From 363678a54142e62fdd4ca39a0db5c54af1a704dc Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 29 二月 2024 15:39:59 +0800
Subject: [PATCH] 生产调度修改

---
 src/views/plan/customerorder/sample-customerorder-form.vue |  120 +++++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 82 insertions(+), 38 deletions(-)

diff --git a/src/views/plan/customerorder/sample-customerorder-form.vue b/src/views/plan/customerorder/sample-customerorder-form.vue
index 8b895f7..262d1fc 100644
--- a/src/views/plan/customerorder/sample-customerorder-form.vue
+++ b/src/views/plan/customerorder/sample-customerorder-form.vue
@@ -1,7 +1,7 @@
 <template>
   <el-dialog
     width="75%"
-    top="10vh"
+    top="5vh"
     :fullscreen="isFullScreen"
     :close-on-click-modal="false"
     :visible.sync="visible"
@@ -230,7 +230,8 @@
 }
 </style>
 <script>
-import { addObj } from '@/api/plan/customer'
+import { saveOrUpdate } from '@/api/plan/customer'
+import { getCustomerMainAndOrderBycNo } from '@/api/plan/customerorder'
 import { remote } from '@/api/admin/dict'
 import PartDialog from '@/views/common/part.vue'
 import {dateFormat} from '@/util/date'
@@ -267,18 +268,19 @@
       currentSelectRow: 0,
       option: tableOption,
       tableData: [{
-          "$cellEdit": true,
-          "$index": 0,
-          "partNo": "",
-          "customerPartSpec": "",
-          "manufactureAttr": "",
-          "productName": "",
-          "productType": "",
-          "otcUnit": "",
-          "buyQtyDue": "",
-          "shippingAddress": "",
-          "remark": "",
-          "isTrusted": true
+          id: null,
+          $cellEdit: true,
+          $index: 0,
+          partNo: "",
+          customerPartSpec: "",
+          manufactureAttr: "",
+          productName: "",
+          productType: "",
+          otcUnit: "",
+          buyQtyDue: "",
+          shippingAddress: "",
+          remark: "",
+          isTrusted: true
       }],
       staffOptions: [],
       title: '',
@@ -287,6 +289,7 @@
       buttonDisable: false,
       showPart: false,
       dataForm: {
+        id: null,
         contractNo: null,
         customerName: null,
         customerNo: null,
@@ -327,12 +330,46 @@
         this.staffOptions = response.data.data
       })
     },
-    init(id) {
-      this.initDataForm()
-      this.visible = true
-      this.$nextTick(() => {
-        this.title = '鏂板'
-      })
+    init(contractNo) {
+      if(contractNo){
+        getCustomerMainAndOrderBycNo(contractNo).then(res=>{
+            if(res.status===200){
+                let data = res.data.data
+                this.dataForm.id = data.id
+                this.dataForm.contractNo = data.contractNo
+                this.dataForm.customerName = data.customerName
+                this.dataForm.entityName = data.entityName
+                this.dataForm.province = data.province
+                this.salesSelectData = data.salesMan
+                this.dataForm.salesMan = data.salesMan
+                this.dataForm.originalContractStatus = data.originalContractStatus
+                this.dataForm.isCp = data.isCp
+                this.dataForm.customerNo = data.customerNo
+                this.dataForm.returnStatus = data.returnStatus
+                this.dataForm.placeOrderDate = data.placeOrderDate
+                this.dataForm.factoryPlaceOrderDate = data.factoryPlaceOrderDate
+                this.dataForm.deliveryDate = data.deliveryDate
+                this.dataForm.comment = data.comment
+                data.customerOrderVOList.forEach(e=>{
+                    e.$cellEdit = true
+                })
+                this.tableData = data.customerOrderVOList
+                console.log(this.dataForm);
+            }
+        }).catch(error=>{
+            console.error(error)
+        })
+        this.visible = true
+        this.$nextTick(() => {
+            this.title = '缂栬緫'
+        })
+      }else{
+        this.initDataForm()
+        this.visible = true
+        this.$nextTick(() => {
+            this.title = '鏂板'
+        })
+      }
     },
     initDataForm() {
       this.dataForm.contractNo = null
@@ -349,18 +386,19 @@
       this.dataForm.deliveryDate = null
       this.dataForm.comment = null
       this.dataForm.customerOrderVOList = [{
-          "$cellEdit": true,
-          "$index": 0,
-          "partNo": "",
-          "customerPartSpec": "",
-          "manufactureAttr": "",
-          "productName": "",
-          "productType": "",
-          "otcUnit": "",
-          "buyQtyDue": "",
-          "shippingAddress": "",
-          "remark": "",
-          "isTrusted": true
+          id: null,
+          $cellEdit: true,
+          $index: 0,
+          partNo: "",
+          customerPartSpec: "",
+          manufactureAttr: "",
+          productName: "",
+          productType: "",
+          otcUnit: "",
+          buyQtyDue: "",
+          shippingAddress: "",
+          remark: "",
+          isTrusted: true
       }]
     },
     // 琛ㄥ崟鎻愪氦
@@ -387,12 +425,18 @@
       _than.$refs.dataForm.validate((valid) => {
         if (valid) {
           _than.dataForm.customerOrderVOList = _than.tableData
-          addObj(_than.dataForm).then((data) => {
-              _than.$message.success('娣诲姞鎴愬姛')
-              _than.initDataForm();
-              _than.visible = false
-              _than.buttonDisable = false
-              _than.$emit('refreshDataList', 1)
+          saveOrUpdate(_than.dataForm).then((res) => {
+            if(res.status===200){
+                if(_than.dataForm.id){
+                    _than.$message.success('鏇存柊鎴愬姛')
+                }else{
+                    _than.$message.success('娣诲姞鎴愬姛')
+                }
+                _than.initDataForm();
+                _than.visible = false
+                _than.buttonDisable = false
+                _than.$emit('refreshDataList', 1)
+            }
             }).catch((error) => {
               _than.buttonDisable = false
             })

--
Gitblit v1.9.3