oil-station/fuintAdmin/src/components/local/selectStaff.vue

274 lines
8.1 KiB
Vue
Raw Normal View History

2023-11-11 18:02:25 +08:00
<template>
2023-11-13 16:54:15 +08:00
<div class="app-container">
<el-card >
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="姓名" prop="name">
<el-input
v-model="queryParams.realName"
placeholder="请输入姓名"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input
v-model="queryParams.mobile"
placeholder="请输入手机号"
clearable
style="width: 240px;"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="状态" prop="auditedStatus">
<el-select
v-model="queryParams.status"
placeholder="状态"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.zhzt"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<!-- <el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>-->
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 20px" >
<el-table ref="tables" v-loading="loading" :data="list" @selection-change="handleSelectionChange"
@row-click="handleRowClick"
:default-sort="defaultSort" @sort-change="handleSortChange">
<el-table-column label="ID" align="center" prop="id" width="80" />
<el-table-column label="姓名" align="center" prop="realName" />
<el-table-column label="手机号" align="center" prop="mobile" width="110"/>
<el-table-column label="员工状态" align="center" prop="status">
<template slot-scope="scope">
<el-tag v-if="scope.row.status=='qy'">启用</el-tag>
<el-tag type="info" v-if="scope.row.status=='jy'">禁用</el-tag>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.page"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-card>
</div>
2023-11-11 18:02:25 +08:00
</template>
<script>
2023-11-13 16:54:15 +08:00
import {getName} from "../../utils/fuint";
import {addStaff, delStaff, getStaff, listStaff, queryStaff, updateStaff} from "@/api/staff/staff";
import {getDuty, listDuty} from "@/api/staff/duty";
2023-11-11 18:02:25 +08:00
export default {
2023-11-13 16:54:15 +08:00
name: "selectStaff",
dicts: ['ywqx','write_off','display','zhzt','transaction','time_frame','handover','handover_quit',
'jbjl','official','notice','special_prem','role','shqx'],
data() {
return {
// 角色列表
roleList:[],
drawer: false,
// 标题
title: "",
// 遮罩层
loading: false,
// 选中数组
ids: [],
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
storeOptions: [],
// role:[],
posPrem:'',
2024-07-12 15:10:46 +08:00
2023-11-13 16:54:15 +08:00
props: { multiple: true },
appletPrem:'',
2024-07-12 15:10:46 +08:00
2023-11-13 16:54:15 +08:00
writeOff:[],
write:[],
specialPrem:[],
auditPrem:[],
special:[],
// 总条数
total: 0,
// 表格数据
list: [],
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 默认排序
defaultSort: {prop: 'createTime', order: 'descending'},
// 表单参数
form: {
id:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'',
auditedTime:'', description:'', isRefuel:'yc', handoverMode:'dqmdtyjb', handoverPrem:'yqx', handoverOut:'jbtc', record:'qbjl',
merchantStatus:'qy',screen:'qy', posPrem:'', appletPrem:'', notice:'advice_jy', oilGunId:'', timeFrame:'bx', refund:'yqx',
transaction:'qbjy', writeOff:'',auditPrem:'',specialPrem:'', official:'', status:'qy',pos:'jy',roleId:''
},
// 查询参数
queryParams: {
page: 1,
pageSize: 10,
realName: '',
mobile: '',
status: ''
2024-07-12 15:10:46 +08:00
},
2023-11-13 16:54:15 +08:00
};
},
created() {
this.getList();
this.getDuty();
// this.getStoreList();
},
methods: {
showDesc(){
this.drawer = true;
},
handleNodeClick1(data) {
this.form.posPrem = JSON.stringify(data);
},
handleNodeClick2(data) {
this.form.appletPrem = JSON.stringify(data);
},
getCheckbox(){
this.form.writeOff = this.writeOff.toString();
this.form.specialPrem = this.specialPrem.toString();
this.form.auditPrem = this.auditPrem.toString();
},
// 页面跳转
toTarget(url) {
this.$router.push( { path: url } );
},
getName,
// 查询列表
getList() {
this.loading = true;
listStaff(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
this.list = response.data.records;
this.total = response.data.total;
this.loading = false;
}
);
},
// 查询角色列表
getDuty(){
listDuty().then(response => {
this.roleList = response.data
})
},
// 店铺列表
getStoreList() {
listStaff().then(response => {
this.storeOptions = response.data.records;
}
);
},
// 搜索按钮操作
handleQuery() {
this.queryParams.page = 1;
this.getList();
},
// 重置按钮操作
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.$refs.tables.sort(this.defaultSort.prop, this.defaultSort.order)
this.handleQuery();
},
// 状态修改
handleStatusChange(row) {
let text = row.auditedStatus == "A" ? "启用" : "禁用";
this.$modal.confirm('确认要' + text + '"' + row.realName + '"吗?').then(function() {
// return updateStaffStatus(row.id, row.auditedStatus);
return updateStaff({id:row.id, auditedStatus:row.auditedStatus})
}).then(() => {
this.$modal.msgSuccess(text + "成功");
}).catch(function() {
row.auditedStatus = row.auditedStatus === "A" ? "A" : "N";
});
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.operId)
this.multiple = !selection.length
},
// 排序触发事件
handleSortChange(column, prop, order) {
this.queryParams.orderByColumn = column.prop;
this.queryParams.isAsc = column.order;
this.getList();
},
// 表单重置
reset() {
this.posPrem = '';
this.appletPrem = '';
this.writeOff = [];
this.auditPrem = [];
this.form = {
id:'', userId:'', mobile:'', realName:'', wechat:'', merchantId:'', storeId:'', auditedStatus:'A',
auditedTime:'', description:'', isRefuel:'yc', handoverMode:'dqmdtyjb', handoverPrem:'yqx', handoverOut:'jbtc', record:'qbjl',
merchantStatus:'qy',screen:'qy', posPrem:'', appletPrem:'', notice:'advice_jy', oilGunId:'', timeFrame:'bx', refund:'yqx',
transaction:'qbjy', writeOff:'',auditPrem:'',specialPrem:'', official:'', status:'qy',pos:'jy',roleId:''
};
this.resetForm("form");
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
handleRowClick(row) {
this.$refs.tables.clearSelection(); // 清除当前选中的行
this.$refs.tables.toggleRowSelection(row); // 选中当前点击的行
// 处理选中的行数据
let file = {
mtStaffId: row.id,
realName: row.realName,
staffMobile: row.mobile,
}
this.$emit('send-data', file);
},
2024-07-12 15:10:46 +08:00
2023-11-13 16:54:15 +08:00
}
};
2023-11-11 18:02:25 +08:00
</script>
2024-07-12 15:10:46 +08:00
<style scoped lang="scss">
2023-11-13 16:54:15 +08:00
.app-container{
width: 100%;
height: 100%;
background: #f6f8f9;
}
.pagin-box{
background: white;
box-sizing: border-box;
padding: 20px;
}
.baoguo{
background: white;
box-sizing: border-box;
padding: 20px;
margin-bottom: 20px;
}
2023-11-11 18:02:25 +08:00
</style>