<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="controlSystemType"
|
>
|
<!--<j-dict-select-tag-->
|
<!--type="list"-->
|
<!--v-model="model.controlSystemType"-->
|
<!--dictCode="mdc_driveType"-->
|
<!--placeholder="请选择控制系统类型"-->
|
<!--/>-->
|
<a-auto-complete
|
v-model="model.controlSystemType"
|
:data-source="driveTypeList"
|
placeholder="请选择控制系统类型"
|
:filter-option="filterOption"
|
/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="中文名称"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="chineseName"
|
>
|
<a-input
|
v-model="model.chineseName"
|
placeholder="请输入中文名称"
|
></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="英文名称"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="englishName"
|
>
|
<a-input
|
v-model="model.englishName"
|
placeholder="请输入英文名称"
|
></a-input>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="序号"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="sortNo"
|
>
|
<a-input-number
|
v-model="model.sortNo"
|
placeholder="请输入序号"
|
style="width: 100%"
|
/>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="显示标志"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="showFlag"
|
>
|
<j-switch v-model="model.showFlag"></j-switch>
|
</a-form-model-item>
|
</a-col>
|
<a-col :span="24">
|
<a-form-model-item
|
label="工作曲线标志"
|
:labelCol="labelCol"
|
:wrapperCol="wrapperCol"
|
prop="curveGenerationFlags"
|
>
|
<j-switch v-model="model.curveGenerationFlags"></j-switch>
|
</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: 'MdcDriveTypeParamConfigForm',
|
components: {
|
},
|
props: {
|
//表单禁用
|
disabled: {
|
type: Boolean,
|
default: false,
|
required: false
|
},
|
driveTypeList:{
|
type:Object
|
}
|
},
|
data() {
|
return {
|
model: {
|
showFlag: "Y",
|
curveGenerationFlags:'N'
|
},
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 },
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 16 },
|
},
|
confirmLoading: false,
|
validatorRules: {
|
controlSystemType: [
|
{ required: true, message: '请输入控制系统类型!' },
|
],
|
chineseName: [
|
{ required: true, message: '请输入中文名称!' },
|
],
|
englishName: [
|
{ required: true, message: '请输入英文名称!' },
|
{ pattern: /^.{2,18}$/, message: '请输入2到18位任意字符!' ,trigger:'blur'},
|
],
|
showFlag: [
|
{ required: true, message: '请输入显示标志!' },
|
],
|
curveGenerationFlags: [
|
{ required: true, message: '请选择工作曲线标志!' },
|
],
|
},
|
url: {
|
add: "/mdc/mdcDriveTypeParamConfig/add",
|
edit: "/mdc/mdcDriveTypeParamConfig/edit",
|
queryById: "/mdc/mdcDriveTypeParamConfig/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.$notification.success({
|
message:'消息',
|
description:res.message
|
});
|
that.$emit('ok');
|
} else {
|
// that.$message.warning(res.message);
|
that.$notification.warning({
|
message:'消息',
|
description:res.message
|
});
|
}
|
}).finally(() => {
|
that.confirmLoading = false;
|
})
|
}
|
|
})
|
},
|
}
|
}
|
</script>
|