Parcourir la source

流量分析重构

zq940222 il y a 5 mois
Parent
commit
5a69425211

+ 20 - 15
src/views/adweb/data/trafficAnalysis.vue

@@ -255,7 +255,7 @@
 <script lang="ts" name="data-trafficAnalysis" setup>
 import selectSite from "@/components/Adweb/selectSite.vue";
 import areaChart from "./chart/areaChart.vue";
-import { reactive, ref, watch } from "vue";
+import { onMounted, reactive, ref, watch } from "vue";
 import { getAction } from "@/api/manage/manage";
 import moment from "moment";
 import MapAdweb from "@/components/chart/mapAdweb.vue";
@@ -263,6 +263,8 @@ import MapAdweb from "@/components/chart/mapAdweb.vue";
 const siteList = ref([]);
 const selectSiteInfo = ref({});
 const queryParam = reactive<any>({});
+queryParam.limit = 10;
+queryParam.siteCode = localStorage.getItem("siteCode");
 const loading = ref(false);
 const chartheight = ref(400);
 const chartDetailDataCol = ref([
@@ -378,7 +380,7 @@ const mostAccessColumns = ref([
   },
   {
     title: "浏览量占比",
-    dataIndex: "accessProportion",
+    dataIndex: "pvProportion",
     width: 160,
     scopedSlots: {
       customRender: "centerSlot"
@@ -396,19 +398,17 @@ const mostAccessColumns = ref([
 ]);
 
 function changeSite(value, e) {
-  selectSiteInfo.value = e.data.attrs.info;
-  queryParam.siteId = selectSiteInfo.id;
-  reloadData(queryParam.siteId);
+  console.log(value, e)
+  selectSiteInfo.value = e.info;
+  console.log(selectSiteInfo.value)
+  queryParam.siteCode = selectSiteInfo.value.code;
+  localStorage.setItem("siteCode", queryParam.siteCode);
+  reloadData();
 }
 
 //重新刷新页面数据
-function reloadData(value) {
+function reloadData() {
   loading.value = true;
-  for (let i in siteList.value) {
-    if (value === siteList[i].id) {
-      localStorage.setItem("siteCode", siteList[i].code);
-    }
-  }
   getFlowIndexNumber();
   getCountryMapData();
   getMediaList();
@@ -519,7 +519,8 @@ const mostAccessDatasource = ref([]);
 //
 const getMostAccessList = async () => {
   try {
-    const res = await getAction("/datacenter/mostaccess/list", queryParam);
+    const res = await getAction("/ga-data/page-path/stats", queryParam);
+    console.log("res", res);
     if (res.code == 200) {
       mostAccessDatasource.value = res.result;
     } else {
@@ -538,7 +539,7 @@ const onChangeDatePciker = (date, dateString) => {
     queryParam.value.start = dateString[0];
     queryParam.value.end = dateString[1];
     queryParam.value.dateType = undefined;
-    reloadData(queryParam.siteId);
+    reloadData();
   }
 };
 
@@ -564,12 +565,16 @@ const setTime = (time) => {
     rangeDate.value = [moment(), moment()];
   }
 
-  reloadData(queryParam.siteId);
+  reloadData();
 };
 
 // 监听queryParam的变化,当它变化时重新加载数据
 watch(queryParam, (newValue, oldValue) => {
-  reloadData(queryParam.siteId);
+  reloadData();
+});
+
+onMounted(() => {
+  reloadData();
 });
 </script>
 

+ 0 - 26
src/views/adweb/keywords/SeoKeywords.data.ts

@@ -54,32 +54,6 @@ export const columns: BasicColumn[] = [
 //查询数据
 export const searchFormSchema: FormSchema[] = [
   {
-    label: "站点",
-    field: 'siteCode',
-    component: 'ApiSelect',
-    componentProps: {
-      //multiple: 多选;不填写为单选
-      mode: '',
-      //请求api,返回结果{ result: { records: [{'id':'1',name:'scott'},{'id':'2',name:'小张'}] }}
-      api: ()=> defHttp.get({ url: '/seo/seoKeywordsRank/getAllSites' }),
-      //数值转成String
-      numberToString: false,
-      //标题字段
-      labelField: 'name',
-      //值字段
-      valueField: 'code',
-      //是否为搜索模式
-      showSearch: true,
-      allowClear: false,
-      defaultValue: localStorage.getItem('siteCode'),
-      //请求参数
-      params:{},
-      // value:localStorage.getItem('siteCode') !== null?localStorage.getItem('siteCode'):'',
-      //返回结果字段
-      resultField:'result'
-    },
-  },
-  {
     label: "关键词",
     field: 'keywords',
     component: 'Input',

+ 95 - 127
src/views/adweb/keywords/SeoKeywordsList.vue

@@ -1,5 +1,34 @@
 <template>
   <div>
+    <!-- 查询区域 -->
+    <div class="table-page-search-wrapper">
+      <a-row :gutter="8" class="r1">
+        <a-col span="8">
+          <span class="t1">站点:</span>
+          <select-site @comMethods="changeSite" />
+        </a-col>
+        <!--          <a-col span="8">-->
+        <!--            <span class="t1">套餐:</span>-->
+        <!--              <a-select-->
+        <!--                placeholder="请选择套餐"-->
+        <!--                @change="changeSeoPlans"-->
+        <!--                v-model="queryParam.historyId">-->
+        <!--                <a-select-option-->
+        <!--                  v-for="(data,index) in planList"-->
+        <!--                  :key="index"-->
+        <!--                  :value="data.subscriptionId"-->
+        <!--                >-->
+        <!--                  {{ data.planName }}-->
+        <!--                </a-select-option>-->
+        <!--              </a-select>-->
+        <!--          </a-col>-->
+        <!--          <a-col span="8" v-if=" marketPlanInfo.domain !== null">-->
+        <!--            <span class="t1">域名:</span>-->
+        <!--              {{ marketPlanInfo.domain }}-->
+        <!--          </a-col>-->
+      </a-row>
+    </div>
+    <!-- 查询区域-END -->
     <!--引用表格-->
     <BasicTable @register="registerTable" :rowSelection="rowSelection">
       <!--插槽:table标题-->
@@ -91,14 +120,11 @@ import { useListPage } from "/@/hooks/system/useListPage";
 import SeoKeywordsModal from "./components/SeoKeywordsModal.vue";
 import { columns, searchFormSchema, superQuerySchema } from "./SeoKeywords.data";
 import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from "./SeoKeywords.api";
-import { downloadFile } from "/@/utils/common/renderUtils";
-import { useUserStore } from "/@/store/modules/user";
 import { getAllSites } from "@/views/adweb/seo/SeoKeywordsRank.api";
-import { getAction } from "@/api/manage/manage";
+import SelectSite from "@/components/Adweb/selectSite.vue";
 
 const queryParam = reactive<any>({});
-const checkedKeys = ref<Array<string | number>>([]);
-const userStore = useUserStore();
+queryParam.siteCode = localStorage.getItem("siteCode");
 //注册model
 const [registerModal, { openModal }] = useModal();
 //注册table数据
@@ -141,66 +167,7 @@ const siteinfo = ref([]);
 
 const selectSiteInfo = ref({});
 
-const modalVisible = ref(false);
-
-const modalTitle = ref("");
-
-const addSeoKeywordStatus = ref(false);
-
-const addSeoKeywordResStatus = ref(false);
-
-const tipTitle = ref("");
-
-const spinning = ref(false);
-
-const seoRepeatKeywords = ref([]);
-
-const keywordType = ref(1);
-
-const formItemLayout = ref( {
-  labelCol: {
-    xs: { span: 24 },
-    sm: { span: 4 }
-  },
-  wrapperCol: {
-    xs: { span: 24 },
-    sm: { span: 20 }
-  }
-})
-
-const formItemLayoutWithOutLabel = ref({
-  wrapperCol: {
-    xs: { span: 24, offset: 0 },
-    sm: { span: 20, offset: 4 }
-  }
-})
-
-const dynamicValidateForm = ref({
-  domains: [
-    {
-      key: 1621308099985,
-      value: ''
-    },
-    {
-      key: 1621308099986,
-      value: ''
-    },
-    {
-      key: 1621308099987,
-      value: ''
-    }
-  ]
-})
-
-/**
- * 高级查询事件
- */
-function handleSuperQuery(params) {
-  Object.keys(params).map((k) => {
-    queryParam[k] = params[k];
-  });
-  reload();
-}
+const planList = ref([]);
 
 /**
  * 新增事件
@@ -273,9 +240,6 @@ function getTableAction(record) {
 function getDropDownAction(record) {
   return [
     {
-      label: "趋势",
-      onClick: handleDetail.bind(null, record)
-    }, {
       label: "删除",
       popConfirm: {
         title: "是否确认删除",
@@ -289,10 +253,10 @@ function getDropDownAction(record) {
 function onPriorityChange($event, id) {
   // postAction('/serp/seoKeywords/changePriority' + '?id=' + id + '&value=' + $event.target.value).then(function(res) {
   //   if (res.code === 200) {
-  //     that.$message.success('优先级更改成功!')
-  //     that.loadData()
+  //     $message.success('优先级更改成功!')
+  //     loadData()
   //   } else {
-  //     that.$message.error('优先级更改失败!')
+  //     $message.error('优先级更改失败!')
   //     return
   //   }
   // })
@@ -302,12 +266,12 @@ function onPriorityChange($event, id) {
 function onchange($event, id) {
 
   // let that = this
-  // postAction(that.url.changeTypeUrl + '?id=' + id + '&type=' + $event.target.value).then(function(res) {
+  // postAction(url.changeTypeUrl + '?id=' + id + '&type=' + $event.target.value).then(function(res) {
   //   if (res.code === 200) {
-  //     that.$message.success('关键词类型更改成功!')
-  //     that.loadData()
+  //     $message.success('关键词类型更改成功!')
+  //     loadData()
   //   } else {
-  //     that.$message.error(res.message)
+  //     $message.error(res.message)
   //     return
   //   }
   // })
@@ -319,7 +283,11 @@ function changeSite(value, e) {
   selectSiteInfo.value = e.info;
   // siteCode.value = value
   // keywords.value = ''
-  localStorage.setItem("siteCode", value);
+  queryParam.siteCode = e.info.code;
+  console.log(e.info.code);
+  localStorage.setItem("siteCode", e.info.code);
+  getSiteInfo();
+  handleSuccess();
 }
 
 //先执行获取site信息,只有在获取到siteCode之后,才能执行以下方法
@@ -350,63 +318,63 @@ function downloadTemplate() {
   return window.open("/adwebv21/uploadDemo/关键词导入模版表.xlsx", "_self");
 }
 
-function handleAddSeo() {
-  modalVisible.value = true;
-  modalTitle.value = "新增SEO关键词";
-  addSeoKeywordStatus.value = true;
-}
-
-function handleCancel() {
-
-}
-
-function handleRepeat(rule, value, callback) {
-  // let seoDatas = dynamicValidateForm.value.domains
-  // let getSeoKeywordUrl = `/seo/seoKeywords/getSeoKeyword` + '?siteCode=' + seoKeywordsForm.userFlag + '&keywords=' + value + '&historyId=' + queryParam.historyId
-  // getAction(getSeoKeywordUrl).then(function(res) {
-  //   // console.log(res)
-  //   if (res.code == 200) {
-  //     if (res.result) {
-  //       let resArr = seoDatas.filter(item => {
-  //         return item.value === value
-  //       })
-  //       // console.log("resArr", resArr)
-  //       if (resArr.length > 1) {
-  //         if (value && resArr[0].value) {
-  //           if (resArr[0].value === value) {
-  //             callback('SEO关键词重复')
-  //             return false
-  //           }
-  //           callback()
-  //         }
-  //       } else {
-  //         callback()
-  //       }
-  //     } else {
-  //       callback('SEO关键词已存在!')
-  //     }
-  //   }
-  // }).catch(function(err) {
-  //   console.log(err)
-  // })
-}
+const marketPlanInfo = ref({
+  "domain": "",
+  "htyStatus": 0
+});
 
-function removeSeoKeywords(item) {
-  let index = dynamicValidateForm.value.domains.indexOf(item)
-  if (index !== -1) {
-    dynamicValidateForm.value.domains.splice(index, 1)
+const changeSeoPlans = () => {
+  // 站点套餐切换函数
+  for (let i = 0; i < planList.value.length; i++) {
+    if (planList[i].subscriptionId === queryParam.subscriptionId) {
+      planList[i].domain = marketPlanInfo.value.domain;
+      marketPlanInfo.value = planList[i];
+      break;
+    }
   }
-}
-function addSeoKeywords() {
-  dynamicValidateForm.value.domains.push({
-    value: '',
-    key: Date.now()
-  })
-}
+};
 </script>
 
 <style scoped>
 :deep(.ant-picker), :deep(.ant-input-number) {
   width: 100%;
 }
+
+.r1 {
+  margin: 20px;
+  display: flex;
+
+  /deep/ .ant-select-selection {
+    background: transparent;
+  }
+
+  /deep/ .ant-select-selection__clear {
+    background: transparent;
+  }
+
+  /deep/ i, /deep/ .ant-calendar-range-picker-separator {
+  }
+
+
+  .t1 {
+    font-size: 18px;
+  }
+
+  .ant-calendar-picker {
+    margin-right: 20px;
+
+    /deep/ .ant-input {
+      background: transparent;
+    }
+  }
+
+  /deep/ .ant-btn {
+    background: transparent;
+    margin-right: 10px;
+
+    &.active {
+      color: @primary-color;
+    }
+  }
+}
 </style>