index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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-maintain: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('iotDevice.code')" align="center" prop="deviceCode" />
  154. <el-table-column :label="t('maintain.deviceName')" align="center" prop="deviceName" />
  155. <el-table-column :label="t('maintain.status')" align="center" prop="status" >
  156. <template #default="scope">
  157. <dict-tag :type="DICT_TYPE.PMS_MAIN_STATUS" :value="scope.row.status" />
  158. </template>
  159. </el-table-column>
  160. <el-table-column :label="t('maintain.source')" align="center" prop="maintainType" />
  161. <el-table-column :label="t('maintain.audit')" align="center" prop="auditStatus" >
  162. <template #default="scope">
  163. <dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
  164. </template>
  165. </el-table-column>
  166. <el-table-column :label="t('maintain.shutDown')" align="center" prop="ifStop" >
  167. <template #default="scope">
  168. <dict-tag :type="DICT_TYPE.INFRA_BOOLEAN_STRING" :value="scope.row.ifStop" />
  169. </template>
  170. </el-table-column>
  171. <el-table-column
  172. :label="t('iotMaintain.startTime')"
  173. align="center"
  174. prop="maintainStartTime"
  175. :formatter="dateFormatter"
  176. width="180px"
  177. />
  178. <el-table-column
  179. :label="t('maintain.failureTime')"
  180. align="center"
  181. prop="failureTime"
  182. :formatter="dateFormatter"
  183. width="180px"
  184. />
  185. <!-- <el-table-column-->
  186. <!-- label="维修结束时间"-->
  187. <!-- align="center"-->
  188. <!-- prop="maintainEndTime"-->
  189. <!-- :formatter="dateFormatter"-->
  190. <!-- width="180px"-->
  191. <!-- />-->
  192. <!-- <el-table-column label="备注" align="center" prop="remark" />-->
  193. <!-- <el-table-column-->
  194. <!-- label="创建时间"-->
  195. <!-- align="center"-->
  196. <!-- prop="createTime"-->
  197. <!-- :formatter="dateFormatter"-->
  198. <!-- width="180px"-->
  199. <!-- />-->
  200. <el-table-column :label="t('maintain.operation')" align="center" min-width="120px">
  201. <template #default="scope">
  202. <el-button
  203. link
  204. type="primary"
  205. @click="detail(scope.row.id)"
  206. >
  207. {{ t('maintain.view') }}
  208. </el-button>
  209. <el-button
  210. link
  211. v-if="scope.row.status==='tx'&&(scope.row.auditStatus===20||scope.row.auditStatus===null)"
  212. type="danger"
  213. @click="openForm('update',scope.row.id)"
  214. >
  215. {{ t('maintain.fill') }}
  216. </el-button>
  217. </template>
  218. </el-table-column>
  219. </el-table>
  220. <!-- 分页 -->
  221. <Pagination
  222. :total="total"
  223. v-model:page="queryParams.pageNo"
  224. v-model:limit="queryParams.pageSize"
  225. @pagination="getList"
  226. />
  227. </ContentWrap>
  228. </el-col>
  229. </el-row>
  230. <!-- 表单弹窗:添加/修改 -->
  231. </template>
  232. <script setup lang="ts">
  233. import { dateFormatter } from '@/utils/formatTime'
  234. import download from '@/utils/download'
  235. import { IotMaintainApi, IotMaintainVO } from '@/api/pms/maintain'
  236. import IotMaintainForm from './IotMaintainForm.vue'
  237. import DeptTree from "@/views/system/user/DeptTree.vue";
  238. import {DICT_TYPE, getStrDictOptions,getBoolDictOptions} from "@/utils/dict";
  239. /** 维修工单 列表 */
  240. defineOptions({ name: 'IotMaintain' })
  241. const message = useMessage() // 消息弹窗
  242. const { t } = useI18n() // 国际化
  243. const { push } = useRouter() // 路由跳转
  244. const ifShow = ref(false)
  245. const loading = ref(true) // 列表的加载中
  246. const list = ref<IotMaintainVO[]>([]) // 列表的数据
  247. const total = ref(0) // 列表的总页数
  248. const queryParams = reactive({
  249. pageNo: 1,
  250. pageSize: 10,
  251. failureCode: undefined,
  252. failureName: undefined,
  253. deviceId: undefined,
  254. status: undefined,
  255. ifStop: undefined,
  256. failureTime: [],
  257. failureInfluence: undefined,
  258. failureSystem: undefined,
  259. description: undefined,
  260. pic: undefined,
  261. solution: undefined,
  262. maintainStartTime: [],
  263. maintainEndTime: [],
  264. remark: undefined,
  265. createTime: [],
  266. deviceName: undefined,
  267. processInstanceId: undefined,
  268. auditStatus: undefined,
  269. deptId: undefined,
  270. })
  271. const queryFormRef = ref() // 搜索的表单
  272. const exportLoading = ref(false) // 导出的加载中
  273. const moreQuery = (show) => {
  274. ifShow.value = show
  275. }
  276. const openForm = (type: string, id?: number) => {
  277. //修改
  278. if (typeof id === 'number') {
  279. push({ name: 'MaintainAdd', params: {id } })
  280. return
  281. }
  282. // 新增
  283. push({ name: 'MaintainAdd', params:{} })
  284. }
  285. const detail = (id?: number) => {
  286. push({ name: 'MaintainDetail', params:{id} })
  287. }
  288. /** 查询列表 */
  289. const getList = async () => {
  290. loading.value = true
  291. try {
  292. const data = await IotMaintainApi.getIotMaintainPage(queryParams)
  293. list.value = data.list
  294. total.value = data.total
  295. } finally {
  296. loading.value = false
  297. }
  298. }
  299. /** 处理部门被点击 */
  300. const handleDeptNodeClick = async (row) => {
  301. queryParams.deptId = row.id
  302. await getList()
  303. }
  304. /** 搜索按钮操作 */
  305. const handleQuery = () => {
  306. queryParams.pageNo = 1
  307. getList()
  308. }
  309. /** 重置按钮操作 */
  310. const resetQuery = () => {
  311. queryFormRef.value.resetFields()
  312. handleQuery()
  313. }
  314. /** 删除按钮操作 */
  315. const handleDelete = async (id: number) => {
  316. try {
  317. // 删除的二次确认
  318. await message.delConfirm()
  319. // 发起删除
  320. await IotMaintainApi.deleteIotMaintain(id)
  321. message.success(t('common.delSuccess'))
  322. // 刷新列表
  323. await getList()
  324. } catch {}
  325. }
  326. /** 导出按钮操作 */
  327. const handleExport = async () => {
  328. try {
  329. // 导出的二次确认
  330. await message.exportConfirm()
  331. // 发起导出
  332. exportLoading.value = true
  333. const data = await IotMaintainApi.exportIotMaintain(queryParams)
  334. download.excel(data, '维修工单.xls')
  335. } catch {
  336. } finally {
  337. exportLoading.value = false
  338. }
  339. }
  340. /** 初始化 **/
  341. onMounted(() => {
  342. getList()
  343. })
  344. </script>