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/modules/LswMaterialForm.vue | 220 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 220 insertions(+), 0 deletions(-) diff --git a/src/views/lsw/modules/LswMaterialForm.vue b/src/views/lsw/modules/LswMaterialForm.vue new file mode 100644 index 0000000..8c4958e --- /dev/null +++ b/src/views/lsw/modules/LswMaterialForm.vue @@ -0,0 +1,220 @@ +<template> + <a-spin :spinning="confirmLoading"> + <j-form-container :disabled="formDisabled"> + <!-- 涓昏〃鍗曞尯鍩� --> + <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="materialNumber"> + <a-input v-model="model.materialNumber" placeholder="璇疯緭鍏ョ墿鏂欑紪鐮�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12" > + <a-form-model-item label="鐗╂枡鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialName"> + <a-input v-model="model.materialName" placeholder="璇疯緭鍏ョ墿鏂欏悕绉�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12" > + <a-form-model-item label="鐗╂枡鍨嬪彿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialModel"> + <a-input v-model="model.materialModel" placeholder="璇疯緭鍏ョ墿鏂欏瀷鍙�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12" > + <a-form-model-item label="鐗╂枡绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialCategory"> + <j-dict-select-tag type="list" v-model="model.materialCategory" dictCode="material_category" placeholder="璇烽�夋嫨鐗╂枡绫诲瀷" /> + </a-form-model-item> + </a-col> + <a-col :span="12" > + <a-form-model-item label="鍗曚綅" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialUnit"> + <a-input v-model="model.materialUnit" placeholder="璇疯緭鍏ュ崟浣�" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + <!-- 瀛愯〃鍗曞尯鍩� --> + <a-tabs v-model="activeKey" @change="handleChangeTabs"> + <a-tab-pane tab="鐗╂枡搴撳瓨淇℃伅" :key="refKeys[0]" :forceRender="true"> + <j-vxe-table + keep-source + :ref="refKeys[0]" + :loading="lswMaterialInventoryTable.loading" + :columns="lswMaterialInventoryTable.columns" + :dataSource="lswMaterialInventoryTable.dataSource" + :maxHeight="300" + :disabled="formDisabled" + :rowNumber="true" + :rowSelection="true" + :toolbar="true" + /> + </a-tab-pane> + </a-tabs> + </a-spin> +</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' + + export default { + name: 'LswMaterialForm', + mixins: [JVxeTableModelMixin], + components: { + JFormContainer, + }, + data() { + return { + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + model:{ + }, + // 鏂板鏃跺瓙琛ㄩ粯璁ゆ坊鍔犲嚑琛岀┖鏁版嵁 + addDefaultRowNum: 1, + validatorRules: { + }, + refKeys: ['lswMaterialInventory', ], + tableKeys:['lswMaterialInventory', ], + activeKey: 'lswMaterialInventory', + // 鐗╂枡搴撳瓨淇℃伅 + lswMaterialInventoryTable: { + loading: false, + dataSource: [], + columns: [ + { + title: '鐗╂枡ID', + key: 'materialId', + type: JVXETypes.input, + width:"200px", + placeholder: '璇疯緭鍏�${title}', + defaultValue:'', + }, + { + 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: { + add: "/lswmaterial/lswMaterial/add", + edit: "/lswmaterial/lswMaterial/edit", + queryById: "/lswmaterial/lswMaterial/queryById", + lswMaterialInventory: { + list: '/lswmaterial/lswMaterial/queryLswMaterialInventoryByMainId' + }, + } + } + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + }, + methods: { + addBefore(){ + this.lswMaterialInventoryTable.dataSource=[] + }, + getAllTable() { + let values = this.tableKeys.map(key => getRefPromise(this, key)) + return Promise.all(values) + }, + /** 璋冪敤瀹宔dit()鏂规硶涔嬪悗浼氳嚜鍔ㄨ皟鐢ㄦ鏂规硶 */ + editAfter() { + this.$nextTick(() => { + }) + // 鍔犺浇瀛愯〃鏁版嵁 + if (this.model.id) { + let params = { id: this.model.id } + this.requestSubTableData(this.url.lswMaterialInventory.list, params, this.lswMaterialInventoryTable) + } + }, + //鏍¢獙鎵�鏈変竴瀵逛竴瀛愯〃琛ㄥ崟 + validateSubForm(allValues){ + return new Promise((resolve,reject)=>{ + Promise.all([ + ]).then(() => { + resolve(allValues) + }).catch(e => { + if (e.error === VALIDATE_FAILED) { + // 濡傛灉鏈夋湭閫氳繃琛ㄥ崟楠岃瘉鐨勫瓙琛紝灏辫嚜鍔ㄨ烦杞埌瀹冩墍鍦ㄧ殑tab + this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index] + } else { + console.error(e) + } + }) + }) + }, + /** 鏁寸悊鎴恌ormData */ + classifyIntoFormData(allValues) { + let main = Object.assign(this.model, allValues.formValue) + return { + ...main, // 灞曞紑 + lswMaterialInventoryList: allValues.tablesValue[0].tableData, + } + }, + validateError(msg){ + this.$message.error(msg) + }, + + } + } +</script> + +<style scoped> +</style> \ No newline at end of file -- Gitblit v1.9.3