From 4d5d871dd1cdc90cd1d913a0c696b7662b9d17e0 Mon Sep 17 00:00:00 2001 From: houshuai <17802598606@163.com> Date: 星期一, 30 六月 2025 17:12:36 +0800 Subject: [PATCH] 线边库基本页面搭建 --- src/views/lsw/LswMateriaView.vue | 232 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 232 insertions(+), 0 deletions(-) diff --git a/src/views/lsw/LswMateriaView.vue b/src/views/lsw/LswMateriaView.vue new file mode 100644 index 0000000..0b726ef --- /dev/null +++ b/src/views/lsw/LswMateriaView.vue @@ -0,0 +1,232 @@ +<template> + <a-card + :bordered="false" + title="绾胯竟搴撶墿鏂欎俊鎭�" + > + <a-button @click="handleAdd" type="primary" icon="plus">鏂板鐗╂枡淇℃伅-娴嬭瘯</a-button> + <a-spin :spinning="confirmLoading"> + <div> + <!-- 涓昏〃鍗曞尯鍩� --> + <a-table + ref="table" + size="middle" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + :loading="loading" + :rowSelection="{ selectedRowKeys: selectedRowKeys, + onChange: onSelectChange, + type: 'radio'}" + @change="handleTableChange"> + </a-table> + </div> + <!-- 瀛愯〃鍗曞尯鍩� --> + <a-tabs v-model="activeKey" @change="handleChangeTabs"> + <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> + </div> + <j-vxe-table + keep-source + :ref="refKeys[0]" + :loading="lswMaterialInventoryTable.loading" + :columns="lswMaterialInventoryTable.columns" + :dataSource="lswMaterialInventoryTable.dataSource" + :maxHeight="300" + :rowNumber="true" + :rowSelection="true" + :toolbar="false" + /> + </a-tab-pane> + </a-tabs> + </a-spin> + <lsw-material-modal ref="modalForm" @ok="modalFormOk" /> + </a-card> +</template> + +<script> + +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' + +export default { + name: 'LswMaterialForm', + mixins: [JVxeTableModelMixin, JeecgListMixin], + components: { + LswMaterialModal, + JFormContainer + }, + data() { + return { + labelCol: { + xs: { span: 24 }, + sm: { span: 5 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + }, + model: {}, + // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁 + addDefaultRowNum: 1, + validatorRules: {}, + selectedRowKeys: [], // 鍒濆鍖栦负绌烘暟缁勶紙鍗曢�夋椂瀛樺偍鍗曚釜key锛� + selectedRowData: null, + refKeys: ['lswMaterialInventory'], + tableKeys: ['lswMaterialInventory'], + activeKey: 'lswMaterialInventory', + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: 'center', + customRender: function(t, r, index) { + return parseInt(index) + 1 + } + }, + { + title: '鐗╂枡缂栫爜', + align: 'center', + dataIndex: 'materialNumber', + customRender: (text) => <strong>{text}</strong> + }, + { + title: '鐗╂枡鍚嶇О', + align: 'center', + dataIndex: 'materialName' + }, + { + title: '鐗╂枡鍨嬪彿', + align: 'center', + dataIndex: 'materialModel' + }, + { + title: '鐗╂枡绫诲瀷', + align: 'center', + dataIndex: 'materialCategory_dictText' + }, + { + title: '鍗曚綅', + align: 'center', + dataIndex: 'materialUnit' + } + ], + // 鐗╂枡搴撳瓨淇℃伅 + lswMaterialInventoryTable: { + loading: false, + dataSource: [], + columns: [ + { + title: '鎵规鍙�', + key: 'batchNumber', + type: JVXETypes.input, + width: '200px', + placeholder: '璇疯緭鍏�${title}', + defaultValue: '' + }, + { + title: '搴撳瓨绫诲瀷', + key: 'inventoryCategory', + type: JVXETypes.input, + width: '200px', + placeholder: '璇疯緭鍏�${title}', + defaultValue: '' + }, + { + title: '鏁伴噺', + key: 'quantity', + type: JVXETypes.input, + width: '200px', + placeholder: '璇疯緭鍏�${title}', + defaultValue: '' + }, + { + title: '搴撳瓨鍦癐D', + key: 'warehouseId', + type: JVXETypes.input, + width: '200px', + placeholder: '璇疯緭鍏�${title}', + defaultValue: '' + }, + { + title: '搴撳瓨鐘舵��', + key: 'inventoryStatus', + type: JVXETypes.input, + width: '200px', + placeholder: '璇疯緭鍏�${title}', + defaultValue: '' + } + ] + }, + url: { + list: '/lswmaterial/lswMaterial/list', + queryById: '/lswmaterial/lswMaterial/queryById', + lswMaterialInventory: { + list: '/lswmaterial/lswMaterial/queryLswMaterialInventoryByMainId' + } + } + } + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + computed: { + formDisabled() { + return this.disabled + }, + totalInventoryQuantity() { + if (!this.lswMaterialInventoryTable.dataSource || this.lswMaterialInventoryTable.dataSource.length === 0) { + return '0'; + } + return this.lswMaterialInventoryTable.dataSource.reduce((sum, item) => { + const quantity = Number(item.quantity) || 0; + return sum + quantity; + }, 0); + }, + }, + created() { + }, + methods: { + handleCustomAdd(){ + console.log('鐐瑰嚮鏂板浜�') + }, + handleTableChange() { + console.log('test---->', this.selectedRowKeys[0]) + }, + async onSelectChange(selectedRowKeys) { + // 鍗曢�夋ā寮忎笅锛宻electedRowKeys 鏄暟缁勶紝浣嗛暱搴︽渶澶氫负1 + console.log('鐐瑰嚮浜�---->') + this.selectedRowKeys = selectedRowKeys + + // 鑾峰彇閫変腑琛岀殑瀹屾暣鏁版嵁 + if (selectedRowKeys.length > 0) { + const selectedId = selectedRowKeys[0] // 閫変腑琛岀殑id + const lswMaterialInventoryResult = await getAction(this.url.lswMaterialInventory.list, { 'id': selectedId }) + this.lswMaterialInventoryTable.dataSource = lswMaterialInventoryResult.result + } + } + + } +} +</script> + +<style scoped> +</style> \ No newline at end of file -- Gitblit v1.9.3