From 6efbb509b876e5e4ec634efa8820bd7b288c2283 Mon Sep 17 00:00:00 2001
From: zhouwenxuan <1175765986@qq.com>
Date: 星期二, 06 二月 2024 09:16:37 +0800
Subject: [PATCH] 分组
---
src/api/user.js | 45 +++++
src/layout/menu/index.js | 10 +
src/views/Admin/massSend.vue | 6
src/views/Admin/sameLevelGroup.vue | 138 +++++++++++++++++
src/views/Admin/components/sameLevelMod.vue | 33 +++
src/views/Admin/components/sameLevelGroupMod.vue | 118 ++++++++++++++
src/router/index.js | 6
src/views/Admin/notice.vue | 74 +++++++--
8 files changed, 406 insertions(+), 24 deletions(-)
diff --git a/src/api/user.js b/src/api/user.js
index 819c7de..c2fedaf 100644
--- a/src/api/user.js
+++ b/src/api/user.js
@@ -213,3 +213,48 @@
data: data
})
}
+
+//评级接收人分组
+
+//分页查询
+export function getSameLevelGroup(data){
+ return request({
+ url: '/mesmanager/recipientGroup/page',
+ method: 'post',
+ data: data
+ })
+}
+
+//新增
+export function addSameLevelGroup(data){
+ return request({
+ url: '/mesmanager/recipientGroup/add ',
+ method: 'post',
+ data:data
+ })
+}
+
+//修改
+export function updateSameLevelGroup(data){
+ return request({
+ url: '/mesmanager/recipientGroup/update',
+ method: 'post',
+ data:data
+ })
+}
+//删除
+export function delSameLevelGroup(id){
+ return request({
+ url:'/mesmanager/recipientGroup/delete?id=' + id,
+ method: 'get'
+ })
+}
+
+//列表
+export function getSameLevelGroupList(data){
+ return request({
+ url: '/mesmanager/recipientGroup/list',
+ method: 'post',
+ data: data
+ })
+}
diff --git a/src/layout/menu/index.js b/src/layout/menu/index.js
index 601db7f..c440bd8 100644
--- a/src/layout/menu/index.js
+++ b/src/layout/menu/index.js
@@ -82,6 +82,11 @@
},
{
MenuID: "34",
+ MenuTitle: "平级接收人分组",
+ MenuPath: "/samelevelGroup",
+ },
+ {
+ MenuID: "35",
MenuTitle: "原通讯录",
MenuPath: "/addressBook",
}
@@ -232,6 +237,11 @@
},
{
MenuID: "34",
+ MenuTitle: "平级接收人分组",
+ MenuPath: "/samelevelGroup",
+ },
+ {
+ MenuID: "35",
MenuTitle: "原通讯录",
MenuPath: "/addressBook",
}
diff --git a/src/router/index.js b/src/router/index.js
index d345dca..550d46b 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -124,6 +124,12 @@
meta: { title: 'App版本信息' },
component: () => import('@/views/Admin/appFile.vue'),
},
+ {
+ path: '/samelevelGroup',
+ name: 'samelevelGroup',
+ meta: { title: '平级接收人分组' },
+ component: () => import('@/views/Admin/sameLevelGroup.vue'),
+ },
// {
// path: '/menu',
// name: 'menu',
diff --git a/src/views/Admin/components/sameLevelGroupMod.vue b/src/views/Admin/components/sameLevelGroupMod.vue
new file mode 100644
index 0000000..c014e12
--- /dev/null
+++ b/src/views/Admin/components/sameLevelGroupMod.vue
@@ -0,0 +1,118 @@
+<template>
+ <a-modal
+ :title="title"
+ :visible="visible"
+ centered
+ :confirm-loading="confirmLoading"
+ width="50%"
+ cancelText="取消"
+ okText="确认"
+ @ok="onSubmit"
+ @cancel="handleCancel"
+ :afterClose="clearMod"
+ >
+ <a-form-model ref="ruleForm" :rules="rules" :model="form" :label-col="labelCol" :wrapper-col="wrapperCol" :colon="false">
+ <a-form-model-item label="分组名称" prop="name">
+ <a-input v-model="form.name"/>
+ </a-form-model-item>
+ </a-form-model>
+ </a-modal>
+</template>
+
+<script>
+
+import {addRecipient, addSameLevelGroup, addUser, updateRecipient, updateSameLevelGroup, updateUser} from "@/api/user";
+import {verifySimplePhone} from "@/util/validate";
+export default {
+ name: 'userMod',
+ props: [],
+ data () {
+ return {
+ title: '新增用户',
+ visible: false,
+ confirmLoading: false,
+ labelCol: { span: 4 },
+ wrapperCol: { span: 14 },
+ form: {
+ id: null,
+ name: '',
+ },
+ rules: {
+ name: [{ required: true, message: '请输入分组名称', trigger: 'blur'}],
+ }
+ }
+ },
+ created() {
+ const t = this
+ },
+ methods:{
+ openDialog(type,data){
+ const t = this
+ if(type == 'add'){
+ t.title = '新增'
+ t.form = {
+ id: null,
+ name: '',
+ }
+ }else{
+ t.title = '编辑'
+ for(let i in data){
+ if(t.isValidKey(i,t.form)){
+ t.form[i] = data[i]
+ }
+ }
+ }
+ t.visible = true
+ },
+
+ isValidKey(key, object){
+ return key in object;
+ },
+
+ clearMod(){
+ this.$refs.ruleForm.clearValidate()
+ this.$refs.ruleForm.resetFields()
+ },
+
+ onSubmit() {
+ this.$refs.ruleForm.validate(valid => {
+ if (valid) {
+ if(this.title == '新增'){
+ const { id,...data } = this.form
+ addSameLevelGroup(data).then(res => {
+ if(res.data.code == 100){
+ this.$message.success('新增成功')
+ this.$emit('refresh')
+ }else{
+ this.$message.error(res.data.msg)
+ }
+ })
+ }else{
+ const data = this.form
+ updateSameLevelGroup(data).then((res)=>{
+ if(res.data.code == 100){
+ this.$message.success('修改成功')
+ this.$emit('refresh')
+ }else{
+ this.$message.error(res.data.msg)
+ }
+ })
+ }
+ this.visible = false
+ } else {
+ return false;
+ }
+ });
+ },
+
+ handleCancel(e) {
+ const t = this
+ t.visible = false;
+ }
+ }
+}
+</script>
+
+<style lang="less" scoped>
+
+</style>
diff --git a/src/views/Admin/components/sameLevelMod.vue b/src/views/Admin/components/sameLevelMod.vue
index 39cea6f..4c715cf 100644
--- a/src/views/Admin/components/sameLevelMod.vue
+++ b/src/views/Admin/components/sameLevelMod.vue
@@ -50,13 +50,18 @@
>
</a-tree-select>
</a-form-model-item>
+ <a-form-model-item label="选择分组" prop="peerRecipientGroupId">
+ <a-select v-model="form.peerRecipientGroupId" style="width: 100%">
+ <a-select-option v-for="item in groupData" :value="item.id" :key="item.id">{{item.name}}</a-select-option>
+ </a-select>
+ </a-form-model-item>
</a-form-model>
</a-modal>
</template>
<script>
-import {addRecipient, addUser, updateRecipient, updateUser} from "@/api/user";
+import {addRecipient, addUser, getSameLevelGroupList, updateRecipient, updateUser} from "@/api/user";
import {verifySimplePhone} from "@/util/validate";
export default {
name: 'userMod',
@@ -80,6 +85,12 @@
labelCol: { span: 4 },
wrapperCol: { span: 14 },
areaData: [],
+ groupData: [
+ {
+ id: '',
+ name: '未分类'
+ }
+ ],
replaceFields: {
children:'children',
title:'name',
@@ -93,17 +104,19 @@
company: '',
phone: '',
unittype: null,
- districtId: null
+ districtId: null,
+ peerRecipientGroupId: null
},
rules: {
recipientName: [{ required: true, message: '请输入姓名或称呼', trigger: 'blur'}],
company: [{ required: true, message: '请输入单位名称(备注)', trigger: 'blur'}],
- phone: [{ required: true, validator: validatePhone, trigger: 'blur'}]
+ phone: [{ required: true, validator: validatePhone, trigger: 'blur'}],
}
}
},
created() {
const t = this
+ t.getGroupList();
},
methods:{
openDialog(type,data){
@@ -116,7 +129,8 @@
company: '',
phone: '',
unittype: null,
- districtId: null
+ districtId: null,
+ peerRecipientGroupId: null
}
}else{
t.title = '编辑用户'
@@ -125,6 +139,7 @@
t.form[i] = data[i]
}
}
+ t.form.peerRecipientGroupId = data.peerRecipientGroupId ? data.peerRecipientGroupId: ''
}
t.visible = true
},
@@ -132,7 +147,15 @@
isValidKey(key, object){
return key in object;
},
-
+ async getGroupList () {
+ const t = this
+ const res = await getSameLevelGroupList();
+ if(res.data.code == 100){
+ t.groupData = t.groupData.concat(res.data.data)
+ }else{
+ this.$message.error(res.data.msg)
+ }
+ },
clearMod(){
this.$refs.ruleForm.clearValidate()
this.$refs.ruleForm.resetFields()
diff --git a/src/views/Admin/massSend.vue b/src/views/Admin/massSend.vue
index dd37f9e..8941a16 100644
--- a/src/views/Admin/massSend.vue
+++ b/src/views/Admin/massSend.vue
@@ -69,7 +69,7 @@
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- </a-row>-->
- <span><b>发布单位:</b>{{form.publishingUnit}}</span>
+<!-- <span><b>发布单位:</b>{{form.publishingUnit}}</span>-->
<br/><br/>
<!-- 子单位-->
<a-row :gutter="24">
@@ -173,7 +173,7 @@
<h2>短信预览</h2>
<div class="mobile">
<div class="mesg">
- <P>【自然灾害风险预警提示】{{form.content}}发布单位:{{form.publishingUnit}}</P>
+ <P>【自然灾害风险预警提示】{{form.content}}</P>
</div>
</div>
@@ -584,4 +584,4 @@
}
}
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/Admin/notice.vue b/src/views/Admin/notice.vue
index 3b8c67e..1da15e2 100644
--- a/src/views/Admin/notice.vue
+++ b/src/views/Admin/notice.vue
@@ -78,7 +78,7 @@
</a-form-model-item>
</a-col>
</a-row>
- <span><b>发布单位:</b>{{form.publishingUnit}}</span>
+<!-- <span><b>发布单位:</b>{{form.publishingUnit}}</span>-->
<br /><br />
<!-- 子单位-->
<a-row :gutter="24">
@@ -110,12 +110,22 @@
</a-checkbox>
</div>
<a-form-model-item prop="recipient">
- <a-select mode="multiple" placeholder="选择平级接收单位" v-model="form.recipient" @change="handle"
- :maxTagCount="3">
- <a-select-option v-for="item in filteredOptions" :key="item.id" :value="item.id">
- {{ item.recipientName }}({{item.company}} {{item.phone}})
- </a-select-option>
- </a-select>
+<!-- <a-select mode="multiple" placeholder="选择平级接收单位" v-model="form.recipient" @change="handle"-->
+<!-- :maxTagCount="3">-->
+<!-- <a-select-option v-for="item in filteredOptions" :key="item.id" :value="item.id">-->
+<!-- {{ item.recipientName }}({{item.company}} {{item.phone}})-->
+<!-- </a-select-option>-->
+<!-- </a-select>-->
+ <a-tree-select
+ v-model="form.recipient"
+ style="width: 100%"
+ :tree-data="treeData"
+ tree-checkable
+ placeholder="选择平级接收单位"
+ :show-checked-strategy="SHOW_PARENT"
+ search-placeholder="Please select"
+ @change="handle"
+ />
</a-form-model-item>
</a-col>
</a-row>
@@ -141,7 +151,7 @@
<h2>短信预览</h2>
<div class="mobile">
<div class="mesg">
- <P>【自然灾害风险预警提示】{{form.content}}<br>发布单位:{{form.publishingUnit}}</P>
+ <P>【自然灾害风险预警提示】{{form.content}}</P>
</div>
</div>
</div>
@@ -166,10 +176,16 @@
import {
deleteFile
} from "@/api/list";
+ import { TreeSelect } from 'ant-design-vue';
+ const SHOW_PARENT = TreeSelect.SHOW_PARENT;
+ const treeData = [];
export default {
name: "notice",
data() {
return {
+ value: [],
+ SHOW_PARENT,
+ treeData,
userInfo: {},
unittype: null,
wrapperCol: {
@@ -322,7 +338,25 @@
let res = await getPeerRecipient()
if (res.data.code == 100) {
if (res.data.data) {
- t.filteredOptions = res.data.data
+ // t.filteredOptions = res.data.data
+
+ for (const resKey in res.data.data) {
+ t.filteredOptions = t.filteredOptions.concat(...res.data.data[resKey]);
+ console.log('t.filteredOptions',t.filteredOptions)
+ const obj = {
+ title: resKey,
+ value: resKey,
+ key: resKey,
+ children: res.data.data[resKey].map(item => {
+ return {
+ title: item.recipientName + '(' +item.company +item.phone+ ')',
+ value: item.id,
+ key: item.id,
+ }
+ })
+ }
+ t.treeData.push(obj);
+ }
} else {
console.log('暂无数据')
}
@@ -384,18 +418,25 @@
//选择平级部门部分
handle(selectedItems) {
const t = this
- if (t.form.recipient.length == t.filteredOptions.length) {
- t.checkSlAll = true
- } else {
- t.checkSlAll = false
- }
+ // if (t.form.recipient.length == t.filteredOptions.length) {
+ // t.checkSlAll = true
+ // } else {
+ // t.checkSlAll = false
+ // }
+ const group = t.treeData.map(item => item.value)
+ if (group.length === t.form.recipient.length && group.every((v,i) => v === t.form.recipient[i])) {
+ t.checkSlAll = true
+ } else {
+ t.checkSlAll = false
+ }
},
checkSlChange(e) {
const t = this
t.checkSlAll = !t.checkSlAll
if (t.checkSlAll == true) {
- t.form.recipient = t.filteredOptions.map(i => i.id)
+ // t.form.recipient = t.filteredOptions.map(i => i.id)
+ t.form.recipient = t.treeData.map(item => item.value)
} else {
t.form.recipient = []
}
@@ -539,6 +580,7 @@
...data
} = this.form
msgSend(data).then(res => {
+
if (res.data.code == 100) {
this.deleteFile()
this.$message.success('信息已提交审核')
@@ -683,4 +725,4 @@
}
}
-</style>
\ No newline at end of file
+</style>
diff --git a/src/views/Admin/sameLevelGroup.vue b/src/views/Admin/sameLevelGroup.vue
new file mode 100644
index 0000000..6f5f2ec
--- /dev/null
+++ b/src/views/Admin/sameLevelGroup.vue
@@ -0,0 +1,138 @@
+<template>
+ <div class="inner">
+ <a-row type="flex" justify="space-between" style="margin-bottom: 20px">
+ <a-col :span="4">
+ <a-button type="primary" @click="editData('add',{})">添加</a-button>
+ </a-col>
+ </a-row>
+ <div class="table-cont">
+ <a-table :columns="columns" :data-source="tableData" :pagination="pagination" :rowKey="record=>record.id" bordered>
+ <template #action="action,row">
+ <a-button type="link" @click="editData('edit',row)">编辑</a-button>
+ <a-button type="link" class="delBtn" @click="delData(row)">删除</a-button>
+ </template>
+ </a-table>
+ </div>
+ <same-level-mod-group ref="sameLevelMod" @refresh="getUserList"></same-level-mod-group>
+ </div>
+</template>
+
+<script>
+import sameLevelModGroup from "@/views/Admin/components/sameLevelGroupMod.vue"
+import {getUserInfo} from "@/util/storage";
+import {delSameLevelGroup, getSameLevelGroup} from "@/api/user";
+export default {
+ name: 'sameLevel',
+ components: {
+ sameLevelModGroup
+ },
+ data () {
+ return {
+ areaVal: [],
+ unittype: null,
+ districtId: null,
+ search:{
+ pageIndex: 1,
+ pageSize: 10,
+ },
+ columns:[
+ {
+ title: '分组名称',
+ dataIndex: 'name',
+ key: 'name',
+ align: 'center'
+ },
+ {
+ title: '操作',
+ width: '12%',
+ key: 'action',
+ scopedSlots: { customRender: 'action' }
+ },
+ ],
+ tableData: [],
+ pagination: {
+ current: 1,
+ defaultCurrent: 1,
+ defaultPageSize: 10,
+ total: 0,
+ onChange: ( page, pageSize ) => this.onPageChange(page,pageSize),
+ showTotal: total => `共 ${total} 条`
+ },
+ fieldNames:{
+ label: 'name',
+ value: 'id',
+ children: 'children'
+ }
+ }
+ },
+ created() {
+ const t = this
+ t.unittype = getUserInfo().unittype
+ t.districtId = getUserInfo().districtId
+ t.getUserList()
+ },
+ methods:{
+ async getUserList(){
+ const t = this
+ const res = await getSameLevelGroup(t.search);
+ if(res.data.code == 100){
+ t.tableData = res.data.data
+ t.pagination.total = res.data.total
+ }else{
+ t.$message.warning(res.data.msg);
+ }
+ },
+
+ resetSearch(){
+ const t = this
+ t.areaVal = []
+ t.search = {
+ pageIndex: 1,
+ pageSize: 10,
+ }
+ t.getUserList()
+ },
+
+ editData(type,data){
+ const t = this
+ t.$refs.sameLevelMod.openDialog(type,data)
+ },
+
+ async delData(row){
+ const t = this
+ this.$confirm({
+ title: '提示',
+ content: h => <div>是否删除该条信息?</div>,
+ cancelText: '取消',
+ okText: '确认',
+ centered: true,
+ onOk() {
+ delSameLevelGroup(row.id).then(res=>{
+ if(res.data.code == 100){
+ t.$message.success('删除成功');
+ t.getUserList()
+ }else{
+ t.$message.warning(res.data.msg);
+ }
+ })
+ },
+ onCancel() {
+ console.log('Cancel');
+ },
+ });
+ },
+ onPageChange(page, pageSize) {
+ const t= this
+ t.pagination.current = page
+ t.search.pageIndex = page
+ t.getUserList()
+ },
+ }
+}
+</script>
+
+<style lang="less" scoped>
+.delBtn{
+ color: @danger
+}
+</style>
--
Gitblit v1.9.2