From 57ec2038f86f47a87db6b73c0c6eb27c1c25b08e Mon Sep 17 00:00:00 2001
From: hyingbo <1363390067@qq.com>
Date: 星期三, 06 八月 2025 14:16:00 +0800
Subject: [PATCH] 我的已办、仓库管理相关调整

---
 src/views/tms/WarehouseList.vue |  231 ++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 178 insertions(+), 53 deletions(-)

diff --git a/src/views/tms/WarehouseList.vue b/src/views/tms/WarehouseList.vue
index d99540f..9466732 100644
--- a/src/views/tms/WarehouseList.vue
+++ b/src/views/tms/WarehouseList.vue
@@ -5,28 +5,47 @@
       <a-form layout="inline" @keyup.enter.native="searchQuery">
         <a-row :gutter="24">
             <a-col
-              :md="6"
+              :md="5"
               :sm="8"
             >
-              <a-form-item label="搴撴埧鍚嶇О">
+              <a-form-item label="浠撳簱鍚嶇О">
                 <a-input
-                  placeholder="璇疯緭鍏ュ簱鎴垮悕绉�"
+                  placeholder="璇疯緭鍏ヤ粨搴撳悕绉�"
                   v-model="queryParam.warehouseName"
                 ></a-input>
               </a-form-item>
             </a-col>
             <a-col
-              :md="6"
+              :md="7"
               :sm="8"
             >
-              <a-form-item label="闆朵欢缂栧彿">
-                <a-input
-                  placeholder="璇疯緭鍏ラ浂浠剁紪鍙锋煡璇�"
-                  v-model="queryParam.partNum"
-                ></a-input>
+              <a-form-item label="寮�濮嬫椂闂�">
+                <a-date-picker
+                  show-time
+                  placeholder="璇烽�夋嫨寮�濮嬫椂闂�"
+                  format="YYYY-MM-DD HH:mm"
+                  valueFormat="YYYY-MM-DD HH:mm"
+                  v-model="queryParam.beginTime"
+                ></a-date-picker>
                 <!-- :triggerChange="false" -->
               </a-form-item>
             </a-col>
+            <a-col
+              :md="7"
+              :sm="8"
+            >
+              <a-form-item label="缁撴潫鏃堕棿">
+                <a-date-picker
+                  show-time
+                  placeholder="璇烽�夋嫨缁撴潫鏃堕棿"
+                  format="YYYY-MM-DD HH:mm"
+                  valueFormat="YYYY-MM-DD HH:mm"
+                  v-model="queryParam.endTime"
+                ></a-date-picker>
+                <!-- :triggerChange="false" -->
+              </a-form-item>
+            </a-col>
+
 
           <a-col :md="4" :sm="4">
             <a-space>
@@ -41,27 +60,27 @@
 
     <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
     <div class="table-operator">
-      <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button>
+      <a-button @click="handleAdd" :disabled="addFlag" type="primary" icon="plus">鏂板</a-button>
 <!--      <a-button type="primary" icon="download" @click="handleExportXls('tms_warehouse')">瀵煎嚭</a-button>-->
 <!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
 <!--        <a-button type="primary" icon="import">瀵煎叆</a-button>-->
 <!--      </a-upload>-->
       <!-- 楂樼骇鏌ヨ鍖哄煙 -->
 <!--      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
-      <a-dropdown v-if="selectedRowKeys.length > 0">
-        <a-menu slot="overlay">
-          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>鍒犻櫎</a-menu-item>
-        </a-menu>
-        <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 <a-icon type="down" /></a-button>
-      </a-dropdown>
+<!--      <a-dropdown v-if="selectedRowKeys.length > 0">-->
+<!--        <a-menu slot="overlay">-->
+<!--          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>鍒犻櫎</a-menu-item>-->
+<!--        </a-menu>-->
+<!--        <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 <a-icon type="down" /></a-button>-->
+<!--      </a-dropdown>-->
     </div>
 
     <!-- table鍖哄煙-begin -->
     <div>
-      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
-        <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤�
-        <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>
-      </div>
+<!--      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
+<!--        <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤�-->
+<!--        <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>-->
+<!--      </div>-->
 
       <a-table
         ref="table"
@@ -73,39 +92,34 @@
         :dataSource="dataSource"
         :pagination="ipagination"
         :loading="loading"
-        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
+        :rowSelection="null"
         class="j-table-force-nowrap"
         @change="handleTableChange">
 
