Browse Source

feat: 企微工具 - 平台账号管理 - 相关页面修改

zhengxy 2 years ago
parent
commit
a70a6e0f6c

+ 48 - 148
project/src/components/manage/platformManage/platformManage.vue

3
     <div class="screenBox flex">
3
     <div class="screenBox flex">
4
       <div></div><!-- 占位 -->
4
       <div></div><!-- 占位 -->
5
       <div class="right">
5
       <div class="right">
6
-        <el-button type="primary" size="mini" @click="onClickAddPlatform">添加平台</el-button>
6
+        <el-button type="primary" size="mini" @click="onClickAddAccount">添加账号</el-button>
7
       </div>
7
       </div>
8
     </div>
8
     </div>
9
-    <el-table :height="height" :data="platformList" tooltip-effect="dark" style="width: 100%;margin-top:10px">
9
+    <el-table :height="height" :data="accountList" tooltip-effect="dark" style="width: 100%;margin-top:10px">
10
+      <el-table-column label="账号" min-width="200" align="center">
11
+        <template slot-scope="{ row }">
12
+          <span>{{ row.name }}</span>
13
+          <el-tooltip content="账号未激活,请联系开发人员激活账号" placement="top">
14
+            <span><i class="el-icon-warning-outline" style="color: red;" /></span>
15
+          </el-tooltip>
16
+        </template>
17
+      </el-table-column>
10
       <el-table-column label="平台" prop="name" min-width="160" align="center" />
18
       <el-table-column label="平台" prop="name" min-width="160" align="center" />
11
-      <el-table-column label="描述" prop="name" min-width="160" align="center" />
12
-      <el-table-column label="账号" min-width="300" align="center">
19
+      <el-table-column label="描述" prop="name" min-width="160" align="center">
13
         <template slot-scope="{ row }">
20
         <template slot-scope="{ row }">
14
-          <div v-for="item in 3" :key="item" class="account-wrap">
15
-            <span>{{ item }}<i class="del-btn el-icon-delete" @click="onClickDelAccount({ platform: row, delItem: item })" /></span>
16
-          </div>
17
-          <div class="account-add-btn" @click="onClickAddAccount(row)">
18
-            <i class="el-icon-plus" />
19
-            <span>添加账号</span>
20
-          </div>
21
+          <span>{{ row.name || '-' }}</span>
21
         </template>
22
         </template>
22
       </el-table-column>
23
       </el-table-column>
23
       <el-table-column label="状态" min-width="160" align="center">
24
       <el-table-column label="状态" min-width="160" align="center">
26
           <span v-else class="c-F03F5C">禁用</span>
27
           <span v-else class="c-F03F5C">禁用</span>
27
         </template>
28
         </template>
28
       </el-table-column>
29
       </el-table-column>
30
+      <el-table-column label="关联短剧数量" min-width="160" align="center">
31
+        <template slot-scope="{ row }">
32
+          <span class="playlet-num">{{ row.name }}</span>
33
+        </template>
34
+      </el-table-column>
29
       <el-table-column label="操作" min-width="160" align="center">
35
       <el-table-column label="操作" min-width="160" align="center">
30
         <template slot-scope="{ row }">
36
         <template slot-scope="{ row }">
31
           <el-button type="primary" size="mini" @click="onClickEditPlatform(row)">编辑</el-button>
37
           <el-button type="primary" size="mini" @click="onClickEditPlatform(row)">编辑</el-button>
39
       </el-pagination>
45
       </el-pagination>
40
     </div>
46
     </div>
41
 
47
 
42
-    <!-- S 添加平台 & 编辑平台 -->
43
-    <addPlatformDialog
44
-      :dialogVisible="addPlatformDialogVisible"
45
-      :platformInfo="currentPlatformInfo"
46
-      @confirm="handleAddPlatformConfirm"
47
-      @cancel="handleAddPlatformCancel"
48
-    />
49
-    <!-- E 添加平台 & 编辑平台 -->
50
-
51
-    <!-- S 添加账号 -->
48
+    <!-- S 添加账号 & 编辑账号 -->
52
     <addAccountDialog
