|
|
@@ -136,6 +136,14 @@
|
|
|
// this.getrecipientDep()
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleClose(){
|
|
|
+ this.addRoleDialog = false
|
|
|
+ this.addForm = {
|
|
|
+ name: '',
|
|
|
+ code: '',
|
|
|
+ remark: ''
|
|
|
+ }
|
|
|
+ },
|
|
|
open(type, row) {
|
|
|
if (type == 'add') {
|
|
|
this.dialogTitle = '新建编码规则';
|
|
|
@@ -152,23 +160,6 @@
|
|
|
this.addRoleDialog = true;
|
|
|
this.openType = type;
|
|
|
},
|
|
|
- data() {
|
|
|
- return {
|
|
|
- addRoleDialog: false,
|
|
|
- dialogTitle: '新建编码规则',
|
|
|
- addForm: {
|
|
|
- name: '',
|
|
|
- code: '',
|
|
|
- remark: ''
|
|
|
- },
|
|
|
- addFormRules: {
|
|
|
- name: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
|
|
- code: [{ required: true, message: '请输入编码', trigger: 'blur' }]
|
|
|
- },
|
|
|
- codeConfigurationList: [],
|
|
|
- openType: 'add'
|
|
|
- };
|
|
|
- },
|
|
|
submitAdd() {
|
|
|
const a1 = new Promise((resolve, reject) => {
|
|
|
this.$refs.addForm.validate((valid) => {
|
|
|
@@ -214,77 +205,6 @@
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- methods: {
|
|
|
- open(type, row) {
|
|
|
- if (type == 'add') {
|
|
|
- this.dialogTitle = '新建编码规则';
|
|
|
- this.codeConfigurationList = [];
|
|
|
- } else if (type == 'edit') {
|
|
|
- this.dialogTitle = '编辑编码规则';
|
|
|
- getCodeDetail(row.id).then((res) => {
|
|
|
- this.addForm = { ...res };
|
|
|
- if (this.addForm.codeConfigurationList)
|
|
|
- delete this.addForm.codeConfigurationList;
|
|
|
- this.codeConfigurationList = res.codeConfigurationList;
|
|
|
- });
|
|
|
- }
|
|
|
- this.addRoleDialog = true;
|
|
|
- this.openType = type;
|
|
|
- },
|
|
|
- handleClose() {
|
|
|
- this.restForm();
|
|
|
- this.addRoleDialog = false;
|
|
|
- },
|
|
|
- restForm() {
|
|
|
- this.$refs.myTable.handleReset(); //清空表格校验
|
|
|
- this.$refs.addForm.resetFields();
|
|
|
- this.addForm = {
|
|
|
- name: '',
|
|
|
- code: '',
|
|
|
- remark: ''
|
|
|
- };
|
|
|
- },
|
|
|
- submitAdd() {
|
|
|
- const a1 = new Promise((resolve, reject) => {
|
|
|
- this.$refs.addForm.validate((valid) => {
|
|
|
- if (valid) resolve();
|
|
|
- });
|
|
|
- });
|
|
|
- const a2 = new Promise((resolve, reject) => {
|
|
|
- this.$refs.myTable.validateForm((valid) => {
|
|
|
- if (valid) resolve();
|
|
|
- });
|
|
|
- });
|
|
|
- Promise.all([a1, a2]).then(() => {
|
|
|
- const codeConfigurationList = this.$refs.myTable.getTableValue();
|
|
|
- // codeConfigurationList.map(item=>{
|
|
|
- // item.type = item.type.code
|
|
|
- // })
|
|
|
- let par = {
|
|
|
- code: this.addForm.code,
|
|
|
- name: this.addForm.name,
|
|
|
- remark: this.addForm.remark,
|
|
|
- codeConfigurationList: codeConfigurationList,
|
|
|
- codeManageTreeId: 1
|
|
|
- };
|
|
|
- if (this.openType == 'edit') {
|
|
|
- par.id = this.addForm.id;
|
|
|
- }
|
|
|
- saveNew(par)
|
|
|
- .then((res) => {
|
|
|
- console.log('res', res);
|
|
|
- this.loading = false;
|
|
|
- this.addRoleDialog = false;
|
|
|
- this.$message.success(res);
|
|
|
- this.$emit('done');
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- this.loading = false;
|
|
|
- // this.$message.error(e.message);
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
};
|
|
|
</script>
|