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

@ -12,7 +12,7 @@
<!-- <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>
@ -22,6 +22,25 @@
<!-- <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>
<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>--> <!-- </u-checkbox-group>-->
</div> </div>
@ -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,
@ -50,9 +70,15 @@ export default {
checkedUserId: "", checkedUserId: "",
checkedUserName: "", checkedUserName: "",
ifDetail: false, ifDetail: false,
type: "sg",
sgIds: [], //
sgNames : [],
xsId: [],
xsName: []
} }
}, },
onLoad(data) { onLoad(data) {
console.log("data", data)
if (data.id) { if (data.id) {
this.ticketId = data.id this.ticketId = data.id
this.workByTicketId() this.workByTicketId()
@ -61,6 +87,18 @@ export default {
//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) {
@ -74,6 +112,38 @@ export default {
} }
console.log(this.checkedUserName) 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
})
})
},
/**
* 获取维修工人
*/
getRepairWorder(){
request({
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)
})
})
},
/** /**
* 通过工单id查询维修工人 * 通过工单id查询维修工人
*/ */
@ -89,7 +159,85 @@ export default {
}) })
}) })
}, },
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() { 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 = { const param = {
id: this.ticketId, id: this.ticketId,
nowRepairId: this.checkedUserId, nowRepairId: this.checkedUserId,
@ -123,6 +271,7 @@ export default {
} }
} }
} }
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -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}`
}) })
}, },
// //