Files
UNION_NSI/target/classes/views/platform/data/user/UpdateUser.html
T
2026-09-08 19:49:21 +08:00

554 lines
24 KiB
HTML

<!--#
layout("/layouts/platform.html"){
#-->
<style>
.query-row {
height: 60px;
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: 100px;
}
.el-table__header-wrapper th {
padding: 5px 0 !important;
}
</style>
<div id="app" v-cloak>
<guava ref="guava">
<template>
<el-card shadow="never"
style="margin-bottom: 5px;padding: 0px 10px 5px;">
<el-row type="flex" align="middle" class="query-row">
<el-col class="query-row-title">基础查询:</el-col>
<el-col class="query-row-content">
<div class="btn-group tool-button">
<el-input placeholder="请输入内容" clearable v-model="pageForm.searchKeyword"
@keyup.enter.native="doSearch">
<el-select v-model="pageForm.searchName" slot="prepend"
placeholder="查询类型"
style="width: 100px;">
<el-option label="姓名" value="u.username"></el-option>
<el-option label="工号" value="u.loginname"></el-option>
</el-select>
</el-input>
</div>
<el-row class="btn-group tool-button">
<el-select placeholder="所属单位" v-model="pageForm.unitId"
style="width: 200px;"
clearable="true"
filterable="true">
<el-option v-for="item in units" :label="item.name"
:value="item.id"></el-option>
</el-select>
</el-row>
<div class="btn-group tool-button">
<dict-select v-model="pageForm.personType" style="width: 200px"
clearable placeholder="人员类型"
code="UserType"></dict-select>
</div>
<div class="btn-group tool-button">
<dict-select v-model="pageForm.userState" style="width: 200px" clearable
placeholder="在职状态"
code="UserState"></dict-select>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search"
@click="doSearch"></el-button>
</div>
<div class="pull-right offscreen-right">
<div class="btn-group tool-button">
<el-button @click="clearHistory" slot="reference"
type="primary">
清空历史记录
</el-button>
<el-button :loading="updateBirthdayLoading" @click="updateBirthday"
slot="reference" type="primary">
根据身份证号设置出生日期
</el-button>
<el-button slot="reference" type="primary"
@click="checkSource" :loading="updateLoading">
更新
</el-button>
</div>
</div>
</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">
<div class="btn-group tool-button">
<el-date-picker
style="width: 200px"
v-model="pageForm.changeDate"
type="date"
value-format="yyyy-MM-dd"
placeholder="更新日期">
</el-date-picker>
</div>
<div class="btn-group tool-button">
<enum-select v-model="pageForm.changeType" value="code"
label="description"
style="width: 200px"
clearable placeholder="异动类型"
enum="UserChangeType"></enum-select>
</div>
<div class="btn-group tool-button">
<el-button type="primary" icon="el-icon-search"
@click="doSearch"></el-button>
<el-button type="primary" @click="exportChange">导出异动人员</el-button>
</div>
</el-col>
</el-row>
</el-card>
<el-card shadow="never">
<el-table :data="tableData" style="width: 100%" row-key="id"
@sort-change="pageOrder" :key="tableKey"
v-loading="tableLoading"
lazy
:load="load"
:tree-props="{hasChildren: 'hasHis'}"
border
>
<el-table-column align="center" header-align="center" type="index"
:index="indexMethod" label="序号"
width="80px"></el-table-column>
<el-table-column label="工号" prop="loginname" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="姓名" prop="username" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="性别" prop="sex" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="联系电话" prop="mobile" header-align="center"
align="center" show-overflow-tooltip></el-table-column>
<!-- <el-table-column label="出生日期" prop="birthday" header-align="center"-->
<!-- align="center" show-overflow-tooltip></el-table-column>-->
<!-- <el-table-column label="身份证" prop="idcard" header-align="center"-->
<!-- align="center" show-overflow-tooltip></el-table-column>-->
<el-table-column label="人员类型" prop="personType" header-align="center" sortable
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="在职状态" prop="userState" header-align="center" sortable
align="center" show-overflow-tooltip></el-table-column>
<el-table-column label="所属单位" prop="unitid" header-align="center"
align="center" show-overflow-tooltip sortable>
<template scope="{row}">
<span v-if="row.unitid"> {{row.unitname}}({{row.unitid}})</span>
</template>
</el-table-column>
<el-table-column label="异动信息" header-align="center">
<el-table-column label="更新时间" prop="changeTime" min-width="100px"
header-align="center" sortable
align="center" show-overflow-tooltip>
<!-- <template scope="{row:{changeTime}}">
{{changeTime?changeTime:'暂无'}}
</template>-->
</el-table-column>
<el-table-column label="异动类型" prop="changeType" header-align="center"
align="center" show-overflow-tooltip sortable>
<template scope="{row}">
<span style="color: #0e78c5">{{changeType[row.changeType]}}</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="userOnline" align="center" header-align="center"
label="操作"
min-width="80px">
<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-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<!--#include("/layouts/pagination.html"){}#-->
</el-card>
</template>
<template #view>
<el-tabs v-model="active">
<el-tab-pane label="个人信息" name="info">
<member ref="memberInfo" :source="source" :id="userId" view></member>
</el-tab-pane>
</el-tabs>
</template>
</guava>
<el-dialog
title="选择数据源"
:visible.sync="dialogVisible"
width="50%">
<el-timeline>
<el-timeline-item timestamp="数据源" placement="top">
<el-radio-group class="checkGroup" v-model="sourceTime" style="width: 100%">
<el-row v-for="item in latelyUpdateTimes" style="margin-bottom: 10px">
<el-radio :key="item.pullTime" style="width: 100%"
:label="item.pullTime" border>
时间:{{item.pullTime}}<span
style="float: right;color: #F56C6C">rows: {{item.num}}</span>
</el-radio>
</el-row>
</el-radio-group>
</el-timeline-item>
<el-timeline-item timestamp="更新方式" placement="top">
<el-radio-group class="checkGroup" style="width: 100%" v-model="sourceType">
<el-row>
<el-radio border label="all">全部更新</el-radio>
<el-radio border label="add">仅更新新增人员</el-radio>
<el-radio border label="part">部分更新</el-radio>
</el-row>
</el-radio-group>
</el-timeline-item>
<el-timeline-item timestamp="选择更新组别" placement="top" v-if="sourceType=='part'">
<el-row class="query-row">
<el-col span="12">
<el-select v-model="partGroupId" clearable filterable
placeholder="请选择更新组别" style="width: 100%">
<el-option
v-for="column in partGroupInfos"
:key="column.groupId"
:label="column.groupName"
:value="column.groupId">
</el-option>
</el-select>
</el-col>
<el-col>
<el-checkbox style="margin-left: 10px;margin-top: 4px" v-model="isInvert" label="是否更新此组别之外人员" border></el-checkbox>
<el-button style="margin-left: 10px;margin-top: 4px" type="primary" @click="partUpdate(sourceType)">设置部分更新人员</el-button>
</el-col>
</el-row>
</el-timeline-item>
<el-timeline-item timestamp="过滤字段" placement="top" v-if="sourceType=='part'">
<el-row class="query-row">
<el-col class="query-title" span="6">过滤字段:</el-col>
<el-col style="justify-content: end;margin-left: 10px">
<el-select v-model="columnNames" clearable filterable
placeholder="请选择字段" style="width: 100%" multiple>
<el-option
v-for="column in columnInfos"
:key="column.COLUMN_NAME"
:label="column.COLUMN_COMMENT"
:value="column.COLUMN_NAME">
</el-option>
</el-select>
</el-col>
<el-col class="query-row">
<span style="color: red;margin-left: 10px">该条件为更新时忽略某字段,如无需忽略请勿填充该条件</span>
</el-col>
</el-row>
</el-timeline-item>
</el-timeline>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" :loading="updateLoading" @click="doUpdate">确 定</el-button>
</span>
</el-dialog>
<el-drawer
title="我是标题" size="78%"
:visible.sync="userScopeDialog"
:append-to-body="true"
:with-header="false">
<div style="padding: 0px 16px;" class="clearfix">
<el-button icon="el-icon-back" style="font-size: 16px" type="text"
@click="doBack()">返回
</el-button>
</div>
<guava>
<el-tabs tab-position="top" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="人员设置" name="1">
<template>
<user-upset ref="userUpset"></user-upset>
</template>
</el-tab-pane>
<el-tab-pane label="人员查看" name="2">
<template>
<user-upset-data ref="userUpsetData"></user-upset-data>
</template>
</el-tab-pane>
</el-tabs>
</guava>
</el-drawer>
</div>
<script>
var vue = new Vue({
el: '#app',
mixins: [initTableMixins],
data() {
return {
active: 'info',
updateLoading: false,
updateBirthdayLoading: false,
pageForm: {
searchName: "u.username",
},
userId: "",
unions: [],
units: [],
latelyUpdateTimes: [],
dialogVisible: false,
sourceTime: "",
changeType: {},
source: 'sys_user',
sourceType: null,
activeName: '1',
userScopeDialog: false,
columnNames: [],
columnInfos: [],
upDataCount: '0',
isUpSet: '0',
partGroupId: '',
partGroupInfos: [],
isInvert:'',
}
},
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'),
'enum-select': httpVueLoader('/components/plugins/EnumSelect.vue?v=1.0.0'),
'user-upset': httpVueLoader('/components/userpartupdate/UserPartUpdateSet.vue'),
'user-upset-data': httpVueLoader('/components/userpartupdate/UserDataPartUpSet.vue'),
},
methods: {
async getColumnInfo() {
const {data, msg, code} = await $.post('/platform/activity/basic/scope/getUserTableColumnInfo')
if (code !== 0) {
this.$notify.warning(msg)
return
}
this.columnInfos = data
},
clearHistory() {
this.$confirm('您确定要清空历史记录吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const resp = await $.post(loc() + '/clearHistory')
if (resp.code === 0) {
this.notifySuccess(resp.msg)
this.doSearch()
} else {
this.notifyWarning(resp.msg)
}
})
},
async updateBirthday() {
const confirm = await this.$confirm('是否确定根据身份证号更新出生日期?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
if (confirm === "confirm") {
this.updateBirthdayLoading = true
const resp = await $.post(loc() + '/updateBirthday')
this.updateBirthdayLoading = false
}
},
async load(tree, treeNode, resolve) {
const {loginname} = tree
const resp = await $.get(loc() + "/historyUsers", {loginname})
if (resp.code === 0) {
resolve(resp.data)
} else {
resolve([])
}
},
checkSource() {
if (!this.latelyUpdateTimes.length) {
this.$notify({
title: '警告',
message: '没有可供更新的数据源',
type: 'warning'
});
return
}
this.sourceTime = ''
this.dialogVisible = true
// this.doUpdate()
},
doUpdate() {
if (!this.sourceTime) {
this.$notify({
title: '警告',
message: '请选择数据源',
type: 'warning'
});
return
}
if (!this.sourceType) {
this.$notify({
title: '警告',
message: '请选择更新范围',
type: 'warning'
});
return
}
if (this.sourceType == 'part' && !this.partGroupId) {
this.$notify({
title: '警告',
message: '部分更新请选择更新组别',
type: 'warning'
});
return;
}
this.$confirm('是否确定更新用户数据?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
this.updateLoading = true
const resp = await $.post(loc() + '/update', {
sourceTime: this.sourceTime,
sourceType: this.sourceType,
columnNames: JSON.stringify(this.columnNames),
isUpSet: this.isUpSet,
partGroupId: this.partGroupId,
isInvert: this.isInvert,
})
this.updateLoading = false
if (resp.code === 0) {
this.tableKey = new Date().getTime()
this.pageData()
this.dialogVisible = false
this.reset()
} else {
this.notifyWarning(resp.msg)
}
})
},
reset(){
this.isInvert = ''
this.sourceType = ''
this.partGroupId = ''
},
openView({id, flag}) {
this.active = 'info'
this.userId = id
this.source = flag ? 'sys_user' : 'user_history'
this.$refs.guava.view()
},
dropdownCommand(command) {
const {type, data} = command
if (type == 'view') {
this.openView(data)
}
},
async getLatelyUpdateTimes() {
const resp = await $.get(loc() + "/latelyUpdateTimes")
if (resp.code === 0) {
this.latelyUpdateTimes = resp.data
}
},
async getChangeType() {
const changeType = {}
const changeTypeOptions = await getEnumOptions("UserChangeType")
changeTypeOptions.forEach(v => {
changeType[v.code] = v.description
})
return changeType
},
exportChange() {
const {
searchName,
searchKeyword,
unitId,
personType,
changeDate,
userState
} = this.pageForm
window.open(loc() + '/exportChangePeo?searchName=' + searchName + '&searchKeyword=' + searchKeyword + '&unitId=' + (unitId ? unitId : '') +
'&userState=' + (userState ? userState : '') + '&personType=' + (personType ? personType : '') + '&changeDate=' + (changeDate ? changeDate : ''))
},
async getPartCount() {
const resp = await $.get('/platform/user/part/update/getPartCount')
this.upDataCount = resp.data
},
partUpdate(sourceType) {
if (sourceType === 'part') {
this.userScopeDialog = true
}
this.getPartCount()
},
handleClick() {
if (this.activeName === "2") {
this.$refs.userUpsetData.pageData();
this.$refs.userUpsetData.getActivityGroup();
}
},
async getPartGroupInfos() {
const resp = await $.get('/platform/user/part/update/getUserPart')
this.partGroupInfos = resp.data
},
doBack(){
this.userScopeDialog = false
this.getPartGroupInfos();
}
},
async created() {
this.pageData();
this.units = await getUnits()
await this.getLatelyUpdateTimes()
this.changeType = await this.getChangeType()
await this.getColumnInfo()
await this.getPartGroupInfos()
}
})
</script>
<!--#
}
#-->