From 2cb8775339209916fcc889dfa9d5ea7a9f63cd24 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期一, 27 六月 2022 18:08:02 +0800
Subject: [PATCH] 仓库定义、库位定义、物料类型  实现增删查改功能

---
 src/views/wlgl/ckdy.vue |   79 ++++++++++++++++-----------------------
 1 files changed, 32 insertions(+), 47 deletions(-)

diff --git a/src/views/wlgl/ckdy.vue b/src/views/wlgl/ckdy.vue
index 175cf65..dfcfbb4 100644
--- a/src/views/wlgl/ckdy.vue
+++ b/src/views/wlgl/ckdy.vue
@@ -86,7 +86,7 @@
             <template slot-scope="{row}">
               <div class="operationClass">
                 <el-button type="text" @click="edit('edit',row)">淇敼</el-button>
-                <el-button type="text" @click="del(row.id)">鍒犻櫎</el-button>
+                <el-button type="text" @click="del(row)">鍒犻櫎</el-button>
               </div>
             </template>
           </el-table-column>
@@ -114,14 +114,14 @@
       @close="handleClose"
     >
       <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
-        <el-form-item label="浠撳簱缂栫爜" prop="OrgCode">
-          <el-input v-model="dialogForm.OrgCode" :disabled="operation!=='add'" style="width: 220px" />
+        <el-form-item label="浠撳簱缂栫爜" prop="warehousecode">
+          <el-input v-model="dialogForm.warehousecode" :disabled="operation!=='add'" style="width: 220px" />
         </el-form-item>
-        <el-form-item label="浠撳簱鍚嶇О" prop="OrgName">
-          <el-input v-model="dialogForm.OrgName" style="width: 220px" />
+        <el-form-item label="浠撳簱鍚嶇О" prop="warehousename">
+          <el-input v-model="dialogForm.warehousename" style="width: 220px" />
         </el-form-item>
-        <el-form-item label="浠撳簱鎻忚堪" prop="SupUnit">
-          <el-input v-model="dialogForm.OrgName" type="textarea" style="width: 220px" />
+        <el-form-item label="浠撳簱鎻忚堪">
+          <el-input v-model="dialogForm.description" type="textarea" style="width: 220px" />
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
@@ -136,9 +136,7 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import { AddUpdateOrganization, DeleteOrganization, OrganizationSearch, PrentOrganization } from '@/api/jcsz'
-import { getCookie } from '@/utils/auth'
-import { WareHouseDefSearch } from '@/api/wlgl'
+import { AddUpdateWareHouseDef, DeleteWareHouseDef, WareHouseDefSearch } from '@/api/wlgl'
 
 const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
@@ -158,13 +156,6 @@
         }
       }
     }
-    const validateTypeCode = (rule, value, callback) => {
-      if (!value) {
-        return callback(new Error('璇烽�夋嫨涓婄骇'))
-      } else {
-        callback()
-      }
-    }
     return {
       mainHeight: 0,
       tableHeight: 0,
@@ -176,31 +167,27 @@
         prop: 'lm_date', // 鎺掑簭瀛楁
         order: 'desc', // 鎺掑簭瀛楁
         page: 1, // 绗嚑椤�
-        rows: 10 // 姣忛〉澶氬皯鏉�
+        rows: 20 // 姣忛〉澶氬皯鏉�
       },
       total: 10,
       tableData: [],
       dialogVisible: false,
       dialogForm: {
-        OrgType: '',
-        OrgCode: '',
-        OrgName: ''
+        id: '',
+        warehousecode: '',
+        warehousename: '',
+        description: '',
+        OperType: ''
       },
-      dialogFormOrgTypeSelected: '',
       operation: '',
       dialogFormRules: {
-        OrgType: [
-          { required: true, message: '璇疯緭鍏ラ�夋嫨绫诲瀷', trigger: ['blur', 'change'] }
-        ],
-        OrgCode: [
+        warehousecode: [
           { required: true, validator: validateName, trigger: ['blur', 'change'] }
         ],
-        OrgName: [
+        warehousename: [
           { required: true, message: '璇疯緭鍏ュ悕绉�', trigger: ['blur', 'change'] }
-        ],
-        SupUnit: [
-          { required: true, validator: validateTypeCode, trigger: ['blur', 'change'] }
         ]
+
       }
 
     }
@@ -255,21 +242,21 @@
     edit(operation, row) {
       this.operation = operation
       this.dialogVisible = true
-
       this.$nextTick(() => {
-        this.dialogForm.OrgCode = row.org_code
-        this.dialogForm.OrgName = row.org_name
-        this.dialogForm.SupUnit = row.parent_id
+        this.dialogForm.id = row.id
+        this.dialogForm.warehousecode = row.code
+        this.dialogForm.warehousename = row.name
+        this.dialogForm.description = row.description
       })
     },
     // 鍒犻櫎鎸夐挳
-    async del(id) {
+    async del(row) {
       this.$confirm('鏄惁纭鍒犻櫎?', '鎻愮ず', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning'
       }).then(() => {
-        DeleteOrganization({ orgid: id }).then(res => {
+        DeleteWareHouseDef({ warehousecode: row.code }).then(res => {
           if (res.code === '200') {
             this.$message.success('鍒犻櫎鎴愬姛!')
             this.getWareHouseDefSearch()
@@ -281,10 +268,9 @@
     },
     // 瀵硅瘽妗嗗叧闂簨浠�
     handleClose() {
-      this.dialogForm.OrgType = ''
-      this.dialogForm.OrgCode = ''
-      this.dialogForm.OrgName = ''
-      this.dialogForm.SupUnit = ''
+      this.dialogForm.warehousecode = ''
+      this.dialogForm.warehousename = ''
+      this.dialogForm.description = ''
       this.$refs.dialogForm.clearValidate()
     },
     // 瀵硅瘽妗嗗彇娑�
@@ -296,14 +282,13 @@
       this.$refs.dialogForm.validate(valid => {
         if (valid) {
           const data = {
-            OrganType: this.dialogFormOrgTypeSelected,
-            OrganCode: this.dialogForm.OrgCode,
-            OrganName: this.dialogForm.OrgName,
-            SupUnit: this.dialogFormOrgTypeSelected === 'F' ? '0' : this.dialogForm.SupUnit,
-            OperType: this.operation === 'add' ? 'Add' : 'Update',
-            Operator: getCookie('admin')
+            'id': this.dialogForm.id,
+            'warehousecode': this.dialogForm.warehousecode,
+            'warehousename': this.dialogForm.warehousename,
+            'description': this.dialogForm.description,
+            'OperType': this.operation === 'add' ? 'Add' : 'Update'
           }
-          AddUpdateOrganization(data).then(res => {
+          AddUpdateWareHouseDef(data).then(res => {
             if (res.code === '200') {
               this.$message.success(this.operation === 'add' ? '娣诲姞鎴愬姛锛�' : '淇敼鎴愬姛锛�')
               this.dialogVisible = false

--
Gitblit v1.9.3