From 3cc4abeb92d11d7a8b365928c5aa9452679fe06c Mon Sep 17 00:00:00 2001 From: zhouwx <1175765986@qq.com> Date: 星期一, 19 八月 2024 09:04:50 +0800 Subject: [PATCH] 责任人增加筛选条件 --- src/views/Admin/contactBook/contactors.vue | 142 +++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 137 insertions(+), 5 deletions(-) diff --git a/src/views/Admin/contactBook/contactors.vue b/src/views/Admin/contactBook/contactors.vue index 6a07c56..c01d159 100644 --- a/src/views/Admin/contactBook/contactors.vue +++ b/src/views/Admin/contactBook/contactors.vue @@ -23,10 +23,21 @@ <a-button type="danger" @click="deliverTask" v-if="!unittype || unittype == 1">下发更新任务</a-button> </div> </div> - <div style="margin: 20px 0"> - <a-button type="primary" style="margin-right: 10px" @click="editData('add',{})">新增</a-button> - <a-button type="primary" @click="massImport()">批量导入</a-button> + <div style="margin: 20px 0;display: flex;justify-content: space-between"> + <div style="display: flex;align-items: center"> + <a-button type="primary" style="margin-right: 10px" @click="editData('add',{})">新增</a-button> + <a-button type="primary" @click="massImport()">批量导入</a-button> + </div> + <a-button type="primary" @click="openExport">批量导出</a-button> </div> + <div style="display: flex;align-items: center;margin-bottom: 15px"> + <a-input v-model="search.searchParams.name" placeholder="请输入姓名" style="width: 250px;margin-right: 10px"></a-input> + <a-input v-model="search.searchParams.phone" placeholder="请输入电话" style="width: 250px;margin-right: 10px"></a-input> + <a-input v-model="search.searchParams.company" placeholder="请输入单位" style="width: 250px;margin-right: 10px"></a-input> + <a-button type="primary" style="margin-right: 10px" @click="getUserList()">查询</a-button> + <a-button @click="resetSearch()">重置</a-button> + </div> + <div class="table-cont"> <a-table :columns="columns" :data-source="tableData" :pagination="pagination" :rowKey="record=>record.id.toString()" bordered> <template #index="text,record,index"> @@ -65,6 +76,33 @@ </a-form-model-item> </a-form-model> </a-modal> + <a-modal v-model="exportDialog" title="导出通讯录" :footer="null" centered :afterClose="closeDialog"> + <a-form-model ref="ruleForm" :label-col="labelCol" :wrapper-col="wrapperCol" :colon="false"> + <a-form-model-item label="行政区划" > + <a-tree-select + v-model="exportAreaId" + style="width: 100%" + :dropdown-style="{ maxHeight: '400px', overflow: 'auto' }" + :tree-data="treeData" + placeholder="请选择行政区划" + :replaceFields="replaceFields" + @change="changeArea" + /> + </a-form-model-item> + <div v-if=" json_data.length>0"> + <download-excel :data="json_data" :fields="json_fields" name="责任人导出.xlsx" style="display: flex;justify-content: flex-end"> + <a-button type="primary">批量导出</a-button> + </download-excel> + </div> + <div v-else style="text-align: center;color: salmon">暂无人员导出</div> + + </a-form-model> + </a-modal> + <a-modal v-model="importDialog" title="导入失败列表" :footer="null" centered :afterClose="closeImportDialog"> + <span style="margin-bottom: 20px;font-size: 16px">{{errorMsg}}</span> + <a-table :columns="errColumns" :data-source="errorData" :rowKey="record=>record.id" bordered :pagination="false" :scroll="{y:'200px'}"> + </a-table> + </a-modal> </div> </template> @@ -80,7 +118,7 @@ } from "@/api/contactBook"; import subMenu from "@/views/Admin/contactBook/subMenu"; import contactorsMod from "@/views/Admin/components/contactorsMod" -import {importUser} from "@/api/user"; +import {getExportData, importUser} from "@/api/user"; import importNew from "@/assets/importNew.xlsx"; import JSONBig from 'json-bigint' export default { @@ -102,12 +140,14 @@ unittype: null, districtId: null, currentKey: [], + importDialog:false, search:{ pageIndex: 1, pageSize: 10, searchParams: { name: '', phone: '', + company: '', orgStructureId: null } }, @@ -177,12 +217,66 @@ onChange: ( page, pageSize ) => this.onPageChange(page,pageSize), showTotal: total => `共 ${total} 条` }, + paginationErr: { + current: 1, + defaultCurrent: 1, + defaultPageSize: 10, + total: 0, + onChange: ( page, pageSize ) => this.onPageChangeErr(page,pageSize), + showTotal: total => `共 ${total} 条` + }, fieldNames:{ label: 'name', value: 'id', children: 'children' }, - currentId: null + currentId: null, + exportDialog: false, + areaId: null, + areaData: [], + exportAreaId: null, + replaceFields: { + children:'children', + title:'name', + key:'id', + value: 'code' + }, + json_fields: { + 'ID': { + field: 'id', + callback: value => { + return ' '+value + } + }, + '姓名': 'name', + '所属当前级别行政区划': 'districtName', + '区划编号': 'districtCode', + '组织架构': 'orgStructureName', + '单位': 'company', + '职务': 'post', + '电话号码': 'phone', + '责任类型': { + field: 'orgUserTypes', + callback: (value) => { + return value?value.map(i=>i.typeName + '(' + i.orgUserTags.map(j=>j.tagName).join('/') +')').join(','): '' + } + }, + }, + json_data: [], + errorData: [], + errorMsg: '', + errColumns:[ + { + title: '姓名', + dataIndex: 'name', + key: 'name' + }, + { + title: '失败原因', + dataIndex: 'errorMsg', + key: 'errorMsg' + }, + ], } }, created() { @@ -246,6 +340,11 @@ this.uploadLoading = false this.visible = false await this.getUserList() + if(res.data.data && res.data.data.length>0){ + this.errorMsg = res.data.msg + this.errorData = res.data.data + this.importDialog = true; + } }else{ this.$message.warning(res.data.msg); this.uploadLoading = false @@ -254,6 +353,16 @@ }, clearMod(){ this.fileList = [] + }, + closeDialog(){ + this.exportAreaId = null; + this.json_data = []; + this.exportDialog = false; + }, + closeImportDialog(){ + this.errorMsg = ''; + this.errorData = []; + this.importDialog = false; }, async getStructure(){ const t = this @@ -272,6 +381,7 @@ t.$message.warning(res.data.msg) } }, + filterBranches(branches, targetNames) { return branches.filter(branch => { @@ -311,6 +421,9 @@ } }, + openExport() { + this.exportDialog = true + }, handleClick(e) { this.currentId = e.keyPath[1]?e.keyPath[1].split('-')[0]:e.keyPath[0].split('-')[0] @@ -320,6 +433,7 @@ searchParams: { name: '', phone: '', + company: '', orgStructureId: null } } @@ -351,6 +465,12 @@ t.search = { pageIndex: 1, pageSize: 10, + searchParams: { + name: '', + phone: '', + company: '', + orgStructureId: t.search.searchParams.orgStructureId + } } t.getUserList() }, @@ -395,6 +515,18 @@ }, }); }, + changeArea(value){ + console.log('val',this.exportAreaId) + getExportData(this.exportAreaId).then(res => { + if(res.data.code == 100){ + this.json_data = res.data.data + console.log('this.json_data',this.json_data) + }else{ + this.$message.warning(res.data.msg); + } + }) + + }, async deliverTask(){ const t = this -- Gitblit v1.9.2