Analysis.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. <template>
  2. <div class="page-header-index-wide">
  3. <template v-if="pageRoleNum >= 2">
  4. <a-empty description="请联系管理员,当前角色权限设置有误或者当前账户无权限" style="height: 210px;margin-top: 200px;"/>
  5. </template>
  6. <template v-else>
  7. <a-row :gutter="24">
  8. <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px', cursor: 'pointer' }" v-for="(item, index) in zhibiaoTotal" :key="index" @click="clickItemTotal(item, index)">
  9. <chart-card :loading="loading" :title="item.title+' (万元) / 当月'" :total="totalPrice(item.monthTotal)">
  10. <a-tooltip :title="`点击查看${item.title}明细`" slot="action">
  11. <a-icon type="info-circle-o" />
  12. </a-tooltip>
  13. <div>
  14. <trend :flag="setJiantou(item.monthTb)" style="margin-right: 16px;">
  15. <span slot="term">月同比</span>
  16. {{comTbHb(item.monthTb)}}%
  17. </trend>
  18. <trend :flag="setJiantou(item.monthHb)">
  19. <span slot="term">月环比</span>
  20. {{comTbHb(item.monthHb)}}%
  21. </trend>
  22. </div>
  23. <template slot="footer">年{{item.title}}<span> {{totalPriceYear(item.yearTotal)}}</span>
  24. <trend :flag="setJiantou(item.yearTb)" style="float: right;">
  25. <span slot="term">同比</span>
  26. {{comTbHb(item.yearTb)}}%
  27. </trend>
  28. </template>
  29. </chart-card>
  30. </a-col>
  31. </a-row>
  32. <!-- 第二级模块:折/柱形图 -->
  33. <a-card :loading="loading" :bordered="false" :body-style="{padding: '0'}">
  34. <div class="salesCard">
  35. <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
  36. <div class="extra-wrapper" slot="tabBarExtraContent">
  37. <div class="extra-item">
  38. <a-button :type="searchType==='month'?'primary':'link'" @click="searchTypeChange('month')">按月查询</a-button>
  39. <a-button :type="searchType==='year'?'primary':'link'" @click="searchTypeChange('year')">按年查询</a-button>
  40. </div>
  41. <!-- <a-range-picker :style="{width: '256px'}" /> -->
  42. <a-range-picker
  43. :placeholder="searchPlaceholder"
  44. :format="searchFormat"
  45. :mode="searchMode"
  46. :value="dateValue"
  47. :open="datePickShow"
  48. @panelChange="handlePanelChange"
  49. @openChange="datePickShow = !datePickShow"
  50. >
  51. <template slot="renderExtraFooter">
  52. <div style="width: 540px;">
  53. <a-button type="primary" style="float: right;margin: 8px;" @click="handleDateSure">确定</a-button>
  54. </div>
  55. </template>
  56. </a-range-picker>
  57. </div>
  58. <a-tab-pane loading="true" :tab="chartTitle+'图表'" key="1">
  59. <a-row>
  60. <template v-if="chooseValue !== 'chb'">
  61. <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
  62. <!-- <a-col :xl="chooseValue === 'chb'?16:24" :lg="chooseValue === 'chb'?16:24" :md="chooseValue === 'chb'?16:24" :sm="24" :xs="24"> -->
  63. <!-- <bar title="销售额排行" :dataSource="barData"/> -->
  64. <twoYAxisChart v-if="chooseValue === 'hte'" ref="twoYAxisChartRef" :twoYAxisData="twoYAxisData"
  65. style="height: 360px;"
  66. class="line-timePrice common-layout"></twoYAxisChart>
  67. <lineBarChart v-else ref="lineBarChartRef" :xAxisData="lineBarXAxisData" :seriesData="lineBarSeriesData" :title="chartTitle"
  68. style="height: 360px;"
  69. class="line-timePrice common-layout"></lineBarChart>
  70. </a-col>
  71. </template>
  72. <template v-if="chooseValue === 'chb'">
  73. <a-col :xl="16" :lg="16" :md="16" :sm="24" :xs="24">
  74. <lineBarChartChb ref="lineBarChartChbRef" :xAxisData="chbXAxisData" :seriesData="chbSeriesData" :title="chartTitle"
  75. style="height: 360px;"
  76. class="line-timePrice common-layout"></lineBarChartChb>
  77. </a-col>
  78. <a-col :xl="8" :lg="8" :md="8" :sm="24" :xs="24">
  79. <rank-list title="详情" :list="rankList"/>
  80. <!-- <pieContentChart style="height: 360px;"></pieContentChart> -->
  81. </a-col>
  82. </template>
  83. </a-row>
  84. </a-tab-pane>
  85. <!-- <a-tab-pane tab="销售趋势" key="2">
  86. <a-row>
  87. <a-col :xl="16" :lg="12" :md="12" :sm="24" :xs="24">
  88. <bar title="销售额趋势" :dataSource="barData"/>
  89. </a-col>
  90. <a-col :xl="8" :lg="12" :md="12" :sm="24" :xs="24">
  91. <rank-list title="门店销售排行榜" :list="rankList"/>
  92. </a-col>
  93. </a-row>
  94. </a-tab-pane> -->
  95. </a-tabs>
  96. </div>
  97. </a-card>
  98. <!-- 第三级模块:部门指标排行 -->
  99. <a-card :loading="loading" :bordered="false" :body-style="{padding: '0'}" style="margin-top: 20px;" v-if="pageRoleNum===0">
  100. <div class="salesCard">
  101. <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
  102. <div class="extra-wrapper" slot="tabBarExtraContent">
  103. <div class="extra-item">
  104. <a-button :type="zbPhParams.time==='month'?'primary':'link'" @click="searchZbphChange('month')">按月查询</a-button>
  105. <a-button :type="zbPhParams.time==='year'?'primary':'link'" @click="searchZbphChange('year')">按年查询</a-button>
  106. </div>
  107. <a-month-picker v-if="zbPhParams.time === 'month'" placeholder="请选择月" :disabled-date="disabledYear" :value="zbPhParams.beginDate" @change="zbphSearchChange" />
  108. <!-- <a-date-picker v-if="zbPhParams.time === 'year'"
  109. @Change=zbphSearchChange
  110. placeholder="请选择年"
  111. mode="year"
  112. v-model="zbPhParams.beginDate"
  113. format="YYYY"
  114. allowClear="false"
  115. /> -->
  116. <a-date-picker
  117. v-if="zbPhParams.time === 'year'"
  118. mode="year"
  119. format="YYYY"
  120. :value="zbPhParams.yearValue"
  121. :open="zbphYearIsopen"
  122. :disabled-date="disabledYear"
  123. placeholder="请选择年份"
  124. @focus="changeopen"
  125. @panelChange="handlePanelChange1">
  126. </a-date-picker>
  127. </div>
  128. <a-tab-pane loading="true" tab="下达部门指标排行" key="1">
  129. <a-row>
  130. <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
  131. <deptZbphTable :dataSource="zbPhDataSource.jycsCharts" :loading="zhbLoading" deptType="xd" class="dept-zbph-table"></deptZbphTable>
  132. </a-col>
  133. </a-row>
  134. </a-tab-pane>
  135. <a-tab-pane loading="true" tab="责任部门指标排行" key="2">
  136. <a-row>
  137. <a-col :xl="24" :lg="24" :md="24" :sm="24" :xs="24">
  138. <deptZbphTable :dataSource="zbPhDataSource.zrbmCharts" :loading="zhbLoading" deptType="zr" class="dept-zbph-table"></deptZbphTable>
  139. </a-col>
  140. </a-row>
  141. </a-tab-pane>
  142. </a-tabs>
  143. </div>
  144. </a-card>
  145. <!-- <a-card :loading="loading" :bordered="false" :body-style="{padding: '0'}" :style="{ marginTop: '24px' }">
  146. <div class="salesCard">
  147. <a-tabs default-active-key="1" size="large" :tab-bar-style="{marginBottom: '24px', paddingLeft: '16px'}">
  148. <div class="extra-wrapper" slot="tabBarExtraContent">
  149. <div class="extra-item">
  150. <a>本月</a>
  151. <a>本季</a>
  152. <a>本年</a>
  153. </div>
  154. <a-range-picker :style="{width: '256px'}" />
  155. </div>
  156. <a-tab-pane loading="true" :tab="'部门'+chartTitle+'排行'" key="1">
  157. <a-row :gutter="24">
  158. <a-col :xl="6" :lg="12" :md="12" :sm="24" :xs="24">
  159. <rankingChart :title="chartTitle" :seriesData="rankingSeriesData" :yAxisNames="rankingYAxisNames" :yAxisNumbers="yAxisNumbers" style="height: 360px;"></rankingChart>
  160. </a-col>
  161. <a-col :xl="18" :lg="12" :md="12" :sm="24" :xs="24">
  162. <a-table
  163. ref="table"
  164. size="middle"
  165. :scroll="{x:true}"
  166. bordered
  167. rowKey="id"
  168. :columns="columns"
  169. :dataSource="dataSource"
  170. :pagination="ipagination"
  171. :loading="loading"
  172. class="j-table-force-nowrap"
  173. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  174. @change="handleTableChange"
  175. >
  176. </a-table>
  177. </a-col>
  178. </a-row>
  179. </a-tab-pane>
  180. </a-tabs>
  181. </div>
  182. </a-card> -->
  183. </template>
  184. </div>
  185. </template>
  186. <script>
  187. import moment from 'moment'
  188. import { getZhibiaoCollect, getdataByHt, getdataBySk, getdataByChb, getdataByLr, deptZhibiaoPaihang, } from '@/api/kzksApi'
  189. import ChartCard from '@/components/ChartCard'
  190. import RankList from '@/components/chart/RankList'
  191. import Trend from '@/components/Trend'
  192. import lineBarChart from './components/lineBarChart.vue'
  193. import lineBarChartChb from './components/lineBarChartChb.vue'
  194. import rankingChart from './components/rankingChart.vue'
  195. import pieContentChart from './components/pieContentChart.vue'
  196. import twoYAxisChart from './components/twoYAxisChart.vue'
  197. import deptZbphTable from './components/deptZbphTable.vue'
  198. import { getLoginfo,getVisitInfo } from '@/api/api'
  199. const chb8Names = [
  200. { name: '外协费', value: 'wxf' },
  201. { name: '材料费', value: 'clf' },
  202. { name: '专用费', value: 'zyf' },
  203. { name: '事务费', value: 'swf' },
  204. { name: '燃动费', value: 'rldlf' },
  205. { name: '工时费', value: 'gzjlwf' },
  206. { name: '固资费', value: 'gdzczj' },
  207. { name: '管理费', value: 'glf' },
  208. { name: '工资费', value: 'gzjlwf' },
  209. ]
  210. export default {
  211. name: "dashboardAnalysis",
  212. components: {
  213. ChartCard,
  214. Trend,
  215. RankList,
  216. lineBarChart,
  217. lineBarChartChb,
  218. rankingChart,
  219. pieContentChart,
  220. twoYAxisChart,
  221. deptZbphTable,
  222. },
  223. data() {
  224. return {
  225. loading: true,
  226. rankList: [],
  227. loginfo:{},
  228. visitInfo:[],
  229. pageRoleNum: 0,
  230. // 顶部n项指标
  231. zhibiaoTotal: [
  232. // {
  233. // value: 'hte',
  234. // title: '合同数量',
  235. // totalMoney: '53',
  236. // lineBarSeriesData: [
  237. // {
  238. // name: '合同数量',
  239. // data: [32, 22, 21, 45, 23, 32, 34],
  240. // },
  241. // ],
  242. // },
  243. {
  244. value: 'hte',
  245. hdValue: 'hte',
  246. title: '合同额',
  247. data: {},
  248. },
  249. {
  250. value: 'ske',
  251. hdValue: 'ske',
  252. title: '收款额',
  253. data: {},
  254. },
  255. {
  256. value: 'chb',
  257. hdValue: 'zce',
  258. title: '成本额',
  259. data: {},
  260. },
  261. {
  262. value: 'lre',
  263. hdValue: 'lre',
  264. title: '利润额',
  265. data: {},
  266. },
  267. ],
  268. // 日期区间选择模块
  269. searchType: 'month',
  270. searchPlaceholder: ['开始月份', '结束月份'],
  271. searchFormat: 'YYYY-MM', // 日期区间选择器format(页面数据显示格式)
  272. dateValue: [null, null], // 日期区间选择器format(页面显示的数据)
  273. searchMode: ['month', 'month'], // 日期区间选择器mode(选择器形式)
  274. datePickShow: false,
  275. // 日期区间选择传参数据
  276. searchParams: {
  277. time: '',
  278. beginDate: null,
  279. endDate: null,
  280. },
  281. // 选择指标
  282. chooseValue: 'hte',
  283. chartTitle: '合同',
  284. // 折线柱形总览图
  285. lineBarXAxisData: [],
  286. lineBarSeriesData: [],
  287. chbXAxisData: [],
  288. chbSeriesData: {
  289. seriesData: [],
  290. sumZcbData: [],
  291. },
  292. // 排行
  293. rankingSeriesData: [50, 42, 26, 20, 15, 14, 12, 8, 5, 1],
  294. rankingYAxisNames: ["部门06", "部门01", "部门05", "部门10", "部门07", "部门04", "部门03", "部门08", "部门09", "部门02"],
  295. yAxisNumbers: [50, 42, 26, 23, 15, 14, 12, 8, 5, 1],
  296. // 双y轴总览图
  297. twoYAxisData: {},
  298. // 排行
  299. // 部门指标排行
  300. zhbLoading: true,
  301. zbPhParams: {
  302. beginDate: null,
  303. yearValue: null, // 因为dataPick是moment格式,所以加一个进行转化显示用
  304. time: ''
  305. },
  306. columns: [
  307. {
  308. title: '序号',
  309. dataIndex: '',
  310. key:'rowIndex',
  311. width:60,
  312. align:"center",
  313. customRender:function (t,r,index) {
  314. return parseInt(index)+1;
  315. }
  316. },
  317. {
  318. title:'部门',
  319. align:"center",
  320. dataIndex: 'wlbm'
  321. },
  322. {
  323. title:'已收款',
  324. align:"center",
  325. dataIndex: 'ggxh'
  326. },
  327. {
  328. title:'成本',
  329. align:"center",
  330. dataIndex: 'zlLevel'
  331. },
  332. {
  333. title:'利润',
  334. align:"center",
  335. dataIndex: 'pici'
  336. },
  337. // {
  338. // title:'利润率',
  339. // align:"center",
  340. // dataIndex: 'pici'
  341. // },
  342. {
  343. title:'合同数量',
  344. align:"center",
  345. dataIndex: 'danjia'
  346. },
  347. {
  348. title:'合同金额',
  349. align:"center",
  350. dataIndex: 'htDate'
  351. },
  352. ],
  353. zbphYearIsopen: false,
  354. zbPhDataSource: {
  355. jycsCharts: [],
  356. zrbmCharts: [],
  357. },
  358. }
  359. },
  360. computed: {
  361. // 判断箭头样式
  362. setJiantou(){
  363. // 闭包实现computed中传参
  364. return function (value) {
  365. var item = Number(value) > 0 ? 'up' : 'down'
  366. return item
  367. }
  368. },
  369. totalPrice(){
  370. return function (value) {
  371. var item = (Number(value) / 10000).toFixed(2)
  372. // console.log(item)
  373. return '¥'+item
  374. }
  375. },
  376. totalPriceYear(){
  377. return function (value) {
  378. var item = (Number(value) / 10000).toFixed(2)
  379. console.log(item)
  380. return item + ' 万元'
  381. }
  382. },
  383. // 将后端数据准换成整数%显示
  384. comTbHb(){
  385. return function (value) {
  386. // console.log(Math.abs('-0.35'))
  387. var item = (Math.abs(value) * 100).toFixed(0)
  388. return item
  389. }
  390. },
  391. },
  392. created() {
  393. this.initLogInfo();
  394. this.getZhibiaoCollect()
  395. this.setNowDate()
  396. // 部门指标排行
  397. // this.deptZhibiaoPaihang()
  398. this.searchZbphChange('month')
  399. },
  400. methods: {
  401. //限制选择年份
  402. disabledYear(current){
  403. // 不可以选择之前的日期,今天包括之后可以选,控制大于小于来实现选择之前的日期还是之后的日期
  404. // return current < moment().subtract(1, 'year');
  405. var timeYear = current.get('year'); // 当前年
  406. return timeYear < '2023';
  407. },
  408. getZhibiaoCollect(){
  409. this.loading = true
  410. getZhibiaoCollect().then(res => {
  411. console.log(res)
  412. if (res.success) {
  413. // 0:所领导,1:部门领导,2:员工;3:未赋值或选了多个前面所说角色
  414. // 如果是管理员,默认显示所领导的
  415. this.pageRoleNum = res.result.auth
  416. if(res.result.auth >= 2){
  417. return
  418. }
  419. var arr = []
  420. for (let i = 0; i < this.zhibiaoTotal.length; i++) {
  421. const element = this.zhibiaoTotal[i];
  422. // element.data = res.result[element.hdValue]
  423. arr[i] = {...element, ...res.result.data[element.hdValue]}
  424. }
  425. this.zhibiaoTotal = arr
  426. this.loading = false
  427. }else{
  428. this.$message.warning(res.message)
  429. this.loading = false
  430. }
  431. }).finally(() => {
  432. this.loading = false
  433. })
  434. },
  435. setNowDate(type){
  436. const now = new Date()
  437. const year = now.getFullYear(); // 年
  438. const month = now.getMonth() + 1; // 月
  439. const monthBetter = month >= 10 ? month : '0' + month
  440. const beginDate = `${year}-01`
  441. const endDate = `${year}-${monthBetter}`
  442. this.dateValue = [beginDate, endDate]
  443. var sType = this.searchType ? this.searchType : type
  444. if(sType === 'month'){
  445. this.searchParams = {
  446. time: 'month',
  447. beginDate: beginDate,
  448. endDate: endDate,
  449. }
  450. } else if (sType === 'year') {
  451. this.searchParams = {
  452. time: 'year',
  453. beginDate: year,
  454. endDate: year,
  455. }
  456. }
  457. this.getDataByDate()
  458. },
  459. // 点击指标转换下方数据
  460. clickItemTotal(item, index){
  461. // console.log(item, index)
  462. this.chooseValue = item.value
  463. this.chartTitle = item.value === 'hte' ? '合同' : item.title
  464. // 调用showLoading方法--解决卡顿和数据闪等问题
  465. setTimeout(() => {
  466. // 定时器解决v-if下第一时间无法获取ref的问题
  467. if(this.$refs.lineBarChartRef){this.$refs.lineBarChartRef.uEcharts.showLoading({text: '加载中...'});}
  468. // 取消设置,因为一开始就很快
  469. if(this.$refs.twoYAxisChartRef){this.$refs.twoYAxisChartRef.uEcharts.showLoading({text: '加载中...'});}
  470. if(this.$refs.lineBarChartChbRef){this.$refs.lineBarChartChbRef.uEcharts.showLoading({text: '加载中...'});}
  471. }, 1);
  472. // this.lineBarSeriesData = item.lineBarSeriesData
  473. // console.log(this.dateValue)
  474. this.getDataByDate()
  475. },
  476. // 获取时间变化图表数据
  477. getDataByDate(){
  478. switch (this.chooseValue) {
  479. case 'hte':
  480. getdataByHt(this.searchParams).then(res => {
  481. console.log(res)
  482. if (res.success) {
  483. this.twoYAxisData = res.result
  484. }else{
  485. this.$message.warning(res.message)
  486. }
  487. }).finally(() => {
  488. // this.loading = false
  489. })
  490. break;
  491. case 'lre':
  492. getdataByLr(this.searchParams).then(res => {
  493. console.log(res)
  494. if (res.success) {
  495. this.lineBarXAxisData = res.result.xaxisData
  496. this.lineBarSeriesData = [
  497. {
  498. name: '利润额',
  499. data: res.result.seriesData,
  500. }
  501. ]
  502. }else{
  503. this.$message.warning(res.message)
  504. }
  505. }).finally(() => {
  506. // this.loading = false
  507. })
  508. break;
  509. case 'ske':
  510. getdataBySk(this.searchParams).then(res => {
  511. console.log(res)
  512. if (res.success) {
  513. this.lineBarXAxisData = res.result.xaxisData
  514. this.lineBarSeriesData = [
  515. {
  516. name: '收款额',
  517. data: res.result.seriesData,
  518. }
  519. ]
  520. }else{
  521. this.$message.warning(res.message)
  522. }
  523. }).finally(() => {
  524. // this.loading = false
  525. })
  526. break;
  527. case 'chb':
  528. getdataByChb(this.searchParams).then(response => {
  529. console.log(response)
  530. var chartsData = response.result[0].chartInfoList[0]
  531. var chbRankingData = response.result[0].eightCostPaiHang
  532. this.rankList = chbRankingData.map(res => {
  533. var findItem = chb8Names.find(item => item.value === res.name)
  534. return{
  535. name: findItem.name + ' ' + res.proportion + '%',
  536. total: (Number(res.value) / 10000).toFixed(2)+'万元'
  537. }
  538. })
  539. if(response){
  540. this.chbXAxisData = chartsData.xaxisData
  541. this.chbSeriesData.seriesData = chartsData.seriesData.map(res => {
  542. var findItem = chb8Names.find(item => item.value === res.name)
  543. return{
  544. name: findItem.name,
  545. data: res.values
  546. }
  547. })
  548. this.chbSeriesData.sumZcbData = chartsData.sumZcbData
  549. }
  550. }).finally(() => {
  551. // this.loading = false
  552. })
  553. break;
  554. default:
  555. break;
  556. }
  557. },
  558. // 查询类型选择:按年、按月
  559. searchTypeChange(type){
  560. // this.resetParams()
  561. this.searchType = type
  562. this.searchFormat = type === 'month' ? 'YYYY-MM' : 'YYYY'
  563. this.searchPlaceholder = type === 'month' ? ['开始月份', '结束月份'] : ['开始年份', '结束年份']
  564. this.searchMode = [type, type]
  565. this.setNowDate(type)
  566. },
  567. handlePanelChange(value, mode) {
  568. // console.log(value, this.searchMode)
  569. // console.log(moment(value[0]).format('YYYY-MM'))
  570. this.dateValue = value;
  571. if(this.searchMode[0] === 'month'){
  572. this.searchParams = {
  573. time: 'month',
  574. beginDate: moment(value[0]).format('YYYY-MM'),
  575. endDate: moment(value[1]).format('YYYY-MM'),
  576. }
  577. }
  578. if(this.searchMode[0] === 'year'){
  579. this.searchParams = {
  580. time: 'year',
  581. beginDate: moment(value[0]).format('YYYY'),
  582. endDate: moment(value[1]).format('YYYY'),
  583. }
  584. }
  585. // this.modeMonth = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
  586. },
  587. handleDateSure(){
  588. console.log(this.searchParams)
  589. this.getDataByDate()
  590. this.datePickShow = false
  591. },
  592. initLogInfo () {
  593. getLoginfo(null).then((res)=>{
  594. if(res.success){
  595. Object.keys(res.result).forEach(key=>{
  596. res.result[key] =res.result[key]+""
  597. })
  598. this.loginfo = res.result;
  599. }
  600. })
  601. getVisitInfo().then(res=>{
  602. if(res.success){
  603. this.visitInfo = res.result;
  604. }
  605. })
  606. },
  607. // 获取部门指标排行数据
  608. deptZhibiaoPaihang(){
  609. this.zhbLoading = true
  610. deptZhibiaoPaihang(this.zbPhParams).then(res => {
  611. if (res.success) {
  612. console.log(res)
  613. this.zbPhDataSource = res.result
  614. // this.$message.success(res.message)
  615. // this.$emit('ok')
  616. this.zhbLoading = false
  617. } else {
  618. this.$message.warning(res.message)
  619. this.zhbLoading = false
  620. }
  621. }).finally(() => {
  622. })
  623. },
  624. // 部门指标排行搜索
  625. searchZbphChange(type){
  626. this.zbPhParams.time = type
  627. const now = new Date()
  628. const year = now.getFullYear(); // 年
  629. const month = now.getMonth() + 1; // 月
  630. const monthBetter = month >= 10 ? month : '0' + month
  631. const endDate = `${year}-${monthBetter}`
  632. if(type === 'month'){
  633. this.zbPhParams.yearValue = ''
  634. this.zbPhParams.beginDate = endDate
  635. }
  636. if(type === 'year'){
  637. this.zbPhParams.yearValue = moment(year, 'YYYY')
  638. this.zbPhParams.beginDate = year
  639. console.log(this.zbPhParams)
  640. }
  641. this.deptZhibiaoPaihang()
  642. },
  643. // 部门指标排行按月选择确事件
  644. zbphSearchChange(date, dateString){
  645. // console.log(date, dateString)
  646. this.zbPhParams.beginDate = dateString
  647. this.deptZhibiaoPaihang()
  648. },
  649. handlePanelChange1(value, mode) {
  650. // console.log(value);
  651. // console.log(mode);
  652. // console.log(moment(value).format('YYYY'))
  653. this.zbPhParams.yearValue = value
  654. this.zbPhParams.beginDate = moment(value).format('YYYY')
  655. this.deptZhibiaoPaihang()
  656. this.zbphYearIsopen = false
  657. },
  658. changeopen() {
  659. this.zbphYearIsopen = true;
  660. },
  661. }
  662. }
  663. </script>
  664. <style lang="less" scoped>
  665. .circle-cust{
  666. position: relative;
  667. top: 28px;
  668. left: -100%;
  669. }
  670. .extra-wrapper {
  671. line-height: 55px;
  672. padding-right: 24px;
  673. .extra-item {
  674. display: inline-block;
  675. margin-right: 24px;
  676. a {
  677. margin-left: 24px;
  678. }
  679. }
  680. }
  681. /* 首页访问量统计 */
  682. .head-info {
  683. position: relative;
  684. text-align: left;
  685. padding: 0 32px 0 0;
  686. min-width: 125px;
  687. &.center {
  688. text-align: center;
  689. padding: 0 32px;
  690. }
  691. span {
  692. color: rgba(0, 0, 0, .45);
  693. display: inline-block;
  694. font-size: .95rem;
  695. line-height: 42px;
  696. margin-bottom: 4px;
  697. }
  698. p {
  699. line-height: 42px;
  700. margin: 0;
  701. a {
  702. font-weight: 600;
  703. font-size: 1rem;
  704. }
  705. }
  706. }
  707. .dept-zbph-table{
  708. padding: 0 20px 20px;
  709. }
  710. </style>