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.
 
 
 
 

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