|
@@ -1,12 +1,13 @@
|
|
|
<template>
|
|
|
<div class="history-table" v-if="loading">
|
|
|
- <BasicTable ref="historyTable" @register="registerTable">
|
|
|
+ <BasicTable ref="historyTable" @register="registerTable" :data-source="dataSource">
|
|
|
<template #bodyCell="{ column, record }">
|
|
|
<slot name="filterCell" v-bind="{ column, record }"></slot>
|
|
|
</template>
|
|
|
- <!-- <template #form-onExportXls>
|
|
|
- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
|
|
- </template> -->
|
|
|
+
|
|
|
+ <template #form-submitBefore>
|
|
|
+ <a-button type="primary" preIcon="ant-design:search-outlined" @click="getDataSource">查询</a-button>
|
|
|
+ </template>
|
|
|
</BasicTable>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -24,26 +25,6 @@
|
|
|
import { onMounted } from 'vue';
|
|
|
|
|
|
const globalConfig = inject('globalConfig');
|
|
|
-
|
|
|
- const historyTable = ref();
|
|
|
- const loading = ref(false);
|
|
|
- const list = (params) => {
|
|
|
- if (globalConfig.History_Type == 'vent') {
|
|
|
- debugger;
|
|
|
- // return defHttp.get({ url: '/safety/ventanalyMonitorData/list', params })
|
|
|
- return defHttp.get({ url: '/safety/ventanalyMonitorData/listdays', params });
|
|
|
- } else {
|
|
|
- return defHttp.post({ url: '/ventanaly-device/history/getHistoryData', params });
|
|
|
- }
|
|
|
- };
|
|
|
- const getExportXlsUrl = () => {
|
|
|
- if (globalConfig.History_Type == 'vent') {
|
|
|
- return '/safety/ventanalyMonitorData/exportXls';
|
|
|
- } else {
|
|
|
- return '/ventanaly-device/history/getHistoryData/exportXls';
|
|
|
- }
|
|
|
- };
|
|
|
- const emit = defineEmits(['change']);
|
|
|
const props = defineProps({
|
|
|
columnsType: {
|
|
|
type: String,
|
|
@@ -80,11 +61,27 @@
|
|
|
default: () => [],
|
|
|
},
|
|
|
});
|
|
|
+
|
|
|
+ const historyTable = ref();
|
|
|
+ const loading = ref(false);
|
|
|
+ const stationType = ref('plc');
|
|
|
+ const dataSource = ref([]);
|
|
|
+
|
|
|
+ const getExportXlsUrl = () => {
|
|
|
+ if (stationType.value !== 'redis') {
|
|
|
+ return '/safety/ventanalyMonitorData/exportXls';
|
|
|
+ } else {
|
|
|
+ return '/ventanaly-device/history/getHistoryData/exportXls';
|
|
|
+ }
|
|
|
+ };
|
|
|
+ const emit = defineEmits(['change']);
|
|
|
+
|
|
|
const historyType = ref('');
|
|
|
const columns = ref([]);
|
|
|
const tableScroll = props.scroll.y ? ref({ y: props.scroll.y - 100 }) : ref({});
|
|
|
let deviceOptions = ref([]);
|
|
|
const deviceTypeStr = ref('');
|
|
|
+ loading.value = true;
|
|
|
|
|
|
watch(
|
|
|
() => {
|
|
@@ -133,6 +130,322 @@
|
|
|
}
|
|
|
);
|
|
|
|
|
|
+ watch(stationType, (type) => {
|
|
|
+ if (type) {
|
|
|
+ getDataSource();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ function getTableProps(stationTypeStr) {
|
|
|
+ if (stationTypeStr !== 'redis') {
|
|
|
+ debugger;
|
|
|
+ setProps({
|
|
|
+ api: (params) => defHttp.get({ url: '/safety/ventanalyMonitorData/listdays', params }),
|
|
|
+ formConfig: {
|
|
|
+ labelAlign: 'left',
|
|
|
+ showAdvancedButton: false,
|
|
|
+ baseColProps: {
|
|
|
+ xs: 24,
|
|
|
+ sm: 24,
|
|
|
+ md: 24,
|
|
|
+ lg: 9,
|
|
|
+ xl: 7,
|
|
|
+ xxl: 4,
|
|
|
+ },
|
|
|
+ schemas:
|
|
|
+ props.formSchemas.length > 0
|
|
|
+ ? props.formSchemas
|
|
|
+ : [
|
|
|
+ {
|
|
|
+ field: 'ttime_begin',
|
|
|
+ label: '开始时间',
|
|
|
+ component: 'DatePicker',
|
|
|
+ defaultValue: dayjs().startOf('date'),
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ showTime: true,
|
|
|
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
+ getPopupContainer: getAutoScrollContainer,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'ttime_end',
|
|
|
+ label: '结束时间',
|
|
|
+ component: 'DatePicker',
|
|
|
+ defaultValue: dayjs(),
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ showTime: true,
|
|
|
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
+ getPopupContainer: getAutoScrollContainer,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '查询设备',
|
|
|
+ field: 'gdeviceid',
|
|
|
+ component: 'Select',
|
|
|
+ defaultValue: deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ options: deviceOptions,
|
|
|
+ onChange: (e, option) => {
|
|
|
+ if (option && (option['strinstallpos'] || option['strtype'] || option['devicekind']))
|
|
|
+ historyType.value = option['strtype'] || option['devicekind'];
|
|
|
+ if (option['strtype']) deviceTypeStr.value = option['strtype'];
|
|
|
+ stationType.value = option['stationtype'];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '间隔时间',
|
|
|
+ field: 'skip',
|
|
|
+ component: 'Select',
|
|
|
+ defaultValue: 5,
|
|
|
+ componentProps: {
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: '5秒',
|
|
|
+ value: '1',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '10秒',
|
|
|
+ value: '2',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '30秒',
|
|
|
+ value: '3',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '1分钟',
|
|
|
+ value: '4',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '5分钟',
|
|
|
+ value: '5',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '10分钟',
|
|
|
+ value: '6',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '30分钟',
|
|
|
+ value: '7',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '1小时',
|
|
|
+ value: '8',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ // fetchSetting: {
|
|
|
+ // listField: 'datalist',
|
|
|
+ // totalField: 'datalist.total',
|
|
|
+ // },
|
|
|
+ pagination: {
|
|
|
+ current: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ pageSizeOptions: ['10', '30', '50', '100'],
|
|
|
+ showQuickJumper: false,
|
|
|
+ },
|
|
|
+ // beforeFetch(params) {
|
|
|
+ // params.strtype = deviceTypeStr.value
|
|
|
+ // ? deviceTypeStr.value
|
|
|
+ // : deviceOptions.value[0]['strtype']
|
|
|
+ // ? deviceOptions.value[0]['strtype']
|
|
|
+ // : props.deviceType + '*';
|
|
|
+ // if (props.sysId) {
|
|
|
+ // params.sysId = props.sysId;
|
|
|
+ // }
|
|
|
+ // return params;
|
|
|
+ // },
|
|
|
+ // afterFetch(result) {
|
|
|
+ // const resultItems = result['records'];
|
|
|
+ // resultItems.map((item) => {
|
|
|
+ // Object.assign(item, item['readData']);
|
|
|
+ // });
|
|
|
+ // console.log('result---------------->', result);
|
|
|
+ // return resultItems;
|
|
|
+ // },
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ setProps({
|
|
|
+ api: (params) => defHttp.post({ url: '/ventanaly-device/history/getHistoryData', params }),
|
|
|
+ formConfig: {
|
|
|
+ labelAlign: 'left',
|
|
|
+ showAdvancedButton: false,
|
|
|
+ // autoAdvancedCol: 2,
|
|
|
+
|
|
|
+ baseColProps: {
|
|
|
+ // offset: 0.5,
|
|
|
+ xs: 24,
|
|
|
+ sm: 24,
|
|
|
+ md: 24,
|
|
|
+ lg: 9,
|
|
|
+ xl: 7,
|
|
|
+ xxl: 4,
|
|
|
+ },
|
|
|
+ schemas:
|
|
|
+ props.formSchemas.length > 0
|
|
|
+ ? props.formSchemas
|
|
|
+ : [
|
|
|
+ {
|
|
|
+ field: 'startTime',
|
|
|
+ label: '开始时间',
|
|
|
+ component: 'DatePicker',
|
|
|
+ defaultValue: dayjs().startOf('date'),
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ showTime: true,
|
|
|
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
+ getPopupContainer: getAutoScrollContainer,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'endTime',
|
|
|
+ label: '结束时间',
|
|
|
+ component: 'DatePicker',
|
|
|
+ defaultValue: dayjs(),
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ showTime: true,
|
|
|
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
+ getPopupContainer: getAutoScrollContainer,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '查询设备',
|
|
|
+ field: 'deviceId',
|
|
|
+ component: 'Select',
|
|
|
+ defaultValue: deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ options: deviceOptions,
|
|
|
+ onChange: (e, option) => {
|
|
|
+ if (option && (option['strinstallpos'] || option['strtype'] || option['devicekind']))
|
|
|
+ historyType.value = option['strtype'] || option['devicekind'];
|
|
|
+ stationType.value = option['stationtype'];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ // componentProps: ({ formModel }) => {
|
|
|
+ // return {
|
|
|
+ // options: deviceOptions.value,
|
|
|
+ // // api: () => defHttp.get({ url: '/safety/ventanalyManageSystem/linkdevicelist', params: { sysId: props.sysId, deviceType: props.deviceType.startsWith('vehicle') ? 'location_normal' : props.deviceType } }),
|
|
|
+ // // resultField: 'result',
|
|
|
+ // // labelField: 'strinstallpos',
|
|
|
+ // // valueField: 'id',
|
|
|
+ // // onChange: (e, option) => {
|
|
|
+ // // if(option && (option['strtype'] || option['devicekind'])) historyType.value = option['strtype'] || option['devicekind']
|
|
|
+ // // },
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '间隔时间',
|
|
|
+ field: 'interval',
|
|
|
+ component: 'Select',
|
|
|
+ defaultValue: '30s',
|
|
|
+ componentProps: {
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ label: '1秒',
|
|
|
+ value: '1s',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '5秒',
|
|
|
+ value: '5s',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '10秒',
|
|
|
+ value: '10s',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '30秒',
|
|
|
+ value: '30s',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '1分钟',
|
|
|
+ value: '1m',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '10分钟',
|
|
|
+ value: '10m',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '30分钟',
|
|
|
+ value: '30m',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '1小时',
|
|
|
+ value: '1h',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ pagination: {
|
|
|
+ current: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ pageSizeOptions: ['10', '30', '50', '100'],
|
|
|
+ showQuickJumper: false,
|
|
|
+ },
|
|
|
+ fetchSetting: {
|
|
|
+ totalField: 'total',
|
|
|
+ // 每页显示多少条
|
|
|
+ sizeField: 'pageSize',
|
|
|
+ // 请求结果列表字段 支持 a.b.c
|
|
|
+ pageField: 'pageNo',
|
|
|
+ },
|
|
|
+ beforeFetch(params) {
|
|
|
+ params.strtype = props.deviceType + '*';
|
|
|
+ if (props.sysId) {
|
|
|
+ params.sysId = props.sysId;
|
|
|
+ }
|
|
|
+ if (params.interval) {
|
|
|
+ params.interval = params.interval;
|
|
|
+ } else {
|
|
|
+ params.interval = '1m';
|
|
|
+ }
|
|
|
+ if (props.deviceType.startsWith('vehicle')) {
|
|
|
+ params['isEmployee'] = false;
|
|
|
+ } else if (props.deviceType.startsWith('location')) {
|
|
|
+ params['isEmployee'] = true;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ afterFetch(result) {
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
async function getDeviceList() {
|
|
|
if (props.deviceType.split('_')[1] && props.deviceType.split('_')[1] === 'history') return;
|
|
|
let result;
|
|
@@ -154,394 +467,244 @@
|
|
|
}
|
|
|
if (result) {
|
|
|
deviceOptions.value = [];
|
|
|
- deviceOptions.value = result.map((item) => {
|
|
|
+ deviceOptions.value = result.map((item, index) => {
|
|
|
return {
|
|
|
label: item['strinstallpos'],
|
|
|
value: item['id'],
|
|
|
strtype: item['strtype'],
|
|
|
strinstallpos: item['strinstallpos'],
|
|
|
devicekind: item['devicekind'],
|
|
|
+ stationtype: index > 2 ? 'redis' : 'plc',
|
|
|
};
|
|
|
// return { label: item['strname'], value: item['id']}
|
|
|
});
|
|
|
}
|
|
|
+ console.log('deviceOptions---------------->', deviceOptions.value);
|
|
|
globalConfig.History_Type == 'vent' && deviceOptions.value[0]
|
|
|
? getForm().setFieldsValue({ gdeviceid: deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '' })
|
|
|
: getForm().setFieldsValue({ deviceId: deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '' });
|
|
|
}
|
|
|
|
|
|
- loading.value = true;
|
|
|
+ async function getDataSource() {
|
|
|
+ setLoading(true);
|
|
|
+ const pagination = getPaginationRef();
|
|
|
+ const stationTypeStr = stationType.value;
|
|
|
+ const formData = getForm().getFieldsValue();
|
|
|
+ formData['pageNo'] = pagination['current'];
|
|
|
+ formData['pageSize'] = pagination['pageSize'];
|
|
|
+ formData['column'] = 'createTime';
|
|
|
+ if (stationTypeStr !== 'redis') {
|
|
|
+ formData['strtype'] = deviceTypeStr.value
|
|
|
+ ? deviceTypeStr.value
|
|
|
+ : deviceOptions.value[0]['strtype']
|
|
|
+ ? deviceOptions.value[0]['strtype']
|
|
|
+ : props.deviceType + '*';
|
|
|
+ if (props.sysId) {
|
|
|
+ formData['sysId'] = props.sysId;
|
|
|
+ }
|
|
|
+ const result = await defHttp.get({ url: '/safety/ventanalyMonitorData/listdays', params: formData });
|
|
|
+ if (result['datalist']['records'].length > 0) {
|
|
|
+ dataSource.value = result['datalist']['records'].map((item: any) => {
|
|
|
+ return Object.assign(item, item['readData']);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ dataSource.value = [];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ const params = {
|
|
|
+ startTime: formData['ttime_begin'],
|
|
|
+ endTime: formData['ttime_end'],
|
|
|
+ deviceId: formData['gdeviceid'],
|
|
|
+ strtype: props.deviceType + '*',
|
|
|
+ sysId: props.sysId,
|
|
|
+ interval: formData['skip'] ? formData['skip'] : '1m',
|
|
|
+ isEmployee: props.deviceType.startsWith('vehicle') ? false : true,
|
|
|
+ };
|
|
|
+ const result = await defHttp.post({ url: '/ventanaly-device/history/getHistoryData', params: params });
|
|
|
+ dataSource.value = result['records'] || [];
|
|
|
+ }
|
|
|
+ setLoading(false);
|
|
|
+ }
|
|
|
+
|
|
|
// 列表页面公共参数、方法
|
|
|
- const { tableContext, onExportXls } = useListPage(
|
|
|
- globalConfig.History_Type == 'vent'
|
|
|
- ? {
|
|
|
- tableProps: {
|
|
|
- api: list,
|
|
|
- columns: props.columnsType ? columns : (props.columns as any[]),
|
|
|
- canResize: true,
|
|
|
- showTableSetting: false,
|
|
|
- showActionColumn: false,
|
|
|
- bordered: false,
|
|
|
- size: 'small',
|
|
|
- scroll: tableScroll,
|
|
|
- showIndexColumn: true,
|
|
|
- formConfig: {
|
|
|
- labelAlign: 'left',
|
|
|
- showAdvancedButton: false,
|
|
|
- baseColProps: {
|
|
|
- // offset: 0.5,
|
|
|
- xs: 24,
|
|
|
- sm: 24,
|
|
|
- md: 24,
|
|
|
- lg: 9,
|
|
|
- xl: 7,
|
|
|
- xxl: 4,
|
|
|
- },
|
|
|
- schemas:
|
|
|
- props.formSchemas.length > 0
|
|
|
- ? props.formSchemas
|
|
|
- : [
|
|
|
+ const { tableContext, onExportXls } = useListPage({
|
|
|
+ tableProps: {
|
|
|
+ // api: list,
|
|
|
+ columns: props.columnsType ? columns : (props.columns as any[]),
|
|
|
+ canResize: true,
|
|
|
+ showTableSetting: false,
|
|
|
+ showActionColumn: false,
|
|
|
+ bordered: false,
|
|
|
+ size: 'small',
|
|
|
+ scroll: tableScroll,
|
|
|
+ showIndexColumn: true,
|
|
|
+ formConfig: {
|
|
|
+ labelAlign: 'left',
|
|
|
+ showAdvancedButton: false,
|
|
|
+ showSubmitButton: false,
|
|
|
+ showResetButton: false,
|
|
|
+ baseColProps: {
|
|
|
+ xs: 24,
|
|
|
+ sm: 24,
|
|
|
+ md: 24,
|
|
|
+ lg: 9,
|
|
|
+ xl: 7,
|
|
|
+ xxl: 4,
|
|
|
+ },
|
|
|
+ schemas:
|
|
|
+ props.formSchemas.length > 0
|
|
|
+ ? props.formSchemas
|
|
|
+ : [
|
|
|
+ {
|
|
|
+ field: 'ttime_begin',
|
|
|
+ label: '开始时间',
|
|
|
+ component: 'DatePicker',
|
|
|
+ defaultValue: dayjs().startOf('date'),
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ showTime: true,
|
|
|
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
+ getPopupContainer: getAutoScrollContainer,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ field: 'ttime_end',
|
|
|
+ label: '结束时间',
|
|
|
+ component: 'DatePicker',
|
|
|
+ defaultValue: dayjs(),
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ showTime: true,
|
|
|
+ valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
+ getPopupContainer: getAutoScrollContainer,
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '查询设备',
|
|
|
+ field: 'gdeviceid',
|
|
|
+ component: 'Select',
|
|
|
+ defaultValue: deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '',
|
|
|
+ required: true,
|
|
|
+ componentProps: {
|
|
|
+ options: deviceOptions,
|
|
|
+ onChange: (e, option) => {
|
|
|
+ if (option && (option['strinstallpos'] || option['strtype'] || option['devicekind']))
|
|
|
+ historyType.value = option['strtype'] || option['devicekind'];
|
|
|
+ if (option['strtype']) deviceTypeStr.value = option['strtype'];
|
|
|
+ stationType.value = option['stationtype'];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '间隔时间',
|
|
|
+ field: 'skip',
|
|
|
+ component: 'Select',
|
|
|
+ defaultValue: 5,
|
|
|
+ componentProps: {
|
|
|
+ options: [
|
|
|
{
|
|
|
- field: 'ttime_begin',
|
|
|
- label: '开始时间',
|
|
|
- component: 'DatePicker',
|
|
|
- defaultValue: dayjs().startOf('date'),
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- showTime: true,
|
|
|
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
- getPopupContainer: getAutoScrollContainer,
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
- },
|
|
|
+ label: '5秒',
|
|
|
+ value: '1',
|
|
|
},
|
|
|
{
|
|
|
- field: 'ttime_end',
|
|
|
- label: '结束时间',
|
|
|
- component: 'DatePicker',
|
|
|
- defaultValue: dayjs(),
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- showTime: true,
|
|
|
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
- getPopupContainer: getAutoScrollContainer,
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
- },
|
|
|
+ label: '10秒',
|
|
|
+ value: '2',
|
|
|
},
|
|
|
- // {
|
|
|
- // label: '时间区间',
|
|
|
- // field: 'tickectDate',
|
|
|
- // component: 'TimeRangePicker',
|
|
|
- // defaultValue: [dayjs().startOf('date').format('HH:mm:ss'), dayjs().format('HH:mm:ss')],
|
|
|
- // componentProps: {
|
|
|
- // placement: 'topLeft',
|
|
|
- // placeholder: ['开始时间', '结束时间'],
|
|
|
- // valueFormat: 'HH:mm:ss',
|
|
|
- // },
|
|
|
- // colProps: {
|
|
|
- // span: 4,
|
|
|
- // },
|
|
|
- // },
|
|
|
{
|
|
|
- label: '查询设备',
|
|
|
- field: 'gdeviceid',
|
|
|
- component: 'Select',
|
|
|
- defaultValue: deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- options: deviceOptions,
|
|
|
- onChange: (e, option) => {
|
|
|
- if (option && (option['strinstallpos'] || option['strtype'] || option['devicekind']))
|
|
|
- historyType.value = option['strtype'] || option['devicekind'];
|
|
|
- if (option['strtype']) deviceTypeStr.value = option['strtype'];
|
|
|
- },
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
- },
|
|
|
+ label: '30秒',
|
|
|
+ value: '3',
|
|
|
},
|
|
|
{
|
|
|
- label: '间隔时间',
|
|
|
- field: 'skip',
|
|
|
- component: 'Select',
|
|
|
- defaultValue: 5,
|
|
|
- componentProps: {
|
|
|
- options: [
|
|
|
- {
|
|
|
- label: '5秒',
|
|
|
- value: '1',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '10秒',
|
|
|
- value: '2',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '30秒',
|
|
|
- value: '3',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '1分钟',
|
|
|
- value: '4',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '5分钟',
|
|
|
- value: '5',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '10分钟',
|
|
|
- value: '6',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '30分钟',
|
|
|
- value: '7',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '1小时',
|
|
|
- value: '8',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
- },
|
|
|
+ label: '1分钟',
|
|
|
+ value: '4',
|
|
|
},
|
|
|
- ],
|
|
|
- // fieldMapToTime: [['tickectDate', ['ttime_begin', 'ttime_end'], '']],
|
|
|
- },
|
|
|
- fetchSetting: {
|
|
|
- listField: 'datalist',
|
|
|
- totalField: 'datalist.total',
|
|
|
- },
|
|
|
- pagination: {
|
|
|
- current: 1,
|
|
|
- pageSize: 10,
|
|
|
- pageSizeOptions: ['10', '30', '50', '100'],
|
|
|
- showQuickJumper: false,
|
|
|
- },
|
|
|
- beforeFetch(params) {
|
|
|
- params.strtype = deviceTypeStr.value
|
|
|
- ? deviceTypeStr.value
|
|
|
- : deviceOptions.value[0]['strtype']
|
|
|
- ? deviceOptions.value[0]['strtype']
|
|
|
- : props.deviceType + '*';
|
|
|
- if (props.sysId) {
|
|
|
- params.sysId = props.sysId;
|
|
|
- }
|
|
|
- return params;
|
|
|
- },
|
|
|
- afterFetch(result) {
|
|
|
- const resultItems = result['records'];
|
|
|
- resultItems.map((item) => {
|
|
|
- Object.assign(item, item['readData']);
|
|
|
- });
|
|
|
- console.log('result---------------->', result);
|
|
|
- return resultItems;
|
|
|
- },
|
|
|
- },
|
|
|
- exportConfig: {
|
|
|
- name: '历史列表',
|
|
|
- url: getExportXlsUrl(),
|
|
|
- },
|
|
|
- }
|
|
|
- : {
|
|
|
- tableProps: {
|
|
|
- api: list,
|
|
|
- columns: props.columnsType ? columns : (props.columns as any[]),
|
|
|
- canResize: true,
|
|
|
- showTableSetting: false,
|
|
|
- showActionColumn: false,
|
|
|
- bordered: false,
|
|
|
- size: 'small',
|
|
|
- scroll: tableScroll,
|
|
|
- showIndexColumn: true,
|
|
|
- formConfig: {
|
|
|
- labelAlign: 'left',
|
|
|
- showAdvancedButton: false,
|
|
|
- // autoAdvancedCol: 2,
|
|
|
-
|
|
|
- baseColProps: {
|
|
|
- // offset: 0.5,
|
|
|
- xs: 24,
|
|
|
- sm: 24,
|
|
|
- md: 24,
|
|
|
- lg: 9,
|
|
|
- xl: 7,
|
|
|
- xxl: 4,
|
|
|
- },
|
|
|
- schemas:
|
|
|
- props.formSchemas.length > 0
|
|
|
- ? props.formSchemas
|
|
|
- : [
|
|
|
{
|
|
|
- field: 'startTime',
|
|
|
- label: '开始时间',
|
|
|
- component: 'DatePicker',
|
|
|
- defaultValue: dayjs().startOf('date'),
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- showTime: true,
|
|
|
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
- getPopupContainer: getAutoScrollContainer,
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
- },
|
|
|
+ label: '5分钟',
|
|
|
+ value: '5',
|
|
|
},
|
|
|
{
|
|
|
- field: 'endTime',
|
|
|
- label: '结束时间',
|
|
|
- component: 'DatePicker',
|
|
|
- defaultValue: dayjs(),
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- showTime: true,
|
|
|
- valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
- getPopupContainer: getAutoScrollContainer,
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
- },
|
|
|
+ label: '10分钟',
|
|
|
+ value: '6',
|
|
|
},
|
|
|
{
|
|
|
- label: '查询设备',
|
|
|
- field: 'deviceId',
|
|
|
- component: 'Select',
|
|
|
- defaultValue: deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '',
|
|
|
- required: true,
|
|
|
- componentProps: {
|
|
|
- options: deviceOptions,
|
|
|
- // api: () => defHttp.get({ url: '/safety/ventanalyManageSystem/linkdevicelist', params: { sysId: props.sysId, deviceType: props.deviceType.startsWith('vehicle') ? 'location_normal' : props.deviceType } }),
|
|
|
- // // resultField: 'result',
|
|
|
- // labelField: 'strinstallpos',
|
|
|
- // valueField: 'id',
|
|
|
- // numberToString: true,
|
|
|
- onChange: (e, option) => {
|
|
|
- if (option && (option['strinstallpos'] || option['strtype'] || option['devicekind']))
|
|
|
- historyType.value = option['strtype'] || option['devicekind'];
|
|
|
- },
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
- },
|
|
|
- // componentProps: ({ formModel }) => {
|
|
|
- // return {
|
|
|
- // options: deviceOptions.value,
|
|
|
- // // api: () => defHttp.get({ url: '/safety/ventanalyManageSystem/linkdevicelist', params: { sysId: props.sysId, deviceType: props.deviceType.startsWith('vehicle') ? 'location_normal' : props.deviceType } }),
|
|
|
- // // resultField: 'result',
|
|
|
- // // labelField: 'strinstallpos',
|
|
|
- // // valueField: 'id',
|
|
|
- // // onChange: (e, option) => {
|
|
|
- // // if(option && (option['strtype'] || option['devicekind'])) historyType.value = option['strtype'] || option['devicekind']
|
|
|
- // // },
|
|
|
- // }
|
|
|
- // },
|
|
|
+ label: '30分钟',
|
|
|
+ value: '7',
|
|
|
},
|
|
|
{
|
|
|
- label: '间隔时间',
|
|
|
- field: 'interval',
|
|
|
- component: 'Select',
|
|
|
- defaultValue: '30s',
|
|
|
- componentProps: {
|
|
|
- options: [
|
|
|
- {
|
|
|
- label: '1秒',
|
|
|
- value: '1s',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '5秒',
|
|
|
- value: '5s',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '10秒',
|
|
|
- value: '10s',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '30秒',
|
|
|
- value: '30s',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '1分钟',
|
|
|
- value: '1m',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '10分钟',
|
|
|
- value: '10m',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '30分钟',
|
|
|
- value: '30m',
|
|
|
- },
|
|
|
- {
|
|
|
- label: '1小时',
|
|
|
- value: '1h',
|
|
|
- },
|
|
|
- ],
|
|
|
- },
|
|
|
- colProps: {
|
|
|
- span: 4,
|
|
|
- },
|
|
|
+ label: '1小时',
|
|
|
+ value: '8',
|
|
|
},
|
|
|
],
|
|
|
- },
|
|
|
- pagination: {
|
|
|
- current: 1,
|
|
|
- pageSize: 10,
|
|
|
- pageSizeOptions: ['10', '30', '50', '100'],
|
|
|
- showQuickJumper: false,
|
|
|
- },
|
|
|
- // pagination: false,
|
|
|
- fetchSetting: {
|
|
|
- totalField: 'total',
|
|
|
- // 每页显示多少条
|
|
|
- sizeField: 'pageSize',
|
|
|
- // 请求结果列表字段 支持 a.b.c
|
|
|
- pageField: 'pageNo',
|
|
|
- },
|
|
|
- beforeFetch(params) {
|
|
|
- params.strtype = props.deviceType + '*';
|
|
|
- if (props.sysId) {
|
|
|
- params.sysId = props.sysId;
|
|
|
- }
|
|
|
- if (params.interval) {
|
|
|
- params.interval = params.interval;
|
|
|
- } else {
|
|
|
- params.interval = '1m';
|
|
|
- }
|
|
|
- if (props.deviceType.startsWith('vehicle')) {
|
|
|
- params['isEmployee'] = false;
|
|
|
- } else if (props.deviceType.startsWith('location')) {
|
|
|
- params['isEmployee'] = true;
|
|
|
- }
|
|
|
- },
|
|
|
- afterFetch(result) {
|
|
|
- return result;
|
|
|
- },
|
|
|
- },
|
|
|
- exportConfig: {
|
|
|
- name: '历史列表',
|
|
|
- url: getExportXlsUrl(),
|
|
|
- },
|
|
|
- }
|
|
|
- );
|
|
|
+ },
|
|
|
+ colProps: {
|
|
|
+ span: 4,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ // fieldMapToTime: [['tickectDate', ['ttime_begin', 'ttime_end'], '']],
|
|
|
+ },
|
|
|
+ // fetchSetting: {
|
|
|
+ // listField: 'datalist',
|
|
|
+ // totalField: 'datalist.total',
|
|
|
+ // },
|
|
|
+ pagination: {
|
|
|
+ current: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ pageSizeOptions: ['10', '30', '50', '100'],
|
|
|
+ showQuickJumper: false,
|
|
|
+ },
|
|
|
+ // beforeFetch(params) {
|
|
|
+ // params.strtype = deviceTypeStr.value
|
|
|
+ // ? deviceTypeStr.value
|
|
|
+ // : deviceOptions.value[0]['strtype']
|
|
|
+ // ? deviceOptions.value[0]['strtype']
|
|
|
+ // : props.deviceType + '*';
|
|
|
+ // if (props.sysId) {
|
|
|
+ // params.sysId = props.sysId;
|
|
|
+ // }
|
|
|
+ // return params;
|
|
|
+ // },
|
|
|
+ // afterFetch(result) {
|
|
|
+ // const resultItems = result['records'];
|
|
|
+ // resultItems.map((item) => {
|
|
|
+ // Object.assign(item, item['readData']);
|
|
|
+ // });
|
|
|
+ // console.log('result---------------->', result);
|
|
|
+ // return resultItems;
|
|
|
+ // },
|
|
|
+ },
|
|
|
+ exportConfig: {
|
|
|
+ name: '历史列表',
|
|
|
+ url: getExportXlsUrl(),
|
|
|
+ },
|
|
|
+ });
|
|
|
|
|
|
//注册table数据
|
|
|
- const [registerTable, { getDataSource, reload, setLoading, getForm, setColumns }] = tableContext;
|
|
|
+ const [registerTable, { reload, setLoading, getForm, setColumns, getPaginationRef }] = tableContext;
|
|
|
|
|
|
watchEffect(() => {
|
|
|
- if (historyTable.value && getDataSource) {
|
|
|
- const data = getDataSource() || [];
|
|
|
+ if (historyTable.value && dataSource) {
|
|
|
+ const data = dataSource.value || [];
|
|
|
emit('change', data);
|
|
|
console.log('[ data ] >', data);
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
await getDeviceList();
|
|
|
- debugger;
|
|
|
if (deviceOptions.value[0]) {
|
|
|
+ stationType.value = deviceOptions.value[0]['stationtype'];
|
|
|
historyType.value = deviceOptions.value[0]['strtype'] || deviceOptions.value[0]['devicekind'];
|
|
|
+ getDataSource();
|
|
|
}
|
|
|
});
|
|
|
defineExpose({ setLoading });
|