From 5c0e57ab831a71a8456e4d7dedf454f85aa96491 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 27 六月 2023 15:06:53 +0800
Subject: [PATCH] 新增同时发信息给本级领导
---
src/views/Admin/components/msgEditMod.vue | 37 +++++++++++++++++-
src/views/Login.vue | 2
src/views/Admin/notice.vue | 40 +++++++++++--------
3 files changed, 58 insertions(+), 21 deletions(-)
diff --git a/src/views/Admin/components/msgEditMod.vue b/src/views/Admin/components/msgEditMod.vue
index 3ec3f8e..2a447b3 100644
--- a/src/views/Admin/components/msgEditMod.vue
+++ b/src/views/Admin/components/msgEditMod.vue
@@ -95,7 +95,7 @@
全选
</a-checkbox>
</div>
- <a-form-model-item prop="receiver">
+ <a-form-model-item prop="receiver" style="margin-bottom: 6px">
<a-tree-select
show-search
tree-checkable
@@ -115,6 +115,9 @@
>
</a-tree-select>
</a-form-model-item>
+ <a-checkbox :checked="withLeaders" @change="isAddLeaders" style="margin-bottom: 24px" :disabled="disable">
+ 同时发信息给本级领导
+ </a-checkbox>
</a-col>
<a-col :span="12">
<b style="margin-bottom: 6px">平级接收人选择:</b>
@@ -158,7 +161,6 @@
</a-col>
</a-row>
</div>
-
<div class="right">
<h2>短信预览</h2>
<div class="mobile">
@@ -208,7 +210,9 @@
acceptingUnitIds: [],
peerRecipientIds: []
},
+ sendLeaders: [],
checkAll: false,
+ withLeaders: false,
areaUsers: [],
replaceFields: {
children:'children',
@@ -268,9 +272,18 @@
methods: {
openMod(type,data){
const t = this
+ t.getLeaders()
t.form.acceptingUnitIds = []
t.form.peerRecipientIds = []
+ t.sendLeaders = []
if(type == 'review' || type == 'view' || type == 'edit') {
+ t.sendLeaders = data.acceptingUnitIds.filter(i=>i.roleId == 2)
+ data.acceptingUnitIds = data.acceptingUnitIds.filter(i=>i.roleId == 3)
+ if(t.sendLeaders.length>0){
+ t.withLeaders = true
+ }else{
+ t.withLeaders = false
+ }
for(let i in data){
if(t.isValidKey(i,t.form)){
t.form[i] = data[i]
@@ -325,7 +338,6 @@
t.fileList = []
}
t.title = '信息转发'
- t.getLeaders()
t.disable = false
}
t.visible = true
@@ -400,6 +412,24 @@
}
},
+ isAddLeaders(e) {
+ const t = this
+ t.withLeaders = !t.withLeaders
+ if(e.target.checked){
+ // if(t.userInfo.role.id == 3){
+ t.sendLeaders = []
+ for(let i of t.leaders){
+ const {realName,...data} = i
+ const { id: recipienterId, name: recipienterName, phone: recipienterPhone,...rest} = data
+ const obj = { recipienterId, recipienterName, recipienterPhone, province: null,city: null,area: null,town: null,receiveUnit: t.userInfo.company,unittype: t.userInfo.unittype,roleId: 2,...rest}
+ t.sendLeaders.push(obj)
+ }
+ // }
+ }else{
+ t.sendLeaders = []
+ }
+ },
+
fileChange(info) {
let fileList = [...info.fileList];
// 2. read from response and show file link
@@ -455,6 +485,7 @@
const obj = { recipienterId, recipienterName, recipienterPhone, receiveUnit,...rest}
this.form.acceptingUnitIds.push(obj)
}
+ this.form.acceptingUnitIds = [...this.form.acceptingUnitIds,...this.sendLeaders]
if(this.form.recipient.length>0){
const bList = this.form.recipient.map(item => this.filteredOptions.find(i=>i.id == item))
for(let i of bList){
diff --git a/src/views/Admin/notice.vue b/src/views/Admin/notice.vue
index 16d336c..189249c 100644
--- a/src/views/Admin/notice.vue
+++ b/src/views/Admin/notice.vue
@@ -90,7 +90,7 @@
全选
</a-checkbox>
</div>
- <a-form-model-item prop="receiver" style="margin-bottom: 12px">
+ <a-form-model-item prop="receiver" style="margin-bottom: 6px">
<a-tree-select
show-search
tree-checkable
@@ -109,7 +109,7 @@
>
</a-tree-select>
</a-form-model-item>
- <a-checkbox @change="isAddLeaders" style="margin-bottom: 24px">
+ <a-checkbox :checked="withLeaders" @change="isAddLeaders" style="margin-bottom: 24px">
同时发信息给本级领导
</a-checkbox>
</a-col>
@@ -122,11 +122,6 @@
</a-select-option>
</a-select>
</a-form-model-item>
- </a-col>
- </a-row>
- <a-row :gutter="24">
- <a-col :span="12">
-
</a-col>
</a-row>
<a-row :gutter="24" style="display: flex;align-items: center">
@@ -158,17 +153,17 @@
</template>
<script>
-import {getAreaWithUserIfo, getPeerRecipient, getLeaders} from '@/api/user'
+ import {getAreaWithUserIfo, getPeerRecipient, getLeaders} from '@/api/user'
import {getUserInfo} from "@/util/storage";
import Cookies from "js-cookie";
- import axios from "axios";
-import {massSend, msgSend} from "@/api/send";
-import {deleteFile} from "@/api/list";
+ import {massSend, msgSend} from "@/api/send";
+ import {deleteFile} from "@/api/list";
export default {
name: "notice",
data() {
return {
userInfo: {},
+ unittype: null,
wrapperCol: { span: 24 },
filteredOptions:[],
form: {
@@ -188,8 +183,10 @@
acceptingUnitIds: [],
peerRecipientIds: []
},
+ sendLeaders: [],
leaders: [],
checkAll: false,
+ withLeaders: false,
areaUsers: [],
replaceFields: {
children:'children',
@@ -272,9 +269,9 @@
// const treeD = []
t.userTitTree(res.data.data)
// treeD.push(t.findNodeById(res.data.data,t.userInfo.districtId))
- t.areaUsers = t.findNodeById(res.data.data,t.userInfo.districtId).children
- // t.leaders = t.findNodeById(res.data.data,t.userInfo.districtId).users.filter(i=>i.roleId == 2)
- t.unittype = t.findNodeById(res.data.data,t.userInfo.districtId)?.type
+ const treeD = t.findNodeById(res.data.data,t.userInfo.districtId)
+ t.areaUsers = treeD.children
+ t.unittype = treeD.type
}else{
console.log('暂无数据')
}
@@ -317,12 +314,20 @@
isAddLeaders(e) {
const t = this
- console.log(`checked = ${e.target.checked}`);
+ t.withLeaders = !t.withLeaders
+ t.sendLeaders = []
+ if(e.target.checked){
+ for(let i of t.leaders){
+ const {realName,...data} = i
+ const { id: recipienterId, name: recipienterName, phone: recipienterPhone,...rest} = data
+ const obj = { recipienterId, recipienterName, recipienterPhone, province: null,city: null,area: null,town: null,receiveUnit: t.userInfo.company,unittype: t.userInfo.unittype,roleId: 2,...rest}
+ t.sendLeaders.push(obj)
+ }
+ }
},
fileChange(info) {
let fileList = [...info.fileList];
- // 2. read from response and show file link
fileList = fileList.map(file => {
if(file.status == 'done'){
if (file.response) {
@@ -375,7 +380,7 @@
const obj = { recipienterId, recipienterName, recipienterPhone, receiveUnit,...rest}
this.form.acceptingUnitIds.push(obj)
}
-
+ this.form.acceptingUnitIds = [...this.form.acceptingUnitIds,...this.sendLeaders]
if(this.form.recipient.length>0){
const bList = this.form.recipient.map(item => this.filteredOptions.find(i=>i.id == item))
for(let i of bList){
@@ -395,6 +400,7 @@
}
this.fileList = []
this.delList = []
+ this.withLeaders = false
this.$refs.ruleForm.clearValidate()
this.$refs.ruleForm.resetFields()
})
diff --git a/src/views/Login.vue b/src/views/Login.vue
index 605f8eb..8fe248e 100644
--- a/src/views/Login.vue
+++ b/src/views/Login.vue
@@ -15,7 +15,7 @@
>
<a-form-model-item ref="name" prop="name">
<a-input
- placeholder="请输入用户"
+ placeholder="请输入用户名"
size="large"
v-model="form.name"
autocomplete="new-password"
--
Gitblit v1.9.2