Эх сурвалжийг харах

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

yusheng 10 сар өмнө
parent
commit
987235a6a9

+ 1 - 1
src/views/saleManage/saleOrder/entrustedReceive/components/addOrEditDialog.vue

@@ -323,7 +323,7 @@
             list.find((key) => key.productCode == item.productCode) || {};
           item.receiveTotalCount = find.receiveTotalCount || 0;
           item.orderTotalCount = item.totalCount || 0;
-          item.totalCount = item.orderTotalCount - item.receiveTotalCount;
+          item.totalCount = item.orderTotalCount - item.receiveTotalCount>=0?item.orderTotalCount - item.receiveTotalCount:0;
         });
         return data;
       },

+ 60 - 78
src/views/saleManage/saleOrder/entrustedReceive/components/inventoryTable.vue

@@ -17,7 +17,7 @@
             type="primary"
             icon="el-icon-plus"
             class="ele-btn-icon"
-            @click="handlAdd"
+            @click="handlAdd('', -1)"
           >
             新增
           </el-button>
@@ -53,7 +53,6 @@
           :prop="'datasource.' + $index + '.customerReqFiles'"
         >
           <fileMain v-model="row.customerReqFiles" type="view"></fileMain>
-      
         </el-form-item>
       </template>
 
@@ -92,16 +91,13 @@
           :prop="'datasource.' + scope.$index + '.warehouseId'"
           :rules="[{ required: true, message: '请选择仓库', trigger: 'blur' }]"
         >
-          <el-select
-            v-model="scope.row.warehouseId"
-            placeholder="请选择"
-            @change="warehouseChange(scope.$index, scope.row)"
-          >
+          <el-select v-model="scope.row.warehouseId" placeholder="请选择">
             <el-option
               v-for="item in warehouseList"
               :key="item.id"
               :label="item.name"
               :value="item.id"
+              @click.native="warehouseChange(scope.$index, scope.row, item)"
             >
             </el-option>
           </el-select>
@@ -135,7 +131,7 @@
     </ele-pro-table>
     <product-list
       ref="productListRef"
-      :orderId="orderId"
+      classType="1"
       @changeParent="changeParent"
     ></product-list>
   </el-form>
@@ -143,7 +139,8 @@
 <script>
   import { emailReg, phoneReg, numberReg } from 'ele-admin';
   import dictMixins from '@/mixins/dictMixins';
