|
@@ -11,23 +11,26 @@
|
|
|
<SelectableInput ref="selectableInputRef" :options="INNER_PERSON_TABLE_SEARCH_OPTIONS" />
|
|
<SelectableInput ref="selectableInputRef" :options="INNER_PERSON_TABLE_SEARCH_OPTIONS" />
|
|
|
<div class="select-box--item">
|
|
<div class="select-box--item">
|
|
|
<span>部门:</span>
|
|
<span>部门:</span>
|
|
|
- <el-cascader
|
|
|
|
|
- style="width: 265px"
|
|
|
|
|
- v-model="searchData.todobumen"
|
|
|
|
|
- :options="deptTree"
|
|
|
|
|
- :props="cascaderProp"
|
|
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ style="width: 280px"
|
|
|
|
|
+ v-model="searchData.deptName"
|
|
|
|
|
+ placeholder="请选择部门"
|
|
|
|
|
+ class="select-box--select"
|
|
|
clearable
|
|
clearable
|
|
|
- collapse-tags
|
|
|
|
|
- :show-all-levels="false"
|
|
|
|
|
- :max-collapse-tags="1"
|
|
|
|
|
- placeholder="请选择责任部门"
|
|
|
|
|
>
|
|
>
|
|
|
- </el-cascader>
|
|
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="item in deptNameList"
|
|
|
|
|
+ :key="item.value"
|
|
|
|
|
+ :value="item.label"
|
|
|
|
|
+ :label="item.label"
|
|
|
|
|
+ :disabled="item.disabled"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
</div>
|
|
</div>
|
|
|
<div class="select-box--item">
|
|
<div class="select-box--item">
|
|
|
<span>事件:</span>
|
|
<span>事件:</span>
|
|
|
<el-select
|
|
<el-select
|
|
|
- v-model="searchData.todoshijian"
|
|
|
|
|
|
|
+ v-model="searchData.eventType"
|
|
|
placeholder="请选择通知状态"
|
|
placeholder="请选择通知状态"
|
|
|
class="select-box--select"
|
|
class="select-box--select"
|
|
|
clearable
|
|
clearable
|
|
@@ -82,39 +85,40 @@
|
|
|
import { QueryPageRequest, QueryPageResponse } from '@/types/basic-query';
|
|
import { QueryPageRequest, QueryPageResponse } from '@/types/basic-query';
|
|
|
import type { InnerPersonTableData, InnerPersonTableQuery } from './types';
|
|
import type { InnerPersonTableData, InnerPersonTableQuery } from './types';
|
|
|
import { INNER_PERSON_TABLE_SEARCH_OPTIONS, OCCURRENCE_TYPE_OPTIONS } from './constants';
|
|
import { INNER_PERSON_TABLE_SEARCH_OPTIONS, OCCURRENCE_TYPE_OPTIONS } from './constants';
|
|
|
-
|
|
|
|
|
- import { DeptTree } from '@/types/dept/type';
|
|
|
|
|
- import { getAllDepartments } from '@/api/auth/dept';
|
|
|
|
|
|
|
+ import {
|
|
|
|
|
+ exportInnerPersonRecordList,
|
|
|
|
|
+ getDeptNameList,
|
|
|
|
|
+ getInnerPersonRecordList,
|
|
|
|
|
+ } from '@/api/security-confidentiality-person/inner-person';
|
|
|
|
|
+ import dayjs from 'dayjs';
|
|
|
|
|
+ import { ElMessage } from 'element-plus';
|
|
|
|
|
+ import { downloadFile } from '@/views/disaster/utils';
|
|
|
|
|
|
|
|
const searchData = reactive<InnerPersonTableQuery>({});
|
|
const searchData = reactive<InnerPersonTableQuery>({});
|
|
|
const searchTime = ref<string[]>([]);
|
|
const searchTime = ref<string[]>([]);
|
|
|
const selectableInputRef = ref<InstanceType<typeof SelectableInput>>();
|
|
const selectableInputRef = ref<InstanceType<typeof SelectableInput>>();
|
|
|
|
|
|
|
|
function getQuery() {
|
|
function getQuery() {
|
|
|
- const query = {
|
|
|
|
|
- todoxinming: selectableInputRef.value?.getValue(),
|
|
|
|
|
- ...searchData,
|
|
|
|
|
- startTime: searchTime.value[0],
|
|
|
|
|
- endTime: searchTime.value[1],
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ if (!selectableInputRef.value) return;
|
|
|
|
|
+ tableQuery.queryParam = {};
|
|
|
|
|
+ const selectableSearch = selectableInputRef.value.getValue();
|
|
|
|
|
+ if (selectableSearch) {
|
|
|
|
|
+ tableQuery.queryParam[selectableSearch.key as string] = selectableSearch.value;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (searchData.deptName != null) {
|
|
|
|
|
+ tableQuery.queryParam.deptName = searchData.deptName;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (searchData.eventType != null) {
|
|
|
|
|
+ tableQuery.queryParam.eventType = searchData.eventType;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (searchTime) {
|
|
|
|
|
+ tableQuery.queryParam.startTime = dayjs(searchTime[0]).format('YYYY-MM-DD HH:MM:ss');
|
|
|
|
|
+ tableQuery.queryParam.endTime = dayjs(searchTime[1]).format('YYYY-MM-DD HH:MM:ss');
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
async function getTableData() {
|
|
async function getTableData() {
|
|
|
tableConfig.loading = true;
|
|
tableConfig.loading = true;
|
|
|
- const res = await new Promise<QueryPageResponse<InnerPersonTableData>>((resolve) => {
|
|
|
|
|
- resolve({
|
|
|
|
|
- totalRow: 1,
|
|
|
|
|
- records: [
|
|
|
|
|
- {
|
|
|
|
|
- todoxinming: '张三',
|
|
|
|
|
- todokahao: 'aaa',
|
|
|
|
|
- todobumen: '部门1',
|
|
|
|
|
- todoshijian: 1,
|
|
|
|
|
- tododidian: '地点1',
|
|
|
|
|
- todojinchushijian: '2023-01-01 00:00:00',
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ const res = await getInnerPersonRecordList(tableQuery);
|
|
|
tableData.value = res.records;
|
|
tableData.value = res.records;
|
|
|
pagination.total = res.totalRow;
|
|
pagination.total = res.totalRow;
|
|
|
tableConfig.loading = false;
|
|
tableConfig.loading = false;
|
|
@@ -158,36 +162,33 @@
|
|
|
|
|
|
|
|
async function handleDownload() {
|
|
async function handleDownload() {
|
|
|
getQuery();
|
|
getQuery();
|
|
|
- // try {
|
|
|
|
|
- // const res = await exportActViolation(tableQuery.queryParam);
|
|
|
|
|
- // if (res.size === 0) return;
|
|
|
|
|
- // const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
|
|
- // const url = window.URL.createObjectURL(blob);
|
|
|
|
|
- // downloadFile(url, '违规行为记录.xlsx');
|
|
|
|
|
- // } catch (e) {
|
|
|
|
|
- // ElMessage.error('下载失败');
|
|
|
|
|
- // console.log(e);
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await exportInnerPersonRecordList(tableQuery.queryParam);
|
|
|
|
|
+ if (res.size === 0) return;
|
|
|
|
|
+ const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
|
|
|
|
|
+ const url = window.URL.createObjectURL(blob);
|
|
|
|
|
+ downloadFile(url, '内部人员门禁出入记录.xlsx');
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ ElMessage.error('下载失败');
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 获取级联部门数据
|
|
|
|
|
- const deptTree = ref<DeptTree[]>();
|
|
|
|
|
- const loadDeptTreeData = async () => {
|
|
|
|
|
- const result = await getAllDepartments();
|
|
|
|
|
- deptTree.value = result[0].children;
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- const cascaderProp = {
|
|
|
|
|
- multiple: true,
|
|
|
|
|
- expandTrigger: 'hover',
|
|
|
|
|
- checkStrictly: true,
|
|
|
|
|
- emitPath: false,
|
|
|
|
|
- value: 'id',
|
|
|
|
|
- label: 'deptName',
|
|
|
|
|
|
|
+ // 获取部门名
|
|
|
|
|
+ const deptNameList = ref<SelectOption[]>();
|
|
|
|
|
+ const loadDeptNameData = async () => {
|
|
|
|
|
+ const result = await getDeptNameList();
|
|
|
|
|
+ deptNameList.value = result.map((x, index) => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ label: x,
|
|
|
|
|
+ value: index,
|
|
|
|
|
+ disabled: false,
|
|
|
|
|
+ };
|
|
|
|
|
+ });
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
- loadDeptTreeData();
|
|
|
|
|
|
|
+ loadDeptNameData();
|
|
|
getTableData();
|
|
getTableData();
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
@@ -199,7 +200,7 @@
|
|
|
|
|
|
|
|
.table-search {
|
|
.table-search {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
- align-items: center;
|
|
|
|
|
|
|
+ align-items: flex-end;
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
}
|
|
}
|
|
@@ -207,7 +208,7 @@
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
flex-wrap: wrap;
|
|
flex-wrap: wrap;
|
|
|
- gap: 32px;
|
|
|
|
|
|
|
+ gap: 20px;
|
|
|
&--item {
|
|
&--item {
|
|
|
@include flex-center;
|
|
@include flex-center;
|
|
|
white-space: nowrap;
|
|
white-space: nowrap;
|