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.
 
 
 
 

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