AI销管
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

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