49
     <addAccountDialog
53
       :dialogVisible="addAccountDialogVisible"
50
       :dialogVisible="addAccountDialogVisible"
54
-      :platformId="currentAccountPlatformId"
55
-      @confirm="handleAddAccountConfirm"
56
-      @cancel="handleAddAccountCancel"
51
+      :accountInfo="currentAccountInfo"
52
+      @confirm="handleAddPlatformConfirm"
53
+      @cancel="handleAddPlatformCancel"
57
     />
54
     />
58
-    <!-- E 添加账号 -->
55
+    <!-- E 添加账号 & 编辑账号 -->
59
   </div>
56
   </div>
60
 </template>
57
 </template>
61
 <script>
58
 <script>
62
-import addPlatformDialog from './dialog/addPlatformDialog.vue'
63
 import addAccountDialog from './dialog/addAccountDialog.vue'
59
 import addAccountDialog from './dialog/addAccountDialog.vue'
64
 export default {
60
 export default {
65
   name: 'platformManage',
61
   name: 'platformManage',
66
   components: {
62
   components: {
67
-    addPlatformDialog,
68
     addAccountDialog,
63
     addAccountDialog,
69
   },
64
   },
70
   data () {
65
   data () {
77
         pages: 0,
72
         pages: 0,
78
         total: 0,
73
         total: 0,
79
       },
74
       },
80
-      platformList: [],
81
-
82
-      addPlatformDialogVisible: false, // 控制"添加平台"弹框显示
83
-      currentPlatformInfo: {}, // 当前编辑的平台信息
75
+      accountList: [],
84
 
76
 
85
       addAccountDialogVisible: false, // 控制"添加账号"弹框显示
77
       addAccountDialogVisible: false, // 控制"添加账号"弹框显示
86
-      currentAccountPlatformId: '', // 当前需要添加账号的平台id
78
+      currentAccountInfo: {}, // 当前编辑的账号信息
87
     }
79
     }
88
   },
80
   },
89
   created () {
81
   created () {
103
         }
95
         }
104
         const { data: res = {} } = await this.$axios.get(url, { params })
96
         const { data: res = {} } = await this.$axios.get(url, { params })
105
         if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
97
         if (res && res.errno == 0 && Array.isArray(res.rst.data)) {
106
-          this.platformList = res.rst.data;
98
+          this.accountList = res.rst.data;
107
           this.pagination.total = res.rst.pageInfo.total;
99
           this.pagination.total = res.rst.pageInfo.total;
108
           this.pagination.pages = res.rst.pageInfo.pages;
100
           this.pagination.pages = res.rst.pageInfo.pages;
109
         } else if (res.errno != 4002) {
101
         } else if (res.errno != 4002) {
110
           this.$message.warning(res.err)
102
           this.$message.warning(res.err)
111
-          this.platformList = [];
103
+          this.accountList = [];
112
           this.pagination.total = 0;
104
           this.pagination.total = 0;
113
           this.pagination.pages = 0;
105
           this.pagination.pages = 0;
114
         }
106
         }
115
       } catch (error) {
107
       } catch (error) {
116
         console.log(error)
108
         console.log(error)
117
-        this.platformList = [];
109
+        this.accountList = [];
118
         this.pagination.total = 0;
110
         this.pagination.total = 0;
119
         this.pagination.pages = 0;
111
         this.pagination.pages = 0;
120
       } finally {
112
       } finally {
127
       this.handleGetPlatform()
119
       this.handleGetPlatform()
128
     },
120
     },
129
 
121
 
