Эх сурвалжийг харах

fix(广告列表页): 修复了有时会出现图表无法展示的BUG

1.在初始化时,错误的设置了广告类型的值,并且重复的更新了图表数据,导致两次请求了两次,并且两次请求的数据不一样,导致出现数据被覆盖的情况。
2. 修复了表格中广告类型没有下拉框的BUG
fxs 3 сар өмнө
parent
commit
b7385ada52

+ 3 - 1
src/components/echarts/PieBorderRadius.vue

@@ -66,6 +66,8 @@ watch(
   () => props.options,
   (newVal) => {
     if (!pieChart.value) return
+    console.log('执行多变')
+    console.log(newVal)
     if (!newVal) {
       pieChart.value.clear()
       pieChart.value.setOption({
@@ -81,7 +83,7 @@ watch(
       pieChart.value.setOption(newVal, true)
     }
   },
-  { deep: true, immediate: true }
+  { deep: true }
 )
 
 onMounted(() => {

+ 37 - 56
src/views/Home/AdvertisingData/AdvertisingList.vue

@@ -173,35 +173,6 @@ const adStateOptions: Array<SelectInfo> = [
   }
 ]
 
-// 查询字段设置
-const queryInfo = reactive<Array<QueryInfo>>([
-  {
-    name: 'adsState',
-    label: '广告状态',
-    type: FilterType.MULTI_SELECT,
-    placeholder: '请选择广告状态',
-    otherOption: adStateOptions,
-    default: [0, 1, 2],
-    supplementInfo: '此项全选与全不选均为查找所有'
-  },
-  {
-    name: 'adsType',
-    label: '广告类型',
-    type: FilterType.INPUT,
-    placeholder: '请输入广告类型',
-    otherOption: null,
-    default: ''
-  },
-  {
-    name: 'openId',
-    label: '用户openId',
-    type: FilterType.INPUT,
-    placeholder: '请输入用户openId',
-    otherOption: null,
-    default: ''
-  }
-])
-
 // 工具栏配置
 const tableToolsConfig: TableToolsConfig = {
   add: false,
@@ -232,25 +203,46 @@ const adTypeOptions: Array<SelectInfo> = [
 ]
 
 // 查询字段设置
-const filterInfo = reactive<Array<QueryInfo>>([
+const tableFilterInfo = reactive<Array<QueryInfo>>([
+  {
+    name: 'adsState',
+    label: '广告状态',
+    type: FilterType.MULTI_SELECT,
+    placeholder: '请选择广告状态',
+    otherOption: adStateOptions,
+    default: [0, 1, 2],
+    supplementInfo: '此项全选与全不选均为查找所有'
+  },
+  {
+    name: 'adsType',
+    label: '广告类型',
+    type: FilterType.SELECT,
+    placeholder: '请选择广告类型',
+    otherOption: adTypeOptions,
+    default: 'Rewarded',
+    clearable: true
+  },
+  {
+    name: 'openId',
+    label: '用户openId',
+    type: FilterType.INPUT,
+    placeholder: '请输入用户openId',
+    otherOption: null,
+    default: ''
+  }
+])
+
+// 查询字段设置
+const chartFilterInfo = reactive<Array<QueryInfo>>([
   {
     name: 'adsType',
     label: '广告类型',
     type: FilterType.SELECT,
     placeholder: '请输入广告类型',
     otherOption: adTypeOptions,
-    default: '',
+    default: 'Rewarded',
     clearable: true
   }
-  // {
-  //   name: 'createTime',
-  //   label: '创建时间',
-  //   type: FilterType.DATE,
-  //   placeholder: '选择日期',
-  //   otherOption: {
-  //     dataRange: true
-  //   }
-  // }
 ])
 
 const headerCardInfo: HeaderCardProps = {
@@ -276,7 +268,7 @@ interface ChartQuery {
 const queryFormData = ref<ChartQuery>({
   gid: tempMultipleChoice.gid,
   pf: tempMultipleChoice.pf,
-  adsType: 'Interstitial ',
+  adsType: 'Rewarded',
   createTime: ['', '']
 })
 
@@ -285,17 +277,6 @@ const chartNeedFields: string[] = []
 const isPie = ref(true)
 const isRadioPf = ref(false)
 
-// watch(
-//   () => tempMultipleChoice,
-//   (newVal: { gid: string; pf: Array<string> }) => {
-//     queryFormData.value.gid = newVal.gid
-//     queryFormData.value.pf = newVal.pf
-//   },
-//   {
-//     deep: true
-//   }
-// )
-
 /**
  * 更新请求配置
  * @param pf  新pf
@@ -304,7 +285,7 @@ const isRadioPf = ref(false)
 const updateAllReq = (pf: string[], gid: string) => {
   queryFormData.value.gid = gid
   queryFormData.value.pf = pf
-  updateChartData()
+  // updateChartData()
   updateReqConfig(requestConfig, { pf, gid })
   // updateReqConfig(keepDataTableInfo.requestConfig, { pf, gid })
 }
@@ -334,7 +315,7 @@ watchPageChange(() => [tempMultipleChoice.pf, selectInfo.gid], backupSelect, upd
 const { updateChartData, chartOptions } = useTableChart(
   AllApi.adListChart,
   queryFormData,
-  filterInfo,
+  chartFilterInfo,
   chartNeedFields,
   isPie,
   chartRef,
@@ -357,7 +338,7 @@ const { updateChartData, chartOptions } = useTableChart(
       <div class="filterContainer">
         <TableFilterForm
           v-model:queryFormData="queryFormData"
-          :queryInfo="filterInfo"
+          :queryInfo="chartFilterInfo"
           @query="updateChartData"
           ref="filterFormRef"
         ></TableFilterForm>
@@ -389,7 +370,7 @@ const { updateChartData, chartOptions } = useTableChart(
           :pagination-config="paginationConfig"
           :table-fields-info="tableFieldsInfo"
           :request-config="requestConfig"
-          :query-info="queryInfo"
+          :query-info="tableFilterInfo"
           :open-filter-query="true"
           :tools="tableToolsConfig"
         ></CustomTable>