故障上报小重构
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,9 +1,9 @@
|
||||||
const install = (Vue, vm) => {
|
const install = (Vue, vm) => {
|
||||||
uni.setStorageSync('deptId', 100);
|
uni.setStorageSync('deptId', 100);
|
||||||
Vue.prototype.$u.http.setConfig({
|
Vue.prototype.$u.http.setConfig({
|
||||||
// baseUrl: 'http://192.168.1.8:4101', //键辉本地
|
baseUrl: 'http://192.168.1.3:4101', //键辉本地
|
||||||
// baseUrl: 'http://192.168.2.221: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://ele.ccttiot.com/prod-api', //线上 小鹿appid: wx8a05cf95418a6859 小兔骑骑appid:wx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe
|
||||||
// baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上
|
// baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上
|
||||||
// baseUrl:'https://ysd.chuantewulian.cn/prod-api', //嵛山岛线上api 嵛山岛appid:wx4d178f8c80348214
|
// baseUrl:'https://ysd.chuantewulian.cn/prod-api', //嵛山岛线上api 嵛山岛appid:wx4d178f8c80348214
|
||||||
loadingText: '努力加载中~',
|
loadingText: '努力加载中~',
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,8 @@
|
||||||
<text class="code">编号: {{item.vehicleCode}}</text>
|
<text class="code">编号: {{item.vehicleCode}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="status-tag"
|
<view class="status-tag" :class="{ ignored: item.appealStatus==='0', pending: item.appealStatus==='1', completed: item.appealStatus==='3' }">
|
||||||
:class="{
|
{{ getFaultStatusLabel(item.appealStatus) }}
|
||||||
'pending': item.appealStatus==1,
|
|
||||||
'rejected': item.appealStatus==0,
|
|
||||||
'repairing': item.appealStatus==2,
|
|
||||||
'completed': item.appealStatus==3
|
|
||||||
}">
|
|
||||||
{{ getStatusText(item.appealStatus) }}
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
|
@ -48,18 +42,11 @@
|
||||||
</view>
|
</view>
|
||||||
</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="divider" style="margin-bottom: 24rpx;"></view>
|
||||||
<view class="action-btns">
|
<view class="action-btns">
|
||||||
<view class="btn secondary" v-if="item.appealStatus==1" @click="unpass(item,0)">
|
<view class="btn secondary" @click="handleAudit(item, false)">忽略</view>
|
||||||
忽略
|
<view class="btn primary" @click="handleAudit(item, true)">已完成</view>
|
||||||
</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>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -73,6 +60,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getFaultStatusLabel, canAuditFault } from '@/common/enums/fault.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -80,94 +69,47 @@
|
||||||
backgroundColor: '#F7F7F7'
|
backgroundColor: '#F7F7F7'
|
||||||
},
|
},
|
||||||
sn: '',
|
sn: '',
|
||||||
pageNum: 1, // 当前页码
|
pageNum: 1,
|
||||||
pageSize: 20, // 每页显示条数
|
pageSize: 20,
|
||||||
list: [] ,// 数据列表
|
list: [],
|
||||||
total:0,
|
total: 0,
|
||||||
areaId:''
|
areaId: ''
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
this.areaId = option.areaId
|
this.areaId = option.areaId
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
this.pageNum = 1
|
this.pageNum = 1
|
||||||
this.getlist();
|
this.getlist()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getStatusText(status) {
|
getFaultStatusLabel,
|
||||||
const map = {
|
showAuditBtns(appealStatus) {
|
||||||
0: '已驳回',
|
return canAuditFault(appealStatus)
|
||||||
1: '待处理',
|
|
||||||
2: '维修中',
|
|
||||||
3: '已完成'
|
|
||||||
}
|
|
||||||
return map[status] || '未知'
|
|
||||||
},
|
},
|
||||||
handleScrollToLower() {
|
handleScrollToLower() {
|
||||||
console.log(this.total,this.list.length);
|
if (this.total > this.list.length) {
|
||||||
if(this.total > this.list.length){
|
this.getlist()
|
||||||
this.getlist()
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// 点击完成
|
handleAudit(item, pass) {
|
||||||
btnwc(item){
|
uni.showLoading({ title: '加载中...' })
|
||||||
let data = {
|
this.$u.put('/bst/fault/handle', {
|
||||||
id:item.id,
|
id: item.id,
|
||||||
pass:true
|
pass: pass
|
||||||
}
|
}).then((res) => {
|
||||||
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) => {
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
if (res.code === 200) {
|
if (res.code === 200) {
|
||||||
uni.showToast({
|
uni.showToast({ title: '操作成功', icon: 'success', duration: 2000 })
|
||||||
title: '操作成功',
|
this.pageNum = 1
|
||||||
icon: 'success',
|
this.list = []
|
||||||
duration: 2000
|
this.getlist()
|
||||||
});
|
|
||||||
this.pageNum = 1;
|
|
||||||
this.list = []; // 清空当前列表
|
|
||||||
this.getlist();
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
uni.showToast({ title: res.msg || '操作失败', icon: 'none', duration: 2000 })
|
||||||
title: res.msg,
|
|
||||||
icon: 'none',
|
|
||||||
duration: 2000
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
uni.hideLoading()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
parsePictures(pictureString) {
|
parsePictures(pictureString) {
|
||||||
|
|
@ -262,6 +204,7 @@
|
||||||
color: #FF4D4F;
|
color: #FF4D4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.ignored,
|
||||||
&.rejected {
|
&.rejected {
|
||||||
background: #F5F5F5;
|
background: #F5F5F5;
|
||||||
color: #999;
|
color: #999;
|
||||||
|
|
|
||||||
|
|
@ -3,66 +3,55 @@
|
||||||
<u-navbar title="故障上报记录" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
|
<u-navbar title="故障上报记录" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
|
||||||
title-size='36' height='36' id="navbar">
|
title-size='36' height='36' id="navbar">
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
<scroll-view class="list" @scrolltolower="handleScrollToLower" scroll-y>
|
<scroll-view class="list" @scrolltolower="handleScrollToLower" scroll-y>
|
||||||
<view class="list_item" v-for="(item,index) in list" :key="index">
|
<view class="list_item" v-for="(item,index) in list" :key="index">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<view class="name">
|
<view class="name">
|
||||||
车牌号:{{item.vehicleNum == null ? '--' : item.vehicleNum}}
|
车牌号:{{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> -->
|
|
||||||
</view>
|
</view>
|
||||||
<view class="zt" v-if="item.appealStatus == 1">
|
<view class="zt">{{ getFaultStatusLabel(item.appealStatus) }}</view>
|
||||||
待处理 <!-- <u-icon name="arrow-right" color="#808080" size="28"></u-icon> -->
|
</view>
|
||||||
</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="wz">
|
<view class="wz">
|
||||||
车辆编号:{{item.vehicleCode == null ? '--' : item.vehicleCode}}
|
车辆编号:{{item.vehicleCode == null ? '--' : item.vehicleCode}}
|
||||||
</view>
|
</view>
|
||||||
<view class="wz">
|
<view class="wz">
|
||||||
故障原因:{{item.faultDetail == null ? '--' : item.faultDetail}}
|
故障详情:{{item.faultDetail == null ? '--' : item.faultDetail}}
|
||||||
</view>
|
</view>
|
||||||
<view class="wz">
|
<view class="wz">
|
||||||
反馈时间:{{item.createTime == null ? '--' : item.createTime}}
|
反馈时间:{{item.createTime == null ? '--' : item.createTime}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="dibutishi">
|
<view class="dibutishi">
|
||||||
仅支持查看最近一年的记录
|
仅支持查看最近一年的记录
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { getFaultStatusLabel } from '@/common/enums/fault.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
bgc: {
|
bgc: {
|
||||||
backgroundColor: "#fff",
|
backgroundColor: "#fff",
|
||||||
},
|
},
|
||||||
list:[],
|
list:[],
|
||||||
pageNum:1,
|
pageNum:1,
|
||||||
total:'',
|
total:'',
|
||||||
userid:''
|
userid:''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {},
|
||||||
|
|
||||||
},
|
|
||||||
onShow() {
|
onShow() {
|
||||||
this.pageNum = 1
|
this.pageNum = 1
|
||||||
this.list = []
|
this.list = []
|
||||||
this.getuser()
|
this.getuser()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getFaultStatusLabel,
|
||||||
getuser(){
|
getuser(){
|
||||||
this.$u.get("/getInfo").then((res) => {
|
this.$u.get("/getInfo").then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,8 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="cardbox">
|
<view class="cardbox">
|
||||||
<view class="tip">
|
<view class="tip">
|
||||||
<view class="ipnt">*</view>请输入车辆故障部位
|
<view class="ipnt">*</view>故障详情
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="input-container">
|
<view class="input-container">
|
||||||
<view class="placeholder" v-if="!textValue">请输入故障问题</view>
|
<view class="placeholder" v-if="!textValue">请输入故障问题</view>
|
||||||
<textarea class="custom-textarea" v-model="textValue" @focus="hidePlaceholder" style="border: none;"
|
<textarea class="custom-textarea" v-model="textValue" @focus="hidePlaceholder" style="border: none;"
|
||||||
|
|
@ -28,7 +27,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="cardbox">
|
<view class="cardbox">
|
||||||
<view class="tip">
|
<view class="tip">
|
||||||
请对故障部位拍照
|
故障图片
|
||||||
</view>
|
</view>
|
||||||
<view class="icon">
|
<view class="icon">
|
||||||
|
|
||||||
|
|
@ -117,7 +116,6 @@
|
||||||
let data = {
|
let data = {
|
||||||
faultDetail: this.textValue,
|
faultDetail: this.textValue,
|
||||||
vehicleCode: this.sn,
|
vehicleCode: this.sn,
|
||||||
faultSite: '',
|
|
||||||
picture: this.imglist.join(',')
|
picture: this.imglist.join(',')
|
||||||
}
|
}
|
||||||
console.log(data, 'dadadad');
|
console.log(data, 'dadadad');
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import Vue from "vue"
|
import Vue from "vue";
|
||||||
import Vuex from "vuex"
|
import Vuex from "vuex";
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user