瀏覽代碼

feat: 数据看板 - 粉丝激活趋势 - 权限控制逻辑

zhengxy 2 年之前
父節點
當前提交
52fdea1184

+ 1 - 1
project/src/components/dataBoard/accountTrends.vue

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <div class="accountTrends-wrap" v-loading="pageLoading">
3 3
     <!-- S 无权限 -->
4
-    <el-empty class="empty-wrap" v-if="isShowEmpty" description="暂无数据权限" />
4
+    <el-empty v-if="isShowEmpty" class="empty-wrap" description="暂无数据权限" />
5 5
     <!-- E 无权限 -->
6 6
 
7 7
     <template v-else>

File diff suppressed because it is too large
+ 944 - 0
project/src/components/dataBoard/copy0104_fansActiveTrends.vue


+ 98 - 50
project/src/components/dataBoard/fansActiveTrends.vue

@@ -1,51 +1,59 @@
1 1
 <template>
2 2
   <div class="fansActiveTrends-wrap" v-loading="pageLoading">
3
-    <div class="screenBox flex">
4
-      <switchMpAdq v-model="filter.order_type" @change="onChangeOrderType" />
5
-      <el-button type="primary" size="mini" @click="onClickExport">导出Excel</el-button>
6
-    </div>
7
-    <!-- S 筛选区 -->
8
-    <div class="screenBox filter-wrap">
9
-      <!-- 日期 -->
10
-      <datePicker style="margin-right: 30px;" :reset="reset" title="自定义" :quickFlag="true" :afferent_time="default_time" :clearFlag="false" @changeTime="onChangeTime" />
11
-      <!-- MP账号(公众号) -->
12
-      <selfChannel style="margin-right: 30px;margin-left: -30px;" v-show="isMP" :reset="reset" title="账号" type="thePublic" labelWidth @channelDefine="onChangeAccountId" />
13
-      <!-- ADQ账号(ADQ) -->
14
-      <selfChannel style="margin-right: 30px;margin-left: -30px;" v-show="isADQ" :reset="reset" title="账号" type="adqAccount" labelWidth @channelDefine="onChangeAccountIdAdq" />
15
-      <!-- 短剧 -->
16
-      <selfChannel style="margin-right: 30px;margin-left: -30px;" :reset="reset" title="短剧" type="dramaList" labelWidth @channelDefine="onChangePlayletId" />
17
-      <!-- 收益截止日期 -->
18
-      <div style="margin-right: 30px;" class="common-screen-item">
19
-        <label class="common-screen-label">收益截止日期</label>
20
-        <el-date-picker v-model="filter.closing_date" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" size="small" style="width:150px" @change="onChangeClosingDate" />
3
+    <!-- S 无权限 -->
4
+    <el-empty v-if="isShowEmpty" class="empty-wrap" description="暂无数据权限" />
5
+    <!-- E 无权限 -->
6
+
7
+    <template v-else>
8
+      <div class="screenBox flex">
9
+        <switchMpAdq
10
+          v-model="filter.order_type"
11
+          :isShowAdqBtn="isShowAdqBtn"
12
+          :isShowMpBtn="isShowMpBtn"
13
+          @change="onChangeOrderType"
14
+        />
15
+        <el-button v-if="isCanExport" type="primary" size="mini" @click="onClickExport">导出Excel</el-button>
21 16
       </div>
