Bladeren bron

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-eom into dev

liujt 8 maanden geleden
bovenliggende
commit
133b1fc60d

+ 1 - 1
src/api/exceptionManagement/index.js

@@ -35,7 +35,7 @@ export async function update(data) {
 export async function save(data) {
   const res = await request.post(`/eom/exceptionmanagement/save`, data);
   if (res.data.code == 0) {
-    return res.data.message;
+    return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }

+ 414 - 403
src/views/saleManage/saleOrder/exceptionManagement/components/addOrEditDialog.vue

@@ -207,437 +207,448 @@
 </template>
 
 <script>
-  import dictMixins from '@/mixins/dictMixins';
-  import { getById, update, save } from '@/api/exceptionManagement/index';
-  import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
-  import { getSendSaleOrderConfirmDetail } from '@/api/saleManage/invoiceConfirm';
-  import { getReceiveConfirmDetail } from '@/api/purchasingManage/invoiceConfirm';
-  import { relationTypeOption } from '@/enum/dict.js';
-  import bpmDetail from '@/views/bpm/processInstance/detail.vue';
-  import sendConfirmDialog from '@/views/saleManage/saleOrder/invoiceConfirm/components/sendConfirmDialog.vue';
-  import receiveTListDialog from '@/views/purchasingManage/purchaseOrder/invoiceConfirm/components/receiveTListDialog.vue';
+import dictMixins from '@/mixins/dictMixins';
+import { getById, update, save } from '@/api/exceptionManagement/index';
+import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+import { getSendSaleOrderConfirmDetail } from '@/api/saleManage/invoiceConfirm';
+import { getReceiveConfirmDetail } from '@/api/purchasingManage/invoiceConfirm';
+import { relationTypeOption } from '@/enum/dict.js';
+import bpmDetail from '@/views/bpm/processInstance/detail.vue';
+import sendConfirmDialog from '@/views/saleManage/saleOrder/invoiceConfirm/components/sendConfirmDialog.vue';
+import receiveTListDialog from '@/views/purchasingManage/purchaseOrder/invoiceConfirm/components/receiveTListDialog.vue';
+import { getCurrentUser, setCurrentUser } from '@/utils/token-util';
 
-  const def = {
-    name: '',
-    relationCode: '',
-    relationType: '',
-    relationName: '',
-    relationTypeName: '',
-    relationId: '',
-    detailList: []
-  };
-  export default {
-    mixins: [dictMixins],
-    components: {
-      processSubmitDialog,
-      bpmDetail,
-      sendConfirmDialog,
-      receiveTListDialog
-    },
-    props: {
-      // 1: 销售订单, 2: 采购订单
-      relationType: {
-        default: 1
-      }
-    },
-    created() {
+const def = {
+  name: '',
+  relationCode: '',
+  relationType: '',
+  relationName: '',
+  relationTypeName: '',
+  relationId: '',
+  formCreateUserId: '',
+  detailList: [],
+  currentUser: '',
+  businessId: ''
+};
+export default {
+  mixins: [dictMixins],
+  components: {
+    processSubmitDialog,
+    bpmDetail,
+    sendConfirmDialog,
+    receiveTListDialog
+  },
+  props: {
+    // 1: 销售订单, 2: 采购订单
+    relationType: {
+      default: 1
+    }
+  },
+  created() {
+    this.currentUser = getCurrentUser();
+    console.log(this.currentUser);
+  },
+  data() {
+    return {
+      activeComp: 'main',
+      tabOptions: [
+        { key: 'main', name: '处置详情' },
+        { key: 'bpm', name: '流程详情' }
+      ],
+      title: '',
+      addOrEditDialogFlag: false,
+      fullscreen: false,
+      processSubmitDialogFlag: false,
 
-    },
-    data() {
-      return {
-        activeComp: 'main',
-        tabOptions: [
-          { key: 'main', name: '处置详情' },
-          { key: 'bpm', name: '流程详情' }
-        ],
-        title: '',
-        addOrEditDialogFlag: false,
-        fullscreen: false,
-        processSubmitDialogFlag: false,
+      rules: {
+        name: [{ required: true, message: '请输入名称', trigger: 'change' }],
 
-        rules: {
-          name: [{ required: true, message: '请输入名称', trigger: 'change' }],
+        relationCode: [
+          { required: true, message: '请选择来源', trigger: 'change' }
+        ]
+      },
+      form: { ...def }
+    };
+  },
+  computed: {
+    columns() {
+      return [
+        {
+          width: 45,
+          type: 'index',
+          columnKey: 'index',
+          align: 'center',
+          fixed: 'left'
+        },
 
-          relationCode: [
-            { required: true, message: '请选择来源', trigger: 'change' }
-          ]
+        {
+          width: 220,
+          prop: 'exceptionDetermine',
+          label: '异常类型',
+          slot: 'exceptionDetermine',
+          fixed: 'left',
+          align: 'center',
+          headerSlot: 'headerExceptionDispose'
+        },
+        {
+          width: 220,
+          prop: 'exceptionDispose',
+          label: '处置方式',
+          slot: 'exceptionDispose',
+          fixed: 'left',
+          align: 'center',
+          headerSlot: 'headerExceptionDispose'
+        },
+        {
+          minWidth: 160,
+          prop: 'productCode',
+          label: '编码',
+          showOverflowTooltip: true,
+          align: 'center'
+        },
+        {
+          minWidth: 120,
+          prop: 'productName',
+          label: '名称',
+          showOverflowTooltip: true,
+          align: 'center'
+        },
+        {
+          width: 120,
+          prop: 'specification',
+          label: '规格',
+          slot: 'specification',
+          align: 'center'
+        },
+        {
+          width: 120,
+          prop: 'modelType',
+          label: '型号',
+          slot: 'modelType',
+          align: 'center'
+        },
+        {
+          width: 120,
+          prop: 'productBrand',
+          label: '牌号',
+          align: 'center'
         },
-        form: { ...def }
-      };
-    },
-    computed: {
-      columns() {
-        return [
-          {
-            width: 45,
-            type: 'index',
-            columnKey: 'index',
-            align: 'center',
-            fixed: 'left'
-          },
 
-          {
-            width: 220,
-            prop: 'exceptionDetermine',
-            label: '异常类型',
-            slot: 'exceptionDetermine',
-            fixed: 'left',
-            align: 'center',
-            headerSlot: 'headerExceptionDispose'
-          },
-          {
-            width: 220,
-            prop: 'exceptionDispose',
-            label: '处置方式',
-            slot: 'exceptionDispose',
-            fixed: 'left',
-            align: 'center',
-            headerSlot: 'headerExceptionDispose'
-          },
-          {
-            minWidth: 160,
-            prop: 'productCode',
-            label: '编码',
-            showOverflowTooltip: true,
-            align: 'center'
-          },
-          {
-            minWidth: 120,
-            prop: 'productName',
-            label: '名称',
-            showOverflowTooltip: true,
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'specification',
-            label: '规格',
-            slot: 'specification',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'modelType',
-            label: '型号',
-            slot: 'modelType',
-            align: 'center'
-          },
-          {
-            width: 120,
-            prop: 'productBrand',
-            label: '牌号',
-            align: 'center'
-          },
+        // {
+        //   minWidth: 100,
+        //   prop: 'saleCount',
+        //   label: '发货数量',
+        //   showOverflowTooltip: true,
+        //   align: 'center'
+        // },
+        {
+          minWidth: 100,
+          prop: 'totalCount',
+          slot: 'totalCount',
+          label: '异常数量',
+          showOverflowTooltip: true,
+          align: 'center'
+        },
+        {
+          minWidth: 160,
+          prop: 'batchNo',
+          label: '批次号',
+          showOverflowTooltip: true,
+          slot: 'batchNo',
+          align: 'center'
+        },
+        {
+          minWidth: 160,
+          prop: 'barcodes',
+          label: '发货条码',
+          showOverflowTooltip: true,
+          slot: 'barcodes',
+          align: 'center'
+        },
+        {
+          minWidth: 120,
+          prop: 'materielDesignation',
+          label: '物料代号',
+          showOverflowTooltip: true,
+          align: 'center'
+        },
+        {
+          minWidth: 120,
+          prop: 'clientCode',
+          label: this.relationType == 1 ? '客户代号' : '供应商代号',
+          showOverflowTooltip: true,
+          align: 'center'
+        },
+        {
+          minWidth: 120,
+          prop: 'engrave',
+          label: '刻码',
+          showOverflowTooltip: true,
+          align: 'center'
+        },
+        // {
+        //   minWidth: 160,
+        //   prop: 'packageNo',
+        //   align: 'center',
+        //   label: '包装编码',
+        //   showOverflowTooltip: true
+        // },
+        // {
+        //   minWidth: 100,
+        //   prop: 'packingQuantity',
+        //   align: 'center',
+        //   label: '包装数量',
+        //   showOverflowTooltip: true
+        // },
+        // {
+        //   minWidth: 120,
+        //   prop: 'packingUnit',
+        //   align: 'center',
+        //   label: '包装单位',
+        //   showOverflowTooltip: true
+        // },
 
-          // {
-          //   minWidth: 100,
-          //   prop: 'saleCount',
-          //   label: '发货数量',
-          //   showOverflowTooltip: true,
-          //   align: 'center'
-          // },
-          {
-            minWidth: 100,
-            prop: 'totalCount',
-            slot: 'totalCount',
-            label: '异常数量',
-            showOverflowTooltip: true,
-            align: 'center'
-          },
-          {
-            minWidth: 160,
-            prop: 'batchNo',
-            label: '批次号',
-            showOverflowTooltip: true,
-            slot: 'batchNo',
-            align: 'center'
-          },
-          {
-            minWidth: 160,
-            prop: 'barcodes',
-            label: '发货条码',
-            showOverflowTooltip: true,
-            slot: 'barcodes',
-            align: 'center'
-          },
-          {
-            minWidth: 120,
-            prop: 'materielDesignation',
-            label: '物料代号',
-            showOverflowTooltip: true,
-            align: 'center'
-          },
-          {
-            minWidth: 120,
-            prop: 'clientCode',
-            label: this.relationType == 1 ? '客户代号' : '供应商代号',
-            showOverflowTooltip: true,
-            align: 'center'
-          },
-          {
-            minWidth: 120,
-            prop: 'engrave',
-            label: '刻码',
-            showOverflowTooltip: true,
-            align: 'center'
-          },
-          // {
-          //   minWidth: 160,
-          //   prop: 'packageNo',
-          //   align: 'center',
-          //   label: '包装编码',
-          //   showOverflowTooltip: true
-          // },
-          // {
-          //   minWidth: 100,
-          //   prop: 'packingQuantity',
-          //   align: 'center',
-          //   label: '包装数量',
-          //   showOverflowTooltip: true
-          // },
-          // {
-          //   minWidth: 120,
-          //   prop: 'packingUnit',
-          //   align: 'center',
-          //   label: '包装单位',
-          //   showOverflowTooltip: true
-          // },
+        {
+          minWidth: 150,
+          prop: 'measuringUnit',
+          label: '计量单位',
+          showOverflowTooltip: true,
+          align: 'center'
+        },
+        {
+          minWidth: 120,
+          prop: 'modelKey',
+          label: '机型',
+          showOverflowTooltip: true,
+          align: 'center'
+        },
+        {
+          minWidth: 120,
+          prop: 'colorKey',
+          showOverflowTooltip: true,
+          label: '颜色',
+          align: 'center'
+        },
 
-          {
-            minWidth: 150,
-            prop: 'measuringUnit',
-            label: '计量单位',
-            showOverflowTooltip: true,
-            align: 'center'
-          },
-          {
-            minWidth: 120,
-            prop: 'modelKey',
-            label: '机型',
-            showOverflowTooltip: true,
-            align: 'center',
+        {
+          width: 220,
+          prop: 'describes',
+          label: '描述',
+          slot: 'describes',
+          align: 'center'
+        },
+        {
+          columnKey: 'action',
+          label: '操作',
+          width: 120,
+          align: 'center',
+          resizable: false,
+          slot: 'action',
+          fixed: 'right',
+          showOverflowTooltip: true
+        }
+      ];
+    },
+    options() {
+      return this.relationType == 1
+        ? [
+            { label: '退货入库', value: 1 },
+            { label: '返工返修', value: 2 },
+            { label: '报损', value: 3 },
+            { label: '报废', value: 4 }
+          ]
+        : [
+            { label: '退货出库', value: 1 },
+            { label: '返工返修', value: 2 },
+            { label: '报损', value: 3 },
+            { label: '报废', value: 4 }
+          ];
+    },
+    options1() {
+      return this.relationType == 1
+        ? [
+            { label: '多发', value: 1 },
+            { label: '少发', value: 2 },
+            { label: '错发', value: 3 },
+            { label: '损坏', value: 4 }
+          ]
+        : [
+            { label: '多收', value: 1 },
+            { label: '少收', value: 2 },
+            { label: '错收', value: 3 },
+            { label: '损坏', value: 4 }
+          ];
+    }
+  },
 
-          },
-          {
-            minWidth: 120,
-            prop: 'colorKey',
-            showOverflowTooltip: true,
-            label: '颜色',
-            align: 'center',
+  methods: {
+    openDialog() {
+      let ref =
+        this.relationType == 1
+          ? 'sendConfirmDialogRef'
+          : 'receiveTListDialogRef';
+      this.$refs[ref].open();
+    },
+    //打开新增编辑弹框
+    async open(type, row) {
+      this.title = type == 'edit' ? '处置' : type == 'add' ? '新建' : '详情';
 
-          },
+      this.addOrEditDialogFlag = true;
+      console.log(row);
+      if (row && row?.id) {
+        await this.getById(row?.id);
+      } else {
+        this.form.relationType = this.relationType;
+        this.form.relationTypeName = relationTypeOption[this.relationType];
+      }
+    },
+    async changeParent(data) {
+      console.log('data~~~~~~', this.relationType, data);
+      if (this.relationType == 1) {
+        const res = await getSendSaleOrderConfirmDetail(data.id);
+        this.form.relationCode = res.docNo;
+        this.form.relationId = res.id;
+        this.form.relationName = res.contactName + '-' + res.docNo;
+        this.$set(this.form, 'detailList', res.productList);
+      }
+      if (this.relationType == 2) {
+        const res = await getReceiveConfirmDetail(data.id);
+        this.form.relationCode = res.receiveConfirmNo;
+        this.form.relationId = res.id;
+        res.productList = res.productList.map((item) => {
+          item['clientCode'] = item.supplierMark;
+          return item;
+        });
 
-          {
-            width: 220,
-            prop: 'describes',
-            label: '描述',
-            slot: 'describes',
-            align: 'center'
-          },
-          {
-            columnKey: 'action',
-            label: '操作',
-            width: 120,
-            align: 'center',
-            resizable: false,
-            slot: 'action',
-            fixed: 'right',
-            showOverflowTooltip: true
-          }
-        ];
-      },
-      options() {
-        return this.relationType == 1 ? [
-          { label: '退货入库', value: 1 },
-          { label: '返工返修', value: 2 },
-          { label: '报损', value: 3 },
-          { label: '报废', value: 4 }
-        ] : [
-          { label: '退货出库', value: 1 },
-          { label: '返工返修', value: 2 },
-          { label: '报损', value: 3 },
-          { label: '报废', value: 4 }
-        ]
-      },
-      options1() {
-        return this.relationType == 1
-          ? [
-              { label: '多发', value: 1 },
-              { label: '少发', value: 2 },
-              { label: '错发', value: 3 },
-              { label: '损坏', value: 4 }
-            ]
-          : [
-              { label: '多收', value: 1 },
-              { label: '少收', value: 2 },
-              { label: '错收', value: 3 },
-              { label: '损坏', value: 4 }
-            ];
+        this.form.relationName = res.supplierName + '-' + res.receiveConfirmNo;
+        this.$set(this.form, 'detailList', res.productList);
       }
     },
 
-    methods: {
-      openDialog() {
-        let ref =
-          this.relationType == 1
-            ? 'sendConfirmDialogRef'
-            : 'receiveTListDialogRef';
-        this.$refs[ref].open();
-      },
-      //打开新增编辑弹框
-      async open(type, row) {
-        this.title = type == 'edit' ? '处置' : type == 'add' ? '新建' : '详情';
+    //获取订单详情
+    async getById(id) {
+      this.loading = true;
+      let data = await getById(id);
+      data['relationTypeName'] = relationTypeOption[data.relationType];
 
-        this.addOrEditDialogFlag = true;
-        if (row && row?.id) {
-          await this.getById(row?.id);
-        } else {
-          this.form.relationType = this.relationType;
-          this.form.relationTypeName = relationTypeOption[this.relationType];
-        }
-      },
-      async changeParent(data) {
-        console.log('data~~~~~~', this.relationType, data);
-        if (this.relationType == 1) {
-          const res = await getSendSaleOrderConfirmDetail(data.id);
-          this.form.relationCode = res.docNo;
-          this.form.relationId = res.id;
-          this.form.relationName = res.contactName + '-' + res.docNo;
-          this.$set(this.form, 'detailList', res.productList);
-        }
-        if (this.relationType == 2) {
-          const res = await getReceiveConfirmDetail(data.id);
-          this.form.relationCode = res.receiveConfirmNo;
-          this.form.relationId = res.id;
-          res.productList = res.productList.map((item) => {
-            item['clientCode'] = item.supplierMark;
-            return item;
+      this.loading = false;
+      if (data) {
+        this.form = data;
+      }
+    },
+    getValidate() {
+      return Promise.all([
+        new Promise((resolve, reject) => {
+          this.$refs.form.validate((valid) => {
+            if (!valid) {
+              reject(false);
+            } else {
+              resolve(true);
+            }
           });
-
-          this.form.relationName =
-            res.supplierName + '-' + res.receiveConfirmNo;
-          this.$set(this.form, 'detailList', res.productList);
-        }
-      },
-
-      //获取订单详情
-      async getById(id) {
+        })
+      ]).catch((e) => {
+        this.$message.warning('有必填项未填写,请检查');
+        return Promise.reject(e);
+      });
+    },
+    async save(type) {
+      try {
+        await this.getValidate();
         this.loading = true;
-        let data = await getById(id);
-        data['relationTypeName'] = relationTypeOption[data.relationType];
+        let isExceptionDispose = false;
+        let isExceptionDetermine = false;
 
-        this.loading = false;
-        if (data) {
-          this.form = data;
-        }
-      },
-      getValidate() {
-        return Promise.all([
-          new Promise((resolve, reject) => {
-            this.$refs.form.validate((valid) => {
-              if (!valid) {
-                reject(false);
-              } else {
-                resolve(true);
-              }
-            });
-          })
-        ]).catch((e) => {
-          this.$message.warning('有必填项未填写,请检查');
-          return Promise.reject(e);
-        });
-      },
-      async save(type) {
-        try {
-          await this.getValidate();
-          this.loading = true;
-          let isExceptionDispose = false;
-          let isExceptionDetermine = false;
-          this.form.detailList.forEach((item) => {
-            if (!item.exceptionDispose) {
-              isExceptionDispose = true;
-            }
-
-            if (!item.exceptionDetermine) {
-              isExceptionDetermine = true;
-            }
-          });
-          if (isExceptionDispose) {
-            this.$message.error('处置方式不能为空');
-            return;
+        this.form.formCreateUserId = this.currentUser.currentRoleId;
+        this.form.detailList.forEach((item) => {
+          if (!item.exceptionDispose) {
+            isExceptionDispose = true;
           }
-          if (isExceptionDetermine) {
-            this.$message.error('异常类型不能为空');
-            return;
+
+          if (!item.exceptionDetermine) {
+            isExceptionDetermine = true;
           }
-          let api = this.form.id ? update : save;
-          api(this.form)
-            .then((res) => {
-              this.loading = false;
-              this.$message.success('操作成功');
-              if (type === 'sub') {
-                this.submit(res);
-                return;
-              }
-              this.cancel();
-            })
-            .catch((e) => {
-              this.loading = false;
-            });
-        } catch (error) {
-          console.log(error);
-          // 表单验证未通过,不执行保存操作
+        });
+        if (isExceptionDispose) {
+          this.$message.error('处置方式不能为空');
+          return;
         }
-      },
-      remove(index) {
-        this.form.detailList.splice(index, 1);
-      },
+        if (isExceptionDetermine) {
+          this.$message.error('异常类型不能为空');
+          return;
+        }
+        let api = this.form.id ? update : save;
+        api(this.form)
+          .then((res) => {
+            this.loading = false;
+            this.businessId = res;
+            console.log(this.businessId);
+            this.$message.success('操作成功');
+            if (type === 'sub') {
+              this.submit(res);
+              return;
+            }
+            this.cancel();
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
+      } catch (error) {
+        console.log(error);
+        // 表单验证未通过,不执行保存操作
+      }
+    },
+    remove(index) {
+      this.form.detailList.splice(index, 1);
+    },
 
-      async submit() {
-        this.processSubmitDialogFlag = true;
+    async submit() {
+      this.processSubmitDialogFlag = true;
 
-        this.$nextTick(() => {
-          let params = {
-            businessId: this.form.id,
-            businessKey: 'eom_exception_approve',
-            formCreateUserId: this.form.createUserId,
-            variables: {
-              businessCode: this.form.code,
-              businessName: this.form.name,
-              businessType: this.form.relationName
-            }
-          };
-          this.$refs.processSubmitDialogRef.init(params);
-        });
-      },
-      reload() {
-        this.cancel();
-      },
-      cancel() {
-        this.form = {
-          ...def
+      this.$nextTick(() => {
+        console.log(this.businessId);
+        let params = {
+          businessId: this.form.id || this.businessId || '',
+          businessKey: 'eom_exception_approve',
+          formCreateUserId:
+            this.form.createUserId || this.currentUser?.currentRoleId || '',
+          variables: {
+            businessCode: this.form.code,
+            businessName: this.form.name,
+            businessType: this.form.relationName
+          }
         };
-        this.addOrEditDialogFlag = false;
-        this.$emit('done');
-      }
+        this.$refs.processSubmitDialogRef.init(params);
+      });
+    },
+    reload() {
+      this.cancel();
+    },
+    cancel() {
+      this.form = {
+        ...def
+      };
+      this.addOrEditDialogFlag = false;
+      this.$emit('done');
     }
-  };
+  }
+};
 </script>
 <style scoped lang="scss">
-  .TotalAmount {
-    font-size: 16px;
-    padding-right: 30px;
-  }
+.TotalAmount {
+  font-size: 16px;
+  padding-right: 30px;
+}
 
-  .headbox {
-    display: flex;
-    justify-content: flex-start;
-    align-items: center;
+.headbox {
+  display: flex;
+  justify-content: flex-start;
+  align-items: center;
 
-    .amount {
-      font-size: 14px;
-      font-weight: bold;
-      margin-right: 20px;
-    }
+  .amount {
+    font-size: 14px;
+    font-weight: bold;
+    margin-right: 20px;
   }
+}
 </style>