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/LswMaterialInventoryForm.vue | 129 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 129 insertions(+), 0 deletions(-) diff --git a/src/views/lsw/modules/LswMaterialInventoryForm.vue b/src/views/lsw/modules/LswMaterialInventoryForm.vue new file mode 100644 index 0000000..79637ba --- /dev/null +++ b/src/views/lsw/modules/LswMaterialInventoryForm.vue @@ -0,0 +1,129 @@ +<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="鐗╂枡ID" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialId"> + <a-input v-model="model.materialId" placeholder="璇疯緭鍏ョ墿鏂橧D" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鎵规鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batchNumber"> + <a-input v-model="model.batchNumber" placeholder="璇疯緭鍏ユ壒娆″彿" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="搴撳瓨绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryCategory"> + <a-input v-model="model.inventoryCategory" placeholder="璇疯緭鍏ュ簱瀛樼被鍨�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="鏁伴噺" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="quantity"> + <a-input v-model="model.quantity" placeholder="璇疯緭鍏ユ暟閲�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="搴撳瓨鍦癐D" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warehouseId"> + <a-input v-model="model.warehouseId" placeholder="璇疯緭鍏ュ簱瀛樺湴ID" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="12"> + <a-form-model-item label="搴撳瓨鐘舵��" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inventoryStatus"> + <a-input v-model="model.inventoryStatus" placeholder="璇疯緭鍏ュ簱瀛樼姸鎬�" ></a-input> + </a-form-model-item> + </a-col> + </a-row> + </a-form-model> + </j-form-container> + </a-spin> +</template> + +<script> + + import { httpAction, getAction } from '@/api/manage' + import { validateDuplicateValue } from '@/utils/util' + + export default { + name: 'LswMaterialInventoryForm', + components: { + }, + props: { + //琛ㄥ崟绂佺敤 + disabled: { + type: Boolean, + default: false, + required: false + } + }, + data () { + return { + model:{ + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 5 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + confirmLoading: false, + validatorRules: { + }, + url: { + add: "/lswmaterialinventory/lswMaterialInventory/add", + edit: "/lswmaterialinventory/lswMaterialInventory/edit", + queryById: "/lswmaterialinventory/lswMaterialInventory/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + add () { + this.edit(this.modelDefault); + }, + edit (record) { + this.model = Object.assign({}, record); + this.visible = true; + }, + submitForm () { + const that = this; + // 瑙﹀彂琛ㄥ崟楠岃瘉 + this.$refs.form.validate(valid => { + if (valid) { + that.confirmLoading = 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'); + }else{ + that.$message.warning(res.message); + } + }).finally(() => { + that.confirmLoading = false; + }) + } + + }) + }, + } + } +</script> \ No newline at end of file -- Gitblit v1.9.3