22
-      <!-- 推广类型 -->
23
-      <selfChannel style="margin-right: 30px;margin-left: -30px;" :reset="reset" title="推广类型" type="promotionType" labelWidth @channelDefine="onChangePromotionType" />
24
-      <div class="flex">
25
-        <!-- 回本率(范围) -->
26
-        <inputRange style="margin-right: 10px;" v-model="filter.costCover" label="回本率" />
27
-        <el-button size="mini" type="primary" plain @click="onClickSearch">确定</el-button>
28
-        <el-button size="mini" plain @click="onClickReset">重置</el-button>
17
+      <!-- S 筛选区 -->
18
+      <div class="screenBox filter-wrap">
19
+        <!-- 日期 -->
20
+        <datePicker style="margin-right: 30px;" :reset="reset" title="自定义" :quickFlag="true" :afferent_time="default_time" :clearFlag="false" @changeTime="onChangeTime" />
21
+        <!-- MP账号(公众号) -->
22
+        <selfChannel style="margin-right: 30px;margin-left: -30px;" v-show="isMP" :reset="reset" title="账号" type="thePublic" labelWidth @channelDefine="onChangeAccountId" />
23
+        <!-- ADQ账号(ADQ) -->
24
+        <selfChannel style="margin-right: 30px;margin-left: -30px;" v-show="isADQ" :reset="reset" title="账号" type="adqAccount" labelWidth @channelDefine="onChangeAccountIdAdq" />
25
+        <!-- 短剧 -->
26
+        <selfChannel style="margin-right: 30px;margin-left: -30px;" :reset="reset" title="短剧" type="dramaList" labelWidth @channelDefine="onChangePlayletId" />
27
+        <!-- 收益截止日期 -->
28
+        <div style="margin-right: 30px;" class="common-screen-item">
29
+          <label class="common-screen-label">收益截止日期</label>
30
+          <el-date-picker v-model="filter.closing_date" value-format="yyyy-MM-dd" type="date" placeholder="选择日期" size="small" style="width:150px" @change="onChangeClosingDate" />
31
+        </div>
32
+        <!-- 推广类型 -->
33
+        <selfChannel style="margin-right: 30px;margin-left: -30px;" :reset="reset" title="推广类型" type="promotionType" labelWidth @channelDefine="onChangePromotionType" />
34
+        <div class="flex">
35
+          <!-- 回本率(范围) -->
36
+          <inputRange style="margin-right: 10px;" v-model="filter.costCover" label="回本率" />
37
+          <el-button size="mini" type="primary" plain @click="onClickSearch">确定</el-button>
38
+          <el-button size="mini" plain @click="onClickReset">重置</el-button>
39
+        </div>
29 40
       </div>
30
-    </div>
31
-    <!-- E 筛选区 -->
32
-    <!-- S 数据更新时间 -->
33
-    <div class="update-time"><i class="el-icon-warning-outline" />数据更新时间:{{ updateTime || '-' }}</div>
34
-    <!-- E 数据更新时间 -->
35
-    <!-- S 折线图 -->
36
-    <div class="trendBox mt-10" v-loading="chartLoading">
37
-      <div class="legendBox">
38
-        <div class="legendItem" v-for="(item, index) in legendList" :key="index" @click="onClickLegend(item, index)">{{ item.name }}
39
-          <div :class="['checkbox', item.selectFlag ? 'checkbox_active': '']" :style="item.selectFlag ? `background: ${item.color};border-color: ${item.color};`: '' "><i class="el-icon-check" /></div>
41
+      <!-- E 筛选区 -->
42
+      <!-- S 数据更新时间 -->
43
+      <div class="update-time"><i class="el-icon-warning-outline" />数据更新时间:{{ updateTime || '-' }}</div>
44
+      <!-- E 数据更新时间 -->
45
+      <!-- S 折线图 -->
46
+      <div class="trendBox mt-10" v-loading="chartLoading">
47
+        <div class="legendBox">
48
+          <div class="legendItem" v-for="(item, index) in legendList" :key="index" @click="onClickLegend(item, index)">{{ item.name }}
49
+            <div :class="['checkbox', item.selectFlag ? 'checkbox_active': '']" :style="item.selectFlag ? `background: ${item.color};border-color: ${item.color};`: '' "><i class="el-icon-check" /></div>
50
+          </div>
40 51
         </div>
52
+        <div id="trend" style="width: 100%; height: 250px;" />
53
+        <div v-if="!chartDataList || !chartDataList.length" style="text-align: center; color: #333; font-size: 14px; position: relative; top: -100px;">暂无数据</div>
41 54
       </div>
42
-      <div id="trend" style="width: 100%; height: 250px;" />
43
-      <div v-if="!chartDataList || !chartDataList.length" style="text-align: center; color: #333; font-size: 14px; position: relative; top: -100px;">暂无数据</div>
44
-    </div>
45
-    <!-- E 折线图 -->
46
-
47
-    <!-- S 表 -->
48
-
55
+      <!-- E 折线图 -->
56
+      <!-- S 表 -->
49 57
       <!-- S 汇总表 summaryTable -->
50 58
       <div v-loading="summaryLoading">
51 59
         <ux-grid class="summaryTable" ref="summaryTable" :border="false" @row-click="() => { return }" :header-cell-style="getHeaderCellStyle" show-footer-overflow="tooltip" show-overflow="tooltip" size="mini">
@@ -147,7 +155,8 @@
147 155
         </div>
148 156
       </div>
149 157
       <!-- E 明细表 detailsTable -->
150
-    <!-- E 表 -->
158
+      <!-- E 表 -->
159
+    </template>
151 160
   </div>
152 161
 </template>
153 162
 <script>
@@ -200,7 +209,7 @@ export default {
200 209
         total: 0,
201 210
       },
