|
@@ -6,11 +6,13 @@
|
|
|
<main class="safety-platform-container__main">
|
|
<main class="safety-platform-container__main">
|
|
|
<div class="search-table-container">
|
|
<div class="search-table-container">
|
|
|
<header>
|
|
<header>
|
|
|
- <div>
|
|
|
|
|
|
|
+ <div v-if="actManagementPermission" style="position: relative">
|
|
|
<el-button type="primary" class="search-table-container--button" :icon="Plus" @click="handleCreateAct">
|
|
<el-button type="primary" class="search-table-container--button" :icon="Plus" @click="handleCreateAct">
|
|
|
新建记录
|
|
新建记录
|
|
|
</el-button>
|
|
</el-button>
|
|
|
- <el-button plain class="search-table-container--button" @click=""> 批量导入 </el-button>
|
|
|
|
|
|
|
+ <el-button plain class="search-table-container--button" @click="batchImportVisible = true">
|
|
|
|
|
+ 批量导入
|
|
|
|
|
+ </el-button>
|
|
|
<RealtimeNotice />
|
|
<RealtimeNotice />
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
@@ -70,58 +72,78 @@
|
|
|
</div>
|
|
</div>
|
|
|
</header>
|
|
</header>
|
|
|
<!-- 表格 -->
|
|
<!-- 表格 -->
|
|
|
- <BasicTable
|
|
|
|
|
- :tableData="tableData"
|
|
|
|
|
- :tableConfig="tableConfig"
|
|
|
|
|
- @update:pageSize="handleSizeChange"
|
|
|
|
|
- @update:pageNumber="handleCurrentChange"
|
|
|
|
|
- @update:selection="handleSelectionChange"
|
|
|
|
|
- >
|
|
|
|
|
- <template #violateType="scope">
|
|
|
|
|
- <span>{{ ACT_VIOLATION_TYPE_LABEL[scope.row.violateType] }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #capturePhotos="scope">
|
|
|
|
|
- <ImageViewer :file-list="scope.row.capturePhotos" />
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #createSource="scope">
|
|
|
|
|
- <span>{{ ACT_NOTICE_DATA_SOURCE_LABEL[scope.row.createSource] }}</span>
|
|
|
|
|
- </template>
|
|
|
|
|
- <template #isNotice="scope">
|
|
|
|
|
- <div class="notice-state">
|
|
|
|
|
- <div
|
|
|
|
|
- :style="{
|
|
|
|
|
- backgroundColor: ACT_NOTICE_STATE_COLOR[scope.row.isNotice],
|
|
|
|
|
- width: '6px',
|
|
|
|
|
- height: '6px',
|
|
|
|
|
- borderRadius: '50%',
|
|
|
|
|
- marginRight: '5px',
|
|
|
|
|
- }"
|
|
|
|
|
- ></div>
|
|
|
|
|
- <span>{{ ACT_NOTICE_STATE_LABEL[scope.row.isNotice] }}</span>
|
|
|
|
|
|
|
+ <div class="batch-table">
|
|
|
|
|
+ <div class="batch-operation--div" v-show="actManagementPermission && selectionItems.length > 0">
|
|
|
|
|
+ <span>已选{{ selectionItems.length }}项</span>
|
|
|
|
|
+ <div class="batch-operation--div--close">
|
|
|
|
|
+ <div class="batch-operation--div--button">
|
|
|
|
|
+ <el-button class="custom-el-button" @click="handleBatchNotice">批量通知</el-button>
|
|
|
|
|
+ <el-button class="custom-el-button" @click="handleBatchDelete">批量删除</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-icon class="close-icon" @click="handleCloseBatchOperation"><Close /></el-icon>
|
|
|
</div>
|
|
</div>
|
|
|
- </template>
|
|
|
|
|
- <template #action="scope">
|
|
|
|
|
- <ActionButton
|
|
|
|
|
- v-if="scope.row.isNotice === ACT_NOTICE_STATE.INACTIVE"
|
|
|
|
|
- text="编辑"
|
|
|
|
|
- @click="handleEditAct(scope.row.id)"
|
|
|
|
|
- />
|
|
|
|
|
- <ActionButton
|
|
|
|
|
- v-if="scope.row.isNotice === ACT_NOTICE_STATE.INACTIVE"
|
|
|
|
|
- text="通知"
|
|
|
|
|
- @click="handleNoticeAct(scope.row.id)"
|
|
|
|
|
- />
|
|
|
|
|
- <ActionButton
|
|
|
|
|
- text="删除"
|
|
|
|
|
- :popconfirm="{
|
|
|
|
|
- title: '确定要删除?',
|
|
|
|
|
- }"
|
|
|
|
|
- @confirm="handleDeleteAct(scope.row.id)"
|
|
|
|
|
- />
|
|
|
|
|
- </template>
|
|
|
|
|
- </BasicTable>
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <BasicTable
|
|
|
|
|
+ :tableData="tableData"
|
|
|
|
|
+ :tableConfig="tableConfig"
|
|
|
|
|
+ @update:pageSize="handleSizeChange"
|
|
|
|
|
+ @update:pageNumber="handleCurrentChange"
|
|
|
|
|
+ @update:selection="handleSelectionChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #violateType="scope">
|
|
|
|
|
+ <span>{{ ACT_VIOLATION_TYPE_LABEL[scope.row.violateType] }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #capturePhotos="scope">
|
|
|
|
|
+ <ImageViewer :file-list="scope.row.capturePhotos" />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #createSource="scope">
|
|
|
|
|
+ <span>{{ ACT_NOTICE_DATA_SOURCE_LABEL[scope.row.createSource] }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #isNotice="scope">
|
|
|
|
|
+ <div class="notice-state">
|
|
|
|
|
+ <div
|
|
|
|
|
+ :style="{
|
|
|
|
|
+ backgroundColor: ACT_NOTICE_STATE_COLOR[scope.row.isNotice],
|
|
|
|
|
+ width: '6px',
|
|
|
|
|
+ height: '6px',
|
|
|
|
|
+ borderRadius: '50%',
|
|
|
|
|
+ marginRight: '5px',
|
|
|
|
|
+ }"
|
|
|
|
|
+ ></div>
|
|
|
|
|
+ <span>{{ ACT_NOTICE_STATE_LABEL[scope.row.isNotice] }}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ <template #action="scope">
|
|
|
|
|
+ <ActionButton
|
|
|
|
|
+ v-if="scope.row.isNotice === ACT_NOTICE_STATE.INACTIVE"
|
|
|
|
|
+ text="编辑"
|
|
|
|
|
+ @click="handleEditAct(scope.row.id)"
|
|
|
|
|
+ />
|
|
|
|
|
+ <ActionButton
|
|
|
|
|
+ v-if="scope.row.isNotice === ACT_NOTICE_STATE.INACTIVE"
|
|
|
|
|
+ text="通知"
|
|
|
|
|
+ @click="handleNoticeAct(scope.row.id)"
|
|
|
|
|
+ />
|
|
|
|
|
+ <ActionButton
|
|
|
|
|
+ text="删除"
|
|
|
|
|
+ :popconfirm="{
|
|
|
|
|
+ title: '确定要删除?',
|
|
|
|
|
+ }"
|
|
|
|
|
+ @confirm="handleDeleteAct(scope.row.id)"
|
|
|
|
|
+ />
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </BasicTable>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
</main>
|
|
</main>
|
|
|
|
|
+ <BatchImport
|
|
|
|
|
+ :visible="batchImportVisible"
|
|
|
|
|
+ :importApiUrl="importApiUrl"
|
|
|
|
|
+ :templateUrl="templateUrl"
|
|
|
|
|
+ :templateName="'违规行为记录-批量导入模版'"
|
|
|
|
|
+ @close="() => (batchImportVisible = false)"
|
|
|
|
|
+ @update="handleUpdate"
|
|
|
|
|
+ />
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -131,8 +153,9 @@
|
|
|
import SelectableInput from '@/components/formItems/selectableInput/SelectableInput.vue';
|
|
import SelectableInput from '@/components/formItems/selectableInput/SelectableInput.vue';
|
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
import ActionButton from '@/components/ActionButton.vue';
|
|
|
import RealtimeNotice from './components/RealtimeNotice.vue';
|
|
import RealtimeNotice from './components/RealtimeNotice.vue';
|
|
|
|
|
+ import dayjs from 'dayjs';
|
|
|
import { ElMessage } from 'element-plus';
|
|
import { ElMessage } from 'element-plus';
|
|
|
- import { TABLE_OPTIONS, VIOLATION_ACT_TABLE_COLUMNS } from './configs/tables';
|
|
|
|
|
|
|
+ import { TABLE_OPTIONS, VIOLATION_ACT_TABLE_COLUMNS, VIOLATION_NOTICE_TABLE_COLUMNS } from './configs/tables';
|
|
|
import {
|
|
import {
|
|
|
ACT_NOTICE_DATA_SOURCE_LABEL,
|
|
ACT_NOTICE_DATA_SOURCE_LABEL,
|
|
|
ACT_VIOLATION_TYPE,
|
|
ACT_VIOLATION_TYPE,
|
|
@@ -143,6 +166,7 @@
|
|
|
ACT_NOTICE_STATE,
|
|
ACT_NOTICE_STATE,
|
|
|
ACT_NOTICE_STATE_LABEL,
|
|
ACT_NOTICE_STATE_LABEL,
|
|
|
ACT_NOTICE_STATE_COLOR,
|
|
ACT_NOTICE_STATE_COLOR,
|
|
|
|
|
+ ACT_MANAGEMENT_PROMISSION_CODE,
|
|
|
} from './constants';
|
|
} from './constants';
|
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
import { ref, reactive, onMounted } from 'vue';
|
|
|
import { Search, Plus } from '@element-plus/icons-vue';
|
|
import { Search, Plus } from '@element-plus/icons-vue';
|
|
@@ -158,10 +182,18 @@
|
|
|
} from '@/api/traffic-violation/traffic-act';
|
|
} from '@/api/traffic-violation/traffic-act';
|
|
|
import { downloadFile } from '@/views/disaster/utils/download';
|
|
import { downloadFile } from '@/views/disaster/utils/download';
|
|
|
import ImageViewer from './components/ImageViewer.vue';
|
|
import ImageViewer from './components/ImageViewer.vue';
|
|
|
- import dayjs from 'dayjs';
|
|
|
|
|
|
|
+ import { BatchImport } from '@/components/batch-import';
|
|
|
|
|
+ import { useGlobSetting } from '@/hooks/setting';
|
|
|
|
|
+ import urlJoin from 'url-join';
|
|
|
|
|
+ import { useUserInfoHook } from '@/hooks/useUserInfoHook';
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
+ const { permissions } = useUserInfoHook();
|
|
|
|
|
+ const actManagementPermission = ref<Boolean>(
|
|
|
|
|
+ Boolean(permissions.find((item: { code: string }) => item.code === ACT_MANAGEMENT_PROMISSION_CODE)),
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
// 搜索栏
|
|
// 搜索栏
|
|
|
const selectableInputRef = ref<InstanceType<typeof SelectableInput>>();
|
|
const selectableInputRef = ref<InstanceType<typeof SelectableInput>>();
|
|
|
const searchData = reactive<ActTableSearch>({});
|
|
const searchData = reactive<ActTableSearch>({});
|
|
@@ -189,7 +221,7 @@
|
|
|
|
|
|
|
|
function handleSearch() {
|
|
function handleSearch() {
|
|
|
getQuery();
|
|
getQuery();
|
|
|
- getTabelData();
|
|
|
|
|
|
|
+ getTableData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function handleReset() {
|
|
function handleReset() {
|
|
@@ -218,7 +250,10 @@
|
|
|
// 表格
|
|
// 表格
|
|
|
const basicTableRef = ref<InstanceType<typeof BasicTable>>();
|
|
const basicTableRef = ref<InstanceType<typeof BasicTable>>();
|
|
|
|
|
|
|
|
- const { tableConfig, pagination } = useTableConfig(VIOLATION_ACT_TABLE_COLUMNS, TABLE_OPTIONS);
|
|
|
|
|
|
|
+ const { tableConfig, pagination } = useTableConfig(
|
|
|
|
|
+ actManagementPermission ? VIOLATION_ACT_TABLE_COLUMNS : VIOLATION_NOTICE_TABLE_COLUMNS,
|
|
|
|
|
+ TABLE_OPTIONS,
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
const tableData = ref<ActTableData[]>([]);
|
|
const tableData = ref<ActTableData[]>([]);
|
|
|
|
|
|
|
@@ -233,39 +268,43 @@
|
|
|
const handleSizeChange = (value: number) => {
|
|
const handleSizeChange = (value: number) => {
|
|
|
pagination.pageNumber = value;
|
|
pagination.pageNumber = value;
|
|
|
tabelQuery.pageSize = value;
|
|
tabelQuery.pageSize = value;
|
|
|
- getTabelData();
|
|
|
|
|
|
|
+ getTableData();
|
|
|
};
|
|
};
|
|
|
const handleCurrentChange = (value: number) => {
|
|
const handleCurrentChange = (value: number) => {
|
|
|
pagination.pageNumber = value;
|
|
pagination.pageNumber = value;
|
|
|
tabelQuery.pageSize = value;
|
|
tabelQuery.pageSize = value;
|
|
|
- getTabelData();
|
|
|
|
|
|
|
+ getTableData();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- const handleSelectionChange = (value: any[]) => {};
|
|
|
|
|
|
|
+ const selectionItems = ref<any[]>([]);
|
|
|
|
|
|
|
|
- // const handleCloseBatchOperation = () => {
|
|
|
|
|
- // if (!basicTableRef.value) return;
|
|
|
|
|
- // basicTableRef.value.clearSelection();
|
|
|
|
|
- // };
|
|
|
|
|
|
|
+ const handleSelectionChange = (selection: any[]) => {
|
|
|
|
|
+ selectionItems.value = selection;
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- // const handleBatchNotice = async () => {
|
|
|
|
|
- // const confirmed = await openMessageBox('', '确认通知任务吗?', 'warning');
|
|
|
|
|
- // if (!confirmed) return;
|
|
|
|
|
- // const noticeIds = getSelectionIds(ACTIVE_STATUS.NOT_EFFECTIVE);
|
|
|
|
|
- // await noticeActData(noticeIds);
|
|
|
|
|
- // ElMessage.success('批量通知成功');
|
|
|
|
|
- // getTableData();
|
|
|
|
|
- // };
|
|
|
|
|
- // const handleBatchDelete = async () => {
|
|
|
|
|
- // const confirmed = await openMessageBox('', '删除后任务不可恢复,确认删除吗?', 'warning');
|
|
|
|
|
- // if (!confirmed) return;
|
|
|
|
|
- // const deleteIds = getSelectionIds(ACTIVE_STATUS.NOT_EFFECTIVE);
|
|
|
|
|
- // await deleteActData(deleteIds);
|
|
|
|
|
- // ElMessage.success('批量删除成功');
|
|
|
|
|
- // getTableData();
|
|
|
|
|
- // };
|
|
|
|
|
|
|
+ const handleCloseBatchOperation = () => {
|
|
|
|
|
+ if (!basicTableRef.value) return;
|
|
|
|
|
+ basicTableRef.value.clearSelection();
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- async function getTabelData() {
|
|
|
|
|
|
|
+ const handleBatchNotice = async () => {
|
|
|
|
|
+ const confirmed = await openMessageBox('', '确认通知任务吗?', 'warning');
|
|
|
|
|
+ if (!confirmed) return;
|
|
|
|
|
+ const noticeIds = selectionItems.value.map((item) => item.id);
|
|
|
|
|
+ await noticeActData(noticeIds);
|
|
|
|
|
+ ElMessage.success('批量通知成功');
|
|
|
|
|
+ getTableData();
|
|
|
|
|
+ };
|
|
|
|
|
+ const handleBatchDelete = async () => {
|
|
|
|
|
+ const confirmed = await openMessageBox('', '删除后任务不可恢复,确认删除吗?', 'warning');
|
|
|
|
|
+ if (!confirmed) return;
|
|
|
|
|
+ const deleteIds = selectionItems.value.map((item) => item.id);
|
|
|
|
|
+ await deleteActData(deleteIds);
|
|
|
|
|
+ ElMessage.success('批量删除成功');
|
|
|
|
|
+ getTableData();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ async function getTableData() {
|
|
|
tableConfig.loading = true;
|
|
tableConfig.loading = true;
|
|
|
const res = await getActTableList(tabelQuery);
|
|
const res = await getActTableList(tabelQuery);
|
|
|
tableData.value = res.records;
|
|
tableData.value = res.records;
|
|
@@ -273,8 +312,19 @@
|
|
|
tableConfig.loading = false;
|
|
tableConfig.loading = false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 批量导入
|
|
|
|
|
+ const batchImportVisible = ref(false);
|
|
|
|
|
+ const { urlPrefix } = useGlobSetting();
|
|
|
|
|
+ const importApiUrl = ref(urlJoin(urlPrefix, '/trafficViolation/importTrafficViolationList'));
|
|
|
|
|
+ const templateUrl = ref('./skyeye-file-upload/sfysecurity/TEMPLATE/import-vehicle-template.xlsx');
|
|
|
|
|
+
|
|
|
|
|
+ const handleUpdate = () => {
|
|
|
|
|
+ batchImportVisible.value = false;
|
|
|
|
|
+ getTableData();
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
|
- await getTabelData();
|
|
|
|
|
|
|
+ await getTableData();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
function handleCreateAct() {
|
|
function handleCreateAct() {
|
|
@@ -305,7 +355,7 @@
|
|
|
} finally {
|
|
} finally {
|
|
|
tableConfig.loading = false;
|
|
tableConfig.loading = false;
|
|
|
}
|
|
}
|
|
|
- getTabelData();
|
|
|
|
|
|
|
+ getTableData();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function handleDeleteAct(id: number) {
|
|
async function handleDeleteAct(id: number) {
|
|
@@ -318,7 +368,7 @@
|
|
|
} finally {
|
|
} finally {
|
|
|
tableConfig.loading = false;
|
|
tableConfig.loading = false;
|
|
|
}
|
|
}
|
|
|
- getTabelData();
|
|
|
|
|
|
|
+ getTableData();
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
@@ -361,4 +411,34 @@
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
justify-self: center;
|
|
justify-self: center;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ .batch-table {
|
|
|
|
|
+ position: relative;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 100%;
|
|
|
|
|
+ }
|
|
|
|
|
+ .batch-operation--div {
|
|
|
|
|
+ @include flex-center;
|
|
|
|
|
+ justify-content: flex-start;
|
|
|
|
|
+ position: absolute;
|
|
|
|
|
+ top: 0;
|
|
|
|
|
+ left: 0;
|
|
|
|
|
+ gap: 60px;
|
|
|
|
|
+ width: 100%;
|
|
|
|
|
+ height: 48px;
|
|
|
|
|
+ border: 4px;
|
|
|
|
|
+ padding: 16px 25px;
|
|
|
|
|
+ background-color: #ddefff;
|
|
|
|
|
+ z-index: 100;
|
|
|
|
|
+ &--close {
|
|
|
|
|
+ @include flex-center;
|
|
|
|
|
+ justify-content: space-between;
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ .close-icon {
|
|
|
|
|
+ font-size: 20px;
|
|
|
|
|
+ color: #ff4d4f;
|
|
|
|
|
+ cursor: pointer;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
</style>
|
|
</style>
|