index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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="故障编码" prop="failureCode">
  19. <el-input
  20. v-model="queryParams.failureCode"
  21. placeholder="请输入故障编码"
  22. clearable
  23. @keyup.enter="handleQuery"
  24. class="!w-200px"
  25. />
  26. </el-form-item>
  27. <el-form-item label="故障名称" label-width="70px" prop="failureName">
  28. <el-input
  29. v-model="queryParams.failureName"
  30. placeholder="请输入故障名称"
  31. clearable
  32. @keyup.enter="handleQuery"
  33. class="!w-200px"
  34. />
  35. </el-form-item>
  36. <el-form-item label="状态" label-width="40px" prop="status">
  37. <el-select
  38. v-model="queryParams.status"
  39. placeholder="状态"
  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="是否停机" v-show="ifShow" prop="ifStop">
  52. <el-select
  53. v-model="queryParams.ifStop"
  54. placeholder="是否停机"
  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="故障时间" v-show="ifShow" prop="failureTime">
  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="是否解决" v-show="ifShow" prop="ifDeal">
  78. <el-select
  79. v-model="queryParams.ifDeal"
  80. placeholder="是否解决"
  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="是否协助" v-show="ifShow" prop="needHelp">
  93. <el-select
  94. v-model="queryParams.needHelp"
  95. placeholder="是否协助"
  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"/> 更多查询</el-button>
  120. <el-button v-if="ifShow" @click="moreQuery(false)" type="danger"><Icon icon="ep:search" class="mr-5px"/> 收起查询</el-button>
  121. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  122. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  123. <el-button
  124. type="primary"
  125. plain
  126. @click="openForm('create')"
  127. v-hasPermi="['rq:iot-device:create']"
  128. >
  129. <Icon icon="ep:plus" class="mr-5px" /> 新增
  130. </el-button>
  131. <el-button
  132. type="success"
  133. plain
  134. @click="handleExport"
  135. :loading="exportLoading"
  136. >
  137. <Icon icon="ep:download" class="mr-5px" /> 导出
  138. </el-button>
  139. </el-form-item>
  140. </el-form>
  141. </ContentWrap>
  142. <!-- 列表 -->
  143. <ContentWrap>
  144. <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
  145. <el-table-column label="故障编码" align="center" prop="failureCode" />
  146. <el-table-column label="故障名称" align="center" prop="failureName" />
  147. <el-table-column label="设备" align="center" prop="deviceName" />
  148. <el-table-column label="状态" align="center" prop="status" >
  149. <template #default="scope">
  150. <dict-tag :type="DICT_TYPE.PMS_MAIN_STATUS" :value="scope.row.status" />
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="审核状态" align="center" prop="auditStatus" >
  154. <template #default="scope">
  155. <dict-tag :type="DICT_TYPE.CRM_AUDIT_STATUS" :value="scope.row.auditStatus" />
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="是否停机" align="center" prop="ifStop" >
  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="failureTime"
  167. :formatter="dateFormatter"
  168. width="180px"
  169. />
  170. <el-table-column
  171. label="维修开始时间"
  172. align="center"
  173. prop="maintainStartTime"
  174. :formatter="dateFormatter"
  175. width="180px"
  176. />
  177. <!-- <el-table-column-->
  178. <!-- label="维修结束时间"-->
  179. <!-- align="center"-->
  180. <!-- prop="maintainEndTime"-->
  181. <!-- :formatter="dateFormatter"-->
  182. <!-- width="180px"-->
  183. <!-- />-->
  184. <!-- <el-table-column label="备注" align="center" prop="remark" />-->
  185. <el-table-column
  186. label="创建时间"
  187. align="center"
  188. prop="createTime"
  189. :formatter="dateFormatter"
  190. width="180px"
  191. />
  192. <el-table-column label="操作" align="center" min-width="120px">
  193. <template #default="scope">
  194. <el-button
  195. link
  196. type="primary"
  197. @click="detail(scope.row.id)"
  198. >
  199. 查看
  200. </el-button>
  201. <el-button
  202. link
  203. v-if="scope.row.status==='tx'"
  204. type="danger"
  205. @click="openForm('update',scope.row.id)"
  206. >
  207. 填写
  208. </el-button>
  209. </template>
  210. </el-table-column>
  211. </el-table>
  212. <!-- 分页 -->
  213. <Pagination
  214. :total="total"
  215. v-model:page="queryParams.pageNo"
  216. v-model:limit="queryParams.pageSize"
  217. @pagination="getList"
  218. />
  219. </ContentWrap>
  220. </el-col>
  221. </el-row>
  222. <!-- 表单弹窗:添加/修改 -->
  223. </template>
  224. <script setup lang="ts">
  225. import { dateFormatter } from '@/utils/formatTime'
  226. import download from '@/utils/download'
  227. import { IotMaintainApi, IotMaintainVO } from '@/api/pms/maintain'
  228. import IotMaintainForm from './IotMaintainForm.vue'
  229. import DeptTree from "@/views/system/user/DeptTree.vue";
  230. import {DICT_TYPE, getStrDictOptions,getBoolDictOptions} from "@/utils/dict";
  231. /** 维修工单 列表 */
  232. defineOptions({ name: 'IotMaintain' })
  233. const message = useMessage() // 消息弹窗
  234. const { t } = useI18n() // 国际化
  235. const { push } = useRouter() // 路由跳转
  236. const ifShow = ref(false)
  237. const loading = ref(true) // 列表的加载中
  238. const list = ref<IotMaintainVO[]>([]) // 列表的数据
  239. const total = ref(0) // 列表的总页数
  240. const queryParams = reactive({
  241. pageNo: 1,
  242. pageSize: 10,
  243. failureCode: undefined,
  244. failureName: undefined,
  245. deviceId: undefined,
  246. status: undefined,
  247. ifStop: undefined,
  248. failureTime: [],
  249. failureInfluence: undefined,
  250. failureSystem: undefined,
  251. description: undefined,
  252. pic: undefined,
  253. solution: undefined,
  254. maintainStartTime: [],
  255. maintainEndTime: [],
  256. remark: undefined,
  257. createTime: [],
  258. deviceName: undefined,
  259. processInstanceId: undefined,
  260. auditStatus: undefined,
  261. deptId: undefined,
  262. })
  263. const queryFormRef = ref() // 搜索的表单
  264. const exportLoading = ref(false) // 导出的加载中
  265. const moreQuery = (show) => {
  266. ifShow.value = show
  267. }
  268. const openForm = (type: string, id?: number) => {
  269. //修改
  270. if (typeof id === 'number') {
  271. push({ name: 'MaintainEdit', params: {id } })
  272. return
  273. }
  274. // 新增
  275. push({ name: 'MaintainAdd', params:{} })
  276. }
  277. const detail = (id?: number) => {
  278. push({ name: 'MaintainDetail', params:{id} })
  279. }
  280. /** 查询列表 */
  281. const getList = async () => {
  282. loading.value = true
  283. try {
  284. const data = await IotMaintainApi.getIotMaintainPage(queryParams)
  285. list.value = data.list
  286. total.value = data.total
  287. } finally {
  288. loading.value = false
  289. }
  290. }
  291. /** 处理部门被点击 */
  292. const handleDeptNodeClick = async (row) => {
  293. queryParams.deptId = row.id
  294. await getList()
  295. }
  296. /** 搜索按钮操作 */
  297. const handleQuery = () => {
  298. queryParams.pageNo = 1
  299. getList()
  300. }
  301. /** 重置按钮操作 */
  302. const resetQuery = () => {
  303. queryFormRef.value.resetFields()
  304. handleQuery()
  305. }
  306. /** 删除按钮操作 */
  307. const handleDelete = async (id: number) => {
  308. try {
  309. // 删除的二次确认
  310. await message.delConfirm()
  311. // 发起删除
  312. await IotMaintainApi.deleteIotMaintain(id)
  313. message.success(t('common.delSuccess'))
  314. // 刷新列表
  315. await getList()
  316. } catch {}
  317. }
  318. /** 导出按钮操作 */
  319. const handleExport = async () => {
  320. try {
  321. // 导出的二次确认
  322. await message.exportConfirm()
  323. // 发起导出
  324. exportLoading.value = true
  325. const data = await IotMaintainApi.exportIotMaintain(queryParams)
  326. download.excel(data, '维修工单.xls')
  327. } catch {
  328. } finally {
  329. exportLoading.value = false
  330. }
  331. }
  332. /** 初始化 **/
  333. onMounted(() => {
  334. getList()
  335. })
  336. </script>