WorkplaceBacklog.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468
  1. <template>
  2. <page-view :avatar="avatar" :title="false">
  3. <div slot="headerContent">
  4. <div class="title">{{ timeFix }},{{ user.realName }}<!--<span class="welcome-text">,{{ welcome }}</span>--></div>
  5. <!-- <div>前端工程师 | 蚂蚁金服 - 某某某事业群 - VUE平台</div>-->
  6. </div>
  7. <div slot="extra">
  8. </div>
  9. <a-card :bordered="false" v-show="dataFlag">
  10. <div v-show="visible">
  11. <div class="table-page-search-wrapper">
  12. <a-form layout="inline">
  13. <a-row :gutter="48">
  14. <a-col :md="4" :sm="24">
  15. <a-form-item label="内容">
  16. <a-input v-model="queryParam.content" placeholder="内容"/>
  17. </a-form-item>
  18. </a-col>
  19. <a-col :md="4" :sm="24">
  20. <a-form-item label="状态">
  21. <a-select :default-value="defaultValue" v-model="queryParam.status" placeholder="请选择">
  22. <a-select-option
  23. :key="1"
  24. label="未读"
  25. :value="1">未读
  26. </a-select-option>
  27. <a-select-option
  28. :key="2"
  29. label="已读"
  30. :value="2">已读
  31. </a-select-option>
  32. </a-select>
  33. </a-form-item>
  34. </a-col>
  35. <a-col :md="8 || 24" :sm="24">
  36. <span class="table-page-search-submitButtons">
  37. <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
  38. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  39. </span>
  40. </a-col>
  41. </a-row>
  42. </a-form>
  43. </div>
  44. <s-table
  45. ref="table"
  46. size="default"
  47. rowKey="id"
  48. :columns="columns"
  49. :data="loadData"
  50. showPagination="auto"
  51. >
  52. <span slot="action" slot-scope="record">
  53. <template>
  54. <a @click="handle(record)">详情</a>
  55. <a-divider v-if="record.status === 1" type="vertical" />
  56. <a v-if="record.status === 1" @click="dealJumpDetail(record)">跳转</a>
  57. </template>
  58. </span>
  59. <a slot="name" slot-scope="text" v-html="text"> {{ text }}</a>
  60. <span slot="content" slot-scope="text" v-html="text">
  61. </span>
  62. </s-table>
  63. </div>
  64. <detail ref="detail" />
  65. <detail-repair-application-form ref="detailRepairApplicationFormModal" @ok="handleOk"/>
  66. <detail-repair-application-form-repair ref="detailRepairApplicationFormRepairModal" @ok="handleOk"/>
  67. <detail-repair-application-form-check ref="detailRepairApplicationFormCheckModal" @ok="handleOk"/>
  68. <detail-out-store ref="detailOutStoreModal" @ok="handleOk"/>
  69. <detail-spare-pick ref="detailSparePickModal" @ok="handleOk"/>
  70. <sb-allocate-apply-detail ref="sbAllocateApplyDetail" @ok="handleOk" />
  71. </a-card>
  72. <sb-allocate-task-audit res="sbAllocateTaskAudit" v-if="sbAllocateTaskAuditShow" :target-id="targetId" @back="back" />
  73. <suplier-audit-form ref="supplierAuditModal" @ok="handleOk"/>
  74. <detail-audit-scrap ref="detailAuditScrapModal" @ok="handleOk"/>
  75. <detail-scrap ref="detailScrapModal" @ok="handleOk"/>
  76. </page-view>
  77. </template>
  78. <script>
  79. import { timeFix } from '@/utils/util'
  80. import { mapState } from 'vuex'
  81. import { PageView } from '@/layouts'
  82. import HeadInfo from '@/components/tools/HeadInfo'
  83. import { Radar, STable } from '@/components'
  84. import Detail from './modules/Detail'
  85. import SbAllocateApplyDetail from '@/views/sb/allocate-apply/modules/Detail'
  86. import SbAllocateTaskAudit from '@/views/sb/allocate-task/SbAllocateTaskAudit'
  87. import { getWorkplaceBacklogUserPage, updateWorkplaceBacklog, fetchWorkplaceBacklogUserById } from '@/api/workplace/backlog'
  88. import { fetchRepairApplicationForm } from '@/api/repair/application-form'
  89. import { fetchOutStoreForm } from '@/api/store/outstoreform'
  90. import { fetchPurchaseOrder } from '@/api/purchase/purchase-order'
  91. import { fetchPurchaseDispatchOrder } from '@/api/purchase/purchase-dispatch-order'
  92. import { fetchSparePickForm } from '@/api/store/sparepickform'
  93. import DetailRepairApplicationForm from '../../repair/application-form/modules/Detail'
  94. import DetailRepairApplicationFormRepair from '../../repair/application-form/modules/DetailRepair'
  95. import DetailRepairApplicationFormCheck from '../../repair/application-form/modules/DetailCheck'
  96. import DetailOutStore from '../../store/outstoreform/modules/Detail'
  97. import DetailSparePick from '../../store/sparepickform/modules/Detail'
  98. import { fetchSbOil } from '@/api/sb/oil'
  99. import { fetchSbAllocateApply } from '@/api/sb/allocate-apply'
  100. import SuplierAuditForm from '@/views/purchase/supplier/modules/AuditForm'
  101. import DetailAuditScrap from '@/views/sb/scrap/modules/DetailAuditScrap'
  102. import DetailScrap from '@/views/sb/scrap/modules/Detail'
  103. export default {
  104. name: 'Workplace',
  105. components: {
  106. PageView,
  107. STable,
  108. HeadInfo,
  109. Radar,
  110. Detail,
  111. DetailRepairApplicationForm,
  112. DetailRepairApplicationFormRepair,
  113. DetailRepairApplicationFormCheck,
  114. DetailOutStore,
  115. DetailSparePick,
  116. SbAllocateTaskAudit,
  117. SbAllocateApplyDetail,
  118. SuplierAuditForm,
  119. DetailAuditScrap,
  120. DetailScrap
  121. },
  122. data () {
  123. return {
  124. // 查询参数
  125. queryParam: {
  126. status: 1
  127. },
  128. defaultValue: 1,
  129. typeDict: {},
  130. typeDetailDict: {},
  131. leaderFlag: false,
  132. dataFlag: true,
  133. targetId: null,
  134. // 表头
  135. columns: [
  136. {
  137. title: '序号',
  138. dataIndex: 'index',
  139. align: 'center',
  140. customRender: (text, record, index) => {
  141. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  142. }
  143. },
  144. {
  145. title: '类型',
  146. dataIndex: 'type',
  147. align: 'center',
  148. customRender: (text, record, index) => {
  149. return this.typeDict[text]
  150. }
  151. },
  152. {
  153. title: '详细类型',
  154. dataIndex: 'detailType',
  155. align: 'center',
  156. customRender: (text, record, index) => {
  157. return this.typeDetailDict[text]
  158. }
  159. },
  160. {
  161. title: '内容',
  162. dataIndex: 'content',
  163. align: 'center',
  164. width: 400,
  165. scopedSlots: { customRender: 'content' }
  166. },
  167. {
  168. title: '时间',
  169. align: 'center',
  170. dataIndex: 'createdTime'
  171. },
  172. {
  173. title: '状态',
  174. align: 'center',
  175. dataIndex: 'status',
  176. customRender: (text, record, index) => {
  177. return (text === 1 ? '未读' : '已读')
  178. }
  179. },
  180. {
  181. title: '操作',
  182. key: 'action',
  183. align: 'center',
  184. scopedSlots: { customRender: 'action' }
  185. }
  186. ],
  187. // 加载数据方法 必须为 Promise 对象
  188. loadData: parameter => {
  189. parameter = {
  190. ...parameter,
  191. ...this.queryParam
  192. }
  193. return getWorkplaceBacklogUserPage(parameter)
  194. .then(res => {
  195. return res.data
  196. })
  197. },
  198. selectedRowKeys: [],
  199. selectedRows: [],
  200. options: {
  201. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  202. rowSelection: {
  203. selectedRowKeys: this.selectedRowKeys,
  204. onChange: this.onSelectChange
  205. }
  206. },
  207. optionAlertShow: false,
  208. timeFix: timeFix(),
  209. avatar: '',
  210. user: {},
  211. visible: true,
  212. sbOilTaskShow: false,
  213. sbOilAuditShow: false,
  214. sbAllocateTaskAuditShow: false,
  215. loading: true
  216. }
  217. },
  218. computed: {
  219. ...mapState({
  220. nickname: (state) => state.user.realName,
  221. welcome: (state) => state.user.welcome
  222. }),
  223. userInfo () {
  224. return this.$store.getters.userInfo
  225. }
  226. },
  227. created () {
  228. this.user = this.userInfo
  229. this.avatar = this.BaseTool.Constant.FILE_URL + this.userInfo.avatar
  230. this.getDict()
  231. this.tableOption()
  232. },
  233. mounted () {
  234. // this.getProjects()
  235. // this.getActivity()
  236. // this.getTeams()
  237. // this.initRadar()
  238. },
  239. methods: {
  240. tableOption () {
  241. this.options = {
  242. alert: false,
  243. rowSelection: null
  244. }
  245. this.optionAlertShow = false
  246. },
  247. handle (record) {
  248. // 已读
  249. if (record.status === 1) {
  250. updateWorkplaceBacklog({ id: record.backlogId }).then(res => {
  251. this.$refs.table.refresh()
  252. })
  253. }
  254. fetchWorkplaceBacklogUserById({ id: record.id }).then(res => {
  255. const data = res.data
  256. this.$refs.detail.base(data)
  257. })
  258. },
  259. dealJumpDetail (record) {
  260. // 维修跳转到维修详情
  261. if (record.type === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE, 'REPAIR')) {
  262. // 已读
  263. if (record.status === 1) {
  264. updateWorkplaceBacklog({ id: record.backlogId }).then(res => {
  265. record.status = 2
  266. })
  267. }
  268. if (record.detailType === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE, 'REPAIR_APPLICATION') ||
  269. record.detailType === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE, 'REPAIR_DISPATCH') ||
  270. record.detailType === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE, 'REPAIR_BACK') ||
  271. record.detailType === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE, 'REPAIR_RECEIVE') ||
  272. record.detailType === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE, 'REPAIR_APPLICATION_STOP')) {
  273. fetchRepairApplicationForm({ id: record.otherId }).then(res => {
  274. this.visible = false
  275. const modal = this.$refs.detailRepairApplicationFormRepairModal
  276. modal.base(res.data)
  277. })
  278. }
  279. if (record.detailType === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE, 'REPAIR_OK')) {
  280. fetchRepairApplicationForm({ id: record.otherId }).then(res => {
  281. this.visible = false
  282. const modal = this.$refs.detailRepairApplicationFormRepairModal
  283. modal.base(res.data)
  284. })
  285. }
  286. if (record.detailType === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE, 'REPAIR_FINISH')) {
  287. fetchRepairApplicationForm({ id: record.otherId }).then(res => {
  288. this.visible = false
  289. // const modal = this.$refs.detailRepairApplicationFormCheckModal
  290. const modal = this.$refs.detailRepairApplicationFormRepairModal
  291. modal.base(res.data)
  292. })
  293. }
  294. } else if (record.type === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE, 'OUT_STORE')) {
  295. this.visible = false
  296. fetchOutStoreForm({ id: record.otherId }).then(res => {
  297. const modal = this.$refs.detailOutStoreModal
  298. modal.base(res.data)
  299. })
  300. } else if (record.type === this.DictCache.getValueByCode(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE, 'SPARE_PICK')) {
  301. this.visible = false
  302. fetchSparePickForm({ id: record.otherId }).then(res => {
  303. const modal = this.$refs.detailSparePickModal
  304. modal.base(res.data)
  305. })
  306. } else if (record.type === this.DictCache.VALUE.WORKPLACE_BACKLOG_TYPE.SB_ALLOCATE) {
  307. this.targetId = record.targetId
  308. // 已读
  309. if (record.status === 1) {
  310. updateWorkplaceBacklog({ id: record.backlogId }).then(res => {
  311. })
  312. }
  313. // 设备调拨处理
  314. if (record.detailType === this.DictCache.VALUE.WORKPLACE_BACKLOG_DETAIL_TYPE.SB_ALLOCATE_APPLY_RESULT) {
  315. fetchSbAllocateApply({ id: record.targetId }).then(res => {
  316. const modal = this.$refs.sbAllocateApplyDetail
  317. modal.base(res.data)
  318. })
  319. } else if (record.detailType === this.DictCache.VALUE.WORKPLACE_BACKLOG_DETAIL_TYPE.SB_ALLOCATE_AUDIT_TASK) {
  320. this.dataFlag = false
  321. this.sbAllocateTaskAuditShow = true
  322. } else {
  323. this.$message.info('没有该类型消息通知,请联系管理员...')
  324. }
  325. } else if (record.type === this.DictCache.VALUE.WORKPLACE_BACKLOG_TYPE.SB_OIL) {
  326. // 已读
  327. if (record.status === 1) {
  328. updateWorkplaceBacklog({ id: record.backlogId }).then(res => {
  329. console.log('已置为已读')
  330. })
  331. }
  332. // 设备加油处理
  333. this.targetId = record.targetId
  334. if (record.detailType === this.DictCache.VALUE.WORKPLACE_BACKLOG_DETAIL_TYPE.SB_OIL_AUDIT_TASK) {
  335. this.dataFlag = false
  336. this.sbOilAuditShow = true
  337. } else if (record.detailType === this.DictCache.VALUE.WORKPLACE_BACKLOG_DETAIL_TYPE.SB_OIL_OIL) {
  338. this.dataFlag = false
  339. this.sbOilTaskShow = true
  340. } else if (record.detailType === this.DictCache.VALUE.WORKPLACE_BACKLOG_DETAIL_TYPE.SB_OIL_AUDIT_RESULT) {
  341. fetchSbOil({ id: this.targetId }).then(res => {
  342. const modal = this.$refs.sbOilDetail
  343. modal.base(res.data)
  344. })
  345. } else if (record.detailType === this.DictCache.VALUE.WORKPLACE_BACKLOG_DETAIL_TYPE.SB_OIL_OIL_CONFIRM) {
  346. fetchSbOil({ id: this.targetId }).then(res => {
  347. const sbOilModel = res.data
  348. if (this.$auth('sb-oils-confirm') && sbOilModel.status === this.DictCache.VALUE.SB_OIL_STATUS.OIL) {
  349. const modal = this.$refs.sbOilConfirmBaseForm
  350. modal.base(res.data)
  351. } else {
  352. const modal = this.$refs.sbOilDetail
  353. modal.base(res.data)
  354. }
  355. })
  356. } else {
  357. this.$message.info('没有该类型消息通知,请联系管理员...')
  358. }
  359. } else if (record.type === this.DictCache.VALUE.WORKPLACE_BACKLOG_TYPE.SB_SCRAP) {
  360. // 已读
  361. if (record.status === 1) {
  362. updateWorkplaceBacklog({ id: record.backlogId }).then(res => {
  363. console.log('已置为已读')
  364. })
  365. }
  366. if (record.detailType === this.DictCache.VALUE.WORKPLACE_BACKLOG_DETAIL_TYPE.SB_SCRAP) {
  367. this.visible = false
  368. const param = {
  369. targetId: record.otherId,
  370. taskId: record.targetId
  371. }
  372. this.$refs.detailAuditScrapModal.base(param)
  373. } else if (record.detailType === this.DictCache.VALUE.WORKPLACE_BACKLOG_DETAIL_TYPE.SB_SCRAP_RESULT) {
  374. this.visible = false
  375. const param = {
  376. targetId: record.otherId,
  377. taskId: record.targetId
  378. }
  379. this.$refs.detailScrapModal.base(param)
  380. }
  381. } else {
  382. this.$message.info('该类型的通知正在开发中,请稍后...')
  383. }
  384. },
  385. toPurchaseOrder (record) {
  386. const id = record.otherId ? record.otherId : record.targetId
  387. fetchPurchaseOrder({ id: id }).then(res => {
  388. this.$store.dispatch('setPurchaseNo', res.data.billNo)
  389. this.$router.push('/purchase/order')
  390. })
  391. },
  392. toDispatchOrder (record) {
  393. const id = record.otherId ? record.otherId : record.targetId
  394. fetchPurchaseDispatchOrder({ id: id }).then(res => {
  395. this.$store.dispatch('setPurchaseNo', res.data.billNo)
  396. this.$router.push('/purchase/dispatch/order')
  397. })
  398. },
  399. updateStatus (targetId) {
  400. updateWorkplaceBacklog({ id: targetId })
  401. },
  402. handleOk () {
  403. this.visible = true
  404. this.$refs.table.refresh()
  405. },
  406. resetSearchForm () {
  407. this.queryParam = {
  408. status: 1
  409. }
  410. this.$refs.table.refresh(true)
  411. },
  412. getDict () {
  413. this.typeDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_TYPE)
  414. this.typeDetailDict = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.WORKPLACE_BACKLOG_DETAIL_TYPE)
  415. },
  416. back () {
  417. this.leaderFlag = false
  418. this.sbOilTaskShow = false
  419. this.sbOilAuditShow = false
  420. this.sbAllocateTaskAuditShow = false
  421. this.dataFlag = true
  422. this.$refs.table.refresh()
  423. }
  424. }
  425. }
  426. </script>
  427. <style lang="less" scoped>
  428. .item-group {
  429. padding: 20px 0 8px 24px;
  430. font-size: 0;
  431. a {
  432. color: rgba(0, 0, 0, 0.65);
  433. display: inline-block;
  434. font-size: 14px;
  435. margin-bottom: 13px;
  436. width: 25%;
  437. }
  438. }
  439. .mobile {
  440. .project-list {
  441. .project-card-grid {
  442. width: 100%;
  443. }
  444. }
  445. .more-info {
  446. border: 0;
  447. padding-top: 16px;
  448. margin: 16px 0 16px;
  449. }
  450. .headerContent .title .welcome-text {
  451. display: none;
  452. }
  453. }
  454. </style>