-  import productList from './product-list.vue';
+  import productList from '@/BIZComponents/product-list.vue';
+
   import {
     getWarehouseList,
     getWarehouseOutStock
@@ -155,7 +152,7 @@
   import tabMixins from '@/mixins/tableColumnsMixin';
 
   export default {
-    mixins: [dictMixins,tabMixins],
+    mixins: [dictMixins, tabMixins],
     props: {
       orderId: String,
       isShowAdd: {
@@ -186,7 +183,7 @@
         allPrice: 0.0,
         numberReg,
         defaultForm,
-        cacheKeyUrl:'eos-saleManage-entrustedReceive-inventoryTable',
+        cacheKeyUrl: 'eos-saleManage-entrustedReceive-inventoryTable',
         warehouseList: [],
         form: {
           datasource: []
@@ -418,6 +415,7 @@
             slot: 'guaranteePeriod',
             formatter: (_row, _column, cellValue) => {
               return (
+                _row.guaranteePeriod &&
                 (_row.guaranteePeriod || '') + _row.guaranteePeriodUnitName
               );
             },
@@ -505,23 +503,7 @@
       }
     },
     methods: {
-      downloadFile(file) {
-        getFile({ objectName: file.storePath }, file.name);
-      },
-      async warehouseChange(index, row) {
-        let warehouseIds =
-          this.form.datasource
-            .filter(
-              (item, i) => row.productCode == item.productCode && index != i
-            )
-            .map((item) => item.warehouseId) || [];
-        const data = this.warehouseList.find(
-          (item) => item.id == row.warehouseId
-        );
-        if (warehouseIds.length > 0 && warehouseIds.includes(row.warehouseId)) {
-          row.warehouseId = '';
-          return this.$message.error('同一个产品不能选择相同的仓库');
-        }
+      async warehouseChange(index, row, data) {
         this.$set(this.form.datasource[index], 'warehouseName', data.name);
         this.$set(this.form.datasource[index], 'warehouseCode', data.code);
         const warehouseOutStock = await getWarehouseOutStock({
@@ -537,7 +519,6 @@
 
       //修改数量更新合计
       changeNum(val, row, index) {
-        console.log(val, row, index);
         this.$set(
           this.form.datasource[index],
           'receiveTotalWeight',
@@ -557,44 +538,23 @@
       },
       getTotalPrice(row) {
         let num = 0;
-        if (row.pricingWay == 1) {
+        if (row.singlePrice && row.totalCount) {
           num = Number(row.singlePrice) * Number(row.totalCount);
         }
-        if (row.pricingWay == 2) {
-          num =
-            Number(row.singlePrice) *
-            Number(row.totalCount) *
-            Number(row.singleWeight);
-        }
         return num;
       },
       getDiscountTotalPrice(row) {
         let num = 0;
-        if (row.pricingWay == 1) {
+        if (row.discountSinglePrice && row.totalCount) {
           num = Number(row.discountSinglePrice) * Number(row.totalCount);
         }
-        if (row.pricingWay == 2) {
-          num =
-            Number(row.discountSinglePrice) *
-            Number(row.totalCount) *
-            Number(row.singleWeight);
-        }
 
         return num;
       },
-      //选择产品回调
-      changeParent(obj, idx) {
-        obj.orderTotalCount = obj.totalCount;
-        obj.id = '';
-        obj['pricingWay'] = obj.pricingWay || this.pricingWay;
-        this.$set(
-          this.form.datasource,
-          this.form.datasource.length,
-          copyObj(obj)
-        );
-      },
+
       validateTotalCount(row) {
         return (rule, value, callback) => {
+          callback();
           if (isNaN(value) || Number(value) <= 0) {
             callback(new Error('请输入大于0的数字'));
           } else if (
@@ -613,7 +573,7 @@
         if (comitDatasource.length === 0) return [];
         comitDatasource.forEach(async (v) => {
           v.totalCount = Number(v.totalCount);
-          item['pricingWay'] = item.pricingWay || this.pricingWay;
+          // item['pricingWay'] = item.pricingWay || this.pricingWay;
           v.technicalDrawings = Array.isArray(v.technicalDrawings)
             ? v.technicalDrawings
             : [];
@@ -650,33 +610,12 @@
           });
         }
       },
-      //选择产品
-      handParent(row, index) {
-        let item = {
-          id: row.productCode
-        };
-        this.$refs.productListRef.open(item, index);
-      },
-      //选择技术人回调
-      changeAnswer(obj, idx) {
-        this.$set(this.form.datasource[idx], 'technicalAnswerId', obj.id);
-        this.$set(this.form.datasource[idx], 'technicalAnswerName', obj.name);
-      },
-      handHead(row, index) {
-        let item = {
-          id: row.technicalAnswerId
-        };
-        this.$refs.headRef.open(item, index);
-      },
 
       remove(i) {
         this.form.datasource.splice(i, 1);
         this.setSort();
       },
-      // 清空表格
-      restTable() {
-        this.form.datasource = [];
-      },
+
       // 重新排序
       setSort() {
         this.form.datasource.forEach((n, index) => {
@@ -686,9 +625,52 @@
       // 添加
       handlAdd() {
         if (!this.orderId) return this.$message.error('请先选择订单');
-        this.$refs.productListRef.open(this.form.datasource);
+        this.$refs.productListRef.open('', -1);
       },
+      //选择产品回调
+      changeParent(obj, idx) {
+        obj.forEach((item, index) => {
+          let i = idx == -1 ? index : idx;
+          let row = JSON.parse(JSON.stringify(this.defaultForm));
+          row.key = this.form.datasource.length + 1;
+          let parasm = idx == -1 ? row : this.form.datasource[i];
+
+          this.$set(parasm, 'productId', item.id);
+          this.$set(parasm, 'categoryName', item.name);
+          this.$set(parasm, 'productCategoryId', item.categoryLevelId);
+          this.$set(parasm, 'productBrand', item.brandNum);
+          this.$set(parasm, 'productCategoryName', item.categoryLevelPath);
+          this.$set(parasm, 'productCode', item.code);
+          this.$set(parasm, 'productName', item.name);
+          this.$set(parasm, 'modelType', item.modelType);
+          this.$set(parasm, 'availableCountBase', item.availableCountBase);
+          this.$set(parasm, 'measuringUnit', item.measuringUnit);
+          this.$set(parasm, 'specification', item.specification);
+          this.$set(parasm, 'weightUnit', item.weightUnit);
+          this.$set(parasm, 'singleWeight', item.netWeight);
+          this.$set(parasm, 'pricingWay', 1);
+          this.$set(parasm, 'goodsLevel', item.level);
 
+          this.$set(parasm, 'discountSinglePrice', 0);
+          this.$set(parasm, 'singlePrice', 0);
+
+          this.$set(parasm, 'imgCode', item.imgCode);
+          this.$set(parasm, 'produceType', item.componentAttribute);
+
+          this.$set(parasm, 'approvalNumber', item.extField?.approvalNumber);
+          this.$set(
+            parasm,
+            'packingSpecification',
+            item.extField.packingSpecification
+          );
+
+          this.$set(parasm, 'provenance', item.purchaseOrigins || []);
+
+          if (idx == -1) {
+            this.form.datasource.push(row);
+          }
+        });
+      },
       validateForm(callback) {
         //开始表单校验
         this.$refs.form.validate((valid, obj) => {

+ 17 - 15
src/views/saleManage/saleOrder/entrustedReceive/index.vue

@@ -164,12 +164,13 @@
   import {
     deleteSaleEntrustedReceiveAPI,
     getSaleEntrustedReceivePageAPI,
-    submit
+    submit,getPSaleEntrustedReceiveDetailAPI
   } from '@/api/saleManage/entrustedReceive';
   import AddOrEditDialog from '@/views/saleManage/saleOrder/customerReturnOrder/addOrEditDialog.vue';
   import addInvoiceDialog from '@/views/saleManage/saleOrder/invoice/components/addInvoiceDialog.vue';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
   import tabMixins from '@/mixins/tableColumnsMixin';
+  import { getWarehouseListByIds } from '@/api/purchasingManage/returnGoods';
 
   export default {
     mixins: [dictMixins,tabMixins],
@@ -358,7 +359,15 @@
         const dataId = this.selection.map((v) => v.id);
         this.remove(dataId);
       },
-      sendSubmit(res) {
+      async sendSubmit(res) {
+
+        const data = await getPSaleEntrustedReceiveDetailAPI(res.id);
+        let storemanIds = '';
+        let ids = data.productList.map((item) => item.warehouseId);
+        let warehouseList = await getWarehouseListByIds(ids || []);
+        storemanIds = warehouseList.map((item) => item.ownerId);
+
+
         this.processSubmitDialogFlag = true;
         this.$nextTick(() => {
           let params = {
@@ -366,24 +375,17 @@
             businessKey: 'sale_entrusted_receive_approve',
             formCreateUserId: res.createUserId,
             variables: {
-              businessCode: res.code
+              businessCode: res.code,
+              storemanIds: storemanIds.toString(),
+              businessName: res.productNames,
+              businessType: '受托收货'
             }
-            // callBackMethodType : '1',
-            // callBackMethod : 'proTargetPlanApproveApiImpl.updatePlanApprovalStatus',
-            // pcHandle : '/bpm/handleTask/components/project-manage/plan-manage/submit.vue',
-            // pcView : '/bpm/handleTask/components/project-manage/plan-manage/detailDialog.vue',
-            // miniHandle : '',
-            // miniView : '',
+        
           };
 
           this.$refs.processSubmitDialogRef.init(params);
         });
-        // submit({
-        //   businessId: res.id
-        // }).then((res) => {
-        //   this.$message.success('提交成功!');
-        //   this.reload();
-        // });
+     
       },
       //查看详情
       openorderDetail(row, type) {

+ 155 - 61
src/views/saleManage/saleOrder/exceptionManagement/components/addOrEditDialog.vue

@@ -10,15 +10,14 @@
     :maxable="true"
     :resizable="true"
   >
-
-    <div class="switch" v-if="title!='处置'">
+    <div class="switch" v-if="title == '详情'">
       <div class="switch_left">
         <ul>
           <li
             v-for="item in tabOptions"
             :key="item.key"
             :class="{ active: activeComp == item.key }"
-            @click="activeComp=item.key"
+            @click="activeComp = item.key"
           >
             {{ item.name }}
           </li>
@@ -26,11 +25,18 @@
       </div>
     </div>
 
-    <el-form ref="form" :model="form" label-width="120px" class="el-form-box" v-if="activeComp=='main'">
+    <el-form
+      ref="form"
+      :model="form"
+      label-width="120px"
+      class="el-form-box"
+      v-if="activeComp == 'main'"
+      :rules="rules"
+    >
       <headerTitle title="基本信息"></headerTitle>
 
       <el-row :gutter="12">
-        <el-col :span="8">
+        <el-col :span="8" v-if="title != '新建'">
           <el-form-item label="编码" prop="code">
             <el-input
               v-model="form.code"
@@ -42,29 +48,38 @@
 
         <el-col :span="8">
           <el-form-item label="名称" prop="name">
-            <el-input clearable v-model="form.name" :disabled="true" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="8">
-          <el-form-item label="来源类型" prop="relationType">
             <el-input
               clearable
-              v-model="form.relationTypeName"
-              :disabled="true"
+              v-model="form.name"
+              :disabled="title == '详情'"
             />
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="来源编码" prop="relationCode">
-            <el-input clearable v-model="form.relationCode" :disabled="true" />
+          <el-form-item label="来源单据类型" prop="relationType">
+            <el-input v-model="form.relationTypeName" :disabled="true" />
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="来源名称" prop="relationName">
-            <el-input clearable v-model="form.relationName" :disabled="true" />
+          <el-form-item label="来源单据编码" prop="relationCode">
+            <el-input
+              v-model="form.relationCode"
+              :disabled="title == '详情'"
+              redaonly
+              @click.native="$refs.sendConfirmDialogRef.open()"
+            />
           </el-form-item>
         </el-col>
         <el-col :span="8">
+          <el-form-item label="来源单据名称" prop="relationName">
+            <el-input
+              clearable
+              v-model="form.relationName"
+              :disabled="title == '详情'"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8" v-if="title != '新建'">
           <el-form-item label="创建人" prop="createUserName">
             <el-input
               clearable
@@ -73,55 +88,70 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="8">
+        <el-col :span="8" v-if="title != '新建'">
           <el-form-item label="创建时间" prop="createTime">
             <el-input clearable v-model="form.createTime" :disabled="true" />
           </el-form-item>
         </el-col>
       </el-row>
       <headerTitle title="物品清单" style="margin-top: 30px"></headerTitle>
-    <ele-pro-table
-      ref="table"
-      :needPage="false"
-      :columns="columns"
-      :toolkit="[]"
-      :datasource="form.detailList"
-      row-key="id"
-    >
-      <template v-slot:headerExceptionDispose="{ column }">
-        <span class="is-required">{{ column.label }}</span>
-      </template>
-      <template v-slot:exceptionDispose="scope">
-        <el-select v-model="scope.row.exceptionDispose" 
-        :disabled="title!='处置'"
-        placeholder="请选择">
-          <el-option
-            v-for="item in options"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
+      <ele-pro-table
+        ref="table"
+        :needPage="false"
+        :columns="columns"
+        :toolkit="[]"
+        :datasource="form.detailList"
+        row-key="id"
+      >
+        <template v-slot:headerExceptionDispose="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
+        <template v-slot:exceptionDispose="scope">
+          <el-select
+            v-model="scope.row.exceptionDispose"
+            :disabled="title == '详情'"
+            placeholder="请选择"
+          >
+            <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </template>
+        <template v-slot:exceptionDetermine="scope">
+          <el-select
+            v-model="scope.row.exceptionDetermine"
+            :disabled="title== '详情'"
+            placeholder="请选择"
           >
-          </el-option>
-        </el-select>
-      </template>
-    </ele-pro-table>
+            <el-option
+              v-for="item in options1"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </template>
+      </ele-pro-table>
     </el-form>
 
-
-
     <div slot="footer" class="footer">
       <el-button
         type="primary"
         @click="save"
         v-click-once
-        v-if="title == '处置'"
+        v-if="title != '详情'"
         >保存</el-button
       >
       <el-button
         type="primary"
         @click="save('sub')"
         v-click-once
-        v-if="title == '处置'"
+        v-if="title != '详情'"
         >提交</el-button
       >
 
@@ -139,6 +169,7 @@
       ref="processSubmitDialogRef"
       @reload="reload"
     ></process-submit-dialog>
+    <sendConfirmDialog ref="sendConfirmDialogRef" @changeParent="changeParent"></sendConfirmDialog>
   </ele-modal>
 </template>
 
@@ -146,20 +177,25 @@
   import dictMixins from '@/mixins/dictMixins';
   import { getById, update } from '@/api/exceptionManagement/index';
   import processSubmitDialog from '@/BIZComponents/processSubmitDialog/processSubmitDialog.vue';
+  import {
+    getSendSaleOrderConfirmDetail,
+  } from '@/api/saleManage/invoiceConfirm';
   import { relationType } from '@/enum/dict.js';
   import bpmDetail from '@/views/bpm/processInstance/detail.vue';
+  import sendConfirmDialog from '@/views/saleManage/saleOrder/invoiceConfirm/components/sendConfirmDialog.vue';
   export default {
     mixins: [dictMixins],
     components: {
-      processSubmitDialog,bpmDetail
+      processSubmitDialog,
+      bpmDetail,
+      sendConfirmDialog
     },
     data() {
       return {
         activeComp: 'main',
         tabOptions: [
           { key: 'main', name: '处置详情' },
-          { key: 'bpm', name: '流程详情' },
-       
+          { key: 'bpm', name: '流程详情' }
         ],
         title: '',
         addOrEditDialogFlag: false,
@@ -171,7 +207,28 @@
           { label: '报损', value: 3 },
           { label: '报废', value: 4 }
         ],
-        form: {},
+        options1: [
+          { label: '多发', value: 1 },
+          { label: '少发', value: 2 },
+          { label: '错发', value: 3 },
+          { label: '损坏', value: 4 }
+        ],
+
+        rules: {
+          name: [{ required: true, message: '请输入名称', trigger: 'change' }],
+
+          relationCode: [
+            { required: true, message: '请选择来源', trigger: 'change' }
+          ]
+        },
+        form: {
+          name: '',
+          relationCode: '',
+          relationType: '',
+          relationName: '',
+          relationTypeName: '',
+          relationId:''
+        },
         columns: [
           {
             width: 45,
@@ -180,6 +237,16 @@
             align: 'center',
             fixed: 'left'
           },
+
+          {
+            width: 220,
+            prop: 'exceptionDetermine',
+            label: '异常类型',
+            slot: 'exceptionDetermine',
+            fixed: 'left',
+            align: 'center',
+            headerSlot: 'headerExceptionDispose'
+          },
           {
             width: 220,
             prop: 'exceptionDispose',
@@ -203,7 +270,20 @@
             showOverflowTooltip: true,
             align: 'center'
           },
-
+          {
+            minWidth: 100,
+            prop: 'totalCount',
+            label: '发货数量',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            minWidth: 100,
+            prop: 'totalCount',
+            label: '异常数量',
+            showOverflowTooltip: true,
+            align: 'center'
+          },
           {
             minWidth: 160,
             prop: 'batchNo',
@@ -262,13 +342,7 @@
             label: '包装单位',
             showOverflowTooltip: true
           },
-          {
-            minWidth: 100,
-            prop: 'totalCount',
-            label: '计量数量',
-            showOverflowTooltip: true,
-            align: 'center'
-          },
+
           {
             minWidth: 150,
             prop: 'measuringUnit',
@@ -334,14 +408,23 @@
     methods: {
       //打开新增编辑弹框
       async open(type, row) {
-        console.log(type,'type')
-        this.title = type == 'edit' ? '处置' : '详情';
+        this.title = type == 'edit' ? '处置' : type == 'add' ? '新建' : '详情';
 
         this.addOrEditDialogFlag = true;
         if (row && row?.id) {
           await this.getById(row?.id);
+        } else {
+          this.form.relationType = 1;
+          this.form.relationTypeName = relationType[1];
         }
       },
+      async changeParent(data){
+       const res= await getSendSaleOrderConfirmDetail(data.id)
+       this.form.relationCode=res.docNo
+       this.form.relationId=res.id
+       this.form.relationName=res.contactName+'-'+res.docNo
+       this.form.detailList=res.productList
+      },
 
       //获取订单详情
       async getById(id) {
@@ -357,16 +440,27 @@
       async save(type) {
         try {
           this.loading = true;
-          let is = false;
+          let isExceptionDispose = false;
+          let isExceptionDetermine = false;
           this.form.detailList.forEach((item) => {
+            if (!item.exceptionDispose) {
+              isExceptionDispose = true;
+            }
             if (!item.exceptionDispose) {
               is = true;
             }
+            if (!item.exceptionDetermine) {
+              isExceptionDetermine = true;
+            }
           });
-          if (is) {
+          if (isExceptionDispose) {
             this.$message.error('处置方式不能为空');
             return;
           }
+          if (isExceptionDetermine) {
+            this.$message.error('异常类型不能为空');
+            return;
+          }
           update(this.form)
             .then((res) => {
               this.loading = false;