Compare commits

...

5 Commits

3 changed files with 35 additions and 17 deletions

View File

@ -1,6 +1,6 @@
<template> <template>
<el-select v-model="userSelected" clearable filterable > <el-select v-model="userSelected" clearable filterable :filter-method="handleQuery">
<el-option v-for="user in userList" :key="user.id" :label="user.cusName + ' ' + user.phoneNumber" :value="user.id" /> <el-option v-for="user in userList" :key="user.id" :label="user.cusName + ' ' + user.phoneNumber" :value="user.id"/>
</el-select> </el-select>
</template> </template>
@ -10,11 +10,11 @@ import {getCustomerMainPage} from "@/api/base/customer";
export default { export default {
name: "UserChoose", name: "UserChoose",
props:{ props: {
value:{ value: {
type: Object, type: Object,
}, },
inList:{ inList: {
type: Object, type: Object,
default: null, default: null,
required: false required: false
@ -24,28 +24,30 @@ export default {
return { return {
userList: [], userList: [],
userSelected: undefined, userSelected: undefined,
queryParams:{ queryParams: {
pageNo: 1, pageNo: 1,
pageSize: 10 pageSize: 10,
cusName: null,
phoneNumber: null,
}, },
total: 0 total: 0
} }
}, },
watch:{ watch: {
userSelected(val){ userSelected(val) {
if (val){ if (val) {
const user = this.userList.find(item => item.id === val) const user = this.userList.find(item => item.id === val)
this.$emit("input", user) this.$emit("input", user)
} }
}, },
value(val){ value(val) {
this.userSelected = val ? val.id : null this.userSelected = val ? val.id : null
}, },
inList(val){ inList(val) {
if (val){ if (val) {
// //
const flag = this.userList.findIndex(item => item.id === val.id) const flag = this.userList.findIndex(item => item.id === val.id)
if (flag > 0){ if (flag > 0) {
this.userList.splice(flag, 1) this.userList.splice(flag, 1)
} }
this.userList.unshift(val) this.userList.unshift(val)
@ -57,10 +59,18 @@ export default {
this.listCustomer() this.listCustomer()
}, },
methods: { methods: {
async listCustomer(){ async listCustomer() {
const res = await getCustomerMainPage(this.queryParams) const res = await getCustomerMainPage(this.queryParams)
this.userList = res.data.records this.userList = res.data.records
this.total = res.data.total this.total = res.data.total
},
handleQuery(data) {
if (/^\d+$/.test(data)) {
this.queryParams.phoneNumber = data
} else {
this.queryParams.cusName = data
}
this.listCustomer()
} }
} }
} }

View File

@ -77,6 +77,9 @@
v-if="(userRole === 'repair_staff' ? (leader ? !isFinish : false) : false) && !(scope.row.ticketsWorkStatus !== '01' && userRole === 'repair_staff' && !isFinish)"> v-if="(userRole === 'repair_staff' ? (leader ? !isFinish : false) : false) && !(scope.row.ticketsWorkStatus !== '01' && userRole === 'repair_staff' && !isFinish)">
重新指派 重新指派
</el-button> </el-button>
<el-button v-if="userRole === 'repair_staff' && !isFinish && scope.row.ticketsWorkStatus === '01' && !(nowUser.id === scope.row.nowRepairId)" @click="handleGet(scope.row)" size="mini" type="text" icon="el-icon-document-add">
申请配件
</el-button>
<el-dropdown <el-dropdown
v-if="(scope.row.ticketsWorkStatus !== '01' && ((userRole === 'service_advisor' || userRole === 'general_inspection') && !isFinish)) || (userRole === 'repair_staff' && !isFinish && scope.row.ticketsWorkStatus !== '01')" v-if="(scope.row.ticketsWorkStatus !== '01' && ((userRole === 'service_advisor' || userRole === 'general_inspection') && !isFinish)) || (userRole === 'repair_staff' && !isFinish && scope.row.ticketsWorkStatus !== '01')"
@command="(command) => handleCommand(command, scope.$index, scope.row)"> @command="(command) => handleCommand(command, scope.$index, scope.row)">

View File

@ -308,7 +308,10 @@ export default {
formRules: { formRules: {
'userInfo.cusName':[{required: true, message: "客户名称不能为空", trigger: 'blur'}], 'userInfo.cusName':[{required: true, message: "客户名称不能为空", trigger: 'blur'}],
'userInfo.phoneNumber': [{required: true, message: "联系方式不能为空", trigger: 'blur'}], 'userInfo.phoneNumber': [{required: true, message: "联系方式不能为空", trigger: 'blur'}],
'carInfo.licenseNumber': [{required: true, message: "车牌号不能为空", trigger: 'blur'}] 'carInfo.licenseNumber': [{required: true, message: "车牌号不能为空", trigger: 'blur'}],
'carInfo.brandAndModel': [{required: true, message: "品牌型号不能为空", trigger: 'blur'}],
'carInfo.carCategory': [{required: true, message: '车辆类别不能为空', trigger: 'blur'}],
'carInfo.carNature': [{required: true, message: '车辆性质不能为空', trigger: 'blur'}]
}, },
formLoading: false, formLoading: false,
// //
@ -369,9 +372,11 @@ export default {
await updateCustomerAndCar(this.formData) await updateCustomerAndCar(this.formData)
this.$modal.msgSuccess(this.formData?.userInfo?.id ? "修改成功" : "新增成功") this.$modal.msgSuccess(this.formData?.userInfo?.id ? "修改成功" : "新增成功")
this.$emit("success", this.formData) this.$emit("success", this.formData)
}finally {
this.formLoading = false this.formLoading = false
this.dialogVisible = false this.dialogVisible = false
}catch {}
finally {
this.formLoading = false
} }
}, },
reset(){ reset(){