WorkplaceBacklog.vue 16 KB

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