audit.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <div class="safety-platform-container">
  3. <header class="safety-platform-container__header">
  4. <div class="breadcrumb-title"> 危险作业管理审核 </div>
  5. </header>
  6. <main class="safety-platform-container__main">
  7. <div class="search-form">
  8. <el-form :inline="true">
  9. <el-form-item label="申请单位名称">
  10. <el-input
  11. v-model="queryParams.queryParam.applicationUnitName"
  12. placeholder="申请单位名称"
  13. style="width: 170px"
  14. />
  15. </el-form-item>
  16. <el-form-item label="状态">
  17. <el-select v-model="queryParams.queryParam.status" clearable placeholder="状态" style="width: 170px">
  18. <el-option value="" label="全部" />
  19. <el-option :value="1" label="待提交" />
  20. <el-option :value="2" label="待审批" />
  21. <el-option :value="3" label="已完成" />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="申请人名称">
  25. <el-input v-model="queryParams.queryParam.applicantName" placeholder="搜索申请人" style="width: 170px" />
  26. </el-form-item>
  27. <el-form-item label="申请部门">
  28. <el-cascader
  29. v-model="queryParams.queryParam.applicationDepartmentId"
  30. style="width: 170px"
  31. ref="cascaderRef"
  32. :options="firstLevelDepts"
  33. :props="cascaderProp"
  34. :show-all-levels="false"
  35. placeholder="部门名称"
  36. filterable
  37. @change="handleChangeDept"
  38. />
  39. </el-form-item>
  40. </el-form>
  41. <div>
  42. <!-- <el-button type="primary" @click="$router.push({ name: 'hazardApprovalManageAdd' })">添加 </el-button> -->
  43. <el-button type="primary" @click="queryTableList">查询</el-button>
  44. <el-button @click="handleRestParams">重置</el-button>
  45. <el-button @click="handleDownload">导出</el-button>
  46. </div>
  47. </div>
  48. <div class="table-content">
  49. <el-table :data="tableData.data">
  50. <el-table-column type="index" label="序号" width="80" />
  51. <el-table-column label="申请单号" width="160" prop="code" />
  52. <el-table-column label="申请单位" width="180" prop="applicationUnitName" />
  53. <el-table-column label="申请人" width="180" prop="applicantName" />
  54. <el-table-column label="申请部门" width="180" prop="applicationDepartment" />
  55. <el-table-column label="申请人电话" width="180" prop="applicantPhone" />
  56. <el-table-column label="作业类别" width="180" prop="hazardOperationTypeName" />
  57. <el-table-column label="申请状态" width="120" prop="statusName" />
  58. <el-table-column label="申请时间" width="180" prop="createdAt" />
  59. <!-- <el-table-column label="备注" width="180" prop="remark" /> -->
  60. <el-table-column label="当前节点名称" width="180" prop="nodeDescription" />
  61. <el-table-column fixed="right" min-width="140" label="操作">
  62. <template #default="scope">
  63. <!-- <el-button
  64. type="primary"
  65. link
  66. @click="$router.push({ name: 'constructionSafetyManageEdit', query: { id: scope.row.id } })"
  67. >编辑</el-button
  68. > -->
  69. <el-button
  70. type="primary"
  71. link
  72. @click="$router.push({ name: 'hazardApprovalManageView', query: { id: scope.row.id } })"
  73. >查看</el-button
  74. >
  75. <!-- <el-button type="primary" link @click="handleConfirmDeleteRow(scope)">删除</el-button> -->
  76. <el-button type="primary" link @click="openApproveDialog(scope)" v-if="scope.row.status === 2">审核</el-button>
  77. <!-- <el-button
  78. type="primary"
  79. link
  80. @click="$router.push({ name: 'constructionSafetyManageMonitor', query: { id: scope.row.id } })"
  81. >视频监控</el-button
  82. > -->
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. </div>
  87. <div class="pagination-container" v-if="tableData.total > 0">
  88. <el-pagination
  89. background
  90. :current-page="queryParams.pageNumber"
  91. :page-size="queryParams.pageSize"
  92. :total="tableData.total"
  93. @size-change="handleSizeChange"
  94. @current-change="handleCurrentChange"
  95. />
  96. </div>
  97. </main>
  98. </div>
  99. <!-- 审核弹窗 -->
  100. <BasicDialog v-model="showApproveDialog" ref="basicDialogRef" title="审核" @refresh="closeDialog">
  101. <template #form>
  102. <el-form ref="formRef" :model="formData" style="width: 100%">
  103. <el-form-item label="审核:" prop="approvalStatus" :rules="[{ required: true, message: '请选择审核状态' }]">
  104. <el-radio-group v-model="formData.approvalStatus">
  105. <el-radio :value="2">通过</el-radio>
  106. <el-radio :value="3">退回</el-radio>
  107. </el-radio-group>
  108. </el-form-item>
  109. <el-form-item
  110. v-if="formData.approvalStatus === 3"
  111. label="退回原因:"
  112. prop="returnReason"
  113. :rules="[{ required: true, message: '请输入退回原因' }]"
  114. >
  115. <el-input v-model="formData.returnReason" placeholder="请输入退回原因" type="textarea" />
  116. </el-form-item>
  117. </el-form>
  118. </template>
  119. <template #footer>
  120. <el-button type="primary" @click="handleApproveSubmit">提交</el-button>
  121. <el-button @click="closeDialog">取消</el-button>
  122. </template>
  123. </BasicDialog>
  124. </template>
  125. <script lang="ts" setup>
  126. import { onMounted, reactive, ref } from 'vue';
  127. import { ElMessage } from 'element-plus';
  128. import { useRouter } from 'vue-router';
  129. import {
  130. dangerWorkQueryDangerWorkApprovalPage,
  131. dangerWorkSaveApproval,
  132. exportHazardWorkApprovalList,
  133. } from '@/api/production-safety/responsibility-implementation';
  134. import { omit } from 'lodash-es';
  135. import BasicDialog from '@/components/BasicDialog.vue';
  136. import { downloadByData } from '@/utils/file/download';
  137. import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
  138. import { getAllDepartments } from '@/api/auth/dept';
  139. import { APPROVAL_STATUS } from '@/views/emergency/emergency-plan/src/constant';
  140. import { type ElForm } from 'element-plus';
  141. const firstLevelDepts = ref<any[]>([]);
  142. const showApproveDialog = ref(false);
  143. const basicDialogRef = ref<InstanceType<typeof BasicDialog>>();
  144. const formRef = ref<InstanceType<typeof ElForm>>();
  145. const formData = reactive({
  146. approvalStatus: APPROVAL_STATUS.APPROVED,
  147. returnReason: '',
  148. });
  149. const cascaderProp = {
  150. expandTrigger: 'click',
  151. checkStrictly: true,
  152. // emitPath: false,
  153. value: 'id',
  154. label: 'deptName',
  155. };
  156. const queryParams = reactive<any>({
  157. pageNumber: 1,
  158. pageSize: 10,
  159. queryParam: {
  160. status: '',
  161. applicationUnitName: '',
  162. applicantName: '',
  163. applicationDepartmentId: [],
  164. },
  165. });
  166. const currentRow = ref<any>();
  167. const cascaderRef = ref();
  168. const tableData = reactive({
  169. data: [],
  170. total: 0,
  171. });
  172. const handleSizeChange = (value) => {};
  173. const handleCurrentChange = (value) => {
  174. queryParams.pageNumber = value;
  175. queryTableList();
  176. };
  177. const closeDialog = () => {
  178. formRef.value?.resetFields();
  179. showApproveDialog.value = false;
  180. currentRow.value = null;
  181. };
  182. function openApproveDialog(scope) {
  183. currentRow.value = scope.row;
  184. showApproveDialog.value = true;
  185. }
  186. function handleApproveSubmit() {
  187. formRef.value?.validate(async (valid) => {
  188. if (valid) {
  189. try {
  190. await dangerWorkSaveApproval({
  191. approvalOrder: currentRow.value.approvalOrder,
  192. approvalStatus: formData.approvalStatus,
  193. id: currentRow.value.id,
  194. returnReason: formData.returnReason,
  195. });
  196. ElMessage.success('审核成功');
  197. showApproveDialog.value = false;
  198. queryTableList();
  199. } catch (e) {
  200. console.error('审核失败:', e);
  201. ElMessage.error('审核失败,请重试');
  202. }
  203. } else {
  204. }
  205. });
  206. }
  207. const getDeptData = () => {
  208. getAllDepartments().then((res) => {
  209. firstLevelDepts.value = formatDeptTree(res);
  210. });
  211. };
  212. const handleChangeDept = () => {
  213. const deptInfo = cascaderRef.value?.getCheckedNodes();
  214. if (deptInfo?.[0]) {
  215. queryParams.queryParam.department = deptInfo[0].label;
  216. queryParams.queryParam.departmentId = deptInfo[0].pathValues;
  217. }
  218. };
  219. const queryTableList = () => {
  220. dangerWorkQueryDangerWorkApprovalPage({
  221. ...queryParams,
  222. queryParam: {
  223. ...omit(queryParams.queryParam, 'responsibleDepartmentId'),
  224. },
  225. }).then((res) => {
  226. tableData.data = res.records;
  227. tableData.total = res.totalRow;
  228. });
  229. };
  230. const handleRestParams = () => {
  231. Object.assign(queryParams, {
  232. pageNumber: 1,
  233. pageSize: 10,
  234. queryParam: {
  235. ...queryParams.queryParam,
  236. status: '',
  237. applicationUnitName: '',
  238. applicantName: '',
  239. applicationDepartmentId: [],
  240. },
  241. });
  242. queryTableList();
  243. };
  244. const handleDownload = async () => {
  245. try {
  246. const response = await exportHazardWorkApprovalList(queryParams.queryParam);
  247. if (response) {
  248. const fileName = `危险作业管理审核_${new Date().toISOString().split('T')[0]}.xlsx`;
  249. downloadByData(response, fileName);
  250. ElMessage.success('导出成功');
  251. }
  252. } catch (e) {
  253. console.error('导出院级文件失败:', e);
  254. ElMessage.error('导出失败,请重试');
  255. }
  256. };
  257. onMounted(async () => {
  258. await getDeptData();
  259. queryTableList();
  260. });
  261. </script>
  262. <style lang="scss" scoped>
  263. @use '@/styles/page-details-layout.scss' as *;
  264. @use '@/styles/page-main-layout.scss' as *;
  265. @use '@/styles/basic-table-action.scss' as *;
  266. :deep(.el-tabs__header) {
  267. margin: 0;
  268. }
  269. :deep(.el-tabs__item) {
  270. font-size: 14px !important;
  271. }
  272. :deep(.flexContent) {
  273. display: flex;
  274. }
  275. :deep(.breadcrumb .title) {
  276. margin-left: 0;
  277. }
  278. :deep(main) {
  279. display: flex;
  280. flex-direction: column;
  281. }
  282. .search-form {
  283. min-width: 800px;
  284. display: flex;
  285. justify-content: space-between;
  286. align-items: center;
  287. margin-bottom: 20px;
  288. :deep(.el-form) {
  289. flex: 1;
  290. display: flex;
  291. row-gap: 15px;
  292. flex-wrap: wrap;
  293. }
  294. :deep(.el-form-item) {
  295. margin-bottom: 0;
  296. }
  297. }
  298. .button-content {
  299. margin-bottom: 20px;
  300. }
  301. .table-content {
  302. flex: 1;
  303. overflow: hidden;
  304. overflow-y: auto;
  305. }
  306. .page-content {
  307. display: flex;
  308. justify-content: flex-end;
  309. }
  310. </style>