Przeglądaj źródła

部门检验;

yijing 1 rok temu
rodzic
commit
52df745840

+ 3 - 1
src/components/selectTree/index.vue

@@ -97,7 +97,7 @@
         handler(val) {
           console.log('value变化', val);
           console.log(this.value);
-          this.valueId = this.value;
+          this.valueId = this.value+'';
           this.initHandle();
         },
         deep: true,
@@ -174,6 +174,8 @@
         }
         this.valueTitle = node[this.props.label];
         this.valueId = node[this.props.value];
+
+        this.$emit('input', this.valueId); 
         this.$emit('getValue', node);
         this.defaultExpandedKey = [];
         this.$refs.test.handleClose();

+ 36 - 31
src/views/bpm/handleTask/components/purchaseOrder/returnGoods/submit.vue

@@ -1,11 +1,7 @@
 <template>
   <el-col :span="16" :offset="6">
-    <el-form label-width="100px" ref="formRef" :model="form">
-      <el-form-item label="审批建议" style="margin-bottom: 20px" :rules="{
-        required: true,
-        message: '请选择',
-        trigger: 'change'
-      }">
+    <el-form label-width="100px" ref="formRef" :model="form" :rules="rules">
+      <el-form-item label="审批建议" prop="reason" style="margin-bottom: 20px">
         <el-input type="textarea" v-model="form.reason" placeholder="请输入审批建议" />
       </el-form-item>
     </el-form>
@@ -104,6 +100,11 @@ export default {
       activeComp: '',
       outInData: {
         verifyStatus: ''
+      },
+      rules: {
+        reason: [
+          { required: true, message: '请输入审批建议', trigger: 'blur' },
+        ],
       }
     };
   },
@@ -120,34 +121,38 @@ export default {
   methods: {
     async storemanApprove() {
       this.$refs.formRef.validate(async (valid) => {
-        if (valid) return this.$message.warning('有必填项未填写,请检查')
+        if (valid) {
+          let res = await this.getTableValue();
+          console.log(res, 'resresresresres12')
+          let storageData = res.returnStorageData;
 
-        let res = await this.getTableValue();
-        let storageData = res.returnStorageData;
-        // 出库来源isSkip 0-正常  1-外部(外部跳过内部审核流程)
-        storageData.isSkip = 1;
-        try {
-          this.isSaveLoading = true;
-          await storageApi.outStorage(storageData);
-          approveTaskWithVariables({
-            id: this.taskId,
-            reason: this.form.reason,
-            variables: {
-              pass: true
-            }
-          }).then((res) => {
-            if (res.code != '-1') {
-              this.$emit('handleAudit', {
-                status: 1,
-                title: '出库'
-              });
-            }
+          // 出库来源isSkip 0-正常  1-外部(外部跳过内部审核流程)
+          storageData.isSkip = 1;
+          try {
+            this.isSaveLoading = true;
+
+            await storageApi.outStorage(storageData);
+            approveTaskWithVariables({
+              id: this.taskId,
+              reason: this.form.reason,
+              variables: {
+                pass: true
+              }
+            }).then((res) => {
+              if (res.code != '-1') {
+                this.$emit('handleAudit', {
+                  status: 1,
+                  title: '出库'
+                });
+              }
+              this.isSaveLoading = false;
+            });
+          } catch (error) {
             this.isSaveLoading = false;
-          });
-        } catch (error) {
-          this.isSaveLoading = false;
-          console.error('保存失败:', error);
+            console.error('保存失败:', error);
+          }
         }
+
       })
 
     },

+ 24 - 6
src/views/bpm/outgoingManagement/outbound.vue

@@ -63,7 +63,7 @@
           <el-col :span="6">
             <el-form-item :label="this.bizType == 10 ? '申请人部门' : '领料人部门'" prop="extInfo.verifyDeptCode">
               <selectTree ref="tree" class="form-ipt" size="medium" style="width: 100%" clearable
-                :value="formData.extInfo.verifyDeptCode" :options="treeList" :props="{
+                v-model="formData.extInfo.verifyDeptCode" :options="treeList" :props="{
                   value: 'id',
                   label: 'name',
                   children: 'children'
@@ -346,12 +346,12 @@ export default {
         },
         'extInfo.verifyDeptCode': {
           required: true,
-          message: '请选择领料人部门',
+          message: '请选择部门',
           trigger: 'change'
         },
         fromId: {
           required: true,
-          message: '请选择领料人',
+          message: '请选择',
           trigger: 'change'
         }
       },
@@ -630,10 +630,28 @@ export default {
       this.formData.extInfo.createUserName = this.$store.state.user.info.name;
       this.formData.createUserId = this.$store.state.user.info.userId;
 
-      //获取部门
+      await this.initDeptData();
+
+      // 获取部门信息
       warehouseDefinition.getGroupById(this.form.makerId).then((res) => {
-        this.formData.extInfo.verifyDeptCode = res.groupId;
-        this.formData.extInfo.verifyDeptName = res.groupName;
+        if (res && res.groupId) {
+          this.formData.extInfo.verifyDeptCode = res.groupId;
+          this.formData.extInfo.verifyDeptName = res.groupName;
+          // 手动触发 selectTree 更新
+          this.$nextTick(() => {
+            if (this.$refs.tree) {
+              this.$refs.tree.initHandle();
+            }
+          });
+          // 手动触发验证更新
+          this.$nextTick(() => {
+            this.$refs.formName.validateField('extInfo.verifyDeptCode');
+          });
+        } else {
+          console.error('部门信息获取失败:', res);
+        }
+      }).catch(err => {
+        console.error('获取部门信息出错:', err);
       });
 
       // 生产相关逻辑