新增人员选择组件

main
mo 1 year ago
parent ff8038bf15
commit 1e82b2b7cd

@ -0,0 +1,180 @@
<template>
<el-dialog
title="人员选择"
v-if="showFlag"
:visible.sync="showFlag"
:modal="false"
width="80%"
center
>
<el-table
v-loading="loading"
:data="userList"
@current-change="handleCurrent"
@row-dblclick="handleRowDbClick"
>
<el-table-column width="50" align="center">
<template v-slot="scope">
<el-radio
v-model="selectedUserId"
:label="scope.row.id"
@change="handleRowChange(scope.row)"
>{{ "" }}</el-radio
>
</template>
</el-table-column>
<el-table-column
label="用户编号"
align="center"
key="id"
prop="id"
v-if="columns[0].visible"
/>
<el-table-column
label="用户名称"
align="center"
key="username"
prop="username"
v-if="columns[1].visible"
:show-overflow-tooltip="true"
/>
<el-table-column
label="用户昵称"
align="center"
key="nickname"
prop="nickname"
v-if="columns[2].visible"
:show-overflow-tooltip="true"
/>
<el-table-column
label="部门"
align="center"
key="deptName"
prop="dept.name"
v-if="columns[3].visible"
:show-overflow-tooltip="true"
/>
<el-table-column
label="手机号码"
align="center"
key="mobile"
prop="mobile"
v-if="columns[4].visible"
width="120"
/>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmSelect"> </el-button>
<el-button @click="showFlag = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listUser } from "@/api/system/user";
export default {
name: "UserSelect",
data() {
return {
showFlag: false,
selectedUserId: undefined,
selectedRow: undefined,
//
loading: true,
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
userList: null,
//
title: "",
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
},
//
columns: [
{ key: 0, label: `用户编号`, visible: true },
{ key: 1, label: `用户名称`, visible: true },
{ key: 2, label: `用户昵称`, visible: true },
{ key: 3, label: `部门`, visible: true },
{ key: 4, label: `手机号码`, visible: true },
{ key: 5, label: `状态`, visible: true },
{ key: 6, label: `创建时间`, visible: true },
],
};
},
created() {
this.getList();
},
methods: {
/** 查询用户列表 */
getList() {
this.loading = true;
listUser(this.queryParams).then((response) => {
this.userList = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleCurrent(row) {
if (row) {
this.selectedRow = row;
}
},
//
handleRowDbClick(row) {
if (row) {
this.selectedRow = row;
this.$emit("onSelected", this.selectedRow);
this.showFlag = false;
}
},
//
handleRowChange(row) {
if (row) {
this.selectedRow = row;
}
},
//
confirmSelect() {
if (this.selectedUserId == null || this.selectedUserId == 0) {
this.$notify({
title: "提示",
type: "warning",
message: "请至少选择一条数据!",
});
return;
}
this.$emit("onSelected", this.selectedRow);
this.showFlag = false;
},
},
};
</script>

@ -207,60 +207,66 @@
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="审核人" prop="audit"> <el-form-item label="审核人" prop="audit">
<el-select <el-input
v-model="form.audit" v-model="form.audit"
filterable
placeholder="请选择审核人" placeholder="请选择审核人"
value-key="id" readonly
@change="handleSelectUser"
> >
<el-option <el-button
v-for="item in userOptions" slot="append"
:key="item.id" @click="handleSelectUser1"
:value="item" icon="el-icon-search"
:label="item.username" style="
> border-color: #46a6ff;
</el-option> background-color: #46a6ff;
</el-select> color: white;
"
></el-button>
</el-input>
<UserSelect ref="UserSelect1" @onSelected="onUserSelected1" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="核准人" prop="checker"> <el-form-item label="核准人" prop="checker">
<el-select <el-input
v-model="form.checker" v-model="form.checker"
filterable placeholder="请选择审核人"
placeholder="请选择核准人" readonly
value-key="id"
@change="handleSelectUser1"
> >
<el-option <el-button
v-for="item in userOptions" slot="append"
:key="item.id" @click="handleSelectUser2"
:value="item" icon="el-icon-search"
:label="item.username" style="
> border-color: #46a6ff;
</el-option> background-color: #46a6ff;
</el-select> color: white;
"
></el-button>
</el-input>
<UserSelect ref="UserSelect2" @onSelected="onUserSelected2" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="经办人" prop="handle"> <el-form-item label="经办人" prop="handle">
<el-select <el-input
v-model="form.handle" v-model="form.handle"
filterable placeholder="请选择审核人"
placeholder="请选择经办人" readonly
value-key="id"
@change="handleSelectUser2"
> >
<el-option <el-button
v-for="item in userOptions" slot="append"
:key="item.id" @click="handleSelectUser3"
:value="item" icon="el-icon-search"
:label="item.username" style="
> border-color: #46a6ff;
</el-option> background-color: #46a6ff;
</el-select> color: white;
</el-form-item> "
></el-button>
</el-input>
<UserSelect ref="UserSelect3" @onSelected="onUserSelected3"
/></el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row> <el-row>
@ -477,10 +483,11 @@ import { getAttachmentPage } from "@/api/accounting/attachment";
import { getFlowPage } from "@/api/accounting/flow"; import { getFlowPage } from "@/api/accounting/flow";
import { getInvoicesPage } from "@/api/accounting/invoices"; import { getInvoicesPage } from "@/api/accounting/invoices";
import { getBankSlipPage } from "@/api/accounting/bankSlip"; import { getBankSlipPage } from "@/api/accounting/bankSlip";
import UserSelect from "@/components/UserSelect/single.vue";
export default { export default {
name: "Voucher", name: "Voucher",
components: {}, components: { UserSelect },
data() { data() {
return { return {
propName: { propName: {
@ -776,15 +783,6 @@ export default {
this.userOptions = response.data.list; this.userOptions = response.data.list;
}); });
}, },
handleSelectUser(val) {
this.form.audit = val.username;
},
handleSelectUser1(val) {
this.form.checker = val.username;
},
handleSelectUser2(val) {
this.form.handle = val.username;
},
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset(); this.reset();
@ -864,6 +862,35 @@ export default {
}) })
.catch(() => {}); .catch(() => {});
}, },
//
handleSelectUser1() {
this.$refs.UserSelect1.showFlag = true;
},
handleSelectUser2() {
this.$refs.UserSelect2.showFlag = true;
},
handleSelectUser3() {
this.$refs.UserSelect3.showFlag = true;
},
//
onUserSelected1(obj) {
console.log(obj);
if (obj != undefined && obj != null) {
this.form.audit = obj.username;
}
},
//
onUserSelected2(obj) {
if (obj != undefined && obj != null) {
this.form.checker = obj.username;
}
},
//
onUserSelected3(obj) {
if (obj != undefined && obj != null) {
this.form.handle = obj.username;
}
},
}, },
}; };
</script> </script>

Loading…
Cancel
Save