From 98702bbaadf789a36bf1d16223964f4966a933e1 Mon Sep 17 00:00:00 2001
From: payne <bzrlw2012@163.com>
Date: 周二, 23 4月 2024 17:06:49 +0800
Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/iWare_RawMaterialWarehouse

---
 iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue |  158 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 158 insertions(+), 0 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
new file mode 100644
index 0000000..574cf4b
--- /dev/null
+++ b/iWare_RawMaterialWarehouse_Web/src/views/main/WmsBase/WmsMaterial/tabForm.vue
@@ -0,0 +1,158 @@
+<template>
+  <a-modal
+    title="鏂板鐗╂枡淇℃伅"
+    :width="900"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    @ok="handleSubmit"
+    @cancel="handleCancel"
+  >
+    <a-spin :spinning="confirmLoading">
+      <!-- tab -->
+      <a-tabs default-active-key="1" @change="callback">
+        <a-tab-pane key="1" tab="鍩烘湰淇℃伅">
+         <add-form ref="addForm" @ok="handleOk" />
+        </a-tab-pane>
+        <a-tab-pane key="2" tab="鎺у埗灞炴��" force-render>
+          Content of Tab Pane 2
+        </a-tab-pane>
+        <a-tab-pane key="3" tab="鎵规灞炴��">
+          Content of Tab Pane 3
+        </a-tab-pane>
+        <a-tab-pane key="4" tab="鏇夸唬鍝佺鐞�">
+          Content of Tab Pane 4
+        </a-tab-pane>
+        <a-tab-pane key="5" tab="瀹㈡埛">
+          <add-form-base-customer ref="addFormBaseCustomer" @ok="handleOk" />
+        </a-tab-pane>
+        
+        <a-tab-pane key="7" tab="鍖呰鍏崇郴">
+          Content of Tab Pane 6
+        </a-tab-pane>
+      </a-tabs>
+
+    </a-spin>
+  </a-modal>
+</template>
+
+<script>
+import { WmsMaterialAdd, GetAreas, GetStations } from '@/api/modular/main/WmsMaterialManage'
+import addForm from './tabItem/addForm.vue'
+import addFormBaseCustomer from './tabItem/addFormBaseCustomer.vue'
+
+export default {
+  components: {
+    // STable,
+    addForm,
+    addFormBaseCustomer,
+
+    // editForm,
+    // excelForm
+  },
+  data() {
+    return {
+      labelCol: {
+        // xs: { span: 24 },
+        // sm: { span: 5 }
+        span: 8
+      },
+      wrapperCol: {
+        // xs: { span: 24 },
+        // sm: { span: 15 }
+        span: 13
+      },
+      inspectionMethodData: [],
+      materialTypeData: [],
+      areaNameParameterData: [],
+      stationNameParameterData: [],
+      visible: false,
+      confirmLoading: false,
+      form: this.$form.createForm(this)
+    }
+  },
+  methods: {
+    // 鍒濆鍖栨柟娉�
+    add(record) {
+      this.visible = true
+      this.$nextTick(() => {
+        this.getSelects()
+      })
+      const materialTypeOption = this.$options
+      this.materialTypeData = materialTypeOption.filters['dictData']('material_type')
+      const inspectionMethodOption = this.$options
+      this.inspectionMethodData = inspectionMethodOption.filters['dictData']('material_inspection')
+    },
+    getSelects() {
+      if (this.areaNameParameterData.length <= 0 || this.stationNameParameterData.length <= 0) {
+        this.confirmLoading = true
+        Promise.all([GetAreas(), GetStations()])
+          .then(response => {
+            this.areaNameParameterData = response[0].data || []
+            this.stationNameParameterData = response[1].data || []
+            this.confirmLoading = false
+          })
+          .catch(() => {
+            this.confirmLoading = false
+          })
+      }
+    },
+    /**
+     * 鎻愪氦琛ㄥ崟
+     */
+    handleSubmit() {
+      const {
+        form: { validateFields }
+      } = this
+      this.confirmLoading = true
+      validateFields((errors, values) => {
+        if (!errors) {
+          if (this.$getObjectType(values.areas) === 'array') {
+            values.areaIds = values.areas.join(',')
+            values.areaNameParameterArr = values.areas.map(val => {
+              return this.parseSelectName(val, 'areaId', 'areaName', 'areaNameParameterData')
+            })
+            values.areaNameParameter = values.areaNameParameterArr.join(',')
+          }
+          if (this.$getObjectType(values.stations) === 'array') {
+            values.stationIds = values.stations.join(',')
+            values.stationNameParameterArr = values.stations.map(val => {
+              return this.parseSelectName(val, 'stationId', 'stationName', 'stationNameParameterData')
+            })
+            values.stationNameParameter = values.stationNameParameterArr.join(',')
+          }
+          WmsMaterialAdd(values)
+            .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
+        }
+      })
+    },
+    parseSelectName(val, field, nfield, pfield) {
+      let res = val
+      for (let i = 0; i < this[pfield].length; i++) {
+        if (val === this[pfield][i][field]) {
+          res = this[pfield][i][nfield]
+          break
+        }
+      }
+      return res
+    },
+    handleCancel() {
+      this.form.resetFields()
+      this.visible = false
+    }
+  }
+}
+</script>

--
Gitblit v1.9.3