From da5bd5596b1f0f7a27cd0791a17a7fc3b608f523 Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期三, 07 五月 2025 18:10:24 +0800 Subject: [PATCH] 工具管理-仓库管理页面开发 --- src/views/tms/WarehouseList.vue | 206 +++++++++++++++++++++++++++++++---------- src/views/tms/modules/WarehouseModal.vue | 8 + src/views/tms/modules/WarehouseForm.vue | 23 ++- src/views/tms/WarehouseTree.vue | 28 +--- 4 files changed, 186 insertions(+), 79 deletions(-) diff --git a/src/views/tms/WarehouseList.vue b/src/views/tms/WarehouseList.vue index d99540f..5a467a1 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,8 @@ import { mixinDevice } from '@/utils/mixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin' import WarehouseModal from './modules/WarehouseModal' + import { getAction, putAction, deleteAction } from '../../api/manage' + import moment from 'moment' export default { name: 'WarehouseList', @@ -137,8 +153,16 @@ WarehouseModal }, data () { + const now = moment() + const lastWeek = now.clone().subtract(7,'days') return { description: '浠撳簱绠$悊', + queryParam: { + beginTime: lastWeek.format('YYYY-MM-DD HH:mm'), + endTime: now.format('YYYY-MM-DD HH:mm'), + warehouseName: '', + parentId: '' + }, // 琛ㄥご columns: [ { @@ -164,17 +188,18 @@ { title:'鐖惰妭鐐圭紪鍙�', align:"center", - dataIndex: 'parentId' + dataIndex: 'parentWarehouseId' }, { title:'鐖惰妭鐐瑰悕绉�', align:"center", - dataIndex: 'parentName' + dataIndex: 'parentWarehouseName' }, { title:'鐘舵��', align:"center", - dataIndex: 'status_dictText' + dataIndex: 'status', + scopedSlots: { customRender: 'status' } }, { title:'澶囨敞', @@ -184,12 +209,12 @@ { title:'鍒涘缓浜�', align:"center", - dataIndex: 'createdBy' + dataIndex: 'createBy' }, { title:'鍒涘缓鏃堕棿', align:"center", - dataIndex: 'createdTime', + dataIndex: 'createTime', customRender:function (text) { return !text?"":(text.length>10?text.substr(0,10):text) } @@ -206,6 +231,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 +239,7 @@ }, dictOptions:{}, superFieldList:[], + treeSelected: {}, } }, created() { @@ -222,8 +249,81 @@ importExcelUrl: function(){ return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`; }, + addFlag: function(){ + return !(this.treeSelected.key && this.treeSelected.entity.leafFlag === '2'); + } + }, + mounted() { + this.$bus.$on('getCurrSelected', (data) => { + console.log(data) + this.treeSelected = data; + this.queryParam.parentId = data.key; + this.loadData(); + }); + }, + beforeDestroy() { + this.$bus.$off('getCurrSelected', {}); }, methods: { + handleStatus(record) { + 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) + } + }) + }, + 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); + } + }) + }, + // onBeginTimeChange(date, dateString) { + // this.queryParam.begin_time = dateString[0] + // }, + // onEndTimeChange(date, dateString) { + // this.queryParam.end_time = dateString[0] + // }, + searchReset() { + const now = moment() + const lastWeek = now.clone().subtract(7,'days') + this.queryParam = { + beginTime: lastWeek.format('YYYY-MM-DD HH:mm'), + endTime: now.format('YYYY-MM-DD HH:mm'), + warehouseName: '', + parentId: '' + } + this.treeSelected = {} + this.loadData(1) + this.$bus.$emit('clearTreeSelection') + }, + modalFormOk() { + this.loadData() + this.$bus.$emit('queryTreeData') + }, initDictConfig(){ }, getSuperFieldList(){ @@ -235,8 +335,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 +344,10 @@ </script> <style scoped> @import '~@assets/less/common.less'; + .enable { + color: green; + } + .disable { + color: red; + } </style> \ No newline at end of file diff --git a/src/views/tms/WarehouseTree.vue b/src/views/tms/WarehouseTree.vue index d17e14d..e9a92d7 100644 --- a/src/views/tms/WarehouseTree.vue +++ b/src/views/tms/WarehouseTree.vue @@ -170,8 +170,7 @@ selectedKeys: [], expandedKeys: [], url: { - factoryTreeList: '/base/warehouse/loadTree', - getAllSiteList: '/base/site/getAllList', + warehouseTreeList: '/tms/warehouse/loadTree' }, searchValue: '', dataList: [], @@ -184,24 +183,9 @@ } }, created() { - this.getAllSiteId(); this.queryTreeData(); - this.closeAll(); }, methods: { - getAllSiteId() { - getAction(this.url.getAllSiteList).then((res) => { - if (res.success) { - let allSiteList = res.result; - for (let i = 0; i < allSiteList.length; i++) { - const site = allSiteList[i]; - this.allSiteIds.push(site.id); - } - } else { - this.$message.warn(res.message); - } - }) - }, getCurrSelectedTitle() { return !this.currSelected.title ? '' : this.currSelected.title; }, @@ -223,12 +207,13 @@ queryTreeData() { this.loading = true; this.cardLoading = true; - getAction(this.url.factoryTreeList).then((res) => { + getAction(this.url.warehouseTreeList).then((res) => { if (res.success) { this.dataList = []; this.allTreeKeys = []; this.treeDataSource = res.result; this.generateList(res.result); + this.expandAll() } else { this.$message.warn(res.message); } @@ -302,7 +287,7 @@ this.expandedKeys = this.allTreeKeys; }, closeAll() { - this.expandedKeys = this.allSiteIds; + this.expandedKeys = [] }, refreshTree() { this.queryTreeData(); @@ -310,6 +295,11 @@ }, mounted() { this.$bus.$on('queryTreeData', this.queryTreeData); + this.$bus.$on('clearTreeSelection', this.onClearSelected) + }, + beforeDestroy() { + this.$bus.$off('queryTreeData', this.queryTreeData); + this.$bus.$off('clearTreeSelection', this.onClearSelected) }, //鐩戝惉 watch: { diff --git a/src/views/tms/modules/WarehouseForm.vue b/src/views/tms/modules/WarehouseForm.vue index 2ff4a66..395abe5 100644 --- a/src/views/tms/modules/WarehouseForm.vue +++ b/src/views/tms/modules/WarehouseForm.vue @@ -4,13 +4,13 @@ <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail"> <a-row> <a-col :span="12"> - <a-form-model-item label="鐖惰妭鐐圭紪鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parentId"> - <a-input v-model="model.parentId" placeholder="璇疯緭鍏ョ埗鑺傜偣缂栧彿" ></a-input> + <a-form-model-item label="鐖惰妭鐐圭紪鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input :disabled="true" v-model="model.parentWarehouseId" placeholder="璇疯緭鍏ョ埗鑺傜偣缂栧彿" ></a-input> </a-form-model-item> </a-col> <a-col :span="12"> - <a-form-model-item label="鐖惰妭鐐瑰悕绉�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="parentName"> - <a-input v-model="model.parentName" placeholder="璇疯緭鍏ョ埗鑺傜偣鍚嶇О" ></a-input> + <a-form-model-item label="鐖惰妭鐐瑰悕绉�" :labelCol="labelCol" :wrapperCol="wrapperCol"> + <a-input :disabled="true" v-model="model.parentWarehouseName" placeholder="璇疯緭鍏ョ埗鑺傜偣鍚嶇О" ></a-input> </a-form-model-item> </a-col> <a-col :span="12"> @@ -25,9 +25,9 @@ </a-col> <a-col :span="12"> <a-form-model-item label="鍙跺瓙鑺傜偣鏍囪瘑" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="leafFlag"> - <a-radio-group v-model="model.leafFlag" @change="onChange" placeholder="璇烽�夋嫨鏄惁鍙跺瓙鑺傜偣"> - <a-radio :value="2">鏈夊瓙鑺傜偣</a-radio> - <a-radio :value="1">鏄彾瀛愯妭鐐�</a-radio> + <a-radio-group v-model="model.leafFlag" placeholder="璇烽�夋嫨鏄惁鍙跺瓙鑺傜偣"> + <a-radio :value="'2'">鏈夊瓙鑺傜偣</a-radio> + <a-radio :value="'1'">鏄彾瀛愯妭鐐�</a-radio> </a-radio-group> </a-form-model-item> </a-col> @@ -70,7 +70,7 @@ }, labelCol: { xs: { span: 24 }, - sm: { span: 5 }, + sm: { span: 8 }, }, wrapperCol: { xs: { span: 24 }, @@ -111,7 +111,10 @@ this.modelDefault = JSON.parse(JSON.stringify(this.model)); }, methods: { - add () { + add (treeSelected) { + this.modelDefault.parentId = treeSelected.key + this.modelDefault.parentWarehouseId = treeSelected.entity.warehouseId + this.modelDefault.parentWarehouseName = treeSelected.entity.warehouseName this.edit(this.modelDefault); }, edit (record) { @@ -129,10 +132,12 @@ if(!this.model.id){ httpurl+=this.url.add; method = 'post'; + this.model.status = '1' }else{ httpurl+=this.url.edit; method = 'put'; } + console.log(this.model) httpAction(httpurl,this.model,method).then((res)=>{ if(res.success){ that.$message.success(res.message); diff --git a/src/views/tms/modules/WarehouseModal.vue b/src/views/tms/modules/WarehouseModal.vue index e046771..7d856a7 100644 --- a/src/views/tms/modules/WarehouseModal.vue +++ b/src/views/tms/modules/WarehouseModal.vue @@ -20,6 +20,12 @@ components: { WarehouseForm }, + props: { + treeSelected: { + type: Object, + default: {} + } + }, data () { return { title:'', @@ -32,7 +38,7 @@ add () { this.visible=true this.$nextTick(()=>{ - this.$refs.realForm.add(); + this.$refs.realForm.add(this.treeSelected); }) }, edit (record) { -- Gitblit v1.9.3