运维端测试中控页面优化 功能优化

This commit is contained in:
dzl 2025-05-22 17:16:26 +08:00
parent 5da0f26acb
commit 9d998ff1ea
2 changed files with 69 additions and 45 deletions

View File

@ -17,8 +17,9 @@
const inputCodeValue = ref(''); const inputCodeValue = ref('');
const { const {
codeValue codeValue,
} = defineProps(["codeValue"]); scanValue
} = defineProps(["codeValue", "scanValue"]);
inputCodeValue.value = codeValue; inputCodeValue.value = codeValue;
const emit = defineEmits(['scan-change']); const emit = defineEmits(['scan-change']);
@ -45,7 +46,12 @@
imei, imei,
sn sn
}; };
inputCodeValue.value = imei;
if (scanValue == "sn") {
inputCodeValue.value = sn;
} else {
inputCodeValue.value = imei;
}
emit('scan-change', params); emit('scan-change', params);
} }
} }
@ -55,10 +61,17 @@
const onInput = (value) => { const onInput = (value) => {
if (value.detail.value == "") return; if (value.detail.value == "") return;
inputCodeValue.value = value.detail.value; inputCodeValue.value = value.detail.value;
emit('scan-change', { if (scanValue == "sn") {
imei: value.detail.value, emit('scan-change', {
sn: "" imei: "",
}); sn: value.detail.value
});
} else {
emit('scan-change', {
imei: value.detail.value,
sn: ""
});
}
} }
const onSetValue = (value) => { const onSetValue = (value) => {

View File

@ -2,11 +2,11 @@
<view class="container"> <view class="container">
<view class="form-panel"> <view class="form-panel">
<uni-card> <uni-card>
<uni-forms ref="ebikeInfoForm" :modelValue="ebikeInfo"> <uni-forms :modelValue="ebikeInfo">
<view v-if="modelShow" class="flex"> <view v-if="modelShow" class="flex">
<text class="cuIcon-order lg text-gray" @click="showClick"></text> <text class="cuIcon-order lg text-gray" @click="showClick"></text>
<uni-forms-item label="中控编号" label-s name="bikeCode"> <uni-forms-item label="中控SN" label-s name="ecuSn">
<ecuCodeScan @scan-change="ecuCodeScanChange" :codeValue="ebikeInfo.ecuCode" /> <ecuCodeScan @scan-change="ecuCodeScanChange" :codeValue="ebikeInfo.ecuSn" scanValue="sn" />
</uni-forms-item> </uni-forms-item>
</view> </view>
<view v-else class="flex"> <view v-else class="flex">
@ -526,7 +526,6 @@
ebikeInfo.value.bikeId = res.data.bikeId; ebikeInfo.value.bikeId = res.data.bikeId;
ebikeInfo.value.ecuId = res.data.ecuId; ebikeInfo.value.ecuId = res.data.ecuId;
ebikeInfo.value.ecuSn = res.data.ecuSn; ebikeInfo.value.ecuSn = res.data.ecuSn;
detectionInfo.value.online.btuDisabled = false; detectionInfo.value.online.btuDisabled = false;
detectionInfo.value.findEbike.btuDisabled = false; detectionInfo.value.findEbike.btuDisabled = false;
detectionInfo.value.gps.btuDisabled = false; detectionInfo.value.gps.btuDisabled = false;
@ -545,6 +544,18 @@
const ecuCodeScanChange = (data) => { const ecuCodeScanChange = (data) => {
ebikeInfo.value.ecuCode = data["imei"]; ebikeInfo.value.ecuCode = data["imei"];
ebikeInfo.value.ecuSn = data["sn"]; ebikeInfo.value.ecuSn = data["sn"];
detectionInfo.value.online.btuDisabled = false;
detectionInfo.value.findEbike.btuDisabled = false;
detectionInfo.value.gps.btuDisabled = false;
detectionInfo.value.soc.btuDisabled = false;
detectionInfo.value.openBatteryLock.btuDisabled = false;
detectionInfo.value.lock.btuDisabled = false;
detectionInfo.value.unlock.btuDisabled = false;
detectionInfo.value.openHelmet.btuDisabled = false;
detectionInfo.value.voltage.btuDisabled = false;
detectionInfo.value.cancelAntiTheft.btuDisabled = false;
detectionInfo.value.powerOff.btuDisabled = false;
navButtonGroup[0].disable = false
}; };
const socClick = () => { const socClick = () => {
@ -574,12 +585,12 @@
reqState.value = true; reqState.value = true;
var paramName = "ecuId"; var paramName = "ecuSn";
var data = ebikeInfo.value.ecuId var data = ebikeInfo.value.ecuSn
var bikeId = ebikeInfo.value.bikeId var bikeId = ebikeInfo.value.bikeId
api.callCoreApi(url['url'] + "?" + paramName + "=" + data + "&bikeId=" + bikeId, {}, 'get').then((res) => { api.callEcuCoreApi(url['url'] + "?" + paramName + "=" + data + "&bikeId=" + bikeId, {}, 'get').then((res) => {
if (url['type']) { if (url['type']) {
api.callCoreApi("gpsMsg" + "?ecuSn=" + ebikeInfo.value.ecuSn, {}, 'get').then((res) => { api.callEcuCoreApi("gpsMsg" + "?ecuSn=" + ebikeInfo.value.ecuSn, {}, 'get').then((res) => {
detectionInfo.value[url['type']].load = ''; detectionInfo.value[url['type']].load = '';
reqState.value = false; reqState.value = false;
detectionInfo.value[url['type']].btuDisable = false; detectionInfo.value[url['type']].btuDisable = false;
@ -605,7 +616,6 @@
}); });
} }
const recursionExecDetection = () => { const recursionExecDetection = () => {
if (urlList.value[0]['type']) { if (urlList.value[0]['type']) {
@ -623,43 +633,44 @@
var paramName = "ecuId"; var paramName = "ecuId";
var data = ebikeInfo.value.ecuId var data = ebikeInfo.value.ecuId
var bikeId = ebikeInfo.value.bikeId var bikeId = ebikeInfo.value.bikeId
api.callCoreApi(urlList.value[0]['url'] + "?" + paramName + "=" + data+ "&bikeId=" + bikeId, {}, 'get').then((res) => { api.callEcuCoreApi(urlList.value[0]['url'] + "?" + paramName + "=" + data + "&bikeId=" + bikeId, {}, 'get')
if (urlList.value[0]['type']) { .then((res) => {
api.callCoreApi("gpsMsg" + "?ecuSn=" + ebikeInfo.value.ecuSn, {}, 'get').then((res) => { if (urlList.value[0]['type']) {
detectionInfo.value[urlList.value[0]['type']].load = ''; api.callEcuCoreApi("gpsMsg" + "?ecuSn=" + ebikeInfo.value.ecuSn, {}, 'get').then((res) => {
detectionInfo.value[urlList.value[0]['type']].load = '';
reqState.value = false;
detectionInfo.value[urlList.value[0]['type']].btuDisable = false;
if (urlList.value[0]['type'] == 'gps') {
detectionInfo.value[urlList.value[0]['type']].msg = "东经:" + res.data
.longitude + "°,北纬:" +
res.data.latitude + "°";
} else {
detectionInfo.value[urlList.value[0]['type']].msg = res.data[urlList.value[0][
'type'
]];
}
detectionInfo.value[urlList.value[0]['type']].detectionState = true;
urlList.value.shift();
if (urlList.value.length > 0) {
recursionExecDetection();
}
})
} else {
detectionInfo.value[urlList.value[0]['url']].load = '';
reqState.value = false; reqState.value = false;
detectionInfo.value[urlList.value[0]['type']].btuDisable = false; detectionInfo.value[urlList.value[0]['url']].btuDisable = false;
if (urlList.value[0]['type'] == 'gps') { detectionInfo.value[urlList.value[0]['url']].msg = res.data.message;
detectionInfo.value[urlList.value[0]['type']].msg = "东经:" + res.data if (res.data.code == 200) {
.longitude + "°,北纬:" + detectionInfo.value[urlList.value[0]['url']].detectionState = 'success';
res.data.latitude + "°";
} else { } else {
detectionInfo.value[urlList.value[0]['type']].msg = res.data[urlList.value[0][ detectionInfo.value[urlList.value[0]['url']].detectionState = 'error';
'type'
]];
} }
detectionInfo.value[urlList.value[0]['type']].detectionState = true;
urlList.value.shift(); urlList.value.shift();
if (urlList.value.length > 0) { if (urlList.value.length > 0) {
recursionExecDetection(); recursionExecDetection();
} }
})
} else {
detectionInfo.value[urlList.value[0]['url']].load = '';
reqState.value = false;
detectionInfo.value[urlList.value[0]['url']].btuDisable = false;
detectionInfo.value[urlList.value[0]['url']].msg = res.data.message;
if (res.data.code == 200) {
detectionInfo.value[urlList.value[0]['url']].detectionState = 'success';
} else {
detectionInfo.value[urlList.value[0]['url']].detectionState = 'error';
} }
urlList.value.shift(); });
if (urlList.value.length > 0) {
recursionExecDetection();
}
}
});
} }
const autoDetection = () => { const autoDetection = () => {