From 6bbceeae0a692ef60f429dbca889752fcb09ec9a Mon Sep 17 00:00:00 2001 From: houshuai <17802598606@163.com> Date: 星期四, 03 七月 2025 19:42:01 +0800 Subject: [PATCH] 线边库和订单 基本页面搭建 --- src/views/pms/modules/PmsProcessBillMaterialsDetailForm.vue | 141 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 141 insertions(+), 0 deletions(-) diff --git a/src/views/pms/modules/PmsProcessBillMaterialsDetailForm.vue b/src/views/pms/modules/PmsProcessBillMaterialsDetailForm.vue new file mode 100644 index 0000000..eaa6351 --- /dev/null +++ b/src/views/pms/modules/PmsProcessBillMaterialsDetailForm.vue @@ -0,0 +1,141 @@ +<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"> + <j-search-select-tag v-model="model.materialId" placeholder="璇疯緭鍏ョ敓浜х墿鏂橧D" dict="pms_process_bill_materials,material_number,id" @change="handleMaterialChange"></j-search-select-tag> + </a-form-model-item> + </a-col> + <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="usageUnit"> + <a-input-number v-model="model.usageUnit" placeholder="璇疯緭鍏ラ渶姹傜敤閲�" style="width: 100%" /> + </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: 'PmsProcessBillMaterialsDetailForm', + 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: { + materialId: [ + { required: true, message: '鐢熶骇鐗╂枡ID鏄繀閫夐」', trigger: 'change' } + ], + materialNumber: [ + { required: true, message: '鐗╂枡缂栫爜鏄繀閫夐」', trigger: 'change' } + ], + materialName: [ + { required: true, message: '鐗╂枡鍚嶇О鏄繀閫夐」', trigger: 'change' } + ], + usageUnit: [ + { required: true, message: '闇�姹傜敤閲忔槸蹇呴�夐」', trigger: 'change' } + ], + }, + url: { + add: "/pms/pmsProcessBillMaterialsDetail/add", + edit: "/pms/pmsProcessBillMaterialsDetail/edit", + queryById: "/pms/pmsProcessBillMaterialsDetail/queryById", + queryPmsProcessBillMaterials:"/pmsprocessbillmaterials/pmsProcessBillMaterials/queryById" + } + } + }, + computed: { + formDisabled(){ + return this.disabled + }, + }, + created () { + //澶囦唤model鍘熷鍊� + this.modelDefault = JSON.parse(JSON.stringify(this.model)); + }, + methods: { + async handleMaterialChange(value){ + console.log('value---->',value) + this.confirmLoading = true + const res = await getAction(this.url.queryPmsProcessBillMaterials,{'id':value}) + console.log('res.result---->',res.result) + this.model.materialNumber = res.result.materialNumber + this.model.materialName = res.result.materialName + this.confirmLoading = false + }, + 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