<template>
|
<el-dialog
|
:title="!dataForm.id ? '新增参数集' : '修改参数集'"
|
:close-on-click-modal="false"
|
:visible.sync="visible">
|
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="100px" class="l-mes">
|
<el-form-item label="名称"prop="templateName">
|
<el-input v-model="dataForm.templateName" placeholder="名称"></el-input>
|
</el-form-item>
|
<el-form-item label="类型" prop="templateType">
|
<el-select v-model="dataForm.templateType" placeholder="类型" filterable style="width: 100%" clearable>
|
<el-option
|
v-for="item in operationTemplateTypeList"
|
:key="item.id"
|
:label="item.templateTypeName"
|
:value="item.templateTypeName"/>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="备注">
|
<el-input v-model="dataForm.remark" placeholder="备注"></el-input>
|
</el-form-item>
|
</el-form>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="visible = false">取消</el-button>
|
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
|
</span>
|
</el-dialog>
|
</template>
|
|
<script>
|
import {getTemplateTypes} from '@/api/basic/template';
|
|
export default {
|
data () {
|
return {
|
operationTemplateTypeList:[],
|
visible: false,
|
dataForm: {
|
id: 0,
|
templateName: '',
|
templateNo: '',
|
templateType: '',
|
dataType:'',
|
remark: ''
|
},
|
dataRule: {
|
templateType: [
|
{ required: true, message: '类型不能为空', trigger: 'blur' }
|
]
|
}
|
}
|
},
|
created() {
|
this.getDict()
|
},
|
methods: {
|
init (id) {
|
this.dataForm.id = id || 0
|
this.visible = true
|
this.$nextTick(() => {
|
this.$refs['dataForm'].resetFields()
|
if (this.dataForm.id) {
|
|
}
|
})
|
},
|
getDict() {
|
getTemplateTypes(Object.assign({
|
dataType: '生产要求'
|
})).then(response => {
|
if (response.data.code === 0) {
|
this.operationTemplateTypeList = response.data.data
|
console.info( this.operationTemplateTypeList )
|
}else{
|
this.operationTemplateTypeList=[];
|
}
|
})
|
},
|
// 表单提交
|
dataFormSubmit () {
|
this.$refs['dataForm'].validate((valid) => {
|
if (valid) {
|
if (this.dataForm.id) {
|
this.visible = false
|
} else {
|
this.visible = false
|
this.dataForm.dataType='生产要求'
|
this.$emit('comfirmCustomizeTemplate',this.dataForm);
|
|
}
|
}
|
})
|
}
|
}
|
}
|
</script>
|