Răsfoiți Sursa

fix(文档模板): 修复联合发文部门字段类型错误及批量删除逻辑

liujt 2 luni în urmă
părinte
comite
acc3d041a3

+ 10 - 8
src/views/bpm/documents/documentTemplate/components/mainBodyTemplate.vue

@@ -393,7 +393,7 @@ export default {
     if(this.type == 'add'){
       this.form.issuingAuthority = this.userInfo.groupId || '';
       this.$nextTick(() => {
-        if(this.form.issuingAuthority){
+        if(this.form.issuingAuthority && this.menu == 'template'){
           this.form.draftPersonId = this.userInfo.userId || '';
           this.handleIssuingAuthorityChange(this.form.issuingAuthority);
         }
@@ -500,17 +500,19 @@ export default {
         const { fieldKey, defaultValue } = field;
 
         // 根据字段类型处理数据
-        if (field.fieldType === 'cascader') {
-          
-          // 级联选择器处理,恢复成数组
+        if (field.fieldType === 'multipleCascader') {
+          // 多选级联选择器处理,恢复成数组
           if (typeof defaultValue === 'string' && defaultValue) {
-            console.log('级联选择器值:~~', fieldKey, typeof defaultValue);
+            console.log('多选级联选择器值:~~', fieldKey, typeof defaultValue, defaultValue);
             this.form[fieldKey] = defaultValue.split(',');
           } else if (Array.isArray(defaultValue)) {
             this.form[fieldKey] = defaultValue;
           } else {
             this.form[fieldKey] = [];
           }
+        } else if (field.fieldType === 'cascader') {
+          // 单选级联选择器处理,保持原值
+          this.form[fieldKey] = defaultValue || '';
         } else if (field.fieldType === 'file') {
           // 文件处理,恢复成数组
           if (typeof defaultValue === 'string' && defaultValue) {
@@ -598,7 +600,7 @@ export default {
         {
           fieldKey: 'jointIssuingAuthority',
           fieldName: '联合部门',
-          fieldType: 'cascader',
+          fieldType: 'multipleCascader',
           isRequired: 0,
           placeholder: '请选择联合发文部门',
           defaultValue: [],
@@ -616,7 +618,7 @@ export default {
         {
           fieldKey: 'mainRecipient',
           fieldName: '主送',
-          fieldType: 'cascader',
+          fieldType: 'multipleCascader',
           isRequired: 0,
           placeholder: '请选择部门',
           defaultValue: '',
@@ -625,7 +627,7 @@ export default {
         {
           fieldKey: 'ccRecipient',
           fieldName: '抄送',
-          fieldType: 'cascader',
+          fieldType: 'multipleCascader',
           isRequired: 0,
           placeholder: '请选择部门',
           defaultValue: '',

+ 38 - 10
src/views/bpm/documents/noticeIssuance/index.vue

@@ -27,7 +27,7 @@
       >
         <template v-slot:toolbar>
           <el-button type="primary" @click="toAdd()">新增</el-button>
-          <el-button type="danger" @click="toDelAll()">批量删除</el-button>
+          <el-button type="danger" :disabled="selection.length == 0" @click="batchRemove()">批量删除</el-button>
           <!-- <el-button type="success" @click="toEnd()">导出</el-button> -->
           <el-button type="primary" @click="printing()">打印</el-button>
         </template>
@@ -89,10 +89,16 @@
     <documentDialog ref="documentDialogRef" @done="handleSelectDone" />
     <process-submit-dialog
       :processSubmitDialogFlag.sync="processSubmitDialogFlag"
+      isCloseRefresh="false"
       v-if="processSubmitDialogFlag"
       ref="processSubmitDialogRef"
       @reload="reload"
     ></process-submit-dialog>
+    <pop-modal
+      :visible.sync="delVisible"
+      content="是否确定删除?"
+      @done="commitBtn"
+    />
   </div>
 </template>
 
@@ -104,18 +110,21 @@
   import {
   listOrganizations
 } from '@/api/system/organization';
+import popModal from '@/components/pop-modal';
   
   export default {
     mixins: [tableColumnsMixin],
     components: {
       documentDialog,
-      processSubmitDialog
+      processSubmitDialog,
+      popModal
     },
 
     data() {
       return {
         organizationList: [],
         processSubmitDialogFlag: false,
+        delVisible: false,
         tabValue: '99',
         id: '',
         where: {},
@@ -390,22 +399,41 @@
         this.reload();
       },
 
-      toDelAll() {
+      //移动
+      batchRemove() {
         if (!this.selection.length) {
           return this.$message.warning('请至少选择一条通知!');
         }
-        batchDeleteNotice({
-          ids: this.selection.map((i) => i.id)
-        }).then((res) => {
-          if (res) {
-            this.$message.success('删除成功');
-            this.reload();
-          }
+        if(this.selection.some((i) => i.approvalStatus != 0 && i.approvalStatus != 3)){
+          return this.$message.warning('只有草稿和已驳回的通知能删除');
+        }
+        this.delVisible = true;
+      },
+
+      commitBtn() {
+        const dataId = this.selection.map((v) => v.id);
+        batchDeleteNotice(dataId).then((res) => {
+          this.$message.success('删除成功!');
+          this.reload();
         }).catch((err) => {
           this.$message.error(err.message);
         });
       },
 
+      // toDelAll() {
+        
+      //   batchDeleteNotice({
+      //     ids: this.selection.map((i) => i.id)
+      //   }).then((res) => {
+      //     if (res) {
+      //       this.$message.success('删除成功');
+      //       this.reload();
+      //     }
+      //   }).catch((err) => {
+      //     this.$message.error(err.message);
+      //   });
+      // },
+
       /* 表格数据源 */
       datasource({ page, limit, where, order }) {
         console.log(this.tabValue, '888');