570 lines
26 KiB
HTML
570 lines
26 KiB
HTML
<!--#
|
||
layout("/layouts/platform.html"){
|
||
#-->
|
||
<style>
|
||
.el-tabs__content {
|
||
padding-top: 20px;
|
||
}
|
||
|
||
.el-dialog__body div div {
|
||
color: #ff0000;
|
||
margin-bottom: 10px;
|
||
}
|
||
|
||
.query-row {
|
||
height: 70px;
|
||
display: flex;
|
||
justify-content: center;
|
||
align-items: center;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.query-row:not(:last-child) {
|
||
border-bottom: 1px dashed rgb(230, 230, 230);
|
||
}
|
||
|
||
/*.query-row:not(:last-child,:first-child) {*/
|
||
/* height: 70px;*/
|
||
/*}*/
|
||
|
||
.query-row-title {
|
||
width: 120px;
|
||
}
|
||
</style>
|
||
|
||
<div id="app" v-cloak>
|
||
<guava ref="guava">
|
||
<template>
|
||
|
||
<el-card shadow="never">
|
||
<div class="search">
|
||
<div class="search-item">
|
||
<div class="search-item-label">职工信息:</div>
|
||
<div class="search-item-option">
|
||
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
|
||
style="width: 100%"
|
||
@keyup.enter.native="doSearch">
|
||
<el-select v-model="pageForm.searchName" slot="prepend" placeholder="查询类型"
|
||
style="width: 80px;">
|
||
<el-option label="姓名" value="username"></el-option>
|
||
<el-option label="工号" value="loginname"></el-option>
|
||
</el-select>
|
||
</el-input>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="search-item">
|
||
<div class="search-item-label">所属工会:</div>
|
||
<div class="search-item-option">
|
||
<el-select placeholder="所属工会" v-model="pageForm.unionId" style="width: 100%;"
|
||
clearable
|
||
@change="flushUnits" @clear="flushUnits"
|
||
filterable>
|
||
<el-option v-for="item in unions" :label="item.unionname" :value="item.id"></el-option>
|
||
</el-select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="search-item">
|
||
<div class="search-item-label">所属单位:</div>
|
||
<div class="search-item-option">
|
||
<el-select placeholder="所属单位" v-model="pageForm.unitId" style="width: 100%;"
|
||
@change="getThreeUnits"
|
||
clearable
|
||
filterable>
|
||
<el-option v-for="item in units" :label="item.name" :value="item.id"></el-option>
|
||
</el-select>
|
||
</div>
|
||
</div>
|
||
|
||
<template v-if="searchMore">
|
||
<!-- <div class="search-item">-->
|
||
<!-- <div class="search-item-label">工会小组:</div>-->
|
||
<!-- <div class="search-item-option">-->
|
||
<!-- <el-select v-model="pageForm.unionGroupId" style="width: 100%"-->
|
||
<!-- filterable-->
|
||
<!-- clearable-->
|
||
<!-- @change="getThreeUnits"-->
|
||
<!-- placeholder="请选择">-->
|
||
<!-- <el-option-->
|
||
<!-- v-for="item in unionGroups"-->
|
||
<!-- :key="item.id"-->
|
||
<!-- :label="item.groupName"-->
|
||
<!-- :value="item.id">-->
|
||
<!-- </el-option>-->
|
||
<!-- </el-select>-->
|
||
<!-- </div>-->
|
||
<!-- </div>-->
|
||
|
||
<!-- <div class="search-item">-->
|
||
<!-- <div class="search-item-label">组成科室:</div>-->
|
||
<!-- <div class="search-item-option">-->
|
||
<!-- <el-select v-model="pageForm.threeUnitId" style="width: 100%" filterable-->
|
||
<!-- clearable-->
|
||
<!-- placeholder="请选择">-->
|
||
<!-- <el-option-->
|
||
<!-- v-for="item in threeUnits"-->
|
||
<!-- :key="item.id"-->
|
||
<!-- :label="item.name"-->
|
||
<!-- :value="item.id">-->
|
||
<!-- </el-option>-->
|
||
<!-- </el-select>-->
|
||
<!-- </div>-->
|
||
<!-- </div>-->
|
||
|
||
|
||
<!--<div class="search-item">
|
||
<div class="search-item-label">人员类型:</div>
|
||
<div class="search-item-option">
|
||
<dict-select v-model="pageForm.personType" style="width: 100%" clearable
|
||
placeholder="人员类型"
|
||
code="UserType"></dict-select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="search-item">
|
||
<div class="search-item-label">在职状态:</div>
|
||
<div class="search-item-option">
|
||
<dict-select v-model="pageForm.userState" style="width: 100%" clearable
|
||
placeholder="在职状态"
|
||
code="UserState"></dict-select>
|
||
</div>
|
||
</div>-->
|
||
|
||
<div class="search-item">
|
||
<div class="search-item-label">性  别:</div>
|
||
<div class="search-item-option">
|
||
<el-select v-model="pageForm.sex" style="width: 100%" clearable
|
||
placeholder="请选择">
|
||
<el-option v-for="sex in sexOptions" :label="sex" :value="sex"></el-option>
|
||
</el-select>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="search-item">
|
||
<div class="search-item-label">职  务:</div>
|
||
<div class="search-item-option">
|
||
<el-input placeholder="请输入内容" clearable v-model="pageForm.position"
|
||
@keyup.enter.native="doSearch">
|
||
</el-input>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="search-item">
|
||
<div class="search-item-label">职  称:</div>
|
||
<div class="search-item-option">
|
||
<el-input placeholder="请输入内容" clearable v-model="pageForm.jobTitle"
|
||
@keyup.enter.native="doSearch">
|
||
</el-input>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- <div class="search-item">
|
||
<div class="search-item-label">会员状态:</div>
|
||
<div class="search-item-option">
|
||
<dict-select v-model="pageForm.memberStatus" style="width: 100%" clearable
|
||
placeholder="会员状态" code="memberStatusText"></dict-select>
|
||
</div>
|
||
</div>-->
|
||
|
||
|
||
</template>
|
||
|
||
|
||
<div class="search-query">
|
||
<el-button type="primary" icon="el-icon-search" @click="doSearch">搜索</el-button>
|
||
|
||
<more v-model="searchMore"></more>
|
||
</div>
|
||
</div>
|
||
</el-card>
|
||
|
||
<el-card shadow="never" style="margin-top: 10px">
|
||
<el-row type="flex" align="middle" class="query-row">
|
||
<el-col class="query-row-title">人员类型:</el-col>
|
||
<el-col class="query-row-content">
|
||
|
||
<el-tag
|
||
style="margin-right: 10px;cursor: pointer"
|
||
v-for="item in personTypeOptions"
|
||
:key="item.code"
|
||
:type="item.name"
|
||
:effect="pageForm.personTypes.includes(item.name)?'dark':'plain'"
|
||
@click="checkPersonType(item.name)">
|
||
{{ item.name }}
|
||
</el-tag>
|
||
|
||
<el-link type="danger" v-if="personTypeOptions.length&&pageForm.personTypes.length"
|
||
:underline="false"
|
||
@click="pageForm.personTypes=[];doSearch()">清空
|
||
</el-link>
|
||
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-row type="flex" align="middle" class="query-row">
|
||
<el-col class="query-row-title">在职状态:</el-col>
|
||
<el-col class="query-row-content">
|
||
<el-tag
|
||
style="margin-right: 10px;cursor: pointer"
|
||
v-for="item in userStateOptions"
|
||
:key="item.code"
|
||
:type="item.name"
|
||
:effect="pageForm.userStates.includes(item.name)?'dark':'plain'"
|
||
@click="checkUserStateType(item.name)">
|
||
{{ item.name }}
|
||
</el-tag>
|
||
|
||
<el-link type="danger" v-if="userStateOptions.length&&pageForm.userStates.length"
|
||
:underline="false"
|
||
@click="pageForm.userStates=[];doSearch()">清空
|
||
</el-link>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
<el-row type="flex" align="middle" class="query-row">
|
||
<el-col class="query-row-title">模糊查询:</el-col>
|
||
<el-col class="query-row-content">
|
||
<member-cnd @cnd="(v)=>pageForm={...pageForm,...v}"></member-cnd>
|
||
</el-col>
|
||
</el-row>
|
||
|
||
</el-card>
|
||
|
||
|
||
<el-card shadow="never" class="mt10">
|
||
<table-tool label="会员列表" :app="this">
|
||
<template #func>
|
||
<el-button type="primary" v-if="${@shiro.hasRole('sysadmin')}" size="small" icon="el-icon-time"
|
||
@click="openArchive"
|
||
>备份历史会员
|
||
</el-button>
|
||
<el-button type="primary" size="small" icon="el-icon-download" @click="exportMember">固定格式导出
|
||
</el-button>
|
||
</template>
|
||
</table-tool>
|
||
|
||
<el-table :data="tableData" style="width: 100%" row-key="id" @sort-change="pageOrder"
|
||
v-loading="tableLoading" :size="tableSize" class="vi-table">
|
||
|
||
<el-table-column align="center" header-align="center" type="index" :index="indexMethod" label="序号"
|
||
width="80px"></el-table-column>
|
||
|
||
<el-table-column
|
||
show-overflow-tooltip
|
||
align="center"
|
||
header-align="center"
|
||
v-for="column in tableColumns"
|
||
:label="column.label"
|
||
:prop="column.prop"
|
||
:sortable="column.sortable"
|
||
:width="column.width"
|
||
min-width="50"
|
||
>
|
||
<template v-if="column.prop==='unitname'" scope="{row}">
|
||
{{isDisPlayCode?'('+row.unitcode+')':null}}{{row.unitname}}
|
||
</template>
|
||
<template v-else-if="column.prop==='unionname'" scope="{row}">
|
||
{{isDisPlayCode?'('+row.unioncode+')':null}}{{row.unionname}}
|
||
</template>
|
||
</el-table-column>
|
||
|
||
<el-table-column prop="userOnline" align="center" header-align="center" label="操作" fixed="right">
|
||
<template scope="scope">
|
||
<el-dropdown @command="dropdownCommand">
|
||
<el-button plain size="mini">
|
||
<i class="ti-settings"></i>
|
||
<span class="ti-angle-down"></span>
|
||
</el-button>
|
||
<el-dropdown-menu slot="dropdown">
|
||
<el-dropdown-item :command="{type:'view',data:scope.row}">
|
||
查看
|
||
</el-dropdown-item>
|
||
|
||
|
||
<el-dropdown-item
|
||
v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}"
|
||
:command="{type:'edit',data:scope.row}">
|
||
编辑
|
||
</el-dropdown-item>
|
||
|
||
<!-- <el-dropdown-item v-if="${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" :command="{type:'delete',data:scope.row}">-->
|
||
<!-- 删除-->
|
||
<!-- </el-dropdown-item>-->
|
||
|
||
|
||
</el-dropdown-menu>
|
||
</el-dropdown>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
|
||
<!--#include("/layouts/pagination.html"){}#-->
|
||
</el-card>
|
||
</template>
|
||
|
||
<template #edit>
|
||
<member ref="member" :id="userId"></member>
|
||
</template>
|
||
|
||
<template #view>
|
||
<el-tabs v-model="active">
|
||
<el-tab-pane label="个人信息" name="info">
|
||
<member ref="memberInfo" :id="userId" view></member>
|
||
</el-tab-pane>
|
||
<el-tab-pane label="变更记录" name="change">
|
||
<mem-change-records :userid="userId"></mem-change-records>
|
||
</el-tab-pane>
|
||
</el-tabs>
|
||
|
||
</template>
|
||
</guava>
|
||
|
||
<el-dialog
|
||
:visible.sync="archiveDialogVisible"
|
||
width="20%">
|
||
<el-divider class="labelYear">{{labelYear}}</el-divider>
|
||
<el-form :model="formData" ref="form" :rules="formRules" label-width="80px">
|
||
<el-form-item prop="year" label="备份年份" style="align-content: center">
|
||
<el-date-picker
|
||
placeholder="请选择备份年份"
|
||
value-format="yyyy"
|
||
v-model="formData.year"
|
||
type="year"
|
||
:picker-options="pickerOptions">
|
||
</el-date-picker>
|
||
</el-form-item>
|
||
</el-form>
|
||
|
||
<span slot="footer" class="dialog-footer">
|
||
<el-button @click="archiveDialogVisible = false">取 消</el-button>
|
||
<el-button type="primary" @click="archive" :loading="archiveLoading">确 定</el-button>
|
||
</span>
|
||
</el-dialog>
|
||
|
||
</div>
|
||
|
||
<script>
|
||
var vue = new Vue({
|
||
el: '#app',
|
||
mixins: [initTableMixins],
|
||
data() {
|
||
return {
|
||
labelYear: "",
|
||
archiveDialogVisible: false,
|
||
archiveLoading: false,
|
||
sexOptions: ['男', '女'],
|
||
|
||
submitLoading: false,
|
||
pageForm: {
|
||
personTypes: [],
|
||
userStates: [],
|
||
searchName: "username",
|
||
},
|
||
|
||
userId: "",
|
||
unions: [],
|
||
units: [],
|
||
active: 'info',
|
||
tableColumns: [
|
||
{prop: 'loginname', label: '工号'},
|
||
{prop: 'username', label: '姓名'},
|
||
{prop: 'sex', label: '性别'},
|
||
{prop: 'birthday', label: '出生年月', sortable: true},
|
||
{prop: 'mobile', label: '联系电话'},
|
||
{prop: 'idcard', label: '身份证号', width: 170},
|
||
{prop: 'position', label: '职务', sortable: true, checked: 0},
|
||
{prop: 'jobTitle', label: '职称', sortable: true, checked: 0},
|
||
{prop: 'personType', label: '人员类型', sortable: true},
|
||
{prop: 'userState', label: '在职状态', sortable: true},
|
||
{prop: 'unionname', label: '所属工会', sortable: true},
|
||
{prop: 'unitname', label: '所属单位', sortable: true},
|
||
// {prop: 'threeUnitName', label: '所在科室', sortable: true},
|
||
// {prop: 'unionGroupName', label: '工会小组', sortable: true},
|
||
{prop: 'campusName', label: '所属校区', sortable: true, checked: 0},
|
||
{prop: 'marriage', label: '婚否', checked: 0},
|
||
{prop: 'education', label: '学历', checked: 0},
|
||
{prop: 'hometown', label: '籍贯', checked: 0},
|
||
{prop: 'nation', label: '民族', checked: 0},
|
||
{prop: 'memberNumber', label: '会员号', checked: 0},
|
||
],
|
||
personTypeOptions: [],
|
||
userStateOptions: [],
|
||
formRules: {
|
||
year: [{required: true, message: '请选择备份年份', trigger: ['blur', 'change']}]
|
||
},
|
||
pickerOptions: {
|
||
disabledDate(time) {
|
||
return (
|
||
time.getFullYear() > new Date().getFullYear() - 1
|
||
);
|
||
}
|
||
},
|
||
}
|
||
},
|
||
components: {
|
||
'guava': httpVueLoader('/components/plugins/Guava.vue'),
|
||
'member': httpVueLoader('/components/member/MemberInfo.vue?v=1.0.3'),
|
||
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
|
||
'mem-change-records': httpVueLoader('/components/member/MemChangeRecords.vue?v=1.0.2'),
|
||
'member-cnd': httpVueLoader('/components/member/MemberCnd.vue'),
|
||
},
|
||
methods: {
|
||
checkUserStateType(state) {
|
||
let idx = this.pageForm.userStates.indexOf(state)
|
||
if (idx != -1) {
|
||
this.pageForm.userStates.splice(idx, 1)
|
||
} else {
|
||
this.pageForm.userStates.push(state)
|
||
}
|
||
this.doSearch()
|
||
},
|
||
checkPersonType(type) {
|
||
let idx = this.pageForm.personTypes.indexOf(type)
|
||
if (idx != -1) {
|
||
this.pageForm.personTypes.splice(idx, 1)
|
||
} else {
|
||
this.pageForm.personTypes.push(type)
|
||
}
|
||
this.doSearch()
|
||
},
|
||
|
||
openArchive() {
|
||
this.$set(this.formData, "year", new Date().getFullYear() - 1 + '')
|
||
this.labelYear = "把当前数据备份成为" + this.formData.year + "年份的历史数据"
|
||
this.archiveDialogVisible = true
|
||
},
|
||
async archive() {
|
||
this.archiveLoading = true
|
||
const yearNum = await $.get(loc() + "/getMemberHistoryNum", {year: this.formData.year})
|
||
if (yearNum > 0) {
|
||
this.$confirm('您今年已备份确定要覆盖吗?', '提示', {
|
||
confirmButtonText: '确定',
|
||
cancelButtonText: '取消',
|
||
type: 'warning',
|
||
callback: async (a, b) => {
|
||
if ("confirm" === a) {//确认后再执行
|
||
const resp = await $.get(loc() + "/archive", {year: this.formData.year})
|
||
this.archiveLoading = false
|
||
if (resp.code === 0) {
|
||
this.archiveDialogVisible = false
|
||
} else {
|
||
this.notifyWarning(resp.msg)
|
||
}
|
||
}
|
||
}
|
||
});
|
||
} else {
|
||
const resp = await $.get(loc() + "/archive", {year: this.formData.year})
|
||
this.archiveLoading = false
|
||
if (resp.code === 0) {
|
||
this.archiveDialogVisible = false
|
||
} else {
|
||
this.notifyWarning(resp.msg)
|
||
}
|
||
}
|
||
},
|
||
exportMember() {
|
||
const personTypes = JSON.stringify(this.pageForm.personTypes)
|
||
const userStates = JSON.stringify(this.pageForm.userStates)
|
||
let arr = Object.keys(this.pageForm).map(key => {
|
||
return {key: key, value: this.pageForm[key]}
|
||
})
|
||
let props = {}
|
||
this.tableColumns.forEach(v => {
|
||
props[v.prop] = v.label
|
||
})
|
||
location.href = loc() + '/export?userStates=' + userStates + '&personTypes=' + personTypes + '+&props=' + JSON.stringify(props) + "&" + arr.filter(v => v.value).map(v => v.key + "=" + v.value).join("&")
|
||
},
|
||
doDelete(userId) {
|
||
this.$confirm('确定要删除吗?', '提示', {
|
||
confirmButtonText: '确定',
|
||
cancelButtonText: '取消',
|
||
type: 'warning',
|
||
callback: async (a, b) => {
|
||
if ("confirm" === a) {//确认后再执行
|
||
const resp = await $.post(loc() + "/delete", {userId});
|
||
if (resp.code === 0) {
|
||
this.pageData()
|
||
} else {
|
||
this.notifyWarning(resp.msg)
|
||
}
|
||
}
|
||
}
|
||
});
|
||
},
|
||
|
||
openEdit(userId) {
|
||
this.userId = userId
|
||
this.$refs.guava.edit()
|
||
},
|
||
afterEdit() {
|
||
this.userId = ''
|
||
this.pageData()
|
||
this.$refs.guava.index()
|
||
},
|
||
openView(userId) {
|
||
this.active = 'info'
|
||
this.userId = userId
|
||
this.$refs.guava.view()
|
||
},
|
||
dropdownCommand(command) {
|
||
const {type, data} = command
|
||
if (type == 'view') {
|
||
this.openView(data.id)
|
||
} else if (type == 'edit') {
|
||
this.openEdit(data.id)
|
||
} else if (type == 'delete') {
|
||
this.doDelete(data.id)
|
||
}
|
||
},
|
||
|
||
async flushUnits() {
|
||
this.$set(this.pageForm, "unitId", null)
|
||
this.$set(this.pageForm, "unionGroupId", null)
|
||
this.$set(this.pageForm, "threeUnitId", null)
|
||
this.units = []
|
||
this.unionGroups = []
|
||
this.threeUnits = []
|
||
if (this.pageForm.unionId) {
|
||
this.units = await getUnits(this.pageForm.unionId)
|
||
this.unionGroups = await unionGroupsByUnionId(this.pageForm.unionId)
|
||
}
|
||
},
|
||
pageData() {
|
||
sublime.showLoadingbar();
|
||
this.tableLoading = true
|
||
|
||
const pageForm = clone(this.pageForm)
|
||
pageForm.personTypes = JSON.stringify(pageForm.personTypes)
|
||
pageForm.userStates = JSON.stringify(pageForm.userStates)
|
||
|
||
$.post(loc() + "/pageData", pageForm, (data) => {
|
||
sublime.closeLoadingbar();
|
||
this.tableLoading = false
|
||
if (data.code == 0) {
|
||
this.tableData = data.data.list;
|
||
this.pageForm.totalCount = data.data.totalCount;
|
||
} else {
|
||
this.$message.error(data.msg);
|
||
}
|
||
}, "json");
|
||
},
|
||
},
|
||
async created() {
|
||
this.pageData();
|
||
if ("${@shiro.hasRole('sysadmin')||@shiro.hasRole('A06')||@shiro.hasRole('H03')}" === 'true') {
|
||
this.unions = await getUnions(null, false)
|
||
} else {
|
||
this.unions = await getUnions(null, true)
|
||
this.$set(this.pageForm, 'unionId', this.unions ? this.unions[0].id : null)
|
||
this.flushUnits()
|
||
}
|
||
this.personTypeOptions = await getDictOptions("UserType")
|
||
this.userStateOptions = await getDictOptions("UserState")
|
||
}
|
||
})
|
||
</script>
|
||
<!--#
|
||
}
|
||
#--> |