Pārlūkot izejas kodu

feat: 采购订单新增增加历史记录

liujt 3 nedēļas atpakaļ
vecāks
revīzija
d567d293f5

+ 103 - 3
src/views/purchasingManage/purchaseOrder/components/addDialogNew.vue

@@ -502,6 +502,19 @@
       </el-row>
 
       <!-- <headerTitle title="产品清单" style="margin-top: 30px"></headerTitle> -->
+       <headerTitle
+        title="物品清单"
+        style="margin-top: 30px"
+      >
+        <el-button
+          type="primary"
+          size="mini"
+          style="margin-bottom: 5px"
+          @click="orderListShow"
+          v-if="!form.id"
+          >历史记录</el-button
+        ></headerTitle
+      >
       <el-tabs v-model="activeName" style="margin-top: 15px" type="border-card">
         <el-tab-pane label="物品清单" name="1">
           <inventoryTable
@@ -684,6 +697,17 @@
       @changeParent="getPReturnOrderInfo"
       ref="returnOrderDialogRef"
     ></purchase-return-order-dialog>
+
+    <!-- 采购订单   -->
+    <orderListDialog
+      ref="orderListDialogRef"
+      :isMy="true"
+      :contactData="{
+        id: form.partbId
+      }"
+      @changeParent="changeHistoryOrder"
+    ></orderListDialog>
+
     <ele-modal
       custom-class="ele-dialog-form long-dialog-form"
       :visible.sync="supplierListShow"
@@ -774,6 +798,7 @@
   import { formatDate } from '@/utils/dateUtils';
   import { formatPrice } from '@/BIZComponents/setProduct.js';
   import { parameterGetByCode } from '@/api/main/index.js';
+  import orderListDialog from '@/views/purchasingManage/purchaseOrder/invoice/components/orderListDialog.vue';
 
   export default {
     mixins: [dictMixins],
@@ -802,7 +827,8 @@
       returnOrderDialog,
       returnOrderDealDialog,
       purchaseReturnOrderDialog,
-      PaymentCollectionPlan
+      PaymentCollectionPlan,
+      orderListDialog
     },
     data() {
       let formDef = {
@@ -1044,6 +1070,80 @@
       });
     },
     methods: {
+      orderListShow() {
+        if (!this.form.partbName) {
+          this.$message.warning('请先选择供应商');
+          return;
+        }
+        this.$refs.orderListDialogRef.open();
+      },
+      async changeHistoryOrder(item) {
+        console.log('item~~~~', item)
+        const data = await getpurchaseorderDetail(item.id);
+        console.log('data~~~~', data);
+        [
+          'id',
+          'orderId',
+          'createTime',
+          'createUserId',
+          'createUserName',
+          'createDept',
+          'orderNo',
+          'orderStatus',
+          'outboundStatus',
+          'payStatus',
+          'preOrderNo',
+          'progress',
+          'processInstanceId',
+          'orderBomList'
+        ].forEach((key) => {
+          delete data[key];
+          data.productList.forEach((item) => {
+            if (['id', 'createTime', 'createUserId', 'orderId'].includes(key)) {
+              delete item[key];
+            }
+          });
+          data.rawList.forEach((item) => {
+            if (['id', 'createTime', 'createUserId', 'orderId'].includes(key)) {
+              delete item[key];
+            }
+          });
+
+          data.outputList.forEach((item) => {
+            if (['id', 'createTime', 'createUserId', 'orderId'].includes(key)) {
+              delete item[key];
+            }
+          });
+
+          data.receiptPaymentList.forEach((item) => {
+            if (['id', 'createTime', 'createUserId', 'orderId'].includes(key)) {
+              delete item[key];
+            }
+          });
+        });
+
+        this.form = data;
+        if (data) {
+          // data.relationType = +data.relationType;
+          this.$nextTick(() => {
+            this.$store.commit('order/setAllcountAmount', data.totalAmount);
+            this.$refs.inventoryTable &&
+              this.$refs.inventoryTable.putTableValue(data.productList);
+            this.$refs.rawDetailListRef &&
+              this.$refs.rawDetailListRef.putTableValue(data.rawList); //原料
+            this.$refs.outputDetailListRef &&
+              this.$refs.outputDetailListRef.putTableValue(data.outputList); //产成品
+            this.getLinkInfo(data.partaId);
+            
+            this.$refs.paymentCollectionPlanRef && this.$refs.paymentCollectionPlanRef.putTableValue(data);
+            this.getrequireUser(data.requireDeptId);
+            if(data.purchaseDeptId) {
+              this.getPurchaseUser(data.purchaseDeptId);
+            }
+            this.$store.commit('order/setContractId', data.contractId);
+          });
+        }
+      },
       setIssueNumber(len) {
         this.form.issueNumber = len;
       },
@@ -2215,8 +2315,8 @@
               (val) => val.value == this.form.sourceType
             )?.label,
             receiptPaymentList: this.$refs?.paymentCollectionPlanRef?.getTableValue() || [],
