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.
 
 
 
 

895 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" :opts="lineOpts" />
  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" v-if="chartData1">
  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. lineOpts: {
  346. yAxis: {
  347. data: [
  348. {
  349. max: 100,
  350. min: 0,
  351. }
  352. ]
  353. }
  354. },
  355. };
  356. },
  357. onLoad() {
  358. let that = this
  359. uni.$on('update', function(data) {
  360. // console.log(data)
  361. that.deptids = data.arr.join(',')
  362. // 获取销奖能力
  363. that.getPowerList()
  364. })
  365. // 获取项目id
  366. this.houseId = uni.getStorageSync('buildingID').id;
  367. // this.buildingname = uni.getStorageSync('buildingID').name;
  368. // 请求接口获取所有置业顾问员工的列表
  369. this.getSectionList()
  370. },
  371. onPullDownRefresh(){
  372. this.getSectionList()
  373. setTimeout(function () {
  374. uni.stopPullDownRefresh();
  375. }, 1000);
  376. },
  377. methods: {
  378. //是否对比
  379. checkboxChange() {
  380. this.timepickpickisshow = !this.timepickpickisshow;
  381. this.staff2.label = '平均'
  382. this.staff2.value = ''
  383. this.lineOptsect1 = null
  384. this.lineOptsect2 = null
  385. this.lineOptsect3 = null
  386. this.chartData1 = null
  387. // 团队对比接待量
  388. this.receptionCountList(this.eharTab.active1, 1, '/cusLvStatistics/teamAnalysisReception')
  389. // 团队对比接待时长
  390. this.receptionCountList(this.eharTab.active2, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  391. /* 销奖执行率 */
  392. this.receptionCountList(this.eharTab.active3, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  393. // 获取销奖能力
  394. this.getPowerList()
  395. },
  396. // 获取部门列表
  397. getSectionList() {
  398. this.$u.post('/cusLvStatistics/findAllDeptIdByHouseId', {
  399. houseId: this.houseId
  400. })
  401. .then(res => {
  402. this.staffList = []
  403. this.staffList1 = []
  404. res.map(item => {
  405. let obj = {}
  406. obj.value = item.deptId
  407. obj.label = item.deptName
  408. this.staffList.push(obj)
  409. })
  410. this.staffList1 = [...this.staffList]
  411. this.staffList.unshift({
  412. value: '',
  413. label: '全部'
  414. })
  415. this.staffList1.unshift({
  416. value: '',
  417. label: '平均'
  418. })
  419. this.staff1 = this.staffList[0]
  420. // 团队对比接待量
  421. this.receptionCountList(0, 1, '/cusLvStatistics/teamAnalysisReception')
  422. // 团队对比接待时长
  423. this.receptionCountList(0, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  424. /* 销奖执行率 */
  425. this.receptionCountList(0, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  426. // 获取销奖能力
  427. this.getPowerList()
  428. })
  429. },
  430. // 点击部门对比
  431. chiocStaff(idx) {
  432. if (idx == 0) {
  433. // 当选择了第一个的时候
  434. this.choseStaffFlag = false
  435. this.staffShow = true
  436. } else {
  437. this.choseStaffFlag = true
  438. this.staffShow1 = true
  439. }
  440. },
  441. //时间切换
  442. tabtimetap(index) {
  443. if (index == 3) {
  444. this.totalTimeShow = true;
  445. } else {
  446. this.activeTotal = index;
  447. this.lastEndDate = ''
  448. this.lastStartDate = ''
  449. // 获取数据
  450. // 团队对比接待量
  451. this.receptionCountList(this.eharTab.active1, 1, '/cusLvStatistics/teamAnalysisReception')
  452. // 团队对比接待时长
  453. this.receptionCountList(this.eharTab.active2, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  454. /* 销奖执行率 */
  455. this.receptionCountList(this.eharTab.active3, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  456. // 获取销奖能力
  457. this.getPowerList()
  458. }
  459. },
  460. // 接待量
  461. tabtimetap1(idx) {
  462. this.eharTab.active1 = idx
  463. // 调用方法
  464. this.receptionCountList(idx, 1, '/cusLvStatistics/teamAnalysisReception')
  465. },
  466. // 接待时长
  467. tabtimetap2(idx) {
  468. this.eharTab.active2 = idx
  469. // 调用方法
  470. this.receptionCountList(idx, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  471. },
  472. tabtimetap3(idx) {
  473. this.eharTab.active3 = idx
  474. // 调用方法
  475. this.receptionCountList(idx, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  476. },
  477. tabtimetap4(idx) {
  478. this.eharTab.active4 = idx
  479. // 调用方法
  480. // this.getRecordList()
  481. },
  482. //自定义时间
  483. totalTimeChange(e) {
  484. console.log(e.startDate, e.endDate)
  485. this.activeTotal = 3;
  486. this.lastEndDate = e.endDate
  487. this.lastStartDate = e.startDate
  488. // 获取数据
  489. // 团队对比接待量
  490. this.receptionCountList(this.eharTab.active1, 1, '/cusLvStatistics/teamAnalysisReception')
  491. // 团队对比接待时长
  492. this.receptionCountList(this.eharTab.active2, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  493. /* 销奖执行率 */
  494. this.receptionCountList(this.eharTab.active3, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  495. // 获取销奖能力
  496. this.getPowerList()
  497. },
  498. //指标执行率分析tab
  499. tapspagek2(index) {
  500. this.bocindex = index;
  501. },
  502. //集团对比
  503. Groupcontrast() {
  504. uni.navigateTo({
  505. url: '/pages/center/Piabodata/Groupcontrast'
  506. });
  507. },
  508. // 去选择团队
  509. goTeam() {
  510. uni.navigateTo({
  511. url: `/pages/center/Piabodata/selectTeam?ids=${this.deptids}`
  512. })
  513. },
  514. staffSelectCallback(e) {
  515. if (this.choseStaffFlag) {
  516. // 第二个客户
  517. // console.log(e,'第二个')
  518. this.staff2 = e[0]
  519. } else {
  520. // 第一个客户
  521. // console.log(e,'第一个')
  522. // 当选择全部时
  523. if (!e.value) {
  524. this.timepickpickisshow = false
  525. this.staff2.label = '平均'
  526. this.staff2.value = ''
  527. }
  528. this.staff1 = e[0]
  529. }
  530. if (this.staff1.label == this.staff2.label) {
  531. uni.showToast({
  532. title: '请勿选择重复',
  533. icon: 'none'
  534. })
  535. this.staff2.label = '请选择'
  536. // this.staff2.label='平均'
  537. // this.staff2.value=''
  538. return
  539. } else {
  540. // 获取数据
  541. // 团队对比接待量
  542. this.receptionCountList(this.eharTab.active1, 1, '/cusLvStatistics/teamAnalysisReception')
  543. // 团队对比接待时长
  544. this.receptionCountList(this.eharTab.active2, 2, '/cusLvStatistics/teamAnalysisReceptionTime')
  545. /* 销奖执行率 */
  546. this.receptionCountList(this.eharTab.active3, 3, '/cusLvStatistics/teamAnalysisExecutionRate')
  547. // 获取销奖能力
  548. this.getPowerList()
  549. }
  550. },
  551. // 公共方法
  552. receptionCountList(idx, index, url) {
  553. this.$u.post(url, {
  554. deptIds: [this.staff1.value, this.staff2.value].filter(item => item).join(','),
  555. showRank: idx,
  556. houseId: this.houseId,
  557. timeType: this.lastEndDate ? null : this.activeTotal + '',
  558. lastEndDate: this.lastEndDate,
  559. lastStartDate: this.lastStartDate
  560. })
  561. .then(res => {
  562. console.log('我再此')
  563. let result = res.result
  564. this['newTeam' + index] = res.avg[0]
  565. this['newAvg' + index] = res.avg[1]
  566. if (idx == 0) {
  567. console.log(idx, index, url, '打卡记录撒橘红颗粒大健康1 ')
  568. // 当选择的是牌名时
  569. // 处理数据
  570. // 先处理牌名数据,需要进行判断全部还是单个
  571. // 当为全部时
  572. this['newlisttabinfo' + index] = []
  573. let arr = []
  574. // 当选择全部时
  575. if (!this.staff1.value && !this.staff2.value) {
  576. // console.log(1)
  577. result[0].map(item => {
  578. let obj = {}
  579. obj.name = item.deptName
  580. obj.zxl = item.data
  581. arr.push(obj)
  582. })
  583. arr = this.dealData(arr)
  584. this['newlisttabinfo' + index] = arr
  585. }
  586. // 当选择只有一个时
  587. else if (this.staff1.value && !this.staff2.value) {
  588. // console.log(2)
  589. result[0].map(item => {
  590. let obj = {}
  591. obj.name = item.deptName
  592. obj.zxl = item.data
  593. arr.push(obj)
  594. })
  595. // 判断是否显示平均
  596. // 如果显示对比
  597. if (this.timepickpickisshow) {
  598. result[1].map(item => {
  599. let obj = {}
  600. obj.name = '平均'
  601. obj.zxl = item.data
  602. arr.push(obj)
  603. })
  604. }
  605. arr = this.dealData(arr)
  606. this['newlisttabinfo' + index] = arr
  607. } else {
  608. console.log(3, '啥大上课了就可领取诶去玩害偶尔UI哦请勿诶哦')
  609. // 当两个都选择的时候
  610. result[0].map(item => {
  611. let obj = {}
  612. obj.name = item.deptName
  613. obj.zxl = item.data
  614. arr.push(obj)
  615. })
  616. result[1].map(item => {
  617. let obj = {}
  618. obj.name = item.deptName
  619. obj.zxl = item.data
  620. arr.push(obj)
  621. })
  622. arr = this.dealData(arr)
  623. this['newlisttabinfo' + index] = arr
  624. }
  625. } else {
  626. console.log(idx, index, url, '1231231231289123132UI哦23UI哦23UI哦1 ')
  627. // 当选择趋势时
  628. this['lineOptsect' + index] = {}
  629. let allobj = {
  630. categories: [],
  631. series: []
  632. }
  633. // 先处理时间
  634. // 当选择全部时
  635. if (!this.staff1.value && !this.staff2.value) {
  636. result.map((item, idx) => {
  637. let obj = {}
  638. obj.name = item[0].deptName
  639. obj.data = []
  640. item.map(item1 => {
  641. // 时间的处理
  642. if (idx == 0) {
  643. allobj.categories.push(item1.statDate.slice(5, 10))
  644. }
  645. obj.data.push(item1.data)
  646. })
  647. allobj.series.push(obj)
  648. })
  649. }
  650. // 当选择只有一个时
  651. else if (this.staff1.value && !this.staff2.value) {
  652. // console.log(2)
  653. let obj = {}
  654. obj.data = []
  655. obj.name = result[0][0].deptName
  656. result[0].map(item => {
  657. allobj.categories.push(item.statDate.slice(5, 10))
  658. obj.data.push(item.data)
  659. })
  660. allobj.series.push(obj)
  661. // 判断是否显示平均
  662. // 如果显示对比
  663. if (this.timepickpickisshow) {
  664. let obj = {}
  665. obj.data = []
  666. obj.name = '平均'
  667. result[1].map(item => {
  668. obj.data.push(item.data)
  669. })
  670. allobj.series.push(obj)
  671. }
  672. } else {
  673. // console.log(3)
  674. // 当两个都选择的时候
  675. let obj = {}
  676. let obj1 = {}
  677. obj.data = []
  678. obj1.data = []
  679. obj.name = result[0][0].deptName
  680. obj1.name = result[1][0].deptName
  681. result[0].map(item => {
  682. allobj.categories.push(item.statDate.slice(5, 10))
  683. obj.data.push(item.data)
  684. })
  685. result[1].map(item => {
  686. obj1.data.push(item.data)
  687. })
  688. allobj.series.push(obj)
  689. allobj.series.push(obj1)
  690. }
  691. // console.log(allobj)
  692. // return
  693. // this.lineOptsect1=allobj
  694. this['lineOptsect' + index] = allobj
  695. // this['lineOptsect'+index].series=allobj.series
  696. // this['lineOptsect'+index].categories=allobj.categories
  697. }
  698. this.$forceUpdate()
  699. })
  700. },
  701. // 获取销奖能力
  702. getPowerList() {
  703. this.$u.post('/cusLvStatistics/teamAnalysisMarketingAbility', {
  704. deptIds: this.deptids || [this.staff1.value, this.staff2.value].filter(item => item).join(','),
  705. houseId: this.houseId,
  706. timeType: this.lastEndDate ? null : this.activeTotal + '',
  707. lastEndDate: this.lastEndDate,
  708. lastStartDate: this.lastStartDate
  709. })
  710. .then(res => {
  711. // console.log(res)
  712. // 处理数据
  713. this.chartData1 = {
  714. categories: [],
  715. series: []
  716. }
  717. let allobj = {
  718. categories: [],
  719. series: []
  720. }
  721. // 当选择全部时
  722. if (!this.staff1.value && !this.staff2.value) {
  723. // let first=res.first
  724. res.first.map((item, index) => {
  725. let obj = {
  726. name: item[0].deptName,
  727. data: []
  728. }
  729. item.map((item1) => {
  730. if (index == 0) {
  731. allobj.categories.push(item1.name)
  732. }
  733. obj.data.push(item1.avgExecutionRate)
  734. })
  735. allobj.series.push(obj)
  736. })
  737. }
  738. // 当选择只有一个时
  739. else if (this.staff1.value && !this.staff2.value) {
  740. res.first.map((item, index) => {
  741. let obj = {
  742. name: item[0].deptName,
  743. data: []
  744. }
  745. item.map((item1) => {
  746. if (index == 0) {
  747. allobj.categories.push(item1.name)
  748. }
  749. obj.data.push(item1.avgExecutionRate)
  750. })
  751. allobj.series.push(obj)
  752. })
  753. // 判断是否显示平均
  754. // 如果显示对比
  755. if (this.timepickpickisshow) {
  756. res.second.map((item, index) => {
  757. let obj = {
  758. name: '平均',
  759. data: []
  760. }
  761. item.map((item1) => {
  762. obj.data.push(item1.avgExecutionRate)
  763. })
  764. allobj.series.push(obj)
  765. })
  766. }
  767. } else {
  768. // console.log(3)
  769. // 当两个都选择的时候
  770. res.first.map((item, index) => {
  771. let obj = {
  772. name: item[0].deptName,
  773. data: []
  774. }
  775. item.map((item1) => {
  776. if (index == 0) {
  777. allobj.categories.push(item1.name)
  778. }
  779. obj.data.push(item1.avgExecutionRate)
  780. })
  781. allobj.series.push(obj)
  782. })
  783. }
  784. // console.log(allobj)
  785. this.chartData1 = allobj
  786. this.$forceUpdate()
  787. })
  788. },
  789. // 定义一个公共方法对数据进行处理
  790. dealData(arr) {
  791. // 获取最大值
  792. let num = Math.max.apply(Math, arr.map(function(o) {
  793. return o.zxl
  794. })) //结果:3
  795. // console.log(num)
  796. if (num > 100) {
  797. // 获取最大值的下标
  798. // let idx=arr.findIndex(item=>item.zxl==num)
  799. // console.log(idx,123)
  800. arr.map(item => {
  801. item.zxl1 = Math.floor(item.zxl / num * 100)
  802. })
  803. // console.log(arr)
  804. return arr
  805. } else {
  806. arr.map(item => {
  807. item.zxl1 = item.zxl
  808. })
  809. return arr
  810. }
  811. },
  812. }
  813. };
  814. </script>
  815. <style lang="scss" scoped>
  816. .boxtittab {
  817. position: sticky;
  818. top: var(--window-top);
  819. z-index: 999;
  820. }
  821. .box {
  822. width: 100%;
  823. height: 100%;
  824. background: #FAFAFA;
  825. padding-bottom: 60rpx;
  826. }
  827. // 对比时间切换
  828. .timepick {
  829. width: 100%;
  830. height: 90rpx;
  831. display: flex;
  832. align-items: center;
  833. background: #FAFAFA;
  834. }
  835. .timepicktime {
  836. width: 260rpx;
  837. height: 50rpx;
  838. border: 1rpx solid #E0E0E0;
  839. margin-left: 30rpx;
  840. display: flex;
  841. background: #FFFFFF;
  842. }
  843. .timepicktime>view:nth-of-type(1) {
  844. width: 210rpx;
  845. height: 100%;
  846. line-height: 50rpx;
  847. font-size: 26rpx;
  848. font-weight: 400;
  849. text-align: center;
  850. }
  851. .timepicktime>view:nth-of-type(2) {
  852. width: 49rpx;
  853. height: 100%;
  854. // border-left: 1px solid #E0E0E0;
  855. }
  856. .timepickpick {
  857. width: 110rpx;
  858. height: 50rpx;
  859. margin-left: 30rpx;
  860. display: flex;
  861. align-items: center;
  862. }
  863. .Underimg {
  864. width: 50rpx;
  865. height: 50rpx;
  866. margin-top: -2rpx;
  867. }
  868. </style>