@ganwei-web/gw-base-components-plus 1.0.24 → 1.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/element-plus-adapter/dist/ElementPlusAdapter.cjs +1 -4
- package/element-plus-adapter/dist/ElementPlusAdapter.cjs.map +1 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.css +24 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js +1 -4
- package/element-plus-adapter/dist/ElementPlusAdapter.iife.js.map +1 -1
- package/element-plus-adapter/dist/ElementPlusAdapter.js +1 -4
- package/element-plus-adapter/dist/ElementPlusAdapter.js.map +1 -1
- package/equip-list-vue2/dist/index.es.js +1173 -415
- package/equip-list-vue2/dist/index.umd.js +6 -1
- package/equip-list-vue3/dist/index.es.js +2964 -609
- package/equip-list-vue3/dist/index.umd.js +6 -1
- package/equipProcessing/dist/index.es.js +49 -13
- package/equipProcessing/dist/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1,6 @@
|
|
|
1
|
-
(function(d,f){typeof exports=="object"&&typeof module<"u"?module.exports=f(require("vue-virtual-scroll-list"),require("@aspnet/signalr")):typeof define=="function"&&define.amd?define(["vue-virtual-scroll-list","@aspnet/signalr"],f):(d=typeof globalThis<"u"?globalThis:d||self,d.index=f(d.VirtualList,d.SignalR))})(this,function(d,f){"use strict";const w=o=>o&&typeof o=="object"&&"default"in o?o:{default:o};function N(o){if(o&&o.__esModule)return o;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,s.get?s:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const E=w(d),O=N(f),Y="";class k{constructor(t,e,s){this.groupNodeObject=t,this.nodesMap=e,this.controlObject=s}addNodesMap(t){t&&t.forEach(e=>{this.nodesMap[e.key]=e})}removeNodesMap(t){t&&t.forEach(e=>{delete this.nodesMap[e.key]})}recycleAllNodeCache(t){for(let e in this.groupNodeObject)this.groupNodeObject[e].expand=!1,this.groupNodeObject[e].count=0,this.recycleGroupCache(this.groupNodeObject[e].key),t&&delete this.groupNodeObject[e]}recycleGroupCache(t){if(this.groupNodeObject[t]){this.groupNodeObject[t].children=[],this.removeNodesMap(this.groupNodeObject[t].equips),this.groupNodeObject[t].equips=[],this.groupNodeObject[t].equips.length=0,this.groupNodeObject[t].expand=!1;for(let e in this.groupNodeObject)this.groupNodeObject[e].groupId==t&&this.recycleGroupCache(this.groupNodeObject[e].key)}}closeBrotherNode(t){if(!!t&&this.groupNodeObject[t]){let e=this.groupNodeObject[t].groupId;for(let s in this.groupNodeObject)this.groupNodeObject[s].groupId==e&&this.groupNodeObject[s].key!=t&&this.groupNodeObject[s].expand&&(this.groupNodeObject[s].expand=!1,this.recycleGroupCache(this.groupNodeObject[s].key))}}}class j{constructor(t,e,s,i,u,r){this.equipControllObject=s,this.groupNodeObject=t,this.nodesMap=e,this.controlObject=i,this.equipCheckObject=u,this.isSearchStatus=!1,this.searchStatusGroupObject={},this.aliasName=r}resetCheckedStatus(){Object.values(this.nodesMap).forEach(t=>{this.setCheckStatus(t.key,!1,!1),t.isGroup&&!t.isEquip&&(this.clearCheckedEquips(t.key),this.updateEquipSelectCount(t.key,!0)),t.halfCheckedEquips&&(t.halfCheckedEquips=[])}),Object.keys(this.equipCheckObject).forEach(t=>{this.setEquipCheckObject(t,!1,!1,this.equipCheckObject[t].groupId)})}reComputedCheckNum(t){this.isSearchStatus=t,this.isSearchStatus?(Object.values(this.groupNodeObject).forEach(e=>{this.searchStatusGroupObject[e.key]={groupId:e.groupId,equipSelectCount:e.equipSelectCount,halfCheckedEquips:e.halfCheckedEquips,...this.searchStatusGroupObject[e.key]}}),Object.values(this.groupNodeObject).forEach(e=>{this.updateEquipSelectCount(e.key,!0),e.halfCheckedEquips=[]}),Object.values(this.groupNodeObject).forEach(e=>{(window.top[`group-${e.key}-search`]||[]).forEach(i=>{this.equipCheckObject[i.equipNo]&&this.equipCheckObject[i.equipNo].checked?this.updateEquipSelectCount(e.key,!1,1):this.equipCheckObject[i.equipNo]&&this.equipCheckObject[i.equipNo].indeterminate&&e.halfCheckedEquips.push(i.equipNo)})})):(Object.values(this.groupNodeObject).forEach(e=>{let s=this.searchStatusGroupObject[e.key];s&&(e.equipSelectCount=s.equipSelectCount,e.halfCheckedEquips=[...s.halfCheckedEquips,...e.halfCheckedEquips],e.halfCheckedEquips=[...new Set(e.halfCheckedEquips)])}),this.searchStatusGroupObject={})}updateCheckedStatusWithEquips(t){window.setTimeout(()=>{for(let e=0,s=t.length;e<s;e++){let i=window.top.equipCache&&window.top.equipCache[t[e]];i&&i.groupId&&(this.setEquipCheckObject(t[e],!0,!1,i.groupId),this.setCheckStatus(`${i.groupId}-${t[e]}`,!0,!1),this.updateEquipSelectCount(i.groupId,!1,1),this.updateExpandControlCheckStatus(i.groupId,t[e]))}this.updateGroupCheckStatus()},200)}updateExpandControlCheckStatus(t,e){let s=this.nodesMap[`${t}-${e}`];s&&s.settings&&s.settings.length&&s.settings.forEach(i=>{this.nodesMap[`${t}-${e}-${i.setNo}`]&&this.setCheckStatus(`${t}-${e}-${i.setNo}`,!0,!1)})}updateCheckedStatusWithControls(t){window.setTimeout(()=>{for(let e=0,s=t.length;e<s;e++){let i=t[e].split("."),u=i[0],r=i[1];if(this.equipControllObject[u]||(this.equipControllObject[u]=[]),this.equipControllObject[u].push(Number(r)),window.top.equipCache&&window.top.equipCache[u]){let p=window.top.equipCache[u].groupId,a=`${p}-${u}-${r}`;this.nodesMap[a]&&this.setCheckStatus(a,!0,!1),this.nodesMap[`${p}-${u}`]&&this.setCheckStatus(`${p}-${u}`,!1,!0),this.nodesMap[`${p}`].halfCheckedEquips&&this.nodesMap[`${p}`].halfCheckedEquips.push(u),this.setEquipCheckObject(u,!1,!0,p)}}this.updateGroupCheckStatus()},100)}updateGroupCheckStatus(){Object.values(this.groupNodeObject).forEach(t=>{t.count>0&&t.count==t.equipSelectCount?this.setCheckStatus(t.key,!0,!1):t.count&&t.equipSelectCount&&t.count>t.equipSelectCount||t.halfCheckedEquips.length?this.setGroupHalfChecked(t.key):this.setCheckStatus(t.key,!1,!1)})}setGroupHalfChecked(t){this.nodesMap[t]&&this.setCheckStatus(t,!1,!0),this.nodesMap[t].groupId&&this.setGroupHalfChecked(this.nodesMap[t].groupId)}setControlStatus(t,e,s,i){t&&t.forEach(u=>{this.nodesMap[`${e}-${s}-${u.setNo}`]&&this.setCheckStatus(`${e}-${s}-${u.setNo}`,i,!1)})}updateControlCheckStatus(){Object.keys(this.controlObject).forEach(t=>{let e=this.nodesMap[`${this.controlObject[t].groupId}-${t}`];if(e)if(e.checked){let s=e.settings;this.setControlStatus(s,this.controlObject[t].groupId,t,!0)}else if(!e.checked&&!e.indeterminate){let s=e.settings;this.setControlStatus(s,this.controlObject[t].groupId,t,!1)}else this.equipControllObject[t]&&this.equipControllObject[t].forEach(s=>{let i=`${this.controlObject[t].groupId}-${t}-${s}`;this.nodesMap[i]&&this.setCheckStatus(i,!0,!1)})})}getGroupChecked(){let t=[];return Object.keys(this.groupNodeObject).forEach(e=>{this.groupNodeObject[e].checked&&t.push(e)}),t}getEquipSelectd(){let t=[];return Object.keys(this.equipCheckObject).forEach(e=>{this.equipCheckObject[e].checked&&t.push(Number(e))}),t}getControlSelected(){let t=[];return Object.keys(this.equipControllObject).forEach(e=>{t.push(...this.equipControllObject[e].map(s=>`${e}.${s}`))}),t}onChecked(t,e){this.isSearchStatus=e||!1,t.isGroup&&!t.isEquip?this.selectGroup(t):t.isEquip?this.selectEquip(t):t.isSetting&&this.selectControl(t)}setCheckStatus(t,e,s){this.nodesMap[t]&&(this.nodesMap[t].checked=e,this.nodesMap[t].isGroup&&(this.nodesMap[t].indeterminate=s))}clearCheckedEquips(t){this.groupNodeObject[t]&&(this.groupNodeObject[t].equipSelectCount=0,this.groupNodeObject[t].halfCheckedEquips&&this.groupNodeObject[t].halfCheckedEquips.forEach(e=>{this.equipControllObject[e]&&this.equipControllObject[e].forEach(s=>{this.setCheckStatus(`${t}-${e}-${s}`,!1,!1)})}),this.groupNodeObject[t].halfCheckedEquips=[],this.groupNodeObject[t].groupId&&this.clearCheckedEquips(this.groupNodeObject[t].groupId))}updateSearchStatusObject(t,e){this.searchStatusGroupObject[t]&&(this.searchStatusGroupObject[t].equipSelectCount=this.searchStatusGroupObject[t].equipSelectCount+e,this.searchStatusGroupObject[t].groupId&&this.updateSearchStatusObject(this.searchStatusGroupObject[t].groupId,e))}updateEquipSelectCount(t,e,s){this.nodesMap[t]&&(e?this.nodesMap[t].equipSelectCount=0:this.nodesMap[t].equipSelectCount=this.nodesMap[t].equipSelectCount+s,this.nodesMap[t].groupId&&this.updateEquipSelectCount(this.nodesMap[t].groupId,e,s))}setEquipCheckObject(t,e,s,i){this.equipCheckObject[t]||(this.equipCheckObject[t]={}),this.equipCheckObject[t].checked=e,this.equipCheckObject[t].indeterminate=s,this.equipCheckObject[t].groupId=i}updateEquipSelect(t,e,s,i){this.nodesMap[t]&&e.length&&e.forEach(u=>{s?(this.setEquipCheckObject(u.equipNo,!0,!1,t),this.nodesMap[`${t}-${u.equipNo}`]&&this.setCheckStatus(`${t}-${u.equipNo}`,!0,!1)):(this.setEquipCheckObject(u.equipNo,!1,!1,t),this.nodesMap[`${t}-${u.equipNo}`]&&this.setCheckStatus(`${t}-${u.equipNo}`,!1,!1)),this.equipControllObject[u.equipNo]&&delete this.equipControllObject[u.equipNo],this.nodesMap[t].halfCheckedEquips.includes(u.equipNo)&&(this.nodesMap[t].halfCheckedEquips=this.nodesMap[t].halfCheckedEquips.filter(r=>r!=u.equipNo),this.searchStatusGroupObject[t]&&(this.searchStatusGroupObject[t].halfCheckedEquips=this.nodesMap[t].halfCheckedEquips))})}updateGroupSelect(t,e){t.forEach(s=>{if(this.groupNodeObject[s]){this.groupNodeObject[s].groups&&this.groupNodeObject[s].groups.length>0&&this.updateGroupSelect(this.groupNodeObject[s].groups.map(a=>a.key),e);let i=window.top[`group-${s}${this.aliasName}`]||[];this.isSearchStatus&&(i=window.top[`group-${s}-search`]||[]);let u=0,r=0;i.forEach(a=>{let h=this.equipCheckObject[a.equipNo];!h||!h.checked?u++:r--});let p=e?u:r;this.updateEquipSelect(s,i,e,p),this.updateEquipSelectCount(s,!1,p),this.updateSearchStatusObject(s,p)}})}clearHalfCheckedEquips(t){t.forEach(e=>{this.groupNodeObject[e].halfCheckedEquips&&this.groupNodeObject[e].halfCheckedEquips.forEach(s=>{this.equipControllObject[s]&&this.equipControllObject[s].forEach(i=>{this.setCheckStatus(`${e}-${s}-${i}`,!1,!1)})}),this.groupNodeObject[e].halfCheckedEquips=[],this.groupNodeObject[e].groups&&this.groupNodeObject[e].groups.length>0&&this.clearHalfCheckedEquips(this.groupNodeObject[e].groups.map(s=>s.key))})}selectGroup(t){this.clearHalfCheckedEquips([t.key]),this.updateGroupSelect([t.key],t.checked),this.updateControlCheckStatus(),this.updateGroupCheckStatus()}selectEquip(t){if(this.nodesMap[t.groupId]){let e=[{equipNo:t.equipNo}],s=(t.checked?1:-1)*e.length;this.updateEquipSelect(t.groupId,e,t.checked,s),this.updateEquipSelectCount(t.groupId,!1,s),this.updateSearchStatusObject(t.groupId,s),this.updateControlCheckStatus(),this.updateGroupCheckStatus()}}updateEquipControl(t,e,s){this.equipControllObject[t]||(this.equipControllObject[t]=[]),s?this.equipControllObject[t].push(e):this.equipControllObject[t]=this.equipControllObject[t].filter(i=>i!=e)}selectControl(t){let e=this.nodesMap[`${t.groupId}-${t.equipNo}`];e&&(this.updateEquipControl(t.equipNo,t.setNo,t.checked),t.checked?e.settings&&e.settings.length==this.equipControllObject[t.equipNo].length?(delete this.equipControllObject[t.equipNo],this.updateEquipSelectCount(t.groupId,!1,1),this.updateSearchStatusObject(t.groupId,1),this.nodesMap[t.groupId].halfCheckedEquips=this.nodesMap[t.groupId].halfCheckedEquips.filter(s=>s!=t.equipNo),this.setEquipCheckObject(t.equipNo,!0,!1,t.groupId),this.setCheckStatus(`${t.groupId}-${t.equipNo}`,!0,!1)):e&&!e.indeterminate&&(this.nodesMap[`${t.groupId}`].halfCheckedEquips.push(t.equipNo),this.setCheckStatus(`${t.groupId}-${t.equipNo}`,!1,!0),this.setEquipCheckObject(t.equipNo,!1,!0,t.groupId)):e.checked?(this.updateEquipSelectCount(t.groupId,!1,-1),this.updateSearchStatusObject(t.groupId,-1),e.settings.length>1?(this.nodesMap[t.groupId].halfCheckedEquips.push(t.equipNo),e.settings.map(i=>i.setNo).filter(i=>i!=t.setNo).forEach(i=>{this.updateEquipControl(t.equipNo,i,!0)}),this.setEquipCheckObject(t.equipNo,!1,!0,t.groupId),this.setCheckStatus(`${t.groupId}-${t.equipNo}`,!1,!0)):(this.setEquipCheckObject(t.equipNo,!1,!1,t.groupId),this.setCheckStatus(`${t.groupId}-${t.equipNo}`,!1,!1))):e.indeterminate&&this.equipControllObject[t.equipNo]&&!this.equipControllObject[t.equipNo].length&&(this.nodesMap[t.groupId].halfCheckedEquips=this.nodesMap[t.groupId].halfCheckedEquips.filter(s=>s!=t.equipNo),this.setEquipCheckObject(t.equipNo,!1,!1,t.groupId),this.setCheckStatus(`${t.groupId}-${t.equipNo}`,!1,!1)),this.updateGroupCheckStatus())}}class M{constructor(t,e){this.aliasName=e,this.groupNodeObject=t}resetGroupNum(t){this.clearAllEquipNum();for(let e in this.groupNodeObject){let s=[];t?s=window.top[`group-${e}-search`]:s=window.top[`group-${e}${this.aliasName}`];let i=s?s.length:0;i&&(this.groupNodeObject[e].equipCount=i,this.setGroupNum(e,i))}}clearAllEquipNum(){for(let t in this.groupNodeObject)this.groupNodeObject[t].equipCount=0,this.groupNodeObject[t].count=0}setGroupNum(t,e){this.groupNodeObject[t]&&(this.groupNodeObject[t].count=Number(this.groupNodeObject[t].count)+Number(e),this.setGroupNum(this.groupNodeObject[t].groupId,e))}getAllEquipsNum(){let t=0;for(let e in this.groupNodeObject)window.top[`group-${this.groupNodeObject[e].key}${this.aliasName}`]&&(t=t+window.top[`group-${this.groupNodeObject[e].key}${this.aliasName}`].length);return t}}class S{constructor(t,e,s){this.url=t,this.connectionId=e,this.equipNo=s,this.signalr=null}openConnect(){return this.signalr&&(this.signalr.stop(),this.signalr=null),this.signalr=new O.HubConnectionBuilder().withUrl(this.url).build(),this.signalr.serverTimeoutInMilliseconds=5e8,this.signalr.keepaliveintervalinmilliseconds=5e8,new Promise(t=>{this.signalr.start().then(()=>{this.connectionId&&this.send(),t(this.signalr)}).catch(e=>{console.log(e)})})}async send(){try{await this.signalr.invoke(this.connectionId,this.equipNo).catch(t=>{console.log("send \u53D1\u9001\u5931\u8D25"+t)})}catch(t){console.log("connectHub \u8FDE\u63A5\u5931\u8D25"+t)}}}class G{constructor(t,e,s,i,u){this.equipStatusObject=e,this.groupNodeObject=s,this.aleadyUpdateStatus={},this.isGetAllEquipStatus=!1,this.nodesMap=t,this.statusChange=i,this.openSignlr(),this.aliasName=u,this.statusMap={0:"noComCounts",1:"normalCounts",2:"alarmCounts",3:"lsSetCounts",4:"initializeCounts",5:"withdrawCounts",6:"backUpCounts"},this.reverseStatusMap={noComCounts:0,normalCounts:1,alarmCounts:2,lsSetCounts:3,initializeCounts:4,withdrawCounts:5,backUpCounts:6}}openSignlr(){this.equipStatusSignlr=new S("/equipStatusMonitor","",""),this.equipStatusSignlr.openConnect().then(t=>{try{t.invoke("GetAllEquipStatus")}catch(e){console.log(e)}this.subscribeTo(t,"GetAllEquipStatus"),t.onclose(()=>{this.openSignlr()})})}subscribeTo(t,e){t.off(e),t.on(e,s=>{if(s&&s.isSuccess&&s.data&&(this[e]?this[e](s.data):this.notice({func:e,data:s.data,key:s.groupId}),e==="GetAllEquipStatus")){try{t.invoke("GetEquipChangeStatus")}catch(i){console.log(i)}this.subscribeTo(t,"GetEquipChangeStatus")}})}GetAllEquipStatus(t){this.isGetAllEquipStatus=!0,this.resetGroupStatusCounts(),Object.keys(t).forEach(e=>{this.equipStatusObject[e]=t[e]}),Object.keys(this.groupNodeObject).forEach(e=>{this.updateByGroup(e)}),this.updateAllGroupStatus()}reRenderGroupStatus(){this.resetGroupStatusCounts(),Object.keys(this.aleadyUpdateStatus).forEach(t=>{this.aleadyUpdateStatus[t]=!1}),Object.keys(this.groupNodeObject).forEach(t=>{this.updateByGroup(t)}),this.updateAllGroupStatus()}updateStatusCounts(t,e,s){if(this.groupNodeObject[t]){this.groupNodeObject[t][e]=this.groupNodeObject[t][e]+s;let i=this.groupNodeObject[t].groupId;i&&this.updateStatusCounts(i,e,s)}}updateByGroup(t){if(!this.aleadyUpdateStatus[t]){let e=window.top[`group-${t}${this.aliasName}`]||[],s=e.length;s&&(this.aleadyUpdateStatus[t]=!0,this.updateStatusCounts(t,this.statusMap[1],s),e.forEach(i=>{this.updateGroupStatusCounts(t,this.equipStatusObject[i.equipNo],1),this.nodesMap[`${t}-${i.equipNo}`]&&(this.nodesMap[`${t}-${i.equipNo}`].status=this.equipStatusObject[i.equipNo])}))}}updateGroupStatusCounts(t,e,s){if(this.nodesMap[t]&&this.statusMap[e]&&this.statusMap[s]){let i=this.statusMap[e],u=this.statusMap[s];this.updateStatusCounts(t,i,1),this.updateStatusCounts(t,u,-1)}}updateGroupStatusByKey(t){this.isGetAllEquipStatus&&(this.updateByGroup(t),this.updateAllGroupStatus())}updateAllGroupStatus(){Object.keys(this.groupNodeObject).forEach(t=>{let e=this.groupNodeObject[t],s=this.getSingleStatus(e);if(s!==-1)this.nodesMap[e.key].status=s;else if(e.alarmCounts>0)this.nodesMap[e.key].status=2;else if(e.noComCounts>0&&(e.normalCounts>0||e.lsSetCounts>0||e.initializeCounts>0||e.withdrawCounts>0||e.backUpCounts>0))this.nodesMap[e.key].status=2;else if(e.backUpCounts>0&&(e.normalCounts>0||e.lsSetCounts>0||e.initializeCounts>0||e.withdrawCounts>0)){let i=this.getStatusArray(e).filter(u=>u.statusMap!="backUpCounts"&&u.value>0);i.length>0?this.nodesMap[e.key].status=i.pop().status:this.nodesMap[e.key].status=6}else if(e.normalCounts>0||e.lsSetCounts>0||e.initializeCounts>0||e.withdrawCounts>0){let i=this.getStatusArray(e).filter(u=>u.value>0);i.length>0?this.nodesMap[e.key].status=i.pop().status:this.nodesMap[e.key].status=1}})}getStatusArray(t){let e=[],s=Object.values(this.statusMap);return Object.keys(t).forEach(i=>{s.includes(i)&&e.push({statusMap:i,status:this.reverseStatusMap[i],value:t[i]})}),e}getSingleStatus(t){let e=this.getStatusArray(t),s=e.filter(i=>i.value==0);if(s.length==e.length)return 1;if(s.length==6){let i=e.find(u=>u.value>0);if(i)return i.status}return-1}GetEquipChangeStatus(t){this.setStatus(t),this.updateAllGroupStatus()}setStatus(t){let e=this.equipStatusObject[t.equipNo],s=window.top.equipCache&&window.top.equipCache[t.equipNo]&&window.top.equipCache[t.equipNo].groupId;if(t.status!=3&&s&&e!=t.status){this.updateGroupStatusCounts(s,t.status,e),this.equipStatusObject[t.equipNo]=t.status;let i=`${s}-${t.equipNo}`;this.nodesMap[i]&&(this.nodesMap[i].status=t.status),this.statusChange(s,t.equipNo,t.status),this.updateAllGroupStatus()}}resetGroupStatusCounts(){for(let t in this.groupNodeObject)Object.values(this.statusMap).forEach(e=>{this.groupNodeObject[t][e]=0})}countGroupStatus(t){this.resetGroupStatusCounts();for(let e in this.groupNodeObject){let s=[];if(t?s=window.top[`group-${e}-search`]:s=window.top[`group-${e}${this.aliasName}`],s?s.length:0)for(let u of s){const r=this.equipStatusObject[u.equipNo];this.setGroupNum(u.groupId,r)}}}setGroupNum(t,e){!this.groupNodeObject[t]||(this.groupNodeObject[t][this.statusMap[e]]+=1,this.setGroupNum(this.groupNodeObject[t].groupId,e))}}const $=Object.assign({},{getSetParm(o){if(window.axios)return window.axios({method:"post",url:"/IoT/api/v3/EquipList/GetSetParmByEquipNo",params:o,data:o})}});class y{constructor(t,e){this.nodesMap=t,this.equipControllObject=e}async getSetting(t,e,s,i){let[u,r]=String(t).split("-"),p={equipNo:r};await $.getSetParm(p).then(a=>{if(a.data.code==200){let h=a&&a.data&&a.data.data&&a.data.data.rows||[];this.nodesMap[t].settings||(this.nodesMap[t].settings=[]),h&&h.length>0&&this.nodesMap[t]&&(h.forEach(n=>{n.title=n.setNm,n.key=`${u}-${r}-${n.setNo}`,n.level=Number(s)+1,n.checked=i||this.equipControllObject[r]&&this.equipControllObject[r].includes(n.setNo),n.isSetting=!0,n.equipNo=r,n.groupId=u,n.equipName=e}),this.nodesMap[t].settings=[...h])}})}}class l{static formateList(t,e){let s=[];for(const i of t){let u={};u.count=0,u.equipSelectCount=0,u.controlSelectCount=0,u.equipCount=i.equipCount||0,u.title=i.name,u.key=i.id,u.isGroup=!0,u.children=[],u.status=1,u.level=e||1,u.expand=!e,u.equips=[],u.groupId=i.parentId,u.groups=[],u.alarmCounts=0,u.backUpCounts=0,u.noComCounts=0,u.normalCounts=0,u.lsSetCounts=0,u.initializeCounts=0,u.withdrawCounts=0,u.indeterminate=!1,u.checked=!1,u.visible=!0,u.nodeEquipSelectCount=0,u.checkedEquips=[],u.halfCheckedEquips=[],u.selectControlCount=0,i.children&&i.children.length>0&&(u.groups=[...this.formateList(i.children,e?e+1:2)]),s.push(u)}return s}static deepClone(t,e,s,i,u,r){let p=[];if(t)for(let a=0,h=t.length;a<h;a++)p.push({isGroup:s,key:`${i}-${t[a].id}`,status:r[t[a].id]||0,title:t[a].title,level:e,expand:!1,isEquip:!0,loading:!1,indeterminate:u[t[a].equipNo]&&u[t[a].equipNo].indeterminate||!1,checked:u[t[a].equipNo]&&u[t[a].equipNo].checked||!1,groupId:i,equipNo:t[a].id,visible:!0,settings:[]});return p}static copyOrigin(t){let e=[];return t.forEach(s=>{e.push({...s})}),e}static getPosition(t,e){let s=0;for(let i=0,u=e.length;i<u;i++)if(e[i].key==t){s=i-30;break}return s}static flattern(t,e){t.forEach(s=>{s.isGroup&&(e[`${s.key}`]=null,e[`${s.key}`]=s),s.groups&&s.groups.length&&this.flattern(s.groups,e)})}static generateUUID(){let t=new Date().getTime();return window.performance&&typeof window.performance.now=="function"&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(s){let i=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(s==="x"?i:i&3|8).toString(16)})}static listToTreeList(t){const e=t,s=[],i={};return e.forEach(u=>{i[u.id]=u}),e.forEach(u=>{const r=i[u.parentId];r?(r.children||(r.children=[])).push(u):s.push(u)}),s}}class m{constructor(t,e,s){this.showSettings=e,this.groupNodeObject=t,this.aliasName=s}filterMethod(t){for(let e in this.groupNodeObject)t&&this.updateBySearch(e,t)}updateBySearch(t,e){let s=window.top[`group-${this.groupNodeObject[t].key}${this.aliasName}`];s&&(s=s.filter(i=>i.title.includes(e)),window.top[`group-${this.groupNodeObject[t].key}-search`]=l.copyOrigin(s))}}function g(o,t,e,s,i,u,r,p){var a=typeof o=="function"?o.options:o;t&&(a.render=t,a.staticRenderFns=e,a._compiled=!0),s&&(a.functional=!0),u&&(a._scopeId="data-v-"+u);var h;if(r?(h=function(c){c=c||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!c&&typeof __VUE_SSR_CONTEXT__<"u"&&(c=__VUE_SSR_CONTEXT__),i&&i.call(this,c),c&&c._registeredComponents&&c._registeredComponents.add(r)},a._ssrRegister=h):i&&(h=p?function(){i.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:i),h)if(a.functional){a._injectStyles=h;var n=a.render;a.render=function(X,b){return h.call(b),n(X,b)}}else{var q=a.beforeCreate;a.beforeCreate=q?[].concat(q,h):[h]}return{exports:o,options:a}}const _={props:{source:{type:Object},groupEditAndNew:{type:Function},deleteGroup:{type:Function}}};var I=function(){var t=this,e=t._self._c;return e("div",{staticClass:"operates"},[e("el-popover",{attrs:{placement:"bottom",trigger:"hover"},scopedSlots:t._u([{key:"reference",fn:function(){return[e("i",{staticClass:"el-icon-more"})]},proxy:!0}])},[e("el-button-group",{staticClass:"new-button-group setModule"},[e("el-button",{staticClass:"elBtn",attrs:{type:"text",size:"small",icon:" iconfont icon-tubiao20_bianji"},on:{click:function(s){return s.stopPropagation(),t.groupEditAndNew(!1,t.source)}}},[t._v(" "+t._s(t.$t("equipInfo.poverTips.rename"))+" ")]),e("el-button",{staticClass:"elBtn",attrs:{type:"text",size:"small",icon:" iconfont icon-gw-icon-tianjia1"},on:{click:function(s){return t.groupEditAndNew(!0,t.source)}}},[t._v(" "+t._s(t.$t("equipInfo.poverTips.newChildGroup"))+" ")]),t.source.level!=1?e("el-button",{attrs:{type:"danger",size:"small",icon:" iconfont icon-tubiao20_shanchu"},on:{click:function(s){return s.stopPropagation(),t.deleteGroup(t.source)}}},[t._v(" "+t._s(t.$t("publics.button.deletes"))+" ")]):t._e()],1)],1)],1)},v=[],x=g(_,I,v,!1,null,null,null,null);const T=x.exports,L={name:"ElTreeVirtualNode",componentName:"ElTreeVirtualNode",props:{isSearchStatus:{type:Boolean,default:!1},searchName:{type:String,default:""},expanding:{type:Boolean,default:!1},aleadyLoadAll:{type:Boolean,default:!1},groupLoading:{type:Boolean,default:!1},source:{default(){return{}}},showCheckbox:{type:Boolean,default:!1},showStatus:{type:Boolean,default:!1},showOperate:{type:Boolean,default:!1},currentSelect:{type:Number|String,default:-1},nodeClick:{type:Function},onChecked:{type:Function},groupEditAndNew:{type:Function},deleteGroup:{type:Function},colorConfig:{type:Object},index:{type:Number,default:-1}},components:{oparate:T},computed:{getColor(){return function(o){let t;switch(o){case 0:t=this.colorConfig.noComm;break;case 1:t=this.colorConfig.normal;break;case 2:t=this.colorConfig.alarm;break;case 3:t=this.colorConfig.lsSet;break;case 4:t=this.colorConfig.initialize;break;case 5:t=this.colorConfig.withdraw;break;case 6:t=this.colorConfig.BackUp;break;default:t=this.colorConfig.noComm;break}return t}}},data(){return{indent:13}},methods:{clickFunction(){this.source.expand=!this.source.expand,this.nodeClick(this.source,this.index,this.source.level,this.source.checked)},checkedChange(o){this.onChecked(this.source)}}};var A=function(){var t=this,e=t._self._c;return e("div",{staticClass:"el-tree-node",class:{parent_tag:t.source.isGroup,child_tags:!t.source.isGroup,selectedColor:t.currentSelect===t.source.key&&!t.source.isGroup},on:{click:t.clickFunction}},[e("div",{staticClass:"el-tree-node__content"},[e("span",{staticClass:"el-tree__indent",style:{width:(t.source.level-1)*t.indent+"px"},attrs:{"aria-hidden":"true"}}),t.source.isGroup?e("span",{class:[{"is-leaf":!t.source.isGroup,expanded:t.source.isGroup&&t.source.expand},"el-tree-node__expand-icon","el-icon-arrow-right"]}):t._e(),e("div",{staticClass:"nodeContent"},[t.showCheckbox?e("el-checkbox",{attrs:{indeterminate:t.source.indeterminate},on:{change:t.checkedChange},model:{value:t.source.checked,callback:function(s){t.$set(t.source,"checked",s)},expression:"source.checked"}}):t._e(),t.showStatus?e("span",{staticClass:"circle"},[t.source.status!=6?e("span",{staticClass:"yd",style:{backgroundColor:t.getColor(t.source.status)}}):e("i",{staticClass:"iconfont icon-gw-icon-beiji2",style:{color:t.colorConfig.BackUp}})]):t._e(),e("span",{staticClass:"label"},[t._v(" "+t._s(t.source.title))]),t.source.isGroup&&!t.source.isEquip?e("span",{staticClass:"equipNumber"},[t._v(" "+t._s(t.source.count)+" ")]):t._e(),t.source.isGroup&&t.showOperate?e("oparate",{attrs:{source:t.source,groupEditAndNew:t.groupEditAndNew,deleteGroup:t.deleteGroup}}):t._e(),t.source.loading?e("span",{staticClass:"el-tree-node__loading-icon el-icon-loading"}):t._e()],1)])])},B=[],U=g(L,A,B,!1,null,null,null,null);const R=U.exports,W={components:{VirtualList:E.default},data(){return{itemComponent:R,visibleList:[],currentSelect:-1,equipStatusManage:null,cacheManage:null,searchManage:null,equipNumManage:null,requestManage:null,checkStatusManage:null,groupNodeObject:{},nodesMap:{},equipCheckObject:{},equipStatusObject:{},controlObject:{},isSearchStatus:!1,equipControllObject:{},expandGroup:[],updateJob:null}},props:{data:{type:Array},selectEquips:{type:Array,default:()=>[]},controllList:{type:Array,default:()=>[]},showSettings:{type:Boolean,default:!1},showSelectNum:{type:Boolean,default(){return!1}},showCheckbox:{type:Boolean,default:!1},showStatus:{type:Boolean,default:!1},showOperate:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},currentNodeKey:[String,Number],colorConfig:{type:Object,default:()=>({noComm:"#a0a0a0",normal:"#63e03f",alarm:"#f22433",lsSet:"#bebcaa",initialize:"#289ac0",withdraw:"#ffc0cb",BackUp:"#f8901c"})},treeType:{type:String,default:""},buildTree:{type:Function},filterData:{type:Function},alias:{type:String,default:""}},watch:{data(o){o&&o.length&&(l.flattern(this.data,this.groupNodeObject),this.cacheManage.addNodesMap(Object.values(this.groupNodeObject).map(t=>t)),this.init())},controllList(o){this.updateCheckedStatusWithControls()},selectEquips(o){this.updateCheckedStatusWithEquips()}},computed:{aliasName(){return this.alias?`-${this.alias}`:""}},created(){this.showCheckbox&&(this.checkStatusManage=new j(this.groupNodeObject,this.nodesMap,this.equipControllObject,this.controlObject,this.equipCheckObject,this.aliasName)),this.cacheManage=new k(this.groupNodeObject,this.nodesMap,this.controlObject,this.equipCheckObject),this.searchManage=new m(this.groupNodeObject,this.showSettings,this.aliasName),this.equipNumManage=new M(this.groupNodeObject,this.aliasName),this.requestManage=new y(this.nodesMap,this.equipControllObject)},mounted(){this.updateCheckedStatusWithControls(),this.updateCheckedStatusWithEquips(),window.addEventListener("message",o=>{o.data.type&&this[o.data.type]&&this[o.data.type](o.data.data)})},methods:{init(){this.data[0].expand=!0,this.updateTreeList(),setTimeout(()=>{Object.values(this.groupNodeObject).forEach(o=>{!o.expand&&this.expandGroup.includes(o.key)&&(o.expand=!0),this.filterWithAlias(o.key),this.updateGroupEquips(o.key,!0)}),this.equipNumManage.resetGroupNum(this.isSearchStatus),this.showStatus&&!this.equipStatusManage&&(this.equipStatusManage=new G(this.nodesMap,this.equipStatusObject,this.groupNodeObject,this.statusChange,this.aliasName)),this.filterEmptyGroup()},100)},filterEmptyGroup(){if(this.isSearchStatus){let o=[];Object.values(this.groupNodeObject).forEach(t=>{t.isGroup&&!t.isEquip&&!t.count&&o.push(t.key)}),this.visibleList=this.visibleList.filter(t=>!o.includes(t.key))}},filterWithAlias(o){if(this.aliasName){let t=window.top[`group-${o}`]||[];window.top[`group-${o}${this.aliasName}`]=this.filterData(t)}},updateCurrentSelect(){window.top.equipCache&&window.top.equipCache[this.currentNodeKey]&&(this.currentSelect=`${window.top.equipCache[this.currentNodeKey].groupId}-${this.currentNodeKey}`)},statusChange(o,t,e){this.currentSelect==`${o}-${t}`&&this.$emit("statusChange",t,e)},updateCheckWidthJob(){this.showCheckbox&&(this.checkStatusManage.resetCheckedStatus(),this.updateCheckedStatusWithControls(),this.updateCheckedStatusWithEquips())},updateGroupEquips(o,t){if(!this.isSearchStatus&&this.groupNodeObject[o]){let e=this.equipNumManage.getAllEquipsNum();this.$emit("getTotal",e)}if(t){let e=window.top[`group-${o}${this.aliasName}`]||[];this.equipNumManage.setGroupNum(o,e.length)}this.groupNodeObject[o].expand&&this.updateList(o,this.groupNodeObject[o].level,null,!1),this.showStatus&&this.equipStatusManage&&this.equipStatusManage.updateGroupStatusByKey(o)},updateList(o){if(this.groupNodeObject[o]){let t=[];this.isSearchStatus?(t=window.top[`group-${o}-search`],this.groupNodeObject[o].equips=[...l.deepClone(t,Number(this.groupNodeObject[o].level)+1,this.showSettings,o,this.equipCheckObject,this.equipStatusObject)]):(t=window.top[`group-${o}${this.aliasName}`],this.groupNodeObject[o].equips=[...l.deepClone(t,Number(this.groupNodeObject[o].level)+1,this.showSettings,o,this.equipCheckObject,this.equipStatusObject)]),this.cacheManage.addNodesMap(this.groupNodeObject[o].equips),this.cacheManage.closeBrotherNode(o),this.visibleList=[],this.updateTreeList(this.data),this.updateCurrentSelect()}},updateTreeList(o){o&&o.forEach(t=>{this.visibleList.push(t),t.expand?t.isEquip?(t.children||(t.children=[]),t.settings&&(t.children=[...t.settings||[]])):t.children=[...t.equips||[],...t.groups||[]]:t.children=[],this.updateTreeList(t.children||[])})},nodeClick(o,t,e,s){this.$emit("node-click",{...o,key:o.isEquip?o.equipNo:o.key}),o.isGroup?o.isEquip?this.equipClick(o,t,s):this.groupClick(o,t,s):this.currentSelect=o.key},groupClick(o,t,e){o.expand?this.updateList(o.key,o.level,t,e):(this.cacheManage.recycleGroupCache(o.key),this.visibleList=[],this.updateTreeList(this.data)),this.isSearchStatus&&this.filterEmptyGroup()},async equipClick(o,t,e){this.showSettings&&(o.expand?(o.loading=!0,await this.requestManage.getSetting(o.key,o.title,o.level,e),this.controlObject[o.equipNo]={groupId:o.groupId},o.loading=!1,this.visibleList.splice(t+1,0,...this.nodesMap[o.key].settings),this.cacheManage.addNodesMap(this.nodesMap[o.key].settings)):(this.visibleList.splice(t+1,this.nodesMap[o.key].settings.length),this.cacheManage.removeNodesMap(this.nodesMap[o.key].settings),this.nodesMap[o.key].settings=[],delete this.controlObject[o.equipNo]))},onChecked(o){this.checkStatusManage&&this.checkStatusManage.onChecked(o,this.isSearchStatus),this.$emit("onCheck",o)},groupEditAndNew(o,t){this.$emit("groupEditAndNew",{isGroupNew:o,node:t})},deleteGroup(o){this.$emit("deleteGroup",o)},updateCheckedStatusWithControls(){this.controllList&&this.controllList.length&&this.checkStatusManage&&this.checkStatusManage&&this.checkStatusManage.updateCheckedStatusWithControls(this.controllList)},updateCheckedStatusWithEquips(){this.selectEquips&&this.selectEquips.length&&this.checkStatusManage&&this.checkStatusManage&&this.checkStatusManage.updateCheckedStatusWithEquips(this.selectEquips)},resetCheckedStatus(){this.checkStatusManage&&this.checkStatusManage.resetCheckedStatus()},getEquipSelectd(){return this.checkStatusManage&&this.checkStatusManage.getEquipSelectd()},getControlSelected(){return this.checkStatusManage&&this.checkStatusManage.getControlSelected()},recordExpandGroup(){this.expandGroup=[],Object.values(this.groupNodeObject).forEach(o=>{o.expand&&this.expandGroup.push(o.key)})},removeExpandGroup(){this.$nextTick(()=>{this.expandGroup=[]})},filterMethod(o){this.visibleList=[],this.cacheManage.recycleAllNodeCache(),o?(this.isSearchStatus=!0,this.searchManage.filterMethod(o)):this.isSearchStatus=!1,this.init(),this.$nextTick(()=>{this.$refs.virtualList.scrollToIndex(0)}),this.equipNumManage.resetGroupNum(this.isSearchStatus),this.equipStatusManage&&this.equipStatusManage.countGroupStatus(this.isSearchStatus),this.showCheckbox&&(this.checkStatusManage&&this.checkStatusManage.reComputedCheckNum(this.isSearchStatus),this.checkStatusManage&&this.checkStatusManage.updateGroupCheckStatus())},rebuildTree(){this.recordExpandGroup(),this.checkStatusManage&&this.checkStatusManage.resetCheckedStatus(),this.cacheManage.recycleAllNodeCache(!0),this.$nextTick(()=>{this.buildTree(),this.removeExpandGroup()})},destroyTree(){this.cacheManage.recycleAllNodeCache(!0),this.visibleList=[],this.updateTreeList(this.data)},GetGroupEquips(o){o.groupId&&this.groupNodeObject[o.groupId]&&!this.isSearchStatus&&(this.updateGroupEquips(o.groupId,!0),this.updateJob&&clearTimeout(this.updateJob),this.updateJob=setTimeout(()=>{this.updateCheckWidthJob()},500))},DeleteEquip(o){const{groupId:t,equips:e}=o||{};t&&this.groupNodeObject[t]&&(this.updateGroupEquips(o.groupId),this.equipNumManage.resetGroupNum(),this.checkStatusManage&&this.checkStatusManage.resetCheckedStatus()),e.length&&e.forEach(s=>{let i=this.nodesMap[`${t}-${s.id}`];i&&(this.currentSelect.toString().includes(s.id)&&this.$emit("currentDelete"),this.showStatus&&(i.status==2||i.status==0?this.equipStatusManage.setGroupStatus(t,!1,2):i.status==6&&this.equipStatusManage.setGroupStatus(t,!1,6)),delete this.nodesMap[`${t}-${s.id}`],delete this.equipCheckObject[s.id]),delete this.equipStatusObject[s.id]}),this.equipStatusManage&&this.equipStatusManage.reRenderGroupStatus()},moveEquips(o){const{updateGroups:t,buildTree:e}=o||{};!e&&t?t.forEach(s=>{s&&this.groupNodeObject[s]&&(this.updateGroupEquips(s),this.equipNumManage.resetGroupNum(),this.checkStatusManage&&this.checkStatusManage.resetCheckedStatus())}):e&&this.rebuildTree(),this.equipStatusManage&&this.equipStatusManage.reRenderGroupStatus()},DeleteEquipGroup(o){o.forEach(t=>{t.groupId&&this.nodesMap[t.groupId]&&(this.isSearchStatus||this.rebuildTree())}),this.equipStatusManage&&this.equipStatusManage.reRenderGroupStatus()},AddEquipGroup(o){const{parentGroupId:t,groupId:e}=o||{};e&&this.nodesMap[t]&&this.treeType&&(this.isSearchStatus||this.rebuildTree())},EditEquipGroup(o){const{groupId:t,groupName:e}=o;this.nodesMap[t]&&(this.nodesMap[t].title=e)},AddEquip(o){const{groupId:t}=o||{};t&&(this.isSearchStatus||this.rebuildTree(),this.equipStatusManage&&this.equipStatusManage.reRenderGroupStatus())},EditEquip(o){const{equipNo:t,groupId:e,equipName:s}=o||{};this.nodesMap[`${e}-${t}`]&&(this.isSearchStatus||(this.nodesMap[`${e}-${t}`].title=s))}}};var K=function(){var t=this,e=t._self._c;return e("div",{staticClass:"gw-tree",style:{height:"100%"}},[e("div",{staticClass:"tree",style:{height:"100%"}},[e("virtual-list",{ref:"virtualList",staticClass:"virtualList",attrs:{"data-key":"key","data-sources":t.visibleList,"data-component":t.itemComponent,keeps:40,"extra-props":{currentSelect:t.currentSelect,nodeClick:t.nodeClick,showStatus:t.showStatus,showSettings:t.showSettings,showCheckbox:t.showCheckbox,onChecked:t.onChecked,showOperate:t.showOperate,groupEditAndNew:t.groupEditAndNew,deleteGroup:t.deleteGroup,colorConfig:t.colorConfig,isSearchStatus:t.isSearchStatus}}})],1)])},D=[],F=g(W,K,D,!1,null,null,null,null);const z=F.exports;class P{constructor(){this.eGroupNotify=new S("/eGroupNotify","",""),this.alreadyUpdate={},this.notify=null}stop(){this.notify&&this.notify.stop()}Init(){this.eGroupNotify.openConnect().then(t=>{this.notify=t;try{t.invoke("GetEquipGroupTree"),t.invoke("GetAllEquipGroupTree")}catch(e){console.log(e)}this.subscribeTo(t,"GetEquipGroupTree"),this.subscribeTo(t,"AddEquipGroup"),this.subscribeTo(t,"EditEquipGroup"),this.subscribeTo(t,"DeleteEquipGroup");try{t.invoke("GetGroupEquips")}catch(e){console.log(e)}this.subscribeTo(t,"GetGroupEquips"),this.subscribeTo(t,"AddEquip"),this.subscribeTo(t,"DeleteEquip"),this.subscribeTo(t,"EditEquip"),this.subscribeTo(t,"moveEquips"),this.subscribeTo(t,"GetAllEquipGroupTree"),t.onclose(e=>{try{this.Init()}catch(s){console.log(s)}console.log("\u91CD\u8FDE",e)})}).catch(t=>{console.error(t)})}subscribeTo(t,e){t.off(e),t.on(e,s=>{s&&s.isSuccess&&(this[e]?this[e](s.data):this.notice({func:e,data:s.data,key:s.groupId}))})}GetEquipGroupTree(t){window.top.groupList||(window.top.groupList=t,this.notice({type:"GetEquipGroupTree"}))}GetAllEquipGroupTree(t){console.log(8899,t),window.top.groupList_manageMent||(window.top.groupList_manageMent=t,this.notice({type:"GetEquipGroupTreeWidthTreeType"}))}AddEquipGroup(t){const{parentGroupId:e,groupId:s,groupName:i}=t||{};s&&(window.top.groupList_manageMent||(window.top.groupList_manageMent=[]),window.top.groupList_manageMent.push({parentId:e,id:s,name:i,equipCount:0}),this.notice({type:"AddEquipGroup",data:t}))}EditEquipGroup(t){const{groupId:e,groupName:s}=t;window.top.groupList&&window.groupList.forEach(i=>{i.id==e&&(i.name=s)}),window.top.groupList_manageMent&&window.groupList_manageMent.forEach(i=>{i.id==e&&(i.name=s)}),this.notice({type:"EditEquipGroup",data:t})}deleteChildGroup(t,e){let s=[];e.forEach(i=>{i.parentId==t&&s.push(i.id)}),s.forEach(i=>{let u=e.findIndex(r=>r.id==i);u>-1&&e.splice(u,1),this.deleteChildGroup(i,e)})}DeleteEquipGroup(t){t.forEach(e=>{if(window.top.groupList){let s=window.top.groupList.findIndex(i=>i.id==e.groupId);s>-1&&window.top.groupList.splice(s,1),this.deleteChildGroup(e.groupId,window.top.groupList)}if(window.top.groupList_manageMent){let s=window.top.groupList_manageMent.findIndex(i=>i.id==e.groupId);s>-1&&window.top.groupList_manageMent.splice(s,1),this.deleteChildGroup(e.groupId,window.top.groupList_manageMent)}}),this.notice({type:"DeleteEquipGroup",data:t})}GetGroupEquips(t){const{groupId:e,equips:s}=t||{};console.log(this.alreadyUpdate[e]),this.alreadyUpdate[e]||(window.top.groupCache||(window.top.groupCache={}),window.top.groupCache[e]={},e&&s&&s instanceof Array&&(s.forEach(i=>{i.title=i.name,i.groupId=e,i.equipNo=i.id,delete i.name,window.equipCache||(window.top.equipCache={}),window.top.equipCache[i.id]=i,window.top.groupCache[e][i.id]=i}),window.top[`group-${e}`]=s,this.notice({type:"GetGroupEquips",data:{groupId:e}}),this.alreadyUpdate[e]=!0))}AddEquip(t){const{groupId:e,equips:s}=t||{};window.top[`group-${e}`]||(window.top[`group-${e}`]=[]),window.top.groupCache||(window.top.groupCache={}),window.top.groupCache[e]||(window.top.groupCache[e]={}),window.top.equipCache||(window.top.equipCache={});let i=window.top[`group-${e}`].length;if(e&&s){if(s.forEach((u,r)=>{window.top[`group-${e}`].push({equipNo:u.id,groupId:e,id:u.id,title:u.name}),window.top.equipCache[u.id]=window.top[`group-${e}`][i+r],window.top.groupCache[e][u.id]=window.top[`group-${e}`][i+r]}),!this.exist(e,window.top.groupList)){let u=this.findParentList(e,window.top.groupList_manageMent);window.top.groupList.push(...u)}this.notice({type:"AddEquip",data:t})}}moveEquips(t){let e=[],s=!0,i=[];const{sourceGroup:u,targetGroupId:r}=t||{};r&&e.push(r),u.forEach(p=>{if(e.push(p.groupId),(!window.top[`group-${r}`]||!window.top[`group-${r}`].length)&&(window.top[`group-${r}`]=[],i.push(r)),window.top.groupCache||(window.top.groupCache={}),window.top.groupCache[r]||(window.top.groupCache[r]={}),p.equips.forEach(a=>{if(a.title=a.name,a.groupId=r,a.equipNo=a.id,window.top[`group-${p.groupId}`]){let h=window.top[`group-${p.groupId}`].findIndex(n=>n.id==a.id);h>-1&&window.top[`group-${p.groupId}`].splice(h,1)}window.equipCache||(window.top.equipCache={}),window.top.equipCache[a.id]=a,window.top.groupCache[r][a.id]=a,window.top[`group-${r}`].push(a)}),!window.top[`group-${p.groupId}`].length){let a=window.top.groupList.findIndex(h=>h.id==p.groupId);a>-1&&window.top.groupList.splice(a,1),this.deleteChildGroup(p.groupId,window.top.groupList)}}),i.forEach(p=>{if(!this.exist(p,window.top.groupList)){let a=this.findParentList(p,window.top.groupList_manageMent);window.top.groupList.push(...a)}}),this.notice({type:"moveEquips",data:{updateGroups:e,buildTree:s}})}exist(t,e){return e?e.some(s=>s.id==t):!1}findParentList(t,e){let s=[];if(e){let i=e.findIndex(u=>u.id==t);i>-1&&s.push({...e[i]}),e[i].parentId&&!this.exist(e[i].parentId,window.top.groupList)&&s.push(...this.findParentList(e[i].parentId,window.top.groupList_manageMent))}return s}DeleteEquip(t){const{groupId:e,equips:s}=t||{};if(e&&s&&s instanceof Array){if(window.top[`group-${e}`])for(let i=0,u=s.length;i<u;i++){let r=window.top[`group-${e}`].findIndex(p=>p.id==s[i].id);r>-1&&window.top[`group-${e}`].splice(r,1),delete window.top.equipCache[s[i].id],delete window.top.groupCache[e][s[i].id]}this.notice({type:"DeleteEquip",data:t})}}EditEquip(t){const{equipNo:e,groupId:s,equipName:i}=t||{};s&&e&&(window[`group-${s}`]&&(window.top.equipCache[e]=i),this.notice({type:"EditEquip",data:t}))}notice(t){if(window.top.hasIframe){let e=document.getElementsByTagName("iframe");for(let s of e)s.contentWindow.postMessage(t)}else window.postMessage(t,"*")}}const J={name:"treeV2",components:{tree:z},data(){return{list:[],refId:l.generateUUID(),treeKey:null,listKey:null,hasBuildTree:!1}},props:{treeType:{type:String,default:""}},mounted(){this.treeKey=`equipGroup${this.treeType}`,this.listKey=`groupList${this.treeType}`,window.top[this.treeKey]?this.list=l.formateList(JSON.parse(JSON.stringify(window.top[this.treeKey]))):window.top[this.listKey]&&this.buildTree(),window.executeQueue||(window.executeQueues={}),window.executeQueues[this.refId]=this.destroyTree,window.addEventListener("message",o=>{o&&o.data&&o.data.type&&this[o.data.type]&&this[o.data.type]()});try{window.top.hasIframe||this.selfRequest()}catch{this.selfRequest()}},methods:{selfRequest(){new P().Init()},GetEquipGroupTreeWidthTreeType(){this.treeType&&window.top[this.listKey]&&this.buildTree()},GetEquipGroupTree(){!this.treeType&&window.top[this.listKey]&&this.buildTree()},buildTree(){if(window.top[this.listKey]){let o=l.listToTreeList(JSON.parse(JSON.stringify(window.top[this.listKey])));this.list=l.formateList(JSON.parse(JSON.stringify(o))),window.top[`equipGroup${this.treeType}`]=o,this.hasBuildTree=!0}},filterMethod(o){this.$refs[this.refId].filterMethod(o)},resetCheckedStatus(){this.$refs[this.refId].resetCheckedStatus()},getEquipSelectd(){return this.$refs[this.refId].getEquipSelectd()},getControlSelected(){return this.$refs[this.refId].getControlSelected()},destroyTree(){this.$refs[this.refId].destroyTree()}}};var V=function(){var t=this,e=t._self._c;return e("tree",t._g(t._b({ref:t.refId,attrs:{data:t.list,buildTree:t.buildTree}},"tree",{...t.$attrs,...t.$props},!1),t.$listeners))},H=[],Q=g(J,V,H,!1,null,null,null,null);const C=Q.exports;return C.install=function(o){o.component(C.name,C)},C});
|
|
1
|
+
(function(M,T){typeof exports=="object"&&typeof module<"u"?module.exports=T(require("vue"),require("@aspnet/signalr")):typeof define=="function"&&define.amd?define(["vue","@aspnet/signalr"],T):(M=typeof globalThis<"u"?globalThis:M||self,M.EquipListVue2=T(M.Vue,M.SignalR))})(this,function(M,T){"use strict";const X=o=>o&&typeof o=="object"&&"default"in o?o:{default:o};function Y(o){if(o&&o.__esModule)return o;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(o){for(const e in o)if(e!=="default"){const i=Object.getOwnPropertyDescriptor(o,e);Object.defineProperty(t,e,i.get?i:{enumerable:!0,get:()=>o[e]})}}return t.default=o,Object.freeze(t)}const Q=X(M),Z=Y(T),zt="";var tt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},U={exports:{}};/*!
|
|
2
|
+
* vue-virtual-scroll-list v2.3.4
|
|
3
|
+
* open source under the MIT license
|
|
4
|
+
* https://github.com/tangbc/vue-virtual-scroll-list#readme
|
|
5
|
+
*/(function(o,t){(function(e,i){o.exports=i(Q.default)})(tt,function(e){e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e;function i(u,n){var r=Object.keys(u);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(u);n&&(p=p.filter(function(f){return Object.getOwnPropertyDescriptor(u,f).enumerable})),r.push.apply(r,p)}return r}function s(u){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?i(Object(r),!0).forEach(function(p){l(u,p,r[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach(function(p){Object.defineProperty(u,p,Object.getOwnPropertyDescriptor(r,p))})}return u}function a(u,n){if(!(u instanceof n))throw new TypeError("Cannot call a class as a function")}function h(u,n){for(var r=0;r<n.length;r++){var p=n[r];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(u,p.key,p)}}function c(u,n,r){return n&&h(u.prototype,n),r&&h(u,r),Object.defineProperty(u,"prototype",{writable:!1}),u}function l(u,n,r){return n in u?Object.defineProperty(u,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):u[n]=r,u}function g(u){return d(u)||w(u)||S(u)||m()}function d(u){if(Array.isArray(u))return b(u)}function w(u){if(typeof Symbol<"u"&&u[Symbol.iterator]!=null||u["@@iterator"]!=null)return Array.from(u)}function S(u,n){if(!!u){if(typeof u=="string")return b(u,n);var r=Object.prototype.toString.call(u).slice(8,-1);if(r==="Object"&&u.constructor&&(r=u.constructor.name),r==="Map"||r==="Set")return Array.from(u);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(u,n)}}function b(u,n){(n==null||n>u.length)&&(n=u.length);for(var r=0,p=new Array(n);r<n;r++)p[r]=u[r];return p}function m(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
6
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var y={FRONT:"FRONT",BEHIND:"BEHIND"},O={INIT:"INIT",FIXED:"FIXED",DYNAMIC:"DYNAMIC"},I=0,B=function(){function u(n,r){a(this,u),this.init(n,r)}return c(u,[{key:"init",value:function(r,p){this.param=r,this.callUpdate=p,this.sizes=new Map,this.firstRangeTotalSize=0,this.firstRangeAverageSize=0,this.fixedSizeValue=0,this.calcType=O.INIT,this.offset=0,this.direction="",this.range=Object.create(null),r&&this.checkRange(0,r.keeps-1)}},{key:"destroy",value:function(){this.init(null,null)}},{key:"getRange",value:function(){var r=Object.create(null);return r.start=this.range.start,r.end=this.range.end,r.padFront=this.range.padFront,r.padBehind=this.range.padBehind,r}},{key:"isBehind",value:function(){return this.direction===y.BEHIND}},{key:"isFront",value:function(){return this.direction===y.FRONT}},{key:"getOffset",value:function(r){return(r<1?0:this.getIndexOffset(r))+this.param.slotHeaderSize}},{key:"updateParam",value:function(r,p){var f=this;this.param&&r in this.param&&(r==="uniqueIds"&&this.sizes.forEach(function(C,q){p.includes(q)||f.sizes.delete(q)}),this.param[r]=p)}},{key:"saveSize",value:function(r,p){this.sizes.set(r,p),this.calcType===O.INIT?(this.fixedSizeValue=p,this.calcType=O.FIXED):this.calcType===O.FIXED&&this.fixedSizeValue!==p&&(this.calcType=O.DYNAMIC,delete this.fixedSizeValue),this.calcType!==O.FIXED&&typeof this.firstRangeTotalSize<"u"&&(this.sizes.size<Math.min(this.param.keeps,this.param.uniqueIds.length)?(this.firstRangeTotalSize=g(this.sizes.values()).reduce(function(f,C){return f+C},0),this.firstRangeAverageSize=Math.round(this.firstRangeTotalSize/this.sizes.size)):delete this.firstRangeTotalSize)}},{key:"handleDataSourcesChange",value:function(){var r=this.range.start;this.isFront()?r=r-I:this.isBehind()&&(r=r+I),r=Math.max(r,0),this.updateRange(this.range.start,this.getEndByStart(r))}},{key:"handleSlotSizeChange",value:function(){this.handleDataSourcesChange()}},{key:"handleScroll",value:function(r){this.direction=r<this.offset||r===0?y.FRONT:y.BEHIND,this.offset=r,this.param&&(this.direction===y.FRONT?this.handleFront():this.direction===y.BEHIND&&this.handleBehind())}},{key:"handleFront",value:function(){var r=this.getScrollOvers();if(!(r>this.range.start)){var p=Math.max(r-this.param.buffer,0);this.checkRange(p,this.getEndByStart(p))}}},{key:"handleBehind",value:function(){var r=this.getScrollOvers();r<this.range.start+this.param.buffer||this.checkRange(r,this.getEndByStart(r))}},{key:"getScrollOvers",value:function(){var r=this.offset-this.param.slotHeaderSize;if(r<=0)return 0;if(this.isFixedType())return Math.floor(r/this.fixedSizeValue);for(var p=0,f=0,C=0,q=this.param.uniqueIds.length;p<=q;){if(f=p+Math.floor((q-p)/2),C=this.getIndexOffset(f),C===r)return f;C<r?p=f+1:C>r&&(q=f-1)}return p>0?--p:0}},{key:"getIndexOffset",value:function(r){if(!r)return 0;for(var p=0,f=0,C=0;C<r;C++)f=this.sizes.get(this.param.uniqueIds[C]),p=p+(typeof f=="number"?f:this.getEstimateSize());return p}},{key:"isFixedType",value:function(){return this.calcType===O.FIXED}},{key:"getLastIndex",value:function(){return this.param.uniqueIds.length-1}},{key:"checkRange",value:function(r,p){var f=this.param.keeps,C=this.param.uniqueIds.length;C<=f?(r=0,p=this.getLastIndex()):p-r<f-1&&(r=p-f+1),this.range.start!==r&&this.updateRange(r,p)}},{key:"updateRange",value:function(r,p){this.range.start=r,this.range.end=p,this.range.padFront=this.getPadFront(),this.range.padBehind=this.getPadBehind(),this.callUpdate(this.getRange())}},{key:"getEndByStart",value:function(r){var p=r+this.param.keeps-1,f=Math.min(p,this.getLastIndex());return f}},{key:"getPadFront",value:function(){return this.isFixedType()?this.fixedSizeValue*this.range.start:this.getIndexOffset(this.range.start)}},{key:"getPadBehind",value:function(){var r=this.range.end,p=this.getLastIndex();return this.isFixedType()?(p-r)*this.fixedSizeValue:(p-r)*this.getEstimateSize()}},{key:"getEstimateSize",value:function(){return this.isFixedType()?this.fixedSizeValue:this.firstRangeAverageSize||this.param.estimateSize}}]),u}(),jt={dataKey:{type:[String,Function],required:!0},dataSources:{type:Array,required:!0},dataComponent:{type:[Object,Function],required:!0},keeps:{type:Number,default:30},extraProps:{type:Object},estimateSize:{type:Number,default:50},direction:{type:String,default:"vertical"},start:{type:Number,default:0},offset:{type:Number,default:0},topThreshold:{type:Number,default:0},bottomThreshold:{type:Number,default:0},pageMode:{type:Boolean,default:!1},rootTag:{type:String,default:"div"},wrapTag:{type:String,default:"div"},wrapClass:{type:String,default:""},wrapStyle:{type:Object},itemTag:{type:String,default:"div"},itemClass:{type:String,default:""},itemClassAdd:{type:Function},itemStyle:{type:Object},headerTag:{type:String,default:"div"},headerClass:{type:String,default:""},headerStyle:{type:Object},footerTag:{type:String,default:"div"},footerClass:{type:String,default:""},footerStyle:{type:Object},itemScopedSlots:{type:Object}},$t={index:{type:Number},event:{type:String},tag:{type:String},horizontal:{type:Boolean},source:{type:Object},component:{type:[Object,Function]},slotComponent:{type:Function},uniqueKey:{type:[String,Number]},extraProps:{type:Object},scopedSlots:{type:Object}},Gt={event:{type:String},uniqueKey:{type:String},tag:{type:String},horizontal:{type:Boolean}},W={created:function(){this.shapeKey=this.horizontal?"offsetWidth":"offsetHeight"},mounted:function(){var n=this;typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(function(){n.dispatchSizeChange()}),this.resizeObserver.observe(this.$el))},updated:function(){this.resizeObserver.observe(this.$el)},beforeDestroy:function(){this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null)},methods:{getCurrentSize:function(){return this.$el?this.$el[this.shapeKey]:0},dispatchSizeChange:function(){this.$parent.$emit(this.event,this.uniqueKey,this.getCurrentSize(),this.hasInitial)}}},Tt=e.component("virtual-list-item",{mixins:[W],props:$t,render:function(n){var r=this.tag,p=this.component,f=this.extraProps,C=f===void 0?{}:f,q=this.index,v=this.source,E=this.scopedSlots,_=E===void 0?{}:E,z=this.uniqueKey,j=this.slotComponent,$=s(s({},C),{},{source:v,index:q});return n(r,{key:z,attrs:{role:"listitem"}},[j?j({item:v,index:q,scope:$}):n(p,{props:$,scopedSlots:_})])}}),V=e.component("virtual-list-slot",{mixins:[W],props:Gt,render:function(n){var r=this.tag,p=this.uniqueKey;return n(r,{key:p,attrs:{role:p}},this.$slots.default)}}),x={ITEM:"item_resize",SLOT:"slot_resize"},F={HEADER:"thead",FOOTER:"tfoot"},It=e.component("virtual-list",{props:jt,data:function(){return{range:null}},watch:{"dataSources.length":function(){this.virtual.updateParam("uniqueIds",this.getUniqueIdFromDataSources()),this.virtual.handleDataSourcesChange()},keeps:function(n){this.virtual.updateParam("keeps",n),this.virtual.handleSlotSizeChange()},start:function(n){this.scrollToIndex(n)},offset:function(n){this.scrollToOffset(n)}},created:function(){this.isHorizontal=this.direction==="horizontal",this.directionKey=this.isHorizontal?"scrollLeft":"scrollTop",this.installVirtual(),this.$on(x.ITEM,this.onItemResized),(this.$slots.header||this.$slots.footer)&&this.$on(x.SLOT,this.onSlotResized)},activated:function(){this.scrollToOffset(this.virtual.offset),this.pageMode&&document.addEventListener("scroll",this.onScroll,{passive:!1})},deactivated:function(){this.pageMode&&document.removeEventListener("scroll",this.onScroll)},mounted:function(){this.start?this.scrollToIndex(this.start):this.offset&&this.scrollToOffset(this.offset),this.pageMode&&(this.updatePageModeFront(),document.addEventListener("scroll",this.onScroll,{passive:!1}))},beforeDestroy:function(){this.virtual.destroy(),this.pageMode&&document.removeEventListener("scroll",this.onScroll)},methods:{getSize:function(n){return this.virtual.sizes.get(n)},getSizes:function(){return this.virtual.sizes.size},getOffset:function(){if(this.pageMode)return document.documentElement[this.directionKey]||document.body[this.directionKey];var n=this.$refs.root;return n?Math.ceil(n[this.directionKey]):0},getClientSize:function(){var n=this.isHorizontal?"clientWidth":"clientHeight";if(this.pageMode)return document.documentElement[n]||document.body[n];var r=this.$refs.root;return r?Math.ceil(r[n]):0},getScrollSize:function(){var n=this.isHorizontal?"scrollWidth":"scrollHeight";if(this.pageMode)return document.documentElement[n]||document.body[n];var r=this.$refs.root;return r?Math.ceil(r[n]):0},scrollToOffset:function(n){if(this.pageMode)document.body[this.directionKey]=n,document.documentElement[this.directionKey]=n;else{var r=this.$refs.root;r&&(r[this.directionKey]=n)}},scrollToIndex:function(n){if(n>=this.dataSources.length-1)this.scrollToBottom();else{var r=this.virtual.getOffset(n);this.scrollToOffset(r)}},scrollToBottom:function(){var n=this,r=this.$refs.shepherd;if(r){var p=r[this.isHorizontal?"offsetLeft":"offsetTop"];this.scrollToOffset(p),setTimeout(function(){n.getOffset()+n.getClientSize()+1<n.getScrollSize()&&n.scrollToBottom()},3)}},updatePageModeFront:function(){var n=this.$refs.root;if(n){var r=n.getBoundingClientRect(),p=n.ownerDocument.defaultView,f=this.isHorizontal?r.left+p.pageXOffset:r.top+p.pageYOffset;this.virtual.updateParam("slotHeaderSize",f)}},reset:function(){this.virtual.destroy(),this.scrollToOffset(0),this.installVirtual()},installVirtual:function(){this.virtual=new B({slotHeaderSize:0,slotFooterSize:0,keeps:this.keeps,estimateSize:this.estimateSize,buffer:Math.round(this.keeps/3),uniqueIds:this.getUniqueIdFromDataSources()},this.onRangeChanged),this.range=this.virtual.getRange()},getUniqueIdFromDataSources:function(){var n=this.dataKey;return this.dataSources.map(function(r){return typeof n=="function"?n(r):r[n]})},onItemResized:function(n,r){this.virtual.saveSize(n,r),this.$emit("resized",n,r)},onSlotResized:function(n,r,p){n===F.HEADER?this.virtual.updateParam("slotHeaderSize",r):n===F.FOOTER&&this.virtual.updateParam("slotFooterSize",r),p&&this.virtual.handleSlotSizeChange()},onRangeChanged:function(n){this.range=n},onScroll:function(n){var r=this.getOffset(),p=this.getClientSize(),f=this.getScrollSize();r<0||r+p>f+1||!f||(this.virtual.handleScroll(r),this.emitEvent(r,p,f,n))},emitEvent:function(n,r,p,f){this.$emit("scroll",f,this.virtual.getRange()),this.virtual.isFront()&&!!this.dataSources.length&&n-this.topThreshold<=0?this.$emit("totop"):this.virtual.isBehind()&&n+r+this.bottomThreshold>=p&&this.$emit("tobottom")},getRenderSlots:function(n){for(var r=[],p=this.range,f=p.start,C=p.end,q=this.dataSources,v=this.dataKey,E=this.itemClass,_=this.itemTag,z=this.itemStyle,j=this.isHorizontal,$=this.extraProps,P=this.dataComponent,D=this.itemScopedSlots,K=this.$scopedSlots&&this.$scopedSlots.item,k=f;k<=C;k++){var G=q[k];if(G){var L=typeof v=="function"?v(G):G[v];typeof L=="string"||typeof L=="number"?r.push(n(Tt,{props:{index:k,tag:_,event:x.ITEM,horizontal:j,uniqueKey:L,source:G,extraProps:$,component:P,slotComponent:K,scopedSlots:D},style:z,class:"".concat(E).concat(this.itemClassAdd?" "+this.itemClassAdd(k):"")})):console.warn("Cannot get the data-key '".concat(v,"' from data-sources."))}else console.warn("Cannot get the index '".concat(k,"' from data-sources."))}return r}},render:function(n){var r=this.$slots,p=r.header,f=r.footer,C=this.range,q=C.padFront,v=C.padBehind,E=this.isHorizontal,_=this.pageMode,z=this.rootTag,j=this.wrapTag,$=this.wrapClass,P=this.wrapStyle,D=this.headerTag,K=this.headerClass,k=this.headerStyle,G=this.footerTag,L=this.footerClass,xt=this.footerStyle,J={padding:E?"0px ".concat(v,"px 0px ").concat(q,"px"):"".concat(q,"px 0px ").concat(v,"px")},_t=P?Object.assign({},P,J):J;return n(z,{ref:"root",on:{"&scroll":!_&&this.onScroll}},[p?n(V,{class:K,style:k,props:{tag:D,event:x.SLOT,uniqueKey:F.HEADER}},p):null,n(j,{class:$,attrs:{role:"group"},style:_t},this.getRenderSlots(n)),f?n(V,{class:L,style:xt,props:{tag:G,event:x.SLOT,uniqueKey:F.FOOTER}},f):null,n("div",{ref:"shepherd",style:{width:E?"0px":"100%",height:E?"100%":"0px"}})])}});return It})})(U);const et=U.exports;class it{constructor(t,e,i){this.groupNodeObject=t,this.nodesMap=e,this.controlObject=i}addNodesMap(t){t&&t.forEach(e=>{this.nodesMap[e.key]=e})}removeNodesMap(t){t&&t.forEach(e=>{delete this.nodesMap[e.key]})}recycleAllNodeCache(t){for(let e in this.groupNodeObject)this.groupNodeObject[e].expand=!1,this.groupNodeObject[e].count=0,this.recycleGroupCache(this.groupNodeObject[e].key),t&&delete this.groupNodeObject[e]}recycleGroupCache(t){if(this.groupNodeObject[t]){this.groupNodeObject[t].children=[],this.removeNodesMap(this.groupNodeObject[t].equips),this.groupNodeObject[t].equips=[],this.groupNodeObject[t].equips.length=0,this.groupNodeObject[t].expand=!1;for(let e in this.groupNodeObject)this.groupNodeObject[e].groupId==t&&this.recycleGroupCache(this.groupNodeObject[e].key)}}closeBrotherNode(t){if(!!t&&this.groupNodeObject[t]){let e=this.groupNodeObject[t].groupId;for(let i in this.groupNodeObject)this.groupNodeObject[i].groupId==e&&this.groupNodeObject[i].key!=t&&this.groupNodeObject[i].expand&&(this.groupNodeObject[i].expand=!1,this.recycleGroupCache(this.groupNodeObject[i].key))}}}class st{constructor(t,e,i,s,a,h){this.equipControllObject=i,this.groupNodeObject=t,this.nodesMap=e,this.controlObject=s,this.equipCheckObject=a,this.isSearchStatus=!1,this.searchStatusGroupObject={},this.aliasName=h}resetCheckedStatus(){Object.values(this.nodesMap).forEach(t=>{this.setCheckStatus(t.key,!1,!1)}),Object.keys(this.equipCheckObject).forEach(t=>delete this.equipCheckObject[t]),this.updateGroupCheckStatus()}reComputedCheckNum(t){this.isSearchStatus=t,this.updateGroupCheckStatus()}updateCheckedStatusWithEquips(t){Object.keys(this.equipCheckObject).forEach(i=>{i.split("-").length===2&&delete this.equipCheckObject[i]});let e=[];Array.isArray(t)?e=t.map(i=>({equipNo:Number(i),groupId:null})):t!==null&&typeof t=="object"&&Object.keys(t).forEach(i=>{Array.isArray(t[i])&&t[i].forEach(s=>{e.push({equipNo:Number(s),groupId:Number(i)})})});for(let i=0,s=e.length;i<s;i++){const{equipNo:a,groupId:h}=e[i];if(h!=null){const c=`${h}-${a}`;this.setEquipCheckObject(c,!0,!1,h),this.setCheckStatus(c,!0,!1),this.updateExpandControlCheckStatus(h,a)}else{const c=window.top.equipCache&&window.top.equipCache[a];c&&(c.groupIds||(c.groupId?[c.groupId]:[])).forEach(g=>{const d=`${g}-${a}`;this.setEquipCheckObject(d,!0,!1,g),this.setCheckStatus(d,!0,!1),this.updateExpandControlCheckStatus(g,a)})}}}updateExpandControlCheckStatus(t,e){let i=this.nodesMap[`${t}-${e}`];i&&i.settings&&i.settings.length&&i.settings.forEach(s=>{this.nodesMap[`${t}-${e}-${s.setNo}`]&&this.setCheckStatus(`${t}-${e}-${s.setNo}`,!0,!1)})}updateCheckedStatusWithControls(t){for(let e=0,i=t.length;e<i;e++){let s=t[e],a,h,c;if(s!==null&&typeof s=="object"&&!Array.isArray(s))a=Number(s.equipNo),h=s.setNo,c=s.groupId;else{let g=s.split(".");a=Number(g[0]),h=g[1],c=null}this.equipControllObject[a]||(this.equipControllObject[a]=[]),this.equipControllObject[a].push(Number(h));const l=window.top.equipCache&&window.top.equipCache[a];l&&(c!=null?[c]:l.groupIds||(l.groupId?[l.groupId]:[])).forEach(d=>{const w=`${d}-${a}`,S=`${d}-${a}-${h}`;this.nodesMap[S]&&this.setCheckStatus(S,!0,!1),this.nodesMap[w]&&this.setCheckStatus(w,!1,!0),this.setEquipCheckObject(w,!1,!0,d)})}}updateGroupCheckStatus(){this.getSortedGroupsByLevel().forEach(e=>{const i=this.computeGroupStatus(e.key);this.setCheckStatus(e.key,i.checked,i.indeterminate),e.equipSelectCount=i.selectCount,e.count===0&&i.checked&&i.selectCount>0&&(e.count=i.selectCount)})}getSortedGroupsByLevel(){return Object.values(this.groupNodeObject).sort((t,e)=>e.level-t.level)}computeGroupStatus(t){const e=this.groupNodeObject[t];if(!e)return{checked:!1,indeterminate:!1,selectCount:0};let i=this.isSearchStatus?window.top[`group-${t}-search`]||[]:window.top[`group-${t}${this.aliasName}`]||[];!this.isSearchStatus&&i.length===0&&this.aliasName&&(i=window.top[`group-${t}`]||[]);let s=0,a=i.length||e.equipCount||0;if(i.length>0)i.forEach(S=>{const b=S.equipNo||S.id,m=`${t}-${b}`;this.equipCheckObject[m]&&this.equipCheckObject[m].checked&&s++}),a=i.length;else{const S=`${t}-`;i.forEach(m=>{const y=m.equipNo||m.id,O=`${S}${y}`;this.equipCheckObject[O]&&this.equipCheckObject[O].checked&&s++});let b=new Set;Object.keys(this.equipCheckObject).forEach(m=>{m.startsWith(S)&&m.split("-").length===2&&(b.add(m.split("-")[1]),this.equipCheckObject[m].checked&&s++)}),a===0&&b.size>0&&(a=b.size)}let h=0,c=0,l=!1,g=!1;e.groups&&e.groups.length>0&&e.groups.forEach(S=>{const b=this.nodesMap[S.key],m=this.groupNodeObject[S.key];if(b){let y=b.count||(m?m.equipCount:0)||0;if(y===0){const O=`${S.key}-`;let I=0;Object.keys(this.equipCheckObject).forEach(B=>{B.startsWith(O)&&B.split("-").length===2&&I++}),y=I,y===0&&b.equipSelectCount>0&&(y=b.equipSelectCount)}c+=y,y>0&&(b.checked?(h+=y,l=!0):b.indeterminate?(g=!0,l=!0):g=!0)}});const d=s+h;let w=e.count||0;return w===0&&(w=a+c),d===0&&!l?{checked:!1,indeterminate:!1,selectCount:0}:w===0?d>0?{checked:!1,indeterminate:!0,selectCount:d}:{checked:!1,indeterminate:!1,selectCount:0}:d===0?l?{checked:!1,indeterminate:!0,selectCount:d}:{checked:!1,indeterminate:!1,selectCount:0}:d===w&&!g?{checked:!0,indeterminate:!1,selectCount:d}:{checked:!1,indeterminate:!0,selectCount:d}}setControlStatus(t,e,i,s){t&&t.forEach(a=>{this.nodesMap[`${e}-${i}-${a.setNo}`]&&this.setCheckStatus(`${e}-${i}-${a.setNo}`,s,!1)})}updateControlCheckStatus(){Object.keys(this.controlObject).forEach(t=>{const[e,i]=t.split("-");let s=this.nodesMap[t];if(s)if(s.checked){let a=s.settings;this.setControlStatus(a,e,i,!0)}else if(!s.checked&&!s.indeterminate){let a=s.settings;this.setControlStatus(a,e,i,!1)}else this.equipControllObject[i]&&this.equipControllObject[i].forEach(a=>{let h=`${e}-${i}-${a}`;this.nodesMap[h]&&this.setCheckStatus(h,!0,!1)})})}getGroupChecked(){let t=[];return Object.keys(this.groupNodeObject).forEach(e=>{this.groupNodeObject[e].checked&&t.push(e)}),t}getEquipSelectd(){let t=[],e=new Set;return Object.keys(this.equipCheckObject).forEach(i=>{if(this.equipCheckObject[i].checked)try{e.add(Number(i.split("-")[1]))}catch(s){console.log(s)}}),t=Array.from(e),t}getEquipGroupSelectd(){let t=Object.keys(this.equipCheckObject);return t.length>0&&(t=this.returnArray(t)),t}returnArray(t){const e=[];return t.forEach(i=>{const s=i.split("-");if(s.length>=2){const a=parseInt(s[0]),h=parseInt(s[1]);!isNaN(a)&&!isNaN(h)&&e.push({groupId:a,equipNo:h})}}),e}parseEquipArrayToGroupFormat(t){const e={};return t.forEach(i=>{const[s,a]=i.split("-"),h=parseInt(s);isNaN(h)||(e[h]||(e[h]=[]),e[h].push(parseInt(a)))}),e}getControlSelected(){let t=[];return Object.keys(this.equipControllObject).forEach(e=>{t.push(...this.equipControllObject[e].map(i=>`${e}.${i}`))}),t}onChecked(t,e){this.isSearchStatus=e||!1,t.isGroup&&!t.isEquip?this.selectGroup(t):t.isEquip?this.selectEquip(t):t.isSetting&&this.selectControl(t)}setCheckStatus(t,e,i){this.nodesMap[t]&&(this.nodesMap[t].checked=e,this.nodesMap[t].isGroup&&(this.nodesMap[t].indeterminate=i))}setEquipCheckObject(t,e,i,s){this.equipCheckObject[t]||(this.equipCheckObject[t]={}),this.equipCheckObject[t].checked=e,this.equipCheckObject[t].indeterminate=i,this.equipCheckObject[t].groupId=s,!e&&!i&&delete this.equipCheckObject[t]}selectGroup(t){this.updateAllEquipStatus(t.key,t.checked),this.updateControlCheckStatus(),this.updateGroupCheckStatus()}updateAllEquipStatus(t,e){const i=this.groupNodeObject[t];if(!i)return;let s=this.isSearchStatus?window.top[`group-${t}-search`]||[]:window.top[`group-${t}${this.aliasName}`]||[];!this.isSearchStatus&&s.length===0&&this.aliasName&&(s=window.top[`group-${t}`]||[]),s.forEach(a=>{const h=a.equipNo||a.id,c=`${t}-${h}`;this.setEquipCheckObject(c,e,!1,t),this.nodesMap[c]&&this.setCheckStatus(c,e,!1)}),i.groups&&i.groups.length>0&&i.groups.forEach(a=>{this.updateAllEquipStatus(a.key,e)})}selectEquip(t){const e=`${t.groupId}-${t.equipNo}`;this.setEquipCheckObject(e,t.checked,!1,t.groupId),this.nodesMap[e]&&this.setCheckStatus(e,t.checked,!1),this.updateControlCheckStatus(),this.updateGroupCheckStatus()}updateEquipControl(t,e,i){this.equipControllObject[t]||(this.equipControllObject[t]=[]),i?this.equipControllObject[t].push(e):this.equipControllObject[t]=this.equipControllObject[t].filter(s=>s!=e)}selectControl(t){const e=`${t.groupId}-${t.equipNo}`,i=`${t.groupId}-${t.equipNo}-${t.setNo}`,s=this.nodesMap[e];if(!s)return;this.updateEquipControl(t.equipNo,t.setNo,t.checked),this.setCheckStatus(i,t.checked,!1);const a=s.settings||[],h=this.equipControllObject[t.equipNo]||[],c=a.length,l=h.length;t.checked?l===c?(delete this.equipControllObject[t.equipNo],this.setEquipCheckObject(e,!0,!1,t.groupId),this.setCheckStatus(e,!0,!1)):(this.setEquipCheckObject(e,!1,!0,t.groupId),this.setCheckStatus(e,!1,!0)):l===0?(this.setEquipCheckObject(e,!1,!1,t.groupId),this.setCheckStatus(e,!1,!1)):(this.setEquipCheckObject(e,!1,!0,t.groupId),this.setCheckStatus(e,!1,!0)),this.updateGroupCheckStatus()}}class ot{constructor(t,e){this.aliasName=e,this.groupNodeObject=t}resetGroupNum(t){this.clearAllEquipNum();const e=Object.keys(this.groupNodeObject).sort((i,s)=>(this.groupNodeObject[s].level||0)-(this.groupNodeObject[i].level||0));for(let i of e){let s=[];t?s=window.top[`group-${i}-search`]:s=window.top[`group-${i}${this.aliasName}`];let a=s?s.length:0;a&&(this.groupNodeObject[i].equipCount=a,this.setGroupNum(i,a))}}clearAllEquipNum(){for(let t in this.groupNodeObject)this.groupNodeObject[t].equipCount=0,this.groupNodeObject[t].count=0}setGroupNum(t,e){this.groupNodeObject[t]&&(this.groupNodeObject[t].count=Number(this.groupNodeObject[t].count)+Number(e),this.setGroupNum(this.groupNodeObject[t].groupId,e))}getAllEquipsNum(){let t=0;for(let e in this.groupNodeObject)window.top[`group-${this.groupNodeObject[e].key}${this.aliasName}`]&&(t=t+window.top[`group-${this.groupNodeObject[e].key}${this.aliasName}`].length);return t}}class H{constructor(t,e,i){this.url=t,this.connectionId=e,this.equipNo=i,this.signalr=null}openConnect(){return this.signalr&&(this.signalr.stop(),this.signalr=null),this.signalr=new Z.HubConnectionBuilder().withUrl(this.url).build(),this.signalr.serverTimeoutInMilliseconds=5e8,this.signalr.keepaliveintervalinmilliseconds=5e8,new Promise(t=>{this.signalr.start().then(()=>{this.connectionId&&this.send(),t(this.signalr)}).catch(e=>{console.log(e)})})}async send(){try{await this.signalr.invoke(this.connectionId,this.equipNo).catch(t=>{console.log("send \u53D1\u9001\u5931\u8D25"+t)})}catch(t){console.log("connectHub \u8FDE\u63A5\u5931\u8D25"+t)}}}class at{constructor(t,e,i,s,a){this.equipStatusObject=e,this.groupNodeObject=i,this.aleadyUpdateStatus={},this.isGetAllEquipStatus=!1,this.nodesMap=t,this.statusChange=s,this.openSignlr(),this.aliasName=a}openSignlr(){this.equipStatusSignlr=new H("/equipStatusMonitor","",""),this.equipStatusSignlr.openConnect().then(t=>{try{t.invoke("GetAllEquipStatus")}catch(e){console.log(e)}this.subscribeTo(t,"GetAllEquipStatus"),t.onclose(()=>{this.openSignlr()})})}subscribeTo(t,e){t.off(e),t.on(e,i=>{if(i&&i.isSuccess&&i.data&&(this[e]?this[e](i.data):this.notice({func:e,data:i.data,key:i.groupId}),e==="GetAllEquipStatus")){try{t.invoke("GetEquipChangeStatus")}catch(s){console.log(s)}this.subscribeTo(t,"GetEquipChangeStatus")}})}GetAllEquipStatus(t){this.isGetAllEquipStatus=!0,this.resetGroupStatusCounts(),Object.keys(t).forEach(e=>{this.equipStatusObject[e]=t[e]}),Object.keys(this.groupNodeObject).forEach(e=>{this.updateByGroup(e)}),this.updateAllGroupStatus()}reRenderGroupStatus(){this.resetGroupStatusCounts(),Object.keys(this.aleadyUpdateStatus).forEach(t=>{this.aleadyUpdateStatus[t]=!1}),Object.keys(this.groupNodeObject).forEach(t=>{this.updateByGroup(t)}),this.updateAllGroupStatus()}updateStatusCounts(t,e,i){if(this.groupNodeObject[t]){this.groupNodeObject[t][e]=this.groupNodeObject[t][e]+i;let s=this.groupNodeObject[t].groupId;s&&this.updateStatusCounts(s,e,i)}}updateByGroup(t){if(!this.aleadyUpdateStatus[t]){let e=window.top[`group-${t}${this.aliasName}`]||[],i=e.length;i&&(this.aleadyUpdateStatus[t]=!0,this.updateStatusCounts(t,this.statusMap[1],i),e.forEach(s=>{this.updateGroupStatusCounts(t,this.equipStatusObject[s.equipNo],1),this.nodesMap[`${t}-${s.equipNo}`]&&(this.nodesMap[`${t}-${s.equipNo}`].status=this.equipStatusObject[s.equipNo])}))}}updateGroupStatusCounts(t,e,i){if(this.nodesMap[t]&&this.statusMap[e]&&this.statusMap[i]){let s=this.statusMap[e],a=this.statusMap[i];this.updateStatusCounts(t,s,1),this.updateStatusCounts(t,a,-1)}}updateGroupStatusByKey(t){this.isGetAllEquipStatus&&(this.updateByGroup(t),this.updateAllGroupStatus())}updateAllGroupStatus(){Object.keys(this.groupNodeObject).forEach(t=>{let e=this.groupNodeObject[t],i=this.getSingleStatus(e);if(i!==-1)this.nodesMap[e.key].status=i;else if(e.alarmCounts>0)this.nodesMap[e.key].status=2;else if(e.noComCounts>0&&(e.normalCounts>0||e.lsSetCounts>0||e.initializeCounts>0||e.withdrawCounts>0||e.backUpCounts>0))this.nodesMap[e.key].status=2;else if(e.backUpCounts>0&&(e.normalCounts>0||e.lsSetCounts>0||e.initializeCounts>0||e.withdrawCounts>0)){let s=this.getStatusArray(e).filter(a=>a.statusMap!="backUpCounts"&&a.value>0);s.length>0?this.nodesMap[e.key].status=s.pop().status:this.nodesMap[e.key].status=6}else if(e.normalCounts>0||e.lsSetCounts>0||e.initializeCounts>0||e.withdrawCounts>0){let s=this.getStatusArray(e).filter(a=>a.value>0);s.length>0?this.nodesMap[e.key].status=s.pop().status:this.nodesMap[e.key].status=1}})}getStatusArray(t){let e=[],i=Object.values(this.statusMap);return Object.keys(t).forEach(s=>{i.includes(s)&&e.push({statusMap:s,status:this.reverseStatusMap[s],value:t[s]})}),e}getSingleStatus(t){let e=this.getStatusArray(t),i=e.filter(s=>s.value==0);if(i.length==e.length)return 1;if(i.length==6){let s=e.find(a=>a.value>0);if(s)return s.status}return-1}GetEquipChangeStatus(t){this.setStatus(t),this.updateAllGroupStatus()}setStatus(t){let e=this.equipStatusObject[t.equipNo];const i=this.getEquipGroupIds(t.equipNo);t.status!=3&&i.length>0&&(i.forEach(s=>{switch(t.status){case 0:e==6&&this.setGroupStatus(s,!1,6);break;case 1:e==6?this.setGroupStatus(s,!1,6):e==2&&this.setGroupStatus(s,!1,2);break;case 2:e!=2&&this.setGroupStatus(s,!0,2),e==6&&this.setGroupStatus(s,!1,6);break;case 6:e==2&&this.setGroupStatus(s,!1,2),e!=6&&this.setGroupStatus(s,!0,6);break}let a=`${s}-${t.equipNo}`;this.nodesMap[a]&&(this.nodesMap[a].status=t.status)}),this.equipStatusObject[t.equipNo]=t.status,this.statusChange(i[0],t.equipNo,t.status))}getEquipGroupIds(t){const e=[];if(window.top.groupCache&&Object.keys(window.top.groupCache).forEach(i=>{window.top.groupCache[i]&&window.top.groupCache[i][t]&&e.push(Number(i))}),e.length===0){const i=window.top.equipCache&&window.top.equipCache[t];if(i){if(i.groupIds&&i.groupIds.length>0)return i.groupIds;i.groupId&&e.push(i.groupId)}}return e}setGroupStatus(t,e,i){e?i==2?(this.nodesMap[t].alarmCounts=this.nodesMap[t].alarmCounts+1,this.nodesMap[t].alarmCounts>0&&(this.nodesMap[t].status=2)):(this.nodesMap[t].backUpCounts=this.nodesMap[t].backUpCounts+1,this.nodesMap[t].alarmCounts==0&&this.nodesMap[t].backUpCounts>0&&(this.nodesMap[t].status=6)):i==2?(this.nodesMap[t].alarmCounts=this.nodesMap[t].alarmCounts-1,this.nodesMap[t].alarmCounts==0&&(this.nodesMap[t].status=1)):(this.nodesMap[t].backUpCounts=this.nodesMap[t].backUpCounts-1,this.nodesMap[t].alarmCounts==0&&(this.nodesMap[t].backUpCounts==0?this.nodesMap[t].status=1:this.nodesMap[t].status=6)),this.nodesMap[t].groupId&&this.setGroupStatus(this.nodesMap[t].groupId,e,i)}resetGroupStatusCounts(){for(let t in this.groupNodeObject)Object.values(this.statusMap).forEach(e=>{this.groupNodeObject[t][e]=0})}countGroupStatus(t){this.resetGroupStatusCounts();for(let e in this.groupNodeObject){let i=[];if(t?i=window.top[`group-${e}-search`]:i=window.top[`group-${e}${this.aliasName}`],i?i.length:0)for(let a of i){const h=this.equipStatusObject[a.equipNo];this.setGroupNum(a.groupId,h)}}}setGroupNum(t,e){!this.groupNodeObject[t]||(this.groupNodeObject[t][this.statusMap[e]]+=1,this.setGroupNum(this.groupNodeObject[t].groupId,e))}}const rt=Object.assign({},{getSetParm(o){if(window.axios)return window.axios({method:"post",url:"/IoT/api/v3/EquipList/GetSetParmByEquipNo",params:o,data:o})}});class nt{constructor(t,e){this.nodesMap=t,this.equipControllObject=e}async getSetting(t,e,i,s){let[a,h]=String(t).split("-"),c={equipNo:h};await rt.getSetParm(c).then(l=>{if(l.data.code==200){let g=l&&l.data&&l.data.data&&l.data.data.rows||[];this.nodesMap[t].settings||(this.nodesMap[t].settings=[]),g&&g.length>0&&this.nodesMap[t]&&(g.forEach(d=>{d.title=d.setNm,d.key=`${a}-${h}-${d.setNo}`,d.level=Number(i)+1,d.checked=s||this.equipControllObject[h]&&this.equipControllObject[h].includes(d.setNo),d.isSetting=!0,d.equipNo=h,d.groupId=a,d.equipName=e}),this.nodesMap[t].settings=[...g])}})}}class N{static formateList(t,e){let i=[];for(const s of t){let a={};a.count=0,a.equipSelectCount=0,a.controlSelectCount=0,a.equipCount=s.equipCount||0,a.title=s.name,a.key=s.id,a.isGroup=!0,a.children=[],a.status=1,a.level=e||1,a.expand=!e,a.equips=[],a.groupId=s.parentId,a.groups=[],a.alarmCounts=0,a.backUpCounts=0,a.noComCounts=0,a.normalCounts=0,a.lsSetCounts=0,a.initializeCounts=0,a.withdrawCounts=0,a.indeterminate=!1,a.checked=!1,a.visible=!0,a.nodeEquipSelectCount=0,a.checkedEquips=[],a.halfCheckedEquips=[],a.selectControlCount=0,s.children&&s.children.length>0&&(a.groups=[...this.formateList(s.children,e?e+1:2)]),i.push(a)}return i}static deepClone(t,e,i,s,a,h){let c=[];if(t)for(let l=0,g=t.length;l<g;l++){const d=t[l].id||t[l].equipNo,w=`${s}-${d}`;c.push({isGroup:i,key:w,status:h[d]||0,title:t[l].title,level:e,expand:!1,isEquip:!0,loading:!1,indeterminate:a[w]&&a[w].indeterminate||!1,checked:a[w]&&a[w].checked||!1,groupId:s,equipNo:d,visible:!0,settings:[]})}return c}static copyOrigin(t){let e=[];return t.forEach(i=>{e.push({...i})}),e}static getPosition(t,e){let i=0;for(let s=0,a=e.length;s<a;s++)if(e[s].key==t){i=s-30;break}return i}static flattern(t,e){t.forEach(i=>{i.isGroup&&(e[`${i.key}`]=null,e[`${i.key}`]=i),i.groups&&i.groups.length&&this.flattern(i.groups,e)})}static generateUUID(){let t=new Date().getTime();return window.performance&&typeof window.performance.now=="function"&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(i){let s=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(i==="x"?s:s&3|8).toString(16)})}static listToTreeList(t){const e=t,i=[],s={};return e.forEach(a=>{s[a.id]=a}),e.forEach(a=>{const h=s[a.parentId];h?(h.children||(h.children=[])).push(a):i.push(a)}),i}}class ut{constructor(t,e,i){this.showSettings=e,this.groupNodeObject=t,this.aliasName=i}filterMethod(t){for(let e in this.groupNodeObject)t&&this.updateBySearch(e,t)}updateBySearch(t,e){let i=window.top[`group-${this.groupNodeObject[t].key}${this.aliasName}`];i&&(i=i.filter(s=>s.title.includes(e)),window.top[`group-${this.groupNodeObject[t].key}-search`]=N.copyOrigin(i))}}function A(o,t,e,i,s,a,h,c){var l=typeof o=="function"?o.options:o;t&&(l.render=t,l.staticRenderFns=e,l._compiled=!0),i&&(l.functional=!0),a&&(l._scopeId="data-v-"+a);var g;if(h?(g=function(S){S=S||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!S&&typeof __VUE_SSR_CONTEXT__<"u"&&(S=__VUE_SSR_CONTEXT__),s&&s.call(this,S),S&&S._registeredComponents&&S._registeredComponents.add(h)},l._ssrRegister=g):s&&(g=c?function(){s.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:s),g)if(l.functional){l._injectStyles=g;var d=l.render;l.render=function(b,m){return g.call(m),d(b,m)}}else{var w=l.beforeCreate;l.beforeCreate=w?[].concat(w,g):[g]}return{exports:o,options:l}}const ht={props:{source:{type:Object},groupEditAndNew:{type:Function},deleteGroup:{type:Function}}};var pt=function(){var t=this,e=t._self._c;return e("div",{staticClass:"operates"},[e("el-popover",{attrs:{placement:"bottom",trigger:"hover"},scopedSlots:t._u([{key:"reference",fn:function(){return[e("i",{staticClass:"el-icon-more"})]},proxy:!0}])},[e("el-button-group",{staticClass:"new-button-group setModule"},[e("el-button",{staticClass:"elBtn",attrs:{type:"text",size:"small",icon:" iconfont icon-tubiao20_bianji"},on:{click:function(i){return i.stopPropagation(),t.groupEditAndNew(!1,t.source)}}},[t._v(" "+t._s(t.$t("equipInfo.poverTips.rename"))+" ")]),e("el-button",{staticClass:"elBtn",attrs:{type:"text",size:"small",icon:" iconfont icon-gw-icon-tianjia1"},on:{click:function(i){return t.groupEditAndNew(!0,t.source)}}},[t._v(" "+t._s(t.$t("equipInfo.poverTips.newChildGroup"))+" ")]),t.source.level!=1?e("el-button",{attrs:{type:"danger",size:"small",icon:" iconfont icon-tubiao20_shanchu"},on:{click:function(i){return i.stopPropagation(),t.deleteGroup(t.source)}}},[t._v(" "+t._s(t.$t("publics.button.deletes"))+" ")]):t._e()],1)],1)],1)},lt=[],ct=A(ht,pt,lt,!1,null,null,null,null);const dt=ct.exports,ft={name:"ElTreeVirtualNode",componentName:"ElTreeVirtualNode",props:{isSearchStatus:{type:Boolean,default:!1},searchName:{type:String,default:""},expanding:{type:Boolean,default:!1},aleadyLoadAll:{type:Boolean,default:!1},groupLoading:{type:Boolean,default:!1},source:{default(){return{}}},showCheckbox:{type:Boolean,default:!1},showStatus:{type:Boolean,default:!1},showOperate:{type:Boolean,default:!1},currentSelect:{type:Number|String,default:-1},nodeClick:{type:Function},onChecked:{type:Function},groupEditAndNew:{type:Function},deleteGroup:{type:Function},colorConfig:{type:Object},index:{type:Number,default:-1}},components:{oparate:dt},computed:{getColor(){return function(o){let t;switch(o){case 0:t=this.colorConfig.noComm;break;case 1:t=this.colorConfig.normal;break;case 2:t=this.colorConfig.alarm;break;case 3:t=this.colorConfig.lsSet;break;case 4:t=this.colorConfig.initialize;break;case 5:t=this.colorConfig.withdraw;break;case 6:t=this.colorConfig.BackUp;break;default:t=this.colorConfig.noComm;break}return t}}},data(){return{indent:13}},methods:{clickFunction(){this.source.expand=!this.source.expand,this.nodeClick(this.source,this.index,this.source.level,this.source.checked)},checkedChange(o){this.onChecked(this.source)}}};var gt=function(){var t=this,e=t._self._c;return e("div",{staticClass:"el-tree-node",class:{parent_tag:t.source.isGroup,child_tags:!t.source.isGroup,selectedColor:t.currentSelect===t.source.key&&!t.source.isGroup},on:{click:t.clickFunction}},[e("div",{staticClass:"el-tree-node__content"},[e("span",{staticClass:"el-tree__indent",style:{width:(t.source.level-1)*t.indent+"px"},attrs:{"aria-hidden":"true"}}),t.source.isGroup?e("span",{class:[{"is-leaf":!t.source.isGroup,expanded:t.source.isGroup&&t.source.expand},"el-tree-node__expand-icon","el-icon-arrow-right"]}):t._e(),e("div",{staticClass:"nodeContent"},[t.showCheckbox?e("el-checkbox",{attrs:{indeterminate:t.source.indeterminate},on:{change:t.checkedChange},model:{value:t.source.checked,callback:function(i){t.$set(t.source,"checked",i)},expression:"source.checked"}}):t._e(),t.showStatus?e("span",{staticClass:"circle"},[t.source.status!=6?e("span",{staticClass:"yd",style:{backgroundColor:t.getColor(t.source.status)}}):e("i",{staticClass:"iconfont icon-gw-icon-beiji2",style:{color:t.colorConfig.BackUp}})]):t._e(),e("span",{staticClass:"label"},[t._v(" "+t._s(t.source.title))]),t.source.isGroup&&!t.source.isEquip?e("span",{staticClass:"equipNumber"},[t._v(" "+t._s(t.source.count)+" ")]):t._e(),t.source.isGroup&&t.showOperate?e("oparate",{attrs:{source:t.source,groupEditAndNew:t.groupEditAndNew,deleteGroup:t.deleteGroup}}):t._e(),t.source.loading?e("span",{staticClass:"el-tree-node__loading-icon el-icon-loading"}):t._e()],1)])])},St=[],Ct=A(ft,gt,St,!1,null,null,null,null);const wt=Ct.exports,bt={components:{VirtualList:et},data(){return{itemComponent:wt,visibleList:[],currentSelect:-1,equipStatusManage:null,cacheManage:null,searchManage:null,equipNumManage:null,requestManage:null,checkStatusManage:null,groupNodeObject:{},nodesMap:{},equipCheckObject:{},equipStatusObject:{},controlObject:{},isSearchStatus:!1,equipControllObject:{},expandGroup:[],updateJob:null}},props:{data:{type:Array},selectEquips:{type:Array,default:()=>[]},controllList:{type:Array,default:()=>[]},showSettings:{type:Boolean,default:!1},showSelectNum:{type:Boolean,default(){return!1}},showCheckbox:{type:Boolean,default:!1},showStatus:{type:Boolean,default:!1},showOperate:{type:Boolean,default:!1},defaultExpandAll:{type:Boolean,default:!1},currentNodeKey:[String,Number],colorConfig:{type:Object,default:()=>({noComm:"#a0a0a0",normal:"#63e03f",alarm:"#f22433",lsSet:"#bebcaa",initialize:"#289ac0",withdraw:"#ffc0cb",BackUp:"#f8901c"})},treeType:{type:String,default:""},buildTree:{type:Function},filterData:{type:Function},alias:{type:String,default:""}},watch:{data(o){o&&o.length&&(N.flattern(this.data,this.groupNodeObject),this.cacheManage.addNodesMap(Object.values(this.groupNodeObject).map(t=>t)),this.init())},controllList(o){this.updateCheckedStatusWithControls()},selectEquips(o){this.updateCheckedStatusWithEquips()}},computed:{aliasName(){return this.alias?`-${this.alias}`:""}},created(){this.showCheckbox&&(this.checkStatusManage=new st(this.groupNodeObject,this.nodesMap,this.equipControllObject,this.controlObject,this.equipCheckObject,this.aliasName)),this.cacheManage=new it(this.groupNodeObject,this.nodesMap,this.controlObject,this.equipCheckObject),this.searchManage=new ut(this.groupNodeObject,this.showSettings,this.aliasName),this.equipNumManage=new ot(this.groupNodeObject,this.aliasName),this.requestManage=new nt(this.nodesMap,this.equipControllObject)},mounted(){this.updateCheckedStatusWithControls(),this.updateCheckedStatusWithEquips(),window.addEventListener("message",o=>{o.data.type&&this[o.data.type]&&this[o.data.type](o.data.data)})},methods:{init(){this.data[0].expand=!0,this.updateTreeList(),setTimeout(()=>{Object.values(this.groupNodeObject).forEach(o=>{!o.expand&&this.expandGroup.includes(o.key)&&(o.expand=!0),this.filterWithAlias(o.key),this.updateGroupEquips(o.key,!0)}),this.equipNumManage.resetGroupNum(this.isSearchStatus),this.showStatus&&!this.equipStatusManage&&(this.equipStatusManage=new at(this.nodesMap,this.equipStatusObject,this.groupNodeObject,this.statusChange,this.aliasName)),this.filterEmptyGroup(),this.showCheckbox&&this.checkStatusManage&&(this.updateCheckedStatusWithEquips(),this.checkStatusManage.updateGroupCheckStatus())},100)},filterEmptyGroup(){if(this.isSearchStatus){let o=[];Object.values(this.groupNodeObject).forEach(t=>{t.isGroup&&!t.isEquip&&!t.count&&o.push(t.key)}),this.visibleList=this.visibleList.filter(t=>!o.includes(t.key))}},filterWithAlias(o){if(this.aliasName){let t=window.top[`group-${o}`]||[];window.top[`group-${o}${this.aliasName}`]=this.filterData(t)}},updateCurrentSelect(){window.top.equipCache&&window.top.equipCache[this.currentNodeKey]&&(this.currentSelect=`${window.top.equipCache[this.currentNodeKey].groupId}-${this.currentNodeKey}`)},statusChange(o,t,e){this.currentSelect==`${o}-${t}`&&this.$emit("statusChange",t,e)},updateCheckWidthJob(){this.showCheckbox&&(this.checkStatusManage.resetCheckedStatus(),this.updateCheckedStatusWithControls(),this.updateCheckedStatusWithEquips())},updateGroupEquips(o,t){if(!this.isSearchStatus&&this.groupNodeObject[o]){let e=this.equipNumManage.getAllEquipsNum();this.$emit("getTotal",e)}this.groupNodeObject[o].expand&&this.updateList(o,this.groupNodeObject[o].level,null,!1),this.showStatus&&this.equipStatusManage&&this.equipStatusManage.updateGroupStatusByKey(o)},updateList(o){if(this.groupNodeObject[o]){let t=[];this.isSearchStatus?(t=window.top[`group-${o}-search`],this.groupNodeObject[o].equips=[...N.deepClone(t,Number(this.groupNodeObject[o].level)+1,this.showSettings,o,this.equipCheckObject,this.equipStatusObject)]):(t=window.top[`group-${o}${this.aliasName}`],this.groupNodeObject[o].equips=[...N.deepClone(t,Number(this.groupNodeObject[o].level)+1,this.showSettings,o,this.equipCheckObject,this.equipStatusObject)]),this.cacheManage.addNodesMap(this.groupNodeObject[o].equips),this.cacheManage.closeBrotherNode(o),this.visibleList=[],this.updateTreeList(this.data),this.updateCurrentSelect()}},updateTreeList(o){o&&o.forEach(t=>{this.visibleList.push(t),t.expand?t.isEquip?(t.children||(t.children=[]),t.settings&&(t.children=[...t.settings||[]])):t.children=[...t.equips||[],...t.groups||[]]:t.children=[],this.updateTreeList(t.children||[])})},nodeClick(o,t,e,i){this.$emit("node-click",{...o,key:o.isEquip?o.equipNo:o.key}),o.isGroup?o.isEquip?this.equipClick(o,t,i):this.groupClick(o,t,i):this.currentSelect=o.key},groupClick(o,t,e){o.expand?this.updateList(o.key,o.level,t,e):(this.cacheManage.recycleGroupCache(o.key),this.visibleList=[],this.updateTreeList(this.data)),this.isSearchStatus&&this.filterEmptyGroup()},async equipClick(o,t,e){this.showSettings&&(o.expand?(o.loading=!0,await this.requestManage.getSetting(o.key,o.title,o.level,e),this.controlObject[`${o.groupId}-${o.equipNo}`]={groupId:o.groupId},o.loading=!1,this.visibleList.splice(t+1,0,...this.nodesMap[o.key].settings),this.cacheManage.addNodesMap(this.nodesMap[o.key].settings)):(this.visibleList.splice(t+1,this.nodesMap[o.key].settings.length),this.cacheManage.removeNodesMap(this.nodesMap[o.key].settings),this.nodesMap[o.key].settings=[],delete this.controlObject[`${o.groupId}-${o.equipNo}`]))},onChecked(o){this.checkStatusManage&&this.checkStatusManage.onChecked(o,this.isSearchStatus),this.$emit("onCheck",o)},groupEditAndNew(o,t){this.$emit("groupEditAndNew",{isGroupNew:o,node:t})},deleteGroup(o){this.$emit("deleteGroup",o)},updateCheckedStatusWithControls(){this.controllList&&this.controllList.length&&this.checkStatusManage&&this.checkStatusManage&&this.checkStatusManage.updateCheckedStatusWithControls(this.controllList)},updateCheckedStatusWithEquips(){if(!this.checkStatusManage||!this.selectEquips)return;(Array.isArray(this.selectEquips)?this.selectEquips.length>0:Object.keys(this.selectEquips).length>0)&&(this.checkStatusManage.updateCheckedStatusWithEquips(this.selectEquips),this.checkStatusManage.updateGroupCheckStatus())},resetCheckedStatus(){this.checkStatusManage&&this.checkStatusManage.resetCheckedStatus()},getEquipSelectd(){return this.checkStatusManage&&this.checkStatusManage.getEquipSelectd()},getEquipGroupSelectd(){return this.checkStatusManage&&this.checkStatusManage.getEquipGroupSelectd()},getControlSelected(){return this.checkStatusManage&&this.checkStatusManage.getControlSelected()},recordExpandGroup(){this.expandGroup=[],Object.values(this.groupNodeObject).forEach(o=>{o.expand&&this.expandGroup.push(o.key)})},removeExpandGroup(){this.$nextTick(()=>{this.expandGroup=[]})},filterMethod(o){this.visibleList=[],this.cacheManage.recycleAllNodeCache(),o?(this.isSearchStatus=!0,this.searchManage.filterMethod(o)):this.isSearchStatus=!1,this.init(),this.$nextTick(()=>{this.$refs.virtualList.scrollToIndex(0)}),this.equipNumManage.resetGroupNum(this.isSearchStatus),this.equipStatusManage&&this.equipStatusManage.countGroupStatus(this.isSearchStatus),this.showCheckbox&&(this.checkStatusManage&&this.checkStatusManage.reComputedCheckNum(this.isSearchStatus),this.checkStatusManage&&this.checkStatusManage.updateGroupCheckStatus())},rebuildTree(){this.recordExpandGroup(),this.checkStatusManage&&this.checkStatusManage.resetCheckedStatus(),this.cacheManage.recycleAllNodeCache(!0),this.$nextTick(()=>{this.buildTree(),this.removeExpandGroup()})},destroyTree(){this.cacheManage.recycleAllNodeCache(!0),this.visibleList=[],this.updateTreeList(this.data)},GetGroupEquips(o){o.groupId&&this.groupNodeObject[o.groupId]&&!this.isSearchStatus&&(this.updateGroupEquips(o.groupId,!0),this.updateJob&&clearTimeout(this.updateJob),this.updateJob=setTimeout(()=>{this.equipNumManage.resetGroupNum(this.isSearchStatus),this.updateCheckWidthJob()},500))},DeleteEquip(o){const{groupId:t,equips:e}=o||{};t&&this.groupNodeObject[t]&&(this.updateGroupEquips(o.groupId),this.equipNumManage.resetGroupNum(),this.checkStatusManage&&this.checkStatusManage.resetCheckedStatus()),e.length&&e.forEach(i=>{let s=this.nodesMap[`${t}-${i.id}`];s&&(this.currentSelect.toString().includes(i.id)&&this.$emit("currentDelete"),this.showStatus&&(s.status==2||s.status==0?this.equipStatusManage.setGroupStatus(t,!1,2):s.status==6&&this.equipStatusManage.setGroupStatus(t,!1,6)),delete this.nodesMap[`${t}-${i.id}`],delete this.equipCheckObject[`${t}-${i.id}`]),delete this.equipStatusObject[i.id]}),this.equipStatusManage&&this.equipStatusManage.reRenderGroupStatus()},moveEquips(o){const{updateGroups:t,buildTree:e}=o||{};!e&&t?t.forEach(i=>{i&&this.groupNodeObject[i]&&(this.updateGroupEquips(i),this.equipNumManage.resetGroupNum(),this.checkStatusManage&&this.checkStatusManage.resetCheckedStatus())}):e&&this.rebuildTree(),this.equipStatusManage&&this.equipStatusManage.reRenderGroupStatus()},DeleteEquipGroup(o){o.forEach(t=>{t.groupId&&this.nodesMap[t.groupId]&&(this.isSearchStatus||this.rebuildTree())}),this.equipStatusManage&&this.equipStatusManage.reRenderGroupStatus()},AddEquipGroup(o){const{parentGroupId:t,groupId:e}=o||{};e&&this.nodesMap[t]&&this.treeType&&(this.isSearchStatus||this.rebuildTree())},EditEquipGroup(o){const{groupId:t,groupName:e}=o;this.nodesMap[t]&&(this.nodesMap[t].title=e)},AddEquip(o){const{groupId:t}=o||{};t&&(this.isSearchStatus||this.rebuildTree(),this.equipStatusManage&&this.equipStatusManage.reRenderGroupStatus())},EditEquip(o){const{equipNo:t,groupId:e,equipName:i}=o||{};this.nodesMap[`${e}-${t}`]&&(this.isSearchStatus||(this.nodesMap[`${e}-${t}`].title=i))}}};var mt=function(){var t=this,e=t._self._c;return e("div",{staticClass:"gw-tree",style:{height:"100%"}},[e("div",{staticClass:"tree",style:{height:"100%"}},[e("virtual-list",{ref:"virtualList",staticClass:"virtualList",attrs:{"data-key":"key","data-sources":t.visibleList,"data-component":t.itemComponent,keeps:40,"extra-props":{currentSelect:t.currentSelect,nodeClick:t.nodeClick,showStatus:t.showStatus,showSettings:t.showSettings,showCheckbox:t.showCheckbox,onChecked:t.onChecked,showOperate:t.showOperate,groupEditAndNew:t.groupEditAndNew,deleteGroup:t.deleteGroup,colorConfig:t.colorConfig,isSearchStatus:t.isSearchStatus}}})],1)])},yt=[],qt=A(bt,mt,yt,!1,null,null,null,null);const Ot=qt.exports;class vt{constructor(){this.eGroupNotify=new H("/eGroupNotify","",""),this.alreadyUpdate={},this.notify=null}stop(){this.notify&&this.notify.stop()}Init(){this.eGroupNotify.openConnect().then(t=>{this.notify=t;try{t.invoke("GetEquipGroupTree"),t.invoke("GetAllEquipGroupTree")}catch(e){console.log(e)}this.subscribeTo(t,"GetEquipGroupTree"),this.subscribeTo(t,"AddEquipGroup"),this.subscribeTo(t,"EditEquipGroup"),this.subscribeTo(t,"DeleteEquipGroup");try{t.invoke("GetGroupEquips")}catch(e){console.log(e)}this.subscribeTo(t,"GetGroupEquips"),this.subscribeTo(t,"AddEquip"),this.subscribeTo(t,"DeleteEquip"),this.subscribeTo(t,"EditEquip"),this.subscribeTo(t,"moveEquips"),this.subscribeTo(t,"CopyEquips"),this.subscribeTo(t,"GetAllEquipGroupTree"),t.onclose(e=>{try{this.Init()}catch(i){console.log(i)}console.log("\u91CD\u8FDE",e)})}).catch(t=>{console.error(t)})}subscribeTo(t,e){t.off(e),t.on(e,i=>{i&&i.isSuccess&&(this[e]?this[e](i.data):this.notice({func:e,data:i.data,key:i.groupId}))})}GetEquipGroupTree(t){window.top.groupList||(window.top.groupList=t,this.notice({type:"GetEquipGroupTree"}))}GetAllEquipGroupTree(t){window.top.groupList_manageMent||(window.top.groupList_manageMent=t,this.notice({type:"GetEquipGroupTreeWidthTreeType"}))}AddEquipGroup(t){const{parentGroupId:e,groupId:i,groupName:s}=t||{};i&&(window.top.groupList_manageMent||(window.top.groupList_manageMent=[]),window.top.groupList_manageMent.push({parentId:e,id:i,name:s,equipCount:0}),this.notice({type:"AddEquipGroup",data:t}))}EditEquipGroup(t){const{groupId:e,groupName:i}=t;window.top.groupList&&window.groupList.forEach(s=>{s.id==e&&(s.name=i)}),window.top.groupList_manageMent&&window.groupList_manageMent.forEach(s=>{s.id==e&&(s.name=i)}),this.notice({type:"EditEquipGroup",data:t})}deleteChildGroup(t,e){let i=[];e.forEach(s=>{s.parentId==t&&i.push(s.id)}),i.forEach(s=>{let a=e.findIndex(h=>h.id==s);a>-1&&e.splice(a,1),this.deleteChildGroup(s,e)})}DeleteEquipGroup(t){t.forEach(e=>{if(window.top.groupList){let i=window.top.groupList.findIndex(s=>s.id==e.groupId);i>-1&&window.top.groupList.splice(i,1),this.deleteChildGroup(e.groupId,window.top.groupList)}if(window.top.groupList_manageMent){let i=window.top.groupList_manageMent.findIndex(s=>s.id==e.groupId);i>-1&&window.top.groupList_manageMent.splice(i,1),this.deleteChildGroup(e.groupId,window.top.groupList_manageMent)}}),this.notice({type:"DeleteEquipGroup",data:t})}GetGroupEquips(t){const{groupId:e,equips:i}=t||{};console.log(this.alreadyUpdate[e]),this.alreadyUpdate[e]||(window.top.groupCache||(window.top.groupCache={}),window.top.groupCache[e]={},e&&i&&i instanceof Array&&(i.forEach(s=>{s.title=s.name,s.groupId=e,s.equipNo=s.id,window.top.equipCache||(window.top.equipCache={}),window.top.equipCache[s.id]=s,window.top.groupCache[e][s.id]=s}),window.top[`group-${e}`]=i,this.notice({type:"GetGroupEquips",data:{groupId:e}}),this.alreadyUpdate[e]=!0))}AddEquip(t){const{groupId:e,equips:i}=t||{};window.top[`group-${e}`]||(window.top[`group-${e}`]=[]),window.top.groupCache||(window.top.groupCache={}),window.top.groupCache[e]||(window.top.groupCache[e]={}),window.top.equipCache||(window.top.equipCache={});let s=window.top[`group-${e}`].length;if(e&&i){if(i.forEach((a,h)=>{window.top[`group-${e}`].push({equipNo:a.id,groupId:e,id:a.id,title:a.name}),window.top.equipCache[a.id]=window.top[`group-${e}`][s+h],window.top.groupCache[e][a.id]=window.top[`group-${e}`][s+h]}),!this.exist(e,window.top.groupList)){let a=this.findParentList(e,window.top.groupList_manageMent);window.top.groupList.push(...a)}this.notice({type:"AddEquip",data:t})}}moveEquips(t){let e=[],i=!0,s=[];const{sourceGroup:a,targetGroupId:h}=t||{};h&&e.push(h),a.forEach(c=>{if(e.push(c.groupId),(!window.top[`group-${h}`]||!window.top[`group-${h}`].length)&&(window.top[`group-${h}`]=[],s.push(h)),window.top.groupCache||(window.top.groupCache={}),window.top.groupCache[h]||(window.top.groupCache[h]={}),c.equips.forEach(l=>{if(!l.name&&window.top.equipCache&&window.top.equipCache[l.id]&&(l.name=window.top.equipCache[l.id].title||window.top.equipCache[l.id].name),l.title=l.name||"",l.groupId=h,l.equipNo=l.id,window.top[`group-${c.groupId}`]){let g=window.top[`group-${c.groupId}`].findIndex(d=>d.id==l.id);g>-1&&window.top[`group-${c.groupId}`].splice(g,1)}window.top.equipCache||(window.top.equipCache={}),window.top.equipCache[l.id]=l,window.top.groupCache[h][l.id]=l,window.top[`group-${h}`].push(l)}),!window.top[`group-${c.groupId}`].length){let l=window.top.groupList.findIndex(g=>g.id==c.groupId);l>-1&&window.top.groupList.splice(l,1),this.deleteChildGroup(c.groupId,window.top.groupList)}}),s.forEach(c=>{if(!this.exist(c,window.top.groupList)){let l=this.findParentList(c,window.top.groupList_manageMent);window.top.groupList.push(...l)}}),this.notice({type:"moveEquips",data:{updateGroups:e,buildTree:i}})}CopyEquips(t){const{targetGroupId:e,equips:i}=t||{};if(!e||!i||!Array.isArray(i)){console.warn("CopyEquips: \u65E0\u6548\u7684\u6570\u636E\u683C\u5F0F",t);return}let s=[e],a=[];window.top[`group-${e}`]||(window.top[`group-${e}`]=[],a.push(e)),window.top.groupCache||(window.top.groupCache={}),window.top.groupCache[e]||(window.top.groupCache[e]={}),window.top.equipCache||(window.top.equipCache={}),i.forEach(h=>{!h.name&&window.top.equipCache&&window.top.equipCache[h.id]&&(h.name=window.top.equipCache[h.id].title||window.top.equipCache[h.id].name);const c={id:h.id,equipNo:h.id,groupId:e,title:h.name||"",name:h.name||""};window.top.equipCache[h.id]=c,window.top.groupCache[e][h.id]=c,window.top[`group-${e}`].push(c)}),a.forEach(h=>{if(!this.exist(h,window.top.groupList)){let c=this.findParentList(h,window.top.groupList_manageMent);window.top.groupList.push(...c)}}),this.notice({type:"moveEquips",data:{updateGroups:s,buildTree:!1,targetGroupId:e,equipCount:i.length}})}exist(t,e){return e?e.some(i=>i.id==t):!1}findParentList(t,e){let i=[];if(e){let s=e.findIndex(a=>a.id==t);s>-1&&i.push({...e[s]}),e[s].parentId&&!this.exist(e[s].parentId,window.top.groupList)&&i.push(...this.findParentList(e[s].parentId,window.top.groupList_manageMent))}return i}DeleteEquip(t){const{groupId:e,equips:i}=t||{};if(e&&i&&i instanceof Array){if(window.top[`group-${e}`])for(let s=0,a=i.length;s<a;s++){let h=window.top[`group-${e}`].findIndex(c=>c.id==i[s].id);h>-1&&window.top[`group-${e}`].splice(h,1),delete window.top.equipCache[i[s].id],delete window.top.groupCache[e][i[s].id]}this.notice({type:"DeleteEquip",data:t})}}EditEquip(t){const{equipNo:e,groupId:i,equipName:s}=t||{};i&&e&&(window[`group-${i}`]&&(window.top.equipCache[e]=s),this.notice({type:"EditEquip",data:t}))}notice(t){if(window.top.hasIframe){let e=document.getElementsByTagName("iframe");for(let i of e)i.contentWindow.postMessage(t)}else window.postMessage(t,"*")}}const Nt={name:"treeV2",components:{tree:Ot},data(){return{list:[],refId:N.generateUUID(),treeKey:null,listKey:null,hasBuildTree:!1}},props:{treeType:{type:String,default:""}},mounted(){this.treeKey=`equipGroup${this.treeType}`,this.listKey=`groupList${this.treeType}`,window.top[this.treeKey]?this.list=N.formateList(JSON.parse(JSON.stringify(window.top[this.treeKey]))):window.top[this.listKey]&&this.buildTree(),window.executeQueue||(window.executeQueues={}),window.executeQueues[this.refId]=this.destroyTree,window.addEventListener("message",o=>{o&&o.data&&o.data.type&&this[o.data.type]&&this[o.data.type]()});try{window.top.hasIframe||this.selfRequest()}catch{this.selfRequest()}},methods:{selfRequest(){new vt().Init()},GetEquipGroupTreeWidthTreeType(){this.treeType&&window.top[this.listKey]&&this.buildTree()},GetEquipGroupTree(){!this.treeType&&window.top[this.listKey]&&this.buildTree()},buildTree(){if(window.top[this.listKey]){let o=N.listToTreeList(JSON.parse(JSON.stringify(window.top[this.listKey])));this.list=N.formateList(JSON.parse(JSON.stringify(o))),window.top[`equipGroup${this.treeType}`]=o,this.hasBuildTree=!0}},filterMethod(o){this.$refs[this.refId].filterMethod(o)},resetCheckedStatus(){this.$refs[this.refId].resetCheckedStatus()},getEquipSelectd(){return this.$refs[this.refId].getEquipSelectd()},getControlSelected(){return this.$refs[this.refId].getControlSelected()},getEquipGroupSelectd(){return this.$refs[this.refId].getEquipGroupSelectd()},destroyTree(){this.$refs[this.refId].destroyTree()}}};var Et=function(){var t=this,e=t._self._c;return e("tree",t._g(t._b({ref:t.refId,attrs:{data:t.list,buildTree:t.buildTree}},"tree",{...t.$attrs,...t.$props},!1),t.$listeners))},kt=[],Mt=A(Nt,Et,kt,!1,null,null,null,null);const R=Mt.exports;return R.install=function(o){o.component(R.name,R)},R});
|