故障上报小重构
This commit is contained in:
parent
1e2095aca6
commit
48191dbe57
35
common/enums/fault.js
Normal file
35
common/enums/fault.js
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/**
|
||||
* 故障申报状态(与后台一致)
|
||||
*/
|
||||
export const FaultStatus = {
|
||||
IGNORED: { label: '已忽略', value: '0' },
|
||||
PENDING: { label: '待处理', value: '1' },
|
||||
COMPLETED: { label: '已完成', value: '3' }
|
||||
}
|
||||
|
||||
/** 仅待处理可审核 */
|
||||
export const FAULT_PENDING = FaultStatus.PENDING.value
|
||||
|
||||
/**
|
||||
* 根据状态码获取展示文案
|
||||
* @param {string} status appealStatus
|
||||
* @returns {string}
|
||||
*/
|
||||
export function getFaultStatusLabel(status) {
|
||||
if (status == null || status === '') return '未知'
|
||||
const map = {
|
||||
[FaultStatus.IGNORED.value]: FaultStatus.IGNORED.label,
|
||||
[FaultStatus.PENDING.value]: FaultStatus.PENDING.label,
|
||||
[FaultStatus.COMPLETED.value]: FaultStatus.COMPLETED.label
|
||||
}
|
||||
return map[status] || '未知'
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为可审核状态(待处理)
|
||||
* @param {string} status appealStatus
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function canAuditFault(status) {
|
||||
return status === FAULT_PENDING
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
const install = (Vue, vm) => {
|
||||
uni.setStorageSync('deptId', 100);
|
||||
Vue.prototype.$u.http.setConfig({
|
||||
// baseUrl: 'http://192.168.1.8:4101', //键辉本地
|
||||
// baseUrl: 'http://192.168.2.221:4101', //景森本地
|
||||
baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 小鹿appid: wx8a05cf95418a6859 小兔骑骑appid:wx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe
|
||||
baseUrl: 'http://192.168.1.3:4101', //键辉本地
|
||||
// baseUrl: 'http://192.168.2.221:4101', //景森本地
|
||||
// baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 小鹿appid: wx8a05cf95418a6859 小兔骑骑appid:wx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe
|
||||
// baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上
|
||||
// baseUrl:'https://ysd.chuantewulian.cn/prod-api', //嵛山岛线上api 嵛山岛appid:wx4d178f8c80348214
|
||||
loadingText: '努力加载中~',
|
||||
loadingText: '努力加载中~',
|
||||
loadingTime: 10000,
|
||||
// 设置自定义头部content-type
|
||||
// 设置自定义头部content-type
|
||||
header: {
|
||||
'content-type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,14 +11,8 @@
|
|||
<text class="code">编号: {{item.vehicleCode}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="status-tag"
|
||||
:class="{
|
||||
'pending': item.appealStatus==1,
|
||||
'rejected': item.appealStatus==0,
|
||||
'repairing': item.appealStatus==2,
|
||||
'completed': item.appealStatus==3
|
||||
}">
|
||||
{{ getStatusText(item.appealStatus) }}
|
||||
<view class="status-tag" :class="{ ignored: item.appealStatus==='0', pending: item.appealStatus==='1', completed: item.appealStatus==='3' }">
|
||||
{{ getFaultStatusLabel(item.appealStatus) }}
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
@ -48,18 +42,11 @@
|
|||
</view>
|
||||
</view>
|
||||
|
||||
<view class="card-footer" v-if="item.appealStatus==1 || item.appealStatus==2">
|
||||
<view class="card-footer" v-if="showAuditBtns(item.appealStatus)">
|
||||
<view class="divider" style="margin-bottom: 24rpx;"></view>
|
||||
<view class="action-btns">
|
||||
<view class="btn secondary" v-if="item.appealStatus==1" @click="unpass(item,0)">
|
||||
忽略
|
||||
</view>
|
||||
<view class="btn primary" v-if="item.appealStatus==1" @click="unpass(item,1)">
|
||||
处理
|
||||
</view>
|
||||
<view class="btn success" v-if="item.appealStatus==2" @click="btnwc(item)">
|
||||
维修完成
|
||||
</view>
|
||||
<view class="btn secondary" @click="handleAudit(item, false)">忽略</view>
|
||||
<view class="btn primary" @click="handleAudit(item, true)">已完成</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -73,6 +60,8 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getFaultStatusLabel, canAuditFault } from '@/common/enums/fault.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -80,94 +69,47 @@
|
|||
backgroundColor: '#F7F7F7'
|
||||
},
|
||||
sn: '',
|
||||
pageNum: 1, // 当前页码
|
||||
pageSize: 20, // 每页显示条数
|
||||
list: [] ,// 数据列表
|
||||
total:0,
|
||||
areaId:''
|
||||
};
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
list: [],
|
||||
total: 0,
|
||||
areaId: ''
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
this.areaId = option.areaId
|
||||
},
|
||||
onShow() {
|
||||
this.pageNum = 1
|
||||
this.getlist();
|
||||
this.getlist()
|
||||
},
|
||||
methods: {
|
||||
getStatusText(status) {
|
||||
const map = {
|
||||
0: '已驳回',
|
||||
1: '待处理',
|
||||
2: '维修中',
|
||||
3: '已完成'
|
||||
}
|
||||
return map[status] || '未知'
|
||||
getFaultStatusLabel,
|
||||
showAuditBtns(appealStatus) {
|
||||
return canAuditFault(appealStatus)
|
||||
},
|
||||
handleScrollToLower() {
|
||||
console.log(this.total,this.list.length);
|
||||
if(this.total > this.list.length){
|
||||
this.getlist()
|
||||
}
|
||||
if (this.total > this.list.length) {
|
||||
this.getlist()
|
||||
}
|
||||
},
|
||||
// 点击完成
|
||||
btnwc(item){
|
||||
let data = {
|
||||
id:item.id,
|
||||
pass:true
|
||||
}
|
||||
this.$u.put('/bst/fault/complete', data).then((res) => {
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '操作成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
this.pageNum = 1;
|
||||
this.list = []; // 清空当前列表
|
||||
this.getlist();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
})
|
||||
},
|
||||
// 点击处理和忽略
|
||||
unpass(item,num){
|
||||
let passflag = ''
|
||||
if(num == 0){
|
||||
passflag = false
|
||||
}else if(num == 1){
|
||||
passflag = true
|
||||
}
|
||||
uni.showLoading({
|
||||
title:'加载中...'
|
||||
})
|
||||
let data = {
|
||||
id:item.id,
|
||||
pass:passflag
|
||||
}
|
||||
this.$u.put('/bst/fault/handle', data).then((res) => {
|
||||
handleAudit(item, pass) {
|
||||
uni.showLoading({ title: '加载中...' })
|
||||
this.$u.put('/bst/fault/handle', {
|
||||
id: item.id,
|
||||
pass: pass
|
||||
}).then((res) => {
|
||||
uni.hideLoading()
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: '操作成功',
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
this.pageNum = 1;
|
||||
this.list = []; // 清空当前列表
|
||||
this.getlist();
|
||||
uni.showToast({ title: '操作成功', icon: 'success', duration: 2000 })
|
||||
this.pageNum = 1
|
||||
this.list = []
|
||||
this.getlist()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
uni.showToast({ title: res.msg || '操作失败', icon: 'none', duration: 2000 })
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.hideLoading()
|
||||
})
|
||||
},
|
||||
parsePictures(pictureString) {
|
||||
|
|
@ -262,16 +204,17 @@
|
|||
color: #FF4D4F;
|
||||
}
|
||||
|
||||
&.ignored,
|
||||
&.rejected {
|
||||
background: #F5F5F5;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
|
||||
&.repairing {
|
||||
background: #EBF4FF;
|
||||
color: #4C97E7;
|
||||
}
|
||||
|
||||
|
||||
&.completed {
|
||||
background: #F0F9EB;
|
||||
color: #67C23A;
|
||||
|
|
|
|||
|
|
@ -3,66 +3,55 @@
|
|||
<u-navbar title="故障上报记录" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
|
||||
title-size='36' height='36' id="navbar">
|
||||
</u-navbar>
|
||||
<scroll-view class="list" @scrolltolower="handleScrollToLower" scroll-y>
|
||||
<view class="list_item" v-for="(item,index) in list" :key="index">
|
||||
<view class="top">
|
||||
<view class="name">
|
||||
车牌号:{{item.vehicleNum == null ? '--' : item.vehicleNum}}
|
||||
</view>
|
||||
<view class="zt" v-if="item.appealStatus == 0">
|
||||
已驳回 <!-- <u-icon name="arrow-right" color="#808080" size="28"></u-icon> -->
|
||||
<scroll-view class="list" @scrolltolower="handleScrollToLower" scroll-y>
|
||||
<view class="list_item" v-for="(item,index) in list" :key="index">
|
||||
<view class="top">
|
||||
<view class="name">
|
||||
车牌号:{{item.vehicleNum == null ? '--' : item.vehicleNum}}
|
||||
</view>
|
||||
<view class="zt" v-if="item.appealStatus == 1">
|
||||
待处理 <!-- <u-icon name="arrow-right" color="#808080" size="28"></u-icon> -->
|
||||
</view>
|
||||
<view class="zt" v-if="item.appealStatus == 2">
|
||||
维修中 <!-- <u-icon name="arrow-right" color="#808080" size="28"></u-icon> -->
|
||||
</view>
|
||||
<view class="zt" v-if="item.appealStatus == 3">
|
||||
已完成 <!-- <u-icon name="arrow-right" color="#808080" size="28"></u-icon> -->
|
||||
</view>
|
||||
</view>
|
||||
<view class="zt">{{ getFaultStatusLabel(item.appealStatus) }}</view>
|
||||
</view>
|
||||
<view class="wz">
|
||||
车辆编号:{{item.vehicleCode == null ? '--' : item.vehicleCode}}
|
||||
</view>
|
||||
<view class="wz">
|
||||
故障原因:{{item.faultDetail == null ? '--' : item.faultDetail}}
|
||||
故障详情:{{item.faultDetail == null ? '--' : item.faultDetail}}
|
||||
</view>
|
||||
<view class="wz">
|
||||
反馈时间:{{item.createTime == null ? '--' : item.createTime}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="dibutishi">
|
||||
仅支持查看最近一年的记录
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
<view class="dibutishi">
|
||||
仅支持查看最近一年的记录
|
||||
</view>
|
||||
</scroll-view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getFaultStatusLabel } from '@/common/enums/fault.js'
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
bgc: {
|
||||
backgroundColor: "#fff",
|
||||
},
|
||||
bgc: {
|
||||
backgroundColor: "#fff",
|
||||
},
|
||||
list:[],
|
||||
pageNum:1,
|
||||
total:'',
|
||||
userid:''
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
onLoad() {},
|
||||
onShow() {
|
||||
this.pageNum = 1
|
||||
this.list = []
|
||||
this.getuser()
|
||||
},
|
||||
methods: {
|
||||
getFaultStatusLabel,
|
||||
getuser(){
|
||||
this.$u.get("/getInfo").then((res) => {
|
||||
if (res.code == 200) {
|
||||
|
|
|
|||
|
|
@ -16,9 +16,8 @@
|
|||
</view>
|
||||
<view class="cardbox">
|
||||
<view class="tip">
|
||||
<view class="ipnt">*</view>请输入车辆故障部位
|
||||
<view class="ipnt">*</view>故障详情
|
||||
</view>
|
||||
|
||||
<view class="input-container">
|
||||
<view class="placeholder" v-if="!textValue">请输入故障问题</view>
|
||||
<textarea class="custom-textarea" v-model="textValue" @focus="hidePlaceholder" style="border: none;"
|
||||
|
|
@ -28,7 +27,7 @@
|
|||
</view>
|
||||
<view class="cardbox">
|
||||
<view class="tip">
|
||||
请对故障部位拍照
|
||||
故障图片
|
||||
</view>
|
||||
<view class="icon">
|
||||
|
||||
|
|
@ -117,7 +116,6 @@
|
|||
let data = {
|
||||
faultDetail: this.textValue,
|
||||
vehicleCode: this.sn,
|
||||
faultSite: '',
|
||||
picture: this.imglist.join(',')
|
||||
}
|
||||
console.log(data, 'dadadad');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import Vue from "vue"
|
||||
import Vuex from "vuex"
|
||||
import Vue from "vue";
|
||||
import Vuex from "vuex";
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
|
|
@ -30,12 +30,12 @@ const store = new Vuex.Store({
|
|||
// 将你的 jiance 函数移动到这里
|
||||
jiance(context) { // context 对象包含了 commit, dispatch 等方法
|
||||
const updateManager = uni.getUpdateManager();
|
||||
|
||||
|
||||
updateManager.onCheckForUpdate(function(res) {
|
||||
// 请求完新版本信息的回调
|
||||
console.log('是否有新版本:', res.hasUpdate);
|
||||
});
|
||||
|
||||
|
||||
updateManager.onUpdateReady(function() {
|
||||
uni.showModal({
|
||||
title: '更新提示',
|
||||
|
|
@ -49,7 +49,7 @@ const store = new Vuex.Store({
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
updateManager.onUpdateFailed(function() {
|
||||
// 新的版本下载失败
|
||||
console.log('download error');
|
||||
|
|
@ -89,16 +89,16 @@ const store = new Vuex.Store({
|
|||
console.log("退出登录成功,清除缓存...")
|
||||
state.isLogin = false;
|
||||
state.userInfo = {};
|
||||
uni.removeStorage({
|
||||
uni.removeStorage({
|
||||
key: "userInfo"
|
||||
})
|
||||
uni.removeStorage({
|
||||
key: "token"
|
||||
})
|
||||
})
|
||||
uni.redirectTo({
|
||||
url:"../login/login",
|
||||
success: (res) => {
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -106,4 +106,4 @@ const store = new Vuex.Store({
|
|||
|
||||
})
|
||||
|
||||
export default store
|
||||
export default store
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user