| | |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'CameraTree', |
| | | name: 'TreeMenu', |
| | | props: { |
| | | node: Array, // 接收树数据 |
| | | height: [Number, String], |
| | |
| | | data() { |
| | | return { |
| | | results: [], |
| | | checkedKeysList:[], |
| | | checkedKeysList: [], |
| | | defaultProps: { |
| | | children: 'children', |
| | | label: 'label' |
| | |
| | | mounted() { |
| | | this.checkedKeys(this.node) |
| | | this.$refs.tree.setCheckedKeys(this.checkedKeysList); |
| | | // console.log("checkedKeysList",this.checkedKeysList) |
| | | this.handleCheckChange() |
| | | console.log("checkedKeysList",this.checkedKeysList) |
| | | // this.handleCheckChange() |
| | | }, |
| | | methods: { |
| | | checkedKeys(node) { |
| | |
| | | if (item.checked) { |
| | | this.checkedKeysList.push(item.ID) |
| | | } |
| | | if(item.children){ |
| | | if (item.children) { |
| | | this.checkedKeys(item.children) |
| | | } |
| | | } |
| | |
| | | }, |
| | | handleCheckChange(data, checked, indeterminate) { |
| | | this.results = []; |
| | | const treeArr = this.$refs.tree.getCheckedNodes(false, false) |
| | | const treeArr = this.$refs.tree.getCheckedNodes(false, false) || [] |
| | | const treeArr2 = this.$refs.tree.getHalfCheckedNodes(false, false) || [] |
| | | // if (treeArr2&&treeArr2.value) { |
| | | // treeArr.push(...treeArr2.value) |
| | | // } |
| | | // console.log("checked", checked.checkedKeys) |
| | | // console.log("data", data) |
| | | // console.log("treeArr", treeArr) |
| | | // console.log("treeArr2", treeArr2) |
| | | //选择摄像机几路数量统计 |
| | | // let checkCount = 0; |
| | | if (treeArr && treeArr.length > 0) { |
| | |
| | | // } |
| | | } |
| | | } |
| | | this.$emit('cehckDataUpload', treeArr.filter(node => node.Parental === 0).length) |
| | | if (treeArr2 && treeArr2.length > 0) { |
| | | for (const item of treeArr2) { |
| | | // console.log("item",item) |
| | | this.results.push({ |
| | | ID: item.ID, |
| | | ParentID: item.ParentID, |
| | | DeviceID: item.DeviceID, |
| | | DeviceName: item.DeviceName, |
| | | Name: item.label, |
| | | Parental: item.Parental, |
| | | Longitude: item.Longitude, |
| | | Latitude: item.Latitude |
| | | }) |
| | | // if (item.Parental == 0) { |
| | | // checkCount = checkCount + 1; |
| | | // } |
| | | } |
| | | } |
| | | this.$emit('cehckDataUpload', treeArr.filter(node => node.checked).length) |
| | | }, |
| | | getResults() { |
| | | return this.results; |