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.
 
 
 
 

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