| | |
| | | }) |
| | | } |
| | | |
| | | export function delRecipientBatch(ids){ |
| | | return request({ |
| | | url:'/mesmanager/recipient/deletebatch/' + ids, |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | // 获取同级领导 |
| | | export function getLeaders(){ |
| | | return request({ |
| | |
| | | return { |
| | | userInfo: {}, |
| | | navData: [], |
| | | openKeys: ['1','2','3','4'] |
| | | openKeys: ['1'] |
| | | }; |
| | | }, |
| | | created() { |
| | |
| | | }, |
| | | methods: { |
| | | onOpenChange(openKeys) { |
| | | if (openKeys.length !== 0) { |
| | | this.openKeys = [openKeys[1]] |
| | | // if (openKeys.length !== 0) { |
| | | // this.openKeys = [openKeys[1]] |
| | | // } else { |
| | | // this.openKeys = [''] |
| | | // } |
| | | const rootSubmenuKeys = this.navData.map(i=>i.MenuID) |
| | | const latestOpenKey = openKeys.find(key => this.openKeys.indexOf(key) === -1); |
| | | if (rootSubmenuKeys.indexOf(latestOpenKey) === -1) { |
| | | this.openKeys = openKeys; |
| | | } else { |
| | | this.openKeys = [''] |
| | | this.openKeys = latestOpenKey ? [latestOpenKey] : []; |
| | | } |
| | | }, |
| | | } |
| | |
| | | <template> |
| | | <div class="inner"> |
| | | <a-row type="flex" justify="space-between" style="margin-bottom: 20px"> |
| | | <a-col :span="6"> |
| | | <a-button v-if="unittype && unittype !== null" type="primary" @click="editData('add',{})">新增</a-button> |
| | | <a-button v-if="unittype && unittype !== null" type="primary" @click="visible = true" style="margin: 0 12px">导入通讯录表</a-button> |
| | | <a-button v-if="unittype && unittype !== null" type="primary" @click="openGroup()">分组管理</a-button> |
| | | <a-col :span="6" v-if="unittype && unittype !== null"> |
| | | <a-button type="primary" @click="editData('add',{})">新增</a-button> |
| | | <a-button type="primary" @click="visible = true" style="margin: 0 12px">导入通讯录表</a-button> |
| | | <a-button type="primary" @click="openGroup()">分组管理</a-button> |
| | | </a-col> |
| | | <a-col :span="18"> |
| | | <a-row type="flex" justify="end" :gutter="14"> |
| | | <a-row type="flex" :gutter="14"> |
| | | <a-col :span="6"> |
| | | <a-input v-model="search.searchParams.company" placeholder="单位名称" style="width: 100%"/> |
| | | </a-col> |
| | |
| | | }, |
| | | created() { |
| | | const t = this |
| | | console.log(t.id,t.form.uid,'id') |
| | | }, |
| | | methods:{ |
| | | clearMod(){ |
| | |
| | | <template> |
| | | <div class="inner"> |
| | | <a-row type="flex" justify="space-between" style="margin-bottom: 20px"> |
| | | <a-col :span="4"> |
| | | <a-button v-if="unittype && unittype !== null" type="primary" @click="editData('add',{})">新增用户</a-button> |
| | | <a-col :span="4" v-if="unittype && unittype !== null"> |
| | | <a-button type="primary" @click="editData('add',{})">新增用户</a-button> |
| | | </a-col> |
| | | <a-col :span="20"> |
| | | <a-row type="flex" justify="end" :gutter="14"> |
| | | <a-row type="flex" :gutter="14"> |
| | | <a-col :span="6"> |
| | | <a-select v-model="search.searchParams.peerRecipientGroupId" placeholder="选择分组" style="width: 100%" @change="handleChange" allowClear show-search :filter-option="filterOption"> |
| | | <a-select-option v-for="item in groupData" :value="item.id" :key="item.id">{{item.name}}</a-select-option> |
| | | </a-select> |
| | | </a-col> |
| | | <a-col :span="6"> |
| | | <a-input v-model="search.searchParams.company" placeholder="单位名称" style="width: 100%"/> |
| | | </a-col> |
| | |
| | | <a-col :span="6"> |
| | | <a-button type="primary" @click="getUserList" v-preventReClick="1500">查询</a-button> |
| | | <a-button style="margin-left: 12px" @click="resetSearch">重置</a-button> |
| | | <a-button type="danger" style="margin-left: 12px" @click="delBySet">批量删除</a-button> |
| | | </a-col> |
| | | </a-row> |
| | | </a-col> |
| | | </a-row> |
| | | <div class="table-cont"> |
| | | <a-table :columns="columns" :data-source="tableData" :pagination="pagination" :rowKey="record=>record.id" bordered> |
| | | <a-table :columns="columns" :data-source="tableData" :pagination="pagination" :rowKey="record=>record.id" bordered :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"> |
| | | <template #unittype="unittype"> |
| | | <a-tag |
| | | :color="unittype === 1 ? 'purple' : unittype === 2 ? 'blue' : unittype === 3 ? 'cyan' : 'green'" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import {delRecipient, delUser, getRecipient, getSameLevelGroupList, getUser} from '@/api/user' |
| | | import {delRecipient, delRecipientBatch, delUser, getRecipient, getSameLevelGroupList, getUser} from '@/api/user' |
| | | import sameLevelMod from "@/views/Admin/components/sameLevelMod" |
| | | import {getUserInfo} from "@/util/storage"; |
| | | import {getDistrictInfo} from "@/api/login"; |
| | |
| | | province: '', |
| | | city: '', |
| | | area: '', |
| | | town: '' |
| | | town: '', |
| | | peerRecipientGroupId: undefined |
| | | } |
| | | }, |
| | | selectedRowKeys: [], |
| | | columns:[ |
| | | { |
| | | title: '单位名称', |
| | |
| | | methods:{ |
| | | async getUserList(){ |
| | | const t = this |
| | | if(t.search.searchParams.province == '' && t.search.searchParams.city == '' && t.search.searchParams.area == '' && t.search.searchParams.company == ''){ |
| | | if(t.search.searchParams.province == '' && t.search.searchParams.city == '' && t.search.searchParams.area == '' && t.search.searchParams.company == '' && t.search.searchParams.peerRecipientGroupId == undefined){ |
| | | const {searchParams,...data} = t.search |
| | | const res = await getRecipient(data) |
| | | if(res.data.code == 100){ |
| | | t.tableData = res.data.data |
| | | t.pagination.total = res.data.total |
| | | // for(let i of t.tableData){ |
| | | // if(i.peerRecipientGroupId == null){ |
| | | // i['peerRecipientGroup'] = '未分类' |
| | | // }else{ |
| | | // getSameLevelGroupList().then((re)=>{ |
| | | // if(re.data.data && re.data.data.length>0){ |
| | | // for(let j of re.data.data){ |
| | | // if(j.id == i.peerRecipientGroupId){ |
| | | // i['peerRecipientGroup'] = j.name |
| | | // } |
| | | // } |
| | | // } |
| | | // }) |
| | | // } |
| | | // } |
| | | }else{ |
| | | t.$message.warning(res.data.msg); |
| | | } |
| | | console.log(t.tableData,'table') |
| | | }else{ |
| | | const res = await getRecipient(t.search) |
| | | if(res.data.code == 100){ |
| | |
| | | if(res.data.code == 100){ |
| | | if(res.data.data){ |
| | | let arr = res.data.data |
| | | t.groupData = arr.concat([{id: null, name: '未分类'}]) |
| | | t.groupData = arr.concat([{id: -1, name: '未分类'}]) |
| | | }else{ |
| | | t.groupData = [{ |
| | | id: null, |
| | | id: -1, |
| | | name: '未分类' |
| | | }] |
| | | } |
| | |
| | | province: '', |
| | | city: '', |
| | | area: '', |
| | | town: '' |
| | | town: '', |
| | | peerRecipientGroupId: undefined |
| | | } |
| | | } |
| | | t.getUserList() |
| | |
| | | t.$refs.sameLevelMod.areaData = t.areaData |
| | | t.$refs.sameLevelMod.form.unittype = t.unittype |
| | | t.$refs.sameLevelMod.form.districtId = t.districtId |
| | | }, |
| | | |
| | | filterOption(input, option) { |
| | | return ( |
| | | option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
| | | ); |
| | | }, |
| | | |
| | | async delData(row){ |
| | |
| | | return null; |
| | | }, |
| | | |
| | | async delBySet(){ |
| | | const t = this |
| | | this.$confirm({ |
| | | title: '提示', |
| | | content: h => <div>是否删除所选用户信息?</div>, |
| | | cancelText: '取消', |
| | | okText: '确认', |
| | | centered: true, |
| | | onOk() { |
| | | delRecipientBatch(t.selectedRowKeys.join(',')).then(res=>{ |
| | | if(res.data.code == 100){ |
| | | t.$message.success('删除用户信息成功'); |
| | | t.getUserList() |
| | | t.selectedRowKeys = [] |
| | | }else{ |
| | | t.$message.warning(res.data.msg); |
| | | } |
| | | }) |
| | | }, |
| | | onCancel() { |
| | | console.log('Cancel'); |
| | | }, |
| | | }); |
| | | }, |
| | | |
| | | onPageChange(page, pageSize) { |
| | | const t= this |
| | | t.pagination.current = page |
| | |
| | | province: '', |
| | | city: '', |
| | | area: '', |
| | | town: '' |
| | | town: '', |
| | | peerRecipientGroupId: undefined |
| | | } |
| | | if(value[0]){ |
| | | t.search.searchParams.province = t.findCodeById(t.areaData,value[0]).name |
| | |
| | | t.search.searchParams.town = t.findCodeById(t.areaData,value[3]).name |
| | | } |
| | | }, |
| | | handleChange(value) { |
| | | console.log(`selected ${value}`); |
| | | this.getUserList() |
| | | }, |
| | | onSelectChange(selectedRowKeys) { |
| | | this.selectedRowKeys = selectedRowKeys; |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | |
| | | import { loginOut, getDistrictInfo } from "@/api/login";
|
| | | import { Session, getUserInfo} from '@/util/storage';
|
| | | import Cookies from "js-cookie";
|
| | | import {getAreaWithUserIfo} from "@/api/user";
|
| | | export default {
|
| | | name: "Home",
|
| | | data() {
|
| | |
| | | })
|
| | | this.addListener()
|
| | | }
|
| | | this.getAreaUsers(getUserInfo().districtId)
|
| | | },
|
| | | watch: {
|
| | | '$route': function(newRoute) {
|
| | |
| | | const path = closePath && closePath.split('?')[0]
|
| | | this.remove(path, nextRoute)
|
| | | },
|
| | | async getAreaUsers(districtId) {
|
| | | let t = this
|
| | | let res = await getAreaWithUserIfo()
|
| | | if (res.data.code == 100) {
|
| | | if (res.data.data) {
|
| | | t.userTitTree(res.data.data)
|
| | | const areaUsers = t.findNodeById(res.data.data, districtId).children
|
| | | localStorage.removeItem('areaUsers')
|
| | | localStorage.setItem('areaUsers',JSON.stringify(areaUsers))
|
| | | } else {
|
| | | console.log('暂无数据')
|
| | | }
|
| | | } else {
|
| | | this.$message.warning(res.data.msg);
|
| | | }
|
| | | },
|
| | |
|
| | | // 根据id查对象
|
| | | findNodeById(data, value) {
|
| | | for (const node of data) {
|
| | | if (node.id === value) {
|
| | | return node;
|
| | | }
|
| | | if (node.children) {
|
| | | const foundNode = this.findNodeById(node.children, value);
|
| | | if (foundNode) {
|
| | | return foundNode;
|
| | | }
|
| | | }
|
| | | }
|
| | | return null;
|
| | | },
|
| | |
|
| | | // 将树状数据name字段放入users的姓名电话
|
| | | userTitTree(treeData) {
|
| | | for (const node of treeData) {
|
| | | if (node.users) {
|
| | | node.users = node.users.filter(i => i.roleId == 3)
|
| | | node.users = node.users.map((i) => {
|
| | | return {
|
| | | ...i,
|
| | | unittype: node.type,
|
| | | districtId: node.id
|
| | | }
|
| | | })
|
| | | node.name = node.name + '(' + node.users.map(i => i.realName + ' ' + i.phone).join(',') + ')'
|
| | | }
|
| | | if (node.children) {
|
| | | this.userTitTree(node.children)
|
| | | }
|
| | | }
|
| | | return treeData
|
| | | }
|
| | | }
|
| | | };
|
| | | </script>
|
| | |
| | | import { login, getMenuAdmin } from "@/api/login"; |
| | | import Cookies from 'js-cookie'; |
| | | import {Base64} from "js-base64"; |
| | | import {getAreaWithUserIfo} from "@/api/user"; |
| | | |
| | | |
| | | export default { |
| | |
| | | Cookies.set('resTk', res.data.data.tk); |
| | | Cookies.set('resUid', res.data.data.uid); |
| | | Cookies.set('userInfo',JSON.stringify(res.data.data),{expires: 7}) |
| | | await this.getAreaUsers(res.data.data.districtId) |
| | | if (this.saveAccount) { |
| | | localStorage.setItem('userName', this.form.name) |
| | | localStorage.setItem('userPassword', Base64.encode(this.form.pwd)) |
| | |
| | | }); |
| | | }, |
| | | |
| | | async getAreaUsers(districtId) { |
| | | let t = this |
| | | let res = await getAreaWithUserIfo() |
| | | if (res.data.code == 100) { |
| | | if (res.data.data) { |
| | | t.userTitTree(res.data.data) |
| | | const areaUsers = t.findNodeById(res.data.data, districtId).children |
| | | localStorage.removeItem('areaUsers') |
| | | localStorage.setItem('areaUsers',JSON.stringify(areaUsers)) |
| | | } else { |
| | | console.log('暂无数据') |
| | | } |
| | | } else { |
| | | this.$message.warning(res.data.msg); |
| | | } |
| | | }, |
| | | |
| | | // 根据id查对象 |
| | | findNodeById(data, value) { |
| | | for (const node of data) { |
| | | if (node.id === value) { |
| | | return node; |
| | | } |
| | | if (node.children) { |
| | | const foundNode = this.findNodeById(node.children, value); |
| | | if (foundNode) { |
| | | return foundNode; |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | }, |
| | | |
| | | // 将树状数据name字段放入users的姓名电话 |
| | | userTitTree(treeData) { |
| | | for (const node of treeData) { |
| | | if (node.users) { |
| | | node.users = node.users.filter(i => i.roleId == 3) |
| | | node.users = node.users.map((i) => { |
| | | return { |
| | | ...i, |
| | | unittype: node.type, |
| | | districtId: node.id |
| | | } |
| | | }) |
| | | node.name = node.name + '(' + node.users.map(i => i.realName + ' ' + i.phone).join(',') + ')' |
| | | } |
| | | if (node.children) { |
| | | this.userTitTree(node.children) |
| | | } |
| | | } |
| | | return treeData |
| | | } |
| | | }, |
| | | }; |
| | | </script> |