StoreWorkplaceBacklog.vue 19 KB

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