From 0343f06a2b1097662d12780829f247b094111320 Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周四, 25 4月 2024 14:17:56 +0800
Subject: [PATCH] 生成助记码

---
 iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue |  118 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 87 insertions(+), 31 deletions(-)

diff --git a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue
index 2749b69..6af8f65 100644
--- a/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue
+++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue
@@ -1,5 +1,5 @@
 <template>
-  <a-modal title="鏂板鍩虹鐗╂枡淇℃伅" :width="1200" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit"
+  <a-modal :title="title" :width="1300" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit"
     @cancel="handleCancel">
     <a-spin :spinning="confirmLoading">
       <!-- tab -->
@@ -125,13 +125,16 @@
 </template>
 
 <script>
-import { WmsMaterialAdd, GetAreas, GetStations, materialTypeDataList } from '@/api/modular/main/WmsMaterialManage'
+
+import {
+  WmsMaterialAdd, WmsMaterialEdit, WmsMaterialDetailList,materialTypeDataList
+} from '@/api/modular/main/WmsBase/WmsMaterialManage'
 import addForm from './tabItem/addForm.vue'
 import addFormBaseCustomer from './tabItem/addFormBaseCustomer/addFormBaseCustomer.vue'
 import addFormContainerPackaging from './tabItem/WmsContainerPackaging/addFormContainerPackaging.vue'
 import addFormSub from './tabItem/WmsSubstituteGood/addFormWmsSubstituteGood.vue'
 import addControlRule from './tabItem/WmsControlRule/addForm.vue'
-import { WmsUnitPage, WmsUnitDelete, WmsUnitToExcel } from '@/api/modular/main/WmsBase/WmsUnitManage'
+import { WmsUnitPage} from '@/api/modular/main/WmsBase/WmsUnitManage'
 export default {
   components: {
     addForm,
@@ -142,9 +145,12 @@
   },
   created() {
     this.materialTypeDataList()
+    const materialTypeOption = this.$options
+    this.materialTypeData2 = materialTypeOption.filters['dictData']('abc_class_type')
   },
   data() {
     return {
+      title: '',
       labelCol: {
         // xs: { span: 24 },
         // sm: { span: 5 }
@@ -161,7 +167,10 @@
       stationNameParameterData: [],
       visible: false,
       confirmLoading: false,
-      form: this.$form.createForm(this)
+      form: this.$form.createForm(this),
+      materialTypeData2: [],
+      selectTypeData2:[],
+      selectTypeData1:[]
     }
   },
   methods: {
@@ -206,15 +215,44 @@
     },
     handleOk() { },
     // 鍒濆鍖栨柟娉�
-    add(record) {
+    add(record, type) {
       this.visible = true
-      // this.$nextTick(() => {
-      //   // this.getSelects()
-      // })
-      const materialTypeOption = this.$options
-      this.materialTypeData2 = materialTypeOption.filters['dictData']('abc_class')
-      // const inspectionMethodOption = this.$options
-      // this.inspectionMethodData = inspectionMethodOption.filters['dictData']('material_inspection')
+      if (record) {//缂栬緫
+        if (type == '璇︽儏') {
+          this.title = '璇︽儏鐗╂枡淇℃伅璇︽儏';// 璇︽儏
+        } else {
+          this.title = '缂栬緫鍩虹鐗╂枡淇℃伅';
+        }
+        this.$nextTick(() => {
+          this.form.setFieldsValue({
+            ...record
+          })
+        })
+        WmsMaterialDetailList({
+          id: record.id
+        })
+          .then(res => {
+            if (res.success) {
+              console.log("666666666666")
+              console.log(res)
+              this.$refs.WmsControlRule.list = res.data.baseCustomerList || []
+              this.$refs.addFormBaseCustomer.list = res.data.controlRuleDetailList || []
+              this.$refs.addFormWmsSubstituteGoodRef.list = res.data.substituteGoodList || []
+              // this.$message.success('缂栬緫鎴愬姛')
+              // this.confirmLoading = false
+              // this.$emit('ok', values)
+              // this.handleCancel()
+            } else {
+              this.$message.error('璇︽儏澶辫触锛�' + JSON.stringify(res.message))
+            }
+          })
+          .finally(res => {
+            this.confirmLoading = false
+          })
+
+      } else {
+        this.title = '鏂板鍩虹鐗╂枡淇℃伅';// 鏂板
+      }
     },
     getSelects() {
       if (this.areaNameParameterData.length <= 0 || this.stationNameParameterData.length <= 0) {
@@ -274,7 +312,7 @@
             BaseCustomerList = this.$refs.addFormBaseCustomer.list
 
           }
-          console.log(6666666666666 + '瀹㈡埛妗f闆嗗悎')
+          console.log(6666666666666 + '寰�鏉ュ叧绯婚泦鍚�')
 
           // console.log(6666666666666 + '鍖呰鍏崇郴')
           // console.log(this.$refs.addFormContainerPackagingRef.list)
@@ -283,24 +321,42 @@
             MaterialInput: values,
             ControlRuleld: ControlRuleld, //鎺у埗灞炴��
             SubstituteGoodList: SubstituteGoodList, //鏇夸唬鍝�
-            BaseCustomerList: BaseCustomerList, //瀹㈡埛妗f闆嗗悎
+            BaseCustomerList: BaseCustomerList, //寰�鏉ュ叧绯婚泦鍚�
             // ContainerPackagingList: this.$refs.addFormContainerPackagingRef.list //鍖呰鍏崇郴
           }
           this.confirmLoading = true
-          WmsMaterialAdd(param)
-            .then(res => {
-              if (res.success) {
-                this.$message.success('鏂板鎴愬姛')
+          if (this.title == '鏂板鍩虹鐗╂枡淇℃伅') {
+            WmsMaterialAdd(param)
+              .then(res => {
+                if (res.success) {
+                  this.$message.success('鏂板鎴愬姛')
+                  this.confirmLoading = false
+                  this.$emit('ok', values)
+                  this.handleCancel()
+                } else {
+                  this.$message.error('鏂板澶辫触锛�' + JSON.stringify(res.message))
+                }
+              })
+              .finally(res => {
                 this.confirmLoading = false
-                this.$emit('ok', values)
-                this.handleCancel()
-              } else {
-                this.$message.error('鏂板澶辫触锛�' + JSON.stringify(res.message))
-              }
-            })
-            .finally(res => {
-              this.confirmLoading = false
-            })
+              })
+          } else {
+            WmsMaterialEdit(param)
+              .then(res => {
+                if (res.success) {
+                  this.$message.success('缂栬緫鎴愬姛')
+                  this.confirmLoading = false
+                  this.$emit('ok', values)
+                  this.handleCancel()
+                } else {
+                  this.$message.error('缂栬緫澶辫触锛�' + JSON.stringify(res.message))
+                }
+              })
+              .finally(res => {
+                this.confirmLoading = false
+              })
+          }
+
         } else {
           this.confirmLoading = false
         }
@@ -329,8 +385,8 @@
 </script>
 
 <style lang="less" scoped>
-  .ant-row.ant-form-item {
-    width: 50% !important;
-    display: inline-block;
-  }
+.ant-row.ant-form-item {
+  width: 50% !important;
+  display: inline-block;
+}
 </style>

--
Gitblit v1.9.3