130
-    // S 添加 & 编辑平台
131
-    // 监听点击"添加平台"
132
-    onClickAddPlatform() {
133
-      this.currentPlatformInfo = {}
134
-      this.addPlatformDialogVisible = true
135
-    },
136
-    // 监听点击"编辑平台"
137
-    onClickEditPlatform(platformInfo) {
138
-      this.currentPlatformInfo = platformInfo
139
-      this.addPlatformDialogVisible = true
140
-    },
141
-    // 添加平台 & 编辑平台 => 确定
142
-    handleAddPlatformConfirm() {
143
-      this.addPlatformDialogVisible = false
144
-      this.pagination.page = 1
145
-      this.handleGetPlatform()
146
-    },
147
-    // 添加平台 & 编辑平台 => 取消
148
-    handleAddPlatformCancel() {
149
-      this.addPlatformDialogVisible = false
150
-    },
151
-    // E 添加 & 编辑平台
152
-
153
-    // S 添加账号
122
+    // S 添加 & 编辑账号
154
     // 监听点击"添加账号"
123
     // 监听点击"添加账号"
155
-    onClickAddAccount(currentPlatform) {
156
-      this.currentAccountPlatformId = currentPlatform.id
124
+    onClickAddAccount() {
125
+      this.currentAccountInfo = {}
126
+      this.addAccountDialogVisible = true
127
+    },
128
+    // 监听点击"编辑账号"
129
+    onClickEditPlatform(accountInfo) {
130
+      this.currentAccountInfo = accountInfo
157
       this.addAccountDialogVisible = true
131
       this.addAccountDialogVisible = true
158
     },
132
     },
159
-    // 添加账号账号 => 确定
160
-    handleAddAccountConfirm() {
133
+    // 添加账号 & 编辑账号 => 确定
134
+    handleAddPlatformConfirm({ isEdit }) {
161
       this.addAccountDialogVisible = false
135
       this.addAccountDialogVisible = false
136
+      if (!isEdit) this.pagination.page = 1
162
       this.handleGetPlatform()
137
       this.handleGetPlatform()
163
     },
138
     },
164
-    // 添加账号账号 => 取消
165
-    handleAddAccountCancel() {
139
+    // 添加账号 & 编辑账号 => 取消
140
+    handleAddPlatformCancel() {
166
       this.addAccountDialogVisible = false
141
       this.addAccountDialogVisible = false
167
     },
142
     },
168
-    // E 添加账号
143
+    // E 添加 & 编辑账号
169
 
144
 
170
     // S 禁用、启用平台
145
     // S 禁用、启用平台
171
     // 监听点击"禁用"、"启用"按钮
146
     // 监听点击"禁用"、"启用"按钮
172
-    async onClickEnable(currentPlatform, eventCode) {
147
+    async onClickEnable(currentAccount, eventCode) {
173
       try {
148
       try {
174
         const h = this.$createElement
149
         const h = this.$createElement
175
         await this.$confirm('', {
150
         await this.$confirm('', {
176
           message:h('div', null, [
151
           message:h('div', null, [
177
             h('span', null, `确定${eventCode === 0 ? '禁用' : '启用'}`),
152
             h('span', null, `确定${eventCode === 0 ? '禁用' : '启用'}`),
178
-            h('span', { style:'color: #32B38A;' }, `${currentPlatform.name}`),
153
+            h('span', { style:'color: #32B38A;' }, `${currentAccount.name}`),
179
             h('span', null, '吗?'),
154
             h('span', null, '吗?'),
180
           ]),
155
           ]),
181
           confirmButtonText: '确定',
156
           confirmButtonText: '确定',
182
           cancelButtonText: '取消',
157
           cancelButtonText: '取消',
183
           type: 'warning',
158
           type: 'warning',
184
         })
159
         })
185
-        this.handleEnable(currentPlatform, eventCode)
160
+        this.handleEnable(currentAccount, eventCode)
186
       } catch (error) {
161
       } catch (error) {
187
         console.log(error)
162
         console.log(error)
188
       }
163
       }
189
     },
164
     },
190
     // 执行"禁用"、"启用"
165
     // 执行"禁用"、"启用"
191
-    async handleEnable(currentPlatform, eventCode) {
166
+    async handleEnable(currentAccount, eventCode) {
192
       try {
167
       try {
193
         let url = `${this.URL.BASEURL}${this.URL.xxx}`
168
         let url = `${this.URL.BASEURL}${this.URL.xxx}`
194
         const params = {
169
         const params = {
195
-          id: currentPlatform.id,
170
+          id: currentAccount.id,
196
           enable: eventCode,
171
           enable: eventCode,
197
         }
172
         }
198
         console.log('url => ', url)
173
         console.log('url => ', url)
213
       }
188
       }
214
     },
189
     },
