audit.vue 10 KB

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