RepairApplicationFormExamining.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <a-card :bordered="false">
  3. <div v-show="visible">
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  6. <a-row :gutter="48">
  7. <a-col :md="8" :sm="24">
  8. <a-form-item label="关键字">
  9. <a-input v-model="queryParam.keyword" placeholder="请输入名称/类型名称"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="8 || 24" :sm="24">
  13. <span class="table-page-search-submitButtons">
  14. <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
  15. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  16. </span>
  17. </a-col>
  18. </a-row>
  19. </a-form>
  20. </div>
  21. <div class="table-operator">
  22. <a-button v-if="$auth('repair-application-forms-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>
  23. <a-button style="margin-left: 8px" v-if="$auth('repair-application-forms-export')" type="primary" icon="download" @click="doExport">导出</a-button>
  24. <a-dropdown v-action:edit v-if="selectedRowKeys.length > 0 && $auth('repair-application-forms-del')">
  25. <a-menu slot="overlay">
  26. <a-popconfirm title="是否要删除所选数据?" @confirm="batchDelete()">
  27. <a-menu-item key="1"><a-icon type="delete" /><a>删除</a></a-menu-item>
  28. </a-popconfirm>
  29. </a-menu>
  30. <a-button style="margin-left: 8px">
  31. 批量操作 <a-icon type="down" />
  32. </a-button>
  33. </a-dropdown>
  34. </div>
  35. <s-table
  36. ref="table"
  37. size="default"
  38. rowKey="id"
  39. :columns="columns"
  40. :data="loadData"
  41. :alert="options.alert"
  42. :rowSelection="options.rowSelection"
  43. showPagination="auto"
  44. >
  45. <span slot="action" slot-scope="record">
  46. <template>
  47. <a @click="handleView(record)">查看</a>
  48. <operation-button
  49. v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-edit')"
  50. @click="handleEdit(record)" >审核</operation-button>
  51. </template>
  52. </span>
  53. <span slot="status" slot-scope="text">
  54. <badge :text="BaseTool.Object.getField(statusMap,text)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[text]"/>
  55. </span>
  56. </s-table>
  57. </div>
  58. <base-form ref="baseModal" @ok="handleOk"/>
  59. <detail-examine ref="detailModal" @ok="handleOk"/>
  60. <dispatch-base-form ref="dispatchBaseForm" @ok="handleOk" />
  61. </a-card>
  62. </template>
  63. <script>
  64. import { STable, Ellipsis } from '@/components'
  65. import BaseForm from './modules/BaseForm'
  66. import DetailExamine from './modules/DetailExamine'
  67. import { getRepairApplicationFormPage, deleteRepairApplicationForms, fetchRepairApplicationForm, exportRepairApplicationForm } from '@/api/repair/application-form'
  68. import DispatchBaseForm from '@/views/repair/application-form/modules/DispatchBaseForm'
  69. export default {
  70. name: 'RepairApplicationFormList',
  71. components: {
  72. STable,
  73. Ellipsis,
  74. BaseForm,
  75. DetailExamine,
  76. DispatchBaseForm
  77. },
  78. data () {
  79. return {
  80. // 查询参数
  81. queryParam: {
  82. status: this.DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.EXAMINING
  83. },
  84. visible: true,
  85. // 表头
  86. columns: [
  87. {
  88. title: '序号',
  89. dataIndex: 'index',
  90. checked: true,
  91. customRender: (text, record, index) => {
  92. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  93. }
  94. },
  95. {
  96. title: '设备编号',
  97. checked: true,
  98. dataIndex: 'sbNo'
  99. },
  100. {
  101. title: '设备名称',
  102. checked: true,
  103. dataIndex: 'sbId',
  104. customRender: (text, record, index) => {
  105. return record.sbName
  106. }
  107. },
  108. {
  109. title: '报修人',
  110. checked: true,
  111. dataIndex: 'actualUser'
  112. },
  113. {
  114. title: '维修人',
  115. checked: true,
  116. dataIndex: 'repairUserName'
  117. },
  118. {
  119. title: '报修来源',
  120. checked: true,
  121. dataIndex: 'source',
  122. customRender: (text, record, index) => {
  123. return this.BaseTool.Object.getField(this.sourceMap, text)
  124. }
  125. },
  126. {
  127. title: '报修时间',
  128. checked: true,
  129. dataIndex: 'applyTime'
  130. },
  131. {
  132. title: '紧急等级',
  133. checked: true,
  134. dataIndex: 'level',
  135. customRender: (text, record, index) => {
  136. return this.BaseTool.Object.getField(this.levelMap, text)
  137. }
  138. },
  139. {
  140. title: '是否停机',
  141. checked: true,
  142. dataIndex: 'needStop',
  143. customRender: (text, record, index) => {
  144. return this.BaseTool.Object.getField(this.needStopMap,text)
  145. }
  146. },
  147. {
  148. title: '报修状态',
  149. checked: true,
  150. dataIndex: 'status',
  151. scopedSlots: { customRender: 'status' }
  152. },
  153. {
  154. title: '创建日期',
  155. dataIndex: 'createdTime'
  156. },
  157. {
  158. title: '操作',
  159. checked: true,
  160. key: 'action',
  161. width: '200px',
  162. align: 'center',
  163. scopedSlots: { customRender: 'action' }
  164. }
  165. ],
  166. // 下拉框map
  167. sourceMap: {},
  168. levelMap: {},
  169. statusMap: {},
  170. needStopMap: {},
  171. // 加载数据方法 必须为 Promise 对象
  172. loadData: parameter => {
  173. parameter = {
  174. ...parameter,
  175. ...this.queryParam,
  176. type: 1,
  177. dataScope: {
  178. sortBy: 'desc',
  179. sortName: 'update_time'
  180. }
  181. }
  182. return getRepairApplicationFormPage(Object.assign(parameter, this.queryParam))
  183. .then(res => {
  184. return res.data
  185. })
  186. },
  187. selectedRowKeys: [],
  188. selectedRows: [],
  189. options: {
  190. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  191. rowSelection: {
  192. selectedRowKeys: this.selectedRowKeys,
  193. onChange: this.onSelectChange
  194. }
  195. },
  196. optionAlertShow: false
  197. }
  198. },
  199. created () {
  200. // 下拉框map
  201. this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
  202. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
  203. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
  204. this.needStopMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  205. this.tableOption()
  206. },
  207. methods: {
  208. tableOption () {
  209. if (!this.optionAlertShow) {
  210. this.options = {
  211. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  212. rowSelection: {
  213. selectedRowKeys: this.selectedRowKeys,
  214. onChange: this.onSelectChange,
  215. getCheckboxProps: record => ({
  216. props: {
  217. disabled: false,
  218. name: record.id
  219. }
  220. })
  221. }
  222. }
  223. this.optionAlertShow = true
  224. } else {
  225. this.options = {
  226. alert: false,
  227. rowSelection: null
  228. }
  229. this.optionAlertShow = false
  230. }
  231. },
  232. batchDelete (id) {
  233. let ids = []
  234. if (this.BaseTool.String.isBlank(id)) {
  235. const length = this.selectedRows.length
  236. if (length === 0) {
  237. this.$message.info('请选择要删除的记录')
  238. return
  239. }
  240. ids = this.selectedRows.map(item => item.id)
  241. } else {
  242. ids = [id]
  243. }
  244. deleteRepairApplicationForms(ids).then(res => {
  245. this.$message.info('删除成功')
  246. this.handleOk()
  247. this.$refs.table.clearSelected()
  248. })
  249. },
  250. handleEdit (record) {
  251. fetchRepairApplicationForm({ id: record.id }).then(res => {
  252. const modal = this.$refs.baseModal
  253. modal.base(res.data)
  254. })
  255. },
  256. handleView (record) {
  257. fetchRepairApplicationForm({ id: record.id }).then(res => {
  258. this.visible = false
  259. const modal = this.$refs.detailModal
  260. modal.base(res.data)
  261. })
  262. },
  263. handleOk () {
  264. this.visible = true
  265. this.$refs.table.refresh()
  266. },
  267. onSelectChange (selectedRowKeys, selectedRows) {
  268. this.selectedRowKeys = selectedRowKeys
  269. this.selectedRows = selectedRows
  270. },
  271. resetSearchForm () {
  272. this.queryParam = {
  273. }
  274. this.$refs.table.refresh(true)
  275. },
  276. doExport () {
  277. const parameter = {
  278. ...this.queryParam
  279. }
  280. exportRepairApplicationForm(parameter).then(file => {
  281. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  282. })
  283. },
  284. handleDispatching (record) {
  285. const modal = this.$refs.dispatchBaseForm
  286. modal.base(record)
  287. }
  288. }
  289. }
  290. </script>