215
     // E 禁用、启用平台
190
     // 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
-
267
   }
191
   }
268
 }
192
 }
269
 </script>
193
 </script>
273
   padding: 5px 20px;
197
   padding: 5px 20px;
274
 }
198
 }
275
 .platformManage-wrap {
199
 .platformManage-wrap {
276
-  .account-wrap {
277
-    span {
278
-      position: relative;
279
-      i {
280
-        position: absolute;
281
-        right: -14px;
282
-        top: 3px;
283
-        display: none;
284
-        color: #F46C6C;
285
-        cursor: pointer;
286
-      }
287
-    }
288
-    &:hover {
289
-      i {
290
-        display: inline-block;
291
-      }
292
-    }
293
-  }
294
-  .account-add-btn {
295
-    display: flex;
296
-    align-items: center;
297
-    justify-content: center;
298
-    color: #32B38A;
200
+  .playlet-num {
299
     cursor: pointer;
201
     cursor: pointer;
300
-    i {
301
-      margin-right: 4px;
302
-    }
202
+    color: #32B38A;
303
   }
203
   }
304
 }
204
 }
305
 </style>
205
 </style>

+ 62 - 18
project/src/components/manage/platformManage/dialog/addAccountDialog.vue

11
         <span class="lable"><em>*</em>账号</span>
11
         <span class="lable"><em>*</em>账号</span>
12
         <el-input v-model="form.accountNumber" size="small" placeholder="请输入账号" clearable />
12
         <el-input v-model="form.accountNumber" size="small" placeholder="请输入账号" clearable />
13
       </div>
13
       </div>
14
+      <div class="form-item">
15
+        <span class="lable"><em>*</em>平台</span>
16
+        <el-select v-model="form.platform" size="small" placeholder="请选择平台" clearable filterable>
17
+          <el-option v-for="item in platformOptions" :key="item.account_id" :label="item.account_id" :value="item.account_id" />
18
+        </el-select>
19
+      </div>
20
+      <div class="form-item">
21
+        <span class="lable">描述</span>
22
+        <el-input v-model="form.accountDesc" size="small" placeholder="请输入描述" clearable />
23
+      </div>
24
+      <div class="form-item">
25
+        <span class="lable"><em>*</em>是否启用</span>
26
+        <el-switch v-model="form.accountEnable" active-color="#43B083" :active-value="1"  inactive-color="#ccc" :inactive-value="0" />
27
+      </div>
14
     </div>
28
     </div>
15
     <div slot="footer" class="dialog-footer">
29
     <div slot="footer" class="dialog-footer">
16
       <el-button size="mini" @click="handleCancel">取 消</el-button>
30
       <el-button size="mini" @click="handleCancel">取 消</el-button>
28
       type: Boolean,
42
       type: Boolean,
29
       default: () => false
43
       default: () => false
30
     },
44
     },
31
-    // 账号所属的平台id
32
-    platformId: {
33
-      type: [String, Number],
34
-      default: () => ''
45
+    // 账号信息
46
+    accountInfo: {
47
+      type: Object,
48
+      default: () => ({})
35
     },
49
     },
36
   },
50
   },
37
   data() {
51
   data() {
38
     return {
52
     return {
39
       loading: false,
53
       loading: false,
54
+      platformOptions: [], // 平台选项
40
       form: {
55
       form: {
41
         accountNumber: '', // 账号
56
         accountNumber: '', // 账号
57
+        platform: '', // 平台
58
+        accountDesc: '', // 描述
59
+        accountEnable: 1, // 是否启用
42
       }
60
       }
43
     }
61
     }
44
   },
62
   },
