fix:修改维修页面样式及功能

This commit is contained in:
5g0Wp7Zy 2025-07-29 16:02:45 +08:00
parent 59f3f8c908
commit 0ea119cd1d
4 changed files with 857 additions and 759 deletions

View File

@ -3,35 +3,56 @@
<uni-card>
<uni-forms>
<uni-forms-item label="车辆编号">
<bikeCodeScan ref="childComponent" @scan-change="bikeCodeScanChange"
:codeValue="ebikeInfo.bikeCode" />
<bikeCodeScan
ref="childComponent"
@scan-change="bikeCodeScanChange"
:codeValue="ebikeInfo.bikeCode"
/>
</uni-forms-item>
<uni-forms-item label="当前坐标">
<uni-easyinput :disabled="true" v-model="currentCoordinates" placeholder="获取中..." />
<uni-easyinput
:disabled="true"
v-model="currentCoordinates"
placeholder="获取中..."
/>
</uni-forms-item>
</uni-forms>
<view class="">
<view class="flex">
<view>
<uni-icons type="location" color="rgb(19,147,235)" size="20"></uni-icons>
</view>
<view class="classwz1">
请确定损坏车辆当前位置
<uni-icons
type="location"
color="rgb(19,147,235)"
size="20"
></uni-icons>
</view>
<view class="classwz1"> 请确定损坏车辆当前位置 </view>
</view>
<view class="classwz2">
{{ address }}
</view>
<view class="classwz3">
拖动地图可修改位置
</view>
<view class="classwz3"> 拖动地图可修改位置 </view>
</view>
</uni-card>
<view v-if="ebikeInfo.latitude & ebikeInfo.longitude" class="divmap">
<map-location height="500px" :lng="ebikeInfo.longitude" :lat="ebikeInfo.latitude" @change="changePoint" />
<map-location
height="500px"
:lng="ebikeInfo.longitude"
:lat="ebikeInfo.latitude"
@change="changePoint"
/>
</view>
<you-touchbox initTop="500" minTop="220" maxTop="5" @get-end-detail="getEndDetail">
<scroll-view class="scroll-container" :scroll-y="isScrollY" :style="{ height: scrollHeight + 'px' }">
<you-touchbox
initTop="500"
minTop="220"
maxTop="5"
@get-end-detail="getEndDetail"
>
<scroll-view
class="scroll-container"
:scroll-y="isScrollY"
:style="{ height: scrollHeight + 'px' }"
>
<view class="">
<view class="containerup">
<view class="titleup">
@ -39,23 +60,49 @@
<span class="wzgl">损坏部位</span>
</view>
</view>
<uni-grid :column="4" :show-border="false" :square="false" :highlight="true" @change="change">
<uni-grid-item v-for="(item, index) in ebikelingjian" :index="index" :key="index">
<view class="cheliangclassbox" :class="item.isSelect ? 'border_color_select' : ''">
<uni-icons custom-prefix="iconfont" :type="item.path" :size="25" color="#777" />
<uni-grid
:column="4"
:show-border="false"
:square="false"
:highlight="true"
@change="change"
>
<uni-grid-item
v-for="(item, index) in ebikelingjian"
:index="index"
:key="index"
>
<view
class="cheliangclassbox"
:class="item.isSelect ? 'border_color_select' : ''"
>
<uni-icons
custom-prefix="iconfont"
:type="item.path"
:size="25"
color="#777"
/>
</view>
<text class="text">{{ item.name }}</text>
</uni-grid-item>
</uni-grid>
<view class="padding">
<uni-easyinput type="textarea" v-model="bzxx" placeholder="其它想说的" />
<uni-easyinput
type="textarea"
v-model="bzxx"
placeholder="其它想说的"
/>
</view>
</view>
<uni-section title="上传图片" type="line">
<view class="example-body">
<uni-file-picker limit="9" @select="selectImg" @delete="delChangeImg"
:value="fileLists"></uni-file-picker>
<uni-file-picker
limit="9"
@select="selectImg"
@delete="delChangeImg"
:value="fileLists"
></uni-file-picker>
</view>
</uni-section>
</scroll-view>
@ -64,32 +111,40 @@
</view>
<view class="nav-panel">
<uni-goods-nav :fill="true" :options="[]" :buttonGroup="navButtonGroup" @buttonClick="navButtonClick" />
<uni-goods-nav
:fill="true"
:options="[]"
:buttonGroup="navButtonGroup"
@buttonClick="navButtonClick"
/>
</view>
<uni-popup ref="popup" class="unipopup" :mask-click="false">
<view v-if="popuptextlx == 1" class="bg-white boxcenter">
<view class="textbox">
您已有当前车辆的待维修工单是否进行维修
</view>
<view class="textbox"> 您已有当前车辆的待维修工单是否进行维修 </view>
<view class="example">
<view class="buttongroup">
<button @click="closePopup" class="cu-btn lg bg-blue">仍然上报</button>
<button @click="gotomaintenancepage" class="cu-btn lg bg-blue">去维修</button>
<button @click="closePopup" class="cu-btn lg bg-blue">
仍然上报
</button>
<button @click="gotomaintenancepage" class="cu-btn lg bg-blue">
去维修
</button>
</view>
</view>
</view>
<view v-else-if="popuptextlx == 2" class="bg-white boxcenter">
<view class="textbox">
当前车辆故障如下可选择进行维修:
</view>
<view class="textbox"> 当前车辆故障如下可选择进行维修: </view>
<view class="textlist">
<scroll-view class="scroll-container" scroll-y style="height: 170px;">
<scroll-view class="scroll-container" scroll-y style="height: 170px">
<view v-for="(item, index) in gzlist" :key="index">
<view class="flex gzboxlist">
<view @click="check(item, index)">
<aip-checkbox :key="keys" :check="item.checked" v-if="true"></aip-checkbox>
<aip-checkbox
:key="keys"
:check="item.checked"
v-if="true"
></aip-checkbox>
</view>
<view class="item">
<view class="wz14">
@ -105,8 +160,12 @@
</view>
<view class="example">
<view class="buttongroup">
<button @click="closePopup" class="cu-btn lg bg-blue">仍然上报</button>
<button @click="createTicket" class="cu-btn lg bg-blue">去维修</button>
<button @click="closePopup" class="cu-btn lg bg-blue">
仍然上报
</button>
<button @click="createTicket" class="cu-btn lg bg-blue">
去维修
</button>
</view>
</view>
</view>
@ -114,29 +173,21 @@
</template>
<script setup>
import {
reactive,
ref,
onMounted
} from 'vue';
import * as api from '@/utils/api.js';
import {
showModelMessage
} from '@/utils/tools.js';
import config from '../../../utils/config';
import {
onLoad
} from '@dcloudio/uni-app';
import { reactive, ref, onMounted } from "vue";
import * as api from "@/utils/api.js";
import { showModelMessage } from "@/utils/tools.js";
import config from "../../../utils/config";
import { onLoad } from "@dcloudio/uni-app";
import mapLocation from "@/pages/map/map-location.vue";
const ebikeInfo = ref({
bikeId: '',
bikeCode: '',
ecuId: '',
ecuSn: '',
longitude: '',
latitude: ''
bikeId: "",
bikeCode: "",
ecuId: "",
ecuSn: "",
longitude: "",
latitude: "",
});
const bikeCode = ref("");
@ -148,21 +199,17 @@
const fileUniqueKey = fileLists.value[res.index].fileUniqueKey;
fileLists.value.splice(res.index, 1);
api.callEbikeInfo("deletedFile?fileUniqueKey=" + fileUniqueKey, {}, "get");
}
const isScrollY = ref(false)
const getEndDetail = ({
minTop,
maxTop,
curTop
}) => {
if (curTop == maxTop) isScrollY.value = true
else isScrollY.value = false
}
};
const isScrollY = ref(false);
const getEndDetail = ({ minTop, maxTop, curTop }) => {
if (curTop == maxTop) isScrollY.value = true;
else isScrollY.value = false;
};
const selectImg = (data) => {
const file = data.tempFiles[0];
api.fileUpload(file).then(res => {
api.fileUpload(file).then((res) => {
if (res.code == 200) {
fileLists.value.push(res.data)
fileLists.value.push(res.data);
} else {
if (fileLists.value.length > 0) {
fileLists.value.pop();
@ -171,85 +218,88 @@
}
}
});
}
};
const check = (item, index) => {
item.checked = !item.checked;
keys.value = keys.value == 1 ? 0 : 1;
}
const bzxx = ref("")
const ebikelingjian = ref([{
name: '车轮',
path: 'icon-ebikechelun',
};
const bzxx = ref("");
const ebikelingjian = ref([
{
name: "车轮",
path: "icon-ebikechelun",
id: 1,
isSelect: false
isSelect: false,
},
{
name: '挡泥板',
path: 'icon-ebikedangniban',
name: "挡泥板",
path: "icon-ebikedangniban",
id: 2,
isSelect: false
isSelect: false,
},
{
name: '电池',
path: 'icon-ebikedianchi',
name: "电池",
path: "icon-ebikedianchi",
id: 3,
isSelect: false
isSelect: false,
},
{
name: '脚撑',
path: 'icon-ebikepart',
name: "脚撑",
path: "icon-ebikepart",
id: 4,
isSelect: false
isSelect: false,
},
{
name: '开关锁',
path: 'icon-ebikekaiguansuo-guan',
name: "开关锁",
path: "icon-ebikekaiguansuo-guan",
id: 5,
isSelect: false
isSelect: false,
},
{
name: '链条',
path: 'icon-ebikeliantiao',
name: "链条",
path: "icon-ebikeliantiao",
id: 6,
isSelect: false
isSelect: false,
},
{
name: '前蹬',
path: 'icon-ebikerunning-shoes',
name: "前蹬",
path: "icon-ebikerunning-shoes",
id: 7,
isSelect: false
isSelect: false,
},
{
name: '刹车',
path: 'icon-ebikedolly-empty',
name: "刹车",
path: "icon-ebikedolly-empty",
id: 8,
isSelect: false
isSelect: false,
},
{
name: '转把',
path: 'icon-ebikeziyoushihuaxue',
name: "转把",
path: "icon-ebikeziyoushihuaxue",
id: 9,
isSelect: false
isSelect: false,
},
{
name: '座椅',
path: 'icon-ebikezuoyi',
name: "座椅",
path: "icon-ebikezuoyi",
id: 10,
isSelect: false
isSelect: false,
},
{
name: '其它',
path: 'icon-ebikeqita',
name: "其它",
path: "icon-ebikeqita",
id: 11,
isSelect: false
}
isSelect: false,
},
]);
const navButtonGroup = [{
text: '确认提交',
backgroundColor: '#0078D4',
color: '#fff'
}];
const navButtonGroup = [
{
text: "确认提交",
backgroundColor: "#0078D4",
color: "#fff",
},
];
const bikeCodeScanChange = (bikeCode) => {
ebikeInfo.value.bikeCode = bikeCode;
api.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode).then((res) => {
@ -259,49 +309,60 @@
ebikeInfo.value.ecuSn = res.data.ecuSn;
const ecuSn = res.data.ecuSn;
const params = {
"receiver": userInfo.value.staffId,
"bikeCode": bikeCode
}
receiver: userInfo.value.staffId,
bikeCode: bikeCode,
};
api.callEbikeInfo("inspectHaveOrNotWorkOrder", params).then((res) => {
if (res.code == 200) {
popuptextlx.value = 1;
popup.value.open("center");
} else {
api.callEbikeInfo("getFaultReportList?bikeCode=" + bikeCode, 'get').then((
res) => {
api
.callEbikeInfo("getFaultReportList?bikeCode=" + bikeCode, "get")
.then((res) => {
if (res.code == 200) {
if (res.data != null && res.data.length > 0) {
gzlist.value = res.data
gzlist.value = res.data;
popuptextlx.value = 2;
popup.value.open("center");
}
}
})
});
}
})
});
//
api.callCoreApi("gps?ecuId=" + res.data.ecuId + "&bikeId=" + ebikeInfo.value.bikeId, {}, 'get')
api
.callCoreApi(
"gps?ecuId=" + res.data.ecuId + "&bikeId=" + ebikeInfo.value.bikeId,
{},
"get"
)
.then((res) => {
api.callCoreApi("gpsMsg" + "?ecuSn=" + ecuSn, {}, 'get').then((res) => {
currentCoordinates.value = res.data.longitude + "," + res.data
.latitude;
api
.callCoreApi("gpsMsg" + "?ecuSn=" + ecuSn, {}, "get")
.then((res) => {
currentCoordinates.value =
res.data.longitude + "," + res.data.latitude;
ebikeInfo.value.latitude = res.data.latitude;
ebikeInfo.value.longitude = res.data.longitude;
})
});
});
} else {
showModelMessage("车辆信息不存在,请重新扫描或输入车辆码");
ebikeInfo.value.bikeCode = "";
ebikeInfo.value.bikeId = "";
ebikeInfo.value.ecuId = "";
ebikeInfo.value.ecuSn = "";
childComponent.value.clearValue();
}
});
};
const change = (e) => {
let {
index
} = e.detail
ebikelingjian.value[index].isSelect = !ebikelingjian.value[index].isSelect
}
let { index } = e.detail;
ebikelingjian.value[index].isSelect = !ebikelingjian.value[index].isSelect;
};
const gzlist = ref([]);
const keys = ref(0)
const keys = ref(0);
const checkscan = () => {
if (!ebikeInfo.value.bikeCode) {
@ -313,100 +374,101 @@
return false;
}
return true;
}
};
const navButtonClick = (index, content) => {
if (!checkscan()) {
return
return;
}
uni.showModal({
title: '确认提交',
content: '您确定要进行提交操作吗?',
title: "确认提交",
content: "您确定要进行提交操作吗?",
success: (res) => {
if (res.confirm) {
let faultPart = ebikelingjian.value.map(res => res.isSelect ? res.name : null)
.filter(name => name !== null);
let faultPart = ebikelingjian.value
.map((res) => (res.isSelect ? res.name : null))
.filter((name) => name !== null);
const params = {
"bikeCode": ebikeInfo.value.bikeCode,
"longitude": Number(ebikeInfo.value.longitude),
"latitude": Number(ebikeInfo.value.latitude),
"faultPart": faultPart.join("|"), //
"faultDescription": bzxx.value, //
"reportUser": userInfo.value.staffId, //
bikeCode: ebikeInfo.value.bikeCode,
longitude: Number(ebikeInfo.value.longitude),
latitude: Number(ebikeInfo.value.latitude),
faultPart: faultPart.join("|"), //
faultDescription: bzxx.value, //
reportUser: userInfo.value.staffId, //
// "reportUserName": userInfo.value.username, //
"reportSource": "运维端",
"reqEbikeFaultReportFileDtos": fileLists.value
}
reportSource: "运维端",
reqEbikeFaultReportFileDtos: fileLists.value,
};
api.callEbikeInfo("faultReporting", params).then((res) => {
if (res.code == 200) {
uni.showToast({
title: '提交成功',
icon: 'success',
duration: 2000
title: "提交成功",
icon: "success",
duration: 2000,
});
//
uni.switchTab({
url: "/pages/mine/mine"
})
url: "/pages/mine/mine",
});
} else {
uni.showToast({
title: '操作失败',
icon: 'error',
duration: 2000
title: "操作失败",
icon: "error",
duration: 2000,
});
}
})
});
} else if (res.cancel) {
console.log('用户取消出库');
}
console.log("用户取消出库");
}
},
});
}
};
const userInfo = ref(null);
const closePopup = () => {
popup.value.close("center");
}
};
const gotomaintenancepage = () => {
uni.navigateTo({
url: `/pages/devops/maintenancepage/maintenancepage?bikeCode=${ebikeInfo.value.bikeCode}`
})
}
url: `/pages/devops/maintenancepage/maintenancepage?bikeCode=${ebikeInfo.value.bikeCode}`,
});
};
const createTicket = () => {
//
const faultIds = gzlist.value.filter(item => item.checked === true).map(item => item.faultReportId);
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
}
bikeCode: ebikeInfo.value.bikeCode,
faultIds: faultIds,
receiverId: userInfo.value.staffId,
};
api.callEbikeInfo("createWorkOrder", params).then((res) => {
if (res.code == 200) { //
if (res.code == 200) {
//
closePopup();
setTimeout(() => {
gotomaintenancepage();
}, 200);
}
})
}
});
};
const popuptextlx = ref(1)
const popuptextlx = ref(1);
const typepopup = ref("center");
const popup = ref(null);
const scrollHeight = ref(0);
const currentCoordinates = ref(null);
onLoad((options) => {
userInfo.value = uni.getStorageSync('userInfo');
userInfo.value = uni.getStorageSync("userInfo");
const systemInfo = uni.getSystemInfoSync();
const screenHeight = systemInfo.screenHeight;
const statusBarHeight = systemInfo.statusBarHeight;
scrollHeight.value = screenHeight - statusBarHeight - 130;
if (options.bikeCode) {
bikeCode.value = options.bikeCode
bikeCode.value = options.bikeCode;
}
})
});
onMounted(() => {
if (bikeCode.value != "") {
if (childComponent.value) {
@ -415,26 +477,24 @@
bikeCodeScanChange(bikeCode.value);
}
uni.getLocation({
type: 'wgs84', // wgs84
type: "wgs84", // wgs84
success: function (res) {
ebikeInfo.value.latitude = res.latitude;
ebikeInfo.value.longitude = res.longitude;
currentCoordinates.value = res.longitude + "," + res.latitude;
},
fail: function (err) {
console.log('获取位置失败:', err);
}
console.log("获取位置失败:", err);
},
});
});
})
const changePoint = (res) => {
address.value = res.address;
currentCoordinates.value = res.location.lng + "," + res.location.lat;
ebikeInfo.value.latitude = res.location.lat;
ebikeInfo.value.longitude = res.location.lng;
}
};
</script>
<style>
@ -543,7 +603,8 @@
z-index: 199;
}
.classtb {}
.classtb {
}
.classwz1 {
font-size: 14px;
@ -569,4 +630,8 @@
height: 500px;
margin-top: -15px;
}
.example-body {
padding: 0 25rpx;
}
</style>

