2024-10-15 23:40:11 +08:00
|
|
|
|
<template>
|
|
|
|
|
<view class="container">
|
|
|
|
|
<VNavigationBar background-color="#fff" title="选择人员" title-color="#333"></VNavigationBar>
|
|
|
|
|
<view class="body">
|
2024-10-21 13:11:14 +08:00
|
|
|
|
<!-- <div class="searchBox">-->
|
|
|
|
|
<!-- <div class="inputBox">-->
|
|
|
|
|
<!-- <input placeholder="请输入人员姓名" type="text">-->
|
|
|
|
|
<!-- </div>-->
|
|
|
|
|
<!-- <text>搜索</text>-->
|
|
|
|
|
<!-- </div>-->
|
2024-10-15 23:40:11 +08:00
|
|
|
|
<div class="userList">
|
2024-10-21 13:11:14 +08:00
|
|
|
|
<!-- <u-checkbox-group-->
|
|
|
|
|
<!-- placement="column"-->
|
|
|
|
|
<!-- v-model="checked">-->
|
2024-10-22 15:05:13 +08:00
|
|
|
|
<radio-group @change="radioChange" v-if="type == 'xs' || !type">
|
2024-10-19 18:06:36 +08:00
|
|
|
|
<label v-for="(item, index) in list" :key="item.userId" class="userItem">
|
2024-10-15 23:40:11 +08:00
|
|
|
|
<view class="info">
|
2024-10-21 13:11:14 +08:00
|
|
|
|
<text class="name">{{ item.userName }}</text>
|
|
|
|
|
<text class="trade">{{ item.workTypeText }}</text>
|
2024-10-15 23:40:11 +08:00
|
|
|
|
</view>
|
2024-10-21 13:11:14 +08:00
|
|
|
|
<radio :value="item.userId+''" :checked="index === current"/>
|
|
|
|
|
<!-- <u-checkbox v-model="item.checked" :name="item.userId" iconSize="24" shape="circle" activeColor="#1890ff"></u-checkbox>-->
|
2024-10-19 18:06:36 +08:00
|
|
|
|
</label>
|
2024-10-21 13:11:14 +08:00
|
|
|
|
</radio-group>
|
|
|
|
|
|
|
|
|
|
<view v-else>
|
|
|
|
|
<!-- <label v-for="(item, index) in list" :key="item.id" class="userItem">-->
|
|
|
|
|
<!-- <view class="info">-->
|
|
|
|
|
<!-- <text class="name">{{ item.userName }}</text>-->
|
|
|
|
|
<!-- <text class="trade">{{ item.workTypeText }}</text>-->
|
|
|
|
|
<!-- </view>-->
|
|
|
|
|
<!-- <checkbox :value="item.id+''" v-model="selectedUsers" @change="cs" />-->
|
|
|
|
|
<!-- </label>-->
|
|
|
|
|
<checkbox-group @change="cs">
|
|
|
|
|
<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>
|
|
|
|
|
<checkbox :value="item.userId + ''" />
|
|
|
|
|
</label>
|
|
|
|
|
</checkbox-group>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- </u-checkbox-group>-->
|
2024-10-15 23:40:11 +08:00
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
<view class="foot">
|
|
|
|
|
<view class="submit" @click="submit">确定选择</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import VNavigationBar from '@/components/VNavigationBar.vue'
|
|
|
|
|
import {bus} from "@/utils/eventBus";
|
2024-10-18 15:14:11 +08:00
|
|
|
|
import request from '@/utils/request';
|
2024-10-23 22:15:34 +08:00
|
|
|
|
import {getDictTextByCodeAndValue,saveTicketsRecords} from "@/utils/utils";
|
2024-10-21 13:11:14 +08:00
|
|
|
|
|
2024-10-15 23:40:11 +08:00
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
VNavigationBar,
|
|
|
|
|
},
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
2024-10-19 18:06:36 +08:00
|
|
|
|
current: 0,
|
2024-10-21 13:11:14 +08:00
|
|
|
|
ticketId: '',
|
2024-10-18 15:14:11 +08:00
|
|
|
|
list: [],
|
2024-10-21 13:11:14 +08:00
|
|
|
|
checkedUserId: "",
|
|
|
|
|
checkedUserName: "",
|
|
|
|
|
ifDetail: false,
|
2024-10-22 15:05:13 +08:00
|
|
|
|
type: "",
|
2024-10-21 13:11:14 +08:00
|
|
|
|
sgIds: [], // 初始化为数组
|
|
|
|
|
sgNames : [],
|
2024-10-23 22:15:34 +08:00
|
|
|
|
projectId: '',
|
|
|
|
|
itemId:"",
|
2024-10-15 23:40:11 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad(data) {
|
2024-10-21 13:11:14 +08:00
|
|
|
|
console.log("data", data)
|
|
|
|
|
if (data.id) {
|
2024-10-22 15:05:13 +08:00
|
|
|
|
console.log('执行了派单')
|
2024-10-18 15:14:11 +08:00
|
|
|
|
this.ticketId = data.id
|
|
|
|
|
this.workByTicketId()
|
|
|
|
|
}
|
2024-10-21 13:11:14 +08:00
|
|
|
|
if (data.ifDetail) {
|
2024-10-19 18:06:36 +08:00
|
|
|
|
//从订单详情页跳过来的,返回时需要返回2步
|
|
|
|
|
this.ifDetail = true
|
|
|
|
|
}
|
2024-10-23 22:15:34 +08:00
|
|
|
|
if (data.itemId) {
|
|
|
|
|
//从订单详情页跳过来的,返回时需要返回2步
|
|
|
|
|
this.itemId = data.itemId
|
|
|
|
|
}
|
2024-10-21 13:11:14 +08:00
|
|
|
|
if (data.type) {
|
|
|
|
|
this.type = data.type
|
|
|
|
|
if (data.type == 'xs') {
|
|
|
|
|
this.getStaffList()
|
|
|
|
|
} else {
|
|
|
|
|
this.getRepairWorder()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//创建工单后,订单详情页跳转过来携带
|
|
|
|
|
if (data.ticketId) {
|
|
|
|
|
this.ticketId = data.ticketId
|
|
|
|
|
}
|
2024-10-22 15:05:13 +08:00
|
|
|
|
if (data.projectId) {
|
|
|
|
|
this.projectId = data.projectId
|
|
|
|
|
}
|
2024-10-15 23:40:11 +08:00
|
|
|
|
},
|
|
|
|
|
methods: {
|
2024-10-21 13:11:14 +08:00
|
|
|
|
radioChange: function (evt) {
|
2024-10-19 18:06:36 +08:00
|
|
|
|
for (let i = 0; i < this.list.length; i++) {
|
|
|
|
|
if (this.list[i].userId == evt.detail.value) {
|
|
|
|
|
this.current = i;
|
|
|
|
|
this.checkedUserId = this.list[i].userId
|
|
|
|
|
this.checkedUserName = this.list[i].userName
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
console.log(this.checkedUserName)
|
|
|
|
|
},
|
2024-10-21 13:11:14 +08:00
|
|
|
|
/**
|
|
|
|
|
* 获取销售列表
|
|
|
|
|
*/
|
|
|
|
|
getStaffList() {
|
|
|
|
|
request({
|
|
|
|
|
url: '/admin-api/company/staff/list',
|
|
|
|
|
method: 'get'
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.list = res.data
|
|
|
|
|
this.list.map((item) => {
|
|
|
|
|
item.userName = item.name
|
|
|
|
|
})
|
2024-10-22 15:05:13 +08:00
|
|
|
|
if (this.list.length > 0) {
|
|
|
|
|
console.log(this.list[0].userId)
|
|
|
|
|
this.checkedUserId = this.list[0].userId
|
|
|
|
|
this.checkedUserName = this.list[0].userName
|
|
|
|
|
}
|
2024-10-21 13:11:14 +08:00
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 获取维修工人
|
|
|
|
|
*/
|
|
|
|
|
getRepairWorder(){
|
|
|
|
|
request({
|
|
|
|
|
url: '/admin-api/repair/worker/page',
|
|
|
|
|
method: 'get',
|
|
|
|
|
params:{
|
|
|
|
|
pageNo: 1,
|
|
|
|
|
pageSize: 9999
|
|
|
|
|
}
|
|
|
|
|
}).then(res => {
|
2024-10-23 15:37:56 +08:00
|
|
|
|
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 = []
|
|
|
|
|
}
|
2024-10-21 13:11:14 +08:00
|
|
|
|
})
|
|
|
|
|
},
|
2024-10-18 15:14:11 +08:00
|
|
|
|
/**
|
|
|
|
|
* 通过工单id查询维修工人
|
|
|
|
|
*/
|
2024-10-21 13:11:14 +08:00
|
|
|
|
workByTicketId() {
|
2024-10-18 15:14:11 +08:00
|
|
|
|
request({
|
|
|
|
|
url: '/admin-api/repair/worker/listByTicketId',
|
|
|
|
|
method: 'get',
|
2024-10-21 13:11:14 +08:00
|
|
|
|
params: {ticketId: this.ticketId}
|
|
|
|
|
}).then((res) => {
|
2024-10-26 16:57:33 +08:00
|
|
|
|
this.list = res.data
|
2024-10-22 15:05:13 +08:00
|
|
|
|
if (this.list.length > 0) {
|
|
|
|
|
console.log(this.list[0].userId)
|
|
|
|
|
this.checkedUserId = this.list[0].userId
|
|
|
|
|
this.checkedUserName = this.list[0].userName
|
|
|
|
|
}
|
2024-10-18 15:14:11 +08:00
|
|
|
|
})
|
|
|
|
|
},
|
2024-10-21 13:11:14 +08:00
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-18 16:10:56 +08:00
|
|
|
|
}
|
2024-10-21 13:11:14 +08:00
|
|
|
|
console.log(this.checkedUserName)
|
|
|
|
|
this.sgIds = arr
|
|
|
|
|
this.sgNames = nameArr
|
|
|
|
|
},
|
2024-10-23 22:15:34 +08:00
|
|
|
|
async submit() {
|
2024-10-21 13:11:14 +08:00
|
|
|
|
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(',')
|
2024-10-22 15:05:13 +08:00
|
|
|
|
console.log('this.projectId',this.projectId)
|
2024-10-21 13:11:14 +08:00
|
|
|
|
const param = {
|
|
|
|
|
ticketId: this.ticketId,
|
2024-10-22 15:05:13 +08:00
|
|
|
|
projectId: this.projectId,
|
2024-10-21 13:11:14 +08:00
|
|
|
|
repairIds: sgIds,
|
|
|
|
|
repairNames: sgNames,
|
|
|
|
|
}
|
|
|
|
|
request({
|
|
|
|
|
url: '/admin-api/repair/titem/updateRepairAndSale',
|
|
|
|
|
method: 'put',
|
|
|
|
|
data: param
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '选择维修人员成功!',
|
|
|
|
|
icon: 'none'
|
2024-10-19 18:06:36 +08:00
|
|
|
|
})
|
2024-10-21 13:11:14 +08:00
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
}, 700)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else if (this.type == 'xs') {
|
|
|
|
|
if (this.checkedUserId == '' && this.checkedUserName == '') {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '请选择销售人员!',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
//以逗号拼接
|
|
|
|
|
const param = {
|
|
|
|
|
ticketId: this.ticketId,
|
2024-10-22 15:05:13 +08:00
|
|
|
|
projectId: this.projectId,
|
2024-10-21 13:11:14 +08:00
|
|
|
|
saleId: this.checkedUserId,
|
|
|
|
|
saleName: this.checkedUserName,
|
2024-10-19 18:06:36 +08:00
|
|
|
|
}
|
2024-10-21 13:11:14 +08:00
|
|
|
|
request({
|
|
|
|
|
url: '/admin-api/repair/titem/updateRepairAndSale',
|
|
|
|
|
method: 'put',
|
|
|
|
|
data: param
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '选择销售人员成功!',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
}, 700)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const param = {
|
|
|
|
|
id: this.ticketId,
|
|
|
|
|
nowRepairId: this.checkedUserId,
|
|
|
|
|
nowRepairName: this.checkedUserName,
|
|
|
|
|
}
|
|
|
|
|
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) {
|
2024-10-23 22:15:34 +08:00
|
|
|
|
//记录一下操作记录
|
|
|
|
|
saveTicketsRecords(this.ticketId, '03',this.itemId,"03","sgwczj","维修完成移交下一班组维修","","01",this.checkedUserName);
|
2024-10-21 13:11:14 +08:00
|
|
|
|
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()
|
|
|
|
|
}
|
2024-10-15 23:40:11 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
.container {
|
|
|
|
|
height: 100%;
|
|
|
|
|
background-color: #F3F5F7;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
|
|
|
|
.body {
|
|
|
|
|
flex: 1;
|
|
|
|
|
height: 0;
|
|
|
|
|
overflow: auto;
|
|
|
|
|
padding: 20rpx 0;
|
|
|
|
|
|
|
|
|
|
.searchBox {
|
|
|
|
|
margin: 0 32rpx;
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
|
|
|
|
padding: 30rpx;
|
|
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
column-gap: 20rpx;
|
|
|
|
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #0174F6;
|
|
|
|
|
|
|
|
|
|
.inputBox {
|
|
|
|
|
flex: 1;
|
|
|
|
|
width: 0;
|
|
|
|
|
color: #000;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.userList {
|
|
|
|
|
margin: 20rpx 32rpx 0;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
padding: 0 20rpx;
|
|
|
|
|
|
|
|
|
|
.userItem {
|
|
|
|
|
padding: 30rpx 0;
|
|
|
|
|
border-bottom: 1rpx solid #DDDDDD;
|
|
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.info {
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
row-gap: 20rpx;
|
2024-10-21 13:11:14 +08:00
|
|
|
|
|
2024-10-15 23:40:11 +08:00
|
|
|
|
.name {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
color: #333333;
|
|
|
|
|
}
|
2024-10-21 13:11:14 +08:00
|
|
|
|
|
2024-10-15 23:40:11 +08:00
|
|
|
|
.trade {
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: #999999;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-10-21 13:11:14 +08:00
|
|
|
|
|
2024-10-15 23:40:11 +08:00
|
|
|
|
.userItem:last-child {
|
|
|
|
|
border-bottom: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.foot {
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
padding: 30rpx;
|
|
|
|
|
|
|
|
|
|
.submit {
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
width: 510rpx;
|
|
|
|
|
height: 76rpx;
|
|
|
|
|
background: #0174F6;
|
|
|
|
|
border-radius: 38rpx 38rpx 38rpx 38rpx;
|
|
|
|
|
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
|
|
|
|
font-size: 32rpx;
|
|
|
|
|
color: #FFFFFF;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|