45
   computed: {
63
   computed: {
46
     // 当前操作是否为"编辑"
64
     // 当前操作是否为"编辑"
47
     isEdit() {
65
     isEdit() {
48
-      return false // 暂时只有新建
66
+      return this.accountInfo && this.accountInfo.id
49
     },
67
     },
50
     // 弹框标题
68
     // 弹框标题
51
     dialogTitle() {
69
     dialogTitle() {
55
   watch: {
73
   watch: {
56
     dialogVisible(isShow) {
74
     dialogVisible(isShow) {
57
       // 弹框显示 => 初始化表单数据
75
       // 弹框显示 => 初始化表单数据
58
-      isShow && this.handleInitData()
76
+      if (isShow) {
77
+        this.handleGetPlatformOptions()
78
+        this.handleInitData()
79
+      }
59
     },
80
     },
60
   },
81
   },
61
   methods: {
82
   methods: {
83
+    // 获取平台选项列表
84
+    async handleGetPlatformOptions() {
85
+      const { data: res = {} } = await this.$axios.get(this.URL.BASEURL + this.URL.adqAccount_list, {
86
+        params: {
87
+          is_select: 1
88
+        }
89
+      })
90
+      if (res && res.errno == 0) {
91
+        this.platformOptions = res.rst
92
+      } else if (res.errno != 4002) {
93
+        this.$message.warning(res.err)
94
+      }
95
+    },
62
     // 获取弹框表单数据
96
     // 获取弹框表单数据
63
     handleInitData() {
97
     handleInitData() {
64
       this.loading = false
98
       this.loading = false
65
       if (this.isEdit) { // 编辑
99
       if (this.isEdit) { // 编辑
66
-
100
+        const { accountNumber, platform, accountDesc, accountEnable } = this.accountInfo
101
+        this.form.accountNumber = accountNumber
102
+        this.form.platform = platform
103
+        this.form.accountDesc = accountDesc
104
+        this.form.accountEnable = accountEnable
67
       } else { // 新建
105
       } else { // 新建
68
         this.form.accountNumber = ''
106
         this.form.accountNumber = ''
107
+        this.form.platform = ''
108
+        this.form.accountDesc = ''
109
+        this.form.accountEnable = 1
69
       }
110
       }
70
     },
111
     },
71
     async handleConfirm() {
112
     async handleConfirm() {
74
         // 表单校验
115
         // 表单校验
75
         await this.handleFormValidate()
116
         await this.handleFormValidate()
76
         let url = `${this.URL.BASEURL}${this.URL.xxx}`
117
         let url = `${this.URL.BASEURL}${this.URL.xxx}`
77
-        const params = {
78
-          ...this.form,
79
-          platformId: this.platformId
80
-        }
118
+        const params = { ...this.form }
81
 
119
 
82
-        // if (this.isEdit) { // 编辑操作
83
-        //   url = `${this.URL.BASEURL}${this.URL.xxx}`
84
-        //   params.id = this.platformInfo.id
85
-        // }
120
+        if (this.isEdit) { // 编辑操作
121
+          url = `${this.URL.BASEURL}${this.URL.xxx}`
122
+          params.id = this.accountInfo.id
123
+        }
86
 
124
 
87
         console.log('url => ', url)
125
         console.log('url => ', url)
88
         console.log('params => ', params)
126
         console.log('params => ', params)
89
-        this.$emit('confirm') // mock
127
+        this.$emit('confirm', { isEdit: this.isEdit }) // mock
90
         return // mock
128
         return // mock
91
 
129
 
92
         this.loading = true
130
         this.loading = true
93
         const { data: res = {} } = await this.$axios.post(url, params)
131
         const { data: res = {} } = await this.$axios.post(url, params)
94
         if (res && res.errno == 0) {
132
         if (res && res.errno == 0) {
95
           this.$message.success('操作成功')
133
           this.$message.success('操作成功')
96
-          this.$emit('confirm')
134
+          this.$emit('confirm', { isEdit: this.isEdit })
97
         } else if (res.errno != 4002) {
135
         } else if (res.errno != 4002) {
98
           this.$message.warning(res.err || '操作失败')
136
           this.$message.warning(res.err || '操作失败')
99
         }
137
         }
109
     // 执行表单校验
147
     // 执行表单校验
110
     handleFormValidate() {
148
     handleFormValidate() {
111
       return new Promise((resolve, reject) => {
149
       return new Promise((resolve, reject) => {
112
-        const { accountNumber } = this.form
150
+        const { accountNumber, platform } = this.form
113
         if (!accountNumber) {
151
         if (!accountNumber) {
114
           this.$message.warning('请输入账号')
152
           this.$message.warning('请输入账号')
115
           reject('表单校验未通过')
153
           reject('表单校验未通过')
154
+        } else if (!platform) {
155
+          this.$message.warning('请选择平台')
156
+          reject('表单校验未通过')
116
         } else {
157
         } else {
117
           resolve('表单校验通过')
158
           resolve('表单校验通过')
118
         }
159
         }
143
           color: red;
184
           color: red;
144
         }
185
         }
145
       }
186
       }
187
+      .el-select {
188
+        width: 100%;
189
+      }
146
     }
190
     }
147
   }
191
   }
148
   .dialog-footer {
192
   .dialog-footer {

+ 0 - 164
project/src/components/manage/platformManage/dialog/addPlatformDialog.vue

1
-<template>
2
-  <el-dialog
3
-    :visible.sync="dialogVisible"
4
-    :before-close="handleCancel"
5
-    class="addPlatform-dialog"
6
-    :title="dialogTitle"
7
-    width="450px"
8
-  >
9
-    <div class="form-wrap" v-loading="loading">
10
-      <div class="form-item">
11
-        <span class="lable"><em>*</em>平台名称</span>
12
-        <el-input v-model="form.platformName" size="small" placeholder="请输入平台名称" clearable />
13
-      </div>
14
-      <div class="form-item">
15
-        <span class="lable">描述</span>
16
-        <el-input v-model="form.platformDesc" size="small" placeholder="请输入描述" clearable />
17
-      </div>
18
-      <div class="form-item">
19
-        <span class="lable"><em>*</em>是否启用</span>
20
-        <el-switch v-model="form.platformEnable" active-color="#43B083" :active-value="1"  inactive-color="#ccc" :inactive-value="0" />
21
-      </div>
22
-    </div>
23
-    <div slot="footer" class="dialog-footer">
24
-      <el-button size="mini" @click="handleCancel">取 消</el-button>
25
-      <el-button size="mini" type="primary" @click="handleConfirm" :disabled="loading">确 定</el-button>
26
-    </div>
27
-  </el-dialog>
28
-</template>
29
-
30
-<script>
31
-export default {
32
-  name: "addPlatformDialog",
33
-  props: {
34
-    // 控制弹框是否显示
35
-    dialogVisible: {
36
-      type: Boolean,
37
-      default: () => false
38
-    },
39
-    // 平台信息
40
-    platformInfo: {
41
-      type: Object,
42
-      default: () => ({})
43
-    },
44
-  },
45
-  data() {
46
-    return {
47
-      loading: false,
48
-      form: {
49
-        platformName: '', // 平台名称
50
-        platformDesc: '', // 描述
51
-        platformEnable: 1, // 是否启用
52
-      }
53
-    }
54
-  },
55
-  computed: {
56
-    // 当前操作是否为"编辑"
57
-    isEdit() {
58
-      return this.platformInfo && this.platformInfo.id
59
-    },
60
-    // 弹框标题
61
-    dialogTitle() {
62
-      return this.isEdit ? '编辑平台' : '添加平台'
63
-    }
64
-  },
65
-  watch: {
66
-    dialogVisible(isShow) {
67
-      // 弹框显示 => 初始化表单数据
68
-      isShow && this.handleInitData()
69
-    },
70
-  },
71
-  methods: {
72
-    // 获取弹框表单数据
73
-    handleInitData() {
74
-      this.loading = false
75
-      if (this.isEdit) { // 编辑
76
-        const { platformName, platformDesc, platformEnable } = this.platformInfo
77
-        this.form.platformName = platformName
78
-        this.form.platformDesc = platformDesc
79
-        this.form.platformEnable = platformEnable
80
-      } else { // 新建
81
-        this.form.platformName = ''
82
-        this.form.platformDesc = ''
83
-        this.form.platformEnable = 1
84
-      }
85
-    },
86
-    async handleConfirm() {
87
-      console.log('handleConfirm => ')
88
-      try {
89
-        // 表单校验
90
-        await this.handleFormValidate()
91
-        let url = `${this.URL.BASEURL}${this.URL.xxx}`
92
-        const params = { ...this.form }
93
-
94
-        if (this.isEdit) { // 编辑操作
95
-          url = `${this.URL.BASEURL}${this.URL.xxx}`
96
-          params.id = this.platformInfo.id
97
-        }
98
-
99
-        console.log('url => ', url)
100
-        console.log('params => ', params)
101
-        this.$emit('confirm') // mock
102
-        return // mock
103
-
104
-        this.loading = true
105
-        const { data: res = {} } = await this.$axios.post(url, params)
106
-        if (res && res.errno == 0) {
107
-          this.$message.success('操作成功')
108
-          this.$emit('confirm')
109
-        } else if (res.errno != 4002) {
110
-          this.$message.warning(res.err || '操作失败')
111
-        }
112
-      } catch (error) {
113
-        console.log('error => ', error)
114
-      } finally {
115
-        this.loading = false
116
-      }
117
-    },
118
-    handleCancel() {
119
-      this.$emit('cancel')
120
-    },
121
-    // 执行表单校验
122
-    handleFormValidate() {
123
-      return new Promise((resolve, reject) => {
124
-        const { platformName } = this.form
125
-        if (!platformName) {
126
-          this.$message.warning('请输入平台名称')
127
-          reject('表单校验未通过')
128
-        } else {
129
-          resolve('表单校验通过')
130
-        }
131
-      })
132
-    },
133
-  },
134
-};
135
-</script>
136
-
137
-<style lang="scss" scoped>
138
-.addPlatform-dialog {
139
-  .form-wrap {
140
-    padding: 0 10px;
141
-    .form-item {
142
-      display: flex;
143
-      align-items: center;
144
-      margin-top: 16px;
145
-      &:first-child {
146
-        margin-top: 0;
147
-      }
148
-      .lable {
149
-        width: 70px;
150
-        margin-right: 16px;
151
-        font-weight: 500;
152
-        flex-shrink: 0;
153
-        text-align: right;
154
-        em {
155
-          color: red;
156
-        }
157
-      }
158
-    }
159
-  }
160
-  .dialog-footer {
161
-    text-align: center;
162
-  }
163
-}
164
-</style>

+ 6 - 6
project/src/router/allRouter.js

62
 // 数据看板 - 用户流失趋势
62
 // 数据看板 - 用户流失趋势
63
 const loseUserTrends = () => import(/* webpackChunkName: 'loseUserTrends' */ '@/components/dataBoard/loseUserTrends.vue')
63
 const loseUserTrends = () => import(/* webpackChunkName: 'loseUserTrends' */ '@/components/dataBoard/loseUserTrends.vue')
64
 
64
 
65
-// 平台管理
66
-const platformManage = () => import(/* webpackChunkName: 'platformManage' */ '@/components/manage/platformManage/platformManage.vue')
65
+// 平台账号管理
66
+const accountManage = () => import(/* webpackChunkName: 'accountManage' */ '@/components/manage/accountManage/accountManage.vue')
67
 
67
 
68
 // name与菜单配置的页面路由一致
68
 // name与菜单配置的页面路由一致
69
 // meta下isData:true为数据看板,否则为助手
69
 // meta下isData:true为数据看板,否则为助手
316
         }
316
         }
317
       },
317
       },
318
       {
318
       {
319
-        path: 'platformManage',
320
-        name: 'platformManage',
321
-        component: platformManage,
319
+        path: 'accountManage',
320
+        name: 'accountManage',
321
+        component: accountManage,
322
         meta: {
322
         meta: {
323
           keepAlive: false,
323
           keepAlive: false,
324
           isLogin: true,
324
           isLogin: true,
325
-          title: '平台管理'
325
+          title: '平台账号管理'
326
         }
326
         }
327
       },
327
       },
328
       {
328
       {