Analysis.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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" 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" 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. // 排行
  290. rankingSeriesData: [50, 42, 26, 20, 15, 14, 12, 8, 5, 1],
  291. rankingYAxisNames: ["部门06", "部门01", "部门05", "部门10", "部门07", "部门04", "部门03", "部门08", "部门09", "部门02"],
  292. yAxisNumbers: [50, 42, 26, 23, 15, 14, 12, 8, 5, 1],
  293. // 双y轴总览图
  294. twoYAxisData: {},
  295. // 排行
  296. // 部门指标排行
  297. zhbLoading: true,
  298. zbPhParams: {
  299. beginDate: null,
  300. yearValue: null, // 因为dataPick是moment格式,所以加一个进行转化显示用
  301. time: ''
  302. },
  303. columns: [
  304. {
  305. title: '序号',
  306. dataIndex: '',
  307. key:'rowIndex',
  308. width:60,
  309. align:"center",
  310. customRender:function (t,r,index) {
  311. return parseInt(index)+1;
  312. }
  313. },
  314. {
  315. title:'部门',
  316. align:"center",
  317. dataIndex: 'wlbm'
  318. },
  319. {
  320. title:'已收款',
  321. align:"center",
  322. dataIndex: 'ggxh'
  323. },
  324. {
  325. title:'成本',
  326. align:"center",
  327. dataIndex: 'zlLevel'
  328. },
  329. {
  330. title:'利润',
  331. align:"center",
  332. dataIndex: 'pici'
  333. },
  334. // {
  335. // title:'利润率',
  336. // align:"center",
  337. // dataIndex: 'pici'
  338. // },
  339. {
  340. title:'合同数量',
  341. align:"center",
  342. dataIndex: 'danjia'
  343. },
  344. {
  345. title:'合同金额',
  346. align:"center",
  347. dataIndex: 'htDate'
  348. },
  349. ],
  350. zbphYearIsopen: false,
  351. zbPhDataSource: {
  352. jycsCharts: [],
  353. zrbmCharts: [],
  354. },
  355. }
  356. },
  357. computed: {
  358. // 判断箭头样式
  359. setJiantou(){
  360. // 闭包实现computed中传参
  361. return function (value) {
  362. var item = Number(value) > 0 ? 'up' : 'down'
  363. return item
  364. }
  365. },
  366. totalPrice(){
  367. return function (value) {
  368. var item = (Number(value) / 10000).toFixed(2)
  369. // console.log(item)
  370. return '¥'+item
  371. }
  372. },
  373. totalPriceYear(){
  374. return function (value) {
  375. var item = (Number(value) / 10000).toFixed(2)
  376. console.log(item)
  377. return item + ' 万元'
  378. }
  379. },
  380. // 将后端数据准换成整数%显示
  381. comTbHb(){
  382. return function (value) {
  383. // console.log(Math.abs('-0.35'))
  384. var item = (Math.abs(value) * 100).toFixed(0)
  385. return item
  386. }
  387. },
  388. },
  389. created() {
  390. this.initLogInfo();
  391. this.getZhibiaoCollect()
  392. this.setNowDate()
  393. // 部门指标排行
  394. // this.deptZhibiaoPaihang()
  395. this.searchZbphChange('month')
  396. },
  397. methods: {
  398. //限制选择年份
  399. disabledYear(current){
  400. // 不可以选择之前的日期,今天包括之后可以选,控制大于小于来实现选择之前的日期还是之后的日期
  401. // return current < moment().subtract(1, 'year');
  402. var timeYear = current.get('year'); // 当前年
  403. return timeYear < '2023';
  404. },
  405. getZhibiaoCollect(){
  406. this.loading = true
  407. getZhibiaoCollect().then(res => {
  408. console.log(res)
  409. if (res.success) {
  410. // 0:所领导,1:部门领导,2:员工;3:未赋值或选了多个前面所说角色
  411. // 如果是管理员,默认显示所领导的
  412. this.pageRoleNum = res.result.auth
  413. if(res.result.auth >= 2){
  414. return
  415. }
  416. var arr = []
  417. for (let i = 0; i < this.zhibiaoTotal.length; i++) {
  418. const element = this.zhibiaoTotal[i];
  419. // element.data = res.result[element.hdValue]
  420. arr[i] = {...element, ...res.result.data[element.hdValue]}
  421. }
  422. this.zhibiaoTotal = arr
  423. this.loading = false
  424. }else{
  425. this.$message.warning(res.message)
  426. this.loading = false
  427. }
  428. }).finally(() => {
  429. this.loading = false
  430. })
  431. },
  432. setNowDate(type){
  433. const now = new Date()
  434. const year = now.getFullYear(); // 年
  435. const month = now.getMonth() + 1; // 月
  436. const monthBetter = month >= 10 ? month : '0' + month
  437. const beginDate = `${year}-01`
  438. const endDate = `${year}-${monthBetter}`
  439. this.dateValue = [beginDate, endDate]
  440. var sType = this.searchType ? this.searchType : type
  441. if(sType === 'month'){
  442. this.searchParams = {
  443. time: 'month',
  444. beginDate: beginDate,
  445. endDate: endDate,
  446. }
  447. } else if (sType === 'year') {
  448. this.searchParams = {
  449. time: 'year',
  450. beginDate: year,
  451. endDate: year,
  452. }
  453. }
  454. this.getDataByDate()
  455. },
  456. // 点击指标转换下方数据
  457. clickItemTotal(item, index){
  458. // console.log(item, index)
  459. this.chooseValue = item.value
  460. this.chartTitle = item.value === 'hte' ? '合同' : item.title
  461. // 调用showLoading方法--解决卡顿和数据闪等问题
  462. setTimeout(() => {
  463. // 定时器解决v-if下第一时间无法获取ref的问题
  464. if(this.$refs.lineBarChartRef){this.$refs.lineBarChartRef.uEcharts.showLoading({text: '加载中...'});}
  465. // 取消设置,因为一开始就很快
  466. if(this.$refs.twoYAxisChartRef){this.$refs.twoYAxisChartRef.uEcharts.showLoading({text: '加载中...'});}
  467. if(this.$refs.lineBarChartChbRef){this.$refs.lineBarChartChbRef.uEcharts.showLoading({text: '加载中...'});}
  468. }, 1);
  469. // this.lineBarSeriesData = item.lineBarSeriesData
  470. // console.log(this.dateValue)
  471. this.getDataByDate()
  472. },
  473. // 获取时间变化图表数据
  474. getDataByDate(){
  475. switch (this.chooseValue) {
  476. case 'hte':
  477. getdataByHt(this.searchParams).then(res => {
  478. console.log(res)
  479. if (res.success) {
  480. this.twoYAxisData = res.result
  481. }else{
  482. this.$message.warning(res.message)
  483. }
  484. }).finally(() => {
  485. // this.loading = false
  486. })
  487. break;
  488. case 'lre':
  489. getdataByLr(this.searchParams).then(res => {
  490. console.log(res)
  491. if (res.success) {
  492. this.lineBarXAxisData = res.result.xaxisData
  493. this.lineBarSeriesData = [
  494. {
  495. name: '利润额',
  496. data: res.result.seriesData,
  497. }
  498. ]
  499. }else{
  500. this.$message.warning(res.message)
  501. }
  502. }).finally(() => {
  503. // this.loading = false
  504. })
  505. break;
  506. case 'ske':
  507. getdataBySk(this.searchParams).then(res => {
  508. console.log(res)
  509. if (res.success) {
  510. this.lineBarXAxisData = res.result.xaxisData
  511. this.lineBarSeriesData = [
  512. {
  513. name: '收款额',
  514. data: res.result.seriesData,
  515. }
  516. ]
  517. }else{
  518. this.$message.warning(res.message)
  519. }
  520. }).finally(() => {
  521. // this.loading = false
  522. })
  523. break;
  524. case 'chb':
  525. getdataByChb(this.searchParams).then(response => {
  526. console.log(response)
  527. var chartsData = response.result[0].chartInfoList[0]
  528. var chbRankingData = response.result[0].eightCostPaiHang
  529. this.rankList = chbRankingData.map(res => {
  530. var findItem = chb8Names.find(item => item.value === res.name)
  531. return{
  532. name: findItem.name + ' ' + res.proportion + '%',
  533. total: (Number(res.value) / 10000).toFixed(2)+'万元'
  534. }
  535. })
  536. if(response){
  537. this.chbXAxisData = chartsData.xaxisData
  538. this.chbSeriesData = chartsData.seriesData.map(res => {
  539. var findItem = chb8Names.find(item => item.value === res.name)
  540. return{
  541. name: findItem.name,
  542. data: res.values
  543. }
  544. })
  545. }
  546. }).finally(() => {
  547. // this.loading = false
  548. })
  549. break;
  550. default:
  551. break;
  552. }
  553. },
  554. // 查询类型选择:按年、按月
  555. searchTypeChange(type){
  556. // this.resetParams()
  557. this.searchType = type
  558. this.searchFormat = type === 'month' ? 'YYYY-MM' : 'YYYY'
  559. this.searchPlaceholder = type === 'month' ? ['开始月份', '结束月份'] : ['开始年份', '结束年份']
  560. this.searchMode = [type, type]
  561. this.setNowDate(type)
  562. },
  563. handlePanelChange(value, mode) {
  564. // console.log(value, this.searchMode)
  565. // console.log(moment(value[0]).format('YYYY-MM'))
  566. this.dateValue = value;
  567. if(this.searchMode[0] === 'month'){
  568. this.searchParams = {
  569. time: 'month',
  570. beginDate: moment(value[0]).format('YYYY-MM'),
  571. endDate: moment(value[1]).format('YYYY-MM'),
  572. }
  573. }
  574. if(this.searchMode[0] === 'year'){
  575. this.searchParams = {
  576. time: 'year',
  577. beginDate: moment(value[0]).format('YYYY'),
  578. endDate: moment(value[1]).format('YYYY'),
  579. }
  580. }
  581. // this.modeMonth = [mode[0] === 'date' ? 'month' : mode[0], mode[1] === 'date' ? 'month' : mode[1]];
  582. },
  583. handleDateSure(){
  584. console.log(this.searchParams)
  585. this.getDataByDate()
  586. this.datePickShow = false
  587. },
  588. initLogInfo () {
  589. getLoginfo(null).then((res)=>{
  590. if(res.success){
  591. Object.keys(res.result).forEach(key=>{
  592. res.result[key] =res.result[key]+""
  593. })
  594. this.loginfo = res.result;
  595. }
  596. })
  597. getVisitInfo().then(res=>{
  598. if(res.success){
  599. this.visitInfo = res.result;
  600. }
  601. })
  602. },
  603. // 获取部门指标排行数据
  604. deptZhibiaoPaihang(){
  605. this.zhbLoading = true
  606. deptZhibiaoPaihang(this.zbPhParams).then(res => {
  607. if (res.success) {
  608. console.log(res)
  609. this.zbPhDataSource = res.result
  610. // this.$message.success(res.message)
  611. // this.$emit('ok')
  612. this.zhbLoading = false
  613. } else {
  614. this.$message.warning(res.message)
  615. this.zhbLoading = false
  616. }
  617. }).finally(() => {
  618. })
  619. },
  620. // 部门指标排行搜索
  621. searchZbphChange(type){
  622. this.zbPhParams.time = type
  623. const now = new Date()
  624. const year = now.getFullYear(); // 年
  625. const month = now.getMonth() + 1; // 月
  626. const monthBetter = month >= 10 ? month : '0' + month
  627. const endDate = `${year}-${monthBetter}`
  628. if(type === 'month'){
  629. this.zbPhParams.yearValue = ''
  630. this.zbPhParams.beginDate = endDate
  631. }
  632. if(type === 'year'){
  633. this.zbPhParams.yearValue = moment(year, 'YYYY')
  634. this.zbPhParams.beginDate = year
  635. console.log(this.zbPhParams)
  636. }
  637. this.deptZhibiaoPaihang()
  638. },
  639. // 部门指标排行按月选择确事件
  640. zbphSearchChange(date, dateString){
  641. // console.log(date, dateString)
  642. this.zbPhParams.beginDate = dateString
  643. this.deptZhibiaoPaihang()
  644. },
  645. handlePanelChange1(value, mode) {
  646. // console.log(value);
  647. // console.log(mode);
  648. // console.log(moment(value).format('YYYY'))
  649. this.zbPhParams.yearValue = value
  650. this.zbPhParams.beginDate = moment(value).format('YYYY')
  651. this.deptZhibiaoPaihang()
  652. this.zbphYearIsopen = false
  653. },
  654. changeopen() {
  655. this.zbphYearIsopen = true;
  656. },
  657. }
  658. }
  659. </script>
  660. <style lang="less" scoped>
  661. .circle-cust{
  662. position: relative;
  663. top: 28px;
  664. left: -100%;
  665. }
  666. .extra-wrapper {
  667. line-height: 55px;
  668. padding-right: 24px;
  669. .extra-item {
  670. display: inline-block;
  671. margin-right: 24px;
  672. a {
  673. margin-left: 24px;
  674. }
  675. }
  676. }
  677. /* 首页访问量统计 */
  678. .head-info {
  679. position: relative;
  680. text-align: left;
  681. padding: 0 32px 0 0;
  682. min-width: 125px;
  683. &.center {
  684. text-align: center;
  685. padding: 0 32px;
  686. }
  687. span {
  688. color: rgba(0, 0, 0, .45);
  689. display: inline-block;
  690. font-size: .95rem;
  691. line-height: 42px;
  692. margin-bottom: 4px;
  693. }
  694. p {
  695. line-height: 42px;
  696. margin: 0;
  697. a {
  698. font-weight: 600;
  699. font-size: 1rem;
  700. }
  701. }
  702. }
  703. .dept-zbph-table{
  704. padding: 0 20px 20px;
  705. }
  706. </style>