From 1df2f72ad0321815d5874b4083aac2999bd2da18 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期三, 05 七月 2023 17:11:46 +0800
Subject: [PATCH] 修改

---
 src/views/Admin/massSend.vue |   48 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/src/views/Admin/massSend.vue b/src/views/Admin/massSend.vue
index 2bc3f52..63287c7 100644
--- a/src/views/Admin/massSend.vue
+++ b/src/views/Admin/massSend.vue
@@ -101,13 +101,16 @@
           </a-form-model-item>
         </a-col>
         <a-col :span="12">
-          <div>
+          <div style="display:flex;justify-content: space-between;align-items: center;">
             <b>平级接收人选择:</b>
+            <a-checkbox :checked="checkSlAll" @change="checkSlChange">
+              全选
+            </a-checkbox>
           </div>
           <a-form-model-item>
             <a-select mode="multiple" placeholder="选择平级接收单位" v-model="form.recipient" @change="handle">
               <a-select-option v-for="item in filteredOptions" :key="item.id" :value="item.id">
-                {{ item.recipientName }}
+                {{ item.recipientName }}({{item.company}} {{item.phone}})
               </a-select-option>
             </a-select>
           </a-form-model-item>
@@ -140,7 +143,7 @@
 			<h2>短信预览</h2>
 			<div class="mobile">
 				<div class="mesg">
-					<P>{{form.content}}发布单位:{{form.publishingUnit}}</P>
+					<P>【自然灾害风险预警提示】{{form.content}}发布单位:{{form.publishingUnit}}</P>
 				</div>
 
 			</div>
@@ -174,6 +177,7 @@
           horizontalRecipient: []
         },
         checkAll: false,
+        checkSlAll: false,
         areaUsers: [],
         replaceFields: {
           children:'children',
@@ -242,7 +246,6 @@
             t.userTitTree(res.data.data)
             treeD.push(t.findNodeById(res.data.data,t.userInfo.districtId))
             t.areaUsers = treeD
-            console.log(t.areaUsers,t.unittype,'696969')
           }else{
             console.log('暂无数据')
           }
@@ -273,6 +276,26 @@
         }
       },
 
+      //选择平级部门部分
+      handle(selectedItems) {
+        const t = this
+        if(t.form.recipient.length == t.filteredOptions.length){
+          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)
+        }else{
+          t.form.recipient = []
+        }
+      },
+
       confirmSend(){
         this.$refs.ruleForm.validate(valid => {
           if (valid) {
@@ -285,7 +308,7 @@
             }
             const newAList = [].concat(...aList)
             for(let i of newAList){
-              const {realName,id,...data} = i
+              const {realName,id,roleId,...data} = i
               const {company: recipientUnit,...rest} = data
               const obj = {recipientUnit,recipientType:1,...rest}
               this.form.verticalRecipient.push(obj)
@@ -305,6 +328,8 @@
                 this.$message.success('信息群发成功')
                 this.$refs.ruleForm.clearValidate()
                 this.$refs.ruleForm.resetFields()
+                this.form.recipient = []
+
               }else{
                 this.$message.error(res.data.msg)
                 this.$refs.ruleForm.clearValidate()
@@ -331,9 +356,6 @@
       handleLevel(selectedItems) {
         // this.selectedItems = selectedItems;
       },
-			handle(selectedItems) {
-				// this.selectedItems = selectedItems;
-			},
 			onChange(){
 				console.log(this.value)
 			},
@@ -372,10 +394,12 @@
       traverseTree(treeData) {
         let result = [];
         function traverse(node) {
-          result.push({ label: node.name, value: node.id });
-          if (node.children && node.children.length > 0) {
-            for (let child of node.children) {
-              traverse(child);
+          if(node.users && node.users.length>0){
+            result.push({ label: node.name, value: node.id });
+            if (node.children && node.children.length > 0) {
+              for (let child of node.children) {
+                traverse(child);
+              }
             }
           }
         }

--
Gitblit v1.9.2