更新
This commit is contained in:
parent
232ef05f6e
commit
c91ebc3135
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<el-select :loading="selectLoading" v-model="staffSelected" clearable filterable :filter-method="changeQuery"
|
||||
@blur="$emit('input-blur', $event)">
|
||||
@blur="$emit('input-blur', selectedStaff)" @change="handleChange">
|
||||
<el-option v-for="staff in staffList" :key="staff.id" :label="staff.name + ' ' + staff.tel" :value="staff.id"/>
|
||||
</el-select>
|
||||
</template>
|
||||
@ -34,6 +34,12 @@ export default {
|
||||
selectLoading: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
selectedStaff() {
|
||||
const staff = this.staffList.find(item => item.id === this.staffSelected) || null;
|
||||
return staff;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
staffSelected(val) {
|
||||
const staff = this.staffList.find(item => item.id === val);
|
||||
@ -51,9 +57,24 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.listStaff()
|
||||
this.getNow()
|
||||
// 只有在需要自动获取当前用户信息时才调用 getNow()
|
||||
if (this.isGet && this.isGet !== 'false') {
|
||||
this.getNow()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleChange(val) {
|
||||
if (val) {
|
||||
const staff = this.staffList.find(item => item.id === val);
|
||||
if (staff) {
|
||||
this.$emit("input", staff);
|
||||
this.$emit("input-blur", staff);
|
||||
}
|
||||
} else {
|
||||
this.$emit("input", null);
|
||||
this.$emit("input-blur", null);
|
||||
}
|
||||
},
|
||||
async listStaff() {
|
||||
this.selectLoading = true
|
||||
try {
|
||||
@ -64,7 +85,10 @@ export default {
|
||||
const res = await getStaffList(this.query)
|
||||
this.staffList = res.data
|
||||
if (this.query){
|
||||
this.staffSelected = this.staffList.filter(item => item.tel === this.query)[0].id
|
||||
const filtered = this.staffList.filter(item => item.tel === this.query);
|
||||
if (filtered.length > 0) {
|
||||
this.staffSelected = filtered[0].id
|
||||
}
|
||||
this.query = null
|
||||
}
|
||||
}
|
||||
@ -87,4 +111,4 @@ export default {
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
</style>
|
||||
</style>
|
||||
@ -18,8 +18,8 @@
|
||||
<el-form-item v-if="goodsYes" label="关键字" prop="query">
|
||||
<el-input v-model="queryParams.query" style="width: 18rem" placeholder="请输入单号、商品名称或编码"/>
|
||||
</el-form-item>
|
||||
<el-form-item v-else label="单据号" prop="query">
|
||||
<el-input v-model="queryParams.query" style="width: 18rem" placeholder="请输入单号、备注"/>
|
||||
<el-form-item v-else label="关键词" prop="query">
|
||||
<el-input v-model="queryParams.query" style="width: 18rem" placeholder="请输入单号、备注、车牌"/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="soByType" label="状态" prop="soStatus">
|
||||
<el-select v-model="queryParams.soStatus" clearable>
|
||||
@ -30,7 +30,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!soByType" :label="!isBack ? '领料人' : '退料人'" prop="userId">
|
||||
<StaffChoose v-model="queryParams.user" @selected="getStaff"/>
|
||||
<StaffChoose @input-blur="getStaff" is-get="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="!isBack" :label="soByType ? '采购门店' : '领料门店'" prop="corpId">
|
||||
<CorpChoose v-model="queryParams.corp" @selected="getCompany"/>
|
||||
@ -85,6 +85,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单号" align="center" prop="soNo" width="200"/>
|
||||
<el-table-column label="车牌号" align="center" prop="licenseNumber" width="200"/>
|
||||
<el-table-column label="数量" align="center" prop="itemCount" width="150"/>
|
||||
<el-table-column label="金额" align="center" prop="totalPrice" width="150"/>
|
||||
<el-table-column :label="soByType ? '采购员' : !isBack ? '领料人' : '退料人'" align="center" prop="userName"
|
||||
@ -541,8 +542,19 @@ export default {
|
||||
},
|
||||
// 员工选择组件的回调
|
||||
getStaff(data) {
|
||||
this.queryParams.userId = data.id
|
||||
this.queryParams.userName = data.name
|
||||
console.log('执行',data);
|
||||
|
||||
if (typeof data === 'object' && data !== null) {
|
||||
this.queryParams.userId = data.userId
|
||||
this.queryParams.userName = data.name
|
||||
} else if (data) {
|
||||
// data是ID
|
||||
this.queryParams.userId = data
|
||||
} else {
|
||||
// data为null,清空userId和userName
|
||||
this.queryParams.userId = null
|
||||
this.queryParams.userName = null
|
||||
}
|
||||
},
|
||||
// 门店选择
|
||||
getCompany(data) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user