AI销管
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

882 lines
25 KiB

  1. <template>
  2. <view class="box">
  3. <view class="boxtittab">
  4. <view class="tabbox">
  5. <view :class="{ activecllasscet: activeTotal == 4 }" @click="tabtimetap(4)">近七天</view>
  6. </view>
  7. <view class="tabbox">
  8. <view :class="{ activecllasscet: activeTotal == 5 }" @click="tabtimetap(5)">近15天</view>
  9. </view>
  10. <view class="tabbox">
  11. <view :class="{ activecllasscet: activeTotal == 6 }" @click="tabtimetap(6)">近30天</view>
  12. </view>
  13. <view class="tabbox">
  14. <view :class="{ activecllasscet: activeTotal == 3 }" @click="tabtimetap(3)">自定义</view>
  15. </view>
  16. </view>
  17. <view class="timepick">
  18. <view class="timepicktime" @click="chiocStaff(0)">
  19. <view>{{staff1.label}}</view>
  20. <view>
  21. <image class="Underimg" src="../../../static/images/Underimg.png" mode=""></image>
  22. </view>
  23. </view>
  24. <view class="timepickpick" v-if="staff1.value">
  25. <view @click="checkboxChange()" style="width: 40rpx;height:40rpx;border: 1rpx solid #E0E0E0;">
  26. <image v-if="timepickpickisshow" style="width: 40rpx;height: 40rpx;"
  27. src="../../../static/images/xuanzhong.png" mode=""></image>
  28. </view>
  29. <view style="font-size:26rpx;text-indent: 12rpx;">对比</view>
  30. </view>
  31. <view class="timepicktime" v-if="timepickpickisshow" @click="chiocStaff(1)">
  32. <view>{{staff2.label}}</view>
  33. <view>
  34. <image class="Underimg" src="../../../static/images/Underimg.png" mode=""></image>
  35. </view>
  36. </view>
  37. </view>
  38. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  39. <view class="single">
  40. <view class="title">
  41. <view class="title1" style="flex: 1;">接待量</view>
  42. <view class="title3" style="flex: 1;">
  43. <view class="title3-box" @click="tabtimetap1(0)">
  44. <view style="height: 42rpx;" :class="{ activecltab: eharTab.active1 == 0 }">排名</view>
  45. </view>
  46. <view class="title3-box" @click="tabtimetap1(1)">
  47. <view style="height: 42rpx;" :class="{ activecltab: eharTab.active1 == 1 }">趋势</view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="hejibox">
  52. <view class="heji">{{!staff1.value?'团队总数':staff1.label}}:{{newTeam1||0}}</view>
  53. <view class="heji">{{!staff2.value?'团队平均':staff2.label}}:{{newAvg1||0}}</view>
  54. </view>
  55. <view class="" v-if=" eharTab.active1 == 1 ">
  56. <view class="danwei">接待量</view>
  57. <view class="uchaserbox">
  58. <template v-if="lineOptsect1">
  59. <qiun-data-charts type="line" :chartData="lineOptsect1" background="none" :ontouch="true"
  60. canvasId="wangxiaohuaerlingeryilingwuyibbb" :canvas2d="true" />
  61. </template>
  62. </view>
  63. </view>
  64. <view class="jindu" v-if=" eharTab.active1 == 0 ">
  65. <view class="jindu-box" v-for="(item,index) in newlisttabinfo1" :key="index">
  66. <view class="jindu-boxche">
  67. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  68. <view style="width: 440rpx;margin-left: 10rpx;">
  69. <u-line-progress height="24" :show-percent="false" active-color="#FBA448"
  70. :percent="item.zxl1"></u-line-progress>
  71. </view>
  72. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}</view>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  78. <view class="single">
  79. <view class="title">
  80. <view class="title1" style="flex: 1;">接待时长</view>
  81. <view class="title3" style="flex: 1;">
  82. <view class="title3-box" @click="tabtimetap2(0)">
  83. <view style="height: 42rpx;" :class="{ activecltab: eharTab.active2 == 0 }">排名</view>
  84. </view>
  85. <view class="title3-box" @click="tabtimetap2(1)">
  86. <view style="height: 42rpx;" :class="{ activecltab: eharTab.active2 == 1 }">趋势</view>
  87. </view>
  88. <!-- <view class="title3-box">
  89. <view style="height: 42rpx;" :class="{ activecltab: activeTotal2 == 2 }">表格</view>
  90. </view> -->
  91. </view>
  92. </view>
  93. <view class="hejibox">
  94. <view class="heji">{{!staff1.value?'团队总数':staff1.label}}:{{newTeam2||0}}</view>
  95. <view class="heji">{{!staff2.value?'团队平均':staff2.label}}:{{newAvg2||0}}</view>
  96. </view>
  97. <view class="" v-if=" eharTab.active2 == 1 ">
  98. <view class="danwei">录音时长</view>
  99. <view class="uchaserbox">
  100. <template v-if="lineOptsect2">
  101. <qiun-data-charts type="line" :chartData="lineOptsect2" background="none" :ontouch="true"
  102. canvasId="wangxiaohuaerlingeryilingwuyibb" :canvas2d="true" />
  103. </template>
  104. </view>
  105. </view>
  106. <view class="jindu" v-if=" eharTab.active2 == 0 ">
  107. <view class="jindu-box" v-for="(item,index) in newlisttabinfo2" :key="index">
  108. <view class="jindu-boxche">
  109. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  110. <view style="width: 440rpx;margin-left: 10rpx;">
  111. <u-line-progress height="24" :show-percent="false" active-color="#FBA448"
  112. :percent="item.zxl1"></u-line-progress>
  113. </view>
  114. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}</view>
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  120. <view class="single">
  121. <view class="title">
  122. <view class="title1" style="flex: 1;">销讲执行率</view>
  123. <view class="title3" style="flex: 1;">
  124. <view class="title3-box" @click="tabtimetap3(0)">
  125. <view style="height: 42rpx;" :class="{ activecltab: eharTab.active3 == 0 }">排名</view>
  126. </view>
  127. <view class="title3-box" @click="tabtimetap3(1)">
  128. <view style="height: 42rpx;" :class="{ activecltab: eharTab.active3 == 1 }">趋势</view>
  129. </view>
  130. </view>
  131. </view>
  132. <view class="" v-if=" eharTab.active3 == 1 ">
  133. <view class="danwei">执行率</view>
  134. <view class="uchaserbox">
  135. <template v-if="lineOptsect3">
  136. <qiun-data-charts type="line" :chartData="lineOptsect3" background="none" :ontouch="true"
  137. canvasId="wangxiaohuaerlingeryilingwuyib" :canvas2d="true" />
  138. </template>
  139. </view>
  140. </view>
  141. <view class="jindu" v-if=" eharTab.active3 == 0 ">
  142. <view class="jindu-box" v-for="(item,index) in newlisttabinfo3" :key="index">
  143. <view class="jindu-boxche">
  144. <view class="jindu-name">{{item.name.substring(0, 4)}}</view>
  145. <view style="width: 440rpx;margin-left: 10rpx;">
  146. <u-line-progress height="24" :show-percent="false" active-color="#FBA448"
  147. :percent="item.zxl1"></u-line-progress>
  148. </view>
  149. <view class="jindu-zxl">{{item.zxl==null?0:item.zxl}}%</view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  155. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  156. <view class="single">
  157. <view class="title" style="padding-right: 30rpx;">
  158. <view class="title1" style="flex: 1;">销讲能力</view>
  159. <view class="title2" style="flex: 1;justify-content: flex-end;" @click="goTeam">
  160. <view class="title2-che">团队
  161. <image class="righttochoose" src="../../../static/images/righttochoose.png" mode=""></image>
  162. </view>
  163. </view>
  164. </view>
  165. <view class="uchaserbox">
  166. <qiun-data-charts :opts="opts" type="radar" :chartData="chartData1" :canvas2d="true"
  167. canvasId="wangxiaohuaerlingeryilingwuyib88" background="none" />
  168. </view>
  169. </view>
  170. <view style="width: 100%;height: 20rpx;background: #FAFAFA;"></view>
  171. <u-calendar v-model="totalTimeShow" mode="range" @change="totalTimeChange"></u-calendar>
  172. <!-- 选择部门的选择框 -->
  173. <u-select v-model="staffShow" :list="staffList" @confirm="staffSelectCallback" :default-value='selindex'>
  174. </u-select>
  175. <u-select v-model="staffShow1" :list="staffList1" @confirm="staffSelectCallback" :default-value='selindex'>
  176. </u-select>
  177. </view>
  178. </template>
  179. <script>
  180. var app = getApp();
  181. var util = require("../../../utils/util.js");
  182. var config = require("../../../config");
  183. export default {
  184. data() {
  185. return {
  186. activeTotal: 4,
  187. eharTab: {
  188. active1: 0,
  189. active2: 0,
  190. active3: 0,
  191. active4: 0,
  192. },
  193. deptids: '',
  194. bocindex: 0,
  195. timepickpickisshow: false,
  196. totalTimeShow: false,
  197. // 楼盘id
  198. houseId: '',
  199. staffList: [],
  200. staffList1: [],
  201. staffShow: false,
  202. staffShow1: false,
  203. staff1: {
  204. value: '',
  205. label: ''
  206. },
  207. staff2: {
  208. value: '',
  209. label: '平均'
  210. },
  211. lastStartDate: '',
  212. lastEndDate: '',
  213. selindex: [0],
  214. choseStaffFlag: false,
  215. lineOptsect1: {
  216. "categories": ["2016", "2017", "2018", "2019", "2020", "2021"],
  217. "series": [{
  218. "name": "成交量1",
  219. "data": [35, 8, 25, 37, 4, 20]
  220. },
  221. {
  222. "name": "成交量2",
  223. "data": [40, 18, 45, 44, 10, 60]
  224. }
  225. ]
  226. },
  227. lineOptsect2: {
  228. "categories": ["2016", "2017", "2018", "2019", "2020", "2021"],
  229. "series": [{
  230. "name": "成交量1",
  231. "data": [35, 8, 25, 37, 4, 20]
  232. },
  233. {
  234. "name": "成交量2",
  235. "data": [40, 18, 45, 44, 10, 60]
  236. }
  237. ]
  238. },
  239. lineOptsect3: {
  240. "categories": ["2016", "2017", "2018", "2019", "2020", "2021"],
  241. "series": [{
  242. "name": "成交量1",
  243. "data": [35, 8, 25, 37, 4, 20]
  244. },
  245. {
  246. "name": "成交量2",
  247. "data": [40, 18, 45, 44, 10, 60]
  248. }
  249. ]
  250. },
  251. lineOptsect4: {
  252. "categories": ["2016", "2017", "2018", "2019", "2020", "2021"],
  253. "series": [{
  254. "name": "成交量1",
  255. "data": [35, 8, 25, 37, 4, 20]
  256. },
  257. {
  258. "name": "成交量2",
  259. "data": [40, 18, 45, 44, 10, 60]
  260. }
  261. ]
  262. },
  263. newlisttabinfo1: [{
  264. name: '接待量',
  265. zxl: '10'
  266. },
  267. {
  268. name: '平均执行率',
  269. zxl: '50'
  270. },
  271. {
  272. name: '接待客户',
  273. zxl: '80'
  274. },
  275. ],
  276. newlisttabinfo2: [{
  277. name: '接待量',
  278. zxl: '10'
  279. },
  280. {
  281. name: '平均执行率',
  282. zxl: '50'
  283. },
  284. {
  285. name: '接待客户',
  286. zxl: '80'
  287. },
  288. ],
  289. newlisttabinfo3: [{
  290. name: '接待量',
  291. zxl: '10'
  292. },
  293. {
  294. name: '平均执行率',
  295. zxl: '50'
  296. },
  297. {
  298. name: '接待客户',
  299. zxl: '80'
  300. },
  301. ],
  302. newlisttabinfo4: [{
  303. name: '接待量',
  304. zxl: '10'
  305. },
  306. {
  307. name: '平均执行率',
  308. zxl: '50'
  309. },
  310. {
  311. name: '接待客户',
  312. zxl: '80'
  313. },
  314. ],
  315. newTeam1: '',
  316. newAvg1: '',
  317. newTeam2: '',
  318. newAvg2: '',
  319. newTeam3: '',
  320. newAvg3: '',
  321. newTeam4: '',
  322. newAvg4: '',
  323. chartData1: {
  324. "categories": ["维度1", "维度2", "维度3", "维度4", "维度5", "维度6"],
  325. "series": [{
  326. "name": "成交量",
  327. "data": [90, 110, 165, 195, 187, 172]
  328. }]
  329. },
  330. chartData2: {
  331. "categories": ["维度1", "维度2", "维度3", "维度4", "维度5", "维度6"],
  332. "series": [{
  333. "name": "成交量",
  334. "data": [90, 110, 165, 195, 187, 172]
  335. }]
  336. },
  337. opts: {
  338. fontSize: 10,
  339. extra: {
  340. radar: {
  341. max: 100
  342. }
  343. }
  344. }
  345. };
  346. },
  347. onLoad() {
  348. let that = this
  349. uni.$on('update', function(data) {
  350. // console.log(data)
  351. that.deptids = data.arr.join(',')
  352. // 获取销奖能力
  353. that.getPowerList()
  354. })
  355. // 获取楼盘id
  356. this.houseId = uni.getStorageSync('buildingID').id;
  357. // this.buildingname = uni.getStorageSync('buildingID').name;
  358. // 请求接口获取所有置业顾问员工的列表
  359. this.getSectionList()
  360. },
  361. onPullDownRefresh(){
  362. this.getSectionList()
  363. setTimeout(function () {
  364. uni.stopPullDownRefresh();
  365. }, 1000);
  366. },
  367. methods: {
  368. //是否对比
  369. checkboxChange() {
  370. this.timepickpickisshow = !this.timepickpickisshow;
  371. this.staff2.label = '平均'
  372. this.staff2.value = ''
  373. this.lineOptsect1 = null
  374. this.lineOptsect2 = null
  375. this.lineOptsect3 = null
  376. // 团队对比接待量
  377. this.receptionCountList(this.eharTab.active1, 1, '/cusLvStatistics/teamAnalysisReception')
  378. // 团队对比接待时长
  379. this.receptionCountList(this.eharTab.active2, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  380. /* 销奖执行率 */
  381. this.receptionCountList(this.eharTab.active3, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  382. // 获取销奖能力
  383. this.getPowerList()
  384. },
  385. // 获取部门列表
  386. getSectionList() {
  387. this.$u.post('/cusLvStatistics/findAllDeptIdByHouseId', {
  388. houseId: this.houseId
  389. })
  390. .then(res => {
  391. this.staffList = []
  392. this.staffList1 = []
  393. res.map(item => {
  394. let obj = {}
  395. obj.value = item.deptId
  396. obj.label = item.deptName
  397. this.staffList.push(obj)
  398. })
  399. this.staffList1 = [...this.staffList]
  400. this.staffList.unshift({
  401. value: '',
  402. label: '全部'
  403. })
  404. this.staffList1.unshift({
  405. value: '',
  406. label: '平均'
  407. })
  408. this.staff1 = this.staffList[0]
  409. // 团队对比接待量
  410. this.receptionCountList(0, 1, '/cusLvStatistics/teamAnalysisReception')
  411. // 团队对比接待时长
  412. this.receptionCountList(0, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  413. /* 销奖执行率 */
  414. this.receptionCountList(0, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  415. // 获取销奖能力
  416. this.getPowerList()
  417. })
  418. },
  419. // 点击部门对比
  420. chiocStaff(idx) {
  421. if (idx == 0) {
  422. // 当选择了第一个的时候
  423. this.choseStaffFlag = false
  424. this.staffShow = true
  425. } else {
  426. this.choseStaffFlag = true
  427. this.staffShow1 = true
  428. }
  429. },
  430. //时间切换
  431. tabtimetap(index) {
  432. if (index == 3) {
  433. this.totalTimeShow = true;
  434. } else {
  435. this.activeTotal = index;
  436. this.lastEndDate = ''
  437. this.lastStartDate = ''
  438. // 获取数据
  439. // 团队对比接待量
  440. this.receptionCountList(this.eharTab.active1, 1, '/cusLvStatistics/teamAnalysisReception')
  441. // 团队对比接待时长
  442. this.receptionCountList(this.eharTab.active2, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  443. /* 销奖执行率 */
  444. this.receptionCountList(this.eharTab.active3, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  445. // 获取销奖能力
  446. this.getPowerList()
  447. }
  448. },
  449. // 接待量
  450. tabtimetap1(idx) {
  451. this.eharTab.active1 = idx
  452. // 调用方法
  453. this.receptionCountList(idx, 1, '/cusLvStatistics/teamAnalysisReception')
  454. },
  455. // 接待时长
  456. tabtimetap2(idx) {
  457. this.eharTab.active2 = idx
  458. // 调用方法
  459. this.receptionCountList(idx, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  460. },
  461. tabtimetap3(idx) {
  462. this.eharTab.active3 = idx
  463. // 调用方法
  464. this.receptionCountList(idx, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  465. },
  466. tabtimetap4(idx) {
  467. this.eharTab.active4 = idx
  468. // 调用方法
  469. // this.getRecordList()
  470. },
  471. //自定义时间
  472. totalTimeChange(e) {
  473. console.log(e.startDate, e.endDate)
  474. this.activeTotal = 3;
  475. this.lastEndDate = e.endDate
  476. this.lastStartDate = e.startDate
  477. // 获取数据
  478. // 团队对比接待量
  479. this.receptionCountList(this.eharTab.active1, 1, '/cusLvStatistics/teamAnalysisReception')
  480. // 团队对比接待时长
  481. this.receptionCountList(this.eharTab.active2, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  482. /* 销奖执行率 */
  483. this.receptionCountList(this.eharTab.active3, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  484. // 获取销奖能力
  485. this.getPowerList()
  486. },
  487. //指标执行率分析tab
  488. tapspagek2(index) {
  489. this.bocindex = index;
  490. },
  491. //集团对比
  492. Groupcontrast() {
  493. uni.navigateTo({
  494. url: '/pages/center/Piabodata/Groupcontrast'
  495. });
  496. },
  497. // 去选择团队
  498. goTeam() {
  499. uni.navigateTo({
  500. url: `/pages/center/Piabodata/selectTeam?ids=${this.deptids}`
  501. })
  502. },
  503. staffSelectCallback(e) {
  504. if (this.choseStaffFlag) {
  505. // 第二个客户
  506. // console.log(e,'第二个')
  507. this.staff2 = e[0]
  508. } else {
  509. // 第一个客户
  510. // console.log(e,'第一个')
  511. // 当选择全部时
  512. if (!e.value) {
  513. this.timepickpickisshow = false
  514. this.staff2.label = '平均'
  515. this.staff2.value = ''
  516. }
  517. this.staff1 = e[0]
  518. }
  519. if (this.staff1.label == this.staff2.label) {
  520. uni.showToast({
  521. title: '请勿选择重复',
  522. icon: 'none'
  523. })
  524. this.staff2.label = '请选择'
  525. // this.staff2.label='平均'
  526. // this.staff2.value=''
  527. return
  528. } else {
  529. // 获取数据
  530. // 团队对比接待量
  531. this.receptionCountList(this.eharTab.active1, 1, '/cusLvStatistics/teamAnalysisReception')
  532. // 团队对比接待时长
  533. this.receptionCountList(this.eharTab.active2, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  534. /* 销奖执行率 */
  535. this.receptionCountList(this.eharTab.active3, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  536. // 获取销奖能力
  537. this.getPowerList()
  538. }
  539. },
  540. // 公共方法
  541. receptionCountList(idx, index, url) {
  542. this.$u.post(url, {
  543. deptIds: [this.staff1.value, this.staff2.value].filter(item => item).join(','),
  544. showRank: idx,
  545. houseId: this.houseId,
  546. timeType: this.lastEndDate ? null : this.activeTotal + '',
  547. lastEndDate: this.lastEndDate,
  548. lastStartDate: this.lastStartDate
  549. })
  550. .then(res => {
  551. console.log('我再此')
  552. let result = res.result
  553. this['newTeam' + index] = res.avg[0]
  554. this['newAvg' + index] = res.avg[1]
  555. if (idx == 0) {
  556. console.log(idx, index, url, '打卡记录撒橘红颗粒大健康1 ')
  557. // 当选择的是牌名时
  558. // 处理数据
  559. // 先处理牌名数据,需要进行判断全部还是单个
  560. // 当为全部时
  561. this['newlisttabinfo' + index] = []
  562. let arr = []
  563. // 当选择全部时
  564. if (!this.staff1.value && !this.staff2.value) {
  565. // console.log(1)
  566. result[0].map(item => {
  567. let obj = {}
  568. obj.name = item.deptName
  569. obj.zxl = item.data
  570. arr.push(obj)
  571. })
  572. arr = this.dealData(arr)
  573. this['newlisttabinfo' + index] = arr
  574. }
  575. // 当选择只有一个时
  576. else if (this.staff1.value && !this.staff2.value) {
  577. // console.log(2)
  578. result[0].map(item => {
  579. let obj = {}
  580. obj.name = item.deptName
  581. obj.zxl = item.data
  582. arr.push(obj)
  583. })
  584. // 判断是否显示平均
  585. // 如果显示对比
  586. if (this.timepickpickisshow) {
  587. result[1].map(item => {
  588. let obj = {}
  589. obj.name = '平均'
  590. obj.zxl = item.data
  591. arr.push(obj)
  592. })
  593. }
  594. arr = this.dealData(arr)
  595. this['newlisttabinfo' + index] = arr
  596. } else {
  597. console.log(3, '啥大上课了就可领取诶去玩害偶尔UI哦请勿诶哦')
  598. // 当两个都选择的时候
  599. result[0].map(item => {
  600. let obj = {}
  601. obj.name = item.deptName
  602. obj.zxl = item.data
  603. arr.push(obj)
  604. })
  605. result[1].map(item => {
  606. let obj = {}
  607. obj.name = item.deptName
  608. obj.zxl = item.data
  609. arr.push(obj)
  610. })
  611. arr = this.dealData(arr)
  612. this['newlisttabinfo' + index] = arr
  613. }
  614. } else {
  615. console.log(idx, index, url, '1231231231289123132UI哦23UI哦23UI哦1 ')
  616. // 当选择趋势时
  617. this['lineOptsect' + index] = {}
  618. let allobj = {
  619. categories: [],
  620. series: []
  621. }
  622. // 先处理时间
  623. // 当选择全部时
  624. if (!this.staff1.value && !this.staff2.value) {
  625. result.map((item, idx) => {
  626. let obj = {}
  627. obj.name = item[0].deptName
  628. obj.data = []
  629. item.map(item1 => {
  630. // 时间的处理
  631. if (idx == 0) {
  632. allobj.categories.push(item1.statDate.slice(5, 10))
  633. }
  634. obj.data.push(item1.data)
  635. })
  636. allobj.series.push(obj)
  637. })
  638. }
  639. // 当选择只有一个时
  640. else if (this.staff1.value && !this.staff2.value) {
  641. // console.log(2)
  642. let obj = {}
  643. obj.data = []
  644. obj.name = result[0][0].deptName
  645. result[0].map(item => {
  646. allobj.categories.push(item.statDate.slice(5, 10))
  647. obj.data.push(item.data)
  648. })
  649. allobj.series.push(obj)
  650. // 判断是否显示平均
  651. // 如果显示对比
  652. if (this.timepickpickisshow) {
  653. let obj = {}
  654. obj.data = []
  655. obj.name = '平均'
  656. result[1].map(item => {
  657. obj.data.push(item.data)
  658. })
  659. allobj.series.push(obj)
  660. }
  661. } else {
  662. // console.log(3)
  663. // 当两个都选择的时候
  664. let obj = {}
  665. let obj1 = {}
  666. obj.data = []
  667. obj1.data = []
  668. obj.name = result[0][0].deptName
  669. obj1.name = result[1][0].deptName
  670. result[0].map(item => {
  671. allobj.categories.push(item.statDate.slice(5, 10))
  672. obj.data.push(item.data)
  673. })
  674. result[1].map(item => {
  675. obj1.data.push(item.data)
  676. })
  677. allobj.series.push(obj)
  678. allobj.series.push(obj1)
  679. }
  680. // console.log(allobj)
  681. // return
  682. // this.lineOptsect1=allobj
  683. this['lineOptsect' + index] = allobj
  684. // this['lineOptsect'+index].series=allobj.series
  685. // this['lineOptsect'+index].categories=allobj.categories
  686. }
  687. this.$forceUpdate()
  688. })
  689. },
  690. // 获取销奖能力
  691. getPowerList() {
  692. this.$u.post('/cusLvStatistics/teamAnalysisMarketingAbility', {
  693. deptIds: this.deptids || [this.staff1.value, this.staff2.value].filter(item => item).join(','),
  694. houseId: this.houseId,
  695. timeType: this.lastEndDate ? null : this.activeTotal + '',
  696. lastEndDate: this.lastEndDate,
  697. lastStartDate: this.lastStartDate
  698. })
  699. .then(res => {
  700. // console.log(res)
  701. // 处理数据
  702. this.chartData1 = {
  703. categories: [],
  704. series: []
  705. }
  706. let allobj = {
  707. categories: [],
  708. series: []
  709. }
  710. // 当选择全部时
  711. if (!this.staff1.value && !this.staff2.value) {
  712. // let first=res.first
  713. res.first.map((item, index) => {
  714. let obj = {
  715. name: item[0].deptName,
  716. data: []
  717. }
  718. item.map((item1) => {
  719. if (index == 0) {
  720. allobj.categories.push(item1.name)
  721. }
  722. obj.data.push(item1.avgExecutionRate)
  723. })
  724. allobj.series.push(obj)
  725. })
  726. }
  727. // 当选择只有一个时
  728. else if (this.staff1.value && !this.staff2.value) {
  729. res.first.map((item, index) => {
  730. let obj = {
  731. name: item[0].deptName,
  732. data: []
  733. }
  734. item.map((item1) => {
  735. if (index == 0) {
  736. allobj.categories.push(item1.name)
  737. }
  738. obj.data.push(item1.avgExecutionRate)
  739. })
  740. allobj.series.push(obj)
  741. })
  742. // 判断是否显示平均
  743. // 如果显示对比
  744. if (this.timepickpickisshow) {
  745. res.second.map((item, index) => {
  746. let obj = {
  747. name: '平均',
  748. data: []
  749. }
  750. item.map((item1) => {
  751. obj.data.push(item1.avgExecutionRate)
  752. })
  753. allobj.series.push(obj)
  754. })
  755. }
  756. } else {
  757. // console.log(3)
  758. // 当两个都选择的时候
  759. res.first.map((item, index) => {
  760. let obj = {
  761. name: item[0].deptName,
  762. data: []
  763. }
  764. item.map((item1) => {
  765. if (index == 0) {
  766. allobj.categories.push(item1.name)
  767. }
  768. obj.data.push(item1.avgExecutionRate)
  769. })
  770. allobj.series.push(obj)
  771. })
  772. }
  773. // console.log(allobj)
  774. this.chartData1 = allobj
  775. this.$forceUpdate()
  776. })
  777. },
  778. // 定义一个公共方法对数据进行处理
  779. dealData(arr) {
  780. // 获取最大值
  781. let num = Math.max.apply(Math, arr.map(function(o) {
  782. return o.zxl
  783. })) //结果:3
  784. // console.log(num)
  785. if (num > 100) {
  786. // 获取最大值的下标
  787. // let idx=arr.findIndex(item=>item.zxl==num)
  788. // console.log(idx,123)
  789. arr.map(item => {
  790. item.zxl1 = Math.floor(item.zxl / num * 100)
  791. })
  792. // console.log(arr)
  793. return arr
  794. } else {
  795. arr.map(item => {
  796. item.zxl1 = item.zxl
  797. })
  798. return arr
  799. }
  800. },
  801. }
  802. };
  803. </script>
  804. <style lang="scss" scoped>
  805. .boxtittab {
  806. position: sticky;
  807. top: var(--window-top);
  808. z-index: 999;
  809. }
  810. .box {
  811. width: 100%;
  812. height: 100%;
  813. background: #FAFAFA;
  814. padding-bottom: 60rpx;
  815. }
  816. // 对比时间切换
  817. .timepick {
  818. width: 100%;
  819. height: 90rpx;
  820. display: flex;
  821. align-items: center;
  822. background: #FAFAFA;
  823. }
  824. .timepicktime {
  825. width: 260rpx;
  826. height: 50rpx;
  827. border: 1rpx solid #E0E0E0;
  828. margin-left: 30rpx;
  829. display: flex;
  830. background: #FFFFFF;
  831. }
  832. .timepicktime>view:nth-of-type(1) {
  833. width: 210rpx;
  834. height: 100%;
  835. line-height: 50rpx;
  836. font-size: 26rpx;
  837. font-weight: 400;
  838. text-align: center;
  839. }
  840. .timepicktime>view:nth-of-type(2) {
  841. width: 49rpx;
  842. height: 100%;
  843. // border-left: 1px solid #E0E0E0;
  844. }
  845. .timepickpick {
  846. width: 110rpx;
  847. height: 50rpx;
  848. margin-left: 30rpx;
  849. display: flex;
  850. align-items: center;
  851. }
  852. .Underimg {
  853. width: 50rpx;
  854. height: 50rpx;
  855. margin-top: -2rpx;
  856. }
  857. </style>