| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471 |
- <template>
- <div class="safety-platform-container">
- <header class="safety-platform-container__header">
- <div class="breadcrumb-title">安全责任区域</div>
- <el-tabs v-model="activeTab" @tab-change="handleTabChange">
- <el-tab-pane label="公共区域" :name="1" />
- <el-tab-pane label="非公共区域" :name="2" />
- </el-tabs>
- </header>
- <main class="safety-platform-container__main">
- <div style="margin-bottom: 20px">
- <el-button
- type="primary"
- @click="
- $router.push({
- name: 'areaAddResponsibilities:public',
- })
- "
- :icon="Plus"
- >添加
- </el-button>
- <el-button plain @click="batchImportVisible = true">
- 导入
- </el-button>
- </div>
- <div class="search-form">
- <el-form :inline="true">
- <el-form-item label="区域名称">
- <el-input v-model="queryParams.queryParam.nameFunction" placeholder="搜索功能名称" style="width: 170px" />
- </el-form-item>
- <el-form-item label="状态">
- <el-select v-model="queryParams.queryParam.status" clearable placeholder="状态" style="width: 170px">
- <el-option :value="1" label="正常" />
- <el-option :value="2" label="待确认" />
- </el-select>
- </el-form-item>
- </el-form>
- <div>
- <!-- <el-button @click="batchImportVisible = true">导入</el-button>
- <el-button type="primary" @click="handleDownload">导出</el-button> -->
- <el-button type="primary" @click="queryTableList">查询</el-button>
- <el-button @click="handleRestParams">重置</el-button>
- <el-button plain @click="handleDownload">
- 导出
- </el-button>
- </div>
- </div>
- <div class="table-content">
- <el-table :data="tableData.data">
- <el-table-column type="index" label="序号" width="80" />
- <el-table-column label="楼宇/区域" prop="buildingArea" width="120" />
- <el-table-column label="楼层/房号" prop="floorRoomNo" width="180" />
- <el-table-column label="功能名称" prop="nameFunction" width="120" />
- <el-table-column label="安全责任所/中心" prop="safetyResponsibleCenter" width="200" />
- <el-table-column label="安全责任所/中心负责人" prop="safetyCenterManagerName" width="200" />
- <el-table-column label="安全责任部门" prop="safetyResponsibleDepartment" width="180" />
- <el-table-column label="安全责任部门负责人" prop="safetyDepartmentManagerName" width="180" />
- <el-table-column label="安全具体责任人" prop="safetySpecificPersonName" width="180" />
- <el-table-column label="安全具体责任人联系方式" prop="safetyPersonContact" width="230" />
- <el-table-column label="是否进行过责任人变更" prop="changed" width="220" />
- <el-table-column label="变更原因" show-overflow-tooltip prop="changeReason" width="170" />
- <el-table-column label="状态" prop="statusName" width="100" />
- <el-table-column fixed="right" min-width="240" label="操作">
- <template #default="scope">
- <template v-if="scope.row.status === 1">
- <el-button
- type="primary"
- link
- @click="
- $router.push({
- name: 'areaEditResponsibilities:public',
- query: {
- id: scope.row.id,
- },
- })
- "
- >编辑
- </el-button>
- <el-popconfirm title="确定要删除吗?" @confirm="handleConfirmDeleteRow(scope)">
- <template #reference>
- <el-button type="primary" link>删除</el-button>
- </template>
- </el-popconfirm>
- </template>
- <template v-if="scope.row.canChange === true">
- <el-button type="primary" link @click="handleAreaCheckListApprove(scope, 1)">确认</el-button>
- <el-button type="primary" link @click="handleAreaCheckListApprove(scope, 0)">拒绝</el-button>
- </template>
- <template v-if="scope.row.status === 1 && scope.row.safetySpecificPerson === id">
- <el-button
- type="primary"
- link
- @click="
- $router.push({
- name: 'areaChangeResponsibilities:public',
- query: {
- id: scope.row.id,
- },
- })
- "
- >变更</el-button
- >
- </template>
- <el-button
- type="primary"
- link
- @click="
- $router.push({
- name: 'areaViewResponsibilities:public',
- query: {
- id: scope.row.id,
- },
- })
- "
- >查看</el-button
- >
- <el-button
- link
- type="primary"
- v-if="scope.row.creatBy === id && scope.row.status === 2"
- @click="handleAreaCheckListApprove(scope, 0)"
- >
- 撤回
- </el-button>
- <template v-if="scope.row.changed === '是'">
- <el-button type="primary" link @click="changedList(scope.row)">变更记录</el-button>
- </template>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="pagination-container" v-if="tableData.total > 0">
- <el-pagination
- background
- layout="prev, pager, next, jumper,sizes, total"
- :current-page="queryParams.pageNumber"
- :page-size="queryParams.pageSize"
- :total="tableData.total"
- :page-sizes="[10, 20, 50, 100]"
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- />
- </div>
- </main>
- <!-- 变更记录 -->
- <el-dialog width="70%" v-model="changedVisible" title="安全责任区域变更记录">
- <div class="table-content">
- <h4>当前信息(变更后)</h4>
- <el-table :data="changedListData.currentRecord">
- <el-table-column type="index" label="编号" width="80" />
- <el-table-column label="楼宇/区域" prop="buildingArea" width="160" />
- <el-table-column label="楼层/房号" prop="floorRoomNo" width="180" />
- <el-table-column label="功能名称" prop="nameFunction" width="160" />
- <el-table-column label="安全责任所/中心" prop="safetyResponsibleCenter" width="200" />
- <el-table-column label="安全责任所/中心负责人" prop="safetyCenterManagerName" width="200" />
- <el-table-column label="安全责任部门" prop="safetyResponsibleDepartment" width="180" />
- <el-table-column label="安全责任部门负责人" prop="safetyDepartmentManagerName" width="180" />
- <el-table-column label="安全具体责任人" prop="safetySpecificPersonName" width="180" />
- <el-table-column label="安全具体责任人联系方式" prop="safetyPersonContact" width="230" />
- <el-table-column label="变更原因" show-overflow-tooltip prop="changeReason" width="170" />
- <el-table-column label="状态" prop="statusName" width="100" />
- </el-table>
- </div>
- <div class="table-content">
- <h4>历史记录(变更前)</h4>
- <el-table :data="changedListData.historiesRecords.records">
- <el-table-column type="index" label="编号" width="80" />
- <el-table-column label="变更时间" prop="createdAt" width="180" />
- <el-table-column label="变更人" prop="safetySpecificPersonName" width="180" />
- <el-table-column label="楼宇/区域" prop="buildingArea" width="160" />
- <el-table-column label="楼层/房号" prop="floorRoomNo" width="180" />
- <el-table-column label="功能名称" prop="nameFunction" width="160" />
- <el-table-column label="安全责任所/中心" prop="safetyResponsibleCenter" width="200" />
- <el-table-column label="安全责任所/中心负责人" prop="safetyCenterManagerName" width="200" />
- <el-table-column label="安全责任部门" prop="safetyResponsibleDepartment" width="180" />
- <el-table-column label="安全责任部门负责人" prop="safetyDepartmentManagerName" width="180" />
- <el-table-column label="安全具体责任人" prop="safetySpecificPersonName" width="180" />
- <el-table-column label="安全具体责任人联系方式" prop="safetyPersonContact" width="230" />
- <el-table-column label="变更原因" show-overflow-tooltip prop="changeReason" width="170" />
- <el-table-column label="状态" prop="statusName" width="100" />
- </el-table>
- <div class="pagination-container" v-if="changedListData.historiesRecords.totalRow > 0">
- <el-pagination
- background
- layout="prev, pager, next, jumper,sizes, total"
- :current-page="queryParams.pageNumber"
- :page-size="queryParams.pageSize"
- :total="changedListData.historiesRecords.totalRow"
- :page-sizes="[10, 20, 50, 100]"
- @size-change="handleSizeChange2"
- @current-change="handleCurrentChange2"
- />
- </div>
- </div>
- </el-dialog>
- <!-- 确认弹窗 -->
- <confirmChange :visible="changedDialogState" :params="changedParams" @confirm="handleConfirmChange" @cancel="handleCancelChange" />
- </div>
- <BatchImport
- :visible="batchImportVisible"
- :importApiUrl="importApiUrl"
- :templateUrl="templateUrl"
- :templateName="'安全责任区域-公共区域导入模版'"
- :show-template="true"
- @close="() => (batchImportVisible = false)"
- @update="handleUpdate"
- />
- </template>
- <script lang="ts" setup>
- import { onMounted, ref, reactive } from 'vue';
- import { ElMessage } from 'element-plus';
- import { useRouter } from 'vue-router';
- import confirmChange from './confirmChange.vue';
- import {
- areaCheckListQueryPage,
- areaCheckListApprove,
- areaCheckListDelete,
- areaCheckListExportArea,
- queryChangedList,
- } from '@/api/production-safety/responsibility-implementation';
- import urlJoin from 'url-join';
- import { BatchImport } from '@/components/batch-import';
- import { Plus } from '@element-plus/icons-vue';
- import { downloadFile } from '@/views/disaster/utils';
- import { useGlobSetting } from '@/hooks/setting';
- import { useUserInfoHook } from '@/views/disaster/hooks';
- import { downloadByData } from '@/utils/file/download';
- const router = useRouter();
- const activeTab = ref(1);
- const { id } = useUserInfoHook();
- const queryParams = reactive<any>({
- pageNumber: 1,
- pageSize: 10,
- queryParam: {
- type: 1,
- nameFunction: '',
- status: '',
- responsibilityPersonId: id,
- },
- });
- // 批量导入
- const batchImportVisible = ref(false);
- const { urlPrefix } = useGlobSetting();
- const importApiUrl = ref(urlJoin(urlPrefix, '/areaCheckList/importArea?type=1'));
- const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/责任清单-公共区域导入模版.xlsx');
- const handleUpdate = () => {
- batchImportVisible.value = false;
- queryTableList();
- };
- const changedVisible = ref(false)
- const changedListData = reactive({
- currentRecord:[],
- historiesRecords: {
- maxPageSize: 0,
- optimizeCountQuery: true,
- pageNumber: 1,
- pageSize: 10,
- records: [],
- totalPage: 1,
- totalRow: 1
- }
- })
- const fetchParams = reactive({
- pageNumber: 1,
- pageSize: 10,
- queryParam: {
- id:''
- }
- })
- const changedList = async(item)=>{
- fetchParams.queryParam.id = item.id
- await fetchTableList()
- changedVisible.value = true
- }
- const fetchTableList = async ()=>{
- let res = await queryChangedList(fetchParams)
- if(!res){ return }
- Object.assign(changedListData, {
- currentRecord: res.currentRecord || [],
- historiesRecords: res.historiesRecords
- })
- }
-
- const tableData = reactive({
- data: [],
- total: 0,
- });
- const handleTabChange = (tab) => {
- if (tab === 1) {
- router.push({
- name: 'areaResponsibilities:public',
- });
- } else if (tab === 2) {
- router.push({
- name: 'areaResponsibilities:nonPublic',
- });
- }
- };
- async function handleDownload() {
- try {
- const response = await areaCheckListExportArea(queryParams.queryParam);
- if (response) {
- const fileName = `安全责任区域_${new Date().toISOString().split('T')[0]}.xlsx`;
- downloadByData(response, fileName);
- ElMessage.success('导出成功');
- }
- } catch (e) {
- ElMessage.error('导出失败');
- console.log(e);
- }
- }
- const changedDialogState = ref(false)
-
- const changedParams = reactive({})
- // 弹出弹窗,修改必填项
- const handleAreaCheckListApprove = (scope, approveType) => {
- if(approveType===1){
- changedDialogState.value = true
- Object.assign(changedParams, {
- id: scope.row.id,
- approveType
- })
- return
- }
- areaCheckListApprove({
- id: scope.row.id,
- approveType,
- refuseReason: null,
- }).then((res) => {
- ElMessage.success('操作成功!');
- queryTableList();
- });
- };
- // 确认回调
- const handleConfirmChange = ()=>{
- changedDialogState.value = false
- queryTableList();
- }
- const handleCancelChange = ()=>{
- changedDialogState.value = false
- }
- const handleSizeChange = (value) => {
- queryParams.pageSize = value;
- queryTableList();
- };
- const handleCurrentChange = (value) => {
- queryParams.pageNumber = value;
- queryTableList();
- };
- const handleSizeChange2 = (value) => {
- fetchParams.pageSize = value;
- fetchTableList()
- };
- const handleCurrentChange2 = (value) => {
- fetchParams.pageNumber = value;
- fetchTableList()
- };
-
- const handleConfirmDeleteRow = (scope) => {
- areaCheckListDelete(scope.row.id).then(() => {
- ElMessage.success('删除成功!');
- queryTableList();
- });
- };
- const queryTableList = () => {
- areaCheckListQueryPage(queryParams).then((res) => {
- tableData.data = res.records;
- tableData.total = res.totalRow;
- });
- };
- const handleRestParams = () => {
- Object.assign(queryParams, {
- pageNumber: 1,
- pageSize: 10,
- queryParam: {
- ...queryParams.queryParam,
- status: '',
- nameFunction: '',
- },
- });
- queryTableList();
- };
- onMounted(() => {
- queryTableList();
- });
- </script>
- <style lang="scss" scoped>
- @use '@/styles/page-details-layout.scss' as *;
- @use '@/styles/page-main-layout.scss' as *;
- @use '@/styles/basic-table-action.scss' as *;
- :deep(.el-tabs__header) {
- margin: 0;
- }
- :deep(.el-tabs__item) {
- font-size: 14px !important;
- }
- :deep(.flexContent) {
- display: flex;
- }
- :deep(.breadcrumb .title) {
- margin-left: 0;
- }
- :deep(.el-form) {
- flex: 1;
- display: flex;
- row-gap: 15px;
- flex-wrap: wrap;
- }
- :deep(.el-form-item) {
- margin-bottom: 0;
- }
- :deep(main) {
- display: flex;
- flex-direction: column;
- }
- .search-form {
- min-width: 800px;
- display: flex;
- justify-content: space-between;
- align-items: flex-end;
- margin-bottom: 20px;
- }
- .button-content {
- margin-bottom: 20px;
- }
- .table-content {
- flex: 1;
- overflow: hidden;
- overflow-y: auto;
- }
- .page-content {
- display: flex;
- justify-content: flex-end;
- }
- .pagination-container {
- margin-top: 20px;
- display: flex;
- justify-content: flex-end;
- }
- .table-content h4 {
- margin: 18px 0 12px 0;
- color: #409eff;
- }
- </style>
|