RepairCheckForm.vue 13 KB

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