From 1084e4c4aed5b1d28924f6838ad83c36c71cf6f5 Mon Sep 17 00:00:00 2001 From: liuyi Date: Wed, 10 May 2023 10:29:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=8D=E7=85=A7=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/setdevice.vue | 53 ++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/src/views/devicePhotoSchedule/components/setdevice.vue b/src/views/devicePhotoSchedule/components/setdevice.vue index 065fd3b..2f85bb0 100644 --- a/src/views/devicePhotoSchedule/components/setdevice.vue +++ b/src/views/devicePhotoSchedule/components/setdevice.vue @@ -8,22 +8,19 @@ >

时间表规则

- - 12:00:07 - 16:00:07 + + {{ val.startTime }} + {{ val.endTime }} - 60 + {{ val.span }}

设置通道

- +
- - - - - + + {{ val.name }}
@@ -58,16 +55,15 @@ export default { data() { return { isShow: false, - formdata: {}, - rules: { - name: [{ required: true, message: "请选择通道", trigger: "blur" }], - }, - listnr: [], + selid: 0,//选中时间表id + ruleSchedule:[],//时间表规则 + checkedAisle: [],//选中通道数据 + aisleList:[],//通道数据内容 + listnr: [],//通道树状结构 defaultProps: { children: "list", label: "name", }, - selid: 0, ruleid: "", parmsList: [], //选中的通道 @@ -115,7 +111,6 @@ export default { ], multipleSelection: [], - checkList: [], }; }, mounted() {}, @@ -123,6 +118,7 @@ export default { //判断 getdataform(val) { this.selid = val.id; + this.ruleSchedule = val.list this.getlistnr(); }, //获取所有通道 @@ -130,10 +126,31 @@ export default { getScheduleRulelAccessList({}) .then((res) => { this.listnr = res.data.list; + this.aisleList = res.data.channellist; }) .catch((err) => {}); }, - + //选择通道 + handleChange(){ + console.log(this.listnr) + console.log(this.checkedAisle) + this.$refs.tree.setCheckedKeys(this.checkedAisle); + }, + //遍历数据 + eachTreeData(data, callback, childKey){ + if (!childKey) childKey = 'children'; + data.forEach(d => { + if (callback(d) !== false && d[childKey]) this.eachTreeData(d[childKey], callback, childKey); + }) + }, + //给树的每一个节点 添加一个唯一值key,并算出默认选中的节点key数组 + addKeyToList(data){ + let key = 0; + this.eachTreeData(data, (d) => { + d.key = key++ + }) + + }, //获取所选值 getCheckedNodes() { this.parmsList = [];