开始施工

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){ doOrder(id){
request({ this.$emit('startWork',id);
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
})
}
})
}, },
gotoDetail() { gotoDetail() {
uni.navigateTo({ uni.navigateTo({

View File

@ -34,7 +34,7 @@
<view class="todoList"> <view class="todoList">
<scroll-view scroll-y="true" class="itemContent" bindscrolltolower="onReachBottom" <scroll-view scroll-y="true" class="itemContent" bindscrolltolower="onReachBottom"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered"> 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"> <view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image> <image class="" src="@/static/images/nothing.png" ></image>
</view> </view>
@ -52,7 +52,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import OrderCard from "@/components/orderCard.vue"; import OrderCard from "@/components/orderCard.vue";
import config from '@/config' import config from '@/config'
import request from '@/utils/request'; import request from '@/utils/request';
import {formatTimestamp,getOrderStatusText,builderOrder} from "@/utils/utils"; import {formatTimestamp,getOrderStatusText,builderOrder,saveTicketsRecords} from "@/utils/utils";
import { import {
getToken, getToken,
getUserInfo, getUserInfo,
@ -148,6 +148,52 @@ export default {
this.orderList = [] this.orderList = []
this.getOrderList() 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"> <view class="orderList">
<scroll-view scroll-y="true" style="height: 100%" class="itemContent" bindscrolltolower="onReachBottom" <scroll-view scroll-y="true" style="height: 100%" class="itemContent" bindscrolltolower="onReachBottom"
refresher-enabled @refresherrefresh="onRefresherrefresh" :refresher-triggered="isTriggered"> 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"> <view style="text-align: center" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image> <image class="" src="@/static/images/nothing.png" ></image>
</view> </view>
@ -34,7 +34,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import tabBarVue from '@/components/tabBar/tabBar.vue' import tabBarVue from '@/components/tabBar/tabBar.vue'
import OrderCard from "@/components/orderCard.vue"; import OrderCard from "@/components/orderCard.vue";
import request from '@/utils/request'; import request from '@/utils/request';
import {formatTimestamp,getOrderStatusText,builderOrder} from "@/utils/utils"; import {formatTimestamp,getOrderStatusText,builderOrder,saveTicketsRecords} from "@/utils/utils";
import { import {
getToken, getToken,
getUserInfo, getUserInfo,
@ -116,6 +116,52 @@ export default {
this.searchText = "" this.searchText = ""
this.onRefresherrefresh() 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(){ getOrderList(){
let paramsObj = {pageNo: this.pageNo, pageSize: this.pageSize, isFinish: "0"} let paramsObj = {pageNo: this.pageNo, pageSize: this.pageSize, isFinish: "0"}
console.log("this.searchText",this.searchText) console.log("this.searchText",this.searchText)

View File

@ -79,6 +79,48 @@ export function getDictByCode(dictCode){
return dictArray 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);
}
})
});
}
/** /**
* 翻译字典 * 翻译字典