This commit is contained in:
2025-08-14 14:28:27 +08:00
parent 6203a06eaa
commit 8f563d361e
7 changed files with 673 additions and 592 deletions
@@ -95,7 +95,7 @@
<dict-select v-model="pageForm.personType" style="width: 100%" clearable
placeholder="人员类型"
@change="doSearch"
code="PERSON_TYPE"></dict-select>
code="UserType"></dict-select>
</div>
</div>
@@ -105,7 +105,7 @@
<dict-select v-model="pageForm.userState" style="width: 100%" clearable
placeholder="在职状态"
@change="doSearch"
code="USER_STATE"></dict-select>
code="UserState"></dict-select>
</div>
</div>
@@ -118,10 +118,13 @@
<el-card shadow="never" class="mt10">
<table-tool :label="currentGroupName" :app="this">
<template #label_end>
<!-- <span class="text-danger pl5">提醒删除活动分组操作请先选择某个活动分组后再点击右边的删除按钮</span>-->
<!-- <span class="text-danger pl5">提醒删除活动分组操作请先选择某个活动分组后再点击右边的删除按钮</span>-->
</template>
<template #func>
<el-button v-if="is_sysadmin||is_A06"
type="primary" size="medium" icon="el-icon-printer" @click="dialogVisible = true">
导入XLSX查询
</el-button>
<el-button @click="doExportUser" icon="el-icon-printer"
size="medium" type="primary" :disabled="!pageForm.groupId">
导出活动分组人员xlsx
@@ -133,7 +136,7 @@
</el-button>
</template>
</table-tool>
<el-table ref="userTable" :data="tableData" stripe border :size="tableSize">
<el-table ref="userTable" :data="tableData" stripe border :size="tableSize" @sort-change="pageOrder">
<el-table-column type="index" label="序号" width="80px"></el-table-column>
<el-table-column
align="center"
@@ -164,6 +167,68 @@
</el-row>
</el-card>
<el-dialog title="人员导入" :visible.sync="dialogVisible" width="50%" :close-on-click-modal="false" append-to-body>
<el-timeline>
<el-timeline-item timestamp="下载模板" placement="top">
<el-card>
<el-button size="medium" type=""
@click="window.open('/platform/activity/basic/user/downloadImport')"
icon="el-icon-download">下载模板
</el-button>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="上传文件" placement="top">
<el-card>
<el-upload
name="file"
ref="upload"
:on-remove="(file, fileList) => {
importData.fileList = fileHandleRemove(file, fileList)
}"
:on-change="(file, fileList) => {
importData.fileList = fileHandleChange(file, fileList,{type:['xls','xlsx']})
}"
:auto-upload="false"
:limit="1"
:file-list="importData.fileList">
<el-button size="medium" type="" icon="el-icon-upload"
style="width: 200px">选择文件
</el-button>
<div class="el-upload__tip" slot="tip" style="color: #F56C6C">
只能上传 xls/xlsx 文件
</div>
</el-upload>
</el-card>
</el-timeline-item>
<el-timeline-item placement="top" timestamp="导入结果">
<el-card shadow="never">
<p>总记录数:{{ errorInfoData.totalCount }}</p>
<p>成功数:<span class="text-success">{{ errorInfoData.successCount }}</span></p>
<p>错误数:<span class="text-danger">{{ errorInfoData.errorCount }}</span></p>
<el-link @click="exportErrors" type="primary" v-if="errorInfoData.errorCount>0">下载错误记录
</el-link>
</el-card>
</el-timeline-item>
</el-timeline>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" type="primary"
:disabled="importLoading">取 消</el-button>
<el-button type="primary" @click="clearSearchCnd"
:loading="importLoading">清空查询条件</el-button>
<el-button type="primary" @click="doImport" :loading="importLoading">核对人员</el-button>
<el-button type="primary" @click="doImportSearch"
:loading="importLoading">查询人员</el-button>
</span>
</el-dialog>
</div>
@@ -218,7 +283,7 @@ module.exports = {
tableColumns: [
{prop: 'loginName', label: '工号'},
{prop: 'userName', label: '姓名'},
{prop: 'sex', label: '性别'},
{prop: 'sex', label: '性别', sortable: true},
{prop: 'birthday', label: '出生年月'},
{prop: 'mobile', label: '联系电话'},
{prop: 'personType', label: '人员类型', sortable: true},
@@ -230,13 +295,122 @@ module.exports = {
],
roleData: {},
currentGroupName: null,
errorInfoData: {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: 0,
},
dialogVisible: false,
importLoading: false,
importData: {
fileList: [],
},
successUserIdList: []
}
},
mixins: [initTableMixins],
components: {
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0')
'dict-select': httpVueLoader('/components/plugins/DictSelect.vue?v=1.0.0'),
'file-import': httpVueLoader('/components/plugins/FileImport.vue')
},
methods: {
clearSearchCnd() {
this.importData = {
fileList: [],
}
this.errorInfoData = {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: [],
}
this.pageForm.userIds = []
this.successUserIdList = []
this.doSearch()
this.dialogVisible = false;
$.get('/platform/activity/basic/user/clearSearchCnd', {existsLoginNameRedisKey: this.pageForm.existsLoginNameRedisKey}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
})
},
doImportSearch() {
this.doSearch()
this.dialogVisible = false
},
exportErrors() {
const data = this.errorInfoData.errorList
// 创建工作簿
const workbook = XLSX.utils.book_new();
// 创建工作表
const worksheet = XLSX.utils.json_to_sheet(data);
// 将工作表添加到工作簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// 将工作簿转换为二进制对象
const excelBuffer = XLSX.write(workbook, {bookType: 'xlsx', type: 'array'});
// 将二进制对象转换为Blob对象
const blob = new Blob([excelBuffer], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
// 创建下载链接并设置相关属性
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = '核对记录.xlsx';
// 模拟点击下载链接
document.body.appendChild(link);
link.click();
// 清理下载链接
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
},
doImport() {
if (this.importData.fileList.length === 0) {
this.notifyWarning("请选择文件")
return
}
const data = new FormData();
data.append("groupId", this.pageForm.groupId)
this.importData.fileList.forEach((val) => {
data.append("file", val.raw, val.raw.name);
});
this.importLoading = true
$.ajax({
url: "/platform/activity/basic/user/doImport",
type: "post",
data: data,
processData: false,
contentType: false,
success: (data) => {
this.importLoading = false
if (data.code === 0) {
this.notifySuccess("核对成功")
this.errorInfoData = data.data
} else {
this.notifyWarning("核对失败")
}
this.errorInfoData = data.data
this.pageForm.existsLoginNameRedisKey = data.data.existsLoginNameRedisKey
},
error: (data) => {
this.notifyWarning("导入失败")
this.importLoading = false
}
});
},
viewGroupName() {
if (this.pageForm.groupId) {
const group = this.activityGroupList.find(v => v.groupId === this.pageForm.groupId)
@@ -259,7 +433,9 @@ module.exports = {
type: 'warning'
})
if (confirm === 'confirm') {
const resp = await $.post('/platform/activity/basic/user/doDelete', {id, groupId})
this.pageForm.id=id
this.pageForm.groupId=groupId
const resp = await $.post('/platform/activity/basic/user/doDelete', this.pageForm)
if (resp.code === 0) {
this.$message.success(resp.msg)
this.$set(this.pageForm, "groupId", null)
@@ -271,13 +447,12 @@ module.exports = {
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
this.units = await getUnits(this.pageForm.unionId)
/* if (this.is_A06 || this.is_sysadmin || this.is_H03) {
if (this.is_A06 || this.is_sysadmin || this.is_H03) {
this.units = await getUnits(this.pageForm.unionId)
this.ActivityUnits = await getActivityUnits(this.pageForm.activityUnionId)
} else {
this.units = await getUnits(this.unionid)
}*/
}
},
async getActivityGroup() {
this.pageForm.groupId = ''
@@ -288,6 +463,11 @@ module.exports = {
}
await this.pageData()
},
pageOrder(column) {
this.pageForm.pageOrderName = column.prop
this.pageForm.pageOrderBy = column.order
this.pageData()
},
async pageData() {
sublime.showLoadingbar()
const resp = await $.post('/platform/activity/basic/user/pageData', this.pageForm)
@@ -297,14 +477,19 @@ module.exports = {
}
sublime.closeLoadingbar()
},
async getRolesAndUnion() {
const {data} = await $.post("/platform/activity/basic/scope/getRolesAndUnion")
this.roleData = data
}
},
async created() {
this.unions = await getUnions(null)
// this.ActivityUnions = await getActivityUnions()
this.ActivityUnions = await getActivityUnions()
await this.flushUnits()
await this.getActivityGroup()
this.viewGroupName()
await this.getRolesAndUnion()
}
}
@@ -17,7 +17,7 @@
</el-row>
<el-row class="query-row"
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true">
<el-col class="query-title hidden-xs-only">会员类型</el-col>
<el-col class="query-content">
<el-tag
@@ -48,7 +48,7 @@
</el-row>
<el-row class="query-row"
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
<el-col class="query-title">人员类型</el-col>
<el-col class="query-content">
<el-tag
@@ -75,7 +75,7 @@
</el-row>
<el-row class="query-row"
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
<el-col class="query-title">在职状态</el-col>
<el-col class="query-content">
<el-tag
@@ -101,7 +101,7 @@
<el-row class="query-row"
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
<el-col class="query-title">部门查询</el-col>
<el-col class="query-content">
<el-row :gutter="20">
@@ -130,7 +130,7 @@
</el-col>
</el-row>
<template v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
<template v-if="is_H10===true||is_A06===true||is_sysadmin===true">
<!--<el-row class="query-row">
<el-col class="query-title">活动部门</el-col>
@@ -208,11 +208,12 @@
</template>
<el-row class="query-row"
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true">
<el-col class="query-title">协会</el-col>
<el-col class="query-content">
<el-select v-model="pageForm.clubId" placeholder="请选择协会" @change="doSearch"
filterable
:clearable="is_H10===true||is_A06===true||is_sysadmin===true||(is_H04===true&&is_H02===true)"
style="width: 100%">
<el-option
v-for="item in clubOptions"
@@ -237,7 +238,7 @@
</el-row>
<el-row class="query-row"
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
<el-col class="query-title">年龄范围</el-col>
<el-col class="query-content">
<el-row type="flex" style="align-items: center">
@@ -258,7 +259,7 @@
<el-row class="query-row"
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H02===true||is_H04===true">
v-if="is_H10===true||is_A06===true||is_sysadmin===true||is_H04===true">
<el-col class="query-title">条件匹配</el-col>
<el-col class="query-content">
<user-cnd @cnd="(v)=>{this.$set(this.pageForm,'activityUserCnd',v)}"></user-cnd>
@@ -279,6 +280,10 @@
<el-card class="mt10" shadow="never">
<table-tool :app="this" label="筛选人员">
<template #func>
<el-button v-if="is_sysadmin||is_A06"
type="primary" size="medium" icon="el-icon-printer" @click="dialogVisible = true">
导入XLSX设置分组
</el-button>
<el-button @click="doExportUser"
size="medium"
type="primary" icon="el-icon-download">
@@ -349,6 +354,67 @@
v-loading="settingLoading"> </el-button>
</span>
</el-dialog>
<el-dialog title="人员导入" :visible.sync="dialogVisible" width="50%" :close-on-click-modal="false" append-to-body>
<el-timeline>
<el-timeline-item timestamp="下载模板" placement="top">
<el-card>
<el-button size="medium" type=""
@click="window.open('/platform/activity/basic/user/downloadImport')"
icon="el-icon-download">下载模板
</el-button>
</el-card>
</el-timeline-item>
<el-timeline-item timestamp="上传文件" placement="top">
<el-card>
<el-upload
name="file"
ref="upload"
:on-remove="(file, fileList) => {
importData.fileList = fileHandleRemove(file, fileList)
}"
:on-change="(file, fileList) => {
importData.fileList = fileHandleChange(file, fileList,{type:['xls','xlsx']})
}"
:auto-upload="false"
:limit="1"
:file-list="importData.fileList">
<el-button size="medium" type="" icon="el-icon-upload"
style="width: 200px">选择文件
</el-button>
<div class="el-upload__tip" slot="tip" style="color: #F56C6C">
只能上传 xls/xlsx 文件
</div>
</el-upload>
</el-card>
</el-timeline-item>
<el-timeline-item placement="top" timestamp="导入结果">
<el-card shadow="never">
<p>总记录数:{{ errorInfoData.totalCount }}</p>
<p>成功数:<span class="text-success">{{ errorInfoData.successCount }}</span></p>
<p>错误数:<span class="text-danger">{{ errorInfoData.errorCount }}</span></p>
<el-link @click="exportErrors" type="primary" v-if="errorInfoData.errorCount>0">下载错误记录
</el-link>
</el-card>
</el-timeline-item>
</el-timeline>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false" type="primary"
:disabled="importLoading">取 消</el-button>
<el-button type="primary" @click="clearSearchCnd"
:loading="importLoading">清空查询条件</el-button>
<el-button type="primary" @click="doImport" :loading="importLoading">核对人员</el-button>
<el-button type="primary" @click="doImportSearch"
:loading="importLoading">查询人员</el-button>
</span>
</el-dialog>
</div>
</template>
@@ -434,7 +500,19 @@ module.exports = {
setGroupName: [{required: true, message: '请输入分组名称', trigger: ['blur', 'change']}]
},
relatedSessionMenus: ['aca4d14498c145ceb5b24ed70776aae2', '733d7266652740a3aeac9da97ab5eeca', 'fe2d0768e26d4a80beeb159306bb8d01'],
roleData: {}
roleData: {},
dialogVisible: false,
importLoading: false,
importData: {
fileList: [],
},
errorInfoData: {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: 0,
},
}
},
computed: {
@@ -461,6 +539,98 @@ module.exports = {
'user-cnd': httpVueLoader('/components/plugins/UserCnd.vue'),
},
methods: {
exportErrors() {
const data = this.errorInfoData.errorList
// 创建工作簿
const workbook = XLSX.utils.book_new();
// 创建工作表
const worksheet = XLSX.utils.json_to_sheet(data);
// 将工作表添加到工作簿
XLSX.utils.book_append_sheet(workbook, worksheet, 'Sheet1');
// 将工作簿转换为二进制对象
const excelBuffer = XLSX.write(workbook, {bookType: 'xlsx', type: 'array'});
// 将二进制对象转换为Blob对象
const blob = new Blob([excelBuffer], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'});
// 创建下载链接并设置相关属性
const url = window.URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = '核对记录.xlsx';
// 模拟点击下载链接
document.body.appendChild(link);
link.click();
// 清理下载链接
document.body.removeChild(link);
window.URL.revokeObjectURL(url);
},
doImportSearch() {
this.doSearch()
this.dialogVisible = false
},
doImport() {
if (this.importData.fileList.length === 0) {
this.notifyWarning("请选择文件")
return
}
const data = new FormData();
this.importData.fileList.forEach((val) => {
data.append("file", val.raw, val.raw.name);
});
this.importLoading = true
$.ajax({
url: "/platform/activity/basic/scope/doImport",
type: "post",
data: data,
processData: false,
contentType: false,
success: (data) => {
this.importLoading = false
if (data.code === 0) {
this.notifySuccess("核对成功")
this.errorInfoData = data.data
} else {
this.notifyWarning("核对失败")
}
this.errorInfoData = data.data
this.pageForm.existsLoginNameRedisKey = data.data.existsLoginNameRedisKey
},
error: (data) => {
this.notifyWarning("导入失败")
this.importLoading = false
}
});
},
clearSearchCnd() {
this.importData = {
fileList: [],
}
this.errorInfoData = {
totalCount: 0,
successCount: 0,
errorCount: 0,
errorList: [],
}
this.pageForm.userIds = []
this.successUserIdList = []
this.doSearch()
this.dialogVisible = false;
$.get('/platform/activity/basic/scope/clearSearchCnd', {existsLoginNameRedisKey: this.pageForm.existsLoginNameRedisKey}).then(res => {
if (res.code === 0) {
this.$message.success(res.msg)
} else {
this.$message.error(res.msg)
}
})
},
doExportUser() {
const {
userId,
@@ -476,7 +646,8 @@ module.exports = {
activityGroupId,
age,
reverseSelection,
activityUserCnd
activityUserCnd,
existsLoginNameRedisKey
} = this.pageForm
let props = {}
@@ -497,7 +668,8 @@ module.exports = {
"&activityGroupId=" + activityGroupId +
"&teacherMeetingId=" + teacherMeetingId +
"&unionId=" + unionId +
"&unitId=" + unitId
"&unitId=" + unitId+
"&existsLoginNameRedisKey=" + existsLoginNameRedisKey
)
},
doReset() {
@@ -534,13 +706,12 @@ module.exports = {
},
async flushUnits() {
this.$set(this.pageForm, "unitId", "")
this.units = await getUnits(this.pageForm.unionId)
/*if (this.is_sysadmin || this.is_A06) {
if (this.is_sysadmin || this.is_A06) {
this.units = await getUnits(this.pageForm.unionId)
this.activityUnits = await getActivityUnits(this.pageForm.activityUnionId)
} else {
this.units = await getUnits(this.unionid)
}*/
}
},
async pageData() {
sublime.showLoadingbar()
@@ -562,7 +733,7 @@ module.exports = {
this.tableData = resp.data.list
this.pageForm.totalCount = resp.data.totalCount
} else {
this.$message.warning(resp.msg)
this.notifyWarning(resp.msg)
}
},
async doSetActivityUser() {
@@ -600,7 +771,7 @@ module.exports = {
// this.userScopeDialog = false
await this.getActivityGroup()
this.doSearch()
this.$message.success(resp.msg)
this.notifySuccess(resp.msg)
this.formData = {
setGroupType: null,
setGroupId: null,
@@ -649,9 +820,8 @@ module.exports = {
async created() {
await this.getRolesAndUnion()
this.clubOptions = await getClubsByRole()
this.unions = await getUnions(null)
/* if (((this.is_sysadmin || this.is_A06 || this.is_H02) === false) && this.is_H04 === true) {
if (((this.is_sysadmin || this.is_A06 || this.is_H02) === false) && this.is_H04 === true) {
this.unions = await getUnionList(this.unionid)
this.$set(this.pageForm, "unionId", this.unions[0].id)
} else {
@@ -662,11 +832,11 @@ module.exports = {
if (this.clubOptions.length > 0) {
this.$set(this.pageForm, "clubId", this.clubOptions[0].stid)
}
}*/
}
await this.flushUnits()
await this.getActivityGroup()
this.personTypeOptions = await getDictOptions("PERSON_TYPE")
this.userStateOptions = await getDictOptions("USER_STATE")
this.personTypeOptions = await getDictOptions("UserType")
this.userStateOptions = await getDictOptions("UserState")
await this.getMenuOptions()
await this.pageData()
},