工单指派多选

This commit is contained in:
xiaofajia 2024-10-12 12:30:30 +08:00
parent e33bda2f9a
commit c036fa3153
4 changed files with 79 additions and 10 deletions

View File

@ -0,0 +1,66 @@
<template>
<div>
<el-select :loading="selectLoading" v-model="workerSelected" multiple clearable filterable :filter-method="changeQuery" @visible-change="handleChange">
<el-option v-for="worker in workerList" :key="worker.id" :label="worker.userName" :value="worker.id"/>
</el-select>
</div>
</template>
<script>
import {getWorkerPage} from '@/api/repair/repairworker'
export default {
name: "WorkerChoose",
props:{
value:{
type: [Object,Array]
}
},
data(){
return{
selectLoading: true,
workerSelected: null,
workerList:[],
queryParams:{
pageNo: 1,
pageSize: 10,
userName: null
},
}
},
watch:{
workerSelected(val){
const list = this.workerList.filter(item => val.includes(item.id))
this.$emit("input", list)
// this.$emit('input-blur')
}
},
mounted() {
this.listWorker()
},
methods:{
async listWorker(){
this.selectLoading = true
try{
const res = await getWorkerPage(this.queryParams)
this.workerList = res.data.records
}finally {
this.selectLoading = false
}
},
async changeQuery(val){
this.queryParams.userName = val
await this.listWorker()
},
handleChange(val){
if (!val){
this.$emit('input-blur')
}
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@ -62,9 +62,9 @@
</el-table-column>
<el-table-column align="center" label="施工人员" width="180" prop="repair">
<div v-if="scope.row.id" class="item" slot-scope="scope">
<StaffChoose @input-blur="save(scope.row)" class="item__input" v-model="scope.row.repair"
:select-width="'15rem'" :is-get="scope.row.id"/>
<span class="item__txt">{{ scope.row.repair ? scope.row.repair.name : scope.row.repair }}</span>
<WorkerChoose @input-blur="save(scope.row)" class="item__input" v-model="scope.row.repair"
:select-width="'15rem'"/>
<span class="item__txt">{{ scope.row.repair ? getRepairName(scope.row.repair) : scope.row.repair }}</span>
</div>
</el-table-column>
<el-table-column align="center" label="销售人员" width="180" prop="sale">
@ -132,10 +132,12 @@ import request from "@/utils/request";
import {getOtherByName} from "@/api/repair/other";
import {getProjectByName} from "@/api/repair/project";
import {getWaresByName} from "@/api/repair/wares";
import WorkerChoose from "@/views/repair/Components/WorkerChoose.vue";
export default {
name: "TicketItem",
components: {
WorkerChoose,
OtherForm,
OtherChoose, ProjectChoose, RepairProjectForm, WaresForm, ServerChoose, StaffChoose, PartChoose
},
@ -183,6 +185,7 @@ export default {
watch: {
list: {
handler(val) {
// console.log(val)
this.$emit("tableData", val)
const coupons = val.filter(item => item.coupon).map(item => item.coupon)
if (coupons && coupons.length > 0) {
@ -192,7 +195,7 @@ export default {
deep: true
},
inListData(val) {
console.log(val)
// console.log(val)
if (val && val.length > 0) {
val.forEach(item => {
item = {
@ -281,7 +284,7 @@ export default {
},
/** 保存数据 */
save(row) {
// TODO BUG
// console.log(row)
if (row.id) {
row.itemStatus = (row.repair && this.itemType === 'project') ? "02" : "01"
row.totalPrice = row.count * row.price * (row.discount / 10)
@ -387,8 +390,8 @@ export default {
})
}
},
getCouponName(id) {
// this.
getRepairName(data) {
return data.map(item => item.userName).join(',')
}
}
}

View File

@ -31,7 +31,7 @@
<el-table-column align="center" label="单价" width="180" prop="itemPrice"/>
<el-table-column align="center" label="折扣" width="180" prop="itemDiscount"/>
<el-table-column align="center" label="金额" width="180" prop="itemMoney"/>
<el-table-column align="center" label="施工人员" width="180" prop="repairName"/>
<el-table-column align="center" label="施工人员" width="180" prop="repairNames"/>
<el-table-column align="center" label="销售人员" width="180" prop="saleName"/>
<el-table-column align="center" label="备注" width="180" prop="remark"/>
</el-table>

View File

@ -552,8 +552,8 @@ export default {
itemPrice: item.price,
itemDiscount: item.discount,
itemMoney: item.totalPrice,
repairId: item?.repair?.id,
repairName: item?.repair?.name,
repairIds: item?.repair.map(i => i.id).join(','),
repairNames: item?.repair.map(i => i.userName).join(','),
saleId: item?.sale?.id,
saleName: item?.sale?.name,
itemTypeId: item?.type?.id,