-        <template slot="htmlSlot" slot-scope="text">
-          <div v-html="text"></div>
-        </template>
-        <template slot="imgSlot" slot-scope="text,record">
-          <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span>
-          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
-        </template>
-        <template slot="fileSlot" slot-scope="text">
-          <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span>
-          <a-button
-            v-else
-            :ghost="true"
-            type="primary"
-            icon="download"
-            size="small"
-            @click="downloadFile(text)">
-            涓嬭浇
-          </a-button>
-        </template>
+        <span slot="status" slot-scope="text, record">
+          <span v-if="text === '1'" class='enable'>鍚敤</span>
+          <span v-if="text === '2'" class='disable'>鍋滅敤</span>
+        </span>
 
         <span slot="action" slot-scope="text, record">
-          <a @click="handleEdit(record)">缂栬緫</a>
+          <a @click="handleDetail(record)">璇︽儏</a>
 
           <a-divider type="vertical" />
           <a-dropdown>
             <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>
             <a-menu slot="overlay">
               <a-menu-item>
-                <a @click="handleDetail(record)">璇︽儏</a>
+                <a @click="handleEdit(record)">缂栬緫</a>
+              </a-menu-item>
+              <a-menu-item v-if="record.status === '1'">
+                <a-popconfirm title="纭畾鍋滅敤鍚�?" @confirm="() => handleStatus(record)">
+                  <a>鍋滅敤</a>
+                </a-popconfirm>
+              </a-menu-item>
+              <a-menu-item v-if="record.status === '2'">
+                <a-popconfirm title="纭畾鍚敤鍚�?" @confirm="() => handleStatus(record)">
+                  <a>鍚敤</a>
+                </a-popconfirm>
               </a-menu-item>
               <a-menu-item>
                 <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
@@ -119,7 +133,7 @@
       </a-table>
     </div>
 
-    <warehouse-modal ref="modalForm" @ok="modalFormOk"></warehouse-modal>
+    <warehouse-modal ref="modalForm" :treeSelected="treeSelected" @ok="modalFormOk"></warehouse-modal>
   </a-card>
 </template>
 
@@ -129,6 +143,7 @@
   import { mixinDevice } from '@/utils/mixin'
   import { JeecgListMixin } from '@/mixins/JeecgListMixin'
   import WarehouseModal from './modules/WarehouseModal'
