From 0e59e3ebb9f7e9f83c7f906f40d0a562a8a686e8 Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期一, 18 八月 2025 17:07:08 +0800 Subject: [PATCH] 排产功能物料下拉框调整 --- src/views/lsw/LswMateriaView.vue | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 202 insertions(+), 30 deletions(-) diff --git a/src/views/lsw/LswMateriaView.vue b/src/views/lsw/LswMateriaView.vue index 0b726ef..53f0289 100644 --- a/src/views/lsw/LswMateriaView.vue +++ b/src/views/lsw/LswMateriaView.vue @@ -1,9 +1,46 @@ <template> <a-card - :bordered="false" - title="绾胯竟搴撶墿鏂欎俊鎭�" - > - <a-button @click="handleAdd" type="primary" icon="plus">鏂板鐗╂枡淇℃伅-娴嬭瘯</a-button> + :bordered="false"> + <div class="table-page-search-wrapper"> + <a-form layout="inline" @keyup.enter.native="searchQuery"> + <a-row :gutter="24"> + <a-col :xl="4" :lg="7" :md="8" :sm="24"> + <a-form-item label="鐗╂枡缂栫爜"> + <j-input placeholder="璇疯緭鍏ョ墿鏂欑紪鐮�" v-model="queryParam.materialNumber"></j-input> + </a-form-item> + </a-col> + <a-col :xl="6" :lg="7" :md="8" :sm="24"> + <a-form-item label="鐗╂枡鍚嶇О"> + <j-input placeholder="璇疯緭鍏ョ墿鏂欏悕绉�" v-model="queryParam.materialName"></j-input> + </a-form-item> + </a-col> + <a-col :xl="4" :lg="7" :md="8" :sm="24"> + <a-form-item label="鐘舵��"> + <j-dict-select-tag placeholder="璇烽�夋嫨鐘舵��" dictCode="dict_item_status" + v-model="queryParam.materialStatus"></j-dict-select-tag> + </a-form-item> + </a-col> + <a-col :xl="4" :lg="7" :md="8" :sm="24"> + <a-form-item label="鐗╂枡绫诲瀷"> + <j-dict-select-tag placeholder="璇烽�夋嫨鐗╂枡绫诲瀷" dictCode="material_category" + v-model="queryParam.materialCategory"></j-dict-select-tag> + </a-form-item> + </a-col> + <a-col :xl="2" :lg="7" :md="8" :sm="24"> + <a-form-item label="绌虹被鍨�"> + <a-switch v-model="queryParam.materialCategoryNull"></a-switch> + </a-form-item> + </a-col> + <a-col :xl="4" :lg="7" :md="8" :sm="24"> + <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> + <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button> + <a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button> + </span> + </a-col> + </a-row> + </a-form> + </div> + <!-- <a-button @click="handleAdd" type="primary" icon="plus">鏂板鐗╂枡淇℃伅-娴嬭瘯</a-button>--> <a-spin :spinning="confirmLoading"> <div> <!-- 涓昏〃鍗曞尯鍩� --> @@ -12,21 +49,78 @@ size="middle" bordered rowKey="id" + :rowClassName="tableRowClass" :columns="columns" :dataSource="dataSource" :pagination="ipagination" :loading="loading" - :rowSelection="{ selectedRowKeys: selectedRowKeys, - onChange: onSelectChange, - type: 'radio'}" + :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: 'radio'}" @change="handleTableChange"> + <!--鐘舵�佹爮涓�у睍绀�--> + <span + slot="status" + slot-scope="text,record" + > + <a-badge + v-if="record.materialStatus==='1'" + status="success" + /> + <span + v-if="record.materialStatus==='1'" + class="success" + >鍚敤</span> + <a-badge + v-if="record.materialStatus==='0'" + status="error" + /> + <span + v-if="record.materialStatus==='0'" + class="error" + >绂佺敤</span> + </span> + <span + slot="action" + slot-scope="text, record" + > + <a + href="javascript:;" + @click="handleEdit(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-menu-item> + <a-menu-item v-if="record.materialStatus === '1'"> + <a-popconfirm + title="纭畾绂佺敤鍚�?" + @confirm="() => handleActive(record)" + > + <a>绂佺敤</a> + </a-popconfirm> + </a-menu-item> + <a-menu-item v-else> + <a-popconfirm + title="纭畾鍚敤鍚�?" + @confirm="() => handleActive(record)" + > + <a>鍚敤</a> + </a-popconfirm> + </a-menu-item> + </a-menu> + </a-dropdown> + </span> </a-table> </div> <!-- 瀛愯〃鍗曞尯鍩� --> <a-tabs v-model="activeKey" @change="handleChangeTabs"> - <a-tab-pane tab="鐗╂枡搴撳瓨淇℃伅" :key="refKeys[0]" :forceRender="true"> + <a-tab-pane tab="搴撳瓨鏄庣粏" :key="refKeys[0]" :forceRender="true"> <div style="display: flex; align-items: center; margin-bottom: 10px;"> - <span style="margin-right: 10px;">鐗╂枡搴撳瓨淇℃伅</span> <a-tag color="green" style="font-weight: bold;"> 搴撳瓨鎬婚噺锛歿{ totalInventoryQuantity }} </a-tag> @@ -54,8 +148,6 @@ import { getAction } from '@/api/manage' import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' import { JVXETypes } from '@/components/jeecg/JVxeTable' -import { getRefPromise, VALIDATE_FAILED } from '@/components/jeecg/JVxeTable/utils/vxeUtils.js' -import { validateDuplicateValue } from '@/utils/util' import JFormContainer from '@/components/jeecg/JFormContainer' import { JeecgListMixin } from '@/mixins/JeecgListMixin' import LswMaterialModal from '@views/lsw/modules/LswMaterialModal.vue' @@ -109,9 +201,12 @@ dataIndex: 'materialName' }, { - title: '鐗╂枡鍨嬪彿', + title: '鐗╂枡鐘舵��', align: 'center', - dataIndex: 'materialModel' + scopedSlots: { + customRender: 'status' + }, + dataIndex: 'materialStatus' }, { title: '鐗╂枡绫诲瀷', @@ -119,9 +214,16 @@ dataIndex: 'materialCategory_dictText' }, { - title: '鍗曚綅', + title: '鍩烘湰璁¢噺鍗曚綅', align: 'center', dataIndex: 'materialUnit' + }, + { + width: 150, + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + scopedSlots: { customRender: 'action' } } ], // 鐗╂枡搴撳瓨淇℃伅 @@ -154,8 +256,8 @@ defaultValue: '' }, { - title: '搴撳瓨鍦癐D', - key: 'warehouseId', + title: '搴撳瓨鍦�', + key: 'warehouseName', type: JVXETypes.input, width: '200px', placeholder: '璇疯緭鍏�${title}', @@ -172,10 +274,14 @@ ] }, url: { - list: '/lswmaterial/lswMaterial/list', - queryById: '/lswmaterial/lswMaterial/queryById', + //searchlikeQuery + list: '/lsw/lswMaterial/list', + edit: '/lsw/lswMaterial/edit', + active: '/lsw/lswMaterial/active', + inactive: '/lsw/lswMaterial/inactive', + queryById: '/lsw/lswMaterial/queryById', lswMaterialInventory: { - list: '/lswmaterial/lswMaterial/queryLswMaterialInventoryByMainId' + list: '/lsw/lswMaterial/queryLswMaterialInventoryByMainId' } } } @@ -194,39 +300,105 @@ }, totalInventoryQuantity() { if (!this.lswMaterialInventoryTable.dataSource || this.lswMaterialInventoryTable.dataSource.length === 0) { - return '0'; + return '0' } return this.lswMaterialInventoryTable.dataSource.reduce((sum, item) => { - const quantity = Number(item.quantity) || 0; - return sum + quantity; - }, 0); + const quantity = Number(item.quantity) || 0 + return sum + quantity + }, 0) }, }, created() { }, methods: { - handleCustomAdd(){ - console.log('鐐瑰嚮鏂板浜�') - }, - handleTableChange() { - console.log('test---->', this.selectedRowKeys[0]) + //绂佺敤鐘舵�佹牱寮� + tableRowClass(record, index) { + if (record.warehouseStatus != '1') { + return 'frozenRowClass' + } + return '' }, async onSelectChange(selectedRowKeys) { + this.lswMaterialInventoryTable.loading = true // 鍗曢�夋ā寮忎笅锛宻electedRowKeys 鏄暟缁勶紝浣嗛暱搴︽渶澶氫负1 console.log('鐐瑰嚮浜�---->') this.selectedRowKeys = selectedRowKeys - + this.lswMaterialInventoryTable.dataSource = [] // 鑾峰彇閫変腑琛岀殑瀹屾暣鏁版嵁 if (selectedRowKeys.length > 0) { const selectedId = selectedRowKeys[0] // 閫変腑琛岀殑id const lswMaterialInventoryResult = await getAction(this.url.lswMaterialInventory.list, { 'id': selectedId }) this.lswMaterialInventoryTable.dataSource = lswMaterialInventoryResult.result + this.lswMaterialInventoryTable.loading = false } + }, + handleActive(record) { + let url = this.url.active; + if (record.materialStatus === '1') { + url = this.url.inactive + } + let that = this + getAction(url, { id: record.id }).then((res) => { + if (res.success) { + that.$message.success(res.message) + that.loadData() + } else { + that.$message.warning(res.message) + } + }) } } } </script> -<style scoped> +<style lang="less" scoped> +@import '~@assets/less/common.less'; + +.frozenRowClass { + color: #c9c9c9; +} + +.success { + color: green; +} + +.error { + color: red; +} + +.fontweight { + font-weight: bold; +} + +.ant-card-body .table-operator { + margin-bottom: 18px; +} + +.ant-table-tbody .ant-table-row td { + padding-top: 15px; + padding-bottom: 15px; +} + +.anty-row-operator button { + margin: 0 5px; +} + +/deep/ .ant-btn-danger { + background-color: #ffffff; +} + +.ant-modal-cust-warp { + height: 100%; +} + +.ant-modal-cust-warp .ant-modal-body { + height: calc(100% - 110px) !important; + overflow-y: auto; +} + +.ant-modal-cust-warp .ant-modal-content { + height: 90% !important; + overflow-y: hidden; +} </style> \ No newline at end of file -- Gitblit v1.9.3