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.
 
 
 
 

876 lines
25 KiB

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