202 211
       filter: {
203
-        order_type: orderTypeOptions.ADQ,
212
+        order_type: '',
204 213
         time: DEFAULT_TIME, // 自定义日期
205 214
         account_id: '', // 账号MP
206 215
         account_id_adq: '', // 账号ADQ
@@ -212,6 +221,7 @@ export default {
212 221
         sort_type: 'desc', // 升序/降序
213 222
       },
214 223
       updateTime: '', // 数据更新时间
224
+      isShowEmpty: false, // 是否展示空页面 => 无任何权限时展示
215 225
     }
216 226
   },
217 227
   computed: {
@@ -239,18 +249,48 @@ export default {
239 249
         return true
240 250
       }
241 251
     },
252
+    // 是否有“ADQ”权限
253
+    isShowAdqBtn() {
254
+      return !!this.$store.state.dataBoardAuth.adq_auth
255
+    },
256
+    // 是否有“MP”权限
257
+    isShowMpBtn() {
258
+      return !!this.$store.state.dataBoardAuth.mp_auth
259
+    },
260
+    // 是否有“导出”权限
261
+    isCanExport() {
262
+      return !!this.$store.state.dataBoardAuth.can_export
263
+    },
242 264
   },
243 265
   created () {
244
-    this.initTableHeight()
245
-    this.handleGetChart()
246
-    this.handleGetSummaryList()
247
-    this.handleGetList()
248
-    this.handleGetUpdateTime()
266
+    const isPermissioned = this.getDefaultOrderType() // 根据用户权限 获取order_type默认值
267
+    if (isPermissioned) { // 有权限 => 获取对应报表数据
268
+      this.initTableHeight()
269
+      this.handleGetChart()
270
+      this.handleGetSummaryList()
271
+      this.handleGetList()
272
+      this.handleGetUpdateTime()
273
+    } else { // 无权限 => 展示空页面
274
+      this.isShowEmpty = true
275
+    }
249 276
   },
250 277
   beforeDestroy () {
251 278
     this.myChart && this.myChart.clear()
252 279
   },
253 280
   methods: {
281
+    // 根据用户权限 获取 order_type 默认值
282
+    getDefaultOrderType() {
283
+      if (this.isShowAdqBtn) { // 有ADQ权限 => 默认值ADQ
284
+        this.filter.order_type = orderTypeOptions.ADQ
285
+        return orderTypeOptions.ADQ
286
+      } else if (this.isShowMpBtn) { // 有MP权限 => 默认值MP
287
+        this.filter.order_type = orderTypeOptions.MP
288
+        return orderTypeOptions.MP
289
+      } else { // 无以上权限 => 返回false
290
+        this.$message.warning('暂无数据权限')
291
+        return false
292
+      }
293
+    },
254 294
     initTableHeight() {
255 295
       this.height = document.documentElement.clientHeight - 200 > 400 ? document.documentElement.clientHeight - 200 : 400
256 296
     },
@@ -705,7 +745,7 @@ export default {
705 745
     // 监听点击"重置"按钮
706 746
     onClickReset() {
707 747
       this.reset = !this.reset
708
-      this.filter.order_type = orderTypeOptions.ADQ
748
+      this.filter.order_type = this.getDefaultOrderType()
709 749
       this.filter.time = this.default_time
710 750
       this.filter.account_id = ''
711 751
       this.filter.account_id_adq = ''
@@ -852,7 +892,15 @@ export default {
852 892
 </style>
853 893
 <style lang="scss" scoped>
854 894
 .fansActiveTrends-wrap {
895
+  position: relative;
896
+  min-height: calc(100vh - 70px);
855 897
   min-width: 1125px;
898
+  .empty-wrap {
899
+    position: absolute;
900
+    top: 50%;
901
+    left: 50%;
902
+    transform: translate(-50%, -50%);
903
+  }
856 904
   .update-time {
857 905
     margin-top: 10px;
858 906
     padding-left: 20px;

+ 1 - 1
project/src/components/dataBoard/shortDramaTrends.vue

@@ -1,7 +1,7 @@
1 1
 <template>
2 2
   <div class="shortDramaTrends-wrap" v-loading="pageLoading">
3 3
     <!-- S 无权限 -->
4
-    <el-empty class="empty-wrap" v-if="isShowEmpty" description="暂无数据权限" />
4
+    <el-empty v-if="isShowEmpty" class="empty-wrap" description="暂无数据权限" />
5 5
     <!-- E 无权限 -->
6 6
 
7 7
     <template v-else>