NewWorkplaceBacklog.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  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" style="color:#3066EC ;" 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 style="width:110px;">
  13. <a-badge color="#3066EC " />
  14. <span style="color:#3066EC ;"><a style="color:#3066EC ;" target="_block" href="/repair/wait?type=1">待接单 &nbsp; {{ topData.completedRepairNum }}</a></span>
  15. </a-col>
  16. <a-col style="width:110px;">
  17. <a-badge color="#3066EC " />
  18. <span style="color:#3066EC ;"><a style="color:#3066EC ;" 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 style="width:110px;">
  23. <a-badge color="#3066EC " />
  24. <span style="color:#3066EC ;"><a style="color:#3066EC ;" target="_block" href="/repair/form?type=1&searchType=3">待审核 &nbsp; {{ topData.verifyRepairNum }}</a></span>
  25. </a-col>
  26. <a-col style="width:110px;">
  27. <a-badge color="#3066EC " />
  28. <span style="color:#3066EC ;"><a style="color:#3066EC ;" 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" style="color:#3066EC ;" 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 style="width:110px;">
  41. <a-badge color="#3066EC " />
  42. <span style="color:#3066EC ;"><a style="color:#3066EC ;" target="_block" href="/repair/wait?type=2">待接单 &nbsp; {{ topData.outCompletedRepairNum }}</a></span>
  43. </a-col>
  44. <a-col style="width:110px;">
  45. <a-badge color="#3066EC " />
  46. <span style="color:#3066EC ;"><a style="color:#3066EC ;" 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 style="width:110px;">
  51. <a-badge color="#3066EC " />
  52. <span style="color:#3066EC ;"><a style="color:#3066EC ;" target="_block" href="/repair/form?type=2&searchType=3">待审核 &nbsp; {{ topData.outVerifyRepairNum }}</a></span>
  53. </a-col>
  54. <a-col style="width:110px;">
  55. <a-badge color="#3066EC " />
  56. <span style="color:#3066EC ;"><a style="color:#3066EC ;" 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:26px; line-height: 60px;">
  64. <div>本月维修总计</div>
  65. <div style="font-size:24px;"><a style="color:#3066EC ;" 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:26px;line-height: 60px;">
  69. <div>本月维修费用</div>
  70. <div style="font-size:24px;"><a style="color:#3066EC ;" 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. <chart-view height="400px" :chartOption="chartOption1" />
  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:20px;">
  89. <div style="width: 7px;background: #4D86ED;"></div>
  90. <div>近一周每日产生维修单数</div>
  91. </div>
  92. <chart-view height="360px" :chartOption="chartOption2" />
  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,#3066EC);">
  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,#36B5FA,#3066EC);" @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,#36B5FA,#3066EC);" @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,#36B5FA,#3066EC);" @click="$refs.sparebackform.base()">
  112. <!-- <my-icon type="icon-tuiku" style="font-size:58px; color:#fff;"/> -->
  113. <img src="@/assets/tuiku.png" width="60px" alt="">
  114. <span>退库</span>
  115. </div>
  116. </div>
  117. </a-col>
  118. </a-row>
  119. </div>
  120. <div class="gutter-example">
  121. <a-row :gutter="20">
  122. <a-col class="gutter-row" :span="6">
  123. <div class="information">
  124. <div style="display:flex;justify-content: space-between;align-items: center; padding-bottom:20px;">
  125. <div style="display:flex; width:65px;height:17px;justify-content: space-between;align-items: center;">
  126. <div style=" width: 17px;height: 17px;background: #3462FD;border-radius: 50%;"></div>
  127. <div style="font-size: 18px;font-weight: 800;color: #333333;">资料</div>
  128. </div>
  129. <div>
  130. <a href="/operate/article/Article" target="_block"> 查看全部
  131. <my-icon type="icon-xiangyou-copy" style="font-size:13px;" /></a>
  132. </div>
  133. </div>
  134. <div class="demo-infinite-container">
  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 @click="handleView(item)">
  138. <div slot="title" style="cursor:pointer">{{ item.title }}</div>
  139. </a-list-item-meta>
  140. <div>{{ item.updateTime }}</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. <div style="display:flex;justify-content: space-between;align-items: center; padding-bottom:20px;">
  149. <div style="display:flex; width:65px;height:17px;justify-content: space-between;align-items: center;">
  150. <div style=" width: 17px;height: 17px;background: #3462FD;border-radius: 50%;"></div>
  151. <div style="font-size: 18px;font-weight: 800;color: #333333;">通知</div>
  152. </div>
  153. <a href="WorkplaceBacklog" target="_block">
  154. 查看全部
  155. <my-icon type="icon-xiangyou-copy" style="font-size:13px;" />
  156. </a>
  157. </div>
  158. <s-table ref="table" size="small" bordered rowKey="id" :columns="columns" :data="loadData" :pageSize="10" :scroll="{ y: 400 }">
  159. <span slot="action" slot-scope="record">
  160. <template>
  161. <a @click="handle(record)">详情</a>
  162. <a-divider v-if="record.status === 1" type="vertical" />
  163. <a v-if="record.status === 1" @click="dealJumpDetail(record)">跳转</a>
  164. </template>
  165. </span>
  166. <span slot="content" slot-scope="text" v-html="text">
  167. </span>
  168. </s-table>
  169. </div>
  170. </a-col>
  171. </a-row>
  172. </div>
  173. <detail ref="detailModal"></detail>
  174. <repair-form ref="repairForm"></repair-form>
  175. <SparePickForm ref="sparePickForm"></SparePickForm>
  176. <SpareBackForm ref="sparebackform"></SpareBackForm>
  177. </div>
  178. </template>
  179. <script>
  180. import { STable } from '@/components'
  181. import Detail from '@/views/operate/article/modules/Detail.vue'
  182. import RepairForm from '@/views/repair/application-form/modules/BaseForm.vue'
  183. import SpareBackForm from '@/views/store/sparebackform/modules/BaseForm'
  184. import SparePickForm from '@/views/store/sparepickform/modules/BaseForm'
  185. import { getArticlePage, fetchArticle } from '@/api/operate/article'
  186. import {
  187. getWorkplaceBacklogUserPage,
  188. getWorkplaceBacklogTopData,
  189. getWorkplaceBacklogWeekData,
  190. getWorkplaceBacklogPie,
  191. } from '@/api/workplace/backlog'
  192. import { getCalendarNotice } from '@/api/repair/application-form'
  193. import { Chart } from '@antv/g2'
  194. import cookie from 'vue-cookie'
  195. export default {
  196. name: 'NewWorkplaceBacklog',
  197. components: {
  198. STable,
  199. Detail,
  200. SparePickForm,
  201. SpareBackForm,
  202. RepairForm,
  203. Chart,
  204. },
  205. data() {
  206. return {
  207. equipmentData: [],
  208. lineData: [],
  209. allCount: 100,
  210. chartPie: null,
  211. chartLine: null,
  212. topData: null,
  213. type: this.$route.query.type,
  214. date: {
  215. repairStartTimeStart: '',
  216. repairStartTimeEnd: '',
  217. searchStartTime: '',
  218. searchEndTime: '',
  219. },
  220. queryParam: {
  221. status: 1,
  222. },
  223. information: [],
  224. columns: [
  225. {
  226. title: '序号',
  227. dataIndex: 'index',
  228. align: 'center',
  229. width: 50,
  230. customRender: (text, record, index) => {
  231. return `${
  232. (this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1
  233. }`
  234. },
  235. },
  236. {
  237. title: '类型',
  238. dataIndex: 'type',
  239. align: 'center',
  240. width: 100,
  241. customRender: (text, record, index) => {
  242. return this.typeDict[text]
  243. },
  244. },
  245. {
  246. title: '详细类型',
  247. dataIndex: 'detailType',
  248. align: 'center',
  249. width: 140,
  250. customRender: (text, record, index) => {
  251. return this.typeDetailDict[text]
  252. },
  253. },
  254. {
  255. title: '内容',
  256. dataIndex: 'content',
  257. align: 'center',
  258. width: 460,
  259. ellipsis: true,
  260. scopedSlots: { customRender: 'content' },
  261. },
  262. {
  263. title: '时间',
  264. align: 'center',
  265. width: 160,
  266. dataIndex: 'createdTime',
  267. },
  268. {
  269. title: '状态',
  270. align: 'center',
  271. dataIndex: 'status',
  272. width: 100,
  273. customRender: (text, record, index) => {
  274. return text === 1 ? '未读' : '已读'
  275. },
  276. },
  277. {
  278. title: '操作',
  279. key: 'action',
  280. width: 150,
  281. align: 'center',
  282. scopedSlots: { customRender: 'action' },
  283. },
  284. ],
  285. // 加载数据方法 必须为 Promise 对象
  286. loadData: (parameter) => {
  287. parameter = {
  288. ...parameter,
  289. ...this.queryParam,
  290. }
  291. return getWorkplaceBacklogUserPage(parameter).then((res) => {
  292. return res.data
  293. })
  294. },
  295. }
  296. },
  297. computed: {
  298. role() {
  299. if (this.$store.state.user.roles.join().includes('workplace-repair-manage')) {
  300. return 'workplace-repair-manage'
  301. } else if (this.$store.state.user.roles.join().includes('workplace-repair-normal')) {
  302. return 'workplace-repair-normal'
  303. } else {
  304. return 'undifined'
  305. }
  306. },
  307. chartOption1() {
  308. return {
  309. legend: {
  310. top: '10%',
  311. type: 'scroll',
  312. },
  313. grid: {
  314. left: '3%',
  315. right: '4%',
  316. bottom: '3%',
  317. containLabel: true,
  318. },
  319. series: [
  320. {
  321. type: 'pie',
  322. center: ['50%', '50%'],
  323. radius: [50, 100],
  324. label: {
  325. formatter: `{b}:{c}`,
  326. textBorderColor: '#000',
  327. textBorderWidth: 0,
  328. fontSize: 16,
  329. overflow: 'breakAll',
  330. labelLine: {
  331. length: 3,
  332. },
  333. },
  334. data: this.equipmentData,
  335. },
  336. ],
  337. }
  338. },
  339. chartOption2() {
  340. return {
  341. // tooltip: {
  342. // trigger: 'axis',
  343. // axisPointer: {
  344. // type: 'shadow'
  345. // }
  346. // },
  347. legend: {},
  348. grid: {
  349. left: '3%',
  350. right: '4%',
  351. bottom: '3%',
  352. containLabel: true,
  353. },
  354. yAxis: {
  355. type: 'value',
  356. },
  357. xAxis: {
  358. type: 'category',
  359. data: this.lineData.map((item) => item.weekDayName),
  360. },
  361. series: [
  362. {
  363. name: '维修单数',
  364. type: 'bar',
  365. data: this.lineData.map((item) => item.tempTotalNum),
  366. itemStyle: {
  367. normal: {
  368. label: {
  369. show: true, // 开启显示
  370. position: 'top', // 在上方显示
  371. textStyle: {
  372. // 数值样式
  373. color: 'black',
  374. fontSize: 16,
  375. },
  376. },
  377. },
  378. },
  379. },
  380. ],
  381. }
  382. },
  383. },
  384. created() {
  385. this.getdate()
  386. this.getDict()
  387. this.toCalendar()
  388. this.getInfo()
  389. },
  390. methods: {
  391. getdate() {
  392. const date = new Date()
  393. const year = date.getFullYear()
  394. const month = date.getMonth()
  395. this.date = {
  396. repairStartTimeStart: `${year}-0${month + 1}-01 00:00:00`,
  397. repairStartTimeEnd: this.BaseTool.Date.formatter(date, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN),
  398. searchStartTime: `${year}-0${month + 1}-01`,
  399. searchEndTime: this.BaseTool.Date.formatter(date, this.BaseTool.Date.PICKER_NORM_DATE_PATTERN),
  400. }
  401. },
  402. getDict() {
  403. this.typeDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE)
  404. this.typeDetailDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE)
  405. },
  406. getInfo() {
  407. if (this.role === 'undifined') {
  408. // this.$error('您的角色未赋予该权限')
  409. alert('您的角色未赋予该权限')
  410. this.$router.push({ path: '/workplace' })
  411. }
  412. getWorkplaceBacklogTopData(this.role).then((res) => {
  413. this.topData = res.data
  414. })
  415. getArticlePage({
  416. pageNum: 1,
  417. pageSize: 10,
  418. dataScope: {
  419. sortBy: 'desc',
  420. sortName: 'update_time',
  421. },
  422. }).then((res) => {
  423. this.information = res.data.rows
  424. })
  425. getWorkplaceBacklogWeekData(this.role).then((res) => {
  426. this.lineData = res.data
  427. })
  428. getWorkplaceBacklogPie(this.role).then((res) => {
  429. const data = res.data.reduce((pre, item) => {
  430. pre.push({
  431. name: item.typeName,
  432. value: item.fee,
  433. })
  434. return pre
  435. }, [])
  436. this.$nextTick(() => {})
  437. this.equipmentData = data
  438. })
  439. },
  440. handleView(record) {
  441. fetchArticle({ id: record.id }).then((res) => {
  442. const modal = this.$refs.detailModal
  443. modal.base(res.data)
  444. })
  445. },
  446. toCalendar() {
  447. const repairTips = cookie.get('repairTips')
  448. if (repairTips === '1') {
  449. getCalendarNotice().then((res) => {
  450. const router = this.$router
  451. cookie.set('repairTips', 2, 7)
  452. if (res.data !== null && res.data.length > 0) {
  453. this.$confirm({
  454. title: '提示',
  455. content: () => {
  456. return (
  457. <div>
  458. 近一周工单任务如下: <br />
  459. {res.data.map((item) => {
  460. return <div>{item.calendarDate + ' : ' + item.num}</div>
  461. })}
  462. </div>
  463. )
  464. },
  465. okText: '去查看',
  466. icon: 'info-circle',
  467. onOk() {
  468. return new Promise((resolve, reject) => {
  469. router.push({ path: '/repaire/calendar' })
  470. resolve()
  471. }).catch((err) => {
  472. this.$message.error({
  473. title: '错误',
  474. description: err.message,
  475. })
  476. })
  477. },
  478. onCancel() {},
  479. })
  480. }
  481. })
  482. }
  483. },
  484. },
  485. }
  486. </script>
  487. <style scoped>
  488. .gutter-example >>> .ant-row > div {
  489. background: transparent;
  490. border: 0;
  491. font-family: PingFang SC;
  492. }
  493. .gutter-box {
  494. display: flex;
  495. flex-direction: column;
  496. justify-content: space-between;
  497. background: #fff;
  498. padding: 18px 41px;
  499. height: 170px;
  500. }
  501. .btn {
  502. height: 113px;
  503. width: 100%;
  504. color: #fff !important;
  505. font-size: 28px;
  506. border-radius: 20px;
  507. display: flex;
  508. align-items: center;
  509. justify-content: space-around;
  510. }
  511. .btn:hover {
  512. cursor: pointer;
  513. }
  514. .information {
  515. background: #fff;
  516. padding: 30px 12px;
  517. height: 500px;
  518. color: #666;
  519. }
  520. .discolor {
  521. background: #efeffb;
  522. }
  523. .demo-infinite-container {
  524. overflow: auto;
  525. height: 400px;
  526. }
  527. /deep/ .ant-table-placeholder {
  528. height: 360px;
  529. display: flex;
  530. flex-direction: column;
  531. align-items: center;
  532. justify-content: center;
  533. }
  534. ::-webkit-scrollbar {
  535. width: 0;
  536. height: 0;
  537. color: transparent;
  538. }
  539. </style>