{"ast":null,"code":"import \"core-js/modules/es.array.push.js\";\nimport \"core-js/modules/es.typed-array.to-reversed.js\";\nimport \"core-js/modules/es.typed-array.to-sorted.js\";\nimport \"core-js/modules/es.typed-array.with.js\";\nimport \"./index.less\";\nimport \"./origin.less\";\nimport \"./square.less\";\nimport TabList from \"../../components/TabList\";\nimport Tabs from \"../../components/Tabs\";\nimport SearchBar from \"../../components/SearchBar\";\nimport Dropdown from \"./components/DropDown\";\nimport TableComponent from \"./components/TableComponent\";\nimport BenchDetail from \"../../components/BenchDetail\";\nimport StatusBar from \"../../components/StatusBar\";\n//import { benchList } from './api'\nimport THREE from \"three\";\nimport { uwbMain } from \"../../uwb-sample\";\nimport { mapState } from \"vuex\";\nimport ImageList from \"./components/ImageList\";\nimport webSocket from \"../../service/ws\";\nimport bus from \"../../service/bus\";\nimport { FBXLoader } from \"../../FBXLoader.js\";\nimport SearchBarMain from \"../../components/SearchBarMain\";\nconst ws = new webSocket();\nlet that = null;\nlet wsArray = [];\nlet wsArrayLength = 0;\nfor (var iR = 0; iR < 50; iR++) {\n const wsRemote = new webSocket();\n wsRemote.open().then(res => {\n // console.log(\"res\", res);\n });\n wsArray.push(wsRemote);\n}\nexport default {\n components: {\n StatusBar,\n TabList,\n SearchBar,\n Dropdown,\n TableComponent,\n BenchDetail,\n ImageList,\n SearchBarMain,\n Tabs\n },\n data() {\n return {\n inputValue: \"\",\n isDetailVisible: false,\n isRemoteBtnVisible: false,\n isShowPlanList: false,\n isShowCaseList: false,\n isShowAutoCaseList: false,\n isShowCaseDetail: false,\n isShowCaseCommit: false,\n isShowIssueList: true,\n isShowIssueDetail: false,\n isShowAutoCaseCommit: false,\n taskName: \"\",\n planName: \"\",\n caseName: \"\",\n caseProject: \"\",\n caseActive: \"\",\n caseFunction: \"\",\n caseSubFunction: \"\",\n caseMarket: \"\",\n caseLanguage: \"\",\n caseContent: \"\",\n isShowTaskList: true,\n benchDisplayVisible: false,\n mainSnapshot: \"\",\n currentBench: {},\n readyCount: 10,\n occupiedCount: 5,\n offlineCount: 3,\n previousSelectedBenchList: [],\n selectedBenchList: [],\n renderBenchList: true,\n filters: [],\n currentCase: null,\n currentIssue: null,\n currentPlanId: null,\n currentPlanName: null,\n currentCaseIndex: 0,\n tabs: [{\n title: \"实时\",\n list: []\n }, {\n title: \"历史\",\n list: []\n }, {\n title: \"告警\",\n list: []\n }, {\n title: \"报表\",\n list: []\n }, {\n title: \"管理\",\n list: []\n }],\n tableData: [{\n benchname: \"Bench 1\",\n project: \"Project A\",\n carline: \"Carline A\",\n market: \"Market A\",\n sw: \"SW 1\",\n status: \"Status A\"\n }, {\n benchname: \"Bench 2\",\n project: \"Project B\",\n carline: \"Carline B\",\n market: \"Market B\",\n sw: \"SW 2\",\n status: \"Status B\"\n }\n // ...\n ],\n\n currentPage: 1,\n pageSize: 5,\n benchId: \"219\",\n mainSnapshot: \"\",\n timer: 0,\n platform: null,\n connetedBenchId: \"\",\n displayTapMode: false,\n controlCursorPosition: {},\n ifBmBenchTrailUpperCursorTap: false,\n benchLog: [],\n trailCursorPosition: {},\n audioName: \"\",\n ifBmBenchTrailUpperCursorSwipe: false,\n ifBmBenchTrailUpperCursorPress: false,\n ifBmBenchTrailUpperCursor: false,\n controlStartPoint: {},\n ifShowLogBox: false,\n filterData: {\n keyword: \"\",\n currentPage: 1,\n pageSize: 10,\n status: [4, 3, 5, 0, 2, 6],\n types: [],\n \"basic attributes\": [],\n ips: [],\n orderBy: \"desc\",\n orderkey: \"id\"\n },\n benchImgUpper: \"\",\n benchImgUpperMap: {},\n currentScreen: \"upper\",\n benchDisplayLowerVisible: false,\n benchImgLower: \"\",\n benchImgLowerMap: {},\n isPlaying: false,\n isRecording: false,\n loopSendAudioTime: null,\n sendAudioString: \"\",\n vadThreshold: 0,\n recStream: null,\n paAc: null,\n paSource: null,\n paScriptNode: null,\n sempleRateMultiple: null,\n recordSuperposeArr: [],\n sempleRateHandlingThreshold: null,\n playAudioBenchList: [],\n isConnected: false,\n currentBenchId: 0,\n gridItems: [1, 2, 3, 4, 5, 6, 7, 8, 9],\n timerIdMap: {\n num: 0\n },\n timerId: 0,\n autoPlanResultInterval: 0,\n remoteBenchList: [],\n waterdotrefresh: false,\n selectedBenchId: 0,\n benchDetail: {},\n mouseBenchDetail: {}\n };\n },\n computed: {\n // tabClass(){\n // return 'ordinary';\n // },\n tabClass() {\n return this.currentBench.type == 2 ? \"short\" : \"long\";\n },\n ...mapState({\n isOpen: state => {\n return state.common.isOpen;\n },\n mouseX: state => {\n return state.benchList.mouseoverx;\n },\n mouseY: state => {\n return state.benchList.mouseovery;\n },\n mouseStatus: state => {\n return state.benchList.mouseoverstatus;\n },\n mouseBenchId: state => {\n return state.benchList.mouseoverbenchid;\n },\n images: state => {\n console.log(state.benchList.benchImgList, \"imageList\");\n return state.benchList.benchImgList;\n },\n isOpenSquare: state => {\n return state.common.isOpenSquare;\n },\n isOpen3d: state => {\n return state.common.isOpen3d;\n },\n benchList: state => {\n return state.benchList.benchList;\n },\n taskList: state => {\n return state.taskList.taskList;\n },\n planList: state => {\n console.log(state.planList.planList, \"planList==============\");\n let planList = state.planList.planList.concat(state.planList.autoPlanList);\n planList = planList.sort((p1, p2) => p1.id - p2.id);\n return planList;\n },\n autoPlanList: state => {\n return state.planList.autoPlanList;\n },\n caseList: state => {\n return state.caseList.caseList;\n },\n autoCaseList: state => {\n return state.caseList.autoCaseList;\n },\n issueList: state => {\n return state.issueList.issueList;\n },\n autoTaskStatus: state => {\n return state.caseList.autoTaskStatusMap[state.caseList.currentTaskIndex];\n },\n filterBenchList: state => {\n return state.benchList.filterBenchList.sort((a, b) => {\n let i = 0;\n let j = 0;\n for (let m = 0; m < a.MU_SW.length; m++) {\n i += a.MU_SW.charCodeAt(m);\n }\n for (let n = 0; n < b.MU_SW.length; n++) {\n j += b.MU_SW.charCodeAt(n);\n }\n return i - j;\n });\n },\n autoTaskStatusMap: state => {\n return state.caseList.autoTaskStatusMap;\n },\n autoTaskPercentMap: state => {\n return state.caseList.autoTaskPercentMap;\n }\n })\n },\n created() {\n // uwbMain(\"player\", window.innerWidth, window.innerHeight, \"panorama\");\n ws.open().then(res => {\n // console.log(\"res\", res);\n });\n window.handleListClick = this.handleListClick;\n window.handleBenchClick = this.handleBenchClick;\n window.handleClickTask = this.handleClickTask.bind(this);\n window.selectRowPlan = this.selectRowPlan.bind(this);\n window.selectRowCase = this.selectRowCase.bind(this);\n window.selectRowIssue = this.selectRowIssue.bind(this);\n window.handleListDbClick = this.handleListDbClick;\n window.showBenchPos = this.showBenchPos;\n window.handleClickImg = this.handleClickImg;\n let that = this;\n window.bmMapItemSelect = this.bmMapItemSelect.bind(this);\n window.bmMapItemUnSelect = this.bmMapItemUnSelect.bind(this);\n window.handleClickIssue = this.handleClickIssue.bind(this);\n window.selectBench = this.selectBench.bind(this);\n that.$store.dispatch(\"taskList/clearTaskList\");\n that.$store.dispatch(\"taskList/fetchTaskList\", {\n page_num: 1,\n page_size: 1000\n });\n window.bmMapItemActivate = this.bmMapItemActivate;\n // 调用定时器方法,返回定时器id,用于按条件清空\n that.timerId = that.myInterval(count => {\n // console.log(count)\n this.$store.dispatch(\"benchList/fetchBenchList\");\n if (!this.waterdotrefresh) {\n this.waterdotrefresh = true;\n window.getsqlData(window.sdkInstance, window.uwbInstance, true);\n }\n this.refreshBenchStatus();\n if (count > 30000) {\n console.log(\"end\");\n that.clearMyInterval(that.timerId);\n }\n }, 10000);\n setTimeout(() => {\n this.$store.dispatch(\"benchList/fetchBenchList\");\n if (!this.waterdotrefresh) {\n window.getsqlData(window.sdkInstance, window.uwbInstance, false);\n }\n this.refreshBenchStatus();\n }, 2000);\n this.$store.dispatch(\"issueList/fetchIssueList\", {\n bench_id: null,\n page_num: 1,\n page_size: 10,\n processor: 0,\n ticket_status: 0,\n ticket_type: 0\n });\n },\n async mounted() {\n that = this;\n //this.getBenchList();\n console.log(this.benchList, \"benchList\");\n this.tabs[0].list = this.benchList;\n this.tabs[1].list = this.taskList;\n this.tabs[2].list = this.issueList;\n let mapDom = document.getElementsByClassName(\"ordinary-map\")[0];\n let style = getComputedStyle(mapDom);\n let width = parseFloat(style.width);\n let height = parseFloat(style.height);\n let ratio = 1.8;\n window.renderWidth = width * ratio;\n window.renderHeight = height * ratio;\n sessionStorage.setItem('3dMode', 0);\n debugger;\n uwbMain('player', width * ratio, height * ratio, \"floorplan\");\n // window.sdkInstance.sceneRenderer.updateScreenSize(width * ratio, height * ratio);\n setTimeout(() => {\n var element = document.getElementById('house-player');\n element.style.marginLeft = (width - width * ratio) / 2 + 'px';\n element.style.marginTop = (height - height * ratio) / 2 + 'px';\n }, 3500);\n setTimeout(() => {\n let self = this;\n var objRBL = this.remoteBenchList;\n if (objRBL) {\n console.log(\"objRBL\", objRBL);\n wsArrayLength = objRBL.length;\n for (var iW = 0; iW < objRBL.length; iW++) {\n var i = JSON.parse(JSON.stringify(iW));\n let benchId = JSON.parse(JSON.stringify(objRBL[i]));\n setTimeout(() => {\n console.log(\"connect bench\", benchId);\n wsArray[i]?.connectBench({\n bench_id: String(benchId)\n }).then(res => {\n console.log(\"connect bench success\", benchId);\n self.getBenchImage(benchId, 1, wsArray[i], () => {});\n }).catch(err => {\n console.log(\"connect bench failed\", benchId);\n this.$message({\n message: \"This bench is offline\",\n // message: \"\",\n type: \"warning\"\n });\n });\n }, iW * 2000);\n }\n }\n }, 3000);\n bus.on(\"newLog\", param => {\n if (param.action) {\n this.benchLog.unshift(param);\n // document.getElementsByClassName(\"bmLogBottom\")[0].scrollIntoView();\n if (Object.keys(param.action).length != 0) {\n // console.log(\"actionType\", param.action.actionType);\n let position = param.action.pos;\n // console.log(\"position\", position);\n if (param.action.actionType == \"swipe on\") {\n this.ifBmBenchTrailUpperCursorSwipe = true;\n this.trailCursorPosition.left = position[0] / 1540 * 100;\n this.trailCursorPosition.top = position[1] / 720 * 100;\n setTimeout(() => {\n this.trailCursorPosition.left = (position[0] + position[2]) / 1540 * 100;\n this.trailCursorPosition.top = (position[1] + position[3]) / 720 * 100;\n }, 800);\n setTimeout(() => {\n this.ifBmBenchTrailUpperCursorSwipe = false;\n }, 2000);\n } else if (param.action.actionType == \"tap on\") {\n this.ifBmBenchTrailUpperCursorTap = true;\n setTimeout(() => {\n this.ifBmBenchTrailUpperCursorTap = false;\n }, 1500);\n this.trailCursorPosition.left = \"calc(\" + position[0] * 2 / 1540 * 100 + \"% - 1vh)\";\n this.trailCursorPosition.top = \"calc(\" + position[1] * 2 / 720 * 100 + \"% - 1vh)\";\n } else if (param.action.actionType == \"longPress on\") {\n this.ifBmBenchTrailUpperCursorPress = true;\n setTimeout(() => {\n this.ifBmBenchTrailUpperCursorPress = false;\n }, 1500);\n this.trailCursorPosition.left = position[0] * 2 / 1540 * 100;\n this.trailCursorPosition.top = position[1] * 2 / 720 * 100;\n } else if (param.action.actionType == \"audio\") {\n // console.log(\"newLog\", param);\n let fileName = param.action.file_name;\n console.log(\"audiofileName\", fileName);\n this.audioName = fileName;\n bus.emit(\"planAudioEmit\");\n }\n }\n }\n if (this.benchLog.length > 100) {\n this.benchLog.pop();\n }\n });\n bus.on(\"switchScreen\", param => {\n this.currentScreen = param.currentScreen;\n });\n bus.on(\"goHome\", () => {\n this.isConnected = false;\n this.$store.dispatch(\"common/setSquareStatus\", false);\n this.$store.dispatch(\"common/setConnectedStatus\", false);\n });\n {\n this.autoPlanResultInterval = setInterval(() => {\n let autoCurrentTaskData = window.localStorage.getItem(\"autoCurrentTaskData\");\n let autoCurrentTaskName = window.localStorage.getItem(\"autoCurrentTaskName\");\n autoCurrentTaskData = JSON.parse(autoCurrentTaskData);\n autoCurrentTaskName = JSON.parse(autoCurrentTaskName);\n if (autoCurrentTaskData) {\n for (let planId in autoCurrentTaskData) {\n let planExecId = autoCurrentTaskData[planId];\n if (autoCurrentTaskName) {\n let planName = autoCurrentTaskName[planId];\n if (planName) {\n this.$store.dispatch(\"caseList/fetchAutoCaseList\", {\n planId: planId,\n planName: planName\n });\n }\n }\n this.$store.dispatch(\"caseList/setPlanExecId\", planExecId);\n this.$store.dispatch('caseList/getAutoPlanResult', {\n planId,\n planExecId\n });\n }\n }\n }, 5000);\n }\n },\n methods: {\n changeCurrentBench(benchId) {\n this.isDetailVisible = false;\n if (this.isOpen3d) {\n this.$store.dispatch(\"common/toggle3dStatus\");\n }\n this.selectBench(benchId);\n },\n myInterval(callback, interval) {\n // 每设置一次定时器,num++ 代表系统中有num个自定义的定时器\n this.timerIdMap.num++;\n // 第 num 个定时器的id\n let intervalId = \"id\" + this.timerIdMap.num;\n this.timerIdMap[intervalId] = true;\n // 循环次数\n let count = 0;\n let startTime = Date.now();\n let loop = () => {\n // 系统map中不存在这个id,就停止循环\n if (!this.timerIdMap[intervalId]) {\n return;\n }\n if (Date.now() > startTime + interval * (count + 1)) {\n count++;\n callback(count);\n }\n window.requestAnimationFrame(loop);\n };\n loop();\n return intervalId;\n },\n // 清空定时器,删除全局的定时器id map\n clearMyInterval(intervalId) {\n delete this.timerIdMap[intervalId];\n },\n turnToNextManualCase() {},\n clickBackToTaskList() {\n this.isShowPlanList = false;\n this.isShowTaskList = true;\n // this.planList = [];\n },\n\n clickBackToCaseList() {\n this.isShowCaseCommit = false;\n this.isShowCaseList = true;\n },\n submitManualCase(item) {\n console.log(this.currentCase, \"manualcasedetail============\");\n this.isShowCaseCommit = true;\n this.isShowCaseDetail = false;\n },\n clickBackToIssueList() {\n this.isShowIssueList = true;\n this.isShowIssueDetail = false;\n },\n clickBackToPlan() {\n this.isShowCaseDetail = false;\n if (sessionStorage.getItem(\"autoCase\") == 0) {\n this.isShowCaseList = true;\n } else {\n this.isShowAutoCaseList = true;\n }\n },\n submitAutoCase() {\n if (this.autoTaskStatus == 'waiting' || this.autoTaskStatus == 'running') {\n this.$store.dispatch('caseList/cancelPlan');\n this.clickBackToTaskList();\n this.isShowAutoCaseList = false;\n return;\n }\n this.isShowAutoCaseList = false;\n this.isShowAutoCaseCommit = true;\n },\n clickBackToAutoCaseList() {\n this.isShowAutoCaseList = true;\n this.isShowAutoCaseCommit = false;\n },\n selectRowPlan(id, auto, name) {\n console.log(id, \"selectrowdata\");\n debugger;\n if (!auto || auto == \"undefined\" || auto == \"false\") {\n this.currentPlanId = id;\n this.currentPlanName = name;\n this.$store.dispatch(\"caseList/fetchCaseList\", {\n uuid: id,\n page_num: 1,\n page_size: 100\n });\n this.isShowCaseList = true;\n sessionStorage.setItem(\"autoCase\", 0);\n this.$store.dispatch(\"caseList/setCurrentTask\", id);\n } else {\n if (id == 109) id = 222;\n this.currentPlanId = id;\n this.currentPlanName = name;\n this.$store.dispatch(\"caseList/setCurrentPlanId\", id);\n this.$store.dispatch(\"caseList/fetchAutoCaseList\", {\n planId: id,\n planName: name\n });\n this.isShowAutoCaseList = true;\n this.$store.dispatch(\"caseList/setCurrentTask\", id);\n sessionStorage.setItem(\"autoCase\", 1);\n }\n this.$store.dispatch(\"common/fetchOptionList\");\n this.isShowPlanList = false;\n this.planName = name;\n },\n selectRowCase(row) {\n this.isShowCaseList = false;\n this.isShowCaseDetail = true;\n this.caseName = row.m_id;\n this.caseProject = row.precondition;\n //this.caseActive =,\n this.caseFunction = row.action;\n this.caseSubFunction = row.expectation;\n this.caseMarket = row.market;\n this.caseLanguage = row.language;\n this.currentCase = row;\n for (let i = 0; i < this.caseList.length; i++) {\n if (this.caseList[i].case_no == row.case_no) {\n this.currentCaseIndex = i;\n break;\n }\n }\n //this.caseContent =,\n },\n\n turnNextCase() {\n this.currentCaseIndex++;\n if (this.currentCaseIndex == this.caseList.length) {\n this.isShowCaseList = true;\n this.isShowCaseCommit = false;\n } else {\n this.currentCase = this.caseList[this.currentCaseIndex];\n this.caseName = this.currentCase.m_id;\n this.caseProject = this.currentCase.precondition;\n //this.caseActive =,\n this.caseFunction = this.currentCase.action;\n this.caseSubFunction = this.currentCase.expectation;\n this.caseMarket = this.currentCase.market;\n this.caseLanguage = this.currentCase.language;\n this.isShowCaseCommit = false;\n this.isShowCaseDetail = true;\n }\n },\n selectRowIssue(id) {\n let row = this.issueList.find(i => i.id == id);\n this.isShowIssueList = false;\n this.isShowIssueDetail = true;\n this.currentIssue = row;\n console.log(row, \"==============issue============\");\n },\n clickBackToPlanList() {\n this.isShowPlanList = true;\n this.isShowCaseList = false;\n this.caseList = [];\n },\n clickBackToAutoPlanList() {\n this.isShowPlanList = true;\n this.isShowAutoCaseList = false;\n this.$store.dispatch('caseList/clearAutoCaseList');\n },\n bmMapItemUnSelect() {\n let items = document.getElementsByClassName(\"item-box\");\n for (var index = 0; index < items.length; index++) {\n items[index].style.background = \"#00000032\";\n let title = items[index].getElementsByClassName(\"item-title\");\n console.log(\"textContent\", title[0].textContent);\n let itemOther = this.benchList.find(b => parseInt(b.id) == parseInt(title[0].textContent));\n itemOther.selected = false;\n itemOther.scale = 1;\n }\n },\n onFocus() {\n this.$store.dispatch(\"common/setIsOpen\", true);\n this.$store.dispatch('benchList/filterBenchList', {\n type: 'status',\n value: 'Status'\n });\n this.$store.dispatch('benchList/filterBenchList', {\n type: 'project',\n value: 'Project'\n });\n this.$store.dispatch('benchList/filterBenchList', {\n type: 'carline',\n value: 'Carline'\n });\n this.$store.dispatch('benchList/filterBenchList', {\n type: 'variant',\n value: 'Variant'\n });\n this.$store.dispatch('benchList/filterBenchList', {\n type: 'cluster',\n value: 'Cluster'\n });\n this.$store.dispatch('benchList/filterBenchList', {\n type: 'market',\n value: 'Market'\n });\n this.$store.dispatch('benchList/setFilterBenchFlag', true);\n },\n onBlur(e) {\n console.log(\"=====----====\", e.target.classList);\n if (Array.prototype.indexOf.call(e.target.classList, \"ordinary-left\") > -1) {\n this.$store.dispatch(\"common/setIsOpen\", false);\n }\n },\n onInput(value) {\n this.inputValue = value;\n this.$store.dispatch('benchList/filterBenchList', {\n type: 'name',\n value: value\n });\n this.$store.dispatch('benchList/setFilterBenchFlag', true);\n },\n onClickOutside() {\n if (this.$refs.searchbar.$el.contains(event.target) || this.$refs.dropdown.$el.contains(event.target)) {\n return;\n }\n this.$store.dispatch(\"common/setIsOpen\", false);\n },\n handleClickTask(taskId, auto) {\n let task = that.taskList.find(t => t.id == taskId);\n // 获取手动测试plan列表\n let manualList = task.plan_list[1];\n // 获取自动测试plan列表\n let autoList = task.plan_list[2];\n autoList.forEach(at => {\n that.$store.dispatch(\"planList/fetchPlanDetail\", {\n planId: at < 100 ? at + 101 : at\n });\n });\n that.isShowPlanList = true;\n that.isShowTaskList = false;\n this.$store.commit(\"planList/setAutoPlanList\", autoList);\n this.$store.commit(\"planList/setPlanList\", manualList);\n that.taskName = task.name;\n this.$nextTick(() => {\n that.$store.dispatch(\"planList/clearPlanList\");\n that.$store.dispatch(\"planList/fetchPlanList\", {\n page_num: 1,\n page_size: 10000\n });\n });\n console.log(task, \"任务详情\");\n },\n handleClickIssue(issueId) {\n console.log(issueId, \"issueid\");\n },\n showBenchPos(benchList) {\n console.log(\"benchList\", benchList);\n for (var item of benchList) {\n var currentBench = this.benchList.find(b => b.id == item.benchId);\n if (currentBench) {\n //console.log('currentBench',currentBench);\n currentBench.left = item.x - 548 + 48;\n currentBench.top = item.y - 137 - 150 + 11;\n currentBench.benchId = item.benchId;\n currentBench.benchType = item.benchType;\n console.log('item.benchImg', item.benchImg);\n currentBench.image = require(\"../../assets/bench_img/\" + item.benchImg);\n if (currentBench.benchType == 2) {\n //currentBench.image = require(\"../../assets/mechine2.png\");\n } else {\n //currentBench.image = require(\"../../assets/mechine.png\");\n }\n }\n }\n this.renderBenchList = false;\n setTimeout(() => {\n this.renderBenchList = true;\n }, 10);\n },\n planBack() {\n that.isShowPlanList = false;\n that.isShowTaskList = true;\n },\n taskRender(item) {\n return `