| | |
| | | import iconPower from "@/components/icons/iconPower.vue"; |
| | | import useDevsRt from "@/hooks/useDevsRt.js"; |
| | | import paramContent from "./paramContent.vue"; |
| | | import battCountContent from "./battCountContent.vue"; |
| | | import useWebSocket from "@/hooks/useWebSocket.js"; |
| | | import { getA200Param } from "./api.js"; |
| | | import formatSeconds from "@/assets/js/tools/formatSeconds.js"; |
| | | import jhParamContent from "./jhParamContent.vue"; |
| | | import ytjRtInfo from "./ytjRtInfo.vue"; |
| | | import jhyRtInfo from "./jhyRtInfo.vue"; |
| | | import { controllerActmParam, stopA200 } from "./api"; |
| | | import { controllerActmParam, stopA200, pauseA200 } from "./api"; |
| | | |
| | | import useElement from "@/hooks/useElement.js"; |
| | | |
| | |
| | | const currentDevId = ref(0); |
| | | |
| | | const testGroupIdx = ref(); |
| | | |
| | | const jhyBattCountVisible = ref(false); |
| | | const isUpdateParam = ref(false); |
| | | // TODO 有几组 |
| | | const onlyOneGroup = ref(false); |
| | | // const onlyOneGroup = ref(false); |
| | | const onlyOneGroup = computed(() => { |
| | | if (!currentDev.value.state) { |
| | | return false; |
| | | } |
| | | return currentDev.value.state[0].batteryCount == 1; |
| | | }); |
| | | |
| | | |
| | | const resList = computed(() => { |
| | | let _list = list.value[devType.value]; |
| | |
| | | const currentDev = computed(() => { |
| | | let _list = list.value[devType.value]; |
| | | return _list.filter((v) => v.devId == currentDevId.value)[0] || {}; |
| | | }); |
| | | |
| | | // 是否可以修改均衡仪电池组数 |
| | | const canChangeBattCount = computed(() => { |
| | | // !currentDev.state[0].isTesting && !currentDev.state[1].isTesting |
| | | if (1 == devType.value || !currentDev.value.state) { |
| | | return false; |
| | | } |
| | | if (onlyOneGroup.value) { |
| | | return !currentDev.value.state[0].isTesting; |
| | | } else { |
| | | return !currentDev.value.state[0].isTesting && !currentDev.value.state[1].isTesting; |
| | | } |
| | | }); |
| | | |
| | | const testMode = computed(() => { |
| | |
| | | ? states[currentDev.value.state[v].workMode] || "--" |
| | | : "--" |
| | | ); |
| | | return `组1:${res1}, 组2: ${res2}`; |
| | | return onlyOneGroup.value ? `组1:${res1}` : `组1:${res1}, 组2: ${res2}`; |
| | | } |
| | | }); |
| | | |
| | | const testStates = computed(() => { |
| | | if (1 == devType.value) { |
| | | return currentDev.value.state?.isTesting ? "测试中" : "--"; |
| | | return currentDev.value.state?.isTesting |
| | | ? currentDev.value.state?.testPause |
| | | ? "暂停中" |
| | | : "测试中" |
| | | : "--"; |
| | | } else { |
| | | let [res1, res2] = [0, 1].map((v) => |
| | | currentDev.value.state |
| | | ? currentDev.value.state[v].moduleStatus || "--" |
| | | : "--" |
| | | ); |
| | | return `组1:${res1}, 组2: ${res2}`; |
| | | return onlyOneGroup.value ? `组1:${res1}` : `组1:${res1}, 组2: ${res2}`; |
| | | } |
| | | }); |
| | | |
| | |
| | | } |
| | | }); |
| | | |
| | | function pauseYtj() {} |
| | | |
| | | function stopYtj() { |
| | | let loading = $loading(); |
| | | stopA200(currentDevId.value) |
| | |
| | | } |
| | | |
| | | function chooseDev(params) { |
| | | // console.log('params', params, '============='); |
| | | currentDevId.value = params.devId; |
| | | } |
| | | |
| | | function test(groupIdx) { |
| | | function setBattCount() { |
| | | jhyBattCountVisible.value = true; |
| | | // console.log("cur", currentDev, "============="); |
| | | } |
| | | |
| | | /** |
| | | * isUpdate 是否是更新参数弹窗 |
| | | */ |
| | | function test(isUpdate, groupIdx) { |
| | | testGroupIdx.value = groupIdx; |
| | | isUpdateParam.value = !!isUpdate; |
| | | testVisible.value = true; |
| | | } |
| | | |
| | | function pauseYtj(type) { |
| | | // console.log("currentDev", currentDev, "============="); |
| | | if (!currentDev.value.devId) { |
| | | return false; |
| | | } |
| | | |
| | | let loading = $loading(); |
| | | pauseA200(currentDev.value.devId, type) |
| | | .then((res) => { |
| | | let { code, data } = res.data; |
| | | if (code == 200) { |
| | | console.log(data); |
| | | $message.success("操作成功"); |
| | | } else { |
| | | $message.error("操作失败"); |
| | | } |
| | | loading.close(); |
| | | }) |
| | | .catch((err) => { |
| | | console.log(err); |
| | | loading.close(); |
| | | $message.error("操作失败"); |
| | | }); |
| | | } |
| | | onMounted(() => {}); |
| | | </script> |
| | |
| | | size="default" |
| | | is-button |
| | | > |
| | | <el-radio-button :value="1">充放电一体机</el-radio-button> |
| | | <el-radio-button :value="1">充放电测试仪</el-radio-button> |
| | | <el-radio-button :value="2">均衡测试仪</el-radio-button> |
| | | </el-radio-group> |
| | | </div> |
| | |
| | | :disabled="!currentDev.devOnline" |
| | | class="btn-start" |
| | | v-if="!currentDev.state?.isTesting" |
| | | @click="test" |
| | | @click="test(false)" |
| | | >启动测试</el-button |
| | | > |
| | | <!-- <el-button |
| | |
| | | @click="pauseYtj" |
| | | >暂停测试</el-button |
| | | > --> |
| | | <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | | v-else |
| | | class="btn-start" |
| | | @click="stopYtj" |
| | | >停止测试</el-button |
| | | > |
| | | <template v-else> |
| | | <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | | class="btn-start" |
| | | @click="test(true)" |
| | | >修改参数</el-button |
| | | > |
| | | <!-- TODO 是否是暂停 --> |
| | | <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | | v-if="!currentDev.state.testPause" |
| | | class="btn-start" |
| | | @click="pauseYtj(1)" |
| | | >暂停测试</el-button |
| | | > |
| | | <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | | v-if="currentDev.state.testPause" |
| | | class="btn-start" |
| | | @click="pauseYtj(2)" |
| | | >继续测试</el-button |
| | | > |
| | | <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | | class="btn-start" |
| | | @click="stopYtj" |
| | | >停止测试</el-button |
| | | > |
| | | </template> |
| | | </template> |
| | | <template v-else-if="currentDev.state"> |
| | | <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | | class="btn-start btn-grp1" |
| | | v-if="!currentDev.state[0].isTesting" |
| | | @click="test(0)" |
| | | >启动组1</el-button |
| | | v-if="canChangeBattCount" |
| | | @click="setBattCount" |
| | | >设置组数</el-button |
| | | > |
| | | <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | | class="btn-start btn-grp1" |
| | | v-else-if="!currentDev.state[0].isTestPause" |
| | | @click="controlTest(0, 2)" |
| | | >暂停组1</el-button |
| | | v-if="!currentDev.state[0].isTesting" |
| | | @click="test(false, 0)" |
| | | >启动组1</el-button |
| | | > |
| | | <template v-else> |
| | | <!-- <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | | class="btn-start btn-grp1" |
| | | @click="test(true, 0)" |
| | | >修改组1参数</el-button |
| | | > --> |
| | | <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | | class="btn-start btn-grp1" |
| | | v-if="!currentDev.state[0].isTestPause" |
| | | @click="controlTest(0, 2)" |
| | | >暂停组1</el-button |
| | | > |
| | | </template> |
| | | <el-button |
| | | size="small" |
| | | :disabled="!currentDev.devOnline" |
| | |
| | | :disabled="!currentDev.devOnline" |
| | | class="btn-start btn-grp2" |
| | | v-if="!currentDev.state[1].isTesting" |
| | | @click="test(1)" |
| | | @click="test(false, 1)" |
| | | >启动组2</el-button |
| | | > |
| | | <el-button |
| | |
| | | <div class="value">{{ currentDev.devModel }}</div> |
| | | <div class="label">设备类型</div> |
| | | <div class="value"> |
| | | {{ { 1: "充放电一体机", 2: "均衡测试仪" }[currentDev.devType] }} |
| | | {{ { 1: "充放电测试仪", 2: "均衡测试仪" }[currentDev.devType] }} |
| | | </div> |
| | | <div class="label">设备编号</div> |
| | | <div class="value">{{ currentDev.devIdcode }}</div> |
| | |
| | | width="700px" |
| | | center |
| | | > |
| | | <template v-if="1 == devType"> |
| | | <template v-if="testVisible && 1 == devType"> |
| | | <param-content |
| | | v-model="testVisible" |
| | | v-if="testVisible" |
| | | :isUpdate="isUpdateParam" |
| | | :devs="currentDev" |
| | | ></param-content> |
| | | </template> |
| | | <template v-if="2 == devType"> |
| | | <template v-if="testVisible && 2 == devType"> |
| | | <jh-param-content |
| | | v-model="testVisible" |
| | | v-if="testVisible" |
| | | :isUpdate="isUpdateParam" |
| | | :grpIdx="testGroupIdx" |
| | | :devs="currentDev" |
| | | ></jh-param-content> |
| | | </template> |
| | | </el-dialog> |
| | | <!-- 设置均衡仪组数 --> |
| | | <el-dialog |
| | | title="设置均衡仪电池组数" |
| | | v-model="jhyBattCountVisible" |
| | | :close-on-click-modal="false" |
| | | class="dialog-center" |
| | | width="600px" |
| | | center |
| | | > |
| | | <batt-count-content |
| | | v-model="jhyBattCountVisible" |
| | | v-if="jhyBattCountVisible" |
| | | :devs="currentDev" |
| | | :isOnlyOne="onlyOneGroup" |
| | | ></batt-count-content> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | |
| | | |
| | | .p-left { |
| | | grid-row-start: span 2; |
| | | background: #1a585d; |
| | | background: radial-gradient(#1a585d10, #1a585d80); |
| | | display: flex; |
| | | flex-direction: column; |
| | | .filter { |
| | |
| | | text-align: center; |
| | | background: #02a7f0; |
| | | &.max { |
| | | background: #d9001b; |
| | | background: #438D29; |
| | | } |
| | | &.min { |
| | | background: #f59a23; |
| | | background: #DBD608; |
| | | } |
| | | } |
| | | } |
| | |
| | | text-align: center; |
| | | background: #02a7f0; |
| | | &.max { |
| | | background: #d9001b; |
| | | background: #438D29; |
| | | } |
| | | &.min { |
| | | background: #f59a23; |
| | | background: #DBD608; |
| | | } |
| | | } |
| | | } |
| | |
| | | padding: 2px 10px; |
| | | border-radius: 6px; |
| | | &.max { |
| | | background: #d9001b; |
| | | background: #438D29; |
| | | } |
| | | &.min { |
| | | background: #f59a23; |
| | | background: #DBD608; |
| | | } |
| | | } |
| | | } |