瀏覽代碼

feat: 企微工具 - 平台管理 - "删除账号"交互逻辑

zhengxy 2 年之前
父節點
當前提交
4c3e00800e
共有 1 個文件被更改,包括 52 次插入1 次删除
  1. 52 1
      project/src/components/manage/platformManage/platformManage.vue

+ 52 - 1
project/src/components/manage/platformManage/platformManage.vue

12
       <el-table-column label="账号" min-width="300" align="center">
12
       <el-table-column label="账号" min-width="300" align="center">
13
         <template slot-scope="{ row }">
13
         <template slot-scope="{ row }">
14
           <div v-for="item in 3" :key="item" class="account-wrap">
14
           <div v-for="item in 3" :key="item" class="account-wrap">
15
-            <span>123123123<i class="del-btn el-icon-delete" /></span>
15
+            <span>{{ item }}<i class="del-btn el-icon-delete" @click="onClickDelAccount({ platform: row, delItem: item })" /></span>
16
           </div>
16
           </div>
17
           <div class="account-add-btn" @click="onClickAddAccount(row)">
17
           <div class="account-add-btn" @click="onClickAddAccount(row)">
18
             <i class="el-icon-plus" />
18
             <i class="el-icon-plus" />
213
       }
213
       }
214
     },
214
     },
215
     // E 禁用、启用平台
215
     // E 禁用、启用平台
216
+
217
+    // S 删除账号
218
+    // 监听点击"删除"账号按钮
219
+    async onClickDelAccount({ platform, delItem }) {
220
+      console.log('platform => ', platform)
221
+      console.log('delItem => ', delItem)
222
+      try {
223
+        const h = this.$createElement
224
+        await this.$confirm('', {
225
+          message:h('div', null, [
226
+            h('span', null, `确定删除`),
227
+            h('span', { style:'color: #32B38A;' }, `${platform.name}`),
228
+            h('span', null, '平台的'),
229
+            h('span', { style:'color: #32B38A;' }, `${delItem}`),
230
+            h('span', null, '账号吗?'),
231
+          ]),
232
+          confirmButtonText: '确定',
233
+          cancelButtonText: '取消',
234
+          type: 'warning',
235
+        })
236
+        this.handleDelAccount({ platform, delItem })
237
+      } catch (error) {
238
+        console.log(error)
239
+      }
240
+    },
241
+    async handleDelAccount({ platform, delItem }) {
242
+      try {
243
+        let url = `${this.URL.BASEURL}${this.URL.xxx}`
244
+        const params = {
245
+          id: platform.id,
246
+          delItem: delItem,
247
+        }
248
+        console.log('url => ', url)
249
+        console.log('params => ', params)
250
+        return // mock
251
+        this.loading = true
252
+        const { data: res = {} } = await this.$axios.post(url, params)
253
+        if (res && res.errno == 0) {
254
+          this.$message.success('操作成功')
255
+          this.handleGetPlatform()
256
+        } else if (res.errno != 4002) {
257
+          this.$message.warning(res.err || '操作失败')
258
+        }
259
+      } catch (error) {
260
+        console.log('error => ', error)
261
+      } finally {
262
+        this.loading = false
263
+      }
264
+    },
265
+    // E 删除账号
266
+
216
   }
267
   }
217
 }
268
 }
218
 </script>
269
 </script>