Commit f9c91904 authored by 张伯涛's avatar 张伯涛

一键启停

parent 520c3973
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
</div> </div>
<div class="demo-button"> <div class="demo-button">
<el-button type="primary" :loading="isLoading" @click="TransferOpen" >一键启动</el-button> <el-button type="primary" :loading="isLoading" @click="TransferOpen" >一键启动</el-button>
<el-button type="primary" :loading="isLoading" @click="OnekeyStopEnd" >一键停止</el-button> <!-- <el-button type="primary" :loading="isLoading" @click="OnekeyStopEnd" >一键停止</el-button>-->
<!-- <el-button type="primary" :loading="isLoading" @click="TransferClose" >一键停止</el-button>--> <el-button type="primary" :loading="isLoading" @click="TransferClose" >一键停止</el-button>
</div> </div>
</div> </div>
</el-card> </el-card>
...@@ -104,6 +104,7 @@ import { vFloatNumber } from "../../utils/directives.js"; ...@@ -104,6 +104,7 @@ import { vFloatNumber } from "../../utils/directives.js";
import { fa } from 'element-plus/es/locale'; import { fa } from 'element-plus/es/locale';
import {useRoute} from "vue-router"; import {useRoute} from "vue-router";
import {selectOneStartStop, selectIsScheduleByUserId, setOneStartStop} from '../../api/oneKeyStartStop/index.js' import {selectOneStartStop, selectIsScheduleByUserId, setOneStartStop} from '../../api/oneKeyStartStop/index.js'
import { userInfo } from 'os';
const enterpriseId = ref(null); const enterpriseId = ref(null);
const cascaderRef = ref(null); const cascaderRef = ref(null);
const isLoading= ref(false); const isLoading= ref(false);
...@@ -122,6 +123,8 @@ const countDown = ref(120); ...@@ -122,6 +123,8 @@ const countDown = ref(120);
const props = { multiple: false, emitPath: false } const props = { multiple: false, emitPath: false }
const isRunning = ref(false); const isRunning = ref(false);
const isStop = ref(false); const isStop = ref(false);
const userInfo = store.getters.getUserInfo();
var startPercent = reactive(new Array({ var startPercent = reactive(new Array({
index: 0, index: 0,
icon: new URL('/imgs/oneKey/ElectricSwitch.png', import.meta.url).href, icon: new URL('/imgs/oneKey/ElectricSwitch.png', import.meta.url).href,
...@@ -617,7 +620,7 @@ async function TransferOpen() { ...@@ -617,7 +620,7 @@ async function TransferOpen() {
} }
activeStep.value = 0; activeStep.value = 0;
if (data.circuitBreakerSwitchOnStatus) { if (data.circuitBreakerSwitchOnStatus === false) {
ElMessage.error(result.data.transferName + " 供热设备总断路器非合闸状态,一键启动失败!"); ElMessage.error(result.data.transferName + " 供热设备总断路器非合闸状态,一键启动失败!");
startPercent[0].color = "rgb(176 63 63)"; startPercent[0].color = "rgb(176 63 63)";
handleSetOneStartStop(stationId.value,transferId.value,false,undefined,1,undefined) handleSetOneStartStop(stationId.value,transferId.value,false,undefined,1,undefined)
...@@ -731,8 +734,9 @@ async function OneKeyStart(num) { ...@@ -731,8 +734,9 @@ async function OneKeyStart(num) {
scheduledTasks() // 定时查询 scheduledTasks() // 定时查询
isLoading.value = true; isLoading.value = true;
try { try {
const userId = userInfo.userId;
var result = await http.post("api/remote/OnekeyControl/WriteStart", { "transferId": transferId.value, "num": num }); const pwd = userInfo.password;
var result = await http.post("api/remote/OnekeyControl/WriteStart", { "transferId": transferId.value, "num": num, "userId": userId, "Password": pwd});
if (result) { if (result) {
if (result.success) { if (result.success) {
activeStep.value = 8; activeStep.value = 8;
...@@ -754,10 +758,11 @@ async function OneKeyStart(num) { ...@@ -754,10 +758,11 @@ async function OneKeyStart(num) {
} }
async function OnekeyStop(){ async function OnekeyStop(){
console.log('1111111')
try { try {
isLoading.value = true; isLoading.value = true;
var result = await http.post("api/remote/OnekeyControl/WriteStop", transferId.value); const userId = userInfo.userId;
const pwd = userInfo.password;
var result = await http.post("api/remote/OnekeyControl/WriteStop", { "transferId": transferId.value, "num": 0, "userId": userId, "Password": pwd });
if (!result) { if (!result) {
ElMessage.error("远程服务器连接异常,一键停止执行失败!"); ElMessage.error("远程服务器连接异常,一键停止执行失败!");
isLoading.value = false; isLoading.value = false;
...@@ -928,8 +933,8 @@ function getSteps() { ...@@ -928,8 +933,8 @@ function getSteps() {
const item = res.data.find(item => (item.runStart === true && item.stopStart === false) || (item.runStart === false && item.stopStart === true )) const item = res.data.find(item => (item.runStart === true && item.stopStart === false) || (item.runStart === false && item.stopStart === true ))
// 获取的数组里,都是false就输出第一个 // 获取的数组里,都是false就输出第一个
const itemTwo = res.data.find(item => item.unitId === transferId.value) const itemTwo = res.data.find(item => item.unitId === transferId.value)
console.log('item',item) // console.log('item',item)
console.log('itemTwo',itemTwo) // console.log('itemTwo',itemTwo)
if(item) { if(item) {
if( isLoading.value === false) { if( isLoading.value === false) {
if(item.stopStart === true) { if(item.stopStart === true) {
...@@ -950,7 +955,7 @@ function getSteps() { ...@@ -950,7 +955,7 @@ function getSteps() {
isStop.value = false; isStop.value = false;
} }
const getItem = item ? item : itemTwo const getItem = item ? item : itemTwo
console.log('getItem',getItem) //console.log('getItem',getItem)
if(getItem.runStepsFlag === true) { if(getItem.runStepsFlag === true) {
activeStep.value = getItem.runSteps activeStep.value = getItem.runSteps
...@@ -1148,7 +1153,7 @@ watch( ...@@ -1148,7 +1153,7 @@ watch(
transform:translate(-50%,-50%); transform:translate(-50%,-50%);
max-height:calc(100% - 30px); max-height:calc(100% - 30px);
max-width:calc(100% - 30px); max-width:calc(100% - 30px);
} }
.el-dialog .el-dialog__body{ .el-dialog .el-dialog__body{
max-height: 100%; max-height: 100%;
flex: 1; flex: 1;
......
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