-            endSettlementDate: this.form.settlementDate.length ?this.form.settlementDate[1] : '',
-            startSettlementDate: this.form.settlementDate.length ? this.form.settlementDate[0] : ''
+            endSettlementDate: this.form.settlementDate?.length ? this.form.settlementDate[1] : '',
+            startSettlementDate: this.form.settlementDate?.length ? this.form.settlementDate[0] : ''
           });
 
           const ratioSum = commitData.receiptPaymentList.reduce((acc, cur) => acc + +cur.ratio, 0);

+ 26 - 5
src/views/purchasingManage/purchaseOrder/invoice/components/orderListDialog.vue

@@ -52,6 +52,7 @@
 <script>
   import searchTable from '@/views/purchasingManage/purchaseOrder/components/searchTable.vue';
   import { getTableList } from '@/api/purchasingManage/purchaseOrder';
+  import { mapGetters } from 'vuex';
 
   export default {
     components: {
@@ -62,9 +63,21 @@
         type: Object,
         default: () => {}
       },
+      contactData: {
+        type: Object,
+        default: () => {
+          return {};
+        }
+      },
+      isMy: {
+        type: Boolean,
+        default: false
+      },
       isOutsourcing:''
     },
-
+    computed: {
+      ...mapGetters(['user'])
+    },
     data() {
       return {
         visible: false,
@@ -208,15 +221,23 @@
     methods: {
       open(item, currentIndex, isAcc=false) {
         this.currentIndex = currentIndex;
-        if (item && item.id) {
-          this.radio = item.id;
-        }
+        // if (item && item.id) {
+        //   this.radio = item.id;
+        // }
         this.isAcc = isAcc;
         this.visible = true;
       },
 
       /* 表格数据源 */
       datasource({ page, limit, where, order }) {
+        let orderStatus = 2;
+        if (this.contactData.id) {
+          where['partbId'] = this.contactData.id;
+        }
+        if (this.isMy) {
+          where['currentUserId'] = this.user.info.userId;
+          orderStatus = '';
+        }
         if(this.isOutsourcing){
          where['isOutsourcing']=this.isOutsourcing
         }
@@ -224,7 +245,7 @@
           pageNum: page,
           size: limit,
           ...where,
-          orderStatus: 2,
+          orderStatus: orderStatus,
           ...this.searchParams
         });
       },

+ 7 - 0
src/views/saleManage/saleOrder/components/addDialogNew.vue

@@ -1595,8 +1595,15 @@
               delete item[key];
             }
           });
+
+          data.receiptPaymentList.forEach((item) => {
+            if (['id', 'createTime', 'createUserId', 'orderId'].includes(key)) {
+              delete item[key];
+            }
+          });
         });
 
+
         this.form = data;
         if (data) {
           data.saleType = +data.saleType;