AI销管
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

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