Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

1358 linhas
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[0] && this.weekObj.level1List[0].total) {
  664. let max1 = this.weekObj.level1List[0].total || 1
  665. this.weekObj.level1List.forEach(item => {
  666. item.percent = Math.floor((item.total / max1) * 100)
  667. })
  668. } else {
  669. this.weekObj.level1List.forEach(item => {
  670. item.percent = 0
  671. })
  672. }
  673. if (this.weekObj.level2List[0] && this.weekObj.level2List[0].total) {
  674. let max2 = this.weekObj.level2List[0].total || 1
  675. this.weekObj.level2List.forEach(item => {
  676. item.percent = Math.floor((item.total / max2) * 100)
  677. })
  678. } else {
  679. this.weekObj.level2List.forEach(item => {
  680. item.percent = 0
  681. })
  682. }
  683. this.weekObj.createTimeName = this.getTimeLines(this.weekObj.weekDate, 1)
  684. console.log(this.weekObj, 'this.weekObj')
  685. this.projectName = res.projectName
  686. this.numlist.forEach(item => {
  687. if (data[item.setName]) {
  688. item.num = data[item.setName]
  689. }
  690. if (data[item.percentName]) {
  691. item.percent = data[item.percentName]
  692. }
  693. if (data[item.preNumName]) {
  694. item.preNum = data[item.preNumName]
  695. }
  696. })
  697. this.init()
  698. }).catch(e => {
  699. console.log(e)
  700. })
  701. },
  702. // 把对象转成数组并在后续的步骤方便处理
  703. init() {
  704. console.log(this.weekObj, 'this.weekObj')
  705. this.needList.forEach(item => {
  706. console.log(item)
  707. if (this.weekObj[item] && Object.keys(this.weekObj[item]).length > 0) {
  708. this.weekObj[item + 'List'] = [] // 销讲执行
  709. for (let i in this.weekObj[item]) {
  710. this.weekObj[item + 'List'].push({
  711. title: i,
  712. value: this.weekObj[item][i]
  713. })
  714. }
  715. } else {
  716. this.weekObj[item + 'List'] = []
  717. }
  718. })
  719. this.sortInitArr()
  720. },
  721. // 排序对象转换后的数组
  722. sortInitArr() {
  723. this.needList.forEach(item => {
  724. if (this.weekObj[item + 'List']) {
  725. console.log(item)
  726. this.bubbleSort(this.weekObj[item + 'List'])
  727. this.weekObj[item + 'List'] = this.dealData(this.weekObj[item + 'List'])
  728. }
  729. })
  730. this.reverseList()
  731. },
  732. // 反转数组
  733. reverseList() {
  734. this.needList.forEach(item => {
  735. if (this.weekObj[item + 'List']) {
  736. this.weekObj[item + 'List'].reverse()
  737. }
  738. })
  739. console.log(this.weekObj, '12312312312')
  740. },
  741. // 冒泡排序
  742. bubbleSort(arr, keys = 'value') {
  743. console.log(arr, 'keys', keys)
  744. for (let i = 0; i < arr.length - 1; i += 1) {
  745. //通过 arr.length 次把第一位放到最后,完成排序
  746. //-i是因为最后的位置是会动态改变的,当完成一次后,最后一位会变成倒数第二位
  747. for (let j = 0; j < arr.length - 1 - i; j += 1) {
  748. if (arr[j][keys] > arr[j + 1][keys]) {
  749. const temp = arr[j];
  750. arr[j] = arr[j + 1];
  751. arr[j + 1] = temp;
  752. }
  753. }
  754. }
  755. },
  756. // 定义一个公共方法对数据进行处理
  757. dealData(arr) {
  758. // 获取最大值
  759. let num = Math.max.apply(Math, arr.map((o) => {
  760. return o.value
  761. }))
  762. arr.map(item => {
  763. item.values = Math.floor(item.value / num * 100)
  764. })
  765. return arr
  766. },
  767. // 转换时间
  768. getTimeLine(date, type = 1) {
  769. let resu = '--'
  770. if (!date) return resu
  771. let time = new Date(date.replace(/-/g, '/'))
  772. time.setDate(time.getDate() - 7)
  773. let arr = date.split(' ')
  774. let str = arr[0]
  775. let result = str.split('-')
  776. let m = (time.getMonth() + 1) < 10 ? `0${time.getMonth() + 1}` : (time.getMonth() + 1)
  777. let d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate()
  778. if (type == 1) {
  779. resu = `${m}.${d}-${result[1]}.${result[2]}`
  780. } else {
  781. resu = `${m}月${d}日~${result[1]}月${result[2]}日`
  782. }
  783. return resu
  784. },
  785. // 转换时间
  786. getTimeLines(date) {
  787. if (!date) return ''
  788. let arr = date.split('~')
  789. let str0 = arr[0].split('-')
  790. let str1 = arr[1].split('-')
  791. return `${str0[1]}月${str0[2]}日~${str1[1]}月${str1[2]}日`
  792. },
  793. },
  794. filters: {
  795. // 时间格式转换
  796. fomatDate(date) {
  797. if (!date) return '--'
  798. let arr = date.split(' ')
  799. let str = arr[0]
  800. let result = str.split('-')
  801. return `${result[1]}-${result[2]}`
  802. },
  803. // 转换时间
  804. getTimeLine(date, type = 1) {
  805. if (!date) return '--'
  806. console.log(date.replace(/-/g, '/'))
  807. let time = new Date(date.replace(/-/g, '/'))
  808. time.setDate(time.getDate() - 7)
  809. let arr = date.split(' ')
  810. let str = arr[0]
  811. let result = str.split('-')
  812. let m = (time.getMonth() + 1) < 10 ? `0${time.getMonth() + 1}` : (time.getMonth() + 1)
  813. let d = time.getDate() < 10 ? `0${time.getDate()}` : time.getDate()
  814. if (type == 1) {
  815. return `${m}.${d}-${result[1]}.${result[2]}`
  816. } else {
  817. return `${m}月${d}日~${result[1]}月${result[2]}日`
  818. }
  819. },
  820. // 设置颜色
  821. setColor(index) {
  822. let color = ''
  823. switch (index) {
  824. case 0:
  825. color = '#E7483C';
  826. break;
  827. case 1:
  828. color = '#FF8C13';
  829. break;
  830. case 2:
  831. color = '#FFCC00';
  832. break;
  833. default:
  834. color = '#4FC78F';
  835. break;
  836. }
  837. return color
  838. },
  839. }
  840. }
  841. </script>
  842. <style lang="scss" scoped>
  843. @import '@/static/css/quill/quill.core.css';
  844. @import '@/static/css/quill/quill.snow.css';
  845. @import '@/static/css/quill/quill.bubble.css';
  846. .pages {
  847. width: 100vw;
  848. min-height: 100vh;
  849. display: flex;
  850. flex-direction: column;
  851. background: #F8F8F8;
  852. .nav-header {
  853. flex-shrink: 0;
  854. }
  855. .container {
  856. padding: 30rpx 30rpx 40rpx;
  857. display: flex;
  858. flex-direction: column;
  859. background: #fff;
  860. .c-head-card {
  861. padding: 30rpx;
  862. width: 100%;
  863. min-height: 252rpx;
  864. border: 2rpx solid #000000;
  865. border-radius: 12rpx;
  866. box-shadow: 10rpx 10rpx #2671E2;
  867. display: flex;
  868. flex-direction: column;
  869. .c-title-text {
  870. // position: relative;
  871. flex-grow: 1;
  872. font-size: 48rpx;
  873. font-weight: bold;
  874. color: #303030;
  875. }
  876. .date {
  877. // position: absolute;
  878. // right: 0;
  879. // bottom: 6rpx;
  880. font-size: 30rpx;
  881. color: #303030;
  882. }
  883. .creative-time {
  884. margin: 20rpx 0 0 0;
  885. flex-shrink: 0;
  886. }
  887. }
  888. }
  889. .nodata-box {
  890. width: 750rpx;
  891. flex: 1;
  892. margin: 0 auto;
  893. display: flex;
  894. justify-content: center;
  895. align-items: center;
  896. flex-direction: column;
  897. background-color: #fff;
  898. .img {
  899. width: 400rpx;
  900. height: 400rpx;
  901. }
  902. .text {
  903. text-align: center;
  904. font-size: 28rpx;
  905. font-family: PingFangSC-Regular, PingFang SC;
  906. font-weight: 400;
  907. color: #666666;
  908. line-height: 40rpx;
  909. }
  910. }
  911. .briefing {
  912. background: #fff;
  913. .briefing-title {
  914. padding: 0 30rpx;
  915. height: 90rpx;
  916. display: flex;
  917. align-items: center;
  918. border: 1rpx solid #E0E0E0;
  919. font-size: 32rpx;
  920. font-weight: bold;
  921. }
  922. .briefing-box {
  923. width: 100%;
  924. display: flex;
  925. flex-wrap: wrap;
  926. .briefing-box-item {
  927. padding: 20rpx 30rpx;
  928. width: 50%;
  929. height: 186rpx;
  930. border: 1px solid #E0E0E0;
  931. border-left: none;
  932. border-top: none;
  933. &:nth-of-type(2n) {
  934. border-right: none;
  935. }
  936. .top {
  937. font-size: 28rpx;
  938. }
  939. .middle {
  940. margin: 14rpx 0 12rpx;
  941. font-size: 32rpx;
  942. font-weight: 600;
  943. color: #333333;
  944. }
  945. .bottom {
  946. font-size: 26rpx;
  947. color: #666666;
  948. .b-text {
  949. margin-left: 20rpx;
  950. &.down {
  951. color: #E7483C;
  952. font-size: 34rpx;
  953. }
  954. &.up {
  955. font-size: 34rpx;
  956. color: #43CD80;
  957. }
  958. }
  959. }
  960. }
  961. }
  962. }
  963. .execution-ranking {
  964. margin: 20rpx 0 0 0;
  965. padding: 30rpx;
  966. background: #fff;
  967. .execution-ranking-title {
  968. font-size: 32rpx;
  969. font-weight: bold;
  970. }
  971. .execution-ranking-desc {
  972. margin-top: 20rpx;
  973. font-size: 30rpx;
  974. }
  975. .ranking-box {
  976. margin: 30rpx 0 0 0;
  977. .ranking-item {
  978. margin-bottom: 18rpx;
  979. display: flex;
  980. &:nth-last-of-type(1) {
  981. margin-bottom: 0;
  982. }
  983. .left {
  984. flex-shrink: 0;
  985. width: 270rpx;
  986. font-size: 30rpx;
  987. overflow: hidden;
  988. text-overflow: ellipsis;
  989. white-space: nowrap;
  990. }
  991. .middle {
  992. flex-grow: 1;
  993. }
  994. .right {
  995. flex-shrink: 0;
  996. width: 118rpx;
  997. font-size: 30rpx;
  998. text-align: center;
  999. }
  1000. }
  1001. }
  1002. }
  1003. .statistics {
  1004. margin: 20rpx 0 0 0;
  1005. background: #fff;
  1006. .statistics-title {
  1007. padding: 30rpx 30rpx 0;
  1008. width: 100%;
  1009. font-size: 32rpx;
  1010. font-weight: bold;
  1011. }
  1012. .statistics-desc {
  1013. padding: 0 30rpx;
  1014. margin-top: 20rpx;
  1015. }
  1016. .table {
  1017. margin: 30rpx 0 0 0;
  1018. .thead {
  1019. padding: 0 30rpx;
  1020. width: 100%;
  1021. height: 72rpx;
  1022. display: flex;
  1023. align-items: center;
  1024. border: 1rpx solid #E0E0E0;
  1025. border-left: none;
  1026. border-right: none;
  1027. font-size: 26rpx;
  1028. .thead-item {
  1029. text-align: center;
  1030. }
  1031. }
  1032. .tbody {
  1033. .tbody-item {
  1034. padding: 0 30rpx;
  1035. display: flex;
  1036. align-items: center;
  1037. height: 72rpx;
  1038. background: #FAFCFF;
  1039. &:nth-of-type(2n) {
  1040. background: #FFFFFF;
  1041. }
  1042. .tbody-items {
  1043. flex: 1;
  1044. display: flex;
  1045. justify-content: center;
  1046. }
  1047. .name {
  1048. justify-content: flex-start;
  1049. overflow: hidden;
  1050. text-overflow: ellipsis;
  1051. white-space: nowrap;
  1052. }
  1053. .time {
  1054. flex: 2;
  1055. }
  1056. .percent {
  1057. flex: 2;
  1058. }
  1059. .week {
  1060. flex: 1.5;
  1061. }
  1062. }
  1063. }
  1064. .tbottom {
  1065. width: 100%;
  1066. height: 72rpx;
  1067. display: flex;
  1068. justify-content: center;
  1069. align-items: center;
  1070. font-size: 30rpx;
  1071. color: #2671E2;
  1072. background: #FAFCFF;
  1073. }
  1074. }
  1075. }
  1076. .guwen-ranking {
  1077. margin: 20rpx 0 0 0;
  1078. width: 100%;
  1079. padding: 30rpx;
  1080. background: #fff;
  1081. .guwen-ranking-title {
  1082. font-size: 32rpx;
  1083. font-weight: 500;
  1084. }
  1085. .guwen-ranking-desc {
  1086. margin-top: 20rpx;
  1087. font-size: 30rpx;
  1088. }
  1089. .ranking-box {
  1090. margin: 30rpx 0 0 0;
  1091. .ranking-item {
  1092. margin-bottom: 18rpx;
  1093. display: flex;
  1094. &:nth-last-of-type(1) {
  1095. margin-bottom: 0;
  1096. }
  1097. .left {
  1098. flex-shrink: 0;
  1099. width: 270rpx;
  1100. font-size: 30rpx;
  1101. overflow: hidden;
  1102. text-overflow: ellipsis;
  1103. white-space: nowrap;
  1104. }
  1105. .middle {
  1106. flex-grow: 1;
  1107. }
  1108. .right {
  1109. flex-shrink: 0;
  1110. width: 118rpx;
  1111. font-size: 30rpx;
  1112. text-align: center;
  1113. }
  1114. }
  1115. }
  1116. }
  1117. .proposal {
  1118. margin: 20rpx 0 0 0;
  1119. padding: 30rpx;
  1120. background: #fff;
  1121. .proposal-title {
  1122. font-size: 32rpx;
  1123. font-weight: 500;
  1124. }
  1125. .proposal-box {
  1126. margin: 30rpx 0 0 0;
  1127. .proposal-item {
  1128. margin: 20rpx 0 0 0;
  1129. display: flex;
  1130. .lside {
  1131. flex-shrink: 0;
  1132. margin: 0 12rpx 0 0;
  1133. width: 44rpx;
  1134. height: 44rpx;
  1135. border-radius: 50%;
  1136. background: #2671E2;
  1137. text-align: center;
  1138. line-height: 44rpx;
  1139. color: #fff;
  1140. }
  1141. .rside {
  1142. .rside-title {
  1143. font-size: 32rpx;
  1144. }
  1145. .rside-box {
  1146. margin: 16rpx 0 0 0;
  1147. }
  1148. }
  1149. }
  1150. }
  1151. }
  1152. .nav-footer {
  1153. position: sticky;
  1154. bottom: 0;
  1155. padding: 32rpx;
  1156. width: 100%;
  1157. display: flex;
  1158. justify-content: center;
  1159. background: #fff;
  1160. .footer-item {
  1161. flex: 1;
  1162. height: 88rpx;
  1163. display: flex;
  1164. justify-content: center;
  1165. align-items: center;
  1166. color: #2671E2;
  1167. border: 2rpx solid #2671E2;
  1168. border-radius: 8rpx;
  1169. overflow: hidden;
  1170. font-size: 32rpx;
  1171. &.full {
  1172. background: #2671E2;
  1173. color: #fff;
  1174. .fulls {
  1175. box-sizing: border-box;
  1176. width: 100%;
  1177. height: 100%;
  1178. background: transparent;
  1179. color: #fff;
  1180. font-size: 32rpx;
  1181. font-weight: normal;
  1182. line-height: 88rpx;
  1183. }
  1184. }
  1185. }
  1186. }
  1187. .up {
  1188. color: #43CD80 !important;
  1189. }
  1190. .down {
  1191. color: #E6273A !important;
  1192. }
  1193. .empity {
  1194. width: 100%;
  1195. height: 300rpx;
  1196. display: flex;
  1197. justify-content: center;
  1198. align-items: center;
  1199. font-size: 28rpx;
  1200. color: #666666;
  1201. }
  1202. }
  1203. </style>