|
@@ -3,7 +3,7 @@
|
|
<BasicTable ref="historyTable" @register="registerTable" :data-source="dataSource" :columns="historyColumns">
|
|
<BasicTable ref="historyTable" @register="registerTable" :data-source="dataSource" :columns="historyColumns">
|
|
<template #form-submitBefore>
|
|
<template #form-submitBefore>
|
|
<a-button type="primary" preIcon="ant-design:search-outlined" @click="getDataSource">查询</a-button>
|
|
<a-button type="primary" preIcon="ant-design:search-outlined" @click="getDataSource">查询</a-button>
|
|
- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXlsFn"> 导出</a-button>
|
|
|
|
|
|
+ <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXlsFn">导出</a-button>
|
|
</template>
|
|
</template>
|
|
</BasicTable>
|
|
</BasicTable>
|
|
</div>
|
|
</div>
|
|
@@ -36,7 +36,7 @@ const props = defineProps({
|
|
type: Array,
|
|
type: Array,
|
|
default: () => [],
|
|
default: () => [],
|
|
},
|
|
},
|
|
- id: {
|
|
|
|
|
|
+ stationId: {
|
|
type: String,
|
|
type: String,
|
|
},
|
|
},
|
|
scroll: {
|
|
scroll: {
|
|
@@ -58,12 +58,13 @@ const dataSource = ref([]);
|
|
const emit = defineEmits(['change']);
|
|
const emit = defineEmits(['change']);
|
|
|
|
|
|
const historyType = ref('');
|
|
const historyType = ref('');
|
|
-const linkStatus = ref('');
|
|
|
|
const deviceKide = ref('');
|
|
const deviceKide = ref('');
|
|
const columns = ref([]);
|
|
const columns = ref([]);
|
|
-const deviceOptions = ref([]);
|
|
|
|
const tableScroll = props.scroll.y ? ref({ y: props.scroll.y - 100 }) : ref({});
|
|
const tableScroll = props.scroll.y ? ref({ y: props.scroll.y - 100 }) : ref({});
|
|
-const deviceTypeStr = ref('');
|
|
|
|
|
|
+const statusMap = new Map([
|
|
|
|
+ ['1', '连接成功'],
|
|
|
|
+ ['0', '连接失败'],
|
|
|
|
+]);
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
|
|
|
watch(
|
|
watch(
|
|
@@ -80,7 +81,6 @@ watch(
|
|
// getForm();
|
|
// getForm();
|
|
}
|
|
}
|
|
dataSource.value = [];
|
|
dataSource.value = [];
|
|
- await getSubStationList();
|
|
|
|
nextTick(() => {
|
|
nextTick(() => {
|
|
getDataSource();
|
|
getDataSource();
|
|
});
|
|
});
|
|
@@ -104,33 +104,12 @@ watch(
|
|
);
|
|
);
|
|
|
|
|
|
watch(
|
|
watch(
|
|
- () => props.id,
|
|
|
|
|
|
+ () => props.stationId,
|
|
async () => {
|
|
async () => {
|
|
await getForm().setFieldsValue({});
|
|
await getForm().setFieldsValue({});
|
|
- await getSubStationList();
|
|
|
|
}
|
|
}
|
|
);
|
|
);
|
|
|
|
|
|
-//获取分站信息
|
|
|
|
-async function getSubStationList() {
|
|
|
|
- let result;
|
|
|
|
- let res = await subStationList({ strtype: 'modbus' });
|
|
|
|
- result = res;
|
|
|
|
- if (result) {
|
|
|
|
- deviceOptions.value = [];
|
|
|
|
- deviceOptions.value = result['records'].map((item) => {
|
|
|
|
- return {
|
|
|
|
- label: item['stationName'],
|
|
|
|
- value: item['id'],
|
|
|
|
- strinstallpos: item['stationName'],
|
|
|
|
- status: item['status'],
|
|
|
|
- };
|
|
|
|
- // return { label: item['strname'], value: item['id']}
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- deviceOptions.value.unshift({ label: '--请选择分站--', value: '', stationName: '' });
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
function resetFormParam() {
|
|
function resetFormParam() {
|
|
const formData = getForm().getFieldsValue();
|
|
const formData = getForm().getFieldsValue();
|
|
const pagination = getPaginationRef();
|
|
const pagination = getPaginationRef();
|
|
@@ -141,7 +120,7 @@ function resetFormParam() {
|
|
pageSize: pagination['pageSize'],
|
|
pageSize: pagination['pageSize'],
|
|
createTime_begin: formData['starttime_begin'],
|
|
createTime_begin: formData['starttime_begin'],
|
|
createTime_end: formData['starttime_end'],
|
|
createTime_end: formData['starttime_end'],
|
|
- stationId: formData['stationId'],
|
|
|
|
|
|
+ stationId: props.stationId,
|
|
status: formData['status'],
|
|
status: formData['status'],
|
|
};
|
|
};
|
|
return params;
|
|
return params;
|
|
@@ -218,7 +197,7 @@ const { tableContext, onExportXlsPost } = useListPage({
|
|
getPopupContainer: getAutoScrollContainer,
|
|
getPopupContainer: getAutoScrollContainer,
|
|
},
|
|
},
|
|
colProps: {
|
|
colProps: {
|
|
- span: 4,
|
|
|
|
|
|
+ span: 6,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
@@ -233,47 +212,24 @@ const { tableContext, onExportXlsPost } = useListPage({
|
|
getPopupContainer: getAutoScrollContainer,
|
|
getPopupContainer: getAutoScrollContainer,
|
|
},
|
|
},
|
|
colProps: {
|
|
colProps: {
|
|
- span: 4,
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- label: '查询分站',
|
|
|
|
- field: 'stationId',
|
|
|
|
- component: 'Select',
|
|
|
|
- defaultValue: props.id ? props.id : deviceOptions.value[0] ? deviceOptions.value[0]['value'] : '',
|
|
|
|
- componentProps: {
|
|
|
|
- showSearch: true,
|
|
|
|
- filterOption: (input: string, option: any) => {
|
|
|
|
- return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
|
|
- },
|
|
|
|
- options: deviceOptions,
|
|
|
|
- onChange: (e, option) => {
|
|
|
|
- if (option) {
|
|
|
|
- historyType.value = option.value; // 使用选项的value(即id)更新historyType
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- },
|
|
|
|
- colProps: {
|
|
|
|
- span: 4,
|
|
|
|
|
|
+ span: 6,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
{
|
|
label: '连接状态',
|
|
label: '连接状态',
|
|
field: 'status',
|
|
field: 'status',
|
|
component: 'Select',
|
|
component: 'Select',
|
|
- componentProps: {
|
|
|
|
- options: [
|
|
|
|
- { label: '连接成功', value: 1 },
|
|
|
|
- { label: '连接失败', value: 0 },
|
|
|
|
- ],
|
|
|
|
- onChange: (e, option) => {
|
|
|
|
- if (option) {
|
|
|
|
- linkStatus.value = option.value; // 使用选项的value(即id)更新historyType
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
|
|
+ defaultValue: '连接成功',
|
|
|
|
+ componentProps: () => {
|
|
|
|
+ return {
|
|
|
|
+ options: [
|
|
|
|
+ { label: '连接成功', value: 1 },
|
|
|
|
+ { label: '连接失败', value: 0 },
|
|
|
|
+ ],
|
|
|
|
+ };
|
|
},
|
|
},
|
|
colProps: {
|
|
colProps: {
|
|
- span: 4,
|
|
|
|
|
|
+ span: 6,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
],
|
|
],
|
|
@@ -309,11 +265,7 @@ watchEffect(() => {
|
|
});
|
|
});
|
|
|
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
- await getSubStationList();
|
|
|
|
- console.log(deviceOptions.value[0], '数据');
|
|
|
|
- if (deviceOptions.value[0]) {
|
|
|
|
- historyType.value = deviceOptions.value[0]['stationName'] || deviceOptions.value[0]['id'];
|
|
|
|
- linkStatus.value = deviceOptions.value[0]['status'];
|
|
|
|
|
|
+ if (props.stationId) {
|
|
nextTick(async () => {
|
|
nextTick(async () => {
|
|
await getDataSource();
|
|
await getDataSource();
|
|
});
|
|
});
|
|
@@ -352,6 +304,9 @@ defineExpose({ setLoading });
|
|
.@{ventSpace}-select-selection-placeholder {
|
|
.@{ventSpace}-select-selection-placeholder {
|
|
color: #ffffffaa;
|
|
color: #ffffffaa;
|
|
}
|
|
}
|
|
|
|
+ .@{ventSpace}-zxm-select-selection-item {
|
|
|
|
+ color: #00000017 !important;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.@{ventSpace}-table-title {
|
|
.@{ventSpace}-table-title {
|