SeoKeywordsRankList.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. <template>
  2. <div class="seo_keywords_rank_wrap">
  3. <a-row class="r1">
  4. <a-col :span="24">
  5. <div class="choose-site">
  6. <span class="t1">站点:</span>
  7. <select-site @set-site-info="changeSite" selectWidth="300px" />
  8. <span style="margin-left: 16px"
  9. class="t1">{{ (selectSiteInfo.planName && selectSiteInfo.planType !== "STATIONCONSTRUCTION") ? selectSiteInfo.planName : "暂无SEO推广套餐~"
  10. }}
  11. <a-popover placement="bottom"
  12. v-show="selectSiteInfo.planName && selectSiteInfo.planType !== 'STATIONCONSTRUCTION'">
  13. <template #content>
  14. <span>
  15. 指定词数:{{ comprehenInfo.planAppointKeywordNum }}&nbsp;
  16. </span>
  17. <span>
  18. 关键词数:{{ comprehenInfo.planLongTailKeywordNum }}&nbsp;
  19. </span>
  20. <span>
  21. 外链数:{{ comprehenInfo.planOuterLinkNum }}&nbsp;
  22. </span>
  23. <span>
  24. 文章数:{{ comprehenInfo.planArticleNum }}
  25. </span>
  26. </template>
  27. <img
  28. src="https://cutomer-static-bucket.s3.cn-northwest-1.amazonaws.com.cn/public/material/220803883dfy/document/changjianwenti_1676606434975.png"
  29. alt="issue" width="25px" height="25px" />
  30. </a-popover>
  31. </span>
  32. </div>
  33. </a-col>
  34. </a-row>
  35. <a-row class="r2" type="flex" justify="center" align="middle">
  36. <a-col :span="6">
  37. <p class="t1"><img src="../../../assets/seo/zhidingci.svg" />指定词</p>
  38. <p class="t2" v-if="comprehenInfo.appointKeywordNum == null">
  39. -
  40. </p>
  41. <p class="t2" v-else>
  42. <a @click="changeKeywordType()">{{ comprehenInfo.appointKeywordNum }}</a>
  43. </p>
  44. </a-col>
  45. <a-col :span="6">
  46. <p class="t1"><img src="../../../assets/seo/changweici.svg" />关键词</p>
  47. <p class="t2" v-if="comprehenInfo.longTailKeywordNum == null">
  48. -
  49. </p>
  50. <p class="t2" v-else>
  51. <a @click="longChangeKeywordType()">{{ comprehenInfo.longTailKeywordNum }}</a>
  52. </p>
  53. </a-col>
  54. <a-col :span="6">
  55. <p class="t1"><img src="../../../assets/seo/lianjieshu.svg" />外链数</p>
  56. <p class="t2" v-if="comprehenInfo.outerLinkNum == null">
  57. -
  58. </p>
  59. <p class="t2">
  60. <span>{{ comprehenInfo.outerLinkNum }}</span>
  61. </p>
  62. </a-col>
  63. <a-col :span="6">
  64. <p class="t1"><img src="../../../assets/seo/wenzhangshu.svg" />文章数</p>
  65. <p class="t2" v-if="comprehenInfo.articleNum == null">
  66. -
  67. </p>
  68. <p class="t2">
  69. <span>{{ comprehenInfo.articleNum }}</span>
  70. </p>
  71. </a-col>
  72. </a-row>
  73. <a-row class="r3" type="flex" :gutter="16">
  74. <a-col :span="12">
  75. <div class="wrap">
  76. <p class="t1">指定词排名</p>
  77. <div class="content">
  78. <div class="d1"><img src="../../../assets/seo/NO1.svg" />1-10位</div>
  79. <div class="d2"><a @click="getTableInfoRank(3,1)">{{ rankInfo.appointKeyword.firstNum
  80. }}</a>个
  81. </div>
  82. </div>
  83. <div class="content">
  84. <div class="d1"><img src="../../../assets/seo/NO2.svg" />11-30位</div>
  85. <div class="d2"><a @click="getTableInfoRank(7,1)">{{
  86. rankInfo.appointKeyword.secondNum }}</a>个
  87. </div>
  88. </div>
  89. <div class="content">
  90. <div class="d1"><img src="../../../assets/seo/NO3.svg" />31-100位</div>
  91. <div class="d2"><a @click="getTableInfoRank(8,1)">{{
  92. rankInfo.appointKeyword.thirdType }}</a>个
  93. </div>
  94. </div>
  95. </div>
  96. </a-col>
  97. <a-col :span="12">
  98. <div class="wrap">
  99. <p class="t1">关键词排名</p>
  100. <div class="content">
  101. <div class="d1"><img src="../../../assets/seo/NO1.svg" />1-10位</div>
  102. <div class="d2">
  103. <a @click="longGetTableInfoRank(3)">{{ rankInfo.longTailKeyword.firstNum }}</a>个
  104. </div>
  105. </div>
  106. <div class="content">
  107. <div class="d1"><img src="../../../assets/seo/NO2.svg" />11-30位</div>
  108. <div class="d2"><a @click="longGetTableInfoRank(7)">{{
  109. rankInfo.longTailKeyword.secondNum }}</a>个
  110. </div>
  111. </div>
  112. <div class="content">
  113. <div class="d1"><img src="../../../assets/seo/NO3.svg" />31-100位</div>
  114. <div class="d2"><a @click="longGetTableInfoRank(8)">{{
  115. rankInfo.longTailKeyword.thirdType }}</a>个
  116. </div>
  117. </div>
  118. </div>
  119. </a-col>
  120. </a-row>
  121. <a-row>
  122. </a-row>
  123. <a-row class="r4">
  124. <a-card title="指定词" :bordered="false" style="width: 100%">
  125. <a-col :span="24">
  126. <a-row class="table-tool-wrap" type="flex">
  127. <a-col :span="8">
  128. <ul>
  129. <li :class="{active:show==1}" @click="getTableInfoRank(1)">全部</li>
  130. <li :class="{active:show==3}" @click="getTableInfoRank(3)">第一页</li>
  131. <li :class="{active:show==4}" @click="getTableInfoRank(4)">前三页</li>
  132. <li :class="{active:show==5}" @click="getTableInfoRank(5)">前五页</li>
  133. <li :class="{active:show==6}" @click="getTableInfoRank(6)">前十页</li>
  134. </ul>
  135. </a-col>
  136. <a-col :span="16" style="text-align: right">
  137. <a-button type="link" @click="rankingClick"
  138. :style="rankingButtonStatus == false ? 'border-style: none;color: black !important;': 'border-style: none;color: #544BEB !important;'">
  139. 按排名
  140. <a-icon :type="rankingButtonArrow" v-if="rankingButtonStatus" />
  141. </a-button>
  142. <a-button type="link"
  143. :style="wordsButtonStatus == false ? 'margin-right: 16px;border-style: none;color: black !important;': 'margin-right: 16px;border-style: none;color: #544BEB !important;'"
  144. @click="wordsClick">
  145. 按字数
  146. <a-icon :type="wordsButtonArrow" v-if="wordsButtonStatus" />
  147. </a-button>
  148. <a-input
  149. placeholder="请输入关键词"
  150. style="width: 200px;margin-right: 8px"
  151. v-model:value="keywords"
  152. >
  153. </a-input>
  154. <a-button type="primary" preIcon="ant-design:search-outlined"
  155. style="margin-right: 8px" @click="setTable">
  156. 查询
  157. </a-button>
  158. <a-button ghost type="primary" preIcon="ant-design:reload-outlined"
  159. @click="searchReset">
  160. 重置
  161. </a-button>
  162. <!-- <a-button ghost type="primary" @click="handleExportXlsLU('关键词排名',1)" style="margin-left: 8px" :loading="excelLoading">导出Excel</a-button>-->
  163. </a-col>
  164. </a-row>
  165. </a-col>
  166. <a-col :span="24">
  167. <a-table
  168. ref="table"
  169. size="middle"
  170. :scroll="{x:true}"
  171. rowKey="id"
  172. :columns="columns"
  173. :dataSource="dataSource"
  174. :pagination="ipagination"
  175. :loading="loading"
  176. class="j-table-force-nowrap"
  177. @change="handleTableChange">
  178. <template #bodyCell="{ column, record, index, text }">
  179. <template v-if="column.key === 'rowIndex' ">
  180. {{ (ipagination.current - 1) * ipagination.pageSize + index + 1 }}
  181. </template>
  182. <template class="title" v-if="column.key === 'keywords'">
  183. <span style="white-space:pre">{{ text }}</span>
  184. <span
  185. v-if="comprehenInfo.specifyKeywordNum != null && comprehenInfo.longTailKeywordNum != null">
  186. <a-tag v-if="record.keywordType == 1" color="blue"
  187. style="margin-left: 8px">指定</a-tag>
  188. </span>
  189. </template>
  190. <template class="tag" v-if="column.key === 'tag'">
  191. <a-popover v-if="text != 0" placement="bottom" overlayClassName="self-pop">
  192. <img style="width: 18px;position: relative;top: -2px;"
  193. v-if="text >= 1 && text <= 10 " src="../../../assets/seo/NO1.svg" />
  194. <img style="width: 18px;position: relative;top: -2px;"
  195. v-if="text >= 11 && text <= 20 " src="../../../assets/seo/NO2.svg" />
  196. <img style="width: 18px;position: relative;top: -2px;"
  197. v-if="text >= 21 && text <= 30 " src="../../../assets/seo/NO3.svg" />
  198. <template slot="content">
  199. <p style="margin-bottom: 0">第{{ parseInt((text - 1) / 10) + 1
  200. }}页,总排名{{ text }}</p>
  201. </template>
  202. <span style="cursor: default;margin-left: 5px">{{ text }}</span>
  203. </a-popover>
  204. <span v-else>
  205. <img style="width: 18px;position: relative;top: -2px;"
  206. v-if="text >= 1 && text <= 10 " src="../../../assets/seo/NO1.svg" />
  207. <img style="width: 18px;position: relative;top: -2px;"
  208. v-if="text >= 11 && text <= 20 " src="../../../assets/seo/NO2.svg" />
  209. <img style="width: 18px;position: relative;top: -2px;"
  210. v-if="text >= 21 && text <= 30 " src="../../../assets/seo/NO3.svg" />
  211. {{ text }}</span>
  212. </template>
  213. <template v-if="column.key === 'action'">
  214. <a-button size="small" @click="gotoSearch(record.keywords)" type="primary">去查询
  215. </a-button>
  216. </template>
  217. </template>
  218. </a-table>
  219. </a-col>
  220. </a-card>
  221. </a-row>
  222. <a-row class="r4" style="margin-top: 10px">
  223. <a-card title="关键词" :bordered="false" style="width: 100%">
  224. <a-col :span="24">
  225. <a-row class="table-tool-wrap" type="flex">
  226. <a-col :span="8">
  227. <ul>
  228. <li :class="{active:longShow==1}" @click="longGetTableInfoRank(1)">全部</li>
  229. <li :class="{active:longShow==3}" @click="longGetTableInfoRank(3)">第一页</li>
  230. <li :class="{active:longShow==4}" @click="longGetTableInfoRank(4)">前三页</li>
  231. <li :class="{active:longShow==5}" @click="longGetTableInfoRank(5)">前五页</li>
  232. <li :class="{active:longShow==6}" @click="longGetTableInfoRank(6)">前十页</li>
  233. </ul>
  234. </a-col>
  235. <a-col :span="16" style="text-align: right">
  236. <a-button type="link" @click="longRankingClick"
  237. :style="longRankingButtonStatus == false ? 'border-style: none;color: black !important;': 'border-style: none;color: #544BEB !important;'">
  238. 按排名
  239. <a-icon :type="longRankingButtonArrow" v-if="longRankingButtonStatus" />
  240. </a-button>
  241. <a-button type="link"
  242. :style="longWordsButtonStatus == false ? 'margin-right: 16px;border-style: none;color: black !important;': 'margin-right: 16px;border-style: none;color: #544BEB !important;'"
  243. @click="longWordsClick">
  244. 按字数
  245. <a-icon :type="longWordsButtonArrow" v-if="longWordsButtonStatus" />
  246. </a-button>
  247. <a-input
  248. placeholder="请输入关键词"
  249. style="width: 200px;margin-right: 8px"
  250. v-model:value="longKeywords"
  251. >
  252. </a-input>
  253. <a-button type="primary" preIcon="ant-design:search-outlined"
  254. style="margin-right: 8px" @click="longSetTable">
  255. 查询
  256. </a-button>
  257. <a-button ghost type="primary" preIcon="ant-design:reload-outlined"
  258. @click="longSearchReset">
  259. 重置
  260. </a-button>
  261. <!-- <a-button ghost type="primary" @click="handleExportXlsLU('关键词排名',2)" style="margin-left: 8px" :loading="longExcelLoading">导出Excel</a-button>-->
  262. </a-col>
  263. </a-row>
  264. </a-col>
  265. <a-col :span="24">
  266. <a-table
  267. ref="table"
  268. size="middle"
  269. :scroll="{x:true}"
  270. rowKey="id"
  271. :columns="longColumns"
  272. :dataSource="longDataSource"
  273. :pagination="longIpagination"
  274. :loading="longLoading"
  275. class="j-table-force-nowrap"
  276. @change="handleLongTableChange">
  277. <template #bodyCell="{column, record, index, text}">
  278. <template v-if="column.key === 'rowIndex'">
  279. {{ (longIpagination.current - 1) * longIpagination.pageSize + index + 1 }}
  280. </template>
  281. <template class="tag" v-if="column.key === 'tag'">
  282. <a-popover v-if="text != 0" placement="bottom" overlayClassName="self-pop">
  283. <img style="width: 18px;position: relative;top: -2px;"
  284. v-if="text >= 1 && text <= 10 " src="../../../assets/seo/NO1.svg" />
  285. <img style="width: 18px;position: relative;top: -2px;"
  286. v-if="text >= 11 && text <= 20 " src="../../../assets/seo/NO2.svg" />
  287. <img style="width: 18px;position: relative;top: -2px;"
  288. v-if="text >= 21 && text <= 30 " src="../../../assets/seo/NO3.svg" />
  289. <template slot="content">
  290. <p style="margin-bottom: 0">第{{ parseInt((text - 1) / 10) + 1
  291. }}页,总排名{{ text }}</p>
  292. </template>
  293. <span style="cursor: default;margin-left: 5px">{{ text }}</span>
  294. </a-popover>
  295. <span v-else>
  296. <img style="width: 18px;position: relative;top: -2px;"
  297. v-if="text >= 1 && text <= 10 " src="../../../assets/seo/NO1.svg" />
  298. <img style="width: 18px;position: relative;top: -2px;"
  299. v-if="text >= 11 && text <= 20 " src="../../../assets/seo/NO2.svg" />
  300. <img style="width: 18px;position: relative;top: -2px;"
  301. v-if="text >= 21 && text <= 30 " src="../../../assets/seo/NO3.svg" />
  302. {{ text }}</span>
  303. </template>
  304. <template slot="action" v-if="column.key === 'action'">
  305. <a-button size="small" @click="gotoSearch(record.keywords)" type="primary">去查询
  306. </a-button>
  307. </template>
  308. </template>
  309. </a-table>
  310. </a-col>
  311. </a-card>
  312. </a-row>
  313. </div>
  314. </template>
  315. <script>
  316. import { getAction, downFile } from "@/api/manage/manage";
  317. import selectSite from "@/components/Adweb/selectSite.vue";
  318. import { filterObj } from "/@/utils/common/compUtils";
  319. export default {
  320. name: "seoKeywordsRankList",
  321. components: {
  322. selectSite
  323. },
  324. data() {
  325. return {
  326. siteinfo: [],
  327. subscriptionId: "",
  328. selectSiteInfo: {},
  329. siteCode: "",
  330. planId:"",
  331. columns: [
  332. {
  333. title: "序号",
  334. dataIndex: "rowIndex",
  335. key: "rowIndex",
  336. width: 40,
  337. align: "center",
  338. fixed: "left"
  339. },
  340. {
  341. title: "关键词",
  342. dataIndex: "keywords",
  343. key: "keywords",
  344. fixed: "left",
  345. width: 350
  346. }
  347. ],
  348. longColumns: [
  349. {
  350. title: "序号",
  351. dataIndex: "rowIndex",
  352. key: "rowIndex",
  353. width: 40,
  354. align: "center",
  355. fixed: "left"
  356. },
  357. {
  358. title: "关键词",
  359. dataIndex: "keywords",
  360. key: "keywords",
  361. fixed: "left",
  362. width: 350
  363. }
  364. ],
  365. show: 1,
  366. keywordType: undefined,
  367. keywords: "",
  368. url: {
  369. list: "/seo/seoKeywords/keywordList"
  370. },
  371. ipagination: {
  372. pageSize: 10,
  373. pageSizeOptions: ["10", "15", "30", "50"]
  374. },
  375. disableMixinCreated: true,
  376. comprehenInfo: {},
  377. rankInfo: {
  378. appointKeyword: {},
  379. longTailKeyword: {},
  380. serverTime: {}
  381. },
  382. excelLoading: false,
  383. queryParam: {
  384. buttonColmn: "words",
  385. buttonSort: "asc"
  386. },
  387. baseInfo: {
  388. createTime: ""
  389. },
  390. routerQuery: {},
  391. /* 排序参数 */
  392. isorter: {
  393. column: "keywords",
  394. order: "desc"
  395. },
  396. rankingButtonArrow: "arrow-up",
  397. wordsButtonArrow: "arrow-up",
  398. rankingButtonStatus: false,
  399. wordsButtonStatus: true,
  400. longIpagination: {
  401. current: 1,
  402. pageSize: 10,
  403. pageSizeOptions: ["10", "15", "30", "50"],
  404. showTotal: (total, range) => {
  405. return range[0] + "-" + range[1] + " 共" + total + "条";
  406. },
  407. showQuickJumper: true,
  408. showSizeChanger: true,
  409. total: 0
  410. },
  411. longQueryParam: {
  412. buttonColmn: "words",
  413. buttonSort: "asc"
  414. },
  415. longDataSource: [],
  416. longLoading: false,
  417. longExcelLoading: false,
  418. longKeywords: "",
  419. longShow: 1,
  420. /* 排序参数 */
  421. longIsorter: {
  422. column: "keywords",
  423. order: "desc"
  424. },
  425. longRankingButtonArrow: "arrow-up",
  426. longWordsButtonArrow: "arrow-up",
  427. longRankingButtonStatus: false,
  428. longWordsButtonStatus: true,
  429. /* 筛选参数 */
  430. filters: {}
  431. };
  432. },
  433. mounted() {
  434. this.siteCode =localStorage.getItem("siteCode");
  435. this.getSiteInfo();
  436. },
  437. watch: {
  438. "$route.query": {
  439. handler: function(val) {
  440. this.routerQuery = val;
  441. },
  442. immediate: true // 初次变化立即查询
  443. }
  444. },
  445. methods: {
  446. filterOption(input, option) {
  447. return (
  448. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  449. );
  450. },
  451. getAllInfo() {
  452. this.getComprehenInfo();
  453. },
  454. resetAllInfo() {
  455. this.comprehenInfo = {};
  456. this.rankInfo.appointKeyword = {};
  457. this.rankInfo.longTailKeyword = {};
  458. this.rankInfo.serverTime = {};
  459. this.dataSource = [];
  460. this.ipagination.current = 1;
  461. this.ipagination.total = 0;
  462. this.longDataSource = [];
  463. this.longIpagination.current = 1;
  464. this.longIpagination.total = 0;
  465. },
  466. //由于页面的业务关联很多,故将所有的查询条件封装
  467. setTableQuery() {
  468. this.queryParam.siteCode = this.siteCode;
  469. if (this.show == 3) {
  470. this.queryParam.rankStart = "1";
  471. this.queryParam.rankEnd = "10";
  472. } else if (this.show == 4) {
  473. this.queryParam.rankStart = "1";
  474. this.queryParam.rankEnd = "30";
  475. } else if (this.show == 5) {
  476. this.queryParam.rankStart = "1";
  477. this.queryParam.rankEnd = "50";
  478. } else if (this.show == 6) {
  479. this.queryParam.rankStart = "1";
  480. this.queryParam.rankEnd = "100";
  481. } else if (this.show == 7) {
  482. this.queryParam.rankStart = "11";
  483. this.queryParam.rankEnd = "30";
  484. } else if (this.show == 8) {
  485. this.queryParam.rankStart = "31";
  486. this.queryParam.rankEnd = "100";
  487. } else {
  488. this.queryParam.rankStart = undefined;
  489. this.queryParam.rankEnd = undefined;
  490. }
  491. this.queryParam.keywordType = this.keywordType;
  492. this.queryParam.keywords = this.keywords;
  493. this.loadData(1);
  494. },
  495. setTable() {
  496. this.queryParam.reachStandard = undefined;
  497. this.setTableQuery();
  498. },
  499. searchReset() {
  500. this.show = 1;
  501. this.queryParam.reachStandard = undefined;
  502. this.keywords = "";
  503. this.rankingButtonStatus = false;
  504. this.rankingButtonArrow = "";
  505. this.wordsButtonStatus = true;
  506. this.wordsButtonArrow = "arrow-up";
  507. this.queryParam.buttonColmn = "words";
  508. this.queryParam.buttonSort = "desc";
  509. this.setTableQuery();
  510. },
  511. loadData(arg) {
  512. let that = this;
  513. let a = [];
  514. if (arg === 1) {
  515. this.ipagination.current = 1;
  516. }
  517. var params = this.getQueryParams();//查询条件
  518. params.subscriptionId = that.subscriptionId;
  519. params.keywordType = 1;
  520. this.loading = true;
  521. getAction(this.url.list, params).then((res) => {
  522. if (res.success) {
  523. let alldata = res.result.records;
  524. if (alldata.length > 0) {
  525. for (let i in alldata) {
  526. let rankInfo = alldata[i].rankInfo;
  527. a.push({
  528. id: alldata[i].id,
  529. keywords: alldata[i].keywords,
  530. keywordType: alldata[i].keywordType,
  531. keywordsLength: alldata[i].keywordsLength,
  532. rankInfo: rankInfo,
  533. ...rankInfo
  534. });
  535. }
  536. this.dataSource = a;
  537. this.getTableColums();
  538. this.ipagination.total = res.result.total;
  539. } else {
  540. this.dataSource = a;
  541. this.ipagination.total = 0;
  542. }
  543. }
  544. if (res.code === 510) {
  545. // this.$message.warning(res.message)
  546. }
  547. this.loading = false;
  548. });
  549. },
  550. //先执行获取site信息,只有在获取到siteCode之后,才能执行以下方法
  551. getSiteInfo() {
  552. let that = this;
  553. let data = {
  554. siteCode: that.siteCode
  555. };
  556. getAction("/seo/seoKeywordsRank/getSubscriptionIdBySiteCode", data).then(function(res) {
  557. if (res.code == 200) {
  558. that.subscriptionId = res.result[0].id??"";
  559. that.planId = res.result[0].planId??"";
  560. }
  561. });
  562. },
  563. handleTableChange(pagination, filters, sorter) {
  564. //分页、排序、筛选变化时触发
  565. //TODO 筛选
  566. if (Object.keys(sorter).length > 0 && sorter.column) {
  567. this.isorter.column = sorter.field;
  568. this.isorter.order = "ascend" === sorter.order ? "asc" : "desc";
  569. } else {
  570. this.isorter.column = "";
  571. this.isorter.order = "";
  572. }
  573. this.ipagination = pagination;
  574. this.loadData();
  575. },
  576. getQueryParams() {
  577. //获取查询条件
  578. let sqp = {};
  579. if (this.superQueryParams) {
  580. sqp["superQueryParams"] = encodeURI(this.superQueryParams);
  581. sqp["superQueryMatchType"] = this.superQueryMatchType;
  582. }
  583. var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters);
  584. param.field = this.getQueryField();
  585. param.pageNo = this.ipagination.current;
  586. param.pageSize = this.ipagination.pageSize;
  587. return filterObj(param);
  588. },
  589. getQueryField() {
  590. //TODO 字段权限控制
  591. var str = "id,";
  592. this.columns.forEach(function(value) {
  593. str += "," + value.dataIndex;
  594. });
  595. return str;
  596. },
  597. //切换站点
  598. changeSite(selectedSiteInfo) {
  599. this.getSiteInfo();
  600. this.selectSiteInfo = selectedSiteInfo;
  601. this.siteCode = selectedSiteInfo.code;
  602. this.keywordType = undefined;
  603. this.queryParam.reachStandard = undefined;
  604. this.keywords = "";
  605. this.show = 1;
  606. localStorage.setItem("siteCode", this.siteCode);
  607. this.resetAllInfo();
  608. this.getAllInfo();
  609. },
  610. //获取关键词等五个指标
  611. getComprehenInfo() {
  612. let that = this;
  613. let d = {
  614. siteCode: that.siteCode,
  615. planId: that.planId ? that.planId : ""
  616. };
  617. getAction("/seo/seoKeywordsRank/comprehensiveInfo", d).then(res => {
  618. if (res.code == 200) {
  619. that.comprehenInfo = res.result;
  620. }
  621. }).finally(() => {
  622. this.getRankInfo();
  623. this.setTableQuery();
  624. this.longSetTableQuery();
  625. });
  626. },
  627. //获取三个list的数据
  628. getRankInfo() {
  629. let that = this;
  630. let d = {
  631. siteCode: that.siteCode,
  632. subscriptionId: that.subscriptionId ? that.subscriptionId : ""
  633. };
  634. getAction("/seo/seoKeywordsRank/getRankInfo", d).then(res => {
  635. if (res.code == 200) {
  636. this.rankInfo.appointKeyword = res.result.appointKeyword;
  637. this.rankInfo.longTailKeyword = res.result.longTailKeyword;
  638. this.rankInfo.serverTime = res.result.serverTime;
  639. }
  640. });
  641. },
  642. //动态处理表格列
  643. getTableColums() {
  644. let that = this;
  645. that.columns = [
  646. {
  647. title: "序号",
  648. dataIndex: "rowIndex",
  649. key: "rowIndex",
  650. width: 40,
  651. align: "center",
  652. fixed: "left",
  653. scopedSlots: { customRender: "dataNo" }
  654. },
  655. {
  656. title: "关键词",
  657. dataIndex: "keywords",
  658. key: "keywords",
  659. fixed: "left",
  660. scopedSlots: { customRender: "keywords" },
  661. width: 350
  662. }
  663. ];
  664. let obj = that.dataSource[0].rankInfo;
  665. let dateInfo = Object.keys(obj);
  666. dateInfo.sort().reverse();
  667. for (let i in dateInfo) {
  668. that.columns.push({
  669. title: dateInfo[i],
  670. dataIndex: dateInfo[i],
  671. key: dateInfo[i],
  672. scopedSlots: { customRender: "tag" },
  673. align: "center"
  674. });
  675. }
  676. that.columns.push({
  677. title: "操作",
  678. dataIndex: "action",
  679. key: "action",
  680. align: "center",
  681. scopedSlots: { customRender: "action" },
  682. fixed: "right",
  683. width: 50
  684. });
  685. },
  686. //点击排名数量事件
  687. getTableInfoRank(d, keywordType) {
  688. this.show = d;
  689. this.queryParam.reachStandard = undefined;
  690. if (keywordType) {
  691. this.keywordType = keywordType;
  692. }
  693. this.setTableQuery();
  694. },
  695. //点击第一行五个指标的种类
  696. changeKeywordType() {
  697. this.queryParam.reachStandard = 1;
  698. this.queryParam.rankStart = undefined;
  699. this.queryParam.rankEnd = undefined;
  700. this.show = 1;
  701. this.setTableQuery();
  702. },
  703. //表格内的去查询按钮
  704. gotoSearch(word) {
  705. window.open("https://www.google.com/search?q=" + word, "_blank");
  706. },
  707. handleExportXlsLU(fileName, keywordType) {
  708. let that = this;
  709. let param = {
  710. siteCode: that.queryParam.siteCode,
  711. subscriptionId: that.subscriptionId ? that.subscriptionId : "",
  712. keywordType: keywordType
  713. };
  714. if (param.siteCode === "") {
  715. // this.$message.warning("请先选择站点!");
  716. return;
  717. }
  718. if (keywordType == 1) {
  719. this.excelLoading = true;
  720. } else {
  721. this.longExcelLoading = true;
  722. }
  723. downFile("/seo/seoKeywords/exportExcel", param).then((data) => {
  724. if (keywordType === 1) {
  725. this.excelLoading = false;
  726. } else {
  727. this.longExcelLoading = false;
  728. }
  729. if (!data) {
  730. console.log(321);
  731. // this.$message.warning("文件下载失败")
  732. return;
  733. }
  734. if (data.size === 0) {
  735. console.log(111);
  736. // this.$message.warning("当前站点未有关键词数据,文件导出失败")
  737. return;
  738. }
  739. if (typeof window.navigator.msSaveBlob !== "undefined") {
  740. window.navigator.msSaveBlob(new Blob([data], { type: "application/vnd.ms-excel" }), fileName + ".xlsx");
  741. } else {
  742. let url = window.URL.createObjectURL(new Blob([data], { type: "application/vnd.ms-excel" }));
  743. let link = document.createElement("a");
  744. link.style.display = "none";
  745. link.href = url;
  746. link.setAttribute("download", fileName + ".xlsx");
  747. document.body.appendChild(link);
  748. link.click();
  749. document.body.removeChild(link); //下载完成移除元素
  750. window.URL.revokeObjectURL(url); //释放掉blob对象
  751. }
  752. });
  753. },
  754. //按排名排序
  755. rankingClick() {
  756. let that = this;
  757. if (that.rankingButtonStatus == false) {
  758. that.rankingButtonStatus = true;
  759. that.rankingButtonArrow = "arrow-up";
  760. that.wordsButtonStatus = false;
  761. that.wordsButtonArrow = "";
  762. that.queryParam.buttonColmn = "ranking";
  763. that.queryParam.buttonSort = "asc";
  764. } else if (that.rankingButtonStatus == true && that.rankingButtonArrow == "arrow-up") {
  765. that.rankingButtonArrow = "arrow-down";
  766. that.queryParam.buttonColmn = "ranking";
  767. that.queryParam.buttonSort = "desc";
  768. } else if (that.rankingButtonArrow == "arrow-down") {
  769. that.rankingButtonStatus = false;
  770. that.queryParam.buttonColmn = "";
  771. that.queryParam.buttonSort = "";
  772. }
  773. that.setTableQuery();
  774. },
  775. //按字数排序
  776. wordsClick() {
  777. let that = this;
  778. if (that.wordsButtonStatus == false) {
  779. that.wordsButtonStatus = true;
  780. that.wordsButtonArrow = "arrow-up";
  781. that.rankingButtonStatus = false;
  782. that.rankingButtonArrow = "";
  783. that.queryParam.buttonColmn = "words";
  784. that.queryParam.buttonSort = "asc";
  785. } else if (that.wordsButtonStatus == true && that.wordsButtonArrow == "arrow-up") {
  786. that.wordsButtonArrow = "arrow-down";
  787. that.queryParam.buttonColmn = "words";
  788. that.queryParam.buttonSort = "desc";
  789. } else if (that.wordsButtonArrow == "arrow-down") {
  790. that.wordsButtonStatus = false;
  791. that.queryParam.buttonColmn = "";
  792. that.queryParam.buttonSort = "";
  793. }
  794. that.setTableQuery();
  795. },
  796. //-----一下全是长尾词列表功能方法
  797. longLoadData(arg) {
  798. let that = this;
  799. let a = [];
  800. if (arg === 1) {
  801. this.longIpagination.current = 1;
  802. }
  803. var params = this.getLongQueryParams();//查询条件
  804. params.subscriptionId = that.subscriptionId;
  805. params.keywordType = 2;
  806. this.longLoading = true;
  807. getAction(this.url.list, params).then((res) => {
  808. if (res.success) {
  809. let alldata = res.result.records;
  810. if (alldata.length > 0) {
  811. for (let i in alldata) {
  812. let rankInfo = alldata[i].rankInfo;
  813. a.push({
  814. id: alldata[i].id,
  815. keywords: alldata[i].keywords,
  816. keywordType: alldata[i].keywordType,
  817. keywordsLength: alldata[i].keywordsLength,
  818. rankInfo: rankInfo,
  819. ...rankInfo
  820. });
  821. }
  822. this.longDataSource = a;
  823. this.longGetTableColums();
  824. this.longIpagination.total = res.result.total;
  825. } else {
  826. this.longDataSource = a;
  827. this.longIpagination.total = 0;
  828. }
  829. }
  830. if (res.code === 510) {
  831. // this.$message.warning(res.message)
  832. }
  833. this.longLoading = false;
  834. });
  835. },
  836. //动态处理表格列
  837. longGetTableColums() {
  838. let that = this;
  839. that.longColumns = [
  840. {
  841. title: "序号",
  842. dataIndex: "rowIndex",
  843. key: "rowIndex",
  844. width: 40,
  845. align: "center",
  846. fixed: "left",
  847. scopedSlots: { customRender: "dataNo" }
  848. },
  849. {
  850. title: "关键词",
  851. dataIndex: "keywords",
  852. key: "keywords",
  853. fixed: "left",
  854. scopedSlots: { customRender: "keywords" },
  855. width: 350
  856. // sorter: (a, b) => a.keywords - b.keywords,
  857. // defaultSortOrder: 'ascend',
  858. }
  859. // {
  860. // title: '关键词长度',
  861. // dataIndex: 'keywordsLength',
  862. // key: 'keywordsLength',
  863. // fixed: 'left',
  864. // width: 40,
  865. // scopedSlots: { customRender: 'keywordsLength' },
  866. // },
  867. ];
  868. let obj = that.longDataSource[0].rankInfo;
  869. let dateInfo = Object.keys(obj);
  870. dateInfo.sort().reverse();
  871. for (let i in dateInfo) {
  872. that.longColumns.push({
  873. title: dateInfo[i],
  874. dataIndex: dateInfo[i],
  875. key: dateInfo[i],
  876. scopedSlots: { customRender: "tag" },
  877. align: "center"
  878. });
  879. }
  880. that.longColumns.push({
  881. title: "操作",
  882. dataIndex: "action",
  883. key: "action",
  884. align: "center",
  885. scopedSlots: { customRender: "action" },
  886. fixed: "right",
  887. width: 50
  888. });
  889. },
  890. //由于页面的业务关联很多,故将所有的查询条件封装
  891. longSetTableQuery() {
  892. let that = this;
  893. that.longQueryParam.siteCode = this.siteCode;
  894. console.log(that.longQueryParam);
  895. if (that.longShow == 3) {
  896. that.longQueryParam.rankStart = "1";
  897. that.longQueryParam.rankEnd = "10";
  898. } else if (that.longShow == 4) {
  899. that.longQueryParam.rankStart = "1";
  900. that.longQueryParam.rankEnd = "30";
  901. } else if (that.longShow == 5) {
  902. that.longQueryParam.rankStart = "1";
  903. that.longQueryParam.rankEnd = "50";
  904. } else if (that.longShow == 6) {
  905. that.longQueryParam.rankStart = "1";
  906. that.longQueryParam.rankEnd = "100";
  907. } else if (that.longShow == 7) {
  908. that.longQueryParam.rankStart = "11";
  909. that.longQueryParam.rankEnd = "30";
  910. } else if (that.longShow == 8) {
  911. that.longQueryParam.rankStart = "31";
  912. that.longQueryParam.rankEnd = "100";
  913. } else {
  914. that.longQueryParam.rankStart = undefined;
  915. that.longQueryParam.rankEnd = undefined;
  916. }
  917. that.longQueryParam.keywords = that.longKeywords;
  918. that.longLoadData(1);
  919. },
  920. longSetTable() {
  921. this.longQueryParam.reachStandard = undefined;
  922. this.longSetTableQuery();
  923. },
  924. longSearchReset() {
  925. this.longShow = 1;
  926. this.longQueryParam.reachStandard = undefined;
  927. this.longKeywords = "";
  928. this.longRankingButtonStatus = false;
  929. this.longRankingButtonArrow = "";
  930. this.longWordsButtonStatus = true;
  931. this.longWordsButtonArrow = "arrow-up";
  932. this.longQueryParam.buttonColmn = "words";
  933. this.longQueryParam.buttonSort = "asc";
  934. this.longSetTableQuery();
  935. },
  936. //点击排名数量事件
  937. longGetTableInfoRank(d) {
  938. this.longShow = d;
  939. this.longQueryParam.reachStandard = undefined;
  940. this.longSetTableQuery();
  941. },
  942. //点击第一行五个指标的种类
  943. longChangeKeywordType() {
  944. this.longQueryParam.reachStandard = 1;
  945. this.longQueryParam.rankStart = undefined;
  946. this.longQueryParam.rankEnd = undefined;
  947. this.longShow = 1;
  948. this.longSetTableQuery();
  949. },
  950. handleLongTableChange(pagination, filters, sorter) {
  951. //分页、排序、筛选变化时触发
  952. //TODO 筛选
  953. if (Object.keys(sorter).length > 0 && sorter.column) {
  954. this.longIsorter.column = sorter.field;
  955. this.longIsorter.order = "ascend" == sorter.order ? "asc" : "desc";
  956. } else {
  957. this.longIsorter.column = "";
  958. this.longIsorter.order = "";
  959. }
  960. this.longIpagination = pagination;
  961. this.longLoadData();
  962. },
  963. getLongQueryParams() {
  964. //获取查询条件
  965. let sqp = {};
  966. var param = Object.assign(sqp, this.longQueryParam, this.longIsorter, this.filters);
  967. param.field = this.getLongQueryField();
  968. param.pageNo = this.longIpagination.current;
  969. param.pageSize = this.longIpagination.pageSize;
  970. return filterObj(param);
  971. },
  972. getLongQueryField() {
  973. //TODO 字段权限控制
  974. var str = "id,";
  975. this.longColumns.forEach(function(value) {
  976. str += "," + value.dataIndex;
  977. });
  978. return str;
  979. },
  980. //按排名排序
  981. longRankingClick() {
  982. let that = this;
  983. if (that.longRankingButtonStatus == false) {
  984. that.longRankingButtonStatus = true;
  985. that.longRankingButtonArrow = "arrow-up";
  986. that.longWordsButtonStatus = false;
  987. that.longWordsButtonArrow = "";
  988. that.longQueryParam.buttonColmn = "ranking";
  989. that.longQueryParam.buttonSort = "asc";
  990. } else if (that.longRankingButtonStatus == true && that.longRankingButtonArrow == "arrow-up") {
  991. that.longRankingButtonArrow = "arrow-down";
  992. that.longQueryParam.buttonColmn = "ranking";
  993. that.longQueryParam.buttonSort = "desc";
  994. } else if (that.longRankingButtonArrow == "arrow-down") {
  995. that.longRankingButtonStatus = false;
  996. that.longQueryParam.buttonColmn = "";
  997. that.longQueryParam.buttonSort = "";
  998. }
  999. that.longSetTableQuery();
  1000. },
  1001. //按字数排序
  1002. longWordsClick() {
  1003. let that = this;
  1004. if (that.longWordsButtonStatus == false) {
  1005. that.longWordsButtonStatus = true;
  1006. that.longWordsButtonArrow = "arrow-up";
  1007. that.longRankingButtonStatus = false;
  1008. that.longRankingButtonArrow = "";
  1009. that.longQueryParam.buttonColmn = "words";
  1010. that.longQueryParam.buttonSort = "asc";
  1011. } else if (that.longWordsButtonStatus == true && that.longWordsButtonArrow == "arrow-up") {
  1012. that.longWordsButtonArrow = "arrow-down";
  1013. that.longQueryParam.buttonColmn = "words";
  1014. that.longQueryParam.buttonSort = "desc";
  1015. } else if (that.longWordsButtonArrow == "arrow-down") {
  1016. that.longWordsButtonStatus = false;
  1017. that.longQueryParam.buttonColmn = "";
  1018. that.longQueryParam.buttonSort = "";
  1019. }
  1020. that.longSetTableQuery();
  1021. }
  1022. }
  1023. };
  1024. </script>
  1025. <style lang="less">
  1026. .self-pop {
  1027. .ant-popover-inner-content {
  1028. background: rgb(245, 243, 254);
  1029. p {
  1030. font-size: 13px;
  1031. }
  1032. }
  1033. .ant-popover-arrow {
  1034. border-color: rgb(245, 243, 254) !important;
  1035. }
  1036. }
  1037. </style>
  1038. <style lang="less" scoped>
  1039. .r1 {
  1040. margin: 20px;
  1041. .choose-site {
  1042. display: flex;
  1043. }
  1044. .t1 {
  1045. font-size: 18px;
  1046. }
  1047. .ant-calendar-picker {
  1048. margin-right: 20px;
  1049. }
  1050. /deep/ .ant-btn {
  1051. background: transparent;
  1052. margin-right: 10px;
  1053. &.active {
  1054. color: @primary-color;
  1055. }
  1056. }
  1057. }
  1058. .r2 {
  1059. background: #fff;
  1060. padding: 30px;
  1061. margin: 10px;
  1062. .ant-col {
  1063. text-align: center;
  1064. color: #000;
  1065. img {
  1066. width: 13px;
  1067. margin: -3px 5px 0 0;
  1068. }
  1069. .t1 {
  1070. font-size: 14px;
  1071. }
  1072. .t2 {
  1073. font-size: 27px;
  1074. margin-bottom: 0;
  1075. font-weight: 500;
  1076. }
  1077. }
  1078. }
  1079. .r3 {
  1080. padding-left: 10px;
  1081. padding-right: 10px;
  1082. padding-bottom: 10px;
  1083. .wrap {
  1084. padding: 20px;
  1085. background: #fff;
  1086. .t1 {
  1087. color: #000;
  1088. font-size: 14px;
  1089. font-weight: 500;
  1090. }
  1091. .content {
  1092. display: block;
  1093. overflow: hidden;
  1094. line-height: 1;
  1095. border-bottom: 1px solid #ddd;
  1096. padding: 20px 0;
  1097. &:last-child {
  1098. border-bottom: none;
  1099. padding-bottom: 0;
  1100. }
  1101. .d1 {
  1102. float: left;
  1103. width: 50%;
  1104. line-height: 25px;
  1105. color: #000;
  1106. img {
  1107. width: 15px;
  1108. margin: -4px 5px 0 0;
  1109. }
  1110. }
  1111. .d2 {
  1112. float: right;
  1113. width: 50%;
  1114. text-align: right;
  1115. &.d3 {
  1116. span {
  1117. color: #000;
  1118. }
  1119. }
  1120. a {
  1121. font-size: 25px;
  1122. font-weight: 500;
  1123. }
  1124. }
  1125. }
  1126. }
  1127. }
  1128. .r4 {
  1129. padding: 20px;
  1130. margin-left: 10px;
  1131. margin-right: 10px;
  1132. background: #fff;
  1133. .table-tool-wrap {
  1134. margin-bottom: 15px;
  1135. ul {
  1136. list-style-type: none;
  1137. display: block;
  1138. overflow: hidden;
  1139. margin: 0;
  1140. padding: 0;
  1141. li {
  1142. float: left;
  1143. margin: 0 10px;
  1144. color: #333;
  1145. font-size: 14px;
  1146. font-weight: 500;
  1147. cursor: pointer;
  1148. text-decoration: underline;
  1149. &.active {
  1150. color: @primary-color;
  1151. }
  1152. }
  1153. }
  1154. }
  1155. }
  1156. </style>