index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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 label="创建时间" v-show="ifShow" prop="createTime">-->
  108. <!-- <el-date-picker-->
  109. <!-- v-model="queryParams.createTime"-->
  110. <!-- value-format="YYYY-MM-DD HH:mm:ss"-->
  111. <!-- type="daterange"-->
  112. <!-- start-placeholder="开始日期"-->
  113. <!-- end-placeholder="结束日期"-->
  114. <!-- :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"-->
  115. <!-- class="!w-220px"-->
  116. <!-- />-->
  117. <!-- </el-form-item>-->
  118. <el-form-item>
  119. <el-button v-if="!ifShow" @click="moreQuery(true)" type="warning"><Icon icon="ep:search" class="mr-5px"/>
  120. {{ t('maintain.moreSearch') }}</el-button>
  121. <el-button v-if="ifShow" @click="moreQuery(false)" type="danger"><Icon icon="ep:search" class="mr-5px"/> {{ t('maintain.closeSearch') }}</el-button>
  122. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> {{ t('maintain.search') }}</el-button>
  123. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> {{ t('maintain.reset') }}</el-button>
  124. <el-button
  125. type="primary"
  126. plain
  127. @click="openForm('create')"
  128. v-hasPermi="['rq:iot-device:create']"
  129. >
  130. <Icon icon="ep:plus" class="mr-5px" /> {{ t('maintain.added') }}
  131. </el-button>
  132. <el-button
  133. type="success"
  134. plain
  135. @click="handleExport"
  136. :loading="exportLoading"
  137. >
  138. <Icon icon="ep:download" class="mr-5px" /> 导出
  139. </el-button>
  140. </el-form-item>
  141. </el-form>
  142. </ContentWrap>
  143. <!-- 列表 -->
  144. <ContentWrap>
  145. <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
  146. <el-table-column :label="t('maintain.serial')" width="70" align="center">
  147. <template #default="scope">
  148. {{ scope.$index + 1 }}
  149. </template>
  150. </el-table-column>
  151. <!-- <el-table-column label="故障编码" align="center" prop="failureCode" />-->
  152. <!-- <el-table-column label="故障名称" align="center" prop="failureName" />-->
  153. <el-table-column :label="t('maintain.deviceName')" align="center" prop="deviceName" />
  154. <el-table-column :label="t('maintain.status')" align="center" prop="status" >
  155. <template #default="scope">
  156. <dict-tag :type="DICT_TYPE.PMS_MAIN_STATUS" :value="scope.row.status" />
  157. </template>
  158. </el-table-column>
  159. <el-table-column :label="t('maintain.source')" align="center" prop="maintainType" />
  160. <el-table-column :label="t('maintain.audit')" align="center" prop="auditStatus" >
  161. <template #default="scope">
  162. <dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
  163. </template>
  164. </el-table-column>
  165. <el-table-column :label="t('maintain.shutDown')" align="center" prop="ifStop" >
  166. <template #default="scope">
  167. <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.ifStop" />
  168. </template>
  169. </el-table-column>
  170. <el-table-column
  171. :label="t('iotMaintain.startTime')"
  172. align="center"
  173. prop="maintainStartTime"
  174. :formatter="dateFormatter"
  175. width="180px"
  176. />
  177. <el-table-column
  178. :label="t('maintain.failureTime')"
  179. align="center"
  180. prop="failureTime"
  181. :formatter="dateFormatter"
  182. width="180px"
  183. />
  184. <!-- <el-table-column-->
  185. <!-- label="维修结束时间"-->
  186. <!-- align="center"-->
  187. <!-- prop="maintainEndTime"-->
  188. <!-- :formatter="dateFormatter"-->
  189. <!-- width="180px"-->
  190. <!-- />-->
  191. <!-- <el-table-column label="备注" align="center" prop="remark" />-->
  192. <!-- <el-table-column-->
  193. <!-- label="创建时间"-->
  194. <!-- align="center"-->
  195. <!-- prop="createTime"-->
  196. <!-- :formatter="dateFormatter"-->
  197. <!-- width="180px"-->
  198. <!-- />-->
  199. <el-table-column :label="t('maintain.operation')" align="center" min-width="120px">
  200. <template #default="scope">
  201. <el-button
  202. link
  203. type="primary"
  204. @click="detail(scope.row.id)"
  205. >
  206. {{ t('maintain.view') }}
  207. </el-button>
  208. <el-button
  209. link
  210. v-if="scope.row.status==='tx'&&(scope.row.auditStatus===20||scope.row.auditStatus===null)"
  211. type="danger"
  212. @click="openForm('update',scope.row.id)"
  213. >
  214. {{ t('maintain.fill') }}
  215. </el-button>
  216. </template>
  217. </el-table-column>
  218. </el-table>
  219. <!-- 分页 -->
  220. <Pagination
  221. :total="total"
  222. v-model:page="queryParams.pageNo"
  223. v-model:limit="queryParams.pageSize"
  224. @pagination="getList"
  225. />
  226. </ContentWrap>
  227. </el-col>
  228. </el-row>
  229. <!-- 表单弹窗:添加/修改 -->
  230. </template>
  231. <script setup lang="ts">
  232. import { dateFormatter } from '@/utils/formatTime'
  233. import download from '@/utils/download'
  234. import { IotMaintainApi, IotMaintainVO } from '@/api/pms/maintain'
  235. import IotMaintainForm from './IotMaintainForm.vue'
  236. import DeptTree from "@/views/system/user/DeptTree.vue";
  237. import {DICT_TYPE, getStrDictOptions,getBoolDictOptions} from "@/utils/dict";
  238. /** 维修工单 列表 */
  239. defineOptions({ name: 'IotMaintain' })
  240. const message = useMessage() // 消息弹窗
  241. const { t } = useI18n() // 国际化
  242. const { push } = useRouter() // 路由跳转
  243. const ifShow = ref(false)
  244. const loading = ref(true) // 列表的加载中
  245. const list = ref<IotMaintainVO[]>([]) // 列表的数据
  246. const total = ref(0) // 列表的总页数
  247. const queryParams = reactive({
  248. pageNo: 1,
  249. pageSize: 10,
  250. failureCode: undefined,
  251. failureName: undefined,
  252. deviceId: undefined,
  253. status: undefined,
  254. ifStop: undefined,
  255. failureTime: [],
  256. failureInfluence: undefined,
  257. failureSystem: undefined,
  258. description: undefined,
  259. pic: undefined,
  260. solution: undefined,
  261. maintainStartTime: [],
  262. maintainEndTime: [],
  263. remark: undefined,
  264. createTime: [],
  265. deviceName: undefined,
  266. processInstanceId: undefined,
  267. auditStatus: undefined,
  268. deptId: undefined,
  269. })
  270. const queryFormRef = ref() // 搜索的表单
  271. const exportLoading = ref(false) // 导出的加载中
  272. const moreQuery = (show) => {
  273. ifShow.value = show
  274. }
  275. const openForm = (type: string, id?: number) => {
  276. //修改
  277. if (typeof id === 'number') {
  278. push({ name: 'MaintainEdit', params: {id } })
  279. return
  280. }
  281. // 新增
  282. push({ name: 'MaintainAdd', params:{} })
  283. }
  284. const detail = (id?: number) => {
  285. push({ name: 'MaintainDetail', params:{id} })
  286. }
  287. /** 查询列表 */
  288. const getList = async () => {
  289. loading.value = true
  290. try {
  291. const data = await IotMaintainApi.getIotMaintainPage(queryParams)
  292. list.value = data.list
  293. total.value = data.total
  294. } finally {
  295. loading.value = false
  296. }
  297. }
  298. /** 处理部门被点击 */
  299. const handleDeptNodeClick = async (row) => {
  300. queryParams.deptId = row.id
  301. await getList()
  302. }
  303. /** 搜索按钮操作 */
  304. const handleQuery = () => {
  305. queryParams.pageNo = 1
  306. getList()
  307. }
  308. /** 重置按钮操作 */
  309. const resetQuery = () => {
  310. queryFormRef.value.resetFields()
  311. handleQuery()
  312. }
  313. /** 删除按钮操作 */
  314. const handleDelete = async (id: number) => {
  315. try {
  316. // 删除的二次确认
  317. await message.delConfirm()
  318. // 发起删除
  319. await IotMaintainApi.deleteIotMaintain(id)
  320. message.success(t('common.delSuccess'))
  321. // 刷新列表
  322. await getList()
  323. } catch {}
  324. }
  325. /** 导出按钮操作 */
  326. const handleExport = async () => {
  327. try {
  328. // 导出的二次确认
  329. await message.exportConfirm()
  330. // 发起导出
  331. exportLoading.value = true
  332. const data = await IotMaintainApi.exportIotMaintain(queryParams)
  333. download.excel(data, '维修工单.xls')
  334. } catch {
  335. } finally {
  336. exportLoading.value = false
  337. }
  338. }
  339. /** 初始化 **/
  340. onMounted(() => {
  341. getList()
  342. })
  343. </script>