This commit is contained in:
xuyuncong 2025-11-14 17:58:40 +08:00
parent e590e6cc7f
commit bca86a4119
3 changed files with 483 additions and 457 deletions

View File

@ -92,6 +92,7 @@
<!--内返派工--> <!--内返派工-->
内返派工 内返派工
</view> </view>
<!-- v-if="order.ticketsStatus == '05' && order.ticketsWorkStatus=='01' && roleCanJd" class="btn qc"> -->
<view @click="openFile(order.id)" <view @click="openFile(order.id)"
v-if="order.ticketsStatus == '05' && order.ticketsWorkStatus=='01' && roleCanJd" class="btn qc"> v-if="order.ticketsStatus == '05' && order.ticketsWorkStatus=='01' && roleCanJd" class="btn qc">
接单 接单
@ -186,7 +187,8 @@
// //
this.roleCanQc = true this.roleCanQc = true
} }
if (this.userInfo.roleCodes.includes("repair_staff") && this.order.nowRepairId == this.userInfo.id) { if (this.userInfo.roleCodes.includes("repair_staff") && this.order.nowRepairId && this.order.nowRepairId
.split(',').includes(this.userInfo.id.toString())) {
//, //,
this.roleCanJd = true this.roleCanJd = true
} }

View File

@ -1,488 +1,510 @@
<template> <template>
<view class="container"> <view class="container">
<VNavigationBar background-color="#fff" title="选择人员" title-color="#333"></VNavigationBar> <VNavigationBar background-color="#fff" title="选择人员" title-color="#333"></VNavigationBar>
<view class="body"> <view class="body">
<!-- <div class="searchBox">--> <!-- <div class="searchBox">-->
<!-- <div class="inputBox">--> <!-- <div class="inputBox">-->
<!-- <input placeholder="请输入人员姓名" type="text">--> <!-- <input placeholder="请输入人员姓名" type="text">-->
<!-- </div>--> <!-- </div>-->
<!-- <text>搜索</text>--> <!-- <text>搜索</text>-->
<!-- </div>--> <!-- </div>-->
<div class="userList"> <div class="userList">
<!-- <u-checkbox-group--> <!-- <u-checkbox-group-->
<!-- placement="column"--> <!-- placement="column"-->
<!-- v-model="checked">--> <!-- v-model="checked">-->
<radio-group @change="radioChange" v-if="type == 'xs' || !type"> <!-- <checkbox-group @change="checkboxChange" v-if="type == 'xs' || !type">
<label v-for="(item, index) in list" :key="item.userId" class="userItem"> <label v-for="(item, index) in list" :key="item.userId" class="userItem">
<view class="info"> <view class="info">
<text class="name">{{ item.userName }}</text> <text class="name">{{ item.userName }}</text>
<text class="trade">{{ item.workTypeText }}</text> <text class="trade">{{ item.workTypeText }}</text>
</view> </view>
<radio :value="item.userId+''" :checked="index === current"/> <checkbox :value="item.userId + ''" />
<!-- <u-checkbox v-model="item.checked" :name="item.userId" iconSize="24" shape="circle" activeColor="#1890ff"></u-checkbox>--> </label>
</label> </checkbox-group> -->
</radio-group> <radio-group @change="radioChange" v-if="type == 'xs' || !type">
<label v-for="(item, index) in list" :key="item.userId" class="userItem">
<view class="info">
<text class="name">{{ item.userName }}</text>
<text class="trade">{{ item.workTypeText }}</text>
</view>
<radio :value="item.userId+''" :checked="index === current" />
</label>
</radio-group>
<view v-else> <view v-else>
<!-- <label v-for="(item, index) in list" :key="item.id" class="userItem">--> <!-- <label v-for="(item, index) in list" :key="item.id" class="userItem">-->
<!-- <view class="info">--> <!-- <view class="info">-->
<!-- <text class="name">{{ item.userName }}</text>--> <!-- <text class="name">{{ item.userName }}</text>-->
<!-- <text class="trade">{{ item.workTypeText }}</text>--> <!-- <text class="trade">{{ item.workTypeText }}</text>-->
<!-- </view>--> <!-- </view>-->
<!-- <checkbox :value="item.id+''" v-model="selectedUsers" @change="cs" />--> <!-- <checkbox :value="item.id+''" v-model="selectedUsers" @change="cs" />-->
<!-- </label>--> <!-- </label>-->
<checkbox-group @change="cs"> <checkbox-group @change="cs">
<label v-for="(item, index) in list" :key="item.userId" class="userItem"> <label v-for="(item, index) in list" :key="item.userId" class="userItem">
<view class="info"> <view class="info">
<text class="name">{{ item.userName }}</text> <text class="name">{{ item.userName }}</text>
<text class="trade">{{ item.workTypeText }}</text> <text class="trade">{{ item.workTypeText }}</text>
</view> </view>
<checkbox :value="item.userId + ''" /> <checkbox :value="item.userId + ''" />
</label> </label>
</checkbox-group> </checkbox-group>
</view> </view>
<!-- </u-checkbox-group>--> <!-- </u-checkbox-group>-->
</div> </div>
</view> </view>
<!-- 普通弹窗---拍照上传 --> <!-- 普通弹窗---拍照上传 -->
<uni-popup ref="popup" background-color="#fff"> <uni-popup ref="popup" background-color="#fff">
<view class="popup-content"> <view class="popup-content">
<view class="dl-avatar-box"> <view class="dl-avatar-box">
<input type="text" placeholder="请输入内返派工原因" v-model="remark" /> <input type="text" placeholder="请输入内返派工原因" v-model="remark" />
<uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile" limit="9" title="请上传图片最多上传9张"></uni-file-picker> <uni-file-picker :value="fileList" :sizeType="sizeType" @select="afterRead" @delete="deleteFile"
</view> limit="9" title="请上传图片最多上传9张"></uni-file-picker>
<button type="primary" @click="submit('1')">保存</button> </view>
</view> <button type="primary" @click="submit('1')">保存</button>
</uni-popup> </view>
<view class="foot"> </uni-popup>
<view v-if="isNei" class="submit" @click="openFile">确定选择</view> <view class="foot">
<view v-else class="submit" @click="submit('0')">确定选择</view> <view v-if="isNei" class="submit" @click="openFile">确定选择</view>
</view> <view v-else class="submit" @click="submit('0')">确定选择</view>
</view>
</view> </view>
</template> </template>
<script> <script>
import VNavigationBar from '@/components/VNavigationBar.vue' import VNavigationBar from '@/components/VNavigationBar.vue'
import {bus} from "@/utils/eventBus"; import {
import request from '@/utils/request'; bus
import {getDictTextByCodeAndValue,saveTicketsRecords} from "@/utils/utils"; } from "@/utils/eventBus";
import config from "@/config"; import request from '@/utils/request';
import upload from "@/utils/upload"; import {
getDictTextByCodeAndValue,
saveTicketsRecords
} from "@/utils/utils";
import config from "@/config";
import upload from "@/utils/upload";
export default { export default {
components: { components: {
VNavigationBar, VNavigationBar,
}, },
data() { data() {
return { return {
// //
fileList: [], fileList: [],
sizeType:['compressed'], sizeType: ['compressed'],
remark:'', remark: '',
isNei:false, isNei: false,
current: 0, current: 0,
ticketId: '', ticketId: '',
list: [], list: [],
checkedUserId: "", checkedUserId: "",
checkedUserName: "", checkedUserName: "",
ifDetail: false, ifDetail: false,
type: "", type: "",
sgIds: [], // sgIds: [], //
sgNames : [], sgNames: [],
projectId: '', projectId: '',
itemId:"", itemId: "",
} checkedUserIds: [],
}, checkedUserNames: [],
onLoad(data) { }
console.log("data", data) },
if (data.id) { onLoad(data) {
console.log('执行了派单') console.log("data", data)
this.ticketId = data.id if (data.id) {
console.log(data.canOperate,103) console.log('执行了派单')
console.log(data.canOperate === '1',104) this.ticketId = data.id
if (data.canOperate === '1'){ console.log(data.canOperate, 103)
this.listLeadsAll() console.log(data.canOperate === '1', 104)
} else { if (data.canOperate === '1') {
this.workByTicketId() this.listLeadsAll()
} } else {
} this.workByTicketId()
if (data.isNei) { }
// }
this.isNei = true if (data.isNei) {
} //
if (data.ifDetail) { this.isNei = true
//2 }
this.ifDetail = true if (data.ifDetail) {
} //2
if (data.itemId) { this.ifDetail = true
//2 }
this.itemId = data.itemId if (data.itemId) {
} //2
if (data.type) { this.itemId = data.itemId
this.type = data.type }
if (data.type == 'xs') { if (data.type) {
this.getStaffList() this.type = data.type
} else { if (data.type == 'xs') {
this.getRepairWorder() this.getStaffList()
} } else {
} this.getRepairWorder()
// }
if (data.ticketId) { }
this.ticketId = data.ticketId //
} if (data.ticketId) {
if (data.projectId) { this.ticketId = data.ticketId
this.projectId = data.projectId }
} if (data.projectId) {
}, this.projectId = data.projectId
methods: { }
},
methods: {
/** /**
* 维修班组长修改派工 * 维修班组长修改派工
*/ */
listLeadsAll(){ listLeadsAll() {
request({ request({
url: '/admin-api/repair/worker/listLeadsAll', url: '/admin-api/repair/worker/listLeadsAll',
method: 'get', method: 'get',
}).then((res) => { }).then((res) => {
this.list = res.data this.list = res.data
if (this.list.length > 0) { if (this.list.length > 0) {
console.log(this.list[0].userId) console.log(this.list[0].userId)
this.checkedUserId = this.list[0].userId this.checkedUserId = this.list[0].userId
this.checkedUserName = this.list[0].userName this.checkedUserName = this.list[0].userName
} }
}) })
}, },
/** /**
* 内返派工打开上传附件弹窗 * 内返派工打开上传附件弹窗
*/ */
openFile(){ openFile() {
this.$refs.popup.open("bottom") this.$refs.popup.open("bottom")
}, },
afterRead(file) { afterRead(file) {
uni.showLoading({ uni.showLoading({
title: '正在上传中...', title: '正在上传中...',
mask:true mask: true
}); });
for (let i = 0; i < file.tempFilePaths.length; i++) { for (let i = 0; i < file.tempFilePaths.length; i++) {
upload({ upload({
url:'/admin-api/infra/file/upload', url: '/admin-api/infra/file/upload',
filePath: file.tempFilePaths[i] filePath: file.tempFilePaths[i]
}).then((res)=>{ }).then((res) => {
this.fileList.push({ this.fileList.push({
url: config.baseImageUrl+res.data url: config.baseImageUrl + res.data
}) })
if(i==file.tempFilePaths.length-1){ if (i == file.tempFilePaths.length - 1) {
uni.hideLoading() uni.hideLoading()
} }
console.log(this.fileList) console.log(this.fileList)
}) })
} }
}, },
deleteFile(file, index) { deleteFile(file, index) {
this.fileList.splice(index, 1); this.fileList.splice(index, 1);
}, },
radioChange: function (evt) { checkboxChange: function(evt) {
for (let i = 0; i < this.list.length; i++) { this.checkedUserIds = evt.detail.value; //
if (this.list[i].userId == evt.detail.value) { this.checkedUserNames = [];
this.current = i;
this.checkedUserId = this.list[i].userId
this.checkedUserName = this.list[i].userName
break;
}
}
console.log(this.checkedUserName)
},
/**
* 获取销售列表
*/
getStaffList() {
request({
url: '/admin-api/company/staff/list',
method: 'get'
}).then(res => {
this.list = res.data
this.list.map((item) => {
item.userName = item.name
})
if (this.list.length > 0) {
console.log(this.list[0].userId)
this.checkedUserId = this.list[0].userId
this.checkedUserName = this.list[0].userName
}
})
},
/**
* 获取维修工人
*/
getRepairWorder(){
request({
url: '/admin-api/repair/worker/page',
method: 'get',
params:{
pageNo: 1,
pageSize: 9999
}
}).then(res => {
if (res.code == 200) {
let thisList = res.data.records
thisList.map((item) => {
getDictTextByCodeAndValue("repair_work_type", item.workType).then(value => {
item.workTypeText = value
}).catch(error => {
item.workTypeText = "未知"
console.error(error);
});
})
this.list = thisList
} else {
this.list = []
}
})
},
/**
* 通过工单id查询维修工人
*/
workByTicketId() {
request({
url: '/admin-api/repair/worker/listByTicketId',
method: 'get',
params: {ticketId: this.ticketId}
}).then((res) => {
this.list = res.data
if (this.list.length > 0) {
console.log(this.list[0].userId)
this.checkedUserId = this.list[0].userId
this.checkedUserName = this.list[0].userName
}
})
},
cs(e){
let arr = []
let nameArr = []
for (let i = 0; i < this.list.length; i++) {
for (let j = 0; j < e.detail.value.length; j++) {
if (this.list[i].userId == e.detail.value[j]) {
this.current = i;
let checkedUserId = this.list[i].userId
let checkedUserName = this.list[i].userName
arr.push(checkedUserId)
nameArr.push(checkedUserName)
}
}
}
console.log(this.checkedUserName)
this.sgIds = arr
this.sgNames = nameArr
},
async submit(type) {
if (this.type == 'sg') {
if (this.sgIds.length == 0) {
uni.showToast({
title: '请选择维修人员!',
icon: 'none'
})
} else {
//
const sgIds = this.sgIds.join(',')
const sgNames = this.sgNames.join(',')
console.log('this.projectId',this.projectId)
const param = {
ticketId: this.ticketId,
projectId: this.projectId,
repairIds: sgIds,
repairNames: sgNames,
}
request({
url: '/admin-api/repair/titem/updateRepairAndSale',
method: 'put',
data: param
}).then((res) => {
uni.showToast({
title: '选择维修人员成功!',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
bus.$emit('choosePeople')
}, 700)
})
}
}else if (this.type == 'xs') { // userId userName
if (this.checkedUserId == '' && this.checkedUserName == '') { for (let i = 0; i < this.list.length; i++) {
uni.showToast({ if (this.checkedUserIds.includes(this.list[i].userId + '')) {
title: '请选择服务顾问!', this.checkedUserNames.push(this.list[i].userName);
icon: 'none' }
}) }
} else {
// console.log(this.checkedUserNames); //
const param = { },
ticketId: this.ticketId,
projectId: this.projectId, /**
saleId: this.checkedUserId, * 获取销售列表
saleName: this.checkedUserName, */
} getStaffList() {
request({ request({
url: '/admin-api/repair/titem/updateRepairAndSale', url: '/admin-api/company/staff/list',
method: 'put', method: 'get'
data: param }).then(res => {
}).then((res) => { this.list = res.data
uni.showToast({ this.list.map((item) => {
title: '选择服务顾问成功!', item.userName = item.name
icon: 'none' })
}) if (this.list.length > 0) {
setTimeout(() => { console.log(this.list[0].userId)
uni.navigateBack() this.checkedUserId = this.list[0].userId
bus.$emit('choosePeople') this.checkedUserName = this.list[0].userName
}, 700) }
}) })
} },
} else { /**
const param = { * 获取维修工人
id: this.ticketId, */
nowRepairId: this.checkedUserId, getRepairWorder() {
nowRepairName: this.checkedUserName request({
} url: '/admin-api/repair/worker/page',
if (type == '1'){ method: 'get',
param.remark = this.remark params: {
param.image = this.fileList.map(item=>item.url.replace(config.baseImageUrl,"")).join(",") pageNo: 1,
} pageSize: 9999
console.log(param) }
request({ }).then(res => {
url: '/admin-api/repair/tickets/notify', if (res.code == 200) {
method: 'post', let thisList = res.data.records
data: param thisList.map((item) => {
}).then((res) => { getDictTextByCodeAndValue("repair_work_type", item.workType).then(value => {
uni.showToast({ item.workTypeText = value
title: '指派成功!', }).catch(error => {
icon: 'none' item.workTypeText = "未知"
}) console.error(error);
setTimeout(() => { });
if (this.ifDetail) { })
uni.navigateBack({ this.list = thisList
delta: 2 // 2 } else {
}) this.list = []
} else { }
uni.navigateBack() })
} },
}, 700) /**
}) * 通过工单id查询维修工人
// */
// console.log('this.checked', this.checked) workByTicketId() {
// const selected = this.list.filter(f => this.checked.includes(f.id)) request({
// bus.$emit('choosePeople', selected) url: '/admin-api/repair/worker/listByTicketId',
// uni.navigateBack() method: 'get',
} params: {
} ticketId: this.ticketId
} }
} }).then((res) => {
this.list = res.data
if (this.list.length > 0) {
console.log(this.list[0].userId)
this.checkedUserId = this.list[0].userId
this.checkedUserName = this.list[0].userName
}
})
},
cs(e) {
let arr = []
let nameArr = []
for (let i = 0; i < this.list.length; i++) {
for (let j = 0; j < e.detail.value.length; j++) {
if (this.list[i].userId == e.detail.value[j]) {
this.current = i;
let checkedUserId = this.list[i].userId
let checkedUserName = this.list[i].userName
arr.push(checkedUserId)
nameArr.push(checkedUserName)
}
}
}
console.log(this.checkedUserName)
this.sgIds = arr
this.sgNames = nameArr
},
async submit(type) {
if (this.type == 'sg') {
if (this.sgIds.length == 0) {
uni.showToast({
title: '请选择维修人员!',
icon: 'none'
})
} else {
//
const sgIds = this.sgIds.join(',')
const sgNames = this.sgNames.join(',')
console.log('this.projectId', this.projectId)
const param = {
ticketId: this.ticketId,
projectId: this.projectId,
repairIds: sgIds,
repairNames: sgNames,
}
request({
url: '/admin-api/repair/titem/updateRepairAndSale',
method: 'put',
data: param
}).then((res) => {
uni.showToast({
title: '选择维修人员成功!',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
bus.$emit('choosePeople')
}, 700)
})
}
} else if (this.type == 'xs') {
if (this.checkedUserId == '' && this.checkedUserName == '') {
uni.showToast({
title: '请选择服务顾问!',
icon: 'none'
})
} else {
//
const param = {
ticketId: this.ticketId,
projectId: this.projectId,
saleId: this.checkedUserId,
saleName: this.checkedUserName,
}
request({
url: '/admin-api/repair/titem/updateRepairAndSale',
method: 'put',
data: param
}).then((res) => {
uni.showToast({
title: '选择服务顾问成功!',
icon: 'none'
})
setTimeout(() => {
uni.navigateBack()
bus.$emit('choosePeople')
}, 700)
})
}
} else {
const param = {
id: this.ticketId,
nowRepairId: this.checkedUserIds.join(','),
nowRepairName: this.checkedUserNames.join(',')
}
if (type == '1') {
param.remark = this.remark
param.image = this.fileList.map(item => item.url.replace(config.baseImageUrl, "")).join(",")
}
console.log(param)
request({
url: '/admin-api/repair/tickets/notify',
method: 'post',
data: param
}).then((res) => {
uni.showToast({
title: '指派成功!',
icon: 'none'
})
setTimeout(() => {
if (this.ifDetail) {
uni.navigateBack({
delta: 2 // 2
})
} else {
uni.navigateBack()
}
}, 700)
})
//
// console.log('this.checked', this.checked)
// const selected = this.list.filter(f => this.checked.includes(f.id))
// bus.$emit('choosePeople', selected)
// uni.navigateBack()
}
}
}
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.popup-content { .popup-content {
@include flex; @include flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 30rpx 30rpx 120rpx 30rpx; padding: 30rpx 30rpx 120rpx 30rpx;
height: auto; height: auto;
background-color: #fff; background-color: #fff;
} }
.container {
height: 100%;
background-color: #F3F5F7;
display: flex;
flex-direction: column;
.body { .container {
flex: 1; height: 100%;
height: 0; background-color: #F3F5F7;
overflow: auto; display: flex;
padding: 20rpx 0; flex-direction: column;
.searchBox { .body {
margin: 0 32rpx; flex: 1;
background: #FFFFFF; height: 0;
border-radius: 8rpx 8rpx 8rpx 8rpx; overflow: auto;
padding: 30rpx; padding: 20rpx 0;
display: flex; .searchBox {
align-items: center; margin: 0 32rpx;
column-gap: 20rpx; background: #FFFFFF;
border-radius: 8rpx 8rpx 8rpx 8rpx;
padding: 30rpx;
font-weight: 500; display: flex;
font-size: 28rpx; align-items: center;
color: #0174F6; column-gap: 20rpx;
.inputBox { font-weight: 500;
flex: 1; font-size: 28rpx;
width: 0; color: #0174F6;
color: #000;
}
}
.userList { .inputBox {
margin: 20rpx 32rpx 0; flex: 1;
background-color: #fff; width: 0;
padding: 0 20rpx; color: #000;
}
}
.userItem { .userList {
padding: 30rpx 0; margin: 20rpx 32rpx 0;
border-bottom: 1rpx solid #DDDDDD; background-color: #fff;
padding: 0 20rpx;
display: flex; .userItem {
align-items: center; padding: 30rpx 0;
justify-content: space-between; border-bottom: 1rpx solid #DDDDDD;
.info { display: flex;
display: flex; align-items: center;
flex-direction: column; justify-content: space-between;
row-gap: 20rpx;
.name { .info {
font-weight: 500; display: flex;
font-size: 28rpx; flex-direction: column;
color: #333333; row-gap: 20rpx;
}
.trade { .name {
font-weight: 500; font-weight: 500;
font-size: 24rpx; font-size: 28rpx;
color: #999999; color: #333333;
} }
}
}
.userItem:last-child { .trade {
border-bottom: none; font-weight: 500;
} font-size: 24rpx;
} color: #999999;
} }
}
}
.foot { .userItem:last-child {
background-color: #fff; border-bottom: none;
padding: 30rpx; }
}
}
.submit { .foot {
margin: 0 auto; background-color: #fff;
width: 510rpx; padding: 30rpx;
height: 76rpx;
background: #0174F6;
border-radius: 38rpx 38rpx 38rpx 38rpx;
display: flex; .submit {
align-items: center; margin: 0 auto;
justify-content: center; width: 510rpx;
height: 76rpx;
background: #0174F6;
border-radius: 38rpx 38rpx 38rpx 38rpx;
font-size: 32rpx; display: flex;
color: #FFFFFF; align-items: center;
} justify-content: center;
}
} font-size: 32rpx;
</style> color: #FFFFFF;
}
}
}
</style>

View File

@ -1167,7 +1167,8 @@
code: "edit" code: "edit"
}) })
} }
if (this.ticketInfo.nowRepairId == this.loginUser.id && "05" == this.ticketInfo.ticketsStatus) { if (this.ticketInfo.nowRepairId.split(',').includes(this.loginUser.id.toString()) && "05" == this
.ticketInfo.ticketsStatus) {
// //
this.content.push({ this.content.push({
text: '总检拍照', text: '总检拍照',
@ -1187,7 +1188,8 @@
code: "apply" code: "apply"
}) })
console.log(this.ticketInfo, "this.ticketInfo") console.log(this.ticketInfo, "this.ticketInfo")
if ("05" == this.ticketInfo.ticketsStatus && this.ticketInfo.nowRepairId == this.loginUser.id) { if ("05" == this.ticketInfo.ticketsStatus && this.ticketInfo.nowRepairId.split(',').includes(this
.loginUser.id.toString())) {
// //
if ("02" == this.ticketInfo.ticketsWorkStatus) { if ("02" == this.ticketInfo.ticketsWorkStatus) {
// //