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.
 
 
 

1359 line
33 KiB

  1. <template>
  2. <view class="pages">
  3. <!-- 日报内容部分 -->
  4. <view class="container">
  5. <!-- 头部日报卡 -->
  6. <view class="c-head-card">
  7. <view class="c-title-text">
  8. {{ projectName || '' }}数智工牌周报
  9. </view>
  10. <text class="date">{{ weekObj.createTimeName }}</text>
  11. <view class="creative-time">
  12. 生成时间:{{ weekObj.createTime || '--' }}
  13. </view>
  14. </view>
  15. </view>
  16. <view class="nodata-box" v-if="nodata">
  17. <image class="img" src="/static/images/nodata.png" mode="" />
  18. <view class="text">此项目本周还没有接待量哦~</view>
  19. </view>
  20. <view v-if="!nodata">
  21. <!-- 简报 -->
  22. <view class="briefing">
  23. <view class="briefing-title">
  24. 简报
  25. </view>
  26. <!-- 简报表格部分 -->
  27. <view class="briefing-box">
  28. <block v-for="(data, index) in numlist" :key="index">
  29. <view class="briefing-box-item">
  30. <view class="tops" :class="[data.class || '']">
  31. {{ data.name }}
  32. </view>
  33. <view class="middle" :class="[data.class || '']">
  34. {{ data.num || 0 }}
  35. </view>
  36. <view class="bottom">
  37. 对比上周: {{ data.preNum || 0 }}
  38. <text class="b-text"
  39. :class="{up: data.percent > 0, down: data.percent < 0}">{{ data.percent || '0' }}</text>
  40. <template v-if="data.percent != 0">
  41. <text style="margin-left: 8rpx;font-size: 34rpx;font-weight: bold;"
  42. :class="{up: data.percent > 0, down: data.percent < 0}">{{ data.percent > 0 ? '↑' : '↓' }}</text>
  43. </template>
  44. </view>
  45. </view>
  46. </block>
  47. </view>
  48. </view>
  49. <!-- 销讲场景执行排名 -->
  50. <view class="execution-ranking" v-if="!weekObj.orgCode">
  51. <view class="execution-ranking-title">
  52. 销讲场景执行排名
  53. </view>
  54. <template v-if="isShowXJTop1List">
  55. <view class="execution-ranking-desc" v-if="false">
  56. <text>销讲场景平均执行对比上周</text>
  57. <text>{{ rankTop('fractionPKName') }}</text>
  58. <text>{{ rankTop('fractionPK') }}</text>
  59. <text>%</text>
  60. <template v-if="rankTop('fractionBastValue') > 0">
  61. <text>,其中【{{ rankTop('fractionBastName') }}】最强为</text>
  62. <text class="up">{{ rankTop('fractionBastValue') }}</text>
  63. <text>%</text>
  64. </template>
  65. <template v-if="rankTop('fractionLastValue') < 0">
  66. <text>,【{{ rankTop('fractionLastName') }}】执行最弱为</text>
  67. <text class="down">{{ rankTop('fractionLastValue') }}</text>
  68. <text>%;</text>
  69. </template>
  70. </view>
  71. <!-- 排名百分比列表 -->
  72. <view class="ranking-box" @click="toTrendAnalysis('销讲数据')">
  73. <block v-for="(percent, index) in weekObj.XJTop1List" :key="index">
  74. <view class="ranking-item">
  75. <view class="left">{{ percent.title }}</view>
  76. <view class="middle">
  77. <u-line-progress :active-color="$options.filters.setColor(index)"
  78. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.value">
  79. </u-line-progress>
  80. </view>
  81. <view class="right"> {{ percent.value || '0' }} %</view>
  82. </view>
  83. </block>
  84. </view>
  85. </template>
  86. <template v-else>
  87. <view class="empity">
  88. 暂无数据
  89. </view>
  90. </template>
  91. </view>
  92. <!-- 接待统计 -->
  93. <view class="statistics">
  94. <view class="statistics-title">
  95. 接待统计
  96. </view>
  97. <template v-if="isShowStatistics">
  98. <view class="statistics-desc" v-if="false">
  99. <text>
  100. 顾问平均执行率对比上周
  101. </text>
  102. <text>
  103. {{ rankTop('ranktype') || '' }}
  104. </text>
  105. <text :class="[rankTop('class')]">{{ rankTop('people') || '' }}</text>
  106. <text class="">
  107. 人,其中{{ rankTop('topName') || '' }}上升
  108. </text>
  109. <text class="up">{{ rankTop('topPk') || '0' }}</text>
  110. <text class="">
  111. %为最高,{{ rankTop('lastName') || '' }}下降
  112. </text>
  113. <text class="down">{{ rankTop('lastPk') || '0' }}</text>
  114. <text class="">
  115. %降幅最大。
  116. </text>
  117. </view>
  118. <view class="table">
  119. <view class="thead">
  120. <block v-for="(head, headIndex) in tableHead" :key="headIndex">
  121. <view class="thead-item"
  122. :style="[(weekObj.orgCode && head.title2) ? head.style1 : head.style]">
  123. <template v-if="weekObj.orgCode && head.title2">
  124. {{ head.title2 }}
  125. </template>
  126. <template v-else>
  127. {{ head.title }}
  128. </template>
  129. </view>
  130. </block>
  131. </view>
  132. <view class="tbody" @click="toEmployeesstatistics('顾问排名')">
  133. <block v-for="(data, index) in weekObj.customerInfo1" :key="index">
  134. <view class="tbody-item">
  135. <template v-if="!weekObj.orgCode">
  136. <view class="tbody-items name">{{ data.name }}</view>
  137. </template>
  138. <template v-else>
  139. <view class="tbody-items time">{{ data.houseName }}</view>
  140. </template>
  141. <view class="tbody-items nums">{{ data.activeCustomer }}</view>
  142. <template v-if="!weekObj.orgCode">
  143. <view class="tbody-items time">{{ tofixed2(data.avgDuration)}}m</view>
  144. </template>
  145. <template v-else>
  146. <view class="tbody-items time">{{ tofixed2(data.avgDuration/60) }}m</view>
  147. </template>
  148. <view class="tbody-items percent">{{ data.fraction }}%</view>
  149. <template v-if="!weekObj.orgCode">
  150. <view class="tbody-items week" :class="{up: data.pk > 0, down: data.pk < 0}">
  151. <template v-if="data.pk">
  152. {{ data.pk > 0 ? `+${data.pk}` : data.pk }}%
  153. </template>
  154. </view>
  155. </template>
  156. <template v-else>
  157. <view class="tbody-items week"
  158. :class="{up: data.fractionContrast > 0, down: data.fractionContrast < 0}">
  159. <template v-if="data.fractionContrast">
  160. {{ data.fractionContrast > 0 ? `+${data.fractionContrast}` : data.fractionContrast }}%
  161. </template>
  162. <template v-else>--</template>
  163. </view>
  164. </template>
  165. </view>
  166. </block>
  167. </view>
  168. </view>
  169. </template>
  170. <template v-else>
  171. <view class="empity">
  172. 暂无数据
  173. </view>
  174. </template>
  175. </view>
  176. <!-- 顾问销讲执行率排名 -->
  177. <view class="guwen-ranking">
  178. <view class="guwen-ranking-title">
  179. <template v-if="!weekObj.orgCode">
  180. 顾问销讲执行率排名(TOP10)
  181. </template>
  182. <template v-else>
  183. 项目统计排名(TOP10)
  184. </template>
  185. </view>
  186. <template v-if="isShowZXLTopList">
  187. <!-- 排名百分比列表 -->
  188. <view class="ranking-box">
  189. <block v-for="(percent, index) in weekObj.ZXLTopList" :key="index">
  190. <view class="ranking-item" @click="toStaffAnalysis('销讲数据', percent)">
  191. <view class="left">{{ percent.title }}</view>
  192. <view class="middle">
  193. <u-line-progress :active-color="$options.filters.setColor(index)"
  194. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.value">
  195. </u-line-progress>
  196. </view>
  197. <view class="right"> {{ percent.value || '0' }}%</view>
  198. </view>
  199. </block>
  200. </view>
  201. </template>
  202. <template v-else>
  203. <view class="empity">
  204. 暂无数据
  205. </view>
  206. </template>
  207. </view>
  208. <!-- 顾问接待量排名 -->
  209. <view class="guwen-ranking">
  210. <view class="guwen-ranking-title">
  211. <template v-if="!weekObj.orgCode">
  212. 顾问接待量排名(TOP10)
  213. </template>
  214. <template v-else>
  215. 项目有效接待排名(TOP10)
  216. </template>
  217. </view>
  218. <template v-if="isShowJDLTopList">
  219. <!-- 排名百分比列表 -->
  220. <view class="ranking-box">
  221. <block v-for="(percent, index) in weekObj.JDLTopList" :key="index">
  222. <view class="ranking-item" @click="toStaffAnalysis('销讲数据', percent)">
  223. <view class="left">{{ percent.title }}</view>
  224. <view class="middle">
  225. <u-line-progress :active-color="$options.filters.setColor(index)"
  226. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.values">
  227. </u-line-progress>
  228. </view>
  229. <view class="right"> {{ percent.value || '0' }} </view>
  230. </view>
  231. </block>
  232. </view>
  233. </template>
  234. <template v-else>
  235. <view class="empity">
  236. 暂无数据
  237. </view>
  238. </template>
  239. </view>
  240. <!-- 顾问接待量排名 -->
  241. <view class="guwen-ranking" v-if="weekObj.level1List">
  242. <view class="guwen-ranking-title">
  243. 画像一级触达排名(TOP10)
  244. </view>
  245. <template v-if="weekObj.level1List">
  246. <!-- 排名百分比列表 -->
  247. <view class="ranking-box">
  248. <block v-for="(percent, index) in weekObj.level1List" :key="index">
  249. <view class="ranking-item">
  250. <view class="left">{{ percent.name }}</view>
  251. <view class="middle">
  252. <u-line-progress :active-color="$options.filters.setColor(index)"
  253. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.percent">
  254. </u-line-progress>
  255. </view>
  256. <view class="right"> {{ percent.total || '0' }} </view>
  257. </view>
  258. </block>
  259. </view>
  260. </template>
  261. <template v-else>
  262. <view class="empity">
  263. 暂无数据
  264. </view>
  265. </template>
  266. </view>
  267. <view class="guwen-ranking" v-if="weekObj.level2List">
  268. <view class="guwen-ranking-title">
  269. 画像关键词触达排名(TOP10)
  270. </view>
  271. <template v-if="weekObj.level2List">
  272. <!-- 排名百分比列表 -->
  273. <view class="ranking-box">
  274. <block v-for="(percent, index) in weekObj.level2List" :key="index">
  275. <view class="ranking-item">
  276. <view class="left">{{ percent.name }}</view>
  277. <view class="middle">
  278. <u-line-progress :active-color="$options.filters.setColor(index)"
  279. inactive-color="#F2F2F2" :show-percent="false" :percent="percent.percent">
  280. </u-line-progress>
  281. </view>
  282. <view class="right"> {{ percent.total || '0' }} </view>
  283. </view>
  284. </block>
  285. </view>
  286. </template>
  287. <template v-else>
  288. <view class="empity">
  289. 暂无数据
  290. </view>
  291. </template>
  292. </view>
  293. <!-- 使用建议 -->
  294. <view class="proposal" v-if="weekObj.suggest">
  295. <view class="proposal-title">
  296. 使用建议
  297. </view>
  298. <!-- 建议的文字 -->
  299. <view class="proposal-box">
  300. <u-parse class="ql-editor" :content="weekObj.suggest" />
  301. </view>
  302. </view>
  303. <!-- 底部按钮 -->
  304. <view class="nav-footer">
  305. <view class="footer-item" @click="toHome">
  306. 回到管理端
  307. </view>
  308. <view class="footer-item full" style="margin-left: 24rpx;" @tap="forShare">
  309. <button open-type="share" class="fulls">
  310. 一键转发
  311. </button>
  312. </view>
  313. </view>
  314. </view>
  315. </view>
  316. </template>
  317. <script>
  318. import uParse from '@/components/gaoyia-parse/parse.vue'
  319. export default {
  320. components: {
  321. uParse
  322. },
  323. data() {
  324. return {
  325. nodata: false,
  326. tableHead: [{
  327. title: '顾问',
  328. title2: '项目名称',
  329. style: {
  330. flex: 1
  331. },
  332. style1: {
  333. flex: 2
  334. },
  335. },
  336. {
  337. title: '接待量',
  338. style: {
  339. flex: 1
  340. }
  341. },
  342. {
  343. title: '平均接待时长',
  344. style: {
  345. flex: 2
  346. }
  347. },
  348. {
  349. title: '平均执行率',
  350. style: {
  351. flex: 2
  352. }
  353. },
  354. {
  355. title: '对比上周',
  356. style: {
  357. flex: 1.5
  358. }
  359. },
  360. ],
  361. id: '', // id
  362. needList: ['JDLTop', 'ZXLTop', 'XJTop1'], // 需要转换数组的内容
  363. // 简报
  364. numlist: [{
  365. name: '接待量 (次)',
  366. num: '',
  367. setName: 'receptionCount1',
  368. percent: '',
  369. percentName: 'receptionCountPK',
  370. preNum: '', // 上周数量
  371. preNumName: 'receptionCount2', //
  372. path: '/pages/center/records/index',
  373. pathParms: '?activeTotal=4&refresh=refresh', // 参数
  374. auth: '接待记录', //
  375. }, {
  376. name: '有效接待 (次)',
  377. num: '',
  378. setName: 'activeCustomer1',
  379. percent: '',
  380. percentName: 'activeCustomerPK',
  381. preNum: '', // 上周数量
  382. preNumName: 'activeCustomer2', //
  383. path: '/pages/center/records/index',
  384. pathParms: '?activeTotal=4&refresh=refresh&validInvalid=0', // 参数
  385. auth: '接待记录', //
  386. },
  387. {
  388. name: '平均执行率(%)',
  389. num: '',
  390. setName: 'fraction1',
  391. percent: '',
  392. percentName: 'fractionPK',
  393. preNum: '', // 上周数量
  394. preNumName: 'fraction2', //
  395. path: '/pages/center/records/index',
  396. pathParms: '?activeTotal=4&refresh=refresh&validInvalid=0', // 参数
  397. auth: '接待记录', //
  398. },
  399. {
  400. name: '平均接待时长(分)',
  401. num: '',
  402. setName: 'avgDuration1',
  403. percent: '',
  404. percentName: 'avgDurationPK',
  405. preNum: '', // 上周数量
  406. preNumName: 'avgDuration2', //
  407. path: '/pages/center/records/index',
  408. pathParms: '?activeTotal=4&refresh=refresh&validInvalid=0', // 参数
  409. auth: '接待记录', //
  410. },
  411. {
  412. name: '违禁接待 (次)',
  413. num: '',
  414. setName: 'prohibitedNum1',
  415. percent: '',
  416. percentName: 'prohibitedNumPK',
  417. preNum: '', // 上周数量
  418. preNumName: 'prohibitedNum2', //
  419. class: 'down',
  420. path: '/pages/center/prohibited/index',
  421. pathParms: '?activeTotal=4&violatedStatus=1&refresh=refresh', // 参数
  422. auth: '违禁记录',
  423. },
  424. {
  425. name: '客户画像触达 (次)',
  426. num: '',
  427. setName: 'reachSum1',
  428. percent: '',
  429. percentName: 'reachSumPK',
  430. preNum: '', // 上周数量
  431. preNumName: 'reachSum2', //
  432. path: '/pages/center/Piabodata/Userinsightinto',
  433. pathParms: '?activeTotal=3', // 参数
  434. auth: '销讲数据',
  435. },
  436. {
  437. name: '已标记',
  438. num: '',
  439. setName: 'labelledReceptionNum1',
  440. percent: '',
  441. percentName: 'labelledReceptionNumPK',
  442. preNum: '', // 上周数量
  443. preNumName: 'labelledReceptionNum2', //
  444. path: '/pages/center/records/index',
  445. pathParms: '?activeTotal=4&refresh=refresh&markAdvisor=1', // 参数
  446. auth: '接待记录', //
  447. },
  448. {
  449. name: '未标记',
  450. num: '',
  451. setName: 'unlabelledReceptionNum1',
  452. percent: '',
  453. percentName: 'unlabelledReceptionNumPK',
  454. preNum: '', // 上周数量
  455. preNumName: 'unlabelledReceptionNum2', //
  456. class: 'down',
  457. path: '/pages/center/records/index',
  458. pathParms: '?activeTotal=4&refresh=refresh&markAdvisor=0', // 参数
  459. auth: '接待记录', //
  460. },
  461. ],
  462. // 周报详情
  463. weekObj: {},
  464. projectName: '', // 项目名称
  465. }
  466. },
  467. computed: {
  468. // 获取本地存储的权限列表
  469. menuList() {
  470. return uni.getStorageSync('weapp_session_Menu_data')
  471. },
  472. // 排名最高与最低
  473. rankTop() {
  474. return name => {
  475. let obj = {}
  476. try {
  477. if (this.weekObj.customerInfo1.length && this.weekObj.customerInfo2.length) {
  478. obj.ranktype = (this.weekObj.customerInfo1.length - this.weekObj.customerInfo2.length) >
  479. 0 ? '上升' : '下降'
  480. obj.people = Math.abs(this.weekObj.customerInfo1.length - this.weekObj.customerInfo2
  481. .length)
  482. }
  483. if (this.weekObj.customerInfo1 && this.weekObj.customerInfo1.length > 0) {
  484. obj.topName = this.weekObj.customerInfo1[0].name
  485. obj.topPk = Math.abs(this.weekObj.customerInfo1[0].pk)
  486. obj.lastName = this.weekObj.customerInfo1[this.weekObj.customerInfo1.length - 1].name,
  487. obj.lastPk = Math.abs(this.weekObj.customerInfo1[this.weekObj.customerInfo1.length - 1]
  488. .pk)
  489. }
  490. if (this.weekObj.customerInfo1.length && this.weekObj.customerInfo2.length) {
  491. obj.class = (this.weekObj.customerInfo1.length - this.weekObj.customerInfo2.length) > 0 ?
  492. 'up' : 'down'
  493. }
  494. if (this.weekObj.fractionPK) {
  495. obj.fractionPKName = this.weekObj.fractionPK > 0 ? '上涨' : '下跌'
  496. obj.fractionPK = Math.abs(this.weekObj.fractionPK)
  497. }
  498. if (this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0) {
  499. obj.fractionBastName = this.weekObj.XJTop1List[0].title
  500. obj.fractionBastValue = this.weekObj.XJTop1List[0].value
  501. }
  502. if (this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0) {
  503. obj.fractionLastName = this.weekObj.XJTop1List[this.weekObj.XJTop1List.length - 1].title
  504. obj.fractionLastValue = this.weekObj.XJTop1List[this.weekObj.XJTop1List.length - 1].value
  505. }
  506. return obj[name] || ''
  507. } catch (e) {
  508. console.log(e)
  509. return ''
  510. }
  511. }
  512. },
  513. // 接待统计
  514. isShowStatistics() {
  515. // return this.rankTop('ranktype') && this.rankTop('class') && this.rankTop('people') && this.rankTop('topName') && this.rankTop('topPk') && this.rankTop('lastName') && this.rankTop('lastPk') && this.weekObj.customerInfo1 && this.weekObj.customerInfo1.length > 0
  516. return this.weekObj.customerInfo1 && this.weekObj.customerInfo1.length > 0
  517. },
  518. isShowXJTop1List() {
  519. // return this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0 && this.rankTop('fractionPKName') && this.rankTop('fractionPK') && this.rankTop('fractionBastName') && this.rankTop('fractionBastValue') && this.rankTop('fractionLastName') && this.rankTop('fractionLastName') && this.rankTop('fractionLastValue')
  520. return this.weekObj.XJTop1List && this.weekObj.XJTop1List.length > 0
  521. },
  522. isShowZXLTopList() {
  523. return this.weekObj.ZXLTopList && this.weekObj.ZXLTopList.length > 0
  524. },
  525. isShowJDLTopList() {
  526. return this.weekObj.JDLTopList && this.weekObj.JDLTopList.length > 0
  527. },
  528. },
  529. onLoad(option) {
  530. if (option.id) this.id = option.id
  531. this.getMessage()
  532. },
  533. onShareAppMessage() {
  534. return {
  535. title: `${this.projectName}数智工牌周报`,
  536. path: `/pages/reportExcel/weekReport?id=${this.id}`
  537. }
  538. },
  539. methods: {
  540. tofixed2(time){
  541. if(time){
  542. return time.toFixed(2)
  543. }else{
  544. return 0
  545. }
  546. },
  547. forShare() {
  548. this.$u.get("/zkMessage/shareMessage", {
  549. id: this.id,
  550. houseId: uni.getStorageSync('buildingID').id
  551. })
  552. },
  553. // 趋势分析
  554. toTrendAnalysis(name) {
  555. return
  556. let date = this.weekObj.weekDate.split('~')
  557. let [t1, t2] = [date[0], date[1]]
  558. let time1 = new Date(t1.replace(/-/g, '/'))
  559. let time2 = new Date(t2.replace(/-/g, '/'))
  560. time1.setDate(time1.getDate() - 7)
  561. time2.setDate(time2.getDate() - 7)
  562. let res1 = `${time1.getFullYear()}-${time1.getMonth() + 1}-${time1.getDate()}`
  563. let res2 = `${time2.getFullYear()}-${time2.getMonth() + 1}-${time2.getDate()}`
  564. if (this.isPassWatch(name)) {
  565. uni.navigateTo({
  566. url: `/pages/center/Piabodata/TrendAnalysis?type=1&staTime=${date[0]}&endtime=${date[1]}&staTime1=${res1}&endtime1=${res2}`
  567. })
  568. } else {
  569. uni.showToast({
  570. title: '暂无权限',
  571. icon: "none"
  572. })
  573. }
  574. },
  575. // 顾问排名
  576. toEmployeesstatistics(name) {
  577. let date = this.weekObj.weekDate.split('~')
  578. let [t1, t2] = [date[0], date[1]]
  579. if (this.isPassWatch(name)) {
  580. uni.navigateTo({
  581. url: `/pages/center/Piabodata/Employeesstatistics?type=1&staTime=${date[0]}&endtime=${date[1]}`
  582. })
  583. } else {
  584. uni.showToast({
  585. title: '暂无权限',
  586. icon: "none"
  587. })
  588. }
  589. },
  590. // 员工分析
  591. toStaffAnalysis(name, data) {
  592. let obj = this.weekObj.customerInfo1.find(item => {
  593. return item.name == data.title
  594. })
  595. console.log(obj)
  596. let time = this.weekObj.weekDate.split('~')
  597. if (this.isPassWatch(name)) {
  598. uni.navigateTo({
  599. url: `/pages/center/Piabodata/StaffAnalysis?type=1&id=${obj.id}&startDate=${time[0]}&endDate=${time[1]}`
  600. });
  601. } else {
  602. uni.showToast({
  603. title: '暂无权限',
  604. icon: "none"
  605. })
  606. }
  607. },
  608. // 跳转对应页面
  609. toAuthPage(data) {
  610. if (!uni.getStorageSync('weapp_session_login_data').token) {
  611. this.toHome()
  612. return
  613. }
  614. if (this.isPassWatch(data.auth)) {
  615. let time = this.weekObj.weekDate.split('~')
  616. data.pathParms = `${data.pathParms}&staTime=${time[0]}&endtime=${time[1]}`
  617. uni.navigateTo({
  618. url: `${data.path}${data.pathParms}`
  619. })
  620. } else {
  621. uni.showToast({
  622. title: '暂无权限',
  623. icon: "none"
  624. })
  625. }
  626. },
  627. // 是否有权限观看
  628. isPassWatch(name) {
  629. return this.menuList.findIndex(item => {
  630. return item.name == name
  631. }) == -1 ? false : true
  632. },
  633. // 跳转首页
  634. toHome() {
  635. uni.navigateTo({
  636. url: '/pages/index/guide'
  637. })
  638. },
  639. // 获取周报详情
  640. getMessage() {
  641. this.$u.get('/zkMessage/findByProjectId', {
  642. id: this.id,
  643. houseId: uni.getStorageSync('buildingID').id
  644. }).then(res => {
  645. // console.log(res)
  646. let data = {}
  647. if (res.zkMessage.content) {
  648. data = JSON.parse(res.zkMessage.content)
  649. this.bubbleSort(data.customerInfo1 || [], 'pk')
  650. this.bubbleSort(data.customerInfo2 || [], 'pk')
  651. data.customerInfo1 && data.customerInfo1.reverse()
  652. data.customerInfo2 && data.customerInfo2.reverse()
  653. this.weekObj = {
  654. ...res.zkMessage,
  655. ...data
  656. }
  657. } else {
  658. this.nodata = true
  659. this.weekObj = {
  660. ...res.zkMessage,
  661. }
  662. }
  663. if (this.weekObj.level1List && this.weekObj.level2List) {
  664. if (this.weekObj.level1List[0] && this.weekObj.level1List[0].total) {
  665. let max1 = this.weekObj.level1List[0].total || 1
  666. this.weekObj.level1List.forEach(item => {
  667. item.percent = Math.floor((item.total / max1) * 100)
  668. })
  669. } else {
  670. this.weekObj.level1List.forEach(item => {
  671. item.percent = 0
  672. })
  673. }
  674. if (this.weekObj.level2List[0] && this.weekObj.level2List[0].total) {
  675. let max2 = this.weekObj.level2List[0].total || 1
  676. this.weekObj.level2List.forEach(item => {
  677. item.percent = Math.floor((item.total / max2) * 100)
  678. })
  679. } else {
  680. this.weekObj.level2List.forEach(item => {
  681. item.percent = 0
  682. })
  683. }
  684. }
  685. this.weekObj.createTimeName = this.getTimeLines(this.weekObj.weekDate, 1)
  686. console.log(this.weekObj, 'this.weekObj')
  687. this.projectName = res.projectName
  688. this.numlist.forEach(item => {
  689. if (data[item.setName]) {
  690. item.num = data[item.setName]
  691. }
  692. if (data[item.percentName]) {
  693. item.percent = data[item.percentName]
  694. }
  695. if (data[item.preNumName]) {
  696. item.preNum = data[item.preNumName]
  697. }
  698. })
  699. this.init()
  700. }).catch(e => {
  701. console.log(e)
  702. })
  703. },
  704. // 把对象转成数组并在后续的步骤方便处理
  705. init() {
  706. console.log(this.weekObj, 'this.weekObj')
  707. this.needList.forEach(item => {
  708. console.log(item)
  709. if (this.weekObj[item] && Object.keys(this.weekObj[item]).length > 0) {
  710. this.weekObj[item + 'List'] = [] // 销讲执行
  711. for (let i in this.weekObj[item]) {
  712. this.weekObj[item + 'List'].push({
  713. title: i,
  714. value: this.weekObj[item][i]
  715. })
  716. }
  717. } else {
  718. this.weekObj[item + 'List'] = []
  719. }
  720. })
  721. this.sortInitArr()
  722. },
  723. // 排序对象转换后的数组
  724. sortInitArr() {
  725. this.needList.forEach(item => {
  726. if (this.weekObj[item + 'List']) {
  727. console.log(item)
  728. this.bubbleSort(this.weekObj[item + 'List'])
  729. this.weekObj[item + 'List'] = this.dealData(this.weekObj[item + 'List'])
  730. }
  731. })
  732. this.reverseList()
  733. },
  734. // 反转数组
  735. reverseList() {
  736. this.needList.forEach(item => {
  737. if (this.weekObj[item + 'List']) {
  738. this.weekObj[item + 'List'].reverse()
  739. }
  740. })
  741. console.log(this.weekObj, '12312312312')
  742. },
  743. // 冒泡排序
  744. bubbleSort(arr, keys = 'value') {
  745. console.log(arr, 'keys', keys)
  746. for (let i = 0; i < arr.length - 1; i += 1) {
  747. //通过 arr.length 次把第一位放到最后,完成排序
  748. //-i是因为最后的位置是会动态改变的,当完成一次后,最后一位会变成倒数第二位
  749. for (let j = 0; j < arr.length - 1 - i; j += 1) {
  750. if (arr[j][keys] > arr[j + 1][keys]) {
  751. const temp = arr[j];
  752. arr[j] = arr[j + 1];
  753. arr[j + 1] = temp;
  754. }
  755. }
  756. }
  757. },
  758. // 定义一个公共方法对数据进行处理
  759. dealData(arr) {
  760. // 获取最大值
  761. let num = Math.max.apply(Math, arr.map((o) => {
  762. return o.value
  763. }))
  764. arr.map(item => {
  765. item.values = Math.floor(item.value / num * 100)
  766. })
  767. return arr
  768. },
  769. // 转换时间
  770. getTimeLine(date, type = 1) {
  771. let resu = '--'
  772. if (!date) return resu
  773. let time = new Date(date.replace(/-/g, '/'))
  774. time.setDate(time.getDate() - 7)
  775. let arr = date.split(' ')
  776. let str = arr[0]
  777. let result = str.split('-')
  778. let m = (time.getMonth() + 1) < 10 ? `0${time.getMonth() + 1}` : (time.getMonth() + 1)
  779. let d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate()
  780. if (type == 1) {
  781. resu = `${m}.${d}-${result[1]}.${result[2]}`
  782. } else {
  783. resu = `${m}月${d}日~${result[1]}月${result[2]}日`
  784. }
  785. return resu
  786. },
  787. // 转换时间
  788. getTimeLines(date) {
  789. if (!date) return ''
  790. let arr = date.split('~')
  791. let str0 = arr[0].split('-')
  792. let str1 = arr[1].split('-')
  793. return `${str0[1]}月${str0[2]}日~${str1[1]}月${str1[2]}日`
  794. },
  795. },
  796. filters: {
  797. // 时间格式转换
  798. fomatDate(date) {
  799. if (!date) return '--'
  800. let arr = date.split(' ')
  801. let str = arr[0]
  802. let result = str.split('-')
  803. return `${result[1]}-${result[2]}`
  804. },
  805. // 转换时间
  806. getTimeLine(date, type = 1) {
  807. if (!date) return '--'
  808. console.log(date.replace(/-/g, '/'))
  809. let time = new Date(date.replace(/-/g, '/'))
  810. time.setDate(time.getDate() - 7)
  811. let arr = date.split(' ')
  812. let str = arr[0]
  813. let result = str.split('-')
  814. let m = (time.getMonth() + 1) < 10 ? `0${time.getMonth() + 1}` : (time.getMonth() + 1)
  815. let d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate()
  816. if (type == 1) {
  817. return `${m}.${d}-${result[1]}.${result[2]}`
  818. } else {
  819. return `${m}月${d}日~${result[1]}月${result[2]}日`
  820. }
  821. },
  822. // 设置颜色
  823. setColor(index) {
  824. let color = ''
  825. switch (index) {
  826. case 0:
  827. color = '#E7483C';
  828. break;
  829. case 1:
  830. color = '#FF8C13';
  831. break;
  832. case 2:
  833. color = '#FFCC00';
  834. break;
  835. default:
  836. color = '#4FC78F';
  837. break;
  838. }
  839. return color
  840. },
  841. }
  842. }
  843. </script>
  844. <style lang="scss" scoped>
  845. @import '@/static/css/quill/quill.core.css';
  846. @import '@/static/css/quill/quill.snow.css';
  847. @import '@/static/css/quill/quill.bubble.css';
  848. .pages {
  849. width: 100vw;
  850. min-height: 100vh;
  851. display: flex;
  852. flex-direction: column;
  853. background: #F8F8F8;
  854. .nav-header {
  855. flex-shrink: 0;
  856. }
  857. .container {
  858. padding: 30rpx 30rpx 40rpx;
  859. display: flex;
  860. flex-direction: column;
  861. background: #fff;
  862. .c-head-card {
  863. padding: 30rpx;
  864. width: 100%;
  865. min-height: 252rpx;
  866. border: 2rpx solid #000000;
  867. border-radius: 12rpx;
  868. box-shadow: 10rpx 10rpx #2671E2;
  869. display: flex;
  870. flex-direction: column;
  871. .c-title-text {
  872. // position: relative;
  873. flex-grow: 1;
  874. font-size: 48rpx;
  875. font-weight: bold;
  876. color: #303030;
  877. }
  878. .date {
  879. // position: absolute;
  880. // right: 0;
  881. // bottom: 6rpx;
  882. font-size: 30rpx;
  883. color: #303030;
  884. }
  885. .creative-time {
  886. margin: 20rpx 0 0 0;
  887. flex-shrink: 0;
  888. }
  889. }
  890. }
  891. .nodata-box {
  892. width: 750rpx;
  893. flex: 1;
  894. margin: 0 auto;
  895. display: flex;
  896. justify-content: center;
  897. align-items: center;
  898. flex-direction: column;
  899. background-color: #fff;
  900. .img {
  901. width: 400rpx;
  902. height: 400rpx;
  903. }
  904. .text {
  905. text-align: center;
  906. font-size: 28rpx;
  907. font-family: PingFangSC-Regular, PingFang SC;
  908. font-weight: 400;
  909. color: #666666;
  910. line-height: 40rpx;
  911. }
  912. }
  913. .briefing {
  914. background: #fff;
  915. .briefing-title {
  916. padding: 0 30rpx;
  917. height: 90rpx;
  918. display: flex;
  919. align-items: center;
  920. border: 1rpx solid #E0E0E0;
  921. font-size: 32rpx;
  922. font-weight: bold;
  923. }
  924. .briefing-box {
  925. width: 100%;
  926. display: flex;
  927. flex-wrap: wrap;
  928. .briefing-box-item {
  929. padding: 20rpx 30rpx;
  930. width: 50%;
  931. height: 186rpx;
  932. border: 1px solid #E0E0E0;
  933. border-left: none;
  934. border-top: none;
  935. &:nth-of-type(2n) {
  936. border-right: none;
  937. }
  938. .top {
  939. font-size: 28rpx;
  940. }
  941. .middle {
  942. margin: 14rpx 0 12rpx;
  943. font-size: 32rpx;
  944. font-weight: 600;
  945. color: #333333;
  946. }
  947. .bottom {
  948. font-size: 26rpx;
  949. color: #666666;
  950. .b-text {
  951. margin-left: 20rpx;
  952. &.down {
  953. color: #E7483C;
  954. font-size: 34rpx;
  955. }
  956. &.up {
  957. font-size: 34rpx;
  958. color: #43CD80;
  959. }
  960. }
  961. }
  962. }
  963. }
  964. }
  965. .execution-ranking {
  966. margin: 20rpx 0 0 0;
  967. padding: 30rpx;
  968. background: #fff;
  969. .execution-ranking-title {
  970. font-size: 32rpx;
  971. font-weight: bold;
  972. }
  973. .execution-ranking-desc {
  974. margin-top: 20rpx;
  975. font-size: 30rpx;
  976. }
  977. .ranking-box {
  978. margin: 30rpx 0 0 0;
  979. .ranking-item {
  980. margin-bottom: 18rpx;
  981. display: flex;
  982. &:nth-last-of-type(1) {
  983. margin-bottom: 0;
  984. }
  985. .left {
  986. flex-shrink: 0;
  987. width: 270rpx;
  988. font-size: 30rpx;
  989. overflow: hidden;
  990. text-overflow: ellipsis;
  991. white-space: nowrap;
  992. }
  993. .middle {
  994. flex-grow: 1;
  995. }
  996. .right {
  997. flex-shrink: 0;
  998. width: 118rpx;
  999. font-size: 30rpx;
  1000. text-align: center;
  1001. }
  1002. }
  1003. }
  1004. }
  1005. .statistics {
  1006. margin: 20rpx 0 0 0;
  1007. background: #fff;
  1008. .statistics-title {
  1009. padding: 30rpx 30rpx 0;
  1010. width: 100%;
  1011. font-size: 32rpx;
  1012. font-weight: bold;
  1013. }
  1014. .statistics-desc {
  1015. padding: 0 30rpx;
  1016. margin-top: 20rpx;
  1017. }
  1018. .table {
  1019. margin: 30rpx 0 0 0;
  1020. .thead {
  1021. padding: 0 30rpx;
  1022. width: 100%;
  1023. height: 72rpx;
  1024. display: flex;
  1025. align-items: center;
  1026. border: 1rpx solid #E0E0E0;
  1027. border-left: none;
  1028. border-right: none;
  1029. font-size: 26rpx;
  1030. .thead-item {
  1031. text-align: center;
  1032. }
  1033. }
  1034. .tbody {
  1035. .tbody-item {
  1036. padding: 0 30rpx;
  1037. display: flex;
  1038. align-items: center;
  1039. height: 72rpx;
  1040. background: #FAFCFF;
  1041. &:nth-of-type(2n) {
  1042. background: #FFFFFF;
  1043. }
  1044. .tbody-items {
  1045. flex: 1;
  1046. display: flex;
  1047. justify-content: center;
  1048. }
  1049. .name {
  1050. justify-content: flex-start;
  1051. overflow: hidden;
  1052. text-overflow: ellipsis;
  1053. white-space: nowrap;
  1054. }
  1055. .time {
  1056. flex: 2;
  1057. }
  1058. .percent {
  1059. flex: 2;
  1060. }
  1061. .week {
  1062. flex: 1.5;
  1063. }
  1064. }
  1065. }
  1066. .tbottom {
  1067. width: 100%;
  1068. height: 72rpx;
  1069. display: flex;
  1070. justify-content: center;
  1071. align-items: center;
  1072. font-size: 30rpx;
  1073. color: #2671E2;
  1074. background: #FAFCFF;
  1075. }
  1076. }
  1077. }
  1078. .guwen-ranking {
  1079. margin: 20rpx 0 0 0;
  1080. width: 100%;
  1081. padding: 30rpx;
  1082. background: #fff;
  1083. .guwen-ranking-title {
  1084. font-size: 32rpx;
  1085. font-weight: 500;
  1086. }
  1087. .guwen-ranking-desc {
  1088. margin-top: 20rpx;
  1089. font-size: 30rpx;
  1090. }
  1091. .ranking-box {
  1092. margin: 30rpx 0 0 0;
  1093. .ranking-item {
  1094. margin-bottom: 18rpx;
  1095. display: flex;
  1096. &:nth-last-of-type(1) {
  1097. margin-bottom: 0;
  1098. }
  1099. .left {
  1100. flex-shrink: 0;
  1101. width: 270rpx;
  1102. font-size: 30rpx;
  1103. overflow: hidden;
  1104. text-overflow: ellipsis;
  1105. white-space: nowrap;
  1106. }
  1107. .middle {
  1108. flex-grow: 1;
  1109. }
  1110. .right {
  1111. flex-shrink: 0;
  1112. width: 118rpx;
  1113. font-size: 30rpx;
  1114. text-align: center;
  1115. }
  1116. }
  1117. }
  1118. }
  1119. .proposal {
  1120. margin: 20rpx 0 0 0;
  1121. padding: 30rpx;
  1122. background: #fff;
  1123. .proposal-title {
  1124. font-size: 32rpx;
  1125. font-weight: 500;
  1126. }
  1127. .proposal-box {
  1128. margin: 30rpx 0 0 0;
  1129. .proposal-item {
  1130. margin: 20rpx 0 0 0;
  1131. display: flex;
  1132. .lside {
  1133. flex-shrink: 0;
  1134. margin: 0 12rpx 0 0;
  1135. width: 44rpx;
  1136. height: 44rpx;
  1137. border-radius: 50%;
  1138. background: #2671E2;
  1139. text-align: center;
  1140. line-height: 44rpx;
  1141. color: #fff;
  1142. }
  1143. .rside {
  1144. .rside-title {
  1145. font-size: 32rpx;
  1146. }
  1147. .rside-box {
  1148. margin: 16rpx 0 0 0;
  1149. }
  1150. }
  1151. }
  1152. }
  1153. }
  1154. .nav-footer {
  1155. position: sticky;
  1156. bottom: 0;
  1157. padding: 32rpx;
  1158. width: 100%;
  1159. display: flex;
  1160. justify-content: center;
  1161. background: #fff;
  1162. .footer-item {
  1163. flex: 1;
  1164. height: 88rpx;
  1165. display: flex;
  1166. justify-content: center;
  1167. align-items: center;
  1168. color: #2671E2;
  1169. border: 2rpx solid #2671E2;
  1170. border-radius: 8rpx;
  1171. overflow: hidden;
  1172. font-size: 32rpx;
  1173. &.full {
  1174. background: #2671E2;
  1175. color: #fff;
  1176. .fulls {
  1177. box-sizing: border-box;
  1178. width: 100%;
  1179. height: 100%;
  1180. background: transparent;
  1181. color: #fff;
  1182. font-size: 32rpx;
  1183. font-weight: normal;
  1184. line-height: 88rpx;
  1185. }
  1186. }
  1187. }
  1188. }
  1189. .up {
  1190. color: #43CD80 !important;
  1191. }
  1192. .down {
  1193. color: #E6273A !important;
  1194. }
  1195. .empity {
  1196. width: 100%;
  1197. height: 300rpx;
  1198. display: flex;
  1199. justify-content: center;
  1200. align-items: center;
  1201. font-size: 28rpx;
  1202. color: #666666;
  1203. }
  1204. }
  1205. </style>