Commit ed30516f authored by “yiyousong”'s avatar “yiyousong”

perf: 优化工作人员管理

parent d8920e5d
......@@ -183,12 +183,8 @@
</div>
<a-space>
<a-select v-model="searchType" style="width: 120px">
<a-select-option :value="1">
按姓名
</a-select-option>
<a-select-option :value="2">
按工号
</a-select-option>
<a-select-option value="name"> 按姓名 </a-select-option>
<a-select-option value="number"> 按工号 </a-select-option>
</a-select>
<a-input-search
placeholder="请输入关键字搜索"
......@@ -201,82 +197,74 @@
</div>
<div class="table-content">
<!-- 表格 -->
<a-table
:pagination="{
showTotal: (total) => `共 ${total} 条`,
current: page,
total: total,
pageSize: size,
showSizeChanger: true,
showQuickJumper: true,
pageSizeOptions: pageSizeOptions,
onChange: handlePagination,
onShowSizeChange: showSizeChange,
}"
bordered
:scroll="{ y: 500 }"
:loading="loading"
<y-table
:columns="columns"
:data-source="WorkmanData"
:rowKey="(record) => record.id"
:data="WorkmanData"
:pageSize.sync="size"
:page.sync="page"
:total="total"
:loading="loading"
:scroll="{ y: 500 }"
@changePagination="getWorkmanData"
>
<a slot="name" slot-scope="text">{{ text }}</a>
<span slot="num" slot-scope="text, record, index">{{
<span slot="num" slot-scope="{ index }">{{
(page - 1) * size + index + 1
}}</span>
<!-- 照片 -->
<template slot="pic" slot-scope="text">
<template slot="pic" slot-scope="{ record }">
<img
v-if="text.photoPath"
:src="text.photoPath"
@click="handlePreview(text.photoPath)"
v-if="record.photoPath"
:src="record.photoPath"
@click="handlePreview(record.photoPath)"
class="pht"
/>
<span v-else>--</span>
</template>
<!-- 电话 -->
<template slot="mobile" slot-scope="text">
<span>{{ text.mobile || text.phone || "--" }}</span>
<template slot="mobile" slot-scope="{ record }">
<span>{{ record.mobile || record.phone || "--" }}</span>
</template>
<!-- 称号 -->
<template slot="dangyuan" slot-scope="text">
<div v-if="text.dangyuan === 0 || text.dangyuan">
<span v-if="text.dangyuan === 99">{{ text.dangyuanext }}</span>
<span v-else>{{ designation(text.dangyuan) }}</span>
<template slot="dangyuan" slot-scope="{ record }">
<div v-if="record.dangyuan === 0 || record.dangyuan">
<span v-if="record.dangyuan === 99">{{
record.dangyuanext
}}</span>
<span v-else>{{ designation(record.dangyuan) }}</span>
</div>
<span v-else>--</span>
</template>
<!-- 所属窗口 -->
<template slot="windowId" slot-scope="text">
{{ text.windowId ? filterWindow(text.windowId) : "--" }}
<template slot="windowId" slot-scope="{ record }">
{{ record.windowId ? filterWindow(record.windowId) : "--" }}
</template>
<!-- 创建时间 -->
<template slot="time" slot-scope="text">
{{ text.createTime | dateFormat }}
<template slot="time" slot-scope="{ record }">
{{ record.createTime | dateFormat }}
</template>
<!-- 最后登录时间 -->
<template slot="lastLoginTime" slot-scope="text">
<span v-if="text.lastLoginTime">{{
text.lastLoginTime | dateFormat
<template slot="lastLoginTime" slot-scope="{ record }">
<span v-if="record.lastLoginTime">{{
record.lastLoginTime | dateFormat
}}</span>
<span v-else>--</span>
</template>
<!-- 操作 -->
<span slot="action" slot-scope="text">
<span slot="action" slot-scope="{ record }">
<a-space>
<span class="primary pointer" @click="editModal(text)"
<span class="primary pointer" @click="editModal(record)"
>编辑</span
>
<span class="primary pointer" @click="changePwd(text)"
<span class="primary pointer" @click="changePwd(record)"
>修改密码</span
>
<span class="delete pointer" @click="handleDel(text.id)"
<span class="delete pointer" @click="handleDel(record.id)"
>删除</span
>
</a-space>
</span>
</a-table>
</y-table>
</div>
</div>
<!-- 新增工作人员 -->
......@@ -310,8 +298,8 @@ import EditPersonel from "./components/EditPersonel.vue";
import TabHeader from "@/components/TabHeader";
import local from "@/utils/local";
import { Empty } from "ant-design-vue";
import { pageSizeOptions } from "@/config/pageConfig.js";
import { mapGetters } from "vuex";
import YTable from "@/components/YTable.vue";
// import axios from "axios";
import {
getDeptList,
......@@ -398,6 +386,7 @@ export default {
EditPwd,
EditPersonel,
TabHeader,
YTable,
},
data() {
return {
......@@ -415,13 +404,12 @@ export default {
WorkmanData: [], // 工作人员列表
deptSearch: "", //部门搜索
windowSearch: "", // 窗口搜索
searchType: 1, // 搜索类型
searchType: "name", // 搜索类型
searchVal: "",
visibleAll: false,
page: 1,
size: 10,
total: 0,
pageSizeOptions,
designationDict: {}, // 称号字典
politicalDict: {}, // 政治面貌字典
curDept: "", // 当前选中部门
......@@ -466,11 +454,8 @@ export default {
async getWorkmanData(search = {}) {
this.loading = true;
let obj = {};
if (this.searchType == 1) {
obj.name = `%${this.searchVal}%`;
} else if (this.searchType == 2) {
obj.number = `%${this.searchVal}%`;
}
let value = `%${this.searchVal}%`;
obj[this.searchType] = value;
let res = await getWorkmanList({
siteId: this.siteId,
page: this.page,
......@@ -546,13 +531,6 @@ export default {
onSearch() {
this.page = 1;
this.getWorkmanData();
// if (/^[\u4e00-\u9fa5]+$/.test(val)) {
// this.getWorkmanData({ name: `%${val}%` });
// } else if (/^[a-zA-z0-9]+$/.test(val)) {
// this.getWorkmanData({ number: `%${val}%` });
// } else {
// this.getWorkmanData();
// }
},
// 新增工作人员
showModal() {
......@@ -569,17 +547,6 @@ export default {
this.$refs.EditPersonel.onEdit(data);
// this.$refs.EditPersonel.editWindow(data.deptId);
},
// 翻页
handlePagination(num) {
this.page = num;
this.getWorkmanData();
},
// 改变每页显示数量
showSizeChange(current, size) {
this.page = current;
this.size = size;
this.getWorkmanData();
},
// 批量导入工作人员模板下载
async handleDownload() {
......@@ -623,13 +590,7 @@ export default {
});
if (res.data.code == 1) {
this.$message.success("导入成功");
// this.$notification.success({
// message: "导入结果",
// duration: null,
// description: res.data.msg,
// });
this.getWorkmanData();
// this.spinning = false;
}
} else {
this.$message.error(msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment