index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <el-row :gutter="20">
  3. <el-col :span="4" :xs="24">
  4. <ContentWrap class="h-1/1">
  5. <DeptTree @node-click="handleDeptNodeClick" />
  6. </ContentWrap>
  7. </el-col>
  8. <el-col :span="20" :xs="24">
  9. <ContentWrap>
  10. <!-- 搜索工作栏 -->
  11. <el-form
  12. class="-mb-15px"
  13. :model="queryParams"
  14. ref="queryFormRef"
  15. :inline="true"
  16. label-width="68px"
  17. >
  18. <el-form-item :label="t('maintain.faultCode')" prop="failureCode" style="margin-left: 25px">
  19. <el-input
  20. v-model="queryParams.failureCode"
  21. :placeholder="t('maintain.codeHolder')"
  22. clearable
  23. @keyup.enter="handleQuery"
  24. class="!w-200px"
  25. />
  26. </el-form-item>
  27. <el-form-item :label="t('maintain.faultName')" label-width="70px" prop="failureName">
  28. <el-input
  29. v-model="queryParams.failureName"
  30. :placeholder="t('maintain.nameHolder')"
  31. clearable
  32. @keyup.enter="handleQuery"
  33. class="!w-200px"
  34. />
  35. </el-form-item>
  36. <el-form-item :label="t('maintain.status')" label-width="40px" prop="status">
  37. <el-select
  38. v-model="queryParams.status"
  39. :placeholder="t('maintain.status')"
  40. clearable
  41. class="!w-200px"
  42. >
  43. <el-option
  44. v-for="dict in getStrDictOptions(DICT_TYPE.PMS_MAIN_STATUS)"
  45. :key="dict.value"
  46. :label="dict.label"
  47. :value="dict.value"
  48. />
  49. </el-select>
  50. </el-form-item>
  51. <el-form-item :label="t('maintain.shutDown')" v-show="ifShow" prop="ifStop">
  52. <el-select
  53. v-model="queryParams.ifStop"
  54. :placeholder="t('maintain.shutDown')"
  55. clearable
  56. class="!w-200px"
  57. >
  58. <el-option
  59. v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
  60. :key="dict.value"
  61. :label="dict.label"
  62. :value="dict.value"
  63. />
  64. </el-select>
  65. </el-form-item>
  66. <el-form-item :label="t('maintain.failureTime')" v-show="ifShow" prop="failureTime" style="margin-left: 25px">
  67. <el-date-picker
  68. v-model="queryParams.failureTime"
  69. value-format="YYYY-MM-DD HH:mm:ss"
  70. type="daterange"
  71. start-placeholder="开始日期"
  72. end-placeholder="结束日期"
  73. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  74. class="!w-220px"
  75. />
  76. </el-form-item>
  77. <el-form-item :label="t('maintain.solve')" v-show="ifShow" prop="ifDeal">
  78. <el-select
  79. v-model="queryParams.ifDeal"
  80. :placeholder="t('maintain.solve')"
  81. clearable
  82. class="!w-200px"
  83. >
  84. <el-option
  85. v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
  86. :key="dict.value"
  87. :label="dict.label"
  88. :value="dict.value"
  89. />
  90. </el-select>
  91. </el-form-item>
  92. <el-form-item :label="t('maintain.assist')" v-show="ifShow" prop="needHelp">
  93. <el-select
  94. v-model="queryParams.needHelp"
  95. :placeholder="t('maintain.assist')"
  96. clearable
  97. class="!w-200px"
  98. >
  99. <el-option
  100. v-for="dict in getBoolDictOptions(DICT_TYPE.INFRA_BOOLEAN_STRING)"
  101. :key="dict.value"
  102. :label="dict.label"
  103. :value="dict.value"
  104. />
  105. </el-select>
  106. </el-form-item>
  107. <el-form-item>
  108. <el-button v-if="!ifShow" @click="moreQuery(true)" type="warning"><Icon icon="ep:search" class="mr-5px"/>
  109. {{ t('maintain.moreSearch') }}</el-button>
  110. <el-button v-if="ifShow" @click="moreQuery(false)" type="danger"><Icon icon="ep:search" class="mr-5px"/> {{ t('maintain.closeSearch') }}</el-button>
  111. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> {{ t('maintain.search') }}</el-button>
  112. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> {{ t('maintain.reset') }}</el-button>
  113. <el-button
  114. type="primary"
  115. plain
  116. @click="openForm('create')"
  117. v-hasPermi="['rq:iot-maintain:create']"
  118. >
  119. <Icon icon="ep:plus" class="mr-5px" /> {{ t('maintain.added') }}
  120. </el-button>
  121. <el-button
  122. type="success"
  123. plain
  124. @click="handleExport"
  125. :loading="exportLoading"
  126. >
  127. <Icon icon="ep:download" class="mr-5px" /> 导出
  128. </el-button>
  129. </el-form-item>
  130. </el-form>
  131. </ContentWrap>
  132. <!-- 列表 -->
  133. <ContentWrap>
  134. <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
  135. <el-table-column :label="t('maintain.serial')" min-width="70" align="center">
  136. <template #default="scope">
  137. {{ scope.$index + 1 }}
  138. </template>
  139. </el-table-column>
  140. <el-table-column :label="t('iotDevice.code')" align="center" prop="deviceCode" min-width="180" />
  141. <el-table-column :label="t('maintain.deviceName')" align="center" prop="deviceName" min-width="280" />
  142. <el-table-column :label="t('maintain.status')" align="center" prop="status" min-width="85" >
  143. <template #default="scope">
  144. <dict-tag :type="DICT_TYPE.PMS_MAIN_STATUS" :value="scope.row.status" />
  145. </template>
  146. </el-table-column>
  147. <el-table-column :label="t('maintain.source')" align="center" prop="maintainType" min-width="135"/>
  148. <!-- <el-table-column :label="t('maintain.audit')" align="center" prop="auditStatus" width="135">-->
  149. <!-- <template #default="scope">-->
  150. <!-- <dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />-->
  151. <!-- </template>-->
  152. <!-- </el-table-column>-->
  153. <el-table-column :label="t('iotMaintain.repairType')" align="center" prop="type" min-width="135">
  154. <template #default="scope">
  155. <dict-tag :type="DICT_TYPE.PMS_MAIN_TYPE" :value="scope.row.type" />
  156. </template>
  157. </el-table-column>
  158. <el-table-column :label="t('maintain.shutDown')" align="center" prop="ifStop" min-width="135">
  159. <template #default="scope">
  160. <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.ifStop" />
  161. </template>
  162. </el-table-column>
  163. <el-table-column
  164. label="执行时间"
  165. align="center"
  166. prop="executeDate"
  167. :formatter="dateFormatter"
  168. min-width="180px"
  169. />
  170. <el-table-column :label="t('maintain.dept')" align="center" prop="deptName" min-width="135"/>
  171. <el-table-column :label="t('inspect.createName')" align="center" prop="createName" min-width="130"/>
  172. <el-table-column
  173. label="创建时间"
  174. align="center"
  175. prop="createTime"
  176. :formatter="dateFormatter"
  177. width="180px"
  178. />
  179. <el-table-column :label="t('maintain.operation')" align="center" min-width="170" fixed="right">
  180. <template #default="scope">
  181. <el-button
  182. link
  183. type="primary"
  184. @click="detail(scope.row.id)"
  185. >
  186. {{ t('maintain.view') }}
  187. </el-button>
  188. <el-button
  189. link
  190. v-if="scope.row.status==='tx'&&(scope.row.auditStatus===20||scope.row.auditStatus===null)"
  191. type="danger"
  192. @click="openForm('update',scope.row.id)"
  193. >
  194. {{ t('maintain.fill') }}
  195. </el-button>
  196. </template>
  197. </el-table-column>
  198. </el-table>
  199. <!-- 分页 -->
  200. <Pagination
  201. :total="total"
  202. v-model:page="queryParams.pageNo"
  203. v-model:limit="queryParams.pageSize"
  204. @pagination="getList"
  205. />
  206. </ContentWrap>
  207. </el-col>
  208. </el-row>
  209. <!-- 表单弹窗:添加/修改 -->
  210. </template>
  211. <script setup lang="ts">
  212. import { dateFormatter } from '@/utils/formatTime'
  213. import download from '@/utils/download'
  214. import { IotMaintainApi, IotMaintainVO } from '@/api/pms/maintain'
  215. import IotMaintainForm from './IotMaintainForm.vue'
  216. import DeptTree from "@/views/system/user/DeptTree.vue";
  217. import {DICT_TYPE, getStrDictOptions,getBoolDictOptions} from "@/utils/dict";
  218. /** 维修工单 列表 */
  219. defineOptions({ name: 'IotMaintain' })
  220. const message = useMessage() // 消息弹窗
  221. const { t } = useI18n() // 国际化
  222. const { push } = useRouter() // 路由跳转
  223. const ifShow = ref(false)
  224. const loading = ref(true) // 列表的加载中
  225. const list = ref<IotMaintainVO[]>([]) // 列表的数据
  226. const total = ref(0) // 列表的总页数
  227. const queryParams = reactive({
  228. pageNo: 1,
  229. pageSize: 10,
  230. failureCode: undefined,
  231. failureName: undefined,
  232. deviceId: undefined,
  233. status: undefined,
  234. ifStop: undefined,
  235. failureTime: [],
  236. failureInfluence: undefined,
  237. failureSystem: undefined,
  238. description: undefined,
  239. pic: undefined,
  240. solution: undefined,
  241. maintainStartTime: [],
  242. maintainEndTime: [],
  243. remark: undefined,
  244. createTime: [],
  245. deviceName: undefined,
  246. processInstanceId: undefined,
  247. auditStatus: undefined,
  248. deptId: undefined,
  249. })
  250. const queryFormRef = ref() // 搜索的表单
  251. const exportLoading = ref(false) // 导出的加载中
  252. const moreQuery = (show) => {
  253. ifShow.value = show
  254. }
  255. const openForm = (type: string, id?: number) => {
  256. //修改
  257. if (typeof id === 'number') {
  258. push({ name: 'MaintainAdd', params: {id } })
  259. return
  260. }
  261. // 新增
  262. push({ name: 'MaintainAdd', params:{} })
  263. }
  264. const detail = (id?: number) => {
  265. push({ name: 'MaintainDetail', params:{id} })
  266. }
  267. /** 查询列表 */
  268. const getList = async () => {
  269. loading.value = true
  270. try {
  271. const data = await IotMaintainApi.getIotMaintainPage(queryParams)
  272. list.value = data.list
  273. total.value = data.total
  274. } finally {
  275. loading.value = false
  276. }
  277. }
  278. /** 处理部门被点击 */
  279. const handleDeptNodeClick = async (row) => {
  280. queryParams.deptId = row.id
  281. await getList()
  282. }
  283. /** 搜索按钮操作 */
  284. const handleQuery = () => {
  285. queryParams.pageNo = 1
  286. getList()
  287. }
  288. /** 重置按钮操作 */
  289. const resetQuery = () => {
  290. queryFormRef.value.resetFields()
  291. handleQuery()
  292. }
  293. /** 删除按钮操作 */
  294. const handleDelete = async (id: number) => {
  295. try {
  296. // 删除的二次确认
  297. await message.delConfirm()
  298. // 发起删除
  299. await IotMaintainApi.deleteIotMaintain(id)
  300. message.success(t('common.delSuccess'))
  301. // 刷新列表
  302. await getList()
  303. } catch {}
  304. }
  305. /** 导出按钮操作 */
  306. const handleExport = async () => {
  307. try {
  308. // 导出的二次确认
  309. await message.exportConfirm()
  310. // 发起导出
  311. exportLoading.value = true
  312. const data = await IotMaintainApi.exportIotMaintain(queryParams)
  313. download.excel(data, '维修工单.xls')
  314. } catch {
  315. } finally {
  316. exportLoading.value = false
  317. }
  318. }
  319. /** 初始化 **/
  320. onMounted(() => {
  321. getList()
  322. })
  323. </script>