list.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <div class="safety-platform-container">
  3. <header class="safety-platform-container__header">
  4. <div class="breadcrumb-title">责任区域(非区域执行人)</div>
  5. <el-tabs v-model="activeTab" @tab-change="handleTabChange">
  6. <el-tab-pane label="公共区域" :name="1" />
  7. <el-tab-pane label="非公共区域" :name="2" />
  8. </el-tabs>
  9. </header>
  10. <main class="safety-platform-container__main">
  11. <div style="margin-bottom: 20px">
  12. <el-button
  13. type="primary"
  14. @click="
  15. $router.push({
  16. name: 'areaAddResponsibilities:nonPublic',
  17. })
  18. "
  19. :icon="Plus"
  20. >添加
  21. </el-button>
  22. <el-button @click="batchImportVisible = true">导入</el-button>
  23. </div>
  24. <div class="search-form">
  25. <el-form :inline="true">
  26. <el-form-item label="区域名称">
  27. <el-input v-model="queryParams.queryParam.nameFunction" placeholder="搜索功能名称" style="width: 170px" />
  28. </el-form-item>
  29. <el-form-item label="状态">
  30. <el-select v-model="queryParams.queryParam.status" clearable placeholder="状态" style="width: 170px">
  31. <el-option :value="1" label="正常" />
  32. <el-option :value="2" label="待确认" />
  33. </el-select>
  34. </el-form-item>
  35. </el-form>
  36. <div>
  37. <el-button type="primary" @click="queryTableList">查询</el-button>
  38. <el-button @click="handleRestParams">重置</el-button>
  39. <el-button @click="handleDownload">导出</el-button>
  40. </div>
  41. </div>
  42. <div class="table-content">
  43. <el-table :data="tableData.data">
  44. <el-table-column type="index" label="序号" width="80" />
  45. <el-table-column label="楼号" prop="buildingNo" width="100" />
  46. <el-table-column label="楼层" prop="buildingArea" width="100" />
  47. <el-table-column label="房间/区域" prop="floorRoomNo" width="180" />
  48. <el-table-column label="功能名称" prop="nameFunction" width="160" />
  49. <el-table-column label="安全责任所/中心" prop="safetyResponsibleCenter" width="200" />
  50. <el-table-column label="安全责任所/中心负责人" prop="safetyCenterManagerName" width="200" />
  51. <el-table-column label="安全责任部门" prop="safetyResponsibleDepartment" width="180" />
  52. <el-table-column label="安全责任部门负责人" prop="safetyDepartmentManagerName" width="180" />
  53. <el-table-column label="安全具体责任人" prop="safetySpecificPersonName" width="180" />
  54. <el-table-column label="安全具体责任人联系方式" prop="safetyPersonContact" width="230" />
  55. <el-table-column label="是否进行过责任人变更" prop="changed" width="220" />
  56. <el-table-column label="变更原因" show-overflow-tooltip prop="changeReason" width="170" />
  57. <el-table-column label="状态" prop="statusName" width="100" />
  58. <el-table-column fixed="right" min-width="240" label="操作">
  59. <template #default="scope">
  60. <template v-if="scope.row.status === 1">
  61. <el-button
  62. type="primary"
  63. link
  64. @click="
  65. $router.push({
  66. name: 'areaEditResponsibilities:nonPublic',
  67. query: {
  68. id: scope.row.id,
  69. },
  70. })
  71. "
  72. >编辑
  73. </el-button>
  74. <el-popconfirm title="确定要删除吗?" @confirm="handleConfirmDeleteRow(scope)">
  75. <template #reference>
  76. <el-button type="primary" link>删除</el-button>
  77. </template>
  78. </el-popconfirm>
  79. <el-button
  80. type="primary"
  81. link
  82. @click="
  83. $router.push({
  84. name: 'areaChangeResponsibilities:nonPublic',
  85. query: {
  86. id: scope.row.id,
  87. },
  88. })
  89. "
  90. >变更</el-button
  91. >
  92. </template>
  93. <template v-if="scope.row.canChange === true">
  94. <el-button type="primary" link @click="handleAreaCheckListApprove(scope, 1)">确认</el-button>
  95. <el-button type="primary" link @click="handleAreaCheckListApprove(scope, 0)">拒绝</el-button>
  96. </template>
  97. <template v-if="scope.row.status === 3">
  98. <el-button type="primary" link>变更</el-button>
  99. </template>
  100. <el-button
  101. type="primary"
  102. link
  103. @click="
  104. $router.push({
  105. name: 'areaViewResponsibilities:nonPublic',
  106. query: {
  107. id: scope.row.id,
  108. },
  109. })
  110. "
  111. >查看</el-button
  112. >
  113. <el-button
  114. link
  115. type="primary"
  116. v-if="scope.row.creatBy === id && scope.row.status === 2"
  117. @click="handleAreaCheckListApprove(scope, 0)"
  118. >
  119. 撤回
  120. </el-button>
  121. <template v-if="scope.row.changed === '是'">
  122. <el-button type="primary" link @click="changedList(scope.row)">变更记录</el-button>
  123. </template>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. </div>
  128. <div class="pagination-container" v-if="tableData.total > 0">
  129. <el-pagination
  130. background
  131. layout="prev, pager, next, jumper,sizes, total"
  132. :current-page="queryParams.pageNumber"
  133. :page-size="queryParams.pageSize"
  134. :total="tableData.total"
  135. :page-sizes="[10, 20, 50, 100]"
  136. @size-change="handleSizeChange"
  137. @current-change="handleCurrentChange"
  138. />
  139. </div>
  140. </main>
  141. <!-- 变更记录 -->
  142. <el-dialog width="70%" v-model="changedVisible" title="公共区域变更记录">
  143. <div class="table-content">
  144. <h4>当前信息(变更后)</h4>
  145. <el-table :data="changedListData.currentRecord">
  146. <el-table-column type="index" label="编号" width="80" />
  147. <el-table-column label="楼号" prop="buildingNo" width="100" />
  148. <el-table-column label="楼层" prop="buildingArea" width="100" />
  149. <el-table-column label="房间/区域" prop="floorRoomNo" width="180" />
  150. <el-table-column label="功能名称" prop="nameFunction" width="160" />
  151. <el-table-column label="安全责任所/中心" prop="safetyResponsibleCenter" width="200" />
  152. <el-table-column label="安全责任所/中心负责人" prop="safetyCenterManagerName" width="200" />
  153. <el-table-column label="安全责任部门" prop="safetyResponsibleDepartment" width="180" />
  154. <el-table-column label="安全责任部门负责人" prop="safetyDepartmentManagerName" width="180" />
  155. <el-table-column label="安全具体责任人" prop="safetySpecificPersonName" width="180" />
  156. <el-table-column label="安全具体责任人联系方式" prop="safetyPersonContact" width="230" />
  157. <el-table-column label="变更原因" show-overflow-tooltip prop="changeReason" width="170" />
  158. <el-table-column label="状态" prop="statusName" width="100" />
  159. </el-table>
  160. </div>
  161. <div class="table-content">
  162. <h4>历史记录(变更前)</h4>
  163. <el-table :data="changedListData.historiesRecords">
  164. <el-table-column type="index" label="编号" width="80" />
  165. <el-table-column label="变更时间" prop="createdAt" width="180" />
  166. <el-table-column label="变更人" prop="safetySpecificPersonName" width="180" />
  167. <el-table-column label="楼号" prop="buildingNo" width="100" />
  168. <el-table-column label="楼层" prop="buildingArea" width="100" />
  169. <el-table-column label="房间/区域" prop="floorRoomNo" width="180" />
  170. <el-table-column label="功能名称" prop="nameFunction" width="160" />
  171. <el-table-column label="安全责任所/中心" prop="safetyResponsibleCenter" width="200" />
  172. <el-table-column label="安全责任所/中心负责人" prop="safetyCenterManagerName" width="200" />
  173. <el-table-column label="安全责任部门" prop="safetyResponsibleDepartment" width="180" />
  174. <el-table-column label="安全责任部门负责人" prop="safetyDepartmentManagerName" width="180" />
  175. <el-table-column label="安全具体责任人" prop="safetySpecificPersonName" width="180" />
  176. <el-table-column label="安全具体责任人联系方式" prop="safetyPersonContact" width="230" />
  177. <el-table-column label="变更原因" show-overflow-tooltip prop="changeReason" width="170" />
  178. <el-table-column label="状态" prop="statusName" width="100" />
  179. </el-table>
  180. </div>
  181. </el-dialog>
  182. </div>
  183. <BatchImport
  184. :visible="batchImportVisible"
  185. :importApiUrl="importApiUrl"
  186. :templateUrl="templateUrl"
  187. :show-template="false"
  188. :templateName="'责任区域-批量导入模版'"
  189. @close="() => (batchImportVisible = false)"
  190. @update="handleUpdate"
  191. />
  192. </template>
  193. <script lang="ts" setup>
  194. import { onMounted, ref, reactive } from 'vue';
  195. import { ElMessage } from 'element-plus';
  196. import { useRouter } from 'vue-router';
  197. import {
  198. areaCheckListQueryPage,
  199. areaCheckListApprove,
  200. areaCheckListDelete,
  201. areaCheckListExportArea,
  202. queryChangedList,
  203. } from '@/api/production-safety/responsibility-implementation';
  204. import urlJoin from 'url-join';
  205. import { BatchImport } from '@/components/batch-import';
  206. import { Plus } from '@element-plus/icons-vue';
  207. import { downloadFile } from '@/views/disaster/utils';
  208. import { useGlobSetting } from '@/hooks/setting';
  209. import { useUserInfoHook } from '@/views/disaster/hooks';
  210. import { downloadByData } from '@/utils/file/download';
  211. const router = useRouter();
  212. const activeTab = ref(2);
  213. const { id } = useUserInfoHook();
  214. const queryParams = reactive<any>({
  215. pageNumber: 1,
  216. pageSize: 10,
  217. queryParam: {
  218. type: 2,
  219. nameFunction: '',
  220. status: '',
  221. responsibilityPersonId: id,
  222. },
  223. });
  224. // 批量导入
  225. const batchImportVisible = ref(false);
  226. const { urlPrefix } = useGlobSetting();
  227. const importApiUrl = ref(urlJoin(urlPrefix, '/areaCheckList/importArea?type=2'));
  228. const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-law-regulation-template.xlsx');
  229. const handleUpdate = () => {
  230. batchImportVisible.value = false;
  231. queryTableList();
  232. };
  233. const changedVisible = ref(false)
  234. const changedListData = reactive({
  235. currentRecord:[],
  236. historiesRecords:[]
  237. })
  238. const changedList = async(item)=>{
  239. await fetchTableList(item.id)
  240. changedVisible.value = true
  241. }
  242. const fetchTableList = async (id)=>{
  243. let res = await queryChangedList({id})
  244. if(!res){ return }
  245. Object.assign(changedListData, {
  246. currentRecord: res.currentRecord || [],
  247. historiesRecords: res.historiesRecords || []
  248. })
  249. }
  250. const tableData = reactive({
  251. data: [],
  252. total: 0,
  253. });
  254. const handleTabChange = (tab) => {
  255. if (tab === 1) {
  256. router.push({
  257. name: 'areaResponsibilities:public',
  258. });
  259. } else if (tab === 2) {
  260. router.push({
  261. name: 'areaResponsibilities:nonPublic',
  262. });
  263. }
  264. };
  265. async function handleDownload() {
  266. try {
  267. const response = await areaCheckListExportArea(queryParams.queryParam);
  268. if (response) {
  269. const fileName = `责任区域(非区域执行人)_${new Date().toISOString().split('T')[0]}.xlsx`;
  270. downloadByData(response, fileName);
  271. ElMessage.success('导出成功');
  272. }
  273. } catch (e) {
  274. ElMessage.error('导出失败');
  275. console.log(e);
  276. }
  277. }
  278. const handleAreaCheckListApprove = (scope, approveType) => {
  279. areaCheckListApprove({
  280. id: scope.row.id,
  281. approveType,
  282. refuseReason: null,
  283. }).then(() => {
  284. if (approveType === 1) {
  285. ElMessage.success('请尽快修改该责任清单的安全责任所/中心、安全责任部门及相关负责人信息');
  286. } else {
  287. ElMessage.success('操作成功!');
  288. }
  289. queryTableList();
  290. });
  291. };
  292. const handleSizeChange = (value) => {
  293. queryParams.pageSize = value;
  294. queryTableList();
  295. };
  296. const handleCurrentChange = (value) => {
  297. queryParams.pageNumber = value;
  298. queryTableList();
  299. };
  300. const handleConfirmDeleteRow = (scope) => {
  301. areaCheckListDelete(scope.row.id).then(() => {
  302. ElMessage.success('删除成功!');
  303. queryTableList();
  304. });
  305. };
  306. const queryTableList = () => {
  307. areaCheckListQueryPage(queryParams).then((res) => {
  308. tableData.data = res.records;
  309. tableData.total = res.totalRow;
  310. });
  311. };
  312. const handleRestParams = () => {
  313. Object.assign(queryParams, {
  314. pageNumber: 1,
  315. pageSize: 10,
  316. queryParam: {
  317. ...queryParams.queryParam,
  318. status: '',
  319. nameFunction: '',
  320. },
  321. });
  322. queryTableList();
  323. };
  324. onMounted(() => {
  325. queryTableList();
  326. });
  327. </script>
  328. <style lang="scss" scoped>
  329. @use '@/styles/page-details-layout.scss' as *;
  330. @use '@/styles/page-main-layout.scss' as *;
  331. @use '@/styles/basic-table-action.scss' as *;
  332. :deep(.el-tabs__header) {
  333. margin: 0;
  334. }
  335. :deep(.el-tabs__item) {
  336. font-size: 14px !important;
  337. }
  338. :deep(.flexContent) {
  339. display: flex;
  340. }
  341. :deep(.breadcrumb .title) {
  342. margin-left: 0;
  343. }
  344. :deep(.el-form) {
  345. flex: 1;
  346. display: flex;
  347. row-gap: 15px;
  348. flex-wrap: wrap;
  349. }
  350. :deep(.el-form-item) {
  351. margin-bottom: 0;
  352. }
  353. :deep(main) {
  354. display: flex;
  355. flex-direction: column;
  356. }
  357. .search-form {
  358. min-width: 800px;
  359. display: flex;
  360. justify-content: space-between;
  361. align-items: flex-end;
  362. margin-bottom: 20px;
  363. }
  364. .button-content {
  365. margin-bottom: 20px;
  366. }
  367. .table-content {
  368. flex: 1;
  369. overflow: hidden;
  370. overflow-y: auto;
  371. }
  372. .page-content {
  373. display: flex;
  374. justify-content: flex-end;
  375. }
  376. .pagination-container {
  377. display: flex;
  378. justify-content: flex-end;
  379. }
  380. .pagination-container {
  381. margin-top: 20px;
  382. display: flex;
  383. justify-content: flex-end;
  384. }
  385. </style>