Commit 06a81aae authored by 张伯涛's avatar 张伯涛

大屏项目修改,一键启停

parent a40e1144
...@@ -1128,14 +1128,7 @@ export default defineComponent({ ...@@ -1128,14 +1128,7 @@ export default defineComponent({
postServicCenterList() { postServicCenterList() {
postServicCenterList().then((res) => { postServicCenterList().then((res) => {
if (res.success === true) { if (res.success === true) {
// 获取登录人所属于的服务中心 this.servicCenterList = res.data;
var result = store.getters.getEnterprise();
const userCenterList = result[0].serviceCenterList
// 过滤接口数据,取两个数组的交集
const finialList = res.data.filter(item1 =>
userCenterList.some(item2 => item1.centerId === item2.serviceCenterId)
);
this.servicCenterList = finialList;
this.servicCenterList.forEach((element, index) => { this.servicCenterList.forEach((element, index) => {
element.markerId = "marker1_" + index; element.markerId = "marker1_" + index;
element.openF = false; element.openF = false;
......
...@@ -397,7 +397,7 @@ function getSupplys() { ...@@ -397,7 +397,7 @@ function getSupplys() {
} }
}); });
if (options && options.length > 0) { if (options && options.length > 0) {
// transferId.value = options[0].children[0].children[0].value; transferId.value = options[0].children[0].children[0].value;
} }
} }
} }
...@@ -871,55 +871,79 @@ function getSteps() { ...@@ -871,55 +871,79 @@ function getSteps() {
} }
// 一键启动 // 一键启动
if(res.code === 200) { if(res.code === 200) {
const item = res.data.find(item => (item.runStart === true && item.stopStart === false) || (item.runStart === false && item.stopStart === true ) || (item.runStart === false && item.stopStart === false )) // 获取的数组里,runStart和stopStart有一个是true就输出
const item = res.data.find(item => (item.runStart === true && item.stopStart === false) || (item.runStart === false && item.stopStart === true ))
// 获取的数组里,都是false就输出第一个
const itemTwo = res.data.find(item => item.unitId === transferId.value)
console.log('item',item) console.log('item',item)
if(item && !(item.runStart === false && item.stopStart === false )) { console.log('itemTwo',itemTwo)
if(item) {
if( isLoading.value === false) {
if(item.stopStart === true) {
isStop.value = true;
startCountdownTwo();
}else {
clearInterval(timerTwo)
countDown.value = 120;
isStop.value = false;
}
}
isLoading.value = true isLoading.value = true
transferId.value =item.unitId
}else { }else {
clearInterval(timerTwo)
isLoading.value = false isLoading.value = false
countDown.value = 120;
isStop.value = false;
}
const getItem = item ? item : itemTwo
console.log('getItem',getItem)
if(getItem.runStepsFlag === true) {
activeStep.value = getItem.runSteps
if(getItem.runSteps === 8) {
startPercent[7].color = "rgb(103 194 58)";
}else {
startPercent[7].color = "rgb(127 127 127)";
} }
const getUnitId = item ? item.unitId : options[0].children[0].children[0].value }else if( getItem.runStepsFlag === false) {
transferId.value = getUnitId activeStep.value = getItem.runSteps - 1
if(item.runStepsFlag === true) { startPercent[getItem.runSteps-1].color = "rgb(176 63 63)";
activeStep.value = item.runSteps saveActiveStep.value = getItem.runSteps
}else if( item.runStepsFlag === false) {
activeStep.value = item.runSteps - 1
startPercent[item.runSteps-1].color = "rgb(176 63 63)";
saveActiveStep.value = item.runSteps
} }
// 一键停止 // 一键停止
if(item.stopStepsFlag === true) { if(getItem.stopStepsFlag === true) {
var result = store.getters.getEnterprise(); var result = store.getters.getEnterprise();
const setNum = result[0].serviceCenterList[0].supplyList[0].transferList.length const setNum = result[0].serviceCenterList[0].supplyList[0].transferList.length
// 北区 1:1 2:2 3:5 4:6 5:7 // 北区 1:1 2:2 3:5 4:6 5:7
if(setNum > 1) { if(setNum > 1) {
if(item.stopSteps === 1 || item.stopSteps === 2) { if(getItem.stopSteps === 1 || getItem.stopSteps === 2) {
activeCloseStep.value = item.stopSteps activeCloseStep.value = getItem.stopSteps
}else { }else {
activeCloseStep.value = item.stopSteps - 2 activeCloseStep.value = getItem.stopSteps - 2
} }
}else { }else {
activeCloseStep.value = item.stopSteps activeCloseStep.value = getItem.stopSteps
} }
}else if( item.stopStepsFlag === false) { }else if( getItem.stopStepsFlag === false) {
var result = store.getters.getEnterprise(); var result = store.getters.getEnterprise();
const setNum = result[0].serviceCenterList[0].supplyList[0].transferList.length const setNum = result[0].serviceCenterList[0].supplyList[0].transferList.length
// 北区 1:1 2:2 3:5 4:6 5:7 // 北区 1:1 2:2 3:5 4:6 5:7
if(setNum > 1) { if(setNum > 1) {
if(item.stopSteps === 1 || item.stopSteps === 2) { if(getItem.stopSteps === 1 || getItem.stopSteps === 2) {
activeCloseStep.value = item.stopSteps - 1 activeCloseStep.value = getItem.stopSteps - 1
stopPercent.value[item.stopSteps-1].color = "rgb(176 63 63)"; stopPercent.value[getItem.stopSteps-1].color = "rgb(176 63 63)";
saveStopStep.value = item.stopSteps-1 saveStopStep.value = getItem.stopSteps-1
}else { }else {
activeCloseStep.value = item.stopSteps - 3 activeCloseStep.value = getItem.stopSteps - 3
stopPercent.value[item.stopSteps-3].color = "rgb(176 63 63)"; stopPercent.value[getItem.stopSteps-3].color = "rgb(176 63 63)";
saveStopStep.value = item.stopSteps-3 saveStopStep.value = getItem.stopSteps-3
} }
}else { }else {
activeCloseStep.value = item.stopSteps - 1 activeCloseStep.value = getItem.stopSteps - 1
stopPercent.value[item.stopSteps-1].color = "rgb(176 63 63)"; stopPercent.value[getItem.stopSteps-1].color = "rgb(176 63 63)";
saveStopStep.value = item.stopSteps-1 saveStopStep.value = getItem.stopSteps-1
} }
} }
} }
...@@ -956,9 +980,22 @@ const startTimer = () => { ...@@ -956,9 +980,22 @@ const startTimer = () => {
}, 1000); }, 1000);
}; };
let timerTwo;
const startTimerTwo = () => {
timerTwo = setInterval(() => {
if ( countDown.value > 0) {
countDown.value--;
} else {
clearInterval(timerTwo);
}
}, 1000);
};
const startCountdown = () => { const startCountdown = () => {
startTimer(); startTimer();
}; };
const startCountdownTwo = () => {
startTimerTwo();
};
const clearIntervalTask = () => { const clearIntervalTask = () => {
if (timerQuery) { if (timerQuery) {
clearInterval(timerQuery); clearInterval(timerQuery);
...@@ -976,6 +1013,7 @@ onDeactivated( ...@@ -976,6 +1013,7 @@ onDeactivated(
watch(isRunning, () => { watch(isRunning, () => {
if (!isRunning.value) { if (!isRunning.value) {
clearInterval(timer); clearInterval(timer);
clearInterval(timerTwo);
OnekeyStopEnd(); OnekeyStopEnd();
} }
}); });
...@@ -986,7 +1024,7 @@ watch( ...@@ -986,7 +1024,7 @@ watch(
async () => { async () => {
if (route.path === '/Remote/OnekeyStartStop') { if (route.path === '/Remote/OnekeyStartStop') {
await store.dispatch("getOrg"); await store.dispatch("getOrg");
getSupplys(); await getSupplys();
scheduledTasks() scheduledTasks()
} else { } else {
// 清理定时任务 // 清理定时任务
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment