From 1e9fa82cb2fe2c15f46bd1dd73f5c878c74b83b8 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期四, 04 八月 2022 15:35:50 +0800
Subject: [PATCH] 1.系统多账号登录问题2.采购订单页面样式修改及数据渲染

---
 src/views/wlgl/ckdy.vue |  148 +++++++++++++++++++++++++++++++------------------
 1 files changed, 93 insertions(+), 55 deletions(-)

diff --git a/src/views/wlgl/ckdy.vue b/src/views/wlgl/ckdy.vue
index 175cf65..d689952 100644
--- a/src/views/wlgl/ckdy.vue
+++ b/src/views/wlgl/ckdy.vue
@@ -32,6 +32,12 @@
       <el-divider />
       <div style="margin-left: 10px;display: flex">
         <el-button type="primary" icon="el-icon-circle-plus-outline" @click="add('add')">鏂板</el-button>
+        <el-button
+          type="primary"
+          icon="el-icon-refresh-right"
+          @click="syncSeaveSearchWhareHouseLocation"
+        >鍚屾浠撳簱/搴撲綅
+        </el-button>
         <el-button type="primary" icon="el-icon-upload2" @click="upload">瀵煎叆</el-button>
       </div>
       <el-divider />
@@ -39,7 +45,8 @@
         <el-table
           :data="tableData"
           border
-          :height="tableHeight"
+          stripe
+          :height="tableHeight+'px'"
           :style="{width: 100+'%',height:tableHeight+'px',}"
           highlight-current-row
           :header-cell-style="this.$headerCellStyle"
@@ -79,14 +86,15 @@
             prop="lm_date"
             label="鍒涘缓鏃堕棿"
             sortable="custom"
+            width="160"
           />
           <el-table-column
             label="鎿嶄綔"
           >
             <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="edit('edit',row)">缂栬緫</el-button>
+                <el-button type="text" @click="del(row)">鍒犻櫎</el-button>
               </div>
             </template>
           </el-table-column>
@@ -106,22 +114,23 @@
     </div>
 
     <el-dialog
-      :title="operation==='add'?'鏂板':'淇敼'"
+      :title="operation==='add'?'鏂板':'缂栬緫'"
       :visible.sync="dialogVisible"
-      width="50%"
+      width="800px"
+      :close-on-click-modal="false"
       top="15vh"
       @closed="handleClose"
       @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: 200px" />
         </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: 200px" />
         </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: 200px" />
         </el-form-item>
       </el-form>
       <span slot="footer" class="dialog-footer">
@@ -131,20 +140,24 @@
         </div>
       </span>
     </el-dialog>
+
+    <!--瀵煎叆缁勪欢-->
+    <import-picker ref="importPickerFunc" :shows.sync="shows" :title="title_value" :colos="colos" :code="code" />
+
   </div>
 </template>
 
 <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'
+import { SeaveSearchWhareHouseLocation } from '@/api/ErpSyncMes'
+import ImportPicker from '@/components/ImportPicker'
 
 const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
-  name: 'Zzjg',
+  name: 'CKDY',
   components: {
-    Pagination
+    Pagination, ImportPicker
   },
   data() {
     const validateName = (rule, value, callback) => {
@@ -158,13 +171,6 @@
         }
       }
     }
-    const validateTypeCode = (rule, value, callback) => {
-      if (!value) {
-        return callback(new Error('璇烽�夋嫨涓婄骇'))
-      } else {
-        callback()
-      }
-    }
     return {
       mainHeight: 0,
       tableHeight: 0,
@@ -176,33 +182,39 @@
         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'] }
         ]
-      }
+      },
 
+      title_value: '鏁版嵁瀵煎叆 / 浠撳簱銆佸簱浣嶅畾涔�',
+      code: '6',
+      shows: false
+
+    }
+  },
+  watch: {
+    shows() {
+      if (!this.shows) {
+        this.getWareHouseDefSearch()
+      }
     }
   },
   created() {
@@ -217,6 +229,29 @@
       const res = await WareHouseDefSearch(this.form)
       this.tableData = res.data
       this.total = res.count
+    },
+    // 鍚屾浠撳簱/搴撲綅
+    async syncSeaveSearchWhareHouseLocation() {
+      const loading = this.$loading({
+        lock: true,
+        text: '姝e湪鍚屾浠撳簱/搴撲綅锛岃绋嶇瓑...',
+        spinner: 'el-icon-loading',
+        customClass: 'osloading',
+        background: 'rgba(0, 0, 0, 0.7)'
+      })
+      const res = await SeaveSearchWhareHouseLocation()
+      if (res.code === '200') {
+        setTimeout(() => {
+          this.getWareHouseDefSearch()
+          loading.close()
+          this.$message.success('鍚屾鎴愬姛锛�')
+        }, 2000)
+      } else {
+        setTimeout(() => {
+          loading.close()
+          this.$message.error('鍚屾澶辫触锛�')
+        }, 10000)
+      }
     },
     // 鎺掑簭鏀瑰彉鏃�
     sortChange({ column, prop, order }) {
@@ -235,8 +270,13 @@
     search() {
       this.getWareHouseDefSearch()
     },
+    // 瀵煎叆鎸夐挳
     upload() {
-
+      this.shows = true
+      this.$refs.importPickerFunc.newDataFunc()
+    },
+    colos() {
+      this.shows = false
     },
     // 閲嶇疆
     reset() {
@@ -255,21 +295,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 +321,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 +335,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