NewWorkplaceBacklog.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  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><a href="/repair/form?type=1&searchType=6" target="_block">{{ topData.repairTotalNum }}</a></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="#F19149"/>
  14. <span style="color:#F19149;"><a style="color:#F19149;" target="_block" href="/repair/wait?type=1">待接单 &nbsp; {{ topData.completedRepairNum }}</a></span>
  15. </a-col>
  16. <a-col >
  17. <a-badge color="#E4007F"/>
  18. <span style="color:#E4007F;"><a style="color:#E4007F;" target="_block" href="/repair/form/mine?type=1">维修中 &nbsp; {{ topData.waitForRepairNum }}</a></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="#5864FF"/>
  24. <span style="color:#5864FF;"><a style="color:#5864FF;" target="_block" href="/repair/form?type=1&searchType=3">待审核 &nbsp; {{ topData.verifyRepairNum }}</a></span>
  25. </a-col>
  26. <a-col>
  27. <a-badge color="#009944"/>
  28. <span style="color:#009944;"><a style="color:#009944;" target="_block" href="/repair/form?type=1&searchType=5">已驳回 &nbsp; {{ topData.refusedRepairNum }}</a></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><a target="_block" href="/repair/form?type=2&searchType=6">{{ topData.outRepairTotalNum }}</a></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="#F19149"/>
  42. <span style="color:#F19149;"><a style="color:#F19149;" target="_block" href="/repair/wait?type=2">待接单 &nbsp; {{ topData.outCompletedRepairNum }}</a></span>
  43. </a-col>
  44. <a-col >
  45. <a-badge color="#E4007F"/>
  46. <span style="color:#E4007F;"><a style="color:#E4007F;" target="_block" href="/repair/form/mine?type=2">待维修 &nbsp; {{ topData.outWaitForRepairNum }}</a></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="#5864FF"/>
  52. <span style="color:#5864FF;"><a style="color:#5864FF;" target="_block" href="/repair/form?type=2&searchType=3">待审核 &nbsp; {{ topData.outVerifyRepairNum }}</a></span>
  53. </a-col>
  54. <a-col>
  55. <a-badge color="#009944"/>
  56. <span style="color:#009944;"><a style="color:#009944;" target="_block" href="/repair/form?type=2&searchType=5">已驳回 &nbsp; {{ topData.outRefusedRepairNum }}</a></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;"><a target="_block" :href="`/repair/form?repairStartTimeStart=${date.repairStartTimeStart}&repairStartTimeEnd=${date.repairStartTimeEnd}`">{{ topData.totalNum }}</a></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;"><a target="_block" :href="`/repair/fee?feeDateStart=${date.searchStartTime}&feeDateEnd=${date.searchEndTime}`">{{ topData.totalFee }}</a></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>
  83. <div id="container-pie"></div>
  84. </div>
  85. </a-col>
  86. <a-col class="gutter-row" :span="12">
  87. <div style="height: 471px;background: #FFFFFF; padding:24px;">
  88. <div style="display:flex;justify-content: space-between;width:190px;height: 18px; font-size:16px;color: #555555; margin-bottom:80px;">
  89. <div style="width: 7px;background: #4D86ED;"></div>
  90. <div>近一周每日产生维修单数</div>
  91. </div>
  92. <div id="container-line"></div>
  93. </div>
  94. </a-col>
  95. <a-col class="gutter-row" :span="4">
  96. <div style="height: 471px;display:flex;flex-direction:column;justify-content: space-between">
  97. <a style="color:#fff;" target="_block" href="/repair/form/mine?type=1">
  98. <div class="btn" style="background:linear-gradient(to right,#36B5FA,#26ECF5);" >
  99. <my-icon type="icon-weixiu" style="font-size:58px;"/>
  100. <span>维修</span>
  101. </div>
  102. </a>
  103. <div class="btn" style="background:linear-gradient(to right,#FF416D,#FF847F);" @click="$refs.repairForm.base({},{filter: -1})">
  104. <my-icon type="icon-baoxiu-xuanzhong-copy" style="font-size:58px;color:#fff;"/>
  105. <span>报修</span>
  106. </div>
  107. <div class="btn" style="background:linear-gradient(to right,#FB47D1,#F96EFE);" @click="$refs.sparePickForm.base()">
  108. <my-icon type="icon-tubiaozhizuomoban-copy" style="font-size:58px;color:#fff;"/>
  109. <span>领用</span>
  110. </div>
  111. <div class="btn" style="background:linear-gradient(to right,#941FFF,#BC72FB);" @click="$refs.sparebackform.base()">
  112. <my-icon type="icon-tuiku" style="font-size:58px;"/>
  113. <span>退库</span>
  114. </div>
  115. </div>
  116. </a-col>
  117. </a-row>
  118. </div>
  119. <div class="gutter-example">
  120. <a-row :gutter="20">
  121. <a-col class="gutter-row" :span="6">
  122. <div class="information">
  123. <div style="display:flex;justify-content: space-between;align-items: center; padding-bottom:20px;">
  124. <div style="display:flex; width:65px;height:17px;justify-content: space-between;align-items: center;">
  125. <div style=" width: 17px;height: 17px;background: #3462FD;border-radius: 50%;"></div>
  126. <div style="font-size: 18px;font-weight: 800;color: #333333;">资料</div>
  127. </div>
  128. <div >
  129. 查看全部
  130. <my-icon type="icon-xiangyou-copy" style="font-size:13px;"/>
  131. </div>
  132. </div>
  133. <div
  134. class="demo-infinite-container"
  135. >
  136. <a-list size="small" bordered :data-source="information">
  137. <a-list-item slot="renderItem" slot-scope="item,index" :class="{discolor: index%2}">
  138. <a-list-item-meta>
  139. <div slot="title" :href="item.href">{{ item.name }}</div>
  140. </a-list-item-meta>
  141. <div>{{ item.time }}</div>
  142. </a-list-item>
  143. </a-list>
  144. </div>
  145. </div>
  146. </a-col>
  147. <a-col class="gutter-row" :span="18">
  148. <div class="information">
  149. <div style="display:flex;justify-content: space-between;align-items: center; padding-bottom:20px;">
  150. <div style="display:flex; width:65px;height:17px;justify-content: space-between;align-items: center;">
  151. <div style=" width: 17px;height: 17px;background: #3462FD;border-radius: 50%;"></div>
  152. <div style="font-size: 18px;font-weight: 800;color: #333333;">通知</div>
  153. </div>
  154. <a href="WorkplaceBacklog" target="_block">
  155. 查看全部
  156. <my-icon type="icon-xiangyou-copy" style="font-size:13px;"/>
  157. </a>
  158. </div>
  159. <s-table
  160. ref="table"
  161. size="small"
  162. bordered
  163. rowKey="id"
  164. :columns="columns"
  165. :data="loadData"
  166. :pageSize="10"
  167. :scroll="{ y: 190 }"
  168. >
  169. <span slot="action" slot-scope="record">
  170. <template>
  171. <a @click="handle(record)">详情</a>
  172. <a-divider v-if="record.status === 1" type="vertical" />
  173. <a v-if="record.status === 1" @click="dealJumpDetail(record)">跳转</a>
  174. </template>
  175. </span>
  176. <span slot="content" slot-scope="text" v-html="text">
  177. </span>
  178. </s-table>
  179. </div>
  180. </a-col>
  181. </a-row>
  182. </div>
  183. <repair-form ref="repairForm"></repair-form>
  184. <SparePickForm ref="sparePickForm"></SparePickForm>
  185. <SpareBackForm ref="sparebackform"></SpareBackForm>
  186. </div>
  187. </template>
  188. <script>
  189. import { STable } from '@/components'
  190. import RepairForm from './modules/RepairBaseForm'
  191. import SpareBackForm from '@/views/store/sparebackform/modules/BaseForm'
  192. import SparePickForm from '@/views/store/sparepickform/modules/BaseForm'
  193. import { getWorkplaceBacklogUserPage, getWorkplaceBacklogTopData, getWorkplaceBacklogWeekData, getWorkplaceBacklogPie } from '@/api/workplace/backlog'
  194. import { Chart } from '@antv/g2'
  195. export default {
  196. name: 'NewWorkplaceBacklog',
  197. components: {
  198. STable,
  199. SparePickForm,
  200. SpareBackForm,
  201. RepairForm,
  202. Chart
  203. },
  204. data () {
  205. return {
  206. equipmentData: [],
  207. lineData: [],
  208. allCount: 100,
  209. chartPie: null,
  210. chartLine: null,
  211. topData: null,
  212. type: this.$route.query.type,
  213. date: {
  214. repairStartTimeStart: '',
  215. repairStartTimeEnd: '',
  216. searchStartTime: '',
  217. searchEndTime: ''
  218. },
  219. queryParam: {
  220. status: 1
  221. },
  222. information: [
  223. {
  224. name: '项目管理通知',
  225. time: '2022-4-7'
  226. },
  227. {
  228. name: '项目管理通知',
  229. time: '2022-4-7'
  230. },
  231. {
  232. name: '项目管理通知',
  233. time: '2022-4-7'
  234. },
  235. {
  236. name: '项目管理通知',
  237. time: '2022-4-7'
  238. }, {
  239. name: '项目管理通知',
  240. time: '2022-4-7'
  241. },
  242. {
  243. name: '项目管理通知',
  244. time: '2022-4-7'
  245. },
  246. {
  247. name: '项目管理通知',
  248. time: '2022-4-7'
  249. }
  250. ],
  251. columns: [
  252. {
  253. title: '序号',
  254. dataIndex: 'index',
  255. align: 'center',
  256. width: 50,
  257. customRender: (text, record, index) => {
  258. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  259. }
  260. },
  261. {
  262. title: '类型',
  263. dataIndex: 'type',
  264. align: 'center',
  265. width: 100,
  266. customRender: (text, record, index) => {
  267. return this.typeDict[text]
  268. }
  269. },
  270. {
  271. title: '详细类型',
  272. dataIndex: 'detailType',
  273. align: 'center',
  274. width: 140,
  275. customRender: (text, record, index) => {
  276. return this.typeDetailDict[text]
  277. }
  278. },
  279. {
  280. title: '内容',
  281. dataIndex: 'content',
  282. align: 'center',
  283. width: 460,
  284. ellipsis: true,
  285. scopedSlots: { customRender: 'content' }
  286. },
  287. {
  288. title: '时间',
  289. align: 'center',
  290. width: 160,
  291. dataIndex: 'createdTime'
  292. },
  293. {
  294. title: '状态',
  295. align: 'center',
  296. dataIndex: 'status',
  297. width: 100,
  298. customRender: (text, record, index) => {
  299. return (text === 1 ? '未读' : '已读')
  300. }
  301. },
  302. {
  303. title: '操作',
  304. key: 'action',
  305. width: 150,
  306. align: 'center',
  307. scopedSlots: { customRender: 'action' }
  308. }
  309. ],
  310. // 加载数据方法 必须为 Promise 对象
  311. loadData: parameter => {
  312. parameter = {
  313. ...parameter,
  314. ...this.queryParam
  315. }
  316. return getWorkplaceBacklogUserPage(parameter)
  317. .then(res => {
  318. return res.data
  319. })
  320. }
  321. }
  322. },
  323. computed: {
  324. role () {
  325. if (this.$store.state.user.roles.join().includes('manage')) {
  326. return 'workplace-repair-manage'
  327. } else if (this.$store.state.user.roles.join().includes('normal')) {
  328. return 'workplace-repair-normal'
  329. } else {
  330. return ''
  331. }
  332. }
  333. },
  334. created () {
  335. this.getdate()
  336. console.log(this.date)
  337. this.getDict()
  338. this.getInfo()
  339. },
  340. mounted () {
  341. },
  342. updated () {
  343. console.log(11)
  344. if (this.lineData.length > 0 && this.equipmentData.length > 0) {
  345. this.$nextTick(function () {
  346. console.log(1111)
  347. this.getPieCharts('container-pie')
  348. this.getLineCharts('container-line')
  349. })
  350. }
  351. },
  352. methods: {
  353. getdate () {
  354. const date = new Date()
  355. const year = date.getFullYear()
  356. const month = date.getMonth()
  357. this.date = {
  358. repairStartTimeStart: `${year}-0${month + 1}-01 00:00:00`,
  359. repairStartTimeEnd: this.BaseTool.Date.formatter(date, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN),
  360. searchStartTime: `${year}-0${month + 1}-01`,
  361. searchEndTime: this.BaseTool.Date.formatter(date, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN)
  362. }
  363. },
  364. getDict () {
  365. this.typeDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE)
  366. this.typeDetailDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE)
  367. },
  368. getInfo () {
  369. getWorkplaceBacklogWeekData(this.role).then(res => {
  370. const data = res.data.reduce((pre, item) => {
  371. pre.push({
  372. week: item.weekDayName,
  373. value: item.tempTotalNum
  374. })
  375. return pre
  376. }, [])
  377. this.lineData = data
  378. })
  379. getWorkplaceBacklogPie(this.role).then(res => {
  380. const data = res.data.reduce((pre, item) => {
  381. pre.push({
  382. item: item.typeName,
  383. count: item.fee,
  384. percent: item.fee
  385. })
  386. return pre
  387. }, [])
  388. this.equipmentData = data
  389. })
  390. getWorkplaceBacklogTopData(this.role).then(res => {
  391. this.topData = res.data
  392. })
  393. },
  394. getPieCharts (id) {
  395. this.chartPie && this.chartPie.destroy()// 防止点击搜索按钮新增一个
  396. this.chartPie = new Chart({
  397. container: id,
  398. autoFit: true,
  399. height: 400
  400. })
  401. this.chartPie.data(this.equipmentData)
  402. this.chartPie.scale('count', {
  403. nice: true
  404. })
  405. this.chartPie.coordinate('theta', {
  406. radius: 0.6,
  407. innerRadius: 0.5
  408. })
  409. this.chartPie.tooltip({
  410. showTitle: false,
  411. showMarkers: false,
  412. itemTpl: `<li class="g2-tooltip-list-item">
  413. <span style="background-color:{color};" class="g2-tooltip-marker"></span>
  414. {name}: {value}
  415. </li>`
  416. })
  417. // 辅助文本
  418. this.chartPie
  419. .annotation()
  420. this.chartPie
  421. .interval()
  422. .adjust('stack')
  423. .position('percent')
  424. .color('item')
  425. .label('percent', (percent) => {
  426. return {
  427. content: (data) => {
  428. return `${data.item}: ${percent}`
  429. }
  430. }
  431. })
  432. .tooltip('item*count', (item, count) => {
  433. return {
  434. name: item,
  435. value: count
  436. }
  437. })
  438. // this.chartPie.interaction('element-active')
  439. this.chartPie.interaction('active-region')
  440. this.chartPie.render()
  441. },
  442. getLineCharts (id) {
  443. this.chartLine = new Chart({
  444. container: id,
  445. autoFit: true,
  446. height: 300
  447. })
  448. this.chartLine.data(this.lineData)
  449. this.chartLine.scale({
  450. week: {
  451. range: [0, 1]
  452. },
  453. value: {
  454. min: 0,
  455. nice: true
  456. }
  457. })
  458. this.chartLine.tooltip({
  459. showCrosshairs: true, // 展示 Tooltip 辅助线
  460. shared: true
  461. })
  462. this.chartLine.axis('value', {
  463. label: {
  464. formatter: (val) => {
  465. return val
  466. }
  467. }
  468. })
  469. this.chartLine.area().position('week*value')
  470. this.chartLine.line().position('week*value')
  471. this.chartLine.render()
  472. }
  473. }
  474. }
  475. </script>
  476. <style scoped>
  477. .gutter-example >>> .ant-row > div {
  478. background: transparent;
  479. border: 0;
  480. font-family: PingFang SC;
  481. }
  482. .gutter-box {
  483. display:flex;
  484. flex-direction:column;
  485. justify-content: space-between;
  486. background: #fff;
  487. padding: 18px 41px;
  488. height: 170px;
  489. }
  490. .btn{
  491. height: 113px;
  492. width: 100%;
  493. color: #fff!important;
  494. font-size:28px;
  495. border-radius: 20px;
  496. display:flex;
  497. align-items: center;
  498. justify-content: space-around;
  499. }
  500. .btn:hover{
  501. cursor:pointer;
  502. }
  503. .information{
  504. background: #fff;
  505. padding: 30px 12px;
  506. height: 500px;
  507. color:#666;
  508. }
  509. .discolor{
  510. background: #EFEFFB;
  511. }
  512. .demo-infinite-container {
  513. overflow: auto;
  514. height: 430px;
  515. }
  516. ::-webkit-scrollbar { width: 0; height: 0; color: transparent; }
  517. </style>