2025-04-14 10:57:27 +08:00

410 lines
13 KiB
JavaScript

"use strict";
const common_vendor = require("../../../common/vendor.js");
const utils_api = require("../../../utils/api.js");
const utils_tools = require("../../../utils/tools.js");
if (!Array) {
const _easycom_bikeCodeScan2 = common_vendor.resolveComponent("bikeCodeScan");
const _easycom_uni_forms_item2 = common_vendor.resolveComponent("uni-forms-item");
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_uni_section2 = common_vendor.resolveComponent("uni-section");
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
const _easycom_uni_tag2 = common_vendor.resolveComponent("uni-tag");
const _easycom_uni_goods_nav2 = common_vendor.resolveComponent("uni-goods-nav");
(_easycom_bikeCodeScan2 + _easycom_uni_forms_item2 + _easycom_uni_icons2 + _easycom_uni_section2 + _easycom_uni_card2 + _easycom_uni_tag2 + _easycom_uni_goods_nav2)();
}
const _easycom_bikeCodeScan = () => "../../../components/bikeCodeScan/bikeCodeScan.js";
const _easycom_uni_forms_item = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-forms-item/uni-forms-item.js";
const _easycom_uni_icons = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons.js";
const _easycom_uni_section = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-section/uni-section.js";
const _easycom_uni_card = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.js";
const _easycom_uni_tag = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-tag/uni-tag.js";
const _easycom_uni_goods_nav = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-goods-nav/uni-goods-nav.js";
if (!Math) {
(_easycom_bikeCodeScan + _easycom_uni_forms_item + _easycom_uni_icons + _easycom_uni_section + _easycom_uni_card + _easycom_uni_tag + _easycom_uni_goods_nav)();
}
const _sfc_main = {
__name: "checkDevice",
setup(__props) {
const ebikeInfo = common_vendor.ref({
bikeId: "",
bikeCode: "",
ecuId: "",
ecuSn: "",
position: "",
stateName: ""
});
const position = common_vendor.ref({
longitude: "",
latitude: ""
});
const navButtonGroup = [{
text: "车辆详情",
backgroundColor: "rgb(0,120,212)",
color: "#fff"
}];
common_vendor.ref([
{
value: 0,
text: "关闭"
},
{
value: 1,
text: "打开"
}
]);
const bqlist = common_vendor.ref(
[{
name: "乐摇摇",
type: "primary"
}, {
name: "离线",
type: "success"
}, {
name: "低电量",
type: "warning"
}, {
name: "未投放",
type: "error"
}, {
name: "超出运营区",
type: "error"
}, {
name: "电量无更新",
type: "error"
}, {
name: "120H无单",
type: "error"
}, {
name: "72H调度无单",
type: "error"
}, {
name: "换电中",
type: "warning"
}, {
name: "已巡检",
type: "primary"
}]
);
const gdlist = common_vendor.ref(
[{
name: "调度",
icon: "icon-ebikehaocai",
url: ""
}, {
name: "换电",
icon: "icon-ebikedianchi",
url: "/pages/devops/changebatteries/changebatteries"
}, {
name: "维修",
icon: "icon-ebikeweixiuoff",
url: "/pages/devops/maintenancepage/maintenancepage"
}, {
name: "故障上报",
icon: "icon-ebikeguzhangshangbao1",
url: "/pages/devops/faultreport/faultreport"
}]
);
const ebikeczList = common_vendor.ref(
[{
name: "开锁",
click: false,
enabled: true,
url: "unlock"
}, {
name: "关锁",
click: false,
enabled: true,
url: "lock"
}, {
name: "开电池锁",
click: false,
enabled: true,
url: "openBatteryLock"
}, {
name: "还车",
click: false,
enabled: false,
url: "lock"
}, {
name: "开头盔锁",
click: false,
enabled: true,
url: "openHelmet"
}, {
name: "寻车铃",
click: false,
enabled: true,
url: "findEbike"
}, {
name: "重启",
click: false,
enabled: false,
url: "restart"
}, {
name: "临时停车",
click: false,
enabled: true,
url: "tempLock"
}, {
name: "重新定位",
click: false,
enabled: true,
url: ""
}]
);
const bikeCodeScanChange = (bikeCode) => {
ebikeInfo.value.bikeCode = bikeCode;
utils_api.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode).then((res) => {
if (res.code == 200) {
ebikeInfo.value.bikeId = res.data.bikeId;
utils_api.callCoreApi("gps?ecuId=" + res.data.ecuId + "&bikeId=" + res.data.bikeId, {}, "get").then((res2) => {
});
ebikeInfo.value.ecuId = res.data.ecuId;
ebikeInfo.value.ecuSn = res.data.ecuSn;
res.data.ecuSn;
navButtonGroup[0].disable = false;
ebikeInfo.value.position = res.data.resGPSDto.chineseLocation;
ebikeInfo.value.stateName = res.data.stateName;
position.value.longitude = res.data.resGPSDto.longitude;
position.value.latitude = res.data.resGPSDto.latitude;
ebikeInfo.value.accOn = res.data.resGPSDto.accOn == 0 ? "电门关闭" : "电门打开";
ebikeInfo.value.gsm = res.data.resGPSDto.gsm;
ebikeInfo.value.helmentExit = res.data.resGPSDto.helmentExit;
ebikeInfo.value.seatLocked = res.data.resGPSDto.seatLocked = res.data.resGPSDto.accOn == 0 ? "未锁" : "已锁";
ebikeInfo.value.soc = res.data.resGPSDto.soc + "%";
ebikeInfo.value.timestamp = common_vendor.dayjs(res.data.resGPSDto.timestamp * 1e3).format(
"YYYY-MM-DD HH:mm:ss"
);
ebikeInfo.value.voltage = res.data.resGPSDto.voltage * 1e-3 + "V";
ebikeInfo.value.wheelLocked = res.data.resGPSDto.wheelLocked == 0 ? "未锁" : "已锁";
utils_api.callCoreApi(
"online?ecuId=" + ebikeInfo.value.ecuId + "&bikeId=" + res.data.bikeId,
{},
"get"
).then((ecudata) => {
ebikeInfo.value.zxstate = ecudata.data.message;
});
} else {
utils_tools.showModelMessage(res.message);
}
});
};
const clickUseEbike = (item, index) => {
if (!checkscan()) {
return;
}
ebikeczList.value[index].click = true;
setTimeout(() => {
ebikeczList.value[index].click = false;
}, 100);
common_vendor.index.showLoading({
title: "指令下发中...",
mask: true
});
var data = ebikeInfo.value.ecuId;
var bikeId = ebikeInfo.value.bikeId;
utils_api.callCoreApi(item["url"] + "?ecuId=" + data + "&bikeId=" + bikeId, {}, "get").then((res) => {
common_vendor.index.hideLoading();
var title = res.data.message;
var icon = "";
if (res.data.code == 200) {
icon = "success";
} else {
icon = "error";
}
common_vendor.index.showToast({
title,
icon,
duration: 2e3,
mask: true
});
});
};
const clickzgd = (item, index) => {
if (!checkscan()) {
return;
}
gdlist.value[index].click = true;
setTimeout(() => {
gdlist.value[index].click = false;
common_vendor.index.navigateTo({
url: item["url"] + "?bikeCode=" + ebikeInfo.value.bikeCode
});
}, 100);
};
const gotoMapsInfo = () => {
common_vendor.index.navigateTo({
url: "/pages/map/map-findbike?longitude=" + position.value.longitude + "&latitude=" + position.value.latitude
});
};
const gotohdInfo = () => {
common_vendor.index.navigateTo({
url: "/pages/devops/changebatteries/changebatteries?bikeCode=" + ebikeInfo.value.bikeCode
});
};
const navButtonClick = (index, content) => {
if (!checkscan()) {
return;
}
common_vendor.index.navigateTo({
url: "/pages/devops/ebikeinfo/ebikeinfo?bikeId=" + ebikeInfo.value.bikeId + "&ecuId=" + ebikeInfo.value.ecuId + "&ecuSn=" + ebikeInfo.value.ecuSn
});
};
const checkscan = () => {
if (!ebikeInfo.value.bikeCode) {
utils_tools.showModelMessage("请先扫车辆码或输入车辆码");
return false;
}
if (!ebikeInfo.value.bikeId) {
utils_tools.showModelMessage("车辆信息不存在");
return false;
}
return true;
};
const scrollHeight = common_vendor.ref(0);
common_vendor.onMounted(() => {
const systemInfo = common_vendor.index.getSystemInfoSync();
const screenHeight = systemInfo.screenHeight;
const statusBarHeight = systemInfo.statusBarHeight;
scrollHeight.value = screenHeight - statusBarHeight - 113;
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(bikeCodeScanChange),
b: common_vendor.p({
codeValue: ebikeInfo.value.bikeCode
}),
c: common_vendor.p({
label: "车辆编号",
["label-s"]: true,
name: "bikeCode"
}),
d: common_vendor.t(ebikeInfo.value.zxstate),
e: common_vendor.p({
label: "在线状态"
}),
f: common_vendor.t(ebikeInfo.value.soc),
g: ebikeInfo.value.soc != null && ebikeInfo.value.soc != ""
}, ebikeInfo.value.soc != null && ebikeInfo.value.soc != "" ? {
h: common_vendor.o(gotohdInfo)
} : {}, {
i: common_vendor.p({
label: "实时电量"
}),
j: common_vendor.t(ebikeInfo.value.stateName),
k: common_vendor.p({
label: "车辆状态"
}),
l: common_vendor.t(ebikeInfo.value.voltage),
m: common_vendor.p({
label: "实时电压"
}),
n: common_vendor.t(ebikeInfo.value.soc),
o: common_vendor.p({
label: "离线前电量"
}),
p: common_vendor.t(ebikeInfo.value.voltage),
q: common_vendor.p({
label: "离线前电压"
}),
r: common_vendor.t(ebikeInfo.value.accOn),
s: common_vendor.p({
label: "电门状态"
}),
t: common_vendor.t(ebikeInfo.value.wheelLocked),
v: common_vendor.p({
label: "轮锁状态"
}),
w: common_vendor.t(ebikeInfo.value.seatLocked),
x: common_vendor.p({
label: "电池仓状态"
}),
y: common_vendor.t(ebikeInfo.value.gsm),
z: common_vendor.p({
label: "GPS信号强度"
}),
A: common_vendor.t(ebikeInfo.value.positionNow),
B: common_vendor.p({
label: "所处站点"
}),
C: common_vendor.t(ebikeInfo.value.position),
D: ebikeInfo.value.position != null && ebikeInfo.value.position != ""
}, ebikeInfo.value.position != null && ebikeInfo.value.position != "" ? {
E: common_vendor.p({
["custom-prefix"]: "iconfont",
color: "#1488f5",
type: "icon-ebikeditu1",
size: "15"
}),
F: common_vendor.o(gotoMapsInfo)
} : {}, {
G: common_vendor.p({
label: "最新定位"
}),
H: common_vendor.t(ebikeInfo.value.lastRideTime),
I: common_vendor.p({
label: "最后的骑行时间"
}),
J: common_vendor.t(ebikeInfo.value.lastRideUser),
K: common_vendor.p({
label: "最后的骑行人"
}),
L: common_vendor.f(bqlist.value, (item, index, i0) => {
return {
a: "7deccf29-21-" + i0 + ",7deccf29-20",
b: common_vendor.p({
text: item.name,
type: item.type
}),
c: index
};
}),
M: common_vendor.p({
title: "标签",
type: "line"
}),
N: common_vendor.f(ebikeczList.value, (item, index, i0) => {
return {
a: common_vendor.t(item.name),
b: common_vendor.o(($event) => clickUseEbike(item, index), index),
c: index,
d: common_vendor.n(item.click ? "classbutsele" : "")
};
}),
O: common_vendor.p({
title: "操作",
type: "line"
}),
P: common_vendor.f(gdlist.value, (item, index, i0) => {
return {
a: "7deccf29-26-" + i0 + ",7deccf29-25",
b: common_vendor.p({
["custom-prefix"]: "iconfont",
color: "rgb(255,129,0)",
type: item.icon,
size: "25"
}),
c: common_vendor.t(item.name),
d: common_vendor.o(($event) => clickzgd(item, index), index),
e: common_vendor.n(item.click ? "select" : ""),
f: index
};
}),
Q: common_vendor.p({
title: "转工单",
type: "line"
}),
R: scrollHeight.value + "px",
S: common_vendor.o(navButtonClick),
T: common_vendor.p({
fill: true,
options: [],
buttonGroup: navButtonGroup
})
});
};
}
};
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/devops/checkDevice/checkDevice.js.map