From 3abdf1e1c92438d8e2986b0a2cf89a1d83477d43 Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期二, 17 六月 2025 16:21:16 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/eam/base/modules/EamFluidForm.vue | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 118 insertions(+), 0 deletions(-) diff --git a/src/views/eam/base/modules/EamFluidForm.vue b/src/views/eam/base/modules/EamFluidForm.vue new file mode 100644 index 0000000..3d54a1d --- /dev/null +++ b/src/views/eam/base/modules/EamFluidForm.vue @@ -0,0 +1,118 @@ +<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="24"> + <a-form-model-item label="娌规恫缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fluidCode"> + <a-input v-model="model.fluidCode" placeholder="绯荤粺鑷姩鐢熸垚" disabled></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="娌规恫鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fluidName"> + <a-input v-model="model.fluidName" placeholder="璇疯緭鍏ユ补娑插悕绉�" ></a-input> + </a-form-model-item> + </a-col> + <a-col :span="24"> + <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark"> + <a-textarea v-model="model.remark" placeholder="璇疯緭鍏ュ娉�" ></a-textarea> + </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: 'EamFluidForm', + 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: { + fluidName: [ + { required: true, message: '璇疯緭鍏ユ补娑插悕绉�!'}, + { validator: (rule, value, callback) => validateDuplicateValue('eam_fluid', 'fluid_name', value, this.model.id, callback) } + ], + }, + url: { + add: "/eam/eamFluid/add", + edit: "/eam/eamFluid/edit", + queryById: "/eam/eamFluid/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