RepairCheckForm.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  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="6" :sm="24">
  8. <a-form-item label="关键字">
  9. <a-input v-model.trim="queryParam.keyword" placeholder="请输入设备名称/设备新号"/>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="24">
  13. <a-form-item label="设备旧号">
  14. <a-input v-model="queryParam.zbh" placeholder="请输入设备旧号"/>
  15. </a-form-item>
  16. </a-col>
  17. <a-col :md="6" :sm="24">
  18. <a-form-item label="报修人">
  19. <a-input v-model="queryParam.actualUser" placeholder="请输入报修人"/>
  20. </a-form-item>
  21. </a-col>
  22. <a-col :md="6" :sm="24">
  23. <a-form-item label="维修人">
  24. <a-input v-model="queryParam.repairUserName" placeholder="请输入维修人"/>
  25. </a-form-item>
  26. </a-col>
  27. <a-col :md="6" :sm="24">
  28. <a-form-item label="问题描述">
  29. <a-input v-model="queryParam.content" placeholder="问题描述模糊查询"/>
  30. </a-form-item>
  31. </a-col>
  32. <a-col :md="6" :sm="24">
  33. <a-form-item label="状态">
  34. <a-select v-model="queryParam.status" placeholder="请选择">
  35. <a-select-option
  36. v-for="(label,value) in statusMap"
  37. :key="value"
  38. :label="label"
  39. :value="parseInt(value)">{{ label }}
  40. </a-select-option>
  41. </a-select>
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="6" :sm="24">
  45. <a-form-item label="报修开始日期">
  46. <a-date-picker
  47. v-model="queryParam.searchStartTime"
  48. style="width: 100%"
  49. :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
  50. />
  51. </a-form-item>
  52. </a-col>
  53. <a-col :md="6" :sm="24">
  54. <a-form-item label="报修结束日期">
  55. <a-date-picker
  56. v-model="queryParam.searchEndTime"
  57. style="width: 100%"
  58. :format="BaseTool.Date.PICKER_NORM_DATETIME_PATTERN"
  59. />
  60. </a-form-item>
  61. </a-col>
  62. <a-col :md="8 || 24" :sm="24">
  63. <span class="table-page-search-submitButtons">
  64. <a-button type="primary" @click="handleOk()">查询</a-button>
  65. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  66. </span>
  67. </a-col>
  68. </a-row>
  69. </a-form>
  70. </div>
  71. <div class="table-operator" style="margin-bottom: 8px;">
  72. </div>
  73. <s-table
  74. ref="table"
  75. size="default"
  76. rowKey="id"
  77. :columns="columns"
  78. :data="loadData"
  79. :alert="options.alert"
  80. :scroll="{x: 1000, y: BaseTool.Constant.scrollY }"
  81. :rowSelection="options.rowSelection"
  82. showPagination="auto"
  83. >
  84. <span slot="action" slot-scope="record">
  85. <template>
  86. <a @click="handleView(record)">查看</a>
  87. <operation-button
  88. v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-edit')"
  89. @click="handleEdit(record)" >修改</operation-button>
  90. <operation-button
  91. v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-del')"
  92. :type="2"
  93. title="是否要删除该条数据?"
  94. @confirm="batchDelete(record.id)">删除</operation-button>
  95. <!--<operation-button
  96. v-if="DictCache.VALUE.REPAIR_APPLICATION_FORM_STATUS.NOT_ALLOCATED === record.status && $auth('repair-application-forms-dispatch')"
  97. @click="handleDispatching(record)" >派工</operation-button>-->
  98. </template>
  99. </span>
  100. <span slot="status" slot-scope="text">
  101. <badge :text="BaseTool.Object.getField(statusMap,text)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_STATUS[text]"/>
  102. </span>
  103. <span slot="level" slot-scope="text">
  104. <badge :text="BaseTool.Object.getField(levelMap,text)" :status="DictCache.COLOR.REPAIR_APPLICATION_FORM_LEVEL[text]"/>
  105. </span>
  106. </s-table>
  107. </div>
  108. <base-form ref="baseModal" @ok="handleOk"/>
  109. <detailCheck ref="detailCheckModal" @ok="handleOk"/>
  110. <dispatch-base-form ref="dispatchBaseForm" @ok="handleOk" />
  111. </a-card>
  112. </template>
  113. <script>
  114. import { STable, Ellipsis } from '@/components'
  115. import BaseForm from './modules/BaseForm'
  116. import DetailCheck from './modules/DetailCheck'
  117. import { getRepairApplicationFormPage, deleteRepairApplicationForms, fetchRepairApplicationForm, exportRepairApplicationForm } from '@/api/repair/application-form'
  118. import DispatchBaseForm from '@/views/repair/application-form/modules/DispatchBaseForm'
  119. export default {
  120. name: 'RepairApplicationFormList',
  121. components: {
  122. STable,
  123. Ellipsis,
  124. BaseForm,
  125. DetailCheck,
  126. DispatchBaseForm
  127. },
  128. data () {
  129. return {
  130. // 查询参数
  131. queryParam: {
  132. filter: 0,
  133. searchType: 7
  134. },
  135. visible: true,
  136. // 表头
  137. columns: [
  138. {
  139. title: '序号',
  140. dataIndex: 'index',
  141. checked: true,
  142. width: '70px',
  143. customRender: (text, record, index) => {
  144. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  145. }
  146. },
  147. {
  148. title: '设备编号',
  149. checked: true,
  150. width: '100px',
  151. dataIndex: 'sbNo'
  152. },
  153. {
  154. title: '设备名称',
  155. checked: true,
  156. width: '150px',
  157. dataIndex: 'sbId',
  158. customRender: (text, record, index) => {
  159. return record.sbName
  160. }
  161. },
  162. {
  163. title: '报修人',
  164. checked: true,
  165. width: '120px',
  166. dataIndex: 'actualUser'
  167. },
  168. {
  169. title: '维修人',
  170. checked: true,
  171. width: '120px',
  172. dataIndex: 'repairUserName'
  173. },
  174. /* {
  175. title: '报修来源',
  176. checked: true,
  177. width: '100px',
  178. dataIndex: 'source',
  179. customRender: (text, record, index) => {
  180. return this.BaseTool.Object.getField(this.sourceMap, text)
  181. }
  182. }, */
  183. {
  184. title: '工单类型',
  185. checked: true,
  186. width: '100px',
  187. dataIndex: 'category',
  188. customRender: (text, record, index) => {
  189. return this.BaseTool.Object.getField(this.planFlagMap, text)
  190. }
  191. },
  192. {
  193. title: '报修时间',
  194. checked: true,
  195. width: '200px',
  196. dataIndex: 'applyTime'
  197. },
  198. /* {
  199. title: '紧急等级',
  200. checked: true,
  201. width: '200px',
  202. dataIndex: 'level',
  203. customRender: (text, record, index) => {
  204. return this.BaseTool.Object.getField(this.levelMap, text)
  205. }
  206. },
  207. {
  208. title: '计划性维修',
  209. checked: true,
  210. dataIndex: 'needStop',
  211. customRender: (text, record, index) => {
  212. return this.BaseTool.Object.getField(this.needStopMap, text)
  213. }
  214. }, */
  215. {
  216. title: '创建日期',
  217. width: '200px',
  218. dataIndex: 'createdTime'
  219. },
  220. {
  221. title: '接收超时',
  222. checked: true,
  223. width: '100px',
  224. dataIndex: 'receiveOvertime',
  225. customRender: (text, record, index) => {
  226. if (text) {
  227. return '是'
  228. } else {
  229. return '否'
  230. }
  231. }
  232. },
  233. {
  234. title: '维修超时',
  235. checked: true,
  236. width: '100px',
  237. dataIndex: 'repairOvertime',
  238. customRender: (text, record, index) => {
  239. if (text === true) {
  240. return '是'
  241. } else {
  242. return '否'
  243. }
  244. }
  245. },
  246. {
  247. title: '报修状态',
  248. checked: true,
  249. width: '100px',
  250. fixed: 'right',
  251. dataIndex: 'status',
  252. scopedSlots: { customRender: 'status' }
  253. },
  254. {
  255. title: '操作',
  256. checked: true,
  257. fixed: 'right',
  258. key: 'action',
  259. width: '150px',
  260. align: 'center',
  261. scopedSlots: { customRender: 'action' }
  262. }
  263. ],
  264. // 下拉框map
  265. sourceMap: {},
  266. levelMap: {},
  267. statusMap: {},
  268. needStopMap: {},
  269. planFlagMap: {},
  270. // 加载数据方法 必须为 Promise 对象
  271. loadData: parameter => {
  272. parameter = {
  273. ...parameter,
  274. ...this.queryParam,
  275. dataScope: {
  276. sortBy: 'asc, desc',
  277. sortName: 'status, apply_time'
  278. }
  279. }
  280. return getRepairApplicationFormPage(Object.assign(parameter, this.queryParam))
  281. .then(res => {
  282. return res.data
  283. })
  284. },
  285. selectedRowKeys: [],
  286. selectedRows: [],
  287. options: {
  288. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  289. rowSelection: {
  290. selectedRowKeys: this.selectedRowKeys,
  291. onChange: this.onSelectChange
  292. }
  293. },
  294. optionAlertShow: false
  295. }
  296. },
  297. created () {
  298. // 下拉框map
  299. this.sourceMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_SOURCE)
  300. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_LEVEL)
  301. this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_STATUS)
  302. this.needStopMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  303. this.planFlagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.REPAIR_APPLICATION_FORM_CATEGORY)
  304. // 获取浏览器的请求参数:报修单编号:no
  305. const no = this.$route.query.no
  306. if (no != null) {
  307. this.queryParam.no = no
  308. }
  309. this.tableOption()
  310. },
  311. methods: {
  312. tableOption () {
  313. if (!this.optionAlertShow) {
  314. this.options = {
  315. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  316. rowSelection: {
  317. selectedRowKeys: this.selectedRowKeys,
  318. onChange: this.onSelectChange,
  319. getCheckboxProps: record => ({
  320. props: {
  321. disabled: false,
  322. name: record.id
  323. }
  324. })
  325. }
  326. }
  327. this.optionAlertShow = true
  328. } else {
  329. this.options = {
  330. alert: false,
  331. rowSelection: null
  332. }
  333. this.optionAlertShow = false
  334. }
  335. },
  336. batchDelete (id) {
  337. let ids = []
  338. if (this.BaseTool.String.isBlank(id)) {
  339. const length = this.selectedRows.length
  340. if (length === 0) {
  341. this.$message.info('请选择要删除的记录')
  342. return
  343. }
  344. ids = this.selectedRows.map(item => item.id)
  345. } else {
  346. ids = [id]
  347. }
  348. deleteRepairApplicationForms(ids).then(res => {
  349. this.$message.info('删除成功')
  350. this.handleOk()
  351. this.$refs.table.clearSelected()
  352. })
  353. },
  354. handleEdit (record) {
  355. fetchRepairApplicationForm({ id: record.id }).then(res => {
  356. const modal = this.$refs.baseModal
  357. modal.base(res.data)
  358. })
  359. },
  360. handleView (record) {
  361. fetchRepairApplicationForm({ id: record.id }).then(res => {
  362. this.visible = false
  363. const modal = this.$refs.detailCheckModal
  364. modal.base(res.data)
  365. })
  366. },
  367. handleOk () {
  368. this.visible = true
  369. this.queryParam.searchStartTime = this.queryParam.searchStartTime ? this.BaseTool.Date.formatter(this.queryParam.searchStartTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN) : null
  370. this.queryParam.searchEndTime = this.queryParam.searchEndTime ? this.BaseTool.Date.formatter(this.queryParam.searchEndTime, this.BaseTool.Date.PICKER_NORM_DATETIME_PATTERN) : null
  371. this.$refs.table.refresh()
  372. },
  373. onSelectChange (selectedRowKeys, selectedRows) {
  374. this.selectedRowKeys = selectedRowKeys
  375. this.selectedRows = selectedRows
  376. },
  377. resetSearchForm () {
  378. this.queryParam = {
  379. }
  380. this.$refs.table.refresh(true)
  381. },
  382. doExport () {
  383. const parameter = {
  384. ...this.queryParam
  385. }
  386. exportRepairApplicationForm(parameter).then(file => {
  387. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  388. })
  389. },
  390. handleDispatching (record) {
  391. const modal = this.$refs.dispatchBaseForm
  392. modal.base(record)
  393. }
  394. }
  395. }
  396. </script>