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: '创建成功', title: '创建成功',
icon: 'success' icon: 'success'
}) })
setTimeout(() => { console.log("工单提交返回的结果", res)
uni.navigateBack(); uni.navigateTo({
}, 600) url: `/pages-order/orderDetail/orderDetail?id=${res.data.id}&isDetail=0`
});
}) })
}, },
listUserInfo() { listUserInfo() {

View File

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

View File

@ -355,6 +355,7 @@ export default {
onLoad(data) { onLoad(data) {
this.loginUser = getUserInfo() this.loginUser = getUserInfo()
console.log(this.loginUser,294) console.log(this.loginUser,294)
console.log(data)
if (data.id) { if (data.id) {
this.ticketId = data.id this.ticketId = data.id
} }
@ -399,7 +400,6 @@ export default {
console.log('删除文件'); console.log('删除文件');
this.fileList.splice(index, 1); this.fileList.splice(index, 1);
}, },
/** /**
* 保存工作记录信息 * 保存工作记录信息
*/ */
@ -682,7 +682,8 @@ export default {
console.log('proj', proj) console.log('proj', proj)
}) })
uni.navigateTo({ 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}`
}) })
}, },
// //