+  import { getAction, putAction, deleteAction } from '../../api/manage'
 
   export default {
     name: 'WarehouseList',
@@ -164,17 +179,32 @@
           {
             title:'鐖惰妭鐐圭紪鍙�',
             align:"center",
-            dataIndex: 'parentId'
+            dataIndex: 'parentWarehouseId',
+            customRender:function (text,r) {
+              if (r.parentId === '-1') {
+                return '-1';
+              } else {
+                return text;
+              }
+            }
           },
           {
             title:'鐖惰妭鐐瑰悕绉�',
             align:"center",
-            dataIndex: 'parentName'
+            dataIndex: 'parentWarehouseName',
+            customRender:function (text,r) {
+              if (r.parentId === '-1') {
+                return '鑸畤鏁戠敓';
+              } else {
+                return text;
+              }
+            }
           },
           {
             title:'鐘舵��',
             align:"center",
-            dataIndex: 'status_dictText'
+            dataIndex: 'status',
+            scopedSlots: { customRender: 'status' }
           },
           {
             title:'澶囨敞',
@@ -184,15 +214,12 @@
           {
             title:'鍒涘缓浜�',
             align:"center",
-            dataIndex: 'createdBy'
+            dataIndex: 'createBy'
           },
           {
             title:'鍒涘缓鏃堕棿',
             align:"center",
-            dataIndex: 'createdTime',
-            customRender:function (text) {
-              return !text?"":(text.length>10?text.substr(0,10):text)
-            }
+            dataIndex: 'createTime'
           },
           {
             title: '鎿嶄綔',
@@ -206,6 +233,7 @@
         url: {
           list: "/tms/warehouse/list",
           delete: "/tms/warehouse/delete",
+          edit: "/tms/warehouse/edit",
           deleteBatch: "/tms/warehouse/deleteBatch",
           exportXlsUrl: "/tms/warehouse/exportXls",
           importExcelUrl: "tms/warehouse/importExcel",
@@ -213,6 +241,7 @@
         },
         dictOptions:{},
         superFieldList:[],
+        treeSelected: {},
       }
     },
     created() {
@@ -222,8 +251,98 @@
       importExcelUrl: function(){
         return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
       },
+      addFlag: function(){
+        return !(this.treeSelected.key && this.treeSelected.entity.leafFlag === '2');
+      }
+    },
+    mounted() {
+      this.handleGetCurrSelected = (data) => {
+        this.treeSelected = data;
+        this.queryParam.parentId = data.key;
+        this.loadData();
+      }
+      this.$bus.$on('getCurrSelected', this.handleGetCurrSelected);
+    },
+    beforeDestroy() {
+      this.$bus.$off('getCurrSelected', this.handleGetCurrSelected);
     },
     methods: {
+      handleAdd: function () {
+        let nextSeq = 0;
+        // 瀹夊叏鐨勫啓娉�
+        if (this.dataSource && this.dataSource.length > 0) {
+          const lastItem = this.dataSource[this.dataSource.length - 1];
+          if (lastItem && lastItem.seq !== undefined) {
+            nextSeq = Number(lastItem.seq) + 1;
+          } else {
+            // 澶勭悊鏈�鍚庝竴涓厓绱犱笉瀛樺湪seq鐨勬儏鍐�
+            nextSeq = 0; // 鎴栧叾浠栭粯璁ゅ��
+          }
+        } else {
+          // 澶勭悊鏁扮粍涓虹┖鐨勬儏鍐�
+          nextSeq = 0; // 鎴栧叾浠栭粯璁ゅ��
+        }
+        this.$refs.modalForm.add(nextSeq);
+        this.$refs.modalForm.title = "鏂板";
+        this.$refs.modalForm.disableSubmit = false;
+      },
+      handleStatus(record) {
+        getAction(this.url.list, { parentId: record.id }).then((res) => {
+          if (res.success) {
+            if (res.result.total > 0) {
+              this.$message.warning('璇ヨ妭鐐逛笅瀛樺湪瀛愯妭鐐癸紝涓嶈兘鍙樻洿鐘舵�侊紒')
+            } else {
+              const params = {
+                id: record.id,
+                status: record.status === '1' ? '2' : '1'
+              }
+              putAction(this.url.edit, params).then((res) => {
+                if (res.success) {
+                  this.$message.success(res.message)
+                  this.loadData()
+                } else {
+                  this.$message.warning(res.message)
+                }
+              })
+            }
+          } else {
+            this.$message.warning(res.message);
+          }
+        });
+
+      },
+      handleDelete(id) {
+        getAction(this.url.list, { parentId: id }).then((res) => {
+          if (res.success) {
+            if (res.result.total > 0) {
+              this.$message.warning('璇峰厛鍒犻櫎瀛愯妭鐐�');
+            } else {
+              deleteAction(this.url.delete, {id: id}).then((res) => {
+                if (res.success) {
+                  //閲嶆柊璁$畻鍒嗛〉闂
+                  this.loadData()
+                  this.$message.success(res.message);
+                  this.$bus.$emit('queryTreeData')
+                } else {
+                  this.$message.warning(res.message);
+                }
+              });
+            }
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+      },
+      searchReset() {
+        this.queryParam = {
+          parentId: this.treeSelected.key
+        }
+        this.loadData(1)
+      },
+      modalFormOk() {
+        this.loadData()
+        this.$bus.$emit('queryTreeData')
+      },
       initDictConfig(){
       },
       getSuperFieldList(){
@@ -235,8 +354,8 @@
         fieldList.push({type:'string',value:'leafFlag',text:'鏄惁鍙跺瓙鑺傜偣(1鏄�;2鍚�)',dictCode:''})
         fieldList.push({type:'string',value:'status',text:'鐘舵�侊紙1鍚敤;2鍋滅敤锛�',dictCode:''})
         fieldList.push({type:'string',value:'remark',text:'澶囨敞',dictCode:''})
-        fieldList.push({type:'string',value:'createdBy',text:'鍒涘缓浜�',dictCode:''})
-        fieldList.push({type:'date',value:'createdTime',text:'鍒涘缓鏃堕棿'})
+        fieldList.push({type:'string',value:'createBy',text:'鍒涘缓浜�',dictCode:''})
+        fieldList.push({type:'date',value:'createTime',text:'鍒涘缓鏃堕棿'})
         this.superFieldList = fieldList
       }
     }
@@ -244,4 +363,10 @@
 </script>
 <style scoped>
   @import '~@assets/less/common.less';
+  .enable {
+    color: green;
+  }
+  .disable {
+    color: red;
+  }
 </style>
\ No newline at end of file

--
Gitblit v1.9.3