index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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="orderName">
  19. <el-input
  20. v-model="queryParams.orderName"
  21. placeholder="请输入工单名"
  22. clearable
  23. @keyup.enter="handleQuery"
  24. class="!w-240px"
  25. />
  26. </el-form-item>
  27. <el-form-item label="工单状态" prop="orderStatus">
  28. <el-select
  29. v-model="queryParams.orderStatus"
  30. placeholder="工单状态"
  31. clearable
  32. class="!w-240px"
  33. >
  34. <el-option
  35. v-for="dict in getStrDictOptions(DICT_TYPE.OPERATION_FILL_ORDER_STATUS)"
  36. :key="dict.value"
  37. :label="dict.label"
  38. :value="dict.value"
  39. />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item label="创建时间" prop="createTime">
  43. <el-date-picker
  44. v-model="queryParams.createTime"
  45. value-format="YYYY-MM-DD HH:mm:ss"
  46. type="daterange"
  47. start-placeholder="开始日期"
  48. end-placeholder="结束日期"
  49. :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
  50. class="!w-220px"
  51. />
  52. </el-form-item>
  53. <el-form-item>
  54. <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
  55. <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
  56. <!-- <el-button-->
  57. <!-- type="primary"-->
  58. <!-- plain-->
  59. <!-- @click="openForm('create')"-->
  60. <!-- v-hasPermi="['rq:iot-inspect-order:create']"-->
  61. <!-- >-->
  62. <!-- <Icon icon="ep:plus" class="mr-5px" /> 新增-->
  63. <!-- </el-button>-->
  64. <!-- <el-button
  65. type="success"
  66. plain
  67. @click="handleExport"
  68. :loading="exportLoading"
  69. v-hasPermi="['rq:iot-inspect-order:export']"
  70. >
  71. <Icon icon="ep:download" class="mr-5px" /> 导出
  72. </el-button>-->
  73. </el-form-item>
  74. </el-form>
  75. </ContentWrap>
  76. <!-- 列表 -->
  77. <ContentWrap>
  78. <el-table v-loading="loading" :data="list" :stripe="true" >
  79. <el-table-column label="序号" width="60" align="center">
  80. <template #default="scope">
  81. {{ scope.$index + 1 }}
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="工单名称" align="center" prop="orderName" width="300"/>
  85. <el-table-column label="责任人" align="center" prop="userName" />
  86. <!-- <el-table-column label="工单类型" align="center" prop="orderType" />-->
  87. <el-table-column label="工单状态" align="center" prop="orderStatus" >
  88. <template #default="scope">
  89. <dict-tag :type="DICT_TYPE.OPERATION_FILL_ORDER_STATUS" :value="scope.row.orderStatus" />
  90. </template>
  91. </el-table-column>
  92. <!-- <el-table-column label="备注" align="center" prop="remark" />-->
  93. <!-- <el-table-column
  94. label="创建时间"
  95. align="center"
  96. prop="createTime"
  97. :formatter="dateFormatter"
  98. width="180px"
  99. />-->
  100. <el-table-column label="操作" align="center" min-width="120px">
  101. <template #default="scope">
  102. <!-- <el-button-->
  103. <!-- link-->
  104. <!-- type="primary"-->
  105. <!-- @click="openForm('update', scope.row.id)"-->
  106. <!-- v-hasPermi="['rq:iot-inspect-order:update']"-->
  107. <!-- >-->
  108. <!-- 编辑-->
  109. <!-- </el-button>-->
  110. <!-- <el-button-->
  111. <!-- link-->
  112. <!-- type="danger"-->
  113. <!-- @click="handleDelete(scope.row.id)"-->
  114. <!-- v-hasPermi="['rq:iot-inspect-order:delete']"-->
  115. <!-- >-->
  116. <!-- 删除-->
  117. <!-- </el-button>-->
  118. <el-button
  119. link
  120. type="primary"
  121. @click="openWrite(scope.row.deptId+','+scope.row.userId+','+scope.row.createTime)"
  122. v-hasPermi="['rq:iot-opeation-fill:update']"
  123. >
  124. 填写
  125. </el-button>
  126. <el-button
  127. link
  128. type="primary"
  129. @click="openWrite(scope.row.deptId+','+scope.row.userId+','+scope.row.createTime)"
  130. v-if='scope.row.orderStatus === "已完成"'
  131. >
  132. 查看
  133. </el-button>
  134. <el-button
  135. link
  136. type="primary"
  137. @click="openWrite(scope.row.deptId)"
  138. v-else
  139. >
  140. 查看
  141. </el-button>
  142. </template>
  143. </el-table-column>
  144. </el-table>
  145. <!-- 分页 -->
  146. <Pagination
  147. :total="total"
  148. v-model:page="queryParams.pageNo"
  149. v-model:limit="queryParams.pageSize"
  150. @pagination="getList"
  151. />
  152. </ContentWrap>
  153. </el-col>
  154. </el-row>
  155. <!-- 表单弹窗:添加/修改 -->
  156. <IotInspectOrderForm ref="formRef" @success="getList" />
  157. </template>
  158. <script setup lang="ts">
  159. import { dateFormatter } from '@/utils/formatTime'
  160. import download from '@/utils/download'
  161. import { IotInspectOrderApi, IotInspectOrderVO } from '@/api/pms/inspect/order'
  162. //import IotInspectOrderForm from './IotInspectOrderForm.vue'
  163. import {DICT_TYPE, getStrDictOptions} from "@/utils/dict";
  164. import DeptTree from "@/views/system/user/DeptTree.vue";
  165. import {IotOpeationFillApi, IotOpeationFillVO} from "@/api/pms/iotopeationfill";
  166. import {useUserStore} from "@/store/modules/user";
  167. const { push } = useRouter()
  168. /** 巡检工单 列表 */
  169. defineOptions({ name: 'IotOpeationFill' })
  170. const message = useMessage() // 消息弹窗
  171. const { t } = useI18n() // 国际化
  172. const loading = ref(true) // 列表的加载中
  173. const list = ref<IotOpeationFillVO[]>([]) // 列表的数据
  174. const total = ref(0) // 列表的总页数
  175. const queryParams = reactive({
  176. pageNo: 1,
  177. pageSize: 10,
  178. inspectOrderTitle: undefined,
  179. inspectOrderCode: undefined,
  180. status: undefined,
  181. remark: undefined,
  182. createTime: [],
  183. deptId: undefined,
  184. deviceIds: undefined,
  185. userId:useUserStore().getUser.id
  186. })
  187. const queryFormRef = ref() // 搜索的表单
  188. const exportLoading = ref(false) // 导出的加载中
  189. const handleDeptNodeClick = async (row) => {
  190. queryParams.deptId = row.id
  191. await getList()
  192. }
  193. /** 查询列表 */
  194. const getList = async () => {
  195. loading.value = true
  196. try {
  197. const data = await IotOpeationFillApi.getIotOpeationFillPage1(queryParams)
  198. list.value = data.list
  199. total.value = data.total
  200. } finally {
  201. loading.value = false
  202. }
  203. }
  204. /** 搜索按钮操作 */
  205. const handleQuery = () => {
  206. queryParams.pageNo = 1
  207. getList()
  208. }
  209. /** 重置按钮操作 */
  210. const resetQuery = () => {
  211. queryFormRef.value.resetFields()
  212. handleQuery()
  213. }
  214. /** 添加/修改操作 */
  215. const formRef = ref()
  216. const openForm = (id?: number) => {
  217. push({ name: 'InspectOrderDetail', params:{id} })
  218. }
  219. const openWrite = (id?: string) => {
  220. push({ name: 'FillOrderInfo',params:{id}})
  221. }
  222. /** 删除按钮操作 */
  223. const handleDelete = async (id: number) => {
  224. try {
  225. // 删除的二次确认
  226. await message.delConfirm()
  227. // 发起删除
  228. await IotInspectOrderApi.deleteIotInspectOrder(id)
  229. message.success(t('common.delSuccess'))
  230. // 刷新列表
  231. await getList()
  232. } catch {}
  233. }
  234. /** 导出按钮操作 */
  235. const handleExport = async () => {
  236. try {
  237. // 导出的二次确认
  238. await message.exportConfirm()
  239. // 发起导出
  240. exportLoading.value = true
  241. const data = await IotInspectOrderApi.exportIotInspectOrder(queryParams)
  242. download.excel(data, '巡检工单.xls')
  243. } catch {
  244. } finally {
  245. exportLoading.value = false
  246. }
  247. }
  248. /** 初始化 **/
  249. onMounted(() => {
  250. getList()
  251. })
  252. </script>