You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.3 KiB
Vue

2 years ago
<template>
<el-dialog class="addLineDialog" title="设置" :visible.sync="isShow" :close-on-click-modal="false" width="40%" >
<el-form label-position="left" ref="formInfo" label-width="100px" :rules="rules" :model="formdata" >
<el-form-item label="通道:" prop="name">
<el-tree :data="listnr" show-checkbox :props="defaultProps" ref="tree" node-key="id" ></el-tree>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="getCheckedNodes"></el-button>
<el-button @click="isShow = false"> </el-button>
<el-button type="primary" @click="submitForm()"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { setScheduleRulel,getScheduleRulelAccessList } from "@/utils/api/index";
export default {
props: {
title:String
},
data() {
return {
isShow: false,
formdata: {},
rules: {
name: [
{ required: true, message: "请选择通道", trigger: "blur" },
],
},
listnr: [],
defaultProps: {
children: 'list',
label: 'name'
},
selid:0
};
},
mounted() {
this.getlistnr()
},
methods: {
//判断
getdataform(val){
this.selid = val.id
// if (val==null) {
// return this.formdata = {}
// }
// this.formdata = val
// this.$set(this.formdata,'time',[val.startTime, val.endTime])
},
//获取所有通道
getlistnr(){
getScheduleRulelAccessList({}).then((res) => {
this.listnr = res.data.list
}).catch((err) => {});
},
//获取所选值
getCheckedNodes() {
console.log(this.$refs.tree.getCheckedNodes());
},
// 保存确定操作
submitForm() {
this.$refs.formInfo.validate((valid) => {
if (valid) {
setScheduleRulel({ list: formArr }).then((res) => {
this.isShow = false
this.$message.success("添加成功");
this.$parent.deviceList()
})
.catch((err) => {
this.$message.error("添加失败");
});
} else {
console.log("error submit!!");
return false;
}
});
},
display() {
this.isShow = true
},
hide() {
this.isShow = false
}
}
};
</script>