list.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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 v-model="queryParams.queryParam.projectName" placeholder="搜索项目名称" style="width: 170px" />
  11. </el-form-item>
  12. <el-form-item label="状态">
  13. <el-select v-model="queryParams.queryParam.status" clearable placeholder="状态" style="width: 170px">
  14. <el-option value="" label="全部" />
  15. <el-option :value="1" label="待提交" />
  16. <el-option :value="2" label="待审批" />
  17. <el-option :value="3" label="已完成" />
  18. </el-select>
  19. </el-form-item>
  20. <el-form-item label="部门名称">
  21. <el-cascader
  22. v-model="queryParams.queryParam.departmentId"
  23. style="width: 170px"
  24. ref="cascaderRef"
  25. :options="firstLevelDepts"
  26. :props="cascaderProp"
  27. :show-all-levels="false"
  28. placeholder="部门名称"
  29. filterable
  30. @change="handleChangeDept"
  31. />
  32. </el-form-item>
  33. <el-form-item label="施工地点">
  34. <el-input
  35. v-model="queryParams.queryParam.constructionLocation"
  36. placeholder="输入施工地点"
  37. style="width: 170px"
  38. />
  39. </el-form-item>
  40. </el-form>
  41. <div>
  42. <el-button type="primary" @click="$router.push({ name: 'constructionSafetyManageAdd' })">添加 </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="项目名称" prop="projectName" width="180" />
  51. <el-table-column label="申请单号" prop="code" width="180" />
  52. <el-table-column label="施工地点(区域)" prop="constructionLocation" width="180" />
  53. <el-table-column label="工程施工内容简要描述 " prop="constructionContent" width="230" />
  54. <el-table-column label="施工单位名称" prop="constructionUnit" width="180" />
  55. <el-table-column label="施工项目负责人" prop="projectManagerName" width="180" />
  56. <el-table-column label="施工现场安全负责人" prop="siteSafetyManagerName" width="240" />
  57. <el-table-column label="当前流程节点" prop="nodeDescription" width="180" />
  58. <el-table-column label="状态" props="statusName" width="100" />
  59. <el-table-column fixed="right" min-width="240" label="操作">
  60. <template #default="scope">
  61. <el-button
  62. type="primary"
  63. link
  64. @click="$router.push({ name: 'constructionSafetyManageEdit', query: { id: scope.row.id } })"
  65. >编辑</el-button
  66. >
  67. <el-button
  68. type="primary"
  69. link
  70. @click="$router.push({ name: 'constructionSafetyManageView', query: { id: scope.row.id } })"
  71. >查看</el-button
  72. >
  73. <el-button type="primary" link @click="handleConfirmDeleteRow(scope)">删除</el-button>
  74. <el-button type="primary" link>审批</el-button>
  75. <el-button
  76. type="primary"
  77. link
  78. @click="$router.push({ name: 'constructionSafetyManageMonitor', query: { id: scope.row.id } })"
  79. >视频监控</el-button
  80. >
  81. </template>
  82. </el-table-column>
  83. </el-table>
  84. </div>
  85. <div class="pagination-container" v-if="tableData.total > 0">
  86. <el-pagination
  87. background
  88. :current-page="queryParams.pageNumber"
  89. :page-size="queryParams.pageSize"
  90. :total="tableData.total"
  91. @size-change="handleSizeChange"
  92. @current-change="handleCurrentChange"
  93. />
  94. </div>
  95. </main>
  96. </div>
  97. </template>
  98. <script lang="ts" setup>
  99. import { onMounted, reactive, ref } from 'vue';
  100. import { ElMessage } from 'element-plus';
  101. import { useRouter } from 'vue-router';
  102. import {
  103. constructionSafetyQueryPageConstruction,
  104. constructionSafetyDeleteConstructionById,
  105. } from '@/api/production-safety/responsibility-implementation';
  106. import { omit } from 'lodash-es';
  107. import { useUserInfoHook } from '@/hooks/useUserInfoHook';
  108. import { unformatAttachment } from '@/components/UploadFiles/utils';
  109. import { downloadFile } from '@/views/disaster/utils';
  110. import { formatDeptTree } from '@/views/disaster/utils/formatDeptTree';
  111. import { getAllDepartments } from '@/api/auth/dept';
  112. const router = useRouter();
  113. const { id } = useUserInfoHook();
  114. const firstLevelDepts = ref<any[]>([]);
  115. const cascaderProp = {
  116. expandTrigger: 'click',
  117. checkStrictly: true,
  118. // emitPath: false,
  119. value: 'id',
  120. label: 'deptName',
  121. };
  122. const queryParams = reactive<any>({
  123. pageNumber: 1,
  124. pageSize: 10,
  125. queryParam: {
  126. status: '',
  127. projectName: '',
  128. constructionLocation: '',
  129. department: '',
  130. departmentId: [],
  131. },
  132. });
  133. const cascaderRef = ref();
  134. const tableData = reactive({
  135. data: [],
  136. total: 0,
  137. });
  138. const handleSizeChange = (value) => {};
  139. const handleCurrentChange = (value) => {
  140. queryParams.pageNumber = value;
  141. queryTableList();
  142. };
  143. const getDeptData = () => {
  144. getAllDepartments().then((res) => {
  145. firstLevelDepts.value = formatDeptTree(res);
  146. });
  147. };
  148. const handleChangeDept = () => {
  149. const deptInfo = cascaderRef.value?.getCheckedNodes();
  150. if (deptInfo?.[0]) {
  151. queryParams.queryParam.department = deptInfo[0].label;
  152. queryParams.queryParam.departmentId = deptInfo[0].pathValues;
  153. }
  154. };
  155. const handleConfirmDeleteRow = (scope) => {
  156. constructionSafetyDeleteConstructionById(scope.row.id).then(() => {
  157. ElMessage.success('删除成功!');
  158. queryTableList();
  159. });
  160. };
  161. const queryTableList = () => {
  162. constructionSafetyQueryPageConstruction({
  163. ...queryParams,
  164. queryParam: {
  165. ...omit(queryParams.queryParam, 'responsibleDepartmentId'),
  166. },
  167. }).then((res) => {
  168. tableData.data = res.records;
  169. tableData.total = res.totalRow;
  170. });
  171. };
  172. const handleRestParams = () => {
  173. Object.assign(queryParams, {
  174. pageNumber: 1,
  175. pageSize: 10,
  176. queryParam: {
  177. ...queryParams.queryParam,
  178. status: '',
  179. projectName: '',
  180. constructionLocation: '',
  181. department: '',
  182. departmentId: [],
  183. },
  184. });
  185. queryTableList();
  186. };
  187. onMounted(async () => {
  188. await getDeptData();
  189. queryTableList();
  190. });
  191. </script>
  192. <style lang="scss" scoped>
  193. @use '@/styles/page-details-layout.scss' as *;
  194. @use '@/styles/page-main-layout.scss' as *;
  195. @use '@/styles/basic-table-action.scss' as *;
  196. :deep(.el-tabs__header) {
  197. margin: 0;
  198. }
  199. :deep(.el-tabs__item) {
  200. font-size: 14px !important;
  201. }
  202. :deep(.flexContent) {
  203. display: flex;
  204. }
  205. :deep(.breadcrumb .title) {
  206. margin-left: 0;
  207. }
  208. :deep(.el-form) {
  209. flex: 1;
  210. display: flex;
  211. row-gap: 15px;
  212. flex-wrap: wrap;
  213. }
  214. :deep(.el-form-item) {
  215. margin-bottom: 0;
  216. }
  217. :deep(main) {
  218. display: flex;
  219. flex-direction: column;
  220. }
  221. .search-form {
  222. min-width: 800px;
  223. display: flex;
  224. justify-content: space-between;
  225. align-items: center;
  226. margin-bottom: 20px;
  227. }
  228. .button-content {
  229. margin-bottom: 20px;
  230. }
  231. .table-content {
  232. flex: 1;
  233. overflow: hidden;
  234. overflow-y: auto;
  235. }
  236. .page-content {
  237. display: flex;
  238. justify-content: flex-end;
  239. }
  240. </style>