StoreWorkplaceBacklog.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  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. 查看全部
  150. <my-icon type="icon-xiangyou-copy" style="font-size:13px;"/>
  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>
  159. <div slot="title" :href="item.href">{{ item.name }}</div>
  160. </a-list-item-meta>
  161. <div>{{ item.time }}</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. </div>
  198. </template>
  199. <script>
  200. import AddStore from '@/views/store/store/modules/BaseForm.vue'
  201. import InBaseFrom from '@/views/store/instoreform/modules/BaseForm.vue'
  202. import OutBaseFrom from '@/views/store/outstoreform/modules/BaseForm.vue'
  203. import { STable } from '@/components'
  204. import { getWorkplaceBacklogUserPage, getWorkplaceBacklogTopData, getWorkplaceBacklogWeekData, getWorkplaceBacklogPie } from '@/api/workplace/backlog'
  205. import { Chart } from '@antv/g2'
  206. export default {
  207. name: 'NewWorkplaceBacklog',
  208. components: {
  209. STable,
  210. AddStore,
  211. InBaseFrom,
  212. OutBaseFrom,
  213. Chart
  214. },
  215. data () {
  216. return {
  217. visible: true,
  218. equipmentData: [
  219. ],
  220. lineData: [
  221. ],
  222. storeNums: 0,
  223. allCount: 100,
  224. chartPie: null,
  225. chartLine: null,
  226. topData: null,
  227. queryParam: {
  228. status: 1
  229. },
  230. information: [
  231. {
  232. name: '项目管理通知',
  233. time: '2022-4-7'
  234. },
  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. name: '项目管理通知',
  248. time: '2022-4-7'
  249. },
  250. {
  251. name: '项目管理通知',
  252. time: '2022-4-7'
  253. },
  254. {
  255. name: '项目管理通知',
  256. time: '2022-4-7'
  257. }
  258. ],
  259. columns: [
  260. {
  261. title: '序号',
  262. dataIndex: 'index',
  263. align: 'center',
  264. width: 50,
  265. customRender: (text, record, index) => {
  266. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  267. }
  268. },
  269. {
  270. title: '类型',
  271. dataIndex: 'type',
  272. align: 'center',
  273. width: 100,
  274. customRender: (text, record, index) => {
  275. return this.typeDict[text]
  276. }
  277. },
  278. {
  279. title: '详细类型',
  280. dataIndex: 'detailType',
  281. align: 'center',
  282. width: 140,
  283. customRender: (text, record, index) => {
  284. return this.typeDetailDict[text]
  285. }
  286. },
  287. {
  288. title: '内容',
  289. dataIndex: 'content',
  290. align: 'center',
  291. width: 460,
  292. ellipsis: true,
  293. scopedSlots: { customRender: 'content' }
  294. },
  295. {
  296. title: '时间',
  297. align: 'center',
  298. width: 160,
  299. dataIndex: 'createdTime'
  300. },
  301. {
  302. title: '状态',
  303. align: 'center',
  304. dataIndex: 'status',
  305. width: 100,
  306. customRender: (text, record, index) => {
  307. return (text === 1 ? '未读' : '已读')
  308. }
  309. },
  310. {
  311. title: '操作',
  312. key: 'action',
  313. width: 150,
  314. align: 'center',
  315. scopedSlots: { customRender: 'action' }
  316. }
  317. ],
  318. // 加载数据方法 必须为 Promise 对象
  319. loadData: parameter => {
  320. parameter = {
  321. ...parameter,
  322. ...this.queryParam
  323. }
  324. return getWorkplaceBacklogUserPage(parameter)
  325. .then(res => {
  326. return res.data
  327. })
  328. }
  329. }
  330. },
  331. computed: {
  332. role () {
  333. if (this.$store.state.user.roles.join().includes('manage')) {
  334. return 'workplace_store_manage'
  335. } else if (this.$store.state.user.roles.join().includes('normal')) {
  336. return 'workplace_store_normal'
  337. } else {
  338. return ''
  339. }
  340. }
  341. },
  342. created () {
  343. this.getDict()
  344. this.getInfo()
  345. },
  346. mounted () {
  347. },
  348. updated () {
  349. if (this.lineData.length > 0 && this.equipmentData.length > 0) {
  350. this.$nextTick(function () {
  351. this.getPieCharts('container-pie', this.equipmentData)
  352. this.getLineCharts('container-line', this.lineData)
  353. })
  354. }
  355. },
  356. methods: {
  357. getDict () {
  358. this.typeDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE)
  359. this.typeDetailDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE)
  360. },
  361. getInfo () {
  362. Promise.all([
  363. getWorkplaceBacklogWeekData(this.role),
  364. getWorkplaceBacklogPie(this.role),
  365. getWorkplaceBacklogTopData(this.role)
  366. ]).then(res => {
  367. const data = res[0].data.inStoreDetailVOS.reduce((pre, item) => {
  368. pre.push({
  369. week: item.weekDayName,
  370. value: item.num,
  371. name: '入库'
  372. })
  373. return pre
  374. }, [])
  375. data.push(
  376. ...res[0].data.outStoreDetailVOS.reduce((pre, item) => {
  377. pre.push({
  378. week: item.weekDayName,
  379. value: item.num,
  380. name: '出库'
  381. })
  382. return pre
  383. }, [])
  384. )
  385. this.lineData = data
  386. const data2 = res[1].data.reduce((pre, item) => {
  387. pre.push({
  388. item: item.name,
  389. count: item.currentStock,
  390. percent: item.currentStock
  391. })
  392. return pre
  393. }, [])
  394. this.equipmentData = data2
  395. this.topData = res[2].data
  396. })
  397. },
  398. getPieCharts (id, data) {
  399. this.chartPie && this.chartPie.destroy()// 防止点击搜索按钮新增一个
  400. this.chartPie = new Chart({
  401. container: id,
  402. autoFit: true,
  403. height: 400
  404. })
  405. this.chartPie.data(data)
  406. this.chartPie.scale('count', {
  407. nice: true
  408. })
  409. this.chartPie.coordinate('theta', {
  410. radius: 0.6,
  411. innerRadius: 0.5
  412. })
  413. this.chartPie.tooltip({
  414. showTitle: false,
  415. showMarkers: false,
  416. itemTpl: `<li class="g2-tooltip-list-item">
  417. <span style="background-color:{color};" class="g2-tooltip-marker"></span>
  418. {name}: {value}
  419. </li>`
  420. })
  421. // 辅助文本
  422. this.chartPie
  423. .annotation()
  424. this.chartPie
  425. .interval()
  426. .adjust('stack')
  427. .position('percent')
  428. .color('item')
  429. .label('percent', (percent) => {
  430. return {
  431. content: (data) => {
  432. return `${data.item}: ${percent}`
  433. }
  434. }
  435. })
  436. .tooltip('item*count', (item, count) => {
  437. return {
  438. name: item,
  439. value: count
  440. }
  441. })
  442. // this.chartPie.interaction('element-active')
  443. this.chartPie.interaction('active-region')
  444. this.chartPie.render()
  445. },
  446. getLineCharts (id, data) {
  447. this.chartLine = new Chart({
  448. container: id,
  449. autoFit: true,
  450. height: 300
  451. })
  452. this.chartLine.data(data)
  453. this.chartLine.scale({
  454. value: {
  455. min: 0,
  456. nice: true
  457. }
  458. })
  459. this.chartLine.tooltip({
  460. showCrosshairs: true, // 展示 Tooltip 辅助线
  461. shared: true
  462. })
  463. this.chartLine.axis('value', {
  464. label: {
  465. formatter: (val) => {
  466. return val
  467. }
  468. }
  469. })
  470. this.chartLine.interval().position('week*value').color('name').adjust([
  471. {
  472. type: 'dodge',
  473. marginRatio: 0
  474. }
  475. ])
  476. this.chartLine.interaction('active-region')
  477. this.chartLine.render()
  478. },
  479. handleOk () {
  480. this.visible = true
  481. this.getDict()
  482. },
  483. handleInAdd () {
  484. this.visible = false
  485. const modal = this.$refs.inBaseModal
  486. modal.base()
  487. },
  488. handleOutAdd () {
  489. this.visible = false
  490. const modal = this.$refs.outBaseModal
  491. modal.base()
  492. }
  493. }
  494. }
  495. </script>
  496. <style scoped>
  497. .gutter-example >>> .ant-row > div {
  498. background: transparent;
  499. border: 0;
  500. font-family: PingFang SC;
  501. }
  502. .gutter-box {
  503. display:flex;
  504. flex-direction:column;
  505. justify-content: space-between;
  506. background: #fff;
  507. padding: 18px 41px;
  508. height: 170px;
  509. }
  510. .btn{
  511. height: 113px;
  512. width: 100%;
  513. color: #fff!important;
  514. font-size:28px;
  515. border-radius: 20px;
  516. display:flex;
  517. align-items: center;
  518. justify-content: space-around;
  519. }
  520. .information{
  521. background: #fff;
  522. padding: 30px 12px;
  523. height: 260px;
  524. color:#666;
  525. }
  526. .discolor{
  527. background: #EFEFFB;
  528. }
  529. .demo-infinite-container {
  530. overflow: auto;
  531. height: 190px;
  532. }
  533. ::-webkit-scrollbar { width: 0; height: 0; color: transparent; }
  534. </style>