page2.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <template>
  2. <vue-fullscreen
  3. class="box-container"
  4. v-cloak
  5. v-model="isFullscreen"
  6. fullscreenClass="box-container"
  7. :exit-on-click-wrapper="false"
  8. >
  9. <div class="box-container" v-cloak>
  10. <div class="box-header">
  11. <div class="logo">
  12. <!-- <img style="width: 20% ;height: 100%;transform: translate(51%,15%)" src="../../../assets/TGLOGO.png" alt="">-->
  13. </div>
  14. <div class="title">
  15. 采购仓储数据看板
  16. </div>
  17. <div class="time">
  18. <span
  19. style="color: #7fa7ce;margin: 5px 10px 15px 0;cursor: pointer" @click.passive="onFullscreen">
  20. <i v-if="isFullscreen" title="取消全屏" class="el-icon-_screen-restore"></i>
  21. <i v-else title="全屏" class="el-icon-_screen-full"></i>
  22. </span>
  23. <div style="margin-right: 10px">
  24. <span style="color: #7fa7ce">{{ date }}</span>
  25. <span style="color: rgb(210 215 221); padding: 0 5px;">{{ time }}</span>
  26. <span style="color: #7fa7ce;">{{ week }}
  27. </span>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="box-middle">
  32. <div class="box-middle-content" style="width: 35%;cursor: pointer" @click="handelRouterTo('/page-eos/purchaseOrder')">
  33. <div class="box-middle-content-left">
  34. <span>月度总金额</span>
  35. <span>(万元)</span>
  36. </div>
  37. <div class="box-middle-content-right">
  38. <template v-for="item in MonthlyAmount">
  39. <span style="display: flex;align-content: flex-end"
  40. v-if="item=='.'">{{ '.' }}</span>
  41. <span v-else class="box-border8">{{ item }}</span>
  42. </template>
  43. </div>
  44. </div>
  45. <div class="box-middle-content">
  46. <div class="box-middle-content-left">
  47. <span>年度总金额</span>
  48. <span>(万元)</span>
  49. </div>
  50. <div class="box-middle-content-right">
  51. <template v-for="item in YearlyAmount">
  52. <span style="display: flex;align-content: flex-end;"
  53. v-if="item=='.'">{{ '.' }}</span>
  54. <span v-else class="box-border8" style=" width: 10%;">{{ item }}</span>
  55. </template>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="box-footer">
  60. <div class="box-footer-right">
  61. <div class="box-echarts-top">
  62. <span class="box-top-name">月度采购明细</span>
  63. </div>
  64. <dv-scroll-board v-if="isFlag" :config="config" style="width:92%;height:80%;transform: translate(5%,7%);"/>
  65. </div>
  66. <div class="box-footer-left">
  67. <div class="box-echarts">
  68. <div class="box-echarts-top">
  69. <span class="box-top-name">年度采购统计</span>
  70. <span class="box-top-unit">(万元)</span>
  71. </div>
  72. <div class="monthly_sales_volume">
  73. <div v-if="isFlag" id="monthly_sales_volume" ref="monthly_sales_volume"></div>
  74. </div>
  75. <!-- <div style="position: fixed; transform: translate(13%, 110%);">-->
  76. <!-- <div style="color:#03c391">-->
  77. <!-- <span>{{ '累计签单金额 ' }}</span>-->
  78. <!-- <span style="font-weight: bold">{{ borderData[0].value }}</span>-->
  79. <!-- </div>-->
  80. <!-- <div style="color:#ea5082">-->
  81. <!-- <span>{{ '累计交货金额 ' }}</span>-->
  82. <!-- <span style="font-weight: bold">{{ borderData[1].value }}</span>-->
  83. <!-- </div>-->
  84. <!-- <div style="color:#faab46">-->
  85. <!-- <span>{{ '累计销售金额 ' }}</span>-->
  86. <!-- <span style="font-weight: bold">{{ borderData[2].value }}</span>-->
  87. <!-- </div>-->
  88. <!-- </div>-->
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </vue-fullscreen>
  94. </template>
  95. <script>
  96. import dvBorderContent from "./dv-border-content.vue";
  97. import * as echarts from 'echarts'
  98. import {component} from 'vue-fullscreen'
  99. import {
  100. getMonthlyPurchaseDetailAPI,
  101. getYearlyPurchaseAmountAPI,
  102. getMonthlyPurchaseAmountAPI,
  103. getYearlyPurchaseStatisticAPI,
  104. } from "@/api/bpm/visPage";
  105. import {toggleFullscreen} from "ele-admin";
  106. export default {
  107. name: 'index',
  108. components: {
  109. dvBorderContent,
  110. VueFullscreen: component
  111. },
  112. computed: {
  113. contentWidth() {
  114. return this.$store.state.theme.contentWidth;
  115. }
  116. },
  117. watch: {
  118. isFullscreen: {
  119. handler() {
  120. this.isFlag = false
  121. this.$nextTick(() => {
  122. let {clientWidth: deviceWidth, clientHeight: deviceHeight} = document.documentElement;
  123. let eleAdminHeaderHeight = (!this.isFullscreen && document.getElementsByClassName('ele-admin-header')[0]?.offsetHeight) || 0;
  124. let eleAdminSidebarWidth = (!this.isFullscreen && document.getElementsByClassName('ele-admin-sidebar')[0]?.offsetWidth) || 0;
  125. let eleAdminTabsWidth = (!this.isFullscreen && document.getElementsByClassName('ele-admin-tabs')[0]?.offsetHeight) || 0;
  126. const setContainerSize = (item) => {
  127. item.style.height = deviceHeight - eleAdminHeaderHeight - eleAdminTabsWidth + 'px';
  128. item.style.width = deviceWidth - eleAdminSidebarWidth + 'px';
  129. };
  130. let boxContainer = [...document.getElementsByClassName('box-container')];
  131. boxContainer.forEach(setContainerSize);
  132. document.documentElement.style.fontSize = this.isFullscreen ? '24px' : '16px'
  133. this.isFlag = true
  134. this.$nextTick(() => {
  135. let chartDom = this.$refs.monthly_sales_volume;
  136. this.salesChart = echarts.init(chartDom);
  137. this.getMonthlySalesStatistic()
  138. })
  139. })
  140. }, immediate: true
  141. },
  142. contentWidth: {
  143. handler() {
  144. clearTimeout(this.resizeTimer);
  145. this.isFlag = false
  146. this.resizeTimer = setTimeout(() => {
  147. this.$nextTick(() => {
  148. let {clientWidth: deviceWidth, clientHeight: deviceHeight} = document.documentElement;
  149. let eleAdminHeaderHeight = (!this.isFullscreen && document.getElementsByClassName('ele-admin-header')[0]?.offsetHeight) || 0;
  150. let eleAdminSidebarWidth = (!this.isFullscreen && document.getElementsByClassName('ele-admin-sidebar')[0]?.offsetWidth) || 0;
  151. let eleAdminTabsWidth = (!this.isFullscreen && document.getElementsByClassName('ele-admin-tabs')[0]?.offsetHeight) || 0;
  152. const setContainerSize = (item) => {
  153. item.style.height = deviceHeight - eleAdminHeaderHeight - eleAdminTabsWidth + 'px';
  154. item.style.width = deviceWidth - eleAdminSidebarWidth + 'px';
  155. };
  156. let boxContainer = [...document.getElementsByClassName('box-container')];
  157. boxContainer.forEach(setContainerSize);
  158. document.documentElement.style.fontSize = this.isFullscreen ? '24px' : '16px'
  159. this.isFlag = true
  160. this.$nextTick(() => {
  161. let chartDom = this.$refs.monthly_sales_volume;
  162. this.salesChart = echarts.init(chartDom);
  163. this.getMonthlySalesStatistic()
  164. })
  165. })
  166. }, 300)
  167. }, immediate: true
  168. },
  169. },
  170. data() {
  171. return {
  172. isFullscreen: false, // 是否是全屏
  173. isFlag: false, // 是否展示图表
  174. resizeTimer: null,
  175. timer: null,
  176. date: '',
  177. time: '',
  178. week: '',
  179. MonthlyAmount: 0,
  180. YearlyAmount: 0,
  181. salesChart: null,
  182. monthlySalesVolumeOption: {
  183. legend: {
  184. left: 'center',
  185. selectedMode: false,
  186. bottom: '85%',
  187. itemGap: 50,
  188. textStyle: {
  189. fontSize: '0.7rem',
  190. color: '#fff',
  191. lineHeight: 0,
  192. padding: [10, 0, 0, 0]
  193. }
  194. },
  195. grid: {
  196. bottom: '5%', // 组件离容器底部的距离
  197. containLabel: true // 包含坐标轴的标签
  198. },
  199. xAxis: {
  200. type: 'category',
  201. data: [],
  202. axisLabel: {
  203. interval: 0,
  204. formatter: function (value, index) {
  205. let month = value.split('-')
  206. return month[1] + '月';
  207. },
  208. textStyle: {
  209. color: '#fff', // 修改字体颜色为红色
  210. fontSize: '0.7rem',
  211. fontFamily: 'AlibabaPuHuiTi' // 修改字体为Arial
  212. }
  213. },
  214. axisLine: {},
  215. axisTick: {}
  216. },
  217. yAxis: {
  218. type: 'value',
  219. axisLabel: {
  220. textStyle: {
  221. color: '#fff', // 修改字体颜色为红色
  222. fontSize: '0.7rem',
  223. fontFamily: 'AlibabaPuHuiTi' // 修改字体为Arial
  224. }
  225. }
  226. },
  227. series: []
  228. },
  229. tableHeader: ['客户代号', '销售订单号', '采购订单', '数量', '到货情况', '入库情况', '质检状态', '合格率'],
  230. config: {
  231. header: [],
  232. data: [],
  233. align: ['center', 'center', 'center', 'center', 'center', 'center', 'center', 'center'],
  234. headerBGC: '#031d42',
  235. columnWidth: [110, 200],
  236. headerHeight: 20,
  237. oddRowBGC: '#031d42',
  238. evenRowBGC: '#031d42',
  239. waitTime: 5000,
  240. rowNum: 6
  241. },
  242. //1已检0未检
  243. qcStatusList: [
  244. {
  245. dictKey: 1,
  246. dictValue: '已检'
  247. },
  248. {
  249. dictKey: 0,
  250. dictValue: '未检'
  251. },
  252. ],
  253. // 1在途2提前3按时4延期
  254. receiveStatusList: [
  255. {
  256. dictKey: 1,
  257. dictValue: '在途'
  258. },
  259. {
  260. dictKey: 2,
  261. dictValue: '提前'
  262. },
  263. {
  264. dictKey: 3,
  265. dictValue: '按时'
  266. },
  267. {
  268. dictKey: 4,
  269. dictValue: '延期'
  270. }
  271. ],
  272. //入库状态 1已入库0未入库 integer(int32)
  273. inStoreStatusList: [
  274. {
  275. dictKey: 1,
  276. dictValue: '已入库'
  277. },
  278. {
  279. dictKey: 0,
  280. dictValue: '未入库'
  281. }
  282. ],
  283. };
  284. },
  285. created() {
  286. this.updateTimer = setInterval(this.updateTime, 1000)
  287. },
  288. mounted() {
  289. this.getSalesFinishList()
  290. this.timer = setInterval(() => {
  291. this.getSalesFinishList()
  292. }, 3600000)
  293. },
  294. // 在组件销毁时清除定时器
  295. beforeDestroy() {
  296. clearInterval(this.updateTimer)
  297. },
  298. methods: {
  299. handelRouterTo(path) {
  300. window.history.pushState(null, '', path);
  301. },
  302. /* 全屏切换 */
  303. onFullscreen() {
  304. this.isFullscreen = !this.isFullscreen
  305. },
  306. //获取年度采购统计
  307. async getMonthlySalesStatistic() {
  308. let data = await getYearlyPurchaseStatisticAPI()
  309. let series = [
  310. {
  311. field: 'contractPrice',
  312. name: '采购订单金额',
  313. data: [],
  314. type: 'bar',
  315. itemStyle: {
  316. color: '#03c391'
  317. }
  318. },
  319. {
  320. field: 'qcInStorePrice',
  321. name: '合格入库金额',
  322. data: [],
  323. type: 'bar',
  324. itemStyle: {
  325. color: '#ea5082'
  326. }
  327. }
  328. ]
  329. this.monthlySalesVolumeOption.xAxis.data = data.map(item => item.monthStr)
  330. series.forEach(item => {
  331. item.data = data.map(i => i[item.field])
  332. })
  333. this.monthlySalesVolumeOption.series = series
  334. this.salesChart.setOption(this.monthlySalesVolumeOption)
  335. },
  336. // 获取销售完成列表数据
  337. async getSalesFinishList() {
  338. // customerMark 客户代号 string
  339. // inStoreStatus 入库状态 1已入库0未入库 integer(int32)
  340. // purchaseOrderCode 采购订单 string
  341. // qcRate 合格率 number
  342. // qcStatus 质检状态 1已检0未检 integer(int32)
  343. // receiveStatus 到货情况 1在途2提前3按时4延期 integer(int32)
  344. // saleOrderCode 销售订单 string
  345. let data = await getMonthlyPurchaseDetailAPI()
  346. this.config = {
  347. header: this.tableHeader.map(item => `<div style="color: #f4d29c;font-size: 0.9rem;font-weight: bold">${item}</div>`),
  348. data: data.map(item => {
  349. let list = []
  350. for (let i in item) {
  351. let div = ''
  352. if (i === 'customerMark') {
  353. div = `<div class="white" style="font-size: 0.8rem;">${item[i] || '-'}</div>`
  354. list[0] = div
  355. }
  356. if (i === 'saleOrderCode') {
  357. div = `<div class="white" style="font-size: 0.8rem;">${item[i] || '-'}</div>`
  358. list[1] = div
  359. }
  360. if (i === 'purchaseOrderCode') {
  361. div = `<div class="white" style="font-size: 0.8rem;">${item[i] || '-'}</div>`
  362. list[2] = div
  363. }
  364. if (i === 'productTotalCount') {
  365. div = `<div class="white" style="font-size: 0.8rem;">${item[i]||'-'}</div>`
  366. list[3] = div
  367. }
  368. if (i === 'receiveStatus') {
  369. div = `<div class="white" style="font-size: 0.8rem;">${this.getValue('receiveStatus', item[i])}</div>`
  370. list[4] = div
  371. }
  372. if (i === 'inStoreStatus') {
  373. div = `<div class="white" style="font-size: 0.8rem;">${this.getValue('inStoreStatus', item[i])}</div>`
  374. list[5] = div
  375. }
  376. if (i === 'qcStatus') {
  377. div = `<div class="white" style="font-size: 0.8rem;">${this.getValue('qcStatus', item[i])}</div>`
  378. list[6] = div
  379. }
  380. if (i === 'qcRate') {
  381. div = `<div class="white" style="font-size: 0.8rem;">${item[i]||0 + '%'}</div>`
  382. list[7] = div
  383. }
  384. }
  385. return list
  386. }) ?? [],
  387. align: ['center', 'center', 'center', 'center', 'center', 'center', 'center', 'center'],
  388. headerBGC: '#031d42',
  389. columnWidth: [],
  390. headerHeight: 30,
  391. oddRowBGC: '#031d42',
  392. evenRowBGC: '#031d42',
  393. waitTime: 5000,
  394. rowNum: 6,
  395. }
  396. /*年度总金额*/
  397. this.YearlyAmount = await getYearlyPurchaseAmountAPI()
  398. this.YearlyAmount = (this.YearlyAmount + '').includes('.') ? ((this.YearlyAmount.toFixed(2)) + '').padStart(8, 0) : (this.YearlyAmount + '').padStart(8, 0)
  399. /*月度总金额*/
  400. this.MonthlyAmount = await getMonthlyPurchaseAmountAPI()
  401. this.MonthlyAmount = (this.MonthlyAmount + '').includes('.') ? ((this.MonthlyAmount.toFixed(2)) + '').padStart(7, 0) : (this.MonthlyAmount + '').padStart(7, 0)
  402. },
  403. // 获取自定义字典值
  404. getValue(name, key) {
  405. let find = this[name + 'List'].find(item => item.dictKey == key) || {}
  406. return find.dictValue || ''
  407. },
  408. //实时更新日期
  409. updateTime() {
  410. let now = new Date();
  411. let hours = now.getHours();
  412. let minutes = now.getMinutes();
  413. let seconds = now.getSeconds();
  414. this.time = hours.toString().padStart(2, '0') + ":" +
  415. minutes.toString().padStart(2, '0') + ":" +
  416. seconds.toString().padStart(2, '0');
  417. let year = now.getFullYear();
  418. let month = now.getMonth() + 1;
  419. let day = now.getDate();
  420. this.date = year + '年' + month + '月' + day + '日'
  421. let weekInfo = {
  422. 1: '一',
  423. 2: '二',
  424. 3: '三',
  425. 4: '四',
  426. 5: '五',
  427. 6: '六',
  428. 0: '日',
  429. }
  430. this.week = '星期' + weekInfo[now.getDay()]
  431. }
  432. }
  433. }
  434. </script>
  435. <style lang="scss" scoped>
  436. [v-cloak] {
  437. display: none;
  438. }
  439. .box-container {
  440. font-size: 16px;
  441. font-family: 'AlibabaPuHuiTi';
  442. background: #011635;
  443. display: flex;
  444. flex-direction: column;
  445. .box-header {
  446. background-image: url("@/assets/border2.png");
  447. background-repeat: no-repeat;
  448. background-size: 100% 100%;
  449. display: flex;
  450. width: 100% !important;
  451. height: 10%;
  452. justify-content: space-between;
  453. .title {
  454. font-family: '优设标题黑';
  455. font-size: 2.85rem;
  456. flex: 1;
  457. display: flex;
  458. justify-content: center;
  459. align-items: center;
  460. color: #fff;
  461. transform: translate(2%, -10%);
  462. letter-spacing: 0.4rem;
  463. }
  464. .logo {
  465. display: inline-block;
  466. width: 20%;
  467. }
  468. .time {
  469. width: 20%;
  470. display: flex;
  471. align-items: center;
  472. justify-content: space-around;
  473. flex-direction: column;
  474. align-items: flex-end;
  475. justify-content: flex-start;
  476. font-size: 0.8rem;
  477. }
  478. }
  479. .box-middle {
  480. width: 100% !important;
  481. height: 10% !important;
  482. display: flex;
  483. justify-content: center;
  484. margin: 5px 0 10px 0;
  485. .box-middle-content {
  486. width: 45%;
  487. height: 100%;
  488. background-image: url("@/assets/png/border6.png");
  489. background-repeat: no-repeat;
  490. background-size: 100% 100%;
  491. margin: 0 28px 10px 0;
  492. display: flex;
  493. align-items: center;
  494. .box-middle-content-left {
  495. width: 30%;
  496. display: flex;
  497. flex-direction: column;
  498. align-items: center;
  499. justify-content: center;
  500. height: 100%;
  501. font-size: 1rem;
  502. font-weight: bold;
  503. color: #fff;
  504. }
  505. .box-middle-content-right {
  506. flex: 1;
  507. display: flex;
  508. //font-family: 'LCD2B';
  509. font-size: 3rem;
  510. color: #fff;
  511. justify-content: space-evenly;
  512. height: 61%;
  513. .box-border8 {
  514. background-image: url("@/assets/png/border8.png");
  515. background-repeat: no-repeat;
  516. background-size: 100% 100%;
  517. width: 12%;
  518. display: flex;
  519. font-size: 3rem;
  520. justify-content: center;
  521. font-family: 'DS-DIGIT';
  522. align-items: center;
  523. }
  524. .border-box-content {
  525. }
  526. }
  527. }
  528. }
  529. .box-footer {
  530. flex: 1;
  531. display: flex;
  532. flex-direction: column;
  533. justify-content: space-around;
  534. .box-footer-left {
  535. width: 100%;
  536. height: 50%;
  537. .box-echarts {
  538. width: 100%;
  539. height: 100%;
  540. display: flex;
  541. flex-direction: column;
  542. background-image: url("@/assets/png/border5.png");
  543. background-repeat: no-repeat;
  544. background-size: 100% 100%;
  545. .box-echarts-top {
  546. background-image: url("@/assets/png/border7.png");
  547. background-repeat: no-repeat;
  548. background-size: 94% 100%;
  549. height: 15.5%;
  550. width: 100%;
  551. display: flex;
  552. align-items: center;
  553. /* justify-content: space-around; */
  554. transform: translate(2%, 20%);
  555. color: #fff;
  556. .box-top-name {
  557. font-family: '优设标题黑';
  558. transform: translateX(40%);
  559. display: inline-block;
  560. font-size: 1.8rem;
  561. }
  562. .box-top-unit {
  563. font-family: '优设标题黑';
  564. display: inline-block;
  565. font-size: 1rem;
  566. transform: translate(150%, 20%);
  567. letter-spacing: 0.9px;
  568. }
  569. }
  570. .monthly_sales_volume {
  571. transform: translateX(-7%);
  572. flex: 1;
  573. //width: 100%;
  574. //height: 100%;
  575. #monthly_sales_volume {
  576. width: 113%;
  577. height: 100%;
  578. }
  579. }
  580. .monthly_output {
  581. transform: translateX(-7%);
  582. flex: 1;
  583. #monthly_output {
  584. width: 113%;
  585. height: 100%;
  586. //width: 100%;
  587. //height: 100%;
  588. }
  589. }
  590. }
  591. }
  592. .box-footer-right {
  593. width: 100%;
  594. height: 50%;
  595. background-image: url("@/assets/png/border5.png");
  596. background-repeat: no-repeat;
  597. background-size: 100% 100%;
  598. .box-echarts-top {
  599. background-image: url("@/assets/png/border7.png");
  600. background-repeat: no-repeat;
  601. background-size: 94% 100%;
  602. height: 15.5%;
  603. width: 100%;
  604. display: flex;
  605. align-items: center;
  606. transform: translate(2%, 20%);
  607. /* justify-content: space-around; */
  608. color: #fff;
  609. font-size: 1.1rem;
  610. letter-spacing: 2px;
  611. .box-top-name {
  612. font-family: '优设标题黑';
  613. transform: translateX(40%);
  614. display: inline-block;
  615. font-size: 1.8rem;
  616. }
  617. }
  618. }
  619. }
  620. }
  621. </style>
  622. <style>
  623. .white {
  624. color: #ffffff;
  625. }
  626. .yellow {
  627. color: #ffd16c;
  628. }
  629. .green {
  630. color: green;
  631. }
  632. .red {
  633. color: red;
  634. }
  635. </style>