| | |
| | | <!-- |
| | | * @Author: lzhe lzhe@example.com |
| | | * @Date: 2024-04-16 15:22:46 |
| | | * @LastEditors: lzhe lzhe@example.com |
| | | * @LastEditTime: 2024-10-23 16:13:47 |
| | | * @LastEditors: 李喆(开发组) lzhe@yxqiche.com |
| | | * @LastEditTime: 2025-03-11 09:49:57 |
| | | * @FilePath: /CPSnew/smart-web/src/views/home/widgets/components/mdcDeviceStatus.vue |
| | | * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE |
| | | --> |
| | |
| | | mounted() { |
| | | this.getList(); |
| | | this.getParentData(); |
| | | var arr = []; |
| | | for(var i=1;i<=30;i++) { |
| | | this.timeLevelList.push({value:i,label:i}); |
| | | this.topList.push({value:i,label:i}); |
| | |
| | | this.getList(); |
| | | }, |
| | | showSearch() { |
| | | this.search.timeLevel = this.timeLevel; |
| | | this.search.top = this.top; |
| | | this.isSearch = true; |
| | | }, |
| | | serchSubmit() { |
| | |
| | | } |
| | | return newData |
| | | }, |
| | | extractLastLevelIds(items, result = []) { //递归获取children最后一级的id的数组 |
| | | items.forEach(item => { |
| | | // 如果当前项有id属性且没有children或children为空数组 |
| | | if (item.id && (!item.children || item.children.length === 0)) { |
| | | result.push(item.id); |
| | | } |
| | | |
| | | // 如果当前项有children属性且是数组,则递归调用collectIds |
| | | if (Array.isArray(item.children)) { |
| | | this.extractLastLevelIds(item.children, result); |
| | | } |
| | | }); |
| | | |
| | | // 返回收集到的id数组 |
| | | return result; |
| | | }, |
| | | getParentData() { |
| | | this.$HTTP.post('/api/smis/group/groupWorkstation/type', { |
| | | groupCategory: 1, |
| | |
| | | this.data = this.formatData(data) |
| | | this.$nextTick(() => { |
| | | this.parentData = this.data; |
| | | var ids = this.extractLastLevelIds(this.parentData); |
| | | this.selectedIds = ids; |
| | | this.search.workStationIdList = ids; |
| | | this.getRunData(); |
| | | }) |
| | | } |
| | | }) |
| | |
| | | if(item.cardKey == "mdcRunning") { |
| | | if(item.apiResource == "") return; |
| | | this.apiResource = JSON.parse(item.apiResource); |
| | | this.selectedIds = this.apiResource.workStationIdList; |
| | | this.search.workStationIdList = this.apiResource.workStationIdList; |
| | | this.timeLevel = this.apiResource.timeLevel; |
| | | this.top = this.apiResource.top; |
| | | if(this.apiResource.workStationIdList.length > 0) { |
| | | this.getRunData(); |
| | | } |
| | | //this.selectedIds = this.apiResource.workStationIdList; |
| | | //this.search.workStationIdList = this.apiResource.workStationIdList; |
| | | //this.timeLevel = this.apiResource.timeLevel; |
| | | //this.top = this.apiResource.top; |
| | | // if(this.apiResource.workStationIdList.length > 0) { |
| | | // this.getRunData(); |
| | | // } |
| | | } |
| | | }) |
| | | }, |
| | | getRunData() { |
| | | this.$HTTP.post(`/api/blade-visual/status/running-top`,this.apiResource).then(res=> { |
| | | this.search.top = this.topList[0].value; |
| | | this.search.timeLevel = this.timeLevelList[0].value; |
| | | this.$HTTP.post(`/api/blade-visual/status/running-top`,this.search).then(res=> { |
| | | if(res.code == 200) { |
| | | this.isSearch = false; |
| | | var recordDom = document.getElementById('running'); |