TransferApproval.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <a-card :bordered="false">
  3. <div class="table-page-search-wrapper">
  4. <a-form layout="inline">
  5. <a-row :gutter="48">
  6. <a-col :md="6" :sm="24">
  7. <a-form-item label="关键字">
  8. <a-input v-model="queryParam.keyword" placeholder="设备名称/编号/问题描述" />
  9. </a-form-item>
  10. </a-col>
  11. <a-col :md="6" :sm="24">
  12. <a-form-item label="报修起始日期">
  13. <a-date-picker v-model="queryParam.searchStartTime" style="width: 100%"
  14. :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN" />
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="报修结束日期">
  19. <a-date-picker v-model="queryParam.searchEndTime" style="width: 100%"
  20. :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN" />
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="8 || 24" :sm="24">
  24. <span class="table-page-search-submitButtons">
  25. <a-button type="primary" @click="handleOk()">查询</a-button>
  26. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  27. </span>
  28. </a-col>
  29. </a-row>
  30. </a-form>
  31. </div>
  32. <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData"
  33. :scroll="{ x: 1000, y: BaseTool.Constant.scrollY }" showPagination="auto">
  34. <span slot="action" slot-scope="record">
  35. <template>
  36. <a @click="handleView(record)">查看</a>
  37. <a-divider type="vertical" />
  38. <a-popconfirm title="确认通过该转派申请?" @confirm="handleApprove(record)">
  39. <a>通过</a>
  40. </a-popconfirm>
  41. <a-divider type="vertical" />
  42. <a @click="handleReject(record)">驳回</a>
  43. </template>
  44. </span>
  45. <span slot="status" slot-scope="text">
  46. <badge :text="BaseTool.Object.getField(statusMap, text)"
  47. :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[text]" />
  48. </span>
  49. </s-table>
  50. <detail ref="detailModal" @ok="handleOk" />
  51. <transfer-approve-form ref="approveForm" @ok="handleOk" />
  52. </a-card>
  53. </template>
  54. <script>
  55. import { STable, Ellipsis } from '@/components'
  56. import Detail from './modules/DetailRepair'
  57. import TransferApproveForm from './modules/TransferApproveForm'
  58. import { getRepairApplicationFormPage, fetchRepairApplicationForm, transferApprove, transferReject } from '@/api/repair/application-form'
  59. export default {
  60. name: 'TransferApproval',
  61. components: {
  62. STable,
  63. Ellipsis,
  64. Detail,
  65. TransferApproveForm
  66. },
  67. data() {
  68. return {
  69. queryParam: {
  70. status: 8,
  71. searchStartTime: null,
  72. searchEndTime: null
  73. },
  74. statusMap: {},
  75. columns: [
  76. {
  77. title: '序号',
  78. dataIndex: 'index',
  79. width: '70px',
  80. customRender: (text, record, index) => {
  81. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  82. }
  83. },
  84. {
  85. title: '报修单号',
  86. width: '150px',
  87. dataIndex: 'no'
  88. },
  89. {
  90. title: '设备编号',
  91. width: '120px',
  92. dataIndex: 'sbNo'
  93. },
  94. {
  95. title: '设备名称',
  96. width: '150px',
  97. dataIndex: 'sbName'
  98. },
  99. {
  100. title: '报修人',
  101. width: '100px',
  102. dataIndex: 'actualUser'
  103. },
  104. {
  105. title: '当前维修人',
  106. width: '120px',
  107. dataIndex: 'repairUserName'
  108. },
  109. {
  110. title: '报修时间',
  111. width: '180px',
  112. dataIndex: 'applyTime'
  113. },
  114. {
  115. title: '状态',
  116. width: '120px',
  117. fixed: 'right',
  118. dataIndex: 'status',
  119. scopedSlots: { customRender: 'status' }
  120. },
  121. {
  122. title: '操作',
  123. fixed: 'right',
  124. key: 'action',
  125. width: '180px',
  126. align: 'center',
  127. scopedSlots: { customRender: 'action' }
  128. }
  129. ],
  130. loadData: parameter => {
  131. parameter = {
  132. ...parameter,
  133. ...this.queryParam,
  134. type: 1,
  135. dataScope: {
  136. sortBy: 'desc',
  137. sortName: 'apply_time'
  138. }
  139. }
  140. return getRepairApplicationFormPage(parameter)
  141. .then(res => {
  142. return res.data
  143. })
  144. }
  145. }
  146. },
  147. created() {
  148. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
  149. },
  150. methods: {
  151. handleOk() {
  152. this.queryParam.searchStartTime = this.queryParam.searchStartTime ? this.BaseTool.Date.formatter(this.queryParam.searchStartTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN) : null
  153. this.queryParam.searchEndTime = this.queryParam.searchEndTime ? this.BaseTool.Date.formatter(this.queryParam.searchEndTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN) : null
  154. this.$refs.table.refresh()
  155. },
  156. resetSearchForm() {
  157. this.queryParam = { status: 8 }
  158. this.$refs.table.refresh()
  159. },
  160. handleView(record) {
  161. fetchRepairApplicationForm({ id: record.id }).then(res => {
  162. const modal = this.$refs.detailModal
  163. modal.base(res.data)
  164. })
  165. },
  166. handleApprove(record) {
  167. transferApprove({ id: record.id, repairDispatchRemark: '审批通过' })
  168. .then(() => {
  169. this.$message.success('转派审批通过')
  170. this.handleOk()
  171. })
  172. },
  173. handleReject(record) {
  174. const modal = this.$refs.approveForm
  175. modal.base(record, 'reject')
  176. }
  177. }
  178. }
  179. </script>