608 lines
22 KiB
JavaScript
Raw Normal View History

2025-04-14 10:57:27 +08:00
"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_file_picker2 = common_vendor.resolveComponent("uni-file-picker");
const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
const _easycom_uni_forms2 = common_vendor.resolveComponent("uni-forms");
const _easycom_uni_card2 = common_vendor.resolveComponent("uni-card");
const _easycom_aip_checkbox2 = common_vendor.resolveComponent("aip-checkbox");
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
const _easycom_uni_goods_nav2 = common_vendor.resolveComponent("uni-goods-nav");
const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
const _easycom_zero_loading2 = common_vendor.resolveComponent("zero-loading");
(_easycom_bikeCodeScan2 + _easycom_uni_forms_item2 + _easycom_uni_file_picker2 + _easycom_uni_icons2 + _easycom_uni_forms2 + _easycom_uni_card2 + _easycom_aip_checkbox2 + _easycom_uni_popup2 + _easycom_uni_goods_nav2 + _easycom_z_paging2 + _easycom_uni_easyinput2 + _easycom_zero_loading2)();
}
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_file_picker = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-file-picker/uni-file-picker.js";
const _easycom_uni_icons = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-icons/uni-icons.js";
const _easycom_uni_forms = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-forms/uni-forms.js";
const _easycom_uni_card = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-card/uni-card.js";
const _easycom_aip_checkbox = () => "../../../components/aip-checkbox/aip-checkbox.js";
const _easycom_uni_popup = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-popup/uni-popup.js";
const _easycom_uni_goods_nav = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-goods-nav/uni-goods-nav.js";
const _easycom_z_paging = () => "../../../uni_modules/z-paging/components/z-paging/z-paging.js";
const _easycom_uni_easyinput = () => "../../../node-modules/@dcloudio/uni-ui/lib/uni-easyinput/uni-easyinput.js";
const _easycom_zero_loading = () => "../../../uni_modules/zero-loading/components/zero-loading/zero-loading.js";
if (!Math) {
(_easycom_bikeCodeScan + _easycom_uni_forms_item + _easycom_uni_file_picker + _easycom_uni_icons + _easycom_uni_forms + _easycom_uni_card + _easycom_aip_checkbox + _easycom_uni_popup + _easycom_uni_goods_nav + _easycom_z_paging + _easycom_uni_easyinput + _easycom_zero_loading)();
}
const _sfc_main = {
__name: "maintenancepage",
setup(__props) {
const ebikeInfo = common_vendor.ref({});
const isloading = common_vendor.ref(false);
const bikeCodeScanChange = (data) => {
userInfo.value = common_vendor.index.getStorageSync("userInfo");
const bikeCode2 = data;
ebikeInfo.value.bikeCode = data;
const params = {
"receiverId": userInfo.value.staffId,
"bikeCode": bikeCode2
};
utils_api.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode2).then((res) => {
if (res.code == 200) {
ebikeInfo.value.ecuId = res.data.ecuId;
ebikeInfo.value.bikeId = res.data.bikeId;
ebikeInfo.value.ecuSn = res.data.ecuSn;
utils_api.callEbikeInfo("inspectHaveOrNotWorkOrder", params).then((res2) => {
if (res2.code == 200) {
orderId.value = res2.data;
utils_api.callEbikeInfo("getFaultInfo?orderId=" + res2.data, {}, "get").then((res1) => {
if (res1.code == 200) {
popup.value.close("center");
ebikeGZInfo.value = res1.data;
}
});
utils_api.callCoreApi("online?ecuId=" + ebikeInfo.value.ecuId + "&bikeId=" + ebikeInfo.value.bikeId, {}, "get").then((ecudata) => {
ebikeGZInfo.value.zxstate = ecudata.data.message;
});
utils_api.callCoreApi("gps?ecuId=" + ebikeInfo.value.ecuId + "&bikeId=" + ebikeInfo.value.bikeId, {}, "get").then((ecudata) => {
utils_api.callCoreApi("gpsMsg?ecuSn=" + ebikeInfo.value.ecuSn, {}, "get").then((res3) => {
ebikeGZInfo.value.batteryLevel = res3.data.soc + "%";
ebikeGZInfo.value.signalStrength = res3.data.gsm;
});
});
} else {
utils_api.callEbikeInfo("getFaultReportList?bikeCode=" + bikeCode2, "get").then((res3) => {
if (res3.code == 200) {
if (res3.data != null && res3.data.length > 0) {
popuptextlx.value = 2;
gzlist.value = res3.data;
popup.value.open("center");
} else {
popuptextlx.value = 1;
popup.value.open("center");
}
}
});
}
});
} else {
utils_tools.showModelMessage(res.message);
}
});
};
const selectImg = (data) => {
const file = data.tempFiles[0];
utils_api.fileUpload(file).then((res) => {
if (res.code == 200) {
fileLists.value.push(res.data);
} else {
if (fileLists.value.length > 0) {
fileLists.value.pop();
} else {
fileLists.value = [];
}
}
});
};
const delChangeImg = (res) => {
const fileUniqueKey = fileLists.value[res.index].fileUniqueKey;
fileLists.value.splice(res.index, 1);
utils_api.callEbikeInfo("deletedFile?fileUniqueKey=" + fileUniqueKey, {}, "get");
};
const fileLists = common_vendor.ref([]);
const orderId = common_vendor.ref("");
const handleResult = common_vendor.ref(null);
common_vendor.ref("1");
common_vendor.ref([{
text: "故障误报",
value: 2
}, {
text: "处理故障",
value: 1
}]);
const ebikeGZInfo = common_vendor.ref({
bikeCode: "",
longitude: "",
latitude: ""
});
const navButtonGroup = [{
text: "取消工单",
backgroundColor: "rgb(0,120,212)",
color: "#fff"
}, {
text: "处理完成",
backgroundColor: "rgb(0,120,212)",
color: "#fff"
}];
const popup_bottom = common_vendor.ref(null);
const popuptextlx = common_vendor.ref(1);
const tabIndex = common_vendor.ref(0);
const gzlist = common_vendor.ref([]);
const keys = common_vendor.ref(0);
const scrollHeight = common_vendor.ref(0);
common_vendor.ref("center");
const popup = common_vendor.ref(null);
const userInfo = common_vendor.ref(null);
const changeList = common_vendor.ref([
{
id: 0,
title: "故障详情"
},
{
id: 1,
title: "故障历史"
}
]);
const faultHistoryList = common_vendor.ref([]);
const paging = common_vendor.ref(null);
const loadMoreData = (pageNo, pageSize) => {
if (!ebikeInfo.value.bikeId) {
paging.value.complete([]);
return;
}
const params = {
"bikeId": ebikeInfo.value.bikeId,
"pageParam": {
"pageNum": pageNo,
"pageSize": pageSize
}
};
utils_api.callEbikeInfo("getFaultHistoryList", params).then((res) => {
if (res.code === 200) {
res.data;
paging.value.complete(res.data);
} else {
paging.value.complete(false);
}
});
};
const sendTabItem = (data) => {
let index = data["id"];
if (tabIndex.value == index)
return;
if (index == 1) {
if (!checkscan()) {
return;
}
paging.value.reload();
}
tabIndex.value = index;
};
const navButtonClick = (data) => {
if (!checkscan()) {
return;
}
const {
index,
content
} = data;
if (index == 0) {
utils_api.callEbikeInfo("canCellWorkOrder?orderId=" + orderId.value, {}, "get").then((res) => {
if (res.code == 200) {
common_vendor.index.showToast({
title: "取消成功!",
icon: "success",
duration: 1e3,
mask: true,
success: () => {
setTimeout(() => {
common_vendor.index.switchTab({
url: "/pages/mine/mine"
});
}, 1e3);
}
});
} else {
common_vendor.index.showToast({
title: "取消工单失败!",
icon: "error",
duration: 1e3,
mask: true
});
}
});
} else if (index == 1) {
popup_bottom.value.open("bottom");
}
};
const closePopup = () => {
popup.value.close("center");
common_vendor.index.switchTab({
url: "/pages/mine/mine"
});
};
const closePopupbottom = () => {
popup_bottom.value.close("bottom");
};
const submitGzInfo = () => {
common_vendor.index.showModal({
title: "确认提交",
content: "您确定要进行提交操作吗?",
success: (res) => {
if (res.confirm) {
const params = {
"orderId": orderId.value,
"handleResult": handleResult.value,
"fileList": fileLists.value
};
utils_api.callEbikeInfo("faultHandelComplete", params).then((res2) => {
if (res2.code == 200) {
common_vendor.index.showToast({
title: "提交成功!",
icon: "success",
duration: 1e3,
mask: true,
success: () => {
setTimeout(() => {
common_vendor.index.switchTab({
url: "/pages/mine/mine"
});
}, 1e3);
}
});
} else {
common_vendor.index.showToast({
title: "提交失败",
icon: "error",
duration: 1e3,
mask: true
});
}
});
} else if (res.cancel)
;
}
});
};
const checkscan = () => {
if (!ebikeInfo.value.bikeCode) {
utils_tools.showModelMessage("请先扫车辆码或输入车辆码");
return false;
}
if (!ebikeInfo.value.bikeId) {
utils_tools.showModelMessage("车辆信息不存在");
return false;
}
return true;
};
const createTicket = () => {
if (isloading.value) {
return;
}
isloading.value = true;
const faultIds = gzlist.value.filter((item) => item.checked === true).map((item) => item.faultReportId);
const params = {
"bikeCode": ebikeInfo.value.bikeCode,
"faultIds": faultIds,
"receiverId": userInfo.value.staffId
};
utils_api.callEbikeInfo("createWorkOrder", params).then((res) => {
if (res.code == 200) {
ebikeInfo.value.orderId = res.data;
orderId.value = res.data;
popup.value.close("center");
utils_api.callEbikeInfo("getFaultInfo?orderId=" + res.data, {}, "get").then((res1) => {
if (res1.code == 200) {
ebikeGZInfo.value = res1.data;
}
isloading.value = false;
});
utils_api.callCoreApi("online?ecuId=" + ebikeInfo.value.ecuId + "&bikeId=" + ebikeInfo.value.bikeId, {}, "get").then((ecudata) => {
ebikeGZInfo.value.zxstate = ecudata.data.message;
});
utils_api.callCoreApi("gps?ecuId=" + ebikeInfo.value.ecuId + "&bikeId=" + ebikeInfo.value.bikeId, {}, "get").then((ecudata) => {
utils_api.callCoreApi("gpsMsg?ecuSn=" + ebikeInfo.value.ecuSn, {}, "get").then((res2) => {
ebikeGZInfo.value.batteryLevel = res2.data.soc + "%";
ebikeGZInfo.value.signalStrength = res2.data.gsm;
});
});
} else {
isloading.value = false;
}
});
};
const gotoFaultReport = () => {
common_vendor.index.navigateTo({
url: "/pages/devops/faultreport/faultreport"
});
};
const check = (item, index) => {
item.checked = !item.checked;
keys.value = keys.value == 1 ? 0 : 1;
};
const execDetection = (url) => {
if (!checkscan()) {
return;
}
common_vendor.index.showLoading({
title: "指令下发中...",
mask: true
});
var data = ebikeInfo.value.ecuId;
var bikeId = ebikeInfo.value.bikeId;
utils_api.callCoreApi(url["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 viewMap = (lng, lat) => {
common_vendor.index.navigateTo({
url: "/pages/map/map-findbike?longitude=" + lng + "&latitude=" + lat
});
};
const bikeCode = common_vendor.ref("");
const childComponent = common_vendor.ref(null);
common_vendor.onLoad((options) => {
userInfo.value = common_vendor.index.getStorageSync("userInfo");
const systemInfo = common_vendor.index.getSystemInfoSync();
const screenHeight = systemInfo.screenHeight;
const statusBarHeight = systemInfo.statusBarHeight;
scrollHeight.value = screenHeight - statusBarHeight - 158;
if (options.bikeCode) {
bikeCode.value = options.bikeCode;
}
});
common_vendor.onMounted(() => {
if (bikeCode.value != "") {
if (childComponent.value) {
childComponent.value.onSetValue(bikeCode.value);
}
bikeCodeScanChange(bikeCode.value);
}
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.f(changeList.value, (item, index, i0) => {
return {
a: common_vendor.t(item.title),
b: index,
c: tabIndex.value == index ? 1 : "",
d: common_vendor.o(($event) => sendTabItem(item), index)
};
}),
b: tabIndex.value,
c: common_vendor.sr(childComponent, "ee1df61e-3,ee1df61e-2", {
"k": "childComponent"
}),
d: common_vendor.o(bikeCodeScanChange),
e: common_vendor.p({
codeValue: ebikeInfo.value.bikeCode
}),
f: common_vendor.p({
label: "车辆编号"
}),
g: common_vendor.t(ebikeGZInfo.value.faultPart),
h: common_vendor.p({
label: "故障部位"
}),
i: common_vendor.t(ebikeGZInfo.value.faultDescription),
j: common_vendor.p({
label: "故障内容"
}),
k: ebikeGZInfo.value.fileList
}, ebikeGZInfo.value.fileList ? {
l: common_vendor.p({
readonly: "true",
limit: "9",
value: ebikeGZInfo.value.fileList
}),
m: common_vendor.p({
label: "故障照片"
})
} : {}, {
n: common_vendor.t(ebikeGZInfo.value.reportUser),
o: common_vendor.p({
label: "上报人"
}),
p: common_vendor.t(ebikeGZInfo.value.reportSource),
q: common_vendor.p({
label: "上报来源"
}),
r: common_vendor.t(ebikeGZInfo.value.reportAt),
s: common_vendor.p({
label: "上报时间"
}),
t: common_vendor.t(ebikeGZInfo.value.zxstate),
v: common_vendor.p({
label: "在线状态"
}),
w: common_vendor.t(ebikeGZInfo.value.batteryLevel),
x: common_vendor.p({
label: "电池电量"
}),
y: ebikeGZInfo.value.longitude & ebikeGZInfo.value.latitude
}, ebikeGZInfo.value.longitude & ebikeGZInfo.value.latitude ? {} : {}, {
z: common_vendor.t(ebikeGZInfo.value.longitude + "," + ebikeGZInfo.value.latitude),
A: ebikeGZInfo.value.longitude & ebikeGZInfo.value.latitude
}, ebikeGZInfo.value.longitude & ebikeGZInfo.value.latitude ? {
B: common_vendor.p({
type: "right",
size: "20"
})
} : {}, {
C: common_vendor.o(($event) => viewMap(ebikeGZInfo.value.longitude, ebikeGZInfo.value.latitude)),
D: common_vendor.p({
label: "车辆位置"
}),
E: common_vendor.t(ebikeGZInfo.value.signalStrength),
F: common_vendor.p({
label: "信号强度"
}),
G: common_vendor.sr("ebikeInfoForm", "ee1df61e-1,ee1df61e-0"),
H: common_vendor.o(($event) => execDetection({
url: "unlock"
})),
I: common_vendor.o(($event) => execDetection({
url: ""
})),
J: common_vendor.o(($event) => execDetection({
url: "openBatteryLock"
})),
K: common_vendor.o(($event) => execDetection({
url: "openHelmet"
})),
L: popuptextlx.value == 1
}, popuptextlx.value == 1 ? {
M: common_vendor.o(closePopup),
N: common_vendor.o(gotoFaultReport)
} : {}, {
O: popuptextlx.value == 2
}, popuptextlx.value == 2 ? {
P: common_vendor.f(gzlist.value, (item, index, i0) => {
return common_vendor.e({
a: keys.value,
b: "ee1df61e-18-" + i0 + ",ee1df61e-17",
c: common_vendor.p({
check: item.checked
})
}, {
d: common_vendor.o(($event) => check(item), index),
e: common_vendor.t(item.faultPart),
f: common_vendor.t(item.faultDescription),
g: index
});
}),
Q: common_vendor.o(closePopup),
R: common_vendor.o(createTicket)
} : {}, {
S: common_vendor.sr(popup, "ee1df61e-17", {
"k": "popup"
}),
T: common_vendor.p({
["mask-click"]: false
}),
U: scrollHeight.value + "px",
V: common_vendor.o(navButtonClick),
W: common_vendor.p({
fill: true,
options: [],
buttonGroup: navButtonGroup
}),
X: tabIndex.value === 0,
Y: common_vendor.f(faultHistoryList.value, (item, k0, i0) => {
return {
a: common_vendor.t(item.bikeCode),
b: "ee1df61e-23-" + i0 + "," + ("ee1df61e-22-" + i0),
c: common_vendor.t(item.faultPart),
d: "ee1df61e-24-" + i0 + "," + ("ee1df61e-22-" + i0),
e: common_vendor.t(item.faultDescription),
f: "ee1df61e-25-" + i0 + "," + ("ee1df61e-22-" + i0),
g: common_vendor.t(item.reportAt),
h: "ee1df61e-26-" + i0 + "," + ("ee1df61e-22-" + i0),
i: common_vendor.t(item.handleAt),
j: "ee1df61e-27-" + i0 + "," + ("ee1df61e-22-" + i0),
k: common_vendor.t(item.receiverName),
l: "ee1df61e-28-" + i0 + "," + ("ee1df61e-22-" + i0),
m: common_vendor.t(item.handleResult),
n: "ee1df61e-29-" + i0 + "," + ("ee1df61e-22-" + i0),
o: common_vendor.sr("ebikeInfoForm", "ee1df61e-22-" + i0 + "," + ("ee1df61e-21-" + i0), {
"f": 1
}),
p: "ee1df61e-22-" + i0 + "," + ("ee1df61e-21-" + i0),
q: common_vendor.p({
modelValue: item
}),
r: "ee1df61e-21-" + i0 + ",ee1df61e-20"
};
}),
Z: common_vendor.p({
label: "车辆编号"
}),
aa: common_vendor.p({
label: "故障部位"
}),
ab: common_vendor.p({
label: "故障内容"
}),
ac: common_vendor.p({
label: "上报时间"
}),
ad: common_vendor.p({
label: "处理时间"
}),
ae: common_vendor.p({
label: "处理人"
}),
af: common_vendor.p({
label: "处理结果"
}),
ag: _ctx.index,
ah: common_vendor.sr(paging, "ee1df61e-20", {
"k": "paging"
}),
ai: common_vendor.o(loadMoreData),
aj: common_vendor.o(($event) => faultHistoryList.value = $event),
ak: common_vendor.p({
fixed: false,
height: "95vh",
["default-page-no"]: 1,
["default-page-size"]: 2,
["auto-show-back-to-top"]: true,
modelValue: faultHistoryList.value
}),
al: tabIndex.value === 1,
am: common_vendor.o(($event) => handleResult.value = $event),
an: common_vendor.p({
type: "textarea",
placeholder: "请输入处理结果",
modelValue: handleResult.value
}),
ao: common_vendor.o(selectImg),
ap: common_vendor.o(delChangeImg),
aq: common_vendor.p({
limit: "9",
value: fileLists.value
}),
ar: common_vendor.o(closePopupbottom),
as: common_vendor.o(submitGzInfo),
at: common_vendor.sr(popup_bottom, "ee1df61e-30", {
"k": "popup_bottom"
}),
av: common_vendor.p({
type: "bottom",
["background-color"]: "#fff"
}),
aw: isloading.value
}, isloading.value ? {
ax: common_vendor.p({
color: "#c1c1c0",
type: "pulse",
mask: "true"
})
} : {});
};
}
};
wx.createPage(_sfc_main);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/devops/maintenancepage/maintenancepage.js.map