This commit is contained in:
Vinjor 2024-10-21 18:10:24 +08:00
commit 1ccb49d161
3 changed files with 218 additions and 64 deletions

View File

@ -232,9 +232,10 @@ export default {
title: '创建成功',
icon: 'success'
})
setTimeout(() => {
uni.navigateBack();
}, 600)
console.log("工单提交返回的结果", res)
uni.navigateTo({
url: `/pages-order/orderDetail/orderDetail?id=${res.data.id}&isDetail=0`
});
})
},
listUserInfo() {

View File

@ -2,27 +2,46 @@
<view class="container">
<VNavigationBar background-color="#fff" title="选择人员" title-color="#333"></VNavigationBar>
<view class="body">
<!-- <div class="searchBox">-->
<!-- <div class="inputBox">-->
<!-- <input placeholder="请输入人员姓名" type="text">-->
<!-- </div>-->
<!-- <text>搜索</text>-->
<!-- </div>-->
<!-- <div class="searchBox">-->
<!-- <div class="inputBox">-->
<!-- <input placeholder="请输入人员姓名" type="text">-->
<!-- </div>-->
<!-- <text>搜索</text>-->
<!-- </div>-->
<div class="userList">
<!-- <u-checkbox-group-->
<!-- placement="column"-->
<!-- v-model="checked">-->
<radio-group @change="radioChange">
<!-- <u-checkbox-group-->
<!-- placement="column"-->
<!-- v-model="checked">-->
<radio-group @change="radioChange" v-if="type == 'xs'">
<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>
<text class="name">{{ item.userName }}</text>
<text class="trade">{{ item.workTypeText }}</text>
</view>
<radio :value="item.userId+''" :checked="index === current" />
<!-- <u-checkbox v-model="item.checked" :name="item.userId" iconSize="24" shape="circle" activeColor="#1890ff"></u-checkbox>-->
<radio :value="item.userId+''" :checked="index === current"/>
<!-- <u-checkbox v-model="item.checked" :name="item.userId" iconSize="24" shape="circle" activeColor="#1890ff"></u-checkbox>-->
</label>
</radio-group>
<!-- </u-checkbox-group>-->
</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>-->
</div>
</view>
@ -38,6 +57,7 @@ import VNavigationBar from '@/components/VNavigationBar.vue'
import {bus} from "@/utils/eventBus";
import request from '@/utils/request';
import {getDictTextByCodeAndValue} from "@/utils/utils";
export default {
components: {
VNavigationBar,
@ -45,25 +65,43 @@ export default {
data() {
return {
current: 0,
ticketId:'',
ticketId: '',
list: [],
checkedUserId:"",
checkedUserName:"",
ifDetail:false,
checkedUserId: "",
checkedUserName: "",
ifDetail: false,
type: "sg",
sgIds: [], //
sgNames : [],
xsId: [],
xsName: []
}
},
onLoad(data) {
if(data.id){
console.log("data", data)
if (data.id) {
this.ticketId = data.id
this.workByTicketId()
}
if(data.ifDetail){
if (data.ifDetail) {
//2
this.ifDetail = true
}
if (data.type) {
this.type = data.type
if (data.type == 'xs') {
this.getStaffList()
} else {
this.getRepairWorder()
}
}
//
if (data.ticketId) {
this.ticketId = data.ticketId
}
},
methods: {
radioChange: function(evt) {
radioChange: function (evt) {
for (let i = 0; i < this.list.length; i++) {
if (this.list[i].userId == evt.detail.value) {
this.current = i;
@ -75,51 +113,162 @@ export default {
console.log(this.checkedUserName)
},
/**
* 通过工单id查询维修工人
* 获取销售列表
*/
workByTicketId(){
getStaffList() {
request({
url: '/admin-api/repair/worker/listByTicketId',
method: 'get',
params:{ticketId:this.ticketId}
}).then((res)=>{
url: '/admin-api/company/staff/list',
method: 'get'
}).then(res => {
this.list = res.data
this.list.map((item)=>{
item.workTypeText = getDictTextByCodeAndValue('repair_work_type',item.workType)
this.list.map((item) => {
item.userName = item.name
})
})
},
submit() {
const param = {
id:this.ticketId,
nowRepairId:this.checkedUserId,
nowRepairName:this.checkedUserName,
}
console.log(param)
/**
* 获取维修工人
*/
getRepairWorder(){
request({
url: '/admin-api/repair/tickets/notify',
method: 'post',
data:param
}).then((res)=>{
uni.showToast({
title: '指派成功!',
icon: 'none'
url: '/admin-api/repair/worker/page',
method: 'get',
params:{
pageNo: 1,
pageSize: 9999
}
}).then(res => {
this.list = res.data.records
this.list.map((item) => {
item.workTypeText = getDictTextByCodeAndValue('repair_work_type', item.workType)
})
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()
},
/**
* 通过工单id查询维修工人
*/
workByTicketId() {
request({
url: '/admin-api/repair/worker/listByTicketId',
method: 'get',
params: {ticketId: this.ticketId}
}).then((res) => {
this.list = res.data
this.list.map((item) => {
item.workTypeText = getDictTextByCodeAndValue('repair_work_type', item.workType)
})
})
},
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
},
submit() {
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(sgIds)
console.log(sgNames)
const param = {
ticketId: this.ticketId,
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()
}, 700)
})
}
}else if (this.type == 'xs') {
if (this.checkedUserId == '' && this.checkedUserName == '') {
uni.showToast({
title: '请选择销售人员!',
icon: 'none'
})
} else {
//
const param = {
ticketId: this.ticketId,
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()
}, 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) {
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()
}
}
}
}
@ -176,11 +325,13 @@ export default {
display: flex;
flex-direction: column;
row-gap: 20rpx;
.name {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
.trade {
font-weight: 500;
font-size: 24rpx;
@ -188,6 +339,7 @@ export default {
}
}
}
.userItem:last-child {
border-bottom: none;
}

View File

@ -355,6 +355,7 @@ export default {
onLoad(data) {
this.loginUser = getUserInfo()
console.log(this.loginUser,294)
console.log(data)
if (data.id) {
this.ticketId = data.id
}
@ -399,7 +400,6 @@ export default {
console.log('删除文件');
this.fileList.splice(index, 1);
},
/**
* 保存工作记录信息
*/
@ -682,7 +682,8 @@ export default {
console.log('proj', proj)
})
uni.navigateTo({
url: `/pages-order/choosePeople/choosePeople?type=${type}`
url: `/pages-order/choosePeople/choosePeople?type=${type}&ticketId=${this.ticketId}`
// url: `/pages-order/choosePeople/choosePeople?type=${type}&id=${this.ticketId}`
})
},
//