StoreWorkplaceBacklog.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <div>
  3. <div class="gutter-example">
  4. <a-row :gutter="20">
  5. <a-col class="gutter-row" :span="8">
  6. <div class="gutter-box">
  7. <a-row type="flex" justify="space-between" style="flex:1; font-size:22px;font-weight: 500;color: #373737;">
  8. <a-col>待入库总数</a-col>
  9. <a-col>{{ topData.inTotalNum }}</a-col>
  10. </a-row>
  11. <a-row type="flex" justify="space-between" :gutter="[0,16]" style="flex:1;font-size:18px;font-weight: 500;">
  12. <a-col >
  13. <a-badge color="#E4007F"/>
  14. <span style="color:#E4007F;">采集入库 &nbsp; {{ topData.purchaseApplyNum }}</span>
  15. </a-col>
  16. <a-col >
  17. <a-badge color="#5864FF"/>
  18. <span style="color:#5864FF;">闲置入库 &nbsp; {{ topData.spareBackApplyNum }}</span>
  19. </a-col>
  20. </a-row>
  21. <a-row type="flex" justify="space-between" :gutter="[0,16]" style="flex:1;font-size:18px;font-weight: 500;">
  22. <a-col >
  23. <a-badge color="#F19149"/>
  24. <span style="color:#F19149;">其他入库 &nbsp; {{ topData.otherNum }}</span>
  25. </a-col>
  26. <a-col>
  27. <a-badge color="#009944"/>
  28. <span style="color:#009944;">调拨入库 &nbsp; {{ topData.applyDBNum }}</span>
  29. </a-col>
  30. </a-row>
  31. </div>
  32. </a-col>
  33. <a-col class="gutter-row" :span="8">
  34. <div class="gutter-box">
  35. <a-row type="flex" justify="space-between" style="flex:1; font-size:22px;font-weight: 500;color: #373737;">
  36. <a-col>待出库总数</a-col>
  37. <a-col>{{ topData.outTotalNum }}</a-col>
  38. </a-row>
  39. <a-row type="flex" justify="space-between" :gutter="[0,16]" style="flex:1;font-size:18px;font-weight: 500;">
  40. <a-col >
  41. <a-badge color="#E4007F"/>
  42. <span style="color:#E4007F;">待调拨出库 &nbsp; {{ topData.outDBNum }}</span>
  43. </a-col>
  44. <a-col >
  45. <a-badge color="#5864FF"/>
  46. <span style="color:#5864FF;">待领用出库 &nbsp; {{ topData.lyNum }}</span>
  47. </a-col>
  48. </a-row>
  49. <a-row type="flex" justify="space-between" :gutter="[0,16]" style="flex:1;font-size:18px;font-weight: 500;">
  50. <a-col >
  51. <a-badge color="#F19149"/>
  52. <span style="color:#F19149;">报废出库 &nbsp; {{ topData.bfNum }}</span>
  53. </a-col>
  54. <a-col>
  55. <a-badge color="#009944"/>
  56. <span style="color:#009944;">其他出库 &nbsp; {{ topData.otherOutNum }}</span>
  57. </a-col>
  58. </a-row>
  59. </div>
  60. </a-col>
  61. <a-col class="gutter-row" :span="8">
  62. <div style="display:flex;text-align:center;background:#fff;height: 170px;">
  63. <div style="width:48%;margin:auto;font-size:30px; line-height: 60px;">
  64. <div>仓库总数</div>
  65. <div style="font-size:24px;">{{ topData.storeNums }}</div>
  66. </div>
  67. <div style="width: 1px;height: 70px;background: #999999;margin:auto;"></div>
  68. <div style="width:48%;margin:auto; font-size:30px;line-height: 60px;">
  69. <div>备件总价值</div>
  70. <div style="font-size:24px;">{{ topData.totalPrice }}</div>
  71. </div>
  72. </div>
  73. </a-col>
  74. </a-row>
  75. </div>
  76. <div class="gutter-example">
  77. <a-row :gutter="[20,40]">
  78. <a-col class="gutter-row" :span="8">
  79. <div style="height: 471px;background: #FFFFFF;padding:24px">
  80. <div style="display:flex;justify-content: space-between;width:160px;height: 18px; font-size:16px;color: #555555; ">
  81. <div>备件类型数量统计</div>
  82. <!-- <div>设备总数100</div> -->
  83. </div>
  84. <div id="container-pie"></div>
  85. </div>
  86. </a-col>
  87. <a-col class="gutter-row" :span="12">
  88. <div style="height: 471px;background: #FFFFFF; padding:24px;">
  89. <div style="display:flex;justify-content: space-between;width:190px;height: 18px; font-size:16px;color: #555555; margin-bottom:80px;">
  90. <div style="width: 7px;background: #4D86ED;"></div>
  91. <div>近一周每日出入库数据</div>
  92. </div>
  93. <div id="container-line"></div>
  94. </div>
  95. </a-col>
  96. <a-col class="gutter-row" :span="4">
  97. <div style="height: 471px;display:flex;flex-direction:column;justify-content: space-between">
  98. <div class="btn" style="background:linear-gradient(to right,#36B5FA,#26ECF5);">
  99. <my-icon type="icon-chukuguanli" style="font-size:58px;"/>
  100. <span>出库</span>
  101. </div>
  102. <div class="btn" style="background:linear-gradient(to right,#FF416D,#FF847F);">
  103. <my-icon type="icon-rukuguanli" style="font-size:58px;"/>
  104. <span>入库</span>
  105. </div>
  106. <div class="btn" style="background:linear-gradient(to right,#FB47D1,#F96EFE);">
  107. <my-icon type="icon-zichanguanli-zichantiaobo" style="font-size:58px;"/>
  108. <span>调拨</span>
  109. </div>
  110. <div class="btn" style="background:linear-gradient(to right,#941FFF,#BC72FB);">
  111. <my-icon type="icon-xinzengyugengxinhuopindangan-copy" style="font-size:58px;"/>
  112. <span>新增</span>
  113. </div>
  114. </div>
  115. </a-col>
  116. </a-row>
  117. </div>
  118. <div class="gutter-example">
  119. <a-row :gutter="20">
  120. <a-col class="gutter-row" :span="6">
  121. <div class="information">
  122. <div style="display:flex;justify-content: space-between;align-items: center; padding-bottom:20px;">
  123. <div style="display:flex; width:65px;height:17px;justify-content: space-between;align-items: center;">
  124. <div style=" width: 17px;height: 17px;background: #3462FD;border-radius: 50%;"></div>
  125. <div style="font-size: 18px;font-weight: 800;color: #333333;">资料</div>
  126. </div>
  127. <div >
  128. 查看全部
  129. <my-icon type="icon-xiangyou-copy" style="font-size:13px;"/>
  130. </div>
  131. </div>
  132. <div
  133. class="demo-infinite-container"
  134. >
  135. <a-list size="small" bordered :data-source="information">
  136. <a-list-item slot="renderItem" slot-scope="item,index" :class="{discolor: index%2}">
  137. <a-list-item-meta>
  138. <div slot="title" :href="item.href">{{ item.name }}</div>
  139. </a-list-item-meta>
  140. <div>{{ item.time }}</div>
  141. </a-list-item>
  142. </a-list>
  143. </div>
  144. </div>
  145. </a-col>
  146. <a-col class="gutter-row" :span="18">
  147. <div class="information">
  148. <s-table
  149. ref="table"
  150. size="small"
  151. bordered
  152. rowKey="id"
  153. :columns="columns"
  154. :data="loadData"
  155. :pageSize="10"
  156. :scroll="{ y: 190 }"
  157. >
  158. <span slot="action" slot-scope="record">
  159. <template>
  160. <a @click="handle(record)">详情</a>
  161. <a-divider v-if="record.status === 1" type="vertical" />
  162. <a v-if="record.status === 1" @click="dealJumpDetail(record)">跳转</a>
  163. </template>
  164. </span>
  165. <span slot="content" slot-scope="text" v-html="text">
  166. </span>
  167. </s-table>
  168. </div>
  169. </a-col>
  170. </a-row>
  171. </div>
  172. </div>
  173. </template>
  174. <script>
  175. import { STable } from '@/components'
  176. import { getWorkplaceBacklogUserPage, getWorkplaceBacklogTopData, getWorkplaceBacklogWeekData, getWorkplaceBacklogPie } from '@/api/workplace/backlog'
  177. import { Chart } from '@antv/g2'
  178. export default {
  179. name: 'NewWorkplaceBacklog',
  180. components: {
  181. STable,
  182. Chart
  183. },
  184. data () {
  185. return {
  186. equipmentData: [
  187. { item: '事例一', count: 40, percent: 0.4 },
  188. { item: '事例二', count: 21, percent: 0.21 },
  189. { item: '事例三', count: 17, percent: 0.17 },
  190. { item: '事例四', count: 13, percent: 0.13 },
  191. { item: '事例五', count: 9, percent: 0.09 }
  192. ],
  193. lineData: [
  194. { week: '周一', value: 3 },
  195. { week: '周二', value: 4 },
  196. { week: '周三', value: 7.5 },
  197. { week: '周四', value: 5 },
  198. { week: '周五', value: 4.9 },
  199. { week: '周六', value: 6 },
  200. { week: '周日', value: 7 }
  201. ],
  202. storeNums: 0,
  203. allCount: 100,
  204. chartPie: null,
  205. chartLine: null,
  206. topData: null,
  207. queryParam: {
  208. status: 1
  209. },
  210. information: [
  211. {
  212. name: '项目管理通知',
  213. time: '2022-4-7'
  214. },
  215. {
  216. name: '项目管理通知',
  217. time: '2022-4-7'
  218. },
  219. {
  220. name: '项目管理通知',
  221. time: '2022-4-7'
  222. },
  223. {
  224. name: '项目管理通知',
  225. time: '2022-4-7'
  226. }, {
  227. name: '项目管理通知',
  228. time: '2022-4-7'
  229. },
  230. {
  231. name: '项目管理通知',
  232. time: '2022-4-7'
  233. },
  234. {
  235. name: '项目管理通知',
  236. time: '2022-4-7'
  237. }
  238. ],
  239. columns: [
  240. {
  241. title: '序号',
  242. dataIndex: 'index',
  243. align: 'center',
  244. width: 50,
  245. customRender: (text, record, index) => {
  246. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  247. }
  248. },
  249. {
  250. title: '类型',
  251. dataIndex: 'type',
  252. align: 'center',
  253. width: 100,
  254. customRender: (text, record, index) => {
  255. return this.typeDict[text]
  256. }
  257. },
  258. {
  259. title: '详细类型',
  260. dataIndex: 'detailType',
  261. align: 'center',
  262. width: 140,
  263. customRender: (text, record, index) => {
  264. return this.typeDetailDict[text]
  265. }
  266. },
  267. {
  268. title: '内容',
  269. dataIndex: 'content',
  270. align: 'center',
  271. width: 460,
  272. ellipsis: true,
  273. scopedSlots: { customRender: 'content' }
  274. },
  275. {
  276. title: '时间',
  277. align: 'center',
  278. width: 160,
  279. dataIndex: 'createdTime'
  280. },
  281. {
  282. title: '状态',
  283. align: 'center',
  284. dataIndex: 'status',
  285. width: 100,
  286. customRender: (text, record, index) => {
  287. return (text === 1 ? '未读' : '已读')
  288. }
  289. },
  290. {
  291. title: '操作',
  292. key: 'action',
  293. width: 150,
  294. align: 'center',
  295. scopedSlots: { customRender: 'action' }
  296. }
  297. ],
  298. // 加载数据方法 必须为 Promise 对象
  299. loadData: parameter => {
  300. parameter = {
  301. ...parameter,
  302. ...this.queryParam
  303. }
  304. return getWorkplaceBacklogUserPage(parameter)
  305. .then(res => {
  306. return res.data
  307. })
  308. }
  309. }
  310. },
  311. computed: {
  312. role () {
  313. if (this.$store.state.user.roles.join().includes('manage')) {
  314. return 'workplace_store_manage'
  315. } else if (this.$store.state.user.roles.join().includes('normal')) {
  316. return 'workplace_store_normal'
  317. } else {
  318. return ''
  319. }
  320. }
  321. },
  322. created () {
  323. this.getDict()
  324. console.log(this.role)
  325. // this.getInfo()
  326. },
  327. mounted () {
  328. this.$nextTick(function () {
  329. this.getInfo()
  330. })
  331. },
  332. methods: {
  333. getDict () {
  334. this.typeDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE)
  335. this.typeDetailDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE)
  336. getWorkplaceBacklogTopData(this.role).then(res => {
  337. this.topData = res.data
  338. })
  339. },
  340. getInfo () {
  341. Promise.all([getWorkplaceBacklogWeekData(this.role), getWorkplaceBacklogPie(this.role)]).then(res => {
  342. console.log(res)
  343. this.lineData = res[0].data.inStoreDetailVOS.reduce((pre, item) => {
  344. pre.push({
  345. week: item.weekDayName,
  346. value: item.num,
  347. name: '入库'
  348. })
  349. return pre
  350. }, [])
  351. this.lineData.push(
  352. ...res[0].data.outStoreDetailVOS.reduce((pre, item) => {
  353. pre.push({
  354. week: item.weekDayName,
  355. value: item.num,
  356. name: '出库'
  357. })
  358. return pre
  359. }, [])
  360. )
  361. this.equipmentData = res[1].data.reduce((pre, item) => {
  362. pre.push({
  363. item: item.name,
  364. count: item.currentStock,
  365. percent: item.currentStock
  366. })
  367. return pre
  368. }, [])
  369. }).then(() => {
  370. this.getPieCharts('container-pie', this.equipmentData)
  371. this.getLineCharts('container-line', this.lineData)
  372. })
  373. },
  374. getPieCharts (id, data) {
  375. this.chartPie && this.chartPie.destroy()// 防止点击搜索按钮新增一个
  376. this.chartPie = new Chart({
  377. container: id,
  378. autoFit: true,
  379. height: 400
  380. })
  381. this.chartPie.data(data)
  382. this.chartPie.scale('count', {
  383. nice: true
  384. })
  385. this.chartPie.coordinate('theta', {
  386. radius: 0.6,
  387. innerRadius: 0.5
  388. })
  389. this.chartPie.tooltip({
  390. showTitle: false,
  391. showMarkers: false,
  392. itemTpl: `<li class="g2-tooltip-list-item">
  393. <span style="background-color:{color};" class="g2-tooltip-marker"></span>
  394. {name}: {value}
  395. </li>`
  396. })
  397. // 辅助文本
  398. this.chartPie
  399. .annotation()
  400. this.chartPie
  401. .interval()
  402. .adjust('stack')
  403. .position('percent')
  404. .color('item')
  405. .label('percent', (percent) => {
  406. return {
  407. content: (data) => {
  408. return `${data.item}: ${percent}`
  409. }
  410. }
  411. })
  412. .tooltip('item*count', (item, count) => {
  413. return {
  414. name: item,
  415. value: count
  416. }
  417. })
  418. // this.chartPie.interaction('element-active')
  419. this.chartPie.interaction('active-region')
  420. this.chartPie.render()
  421. },
  422. getLineCharts (id, data) {
  423. this.chartLine = new Chart({
  424. container: id,
  425. autoFit: true,
  426. height: 300
  427. })
  428. this.chartLine.data(data)
  429. this.chartLine.scale({
  430. value: {
  431. min: 0,
  432. nice: true
  433. }
  434. })
  435. this.chartLine.tooltip({
  436. showCrosshairs: true, // 展示 Tooltip 辅助线
  437. shared: true
  438. })
  439. this.chartLine.axis('value', {
  440. label: {
  441. formatter: (val) => {
  442. return val
  443. }
  444. }
  445. })
  446. this.chartLine.interval().position('week*value').color('name').adjust([
  447. {
  448. type: 'dodge',
  449. marginRatio: 0
  450. }
  451. ])
  452. this.chartLine.interaction('active-region')
  453. this.chartLine.render()
  454. }
  455. }
  456. }
  457. </script>
  458. <style scoped>
  459. .gutter-example >>> .ant-row > div {
  460. background: transparent;
  461. border: 0;
  462. font-family: PingFang SC;
  463. }
  464. .gutter-box {
  465. display:flex;
  466. flex-direction:column;
  467. justify-content: space-between;
  468. background: #fff;
  469. padding: 18px 41px;
  470. height: 170px;
  471. }
  472. .btn{
  473. height: 113px;
  474. width: 100%;
  475. color: #fff!important;
  476. font-size:28px;
  477. border-radius: 20px;
  478. display:flex;
  479. align-items: center;
  480. justify-content: space-around;
  481. }
  482. .information{
  483. background: #fff;
  484. padding: 30px 12px;
  485. height: 260px;
  486. color:#666;
  487. }
  488. .discolor{
  489. background: #EFEFFB;
  490. }
  491. .demo-infinite-container {
  492. overflow: auto;
  493. height: 190px;
  494. }
  495. ::-webkit-scrollbar { width: 0; height: 0; color: transparent; }
  496. </style>