View File

@ -4,45 +4,61 @@
<!-- 用户名输入框 -->
<view class="input-group">
<uni-easyinput v-model="userName" placeholder="请输入用户名"></uni-easyinput>
<uni-easyinput
v-model="userName"
placeholder="请输入用户名"
></uni-easyinput>
</view>
<!-- 密码输入框-->
<view class="input-group">
<uni-easyinput type="password" v-model="passWord" placeholder="请输入密码"></uni-easyinput>
<uni-easyinput
type="password"
v-model="passWord"
placeholder="请输入密码"
></uni-easyinput>
</view>
<!-- 登录按钮 -->
<button type="primary" class="login-button" @click="login"><span>立即登录</span></button>
<button
type="primary"
class="login-button"
:disabled="isLogin"
@click="login"
>
<span>立即登录</span>
</button>
</view>
</template>
<script>
import {
getCurrentInstance,
ref
} from 'vue';
import { getCurrentInstance, ref } from "vue";
import {
login as reqLogin,
getUserZone,
getUserOperation,
getUserRegion
} from '../../utils/api';
getUserRegion,
} from "../../utils/api";
export default {
setup() {
const userName = ref('');
const passWord = ref('');
const userName = ref("");
const passWord = ref("");
const isLogin = ref(false);
//
const login = () => {
uni.showLoading({
title: "登录中...",
});
isLogin.value = true;
if (!userName.value || !passWord.value) {
uni.showToast({
title: '请输入完整信息',
icon: 'none',
title: "请输入完整信息",
icon: "none",
});
return;
}
const param = {
"username": userName.value,
"password": passWord.value
username: userName.value,
password: passWord.value,
};
// uni.switchTab({
// url: '/pages/home/home', // Tab
@ -51,74 +67,73 @@
// 使
reqLogin(param).then(
(res) => {
uni.hideLoading();
isLogin.value = false;
if (res.code == 200) {
//
uni.setStorageSync('token', res.data.token);
uni.setStorageSync('userInfo', res.data.staff);
uni.setStorageSync('permCodes', res.data.permCodes);
uni.setStorageSync("token", res.data.token);
uni.setStorageSync("userInfo", res.data.staff);
uni.setStorageSync("permCodes", res.data.permCodes);
if (res.data.permCodes.length == 0) {
uni.showToast({
title: '该用户没有权限',
icon: 'none',
title: "该用户没有权限",
icon: "none",
});
}
else if (res.data.permCodes.includes('maintenance.applet') === -1) {
} else if (
res.data.permCodes.includes("maintenance.applet") === -1
) {
uni.showToast({
title: '该用户没有权限',
icon: 'none',
title: "该用户没有权限",
icon: "none",
});
}
else
{
} else {
uni.showToast({
title: '登录成功',
icon: 'success',
title: "登录成功",
icon: "success",
});
getUserZone().then(res => {
getUserZone().then((res) => {
if (res.code == 200) {
uni.setStorageSync('userZone', res.data);
getUserOperation().then(res => {
uni.setStorageSync("userZone", res.data);
getUserOperation().then((res) => {
if (res.code == 200) {
uni.setStorageSync('userOperation', res.data);
uni.setStorageSync("userOperation", res.data);
if (res.data.length > 0) {
uni.setStorageSync('userDefultOperation', res.data[0]);
uni.setStorageSync("userDefultOperation", res.data[0]);
}
// Home Tab
uni.switchTab({
url: '/pages/mine/mine', // Tab
url: "/pages/mine/mine", // Tab
});
}
else
{
} else {
uni.showToast({
title: '获取用户区域信息失败',
icon: 'none',
title: "获取用户区域信息失败",
icon: "none",
});
}
});
}
else
{
} else {
uni.showToast({
title: '获取用户区域信息失败',
icon: 'none',
title: "获取用户区域信息失败",
icon: "none",
});
}
});
}
} else {
console.log('OK3--user/login登录失败');
console.log("OK3--user/login登录失败");
uni.showToast({
title: '登录失败',
icon: 'none',
title: "登录失败",
icon: "none",
});
}
},
(error) => {
console.log('登录异常--user/login');
console.log("登录异常--user/login");
uni.hideLoading();
isLogin.value = false;
uni.showToast({
title: '登录失败',
icon: 'none',
title: "登录失败",
icon: "none",
});
}
);
@ -127,7 +142,8 @@
return {
userName,
passWord,
login
login,
isLogin,
};
},
};
@ -155,7 +171,6 @@
width: 100%;
}
.login-button {
margin-top: 80px;
background-color: #007aff;

View File

@ -13,7 +13,6 @@
text-align: center;
border: 1px solid #80808061;
padding: 0px 5px;
}
.divBtnTitle {
@ -76,7 +75,6 @@
.divCountRow .divCount {
font-size: 20px;
font-weight: bold;
}
.divCountRow .divTitle {

View File

@ -359,7 +359,12 @@ const onRingClick = (bikeCode) => {
title: "指令下发中...",
mask: true,
});
api.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode).then((res) => {
console.log(1111);
api
.callEbikeInfo("getBikeINfoData?bikeCode=" + bikeCode)
.then((res) => {
console.log(res);
if (res.code == 200) {
const ecuId = res.data.ecuId;
const bikeId = res.data.bikeId;
@ -385,8 +390,23 @@ const onRingClick = (bikeCode) => {
duration: 1000,
mask: true,
});
})
.catch((err) => {
console.log(err);
uni.hideLoading();
});
} else {
uni.showToast({
title: res.message,
icon: "error",
duration: 1000,
mask: true,
});
uni.hideLoading();
}
})
.catch((err) => {
uni.hideLoading();
});
};
</script>