audit.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  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 style="margin-bottom: 20px">
  8. <el-button type="primary" @click="$router.push({ name: 'constructionSafetyManageAdd' })">添加 </el-button>
  9. </div>
  10. <div class="search-form">
  11. <el-form :inline="true">
  12. <el-form-item label="项目名称">
  13. <el-input v-model="queryParams.queryParam.projectName" placeholder="搜索项目名称" style="width: 170px" />
  14. </el-form-item>
  15. <!-- <el-form-item label="状态">
  16. <el-select v-model="queryParams.queryParam.status" clearable placeholder="状态" style="width: 170px">
  17. <el-option value="" label="全部" />
  18. <el-option :value="1" label="待提交" />
  19. <el-option :value="2" label="待审批" />
  20. <el-option :value="3" label="已完成" />
  21. </el-select>
  22. </el-form-item> -->
  23. <el-form-item label="申请部门名称">
  24. <el-cascader
  25. v-model="queryParams.queryParam.departmentId"
  26. style="width: 170px"
  27. ref="cascaderRef"
  28. :options="firstLevelDepts"
  29. :props="cascaderProp"
  30. :show-all-levels="false"
  31. placeholder="部门名称"
  32. filterable
  33. @change="handleChangeDept"
  34. />
  35. </el-form-item>
  36. <el-form-item label="施工地点">
  37. <el-input
  38. v-model="queryParams.queryParam.constructionLocation"
  39. placeholder="输入施工地点"
  40. style="width: 170px"
  41. />
  42. </el-form-item>
  43. </el-form>
  44. <div>
  45. <el-button type="primary" @click="queryTableList">查询</el-button>
  46. <el-button @click="handleRestParams">重置</el-button>
  47. </div>
  48. </div>
  49. <div class="table-content">
  50. <el-table :data="tableData.data">
  51. <el-table-column type="index" label="序号" width="80" />
  52. <el-table-column label="项目名称" prop="projectName" width="180" />
  53. <el-table-column label="申请单号" prop="code" width="180" />
  54. <el-table-column label="施工地点(区域)" prop="constructionLocation" width="180" />
  55. <el-table-column label="工程施工内容简要描述 " prop="constructionContent" width="230" />
  56. <el-table-column label="施工单位名称" prop="constructionUnit" width="180" />
  57. <el-table-column label="施工项目负责人" prop="projectManagerName" width="180" />
  58. <el-table-column label="施工现场安全负责人" prop="siteSafetyManagerName" width="240" />
  59. <el-table-column label="当前流程节点" prop="nodeDescription" width="180" />
  60. <el-table-column label="状态" prop="statusName" width="100" />
  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: 'constructionSafetyManageView', 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)">审核</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. constructionSafetyQueryConstructionApprovalPage,
  131. constructionSafetySaveApproval,
  132. } from '@/api/production-safety/responsibility-implementation';
  133. import { omit } from 'lodash-es';
  134. import BasicDialog from '@/components/BasicDialog.vue';
  135. import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
  136. import { getAllDepartments } from '@/api/auth/dept';
  137. import { APPROVAL_STATUS } from '@/views/emergency/emergency-plan/src/constant';
  138. import { type ElForm } from 'element-plus';
  139. const firstLevelDepts = ref<any[]>([]);
  140. const showApproveDialog = ref(false);
  141. const basicDialogRef = ref<InstanceType<typeof BasicDialog>>();
  142. const formRef = ref<InstanceType<typeof ElForm>>();
  143. const formData = reactive({
  144. approvalStatus: APPROVAL_STATUS.APPROVED,
  145. returnReason: '',
  146. });
  147. const cascaderProp = {
  148. expandTrigger: 'click',
  149. checkStrictly: true,
  150. // emitPath: false,
  151. value: 'id',
  152. label: 'deptName',
  153. };
  154. const queryParams = reactive<any>({
  155. pageNumber: 1,
  156. pageSize: 10,
  157. queryParam: {
  158. approvalStatus: '1',
  159. projectName: '',
  160. constructionLocation: '',
  161. department: '',
  162. departmentId: [],
  163. },
  164. });
  165. const currentRow = ref<any>();
  166. const cascaderRef = ref();
  167. const tableData = reactive({
  168. data: [],
  169. total: 0,
  170. });
  171. const handleSizeChange = (value) => {};
  172. const handleCurrentChange = (value) => {
  173. queryParams.pageNumber = value;
  174. queryTableList();
  175. };
  176. const closeDialog = () => {
  177. formRef.value?.resetFields();
  178. showApproveDialog.value = false;
  179. currentRow.value = null;
  180. };
  181. function openApproveDialog(scope) {
  182. currentRow.value = scope.row;
  183. showApproveDialog.value = true;
  184. }
  185. function handleApproveSubmit() {
  186. formRef.value?.validate(async (valid) => {
  187. if (valid) {
  188. try {
  189. await constructionSafetySaveApproval({
  190. approvalOrder: currentRow.value.approvalOrder,
  191. approvalStatus: formData.approvalStatus,
  192. planId: currentRow.value.id,
  193. returnReason: formData.returnReason,
  194. });
  195. ElMessage.success('审核成功');
  196. showApproveDialog.value = false;
  197. queryTableList();
  198. } catch (e) {
  199. console.error('审核失败:', e);
  200. ElMessage.error('审核失败,请重试');
  201. }
  202. } else {
  203. }
  204. });
  205. }
  206. const getDeptData = () => {
  207. getAllDepartments().then((res) => {
  208. firstLevelDepts.value = formatDeptTree(res);
  209. });
  210. };
  211. const handleChangeDept = () => {
  212. const deptInfo = cascaderRef.value?.getCheckedNodes();
  213. if (deptInfo?.[0]) {
  214. queryParams.queryParam.department = deptInfo[0].value;
  215. queryParams.queryParam.departmentId = deptInfo[0].value;
  216. }
  217. };
  218. const queryTableList = () => {
  219. constructionSafetyQueryConstructionApprovalPage({
  220. ...queryParams,
  221. queryParam: {
  222. ...omit(queryParams.queryParam, 'responsibleDepartmentId'),
  223. },
  224. }).then((res) => {
  225. tableData.data = res.records;
  226. tableData.total = res.totalRow;
  227. });
  228. };
  229. const handleRestParams = () => {
  230. Object.assign(queryParams, {
  231. pageNumber: 1,
  232. pageSize: 10,
  233. queryParam: {
  234. ...queryParams.queryParam,
  235. status: '',
  236. projectName: '',
  237. constructionLocation: '',
  238. department: '',
  239. departmentId: [],
  240. },
  241. });
  242. queryTableList();
  243. };
  244. onMounted(async () => {
  245. await getDeptData();
  246. queryTableList();
  247. });
  248. </script>
  249. <style lang="scss" scoped>
  250. @use '@/styles/page-details-layout.scss' as *;
  251. @use '@/styles/page-main-layout.scss' as *;
  252. @use '@/styles/basic-table-action.scss' as *;
  253. :deep(.el-tabs__header) {
  254. margin: 0;
  255. }
  256. :deep(.el-tabs__item) {
  257. font-size: 14px !important;
  258. }
  259. :deep(.flexContent) {
  260. display: flex;
  261. }
  262. :deep(.breadcrumb .title) {
  263. margin-left: 0;
  264. }
  265. :deep(main) {
  266. display: flex;
  267. flex-direction: column;
  268. }
  269. .search-form {
  270. min-width: 800px;
  271. display: flex;
  272. justify-content: space-between;
  273. align-items: flex-end;
  274. margin-bottom: 20px;
  275. :deep(.el-form) {
  276. flex: 1;
  277. display: flex;
  278. row-gap: 15px;
  279. flex-wrap: wrap;
  280. }
  281. :deep(.el-form-item) {
  282. margin-bottom: 0;
  283. }
  284. }
  285. .button-content {
  286. margin-bottom: 20px;
  287. }
  288. .table-content {
  289. flex: 1;
  290. overflow: hidden;
  291. overflow-y: auto;
  292. }
  293. .page-content {
  294. display: flex;
  295. justify-content: flex-end;
  296. }
  297. </style>