From 140e83402814ffd2e92dfe313f5681feedd39f86 Mon Sep 17 00:00:00 2001
From: 马宇豪 <978517621@qq.com>
Date: 星期二, 06 二月 2024 16:49:12 +0800
Subject: [PATCH] 修复弹窗bug

---
 src/views/Admin/components/msgEditMod.vue   |    3 -
 src/views/Admin/massSend.vue                |    2 
 src/views/Admin/sameLevel.vue               |   45 +++++++++++++++++++++-
 src/views/Admin/components/sameLevelMod.vue |   26 +++---------
 src/views/Admin/notice.vue                  |   10 +++--
 5 files changed, 58 insertions(+), 28 deletions(-)

diff --git a/src/views/Admin/components/msgEditMod.vue b/src/views/Admin/components/msgEditMod.vue
index 97c4b7a..e1f89ac 100644
--- a/src/views/Admin/components/msgEditMod.vue
+++ b/src/views/Admin/components/msgEditMod.vue
@@ -189,7 +189,7 @@
         <h2>短信预览</h2>
         <div class="mobile">
           <div class="mesg">
-            <P>【自然灾害风险预警提示】{{form.content}}<br>发布单位:{{form.publishingUnit}}</P>
+            <P>【防灾减灾工作通知】{{form.content}}<br>发布单位:{{form.publishingUnit}}</P>
           </div>
         </div>
       </div>
@@ -390,7 +390,6 @@
           // 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,'ops')
             const obj = {
               title: resKey,
               value: resKey,
diff --git a/src/views/Admin/components/sameLevelMod.vue b/src/views/Admin/components/sameLevelMod.vue
index 4c715cf..f235579 100644
--- a/src/views/Admin/components/sameLevelMod.vue
+++ b/src/views/Admin/components/sameLevelMod.vue
@@ -52,7 +52,7 @@
       </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-option v-for="(item,index) in groupData" :value="item.id" :key="index">{{item.name}}</a-select-option>
         </a-select>
       </a-form-model-item>
     </a-form-model>
@@ -85,12 +85,7 @@
       labelCol: { span: 4 },
       wrapperCol: { span: 14 },
       areaData: [],
-      groupData: [
-        {
-          id: '',
-          name: '未分类'
-        }
-      ],
+      groupData: [],
       replaceFields: {
         children:'children',
         title:'name',
@@ -116,11 +111,12 @@
   },
   created() {
     const t = this
-    t.getGroupList();
   },
   methods:{
-    openDialog(type,data){
+    openDialog(type,data,group){
       const t = this
+      t.groupData = group
+      console.log(t.groupData,'data222')
       if(type == 'add'){
         t.title = '新增用户'
         t.form = {
@@ -139,7 +135,7 @@
             t.form[i] = data[i]
           }
         }
-        t.form.peerRecipientGroupId = data.peerRecipientGroupId ? data.peerRecipientGroupId: ''
+        t.form.peerRecipientGroupId = data.peerRecipientGroupId ? data.peerRecipientGroupId: null
       }
       t.visible = true
     },
@@ -147,15 +143,7 @@
     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 166f594..86af6c0 100644
--- a/src/views/Admin/massSend.vue
+++ b/src/views/Admin/massSend.vue
@@ -173,7 +173,7 @@
 			<h2>短信预览</h2>
 			<div class="mobile">
 				<div class="mesg">
-					<P>【自然灾害风险预警提示】{{form.content}}</P>
+					<P>【防灾减灾工作通知】{{form.content}}</P>
 				</div>
 
 			</div>
diff --git a/src/views/Admin/notice.vue b/src/views/Admin/notice.vue
index d765134..a3b18a4 100644
--- a/src/views/Admin/notice.vue
+++ b/src/views/Admin/notice.vue
@@ -125,6 +125,7 @@
                   :show-checked-strategy="SHOW_PARENT"
                   search-placeholder="Please select"
                   @change="handle"
+                  @focus="getPj()"
               />
 						</a-form-model-item>
 					</a-col>
@@ -151,7 +152,7 @@
 				<h2>短信预览</h2>
 				<div class="mobile">
 					<div class="mesg">
-						<P>【自然灾害风险预警提示】{{form.content}}</P>
+						<P>【防灾减灾工作通知】{{form.content}}</P>
 					</div>
 				</div>
 			</div>
@@ -342,7 +343,6 @@
 
             for (const resKey in res.data.data) {
               t.filteredOptions = t.filteredOptions.concat(...res.data.data[resKey]);
-              console.log(t.filteredOptions,'ops')
               const obj = {
                   title: resKey,
                   value: resKey,
@@ -363,7 +363,10 @@
 					this.$message.warning(res.data.msg);
 				}
 			},
-
+      getPj(){
+        this.treeData = []
+        this.getSameLevel()
+      },
 			// 获取接收单位
 			async getAreaUsers() {
 				let t = this
@@ -574,7 +577,6 @@
 							...data
 						} = this.form
 						msgSend(data).then(res => {
-
 							if (res.data.code == 100) {
 								this.deleteFile()
 								this.$message.success('信息已提交审核')
diff --git a/src/views/Admin/sameLevel.vue b/src/views/Admin/sameLevel.vue
index 14db0ed..be1f3b5 100644
--- a/src/views/Admin/sameLevel.vue
+++ b/src/views/Admin/sameLevel.vue
@@ -45,7 +45,7 @@
 </template>
 
 <script>
-import {delRecipient, delUser, getRecipient, getUser} from '@/api/user'
+import {delRecipient, delUser, getRecipient, getSameLevelGroupList, getUser} from '@/api/user'
 import sameLevelMod from "@/views/Admin/components/sameLevelMod"
 import {getUserInfo} from "@/util/storage";
 import {getDistrictInfo} from "@/api/login";
@@ -82,6 +82,11 @@
           key: 'recipientName'
         },
         {
+          title: '所属分组',
+          dataIndex: 'peerRecipientGroupName',
+          key: 'peerRecipientGroupName'
+        },
+        {
           title: '手机号码',
           dataIndex: 'phone',
           key: 'phone'
@@ -106,6 +111,7 @@
         },
       ],
       tableData: [],
+      groupData: [],
       pagination: {
         current: 1,
         defaultCurrent: 1,
@@ -124,8 +130,10 @@
   },
   created() {
     const t = this
+    t.groupData = []
     t.unittype = getUserInfo().unittype
     t.districtId = getUserInfo().districtId
+    t.getGroupList()
     t.getUserList()
     t.getDistrictInfo()
   },
@@ -138,9 +146,25 @@
         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){
@@ -161,6 +185,23 @@
       }
     },
 
+    async getGroupList() {
+      const t = this
+      const res = await getSameLevelGroupList();
+      if(res.data.code == 100){
+        if(res.data.data){
+          let arr = res.data.data
+          t.groupData = arr.concat([{id: null, name: '未分类'}])
+        }else{
+          t.groupData = [{
+            id: null,
+            name: '未分类'
+          }]
+        }
+      }else{
+        this.$message.error(res.data.msg)
+      }
+    },
     resetSearch(){
       const t = this
       t.areaVal = []
@@ -180,7 +221,7 @@
 
     editData(type,data){
       const t = this
-      t.$refs.sameLevelMod.openDialog(type,data)
+      t.$refs.sameLevelMod.openDialog(type,data,t.groupData)
       t.$refs.sameLevelMod.areaData = t.areaData
       t.$refs.sameLevelMod.form.unittype = t.unittype
       t.$refs.sameLevelMod.form.districtId = t.districtId

--
Gitblit v1.9.2