Browse Source

fix: 企微助手 - 群活码 - 分组修改&群活码列表联动逻辑优化

zhengxy 2 years ago
parent
commit
7cf89c6606

+ 12 - 2
project/src/components/groupCode/components/channelGroup.vue

@@ -4,7 +4,7 @@
4 4
       <span class="fWeight600 c-000 f14">渠道分组</span>
5 5
       <span
6 6
         class="addGroupBox"
7
-        @click="($refs.dialogGroupRef.dialogVisible = true),($refs.dialogGroupRef.groupName = '')"
7
+        @click="onClickAdd"
8 8
       >
9 9
         <i class="el-icon-plus f12"></i>
10 10
         添加分组
@@ -90,7 +90,7 @@ export default {
90 90
     handleGetDeleteCommand({ id }) {
91 91
       return `${eventOptions.DELETE}/${id}`
92 92
     },
93
-    async init() {
93
+    async init(options = {}) {
94 94
       try {
95 95
         this.loading = true;
96 96
         const { data: res = {} } = await this.$axios.get(this.URL.BASEURL + this.URL.channel_groupList, {
@@ -112,6 +112,10 @@ export default {
112 112
       } finally {
113 113
         this.loading = false
114 114
       }
115
+      // 编辑分组名称后 => 需要重新获取群活码列表
116
+      if (options.isChangeRuleList) {
117
+        this.$emit('update')
118
+      }
115 119
     },
116 120
     handleCommand(command) {
117 121
       const [eventName, groupId, groupName] = command.split('/')
@@ -159,6 +163,7 @@ export default {
159 163
           del_sqs: 0, //是否删除子活码
160 164
         })
161 165
         if (res && res.errno == 0) {
166
+          this.itemClick(null)
162 167
           this.init();
163 168
         } else if (res.errno != 4002) {
164 169
           this.$message.warning(res.err)
@@ -189,6 +194,11 @@ export default {
189 194
       this.acIdx = id
190 195
       this.$emit('changeGroupId', id)
191 196
     },
197
+    onClickAdd() {
198
+      this.dialogTitle = "添加";
199
+      this.$refs.dialogGroupRef.groupName = '';
200
+      this.$refs.dialogGroupRef.dialogVisible = true;
201
+    },
192 202
   },
193 203
 };
194 204
 </script>

+ 1 - 1
project/src/components/groupCode/components/dialogGroup.vue

@@ -79,7 +79,7 @@ export default {
79 79
         if (res && res.errno == 0) {
80 80
           this.$message.success(res.err);
81 81
           this.dialogVisible = false;
82
-          this.$emit("init");
82
+          this.$emit("init", { 'isChangeRuleList': true });
83 83
         }
84 84
       } catch (error) {
85 85
         console.log('error => ', error)

+ 1 - 1
project/src/components/groupCode/index.vue

@@ -7,7 +7,7 @@
7 7
     </div>
8 8
     <div class="mainBox">
9 9
       <div class="groupBox">
10
-        <channelGroup @changeGroupId="onChangeGroupId" />
10
+        <channelGroup @changeGroupId="onChangeGroupId" @update="handleGetCodeList" />
11 11
       </div>
12 12
       <div class="tableBox">
13 13
         <el-table v-loading="loading" ref="multipleTable" border :height="height" :data="tableData.list" tooltip-effect="dark" :header-cell-style="()=>{return { backgroundColor: '#f9f9f9 !important' }}" style="width: 100%">