|
@@ -11,7 +11,8 @@
|
|
|
import { useListPage } from '/@/hooks/system/useListPage';
|
|
|
import { getTableHeaderColumns } from '/@/hooks/web/useWebColumns';
|
|
|
import { defHttp } from '/@/utils/http/axios';
|
|
|
-
|
|
|
+ import dayjs from 'dayjs';
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
columnsType: {
|
|
|
type: String,
|
|
@@ -47,8 +48,23 @@
|
|
|
});
|
|
|
const alarmHistory = ref()
|
|
|
const columns = ref([])
|
|
|
+ let deviceOptions = <any[]>[]
|
|
|
+
|
|
|
const tableScroll = props.scroll.y ? ref({ y: props.scroll.y - 100 }) : ref({})
|
|
|
+
|
|
|
+ async function getDeviceList() {
|
|
|
+ let result;
|
|
|
+ result = await props.deviceListApi()
|
|
|
+ if (result && result['records'] && result['records'].length > 0) {
|
|
|
+ const deviceList = result['records']
|
|
|
+ deviceOptions = []
|
|
|
+ deviceOptions = deviceList.map((item) => {
|
|
|
+ return { label: item['strinstallpos'], value: item['id'], strtype: item['strtype'], strinstallpos: item['strinstallpos'], devicekind: item['devicekind'] }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ await getDeviceList()
|
|
|
watch(
|
|
|
() => {
|
|
|
return props.columnsType;
|
|
@@ -104,6 +120,10 @@
|
|
|
label: '时间范围',
|
|
|
field: 'createTime',
|
|
|
component: 'RangePicker',
|
|
|
+ defaultValue: [
|
|
|
+ dayjs().subtract(1, 'day'),
|
|
|
+ dayjs(),
|
|
|
+ ],
|
|
|
componentProps: {
|
|
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
|
|
},
|
|
@@ -111,13 +131,21 @@
|
|
|
{
|
|
|
label: '查询设备',
|
|
|
field: 'gdeviceid',
|
|
|
- component: 'ApiSelect',
|
|
|
+ component: 'Select',
|
|
|
+ defaultValue: deviceOptions[0] ? deviceOptions[0]['value'] : '',
|
|
|
+ required: true,
|
|
|
componentProps: {
|
|
|
- api: props.deviceListApi,
|
|
|
- resultField: 'records',
|
|
|
- labelField: 'strname',
|
|
|
- valueField: 'id',
|
|
|
+ options: deviceOptions,
|
|
|
+ onChange: (e, option) => {
|
|
|
+ if (option && (option['strinstallpos'] || option['strtype'] || option['devicekind'])) historyType.value = option['strtype'] || option['devicekind']
|
|
|
+ },
|
|
|
},
|
|
|
+ // componentProps: {
|
|
|
+ // api: props.deviceListApi,
|
|
|
+ // resultField: 'records',
|
|
|
+ // labelField: 'strname',
|
|
|
+ // valueField: 'id',
|
|
|
+ // },
|
|
|
},
|
|
|
],
|
|
|
fieldMapToTime: [['createTime', ['createTime_begin', 'createTime_end'], '']],
|