<template>
|
<win-sm :title="setting.title" @close="close">
|
<el-form :model="formData" :rules="rules" ref="ruleForm" label-width="100px">
|
<el-form-item label="预警模板" prop="tempExpirationNotifyId">
|
<el-select v-model="formData.tempExpirationNotifyId" placeholder="请选择预警模板" filterable >
|
<el-option v-for="c in treeData" :key="c.id" :label="c.tempExpirationNotifyName" :value="c.id"></el-option>
|
</el-select>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" align="center" class="dialog-footer">
|
<my-button name="取消" site="form" @click="close" />
|
<my-button name="保存" site="form" @click="save" />
|
</div>
|
</win-sm>
|
</template>
|
|
<script>
|
import winSm from '@/components/win/win-sm'
|
import myButton from "@/components/myButton/myButton";
|
import * as information from '@/api/projectManage/information'
|
export default {
|
name: "warningSetting",
|
components: { winSm, myButton},
|
props: {
|
setting: {
|
type: Object,
|
default: () => {
|
}
|
}
|
},
|
data() {
|
return {
|
treeData:[],
|
formData:{
|
id: '',
|
tempExpirationNotifyId:null
|
},
|
rules: {
|
tempExpirationNotifyId: [
|
{ required: true, message: '请选择预警模板', trigger: 'change' }
|
]
|
}
|
}
|
},
|
created() {
|
this.formData.tempExpirationNotifyId = this.setting.tempExpirationNotifyId
|
this.formData.id = this.setting.id
|
this.loadTempList()
|
},
|
methods:{
|
loadTempList(){
|
information.getWarnTempletelist({
|
createOrgId: this.setting.createOrgId
|
}).then(res=>{
|
this.treeData = res
|
})
|
},
|
close(){
|
this.$emit('close')
|
},
|
save(){
|
this.$refs['ruleForm'].validate((valid) => {
|
if (valid) {
|
information.warnTempleteSave(this.formData).then(res=>{
|
this.$message.success('保存成功')
|
this.$emit('close')
|
this.$emit('search')
|
})
|
} else {
|
return false;
|
}
|
})
|
}
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|