This commit is contained in:
=
2026-04-28 17:33:16 +08:00
parent a1dcad9e28
commit a9fc3d9690
10 changed files with 552 additions and 32 deletions
@@ -121,6 +121,9 @@ layout("/layouts/platform.html"){
<el-button icon="el-icon-plus" @click="openAdd">创建协会</el-button>
&lt;!&ndash;#}#&ndash;&gt;
</div>-->
<div class="pull-right offscreen-right mt5">
<el-button type="primary" icon="el-icon-upload2" @click="openImport">导入成员</el-button>
</div>
</el-card>
<el-row class="el-table-container">
@@ -646,6 +649,57 @@ layout("/layouts/platform.html"){
</span>
</el-dialog>
<el-dialog
title="导入成员"
:visible.sync="importDialogVisible" :close-on-click-modal="false" width="40%">
<el-timeline>
<el-timeline-item placement="top" timestamp="下载模板">
<el-card>
<el-button
@click="downloadImportTemplate"
icon="el-icon-download" size="medium"
style="width: 200px"
type="">下载模板
</el-button>
</el-card>
</el-timeline-item>
<el-timeline-item placement="top" timestamp="上传文件">
<el-card>
<el-upload
:auto-upload="false"
:file-list="importData.fileList"
:limit="1"
:on-change="importFileChange"
:on-remove="importFileRemove"
name="file"
ref="importUpload">
<el-button icon="el-icon-upload" size="medium" style="width: 200px" type="">
选择文件
</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="导入结果" v-if="importResult.totalCount > 0">
<el-card>
<div>
本次导入共 {{importResult.totalCount}} 条,成功 {{importResult.successCount}} 条,失败 {{importResult.errorCount}} 条
</div>
<div style="margin-top: 15px" v-if="importResult.errorCount > 0 && importResult.cacheKey">
<el-button icon="el-icon-download" @click="downloadImportErrors">下载错误信息表格</el-button>
</div>
</el-card>
</el-timeline-item>
</el-timeline>
<span slot="footer" class="dialog-footer">
<el-button :disabled="importLoading" @click="importDialogVisible = false">取 消</el-button>
<el-button type="primary" :loading="importLoading" @click="doImportMember">确 定</el-button>
</span>
</el-dialog>
</div>
<script>
var E = window.wangEditor
@@ -690,7 +744,7 @@ layout("/layouts/platform.html"){
userLoading: false,
fileList: [],
delFiles: [],
checkNode: {level: 2},
checkNode: {level: 1},
checkData: {},
//################################
userFormRules: {
@@ -713,6 +767,17 @@ layout("/layouts/platform.html"){
userTabKey: "",
addDialogVisible: false,
clubOptions: [],
importDialogVisible: false,
importLoading: false,
importData: {
fileList: []
},
importResult: {
totalCount: 0,
successCount: 0,
errorCount: 0,
cacheKey: ''
}
}
},
components: {
@@ -826,6 +891,88 @@ layout("/layouts/platform.html"){
})
},
openImport() {
this.$set(this, 'importResult', {
totalCount: 0,
successCount: 0,
errorCount: 0,
cacheKey: ''
})
this.$set(this, 'importData', {
fileList: []
})
this.importDialogVisible = true
},
downloadImportTemplate() {
window.location.href = base + '/platform/sys/club/clubIn/downloadImportTemplate'
},
importFileChange(file, fileList) {
var fileName = file.name ? file.name : file.raw.name
var suffix = fileName.indexOf('.') > -1 ? fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase() : ''
if (['xls', 'xlsx'].indexOf(suffix) === -1) {
this.$message({
message: '只能上传 xls、xlsx 文件',
type: 'warning'
})
this.$set(this.importData, 'fileList', [])
return
}
this.$set(this.importData, 'fileList', fileList.slice(fileList.length - 1))
},
importFileRemove(file, fileList) {
this.$set(this.importData, 'fileList', fileList)
},
doImportMember() {
if (!this.importData.fileList.length) {
this.$message({
message: '请先选择导入文件',
type: 'warning'
})
return
}
var formdata = new FormData();
this.importData.fileList.forEach(function (val) {
formdata.append('file', val.raw, val.raw.name)
})
this.importLoading = true
$.ajax({
url: base + "/platform/sys/club/clubIn/doImportMember",
type: "post",
data: formdata,
processData: false,
contentType: false,
success: (resp) => {
this.importLoading = false
if (resp.code === 0) {
this.$set(this, 'importResult', resp.data)
this.$message({
message: '导入完成,成功 ' + resp.data.successCount + ' 条,失败 ' + resp.data.errorCount + ' 条',
type: resp.data.errorCount > 0 ? 'warning' : 'success'
})
this.pageData()
this.loadTree()
} else {
this.$message({
message: resp.msg,
type: 'error'
})
}
},
error: (resp) => {
this.importLoading = false
this.$message({
message: resp.msg ? resp.msg : '导入失败',
type: 'error'
})
}
});
},
downloadImportErrors() {
if (!this.importResult.cacheKey) {
return
}
window.location.href = base + '/platform/sys/club/clubIn/exportImportErrors?cacheKey=' + this.importResult.cacheKey
},
doUserSearch() {
this.userTabKey = new Date().getTime()
this.userPageForm.pageNumber = 1
@@ -1246,7 +1393,7 @@ layout("/layouts/platform.html"){
this.treeLoading = false
if (code == 0) {
this.treeData = data
this.checkData = data[0].child[0]
this.checkData = data[0]
} else {
this.$message({
message: data.msg,
@@ -1258,12 +1405,10 @@ layout("/layouts/platform.html"){
async created() {
await this.loadTree()
this.typeOptions = await getClubType()
this.userPageForm.clubid = this.checkData.id
this.userPageData();
this.pageData();
}
})
</script>
<!--#
}
#-->
#-->
@@ -292,6 +292,7 @@ layout("/layouts/platform.html"){
<el-lable v-if="scope.row.sf==3">副会长</el-lable>
<el-lable v-if="scope.row.sf==4">秘书长</el-lable>
<el-lable v-if="scope.row.sf==5">副秘书长</el-lable>
<el-lable v-if="scope.row.sf==6">协会经办人</el-lable>
</template>
</el-table-column>
@@ -325,6 +326,10 @@ layout("/layouts/platform.html"){
@click.native="updateSf(row,5)"
class="text-primary">设置副秘书长
</el-dropdown-item>
<el-dropdown-item v-if="row.sf!==6"
@click.native="updateSf(row,6)"
class="text-primary">设置协会经办人
</el-dropdown-item>
<el-dropdown-item
@click.native="userDropdownCommand(row)">删除
</el-dropdown-item>
@@ -567,6 +572,7 @@ layout("/layouts/platform.html"){
<el-lable v-if="scope.row.sf==3">副会长</el-lable>
<el-lable v-if="scope.row.sf==4">秘书长</el-lable>
<el-lable v-if="scope.row.sf==5">副秘书长</el-lable>
<el-lable v-if="scope.row.sf==6">协会经办人</el-lable>
</template>
</el-table-column>
<el-table-column label="工号" width="150px" prop="loginname" header-align="center"
@@ -627,6 +633,7 @@ layout("/layouts/platform.html"){
<el-radio-button :label="3">副会长</el-radio-button>
<el-radio-button :label="4">秘书长</el-radio-button>
<el-radio-button :label="5">副秘书长</el-radio-button>
<el-radio-button :label="6">协会经办人</el-radio-button>
<!--<el-radio-button :label="2">成员</el-radio-button>-->
</el-radio-group>
</el-form-item>
@@ -791,7 +798,7 @@ layout("/layouts/platform.html"){
});
},
async userQueryUser(clubid, query) {
const {data} = await $.get("/platform/sys/club/users/queryUser", {clubid, query})
const {data} = await $.get("/platform/sys/club/users/queryClubMemberForManage", {clubid, query})
return data
},
async userUserRemoteMethod(query) {
@@ -1258,4 +1265,4 @@ layout("/layouts/platform.html"){
</script>
<!--#
}
#-->
#-->