开始施工

This commit is contained in:
Vinjor 2024-10-18 21:44:30 +08:00
parent 7de45ffa35
commit f1b078a262
4 changed files with 139 additions and 23 deletions

View File

@ -162,25 +162,7 @@ export default {
* 开始施工
*/
doOrder(id){
request({
url: '/admin-api/repair/tickets/take',
method: 'get',
params:{id:id}
}).then((res) => {
console.log(res)
if (res.code == 200) {
uni.showToast({
icon: 'none',
title: '接单成功,请尽快处理!'
})
this.$emit('childEvent');
}else{
uni.showToast({
icon: 'none',
title: res.message
})
}
})
this.$emit('startWork',id);
},
gotoDetail() {
uni.navigateTo({

View File

@ -34,7 +34,7 @@
<view class="todoList">
<scroll-view scroll-y="true" class="itemContent" bindscrolltolower="onReachBottom"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh"></order-card>
<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh" @startWork="startWork"></order-card>
<view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
@ -52,7 +52,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import OrderCard from "@/components/orderCard.vue";
import config from '@/config'
import request from '@/utils/request';
import {formatTimestamp,getOrderStatusText,builderOrder} from "@/utils/utils";
import {formatTimestamp,getOrderStatusText,builderOrder,saveTicketsRecords} from "@/utils/utils";
import {
getToken,
getUserInfo,
@ -148,6 +148,52 @@ export default {
this.orderList = []
this.getOrderList()
},
/**
* 开始施工
*/
startWork(id){
let paramsObj = {ticketId:id}
//
request({
url: '/admin-api/repair/titem/listProject',
method: 'get',
params:paramsObj
}).then((res) => {
console.log(res)
if (res.code == 200 && res.data.length>0) {
if(res.data.length==1){
//1
this.startWorkRequest(id,"02",res.data[0].id,"02","kssg","开始施工")
}else{
uni.showActionSheet({
itemList: res.data.map(m => m.itemName),
success: ({
tapIndex
}) => {
this.startWorkRequest(id,"02",res.data[tapIndex].id,"02","kssg","开始施工")
}
})
}
}else{
uni.showToast({
title: '操作失败,请联系管理员',
icon: 'none'
})
}
})
},
/**
* 开始施工请求后台
*/
async startWorkRequest(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark){
try {
const result = await saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark,null);
console.error("result",result);
this.onRefresherrefresh()
} catch (error) {
console.error(error);
}
},
/**
* 查本人待处理工单
*/

View File

@ -18,7 +18,7 @@
<view class="orderList">
<scroll-view scroll-y="true" style="height: 100%" class="itemContent" bindscrolltolower="onReachBottom"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered">
<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh"></order-card>
<order-card v-for="(item, index) in orderList" :key="index" :order="item" @childEvent="onRefresherrefresh" @startWork="startWork"></order-card>
<view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
@ -34,7 +34,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import tabBarVue from '@/components/tabBar/tabBar.vue'
import OrderCard from "@/components/orderCard.vue";
import request from '@/utils/request';
import {formatTimestamp,getOrderStatusText,builderOrder} from "@/utils/utils";
import {formatTimestamp,getOrderStatusText,builderOrder,saveTicketsRecords} from "@/utils/utils";
import {
getToken,
getUserInfo,
@ -116,6 +116,52 @@ export default {
this.searchText = ""
this.onRefresherrefresh()
},
/**
* 开始施工
*/
startWork(id){
let paramsObj = {ticketId:id}
//
request({
url: '/admin-api/repair/titem/listProject',
method: 'get',
params:paramsObj
}).then((res) => {
console.log(res)
if (res.code == 200 && res.data.length>0) {
if(res.data.length==1){
//1
this.startWorkRequest(id,"02",res.data[0].id,"02","kssg","开始施工")
}else{
uni.showActionSheet({
itemList: res.data.map(m => m.itemName),
success: ({
tapIndex
}) => {
this.startWorkRequest(id,"02",res.data[tapIndex].id,"02","kssg","开始施工")
}
})
}
}else{
uni.showToast({
title: '操作失败,请联系管理员',
icon: 'none'
})
}
})
},
/**
* 开始施工请求后台
*/
async startWorkRequest(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark){
try {
const result = await saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark,null);
console.error("result",result);
this.onRefresherrefresh()
} catch (error) {
console.error(error);
}
},
getOrderList(){
let paramsObj = {pageNo: this.pageNo, pageSize: this.pageSize, isFinish: "0"}
console.log("this.searchText",this.searchText)

View File

@ -79,6 +79,48 @@ export function getDictByCode(dictCode){
return dictArray
}
}
/**
* 工单记录操作日志
* @param id 工单主表id
* @param ticketsWorkStatus 工单主表状态
* @param itemId 工单子表id
* @param itemStatus 工单子表状态
* @param recordType 操作类型 对应后端枚举RecordTypeEnum
* @param remark 备注
* @param image 图片相对路径多个英文逗号隔开
*/
export function saveTicketsRecords(id,ticketsWorkStatus,itemId,itemStatus,recordType,remark,image){
return new Promise((resolve, reject) => {
let dataObj = {
id: id,
ticketsWorkStatus:ticketsWorkStatus,
item: {id: itemId, itemStatus: itemStatus},
recordType: recordType,
remark: remark,
image: image
}
request({
url: '/admin-api/repair/tickets/updateStatus',
method: 'POST',
data:dataObj
}).then((res) => {
console.log(res)
if (res.code == 200) {
uni.showToast({
title: '操作成功',
icon: 'none'
})
resolve(1);
}else{
uni.showToast({
title: '操作失败,请联系管理员',
icon: 'none'
})
reject(0);
}
})
});
}
/**
* 翻译字典