From 536786768f4dd03ebf2ff76b3a00adc9d1e5c043 Mon Sep 17 00:00:00 2001 From: qushaowei <qushaowei@163.com> Date: 星期四, 22 五月 2025 17:45:08 +0800 Subject: [PATCH] 备件管理、备件库存管理 --- src/views/eam/spare/modules/EamSpareParts/EamSparePartsModal.vue | 2 src/views/eam/spare/EamSparePartsList.vue | 29 +++++ src/views/eam/spare/modules/EamSpareParts/EamSparePartInventoryList.vue | 22 ++-- src/views/eam/spare/modules/EamSpareParts/EamSparePartIntoModal.vue | 233 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 273 insertions(+), 13 deletions(-) diff --git a/src/views/eam/spare/EamSparePartsList.vue b/src/views/eam/spare/EamSparePartsList.vue index e5f9d88..249bec8 100644 --- a/src/views/eam/spare/EamSparePartsList.vue +++ b/src/views/eam/spare/EamSparePartsList.vue @@ -98,6 +98,12 @@ type="primary" icon="plus" >鏂板</a-button> + + <a-button + @click="handleInto" + type="primary" + icon="plus" + >鍏ュ簱</a-button> <!-- <a-button type="primary" icon="download" @@ -198,6 +204,11 @@ ref="modalForm" @ok="modalFormOk" ></eamSpareParts-modal> + + <eamSpare-part-into-modal + ref="intoModalForm" + @ok="modalFormOk" + ></eamSpare-part-into-modal> </a-card> </template> @@ -205,6 +216,7 @@ import '@assets/less/TableExpand.less' import EamSparePartsModal from './modules/EamSpareParts/EamSparePartsModal.vue' import EamSparePartInventoryList from './modules/EamSpareParts/EamSparePartInventoryList.vue' +import EamSparePartIntoModal from './modules/EamSpareParts/EamSparePartIntoModal.vue' import { JeecgListMixin } from '@/mixins/JeecgListMixin' export default { @@ -212,7 +224,8 @@ mixins: [JeecgListMixin], components: { EamSparePartsModal, - EamSparePartInventoryList + EamSparePartInventoryList, + EamSparePartIntoModal }, data() { return { @@ -281,6 +294,11 @@ dataIndex: 'inventoryWarning' }, { + title: '搴撳瓨鎬绘暟', + align: "center", + dataIndex: 'totalQuantity' + }, + { title: '鎿嶄綔', dataIndex: 'action', align: "center", @@ -302,11 +320,20 @@ } }, methods: { + + handleInto() { + this.$refs.intoModalForm.add(); + this.$refs.intoModalForm.title = "鍏ュ簱"; + }, searchReset() { this.queryParam = {} this.onClearSelected() this.loadData(1); }, + searchQuery() { + this.onClearSelected() + this.loadData(1); + }, clickThenSelect(record) { return { on: { diff --git a/src/views/eam/spare/modules/EamSpareParts/EamSparePartIntoModal.vue b/src/views/eam/spare/modules/EamSpareParts/EamSparePartIntoModal.vue new file mode 100644 index 0000000..33b41a5 --- /dev/null +++ b/src/views/eam/spare/modules/EamSpareParts/EamSparePartIntoModal.vue @@ -0,0 +1,233 @@ +<template> + <j-modal + :title="title" + :width="1500" + :visible="visible" + :confirmLoading="confirmLoading" + switchFullscreen + centered + :mask-closable="false" + @ok="handleOk" + @cancel="handleCancel" + cancelText="鍏抽棴" + > + + <a-spin :spinning="spinning"> + <a-form-model + ref="form" + :model="model" + :rules="validatorRules" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-row :gutter="24"> + <j-vxe-table + ref="editableDetailTable" + :rowNumber="true" + :rowSelection="true" + :bordered="true" + :alwaysEdit="true" + :toolbar="true" + keep-source + :height="300" + :loading="detail.loading" + :dataSource="detail.dataSource" + :columns="detail.columns" + style="margin-top: 8px;" + /> + </a-row> + </a-form-model> + </a-spin> + </j-modal> +</template> + +<script> +import { getAction, httpAction } from '@/api/manage' +import { JVxeTableModelMixin } from '@/mixins/JVxeTableModelMixin.js' +import { JVXETypes } from '@/components/jeecg/JVxeTable' + +export default { + name: 'EamSparePartIntoModal', + mixins: [JVxeTableModelMixin], + components: {}, + data() { + return { + title: '鎿嶄綔', + visible: false, + model: {}, + labelCol: { + xs: { span: 24 }, + sm: { span: 6 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 15 } + }, + confirmLoading: false, + spinning: false, + disabled: false, + validatorRules: {}, + url: { + add: '/eam/eamSparePartInventory/add', + edit: '/eam/eamSparePartInventory/edit', + }, + detail: { + loading: false, + dataSource: [], + columns: [ + { + title: '鏉ユ簮绫诲瀷', + key: 'sparePartIntoType', + type: JVXETypes.hidden, + width: '12%', + align: 'center', + defaultValue: '1', + validateRules: [ + { required: true, message: '澶囦欢涓嶈兘涓虹┖锛�' } + ] + }, + { + title: '澶囦欢', + key: 'sparePartId', + type: JVXETypes.select, + width: '12%', + align: 'center', + dictCode: 'eam_spare_parts,part_name,id, del_flag!=\'1\'', + validateRules: [ + { required: true, message: '澶囦欢涓嶈兘涓虹┖锛�' } + ] + }, + { + title: '鎵规鍙�', + key: 'batchNum', + type: JVXETypes.input, + width: '10%', + align: 'center', + validateRules: [ + { required: true, message: '鎵规鍙蜂笉鑳戒负绌猴紒' } + ] + }, + { + title: '鏁伴噺', + key: 'inventory', + type: JVXETypes.inputNumber, + width: '10%', + align: 'center', + validateRules: [ + { required: true, message: '鏁伴噺涓嶈兘涓虹┖锛�' } + ] + }, + { + title: '鍑哄巶鏃ユ湡(鐢熶骇鏃ユ湡)', + key: 'manufactureDate', + type: JVXETypes.datetime, + width: '16%', + align: 'center', + validateRules: [ + { required: false, message: '鍑哄巶鏃ユ湡(鐢熶骇鏃ユ湡)涓嶈兘涓虹┖锛�' } + ] + }, + { + title: '渚涘簲鍟�', + key: 'supplier', + type: JVXETypes.textarea, + width: '15%', + align: 'center', + validateRules: [ + { required: false, message: '渚涘簲鍟嗕笉鑳戒负绌猴紒' } + ] + }, + { + title: '鎴鏈夋晥鏈�', + key: 'expirationOfValidity', + type: JVXETypes.datetime, + width: '16%', + align: 'center', + validateRules: [ + { required: false, message: '鎴鏈夋晥鏈熶笉鑳戒负绌猴紒' } + ] + }, + { + title: '瀛樻斁浣嶇疆', + key: 'location', + type: JVXETypes.textarea, + width: '13%', + align: 'center', + validateRules: [ + { required: false, message: '瀛樻斁浣嶇疆涓嶈兘涓虹┖锛�' } + ] + }, + ] + } + } + }, + created() { + }, + methods: { + add() { + this.model = {} + this.detail.dataSource = [] + this.visible = true + }, + + + async handleOk() { + const that = this + let errMap = await that.$refs.editableDetailTable.validateTable() + if (errMap) { + this.$message.warning('鏁版嵁鏍¢獙澶辫触锛�') + return + } + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + let tableData = that.$refs.editableDetailTable.getTableData() + let removeData = that.$refs.editableDetailTable.getDeleteData() + that.model.eamSparePartInventories = [...tableData] + that.model.removeDetailList = [...removeData] + + that.confirmLoading = that.spinning = true + let httpurl = '' + let method = '' + if (!this.model.id) { + httpurl += this.url.add + method = 'post' + } else { + httpurl += this.url.edit + method = 'put' + } + httpAction(httpurl, this.model, method).then((res) => { + + if (res.success) { + that.$message.success(res.message) + that.$emit('ok') + that.close() + } else { + that.$message.warning(res.message) + } + }).finally(() => { + that.confirmLoading = that.spinning = false + }) + } else { + return false + } + }) + }, + + + + handleCancel() { + this.close() + }, + + close() { + this.$emit('close') + this.visible = false + this.$refs.form.clearValidate() + } + } +} +</script> + +<style lang="less" scoped> +</style> \ No newline at end of file diff --git a/src/views/eam/spare/modules/EamSpareParts/EamSparePartInventoryList.vue b/src/views/eam/spare/modules/EamSpareParts/EamSparePartInventoryList.vue index edfc5b8..80dbf4f 100644 --- a/src/views/eam/spare/modules/EamSpareParts/EamSparePartInventoryList.vue +++ b/src/views/eam/spare/modules/EamSpareParts/EamSparePartInventoryList.vue @@ -81,11 +81,11 @@ return parseInt(index) + 1; } }, - // { - // title: '澶囧搧澶囦欢ID', - // align: "center", - // dataIndex: 'sparePartId' - // }, + { + title: '鏉ユ簮绫诲瀷', + align: "center", + dataIndex: 'sparePartIntoType_dictText' + }, { title: '鎵规鍙�', align: "center", @@ -116,12 +116,12 @@ align: "center", dataIndex: 'location' }, - { - title: '鎿嶄綔', - dataIndex: 'action', - align: "center", - scopedSlots: { customRender: 'action' }, - } + // { + // title: '鎿嶄綔', + // dataIndex: 'action', + // align: "center", + // scopedSlots: { customRender: 'action' }, + // } ], url: { list: "/eam/eamSparePartInventory/list", diff --git a/src/views/eam/spare/modules/EamSpareParts/EamSparePartsModal.vue b/src/views/eam/spare/modules/EamSpareParts/EamSparePartsModal.vue index b80a52f..dbfe962 100644 --- a/src/views/eam/spare/modules/EamSpareParts/EamSparePartsModal.vue +++ b/src/views/eam/spare/modules/EamSpareParts/EamSparePartsModal.vue @@ -1,7 +1,7 @@ <template> <j-modal :title="title" - :width="800" + :width="900" :visible="visible" :confirmLoading="confirmLoading" switchFullscreen -- Gitblit v1.9.3