|
@@ -22,6 +22,18 @@
|
|
|
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXlsFn"> 导出</a-button>
|
|
|
</template>
|
|
|
</BasicTable>
|
|
|
+ <BarAndLine
|
|
|
+ v-if="showHistoryCurve"
|
|
|
+ :charts-columns="chartsColumns"
|
|
|
+ :option="{
|
|
|
+ legend: {
|
|
|
+ top: '5',
|
|
|
+ },
|
|
|
+ }"
|
|
|
+ :data-source="dataSource"
|
|
|
+ height="250px"
|
|
|
+ x-axis-prop-type="ttime"
|
|
|
+ />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -37,6 +49,7 @@
|
|
|
import { getAutoScrollContainer } from '/@/utils/common/compUtils';
|
|
|
import { render } from '/@/utils/common/renderUtils';
|
|
|
import { useMethods } from '/@/hooks/system/useMethods';
|
|
|
+ import BarAndLine from '/@/components/chart/BarAndLine.vue';
|
|
|
|
|
|
const globalConfig = inject('globalConfig');
|
|
|
const props = defineProps({
|
|
@@ -77,6 +90,15 @@
|
|
|
type: Array<FormSchema>,
|
|
|
default: () => [],
|
|
|
},
|
|
|
+ /** 仅展示已绑定设备,选择是则从系统中获取sysId下已绑定设备。仅能查询到已绑定设备的历史数据 */
|
|
|
+ onlyBounedDevices: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
+ showHistoryCurve: {
|
|
|
+ type: Boolean,
|
|
|
+ default: false,
|
|
|
+ },
|
|
|
});
|
|
|
const getDeviceListApi = (params) => defHttp.post({ url: '/monitor/device', params });
|
|
|
const historyTable = ref();
|
|
@@ -112,6 +134,7 @@
|
|
|
const deviceTypeStr = ref('');
|
|
|
const deviceTypeName = ref('');
|
|
|
const deviceType = ref('');
|
|
|
+ const chartsColumns = ref([]);
|
|
|
loading.value = true;
|
|
|
|
|
|
watch(
|
|
@@ -163,6 +186,10 @@
|
|
|
} else {
|
|
|
columns.value = column;
|
|
|
}
|
|
|
+ if (props.showHistoryCurve) {
|
|
|
+ const arr = type.split('_');
|
|
|
+ chartsColumns.value = getTableHeaderColumns(arr[0] + '_chart');
|
|
|
+ }
|
|
|
setColumns(columns.value);
|
|
|
});
|
|
|
|
|
@@ -193,50 +220,40 @@
|
|
|
}
|
|
|
);
|
|
|
|
|
|
+ /** 获取可供查询历史数据的设备列表 */
|
|
|
async function getDeviceList() {
|
|
|
// if (props.deviceType.split('_')[1] && props.deviceType.split('_')[1] === 'history') return;
|
|
|
let result;
|
|
|
- if (!props.sysId) {
|
|
|
- if (props.deviceListApi) {
|
|
|
- const res = await props.deviceListApi();
|
|
|
- if (props.deviceType.startsWith('modelsensor')) {
|
|
|
- if (res['msgTxt'] && res['msgTxt'][0] && res['msgTxt'][0]['datalist']) {
|
|
|
- result = res['msgTxt'][0]['datalist'];
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (res['records'] && res['records'].length > 0) result = res['records'];
|
|
|
- }
|
|
|
- if (res['msgTxt'] && res['msgTxt'][0]) {
|
|
|
- deviceTypeName.value = res['msgTxt'][0]['typeName'];
|
|
|
- deviceType.value = res['msgTxt'][0]['type'];
|
|
|
- }
|
|
|
- } else {
|
|
|
- const res = await getDeviceListApi({ devicetype: props.deviceType, pageSize: 10000 });
|
|
|
- if (res['records'] && res['records'].length > 0) {
|
|
|
- result = res['records'];
|
|
|
- } else if (res['msgTxt'] && res['msgTxt'][0] && res['msgTxt'][0]['datalist']) {
|
|
|
- result = res['msgTxt'][0]['datalist'];
|
|
|
- }
|
|
|
- if (res['msgTxt'] && res['msgTxt'][0]) {
|
|
|
- deviceTypeName.value = res['msgTxt'][0]['typeName'];
|
|
|
- deviceType.value = res['msgTxt'][0]['type'];
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- const res = await getDeviceListApi({
|
|
|
+ let response;
|
|
|
+ if (props.onlyBounedDevices) {
|
|
|
+ response = await getDeviceListApi({
|
|
|
+ systemID: props.sysId,
|
|
|
+ devicetype: 'sys',
|
|
|
+ pageSize: 10000,
|
|
|
+ }).then(({ msgTxt }) => {
|
|
|
+ return { msgTxt: msgTxt.filter((e) => e.type === props.deviceType) };
|
|
|
+ });
|
|
|
+ } else if (props.sysId) {
|
|
|
+ response = await getDeviceListApi({
|
|
|
sysId: props.sysId,
|
|
|
devicetype: props.deviceType.startsWith('vehicle') ? 'location_normal' : props.deviceType,
|
|
|
pageSize: 10000,
|
|
|
});
|
|
|
- if (res['records'] && res['records'].length > 0) {
|
|
|
- result = res['records'];
|
|
|
- } else if (res['msgTxt'] && res['msgTxt'][0] && res['msgTxt'][0]['datalist']) {
|
|
|
- result = res['msgTxt'][0]['datalist'];
|
|
|
- }
|
|
|
- if (res['msgTxt'] && res['msgTxt'][0]) {
|
|
|
- deviceTypeName.value = res['msgTxt'][0]['typeName'];
|
|
|
- deviceType.value = res['msgTxt'][0]['type'];
|
|
|
- }
|
|
|
+ } else if (props.deviceListApi) {
|
|
|
+ response = await props.deviceListApi();
|
|
|
+ } else {
|
|
|
+ response = await getDeviceListApi({ devicetype: props.deviceType, pageSize: 10000 });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 处理不同格式的数据
|
|
|
+ if (response['records'] && response['records'].length > 0) {
|
|
|
+ result = response['records'];
|
|
|
+ } else if (response['msgTxt'] && response['msgTxt'][0] && response['msgTxt'][0]['datalist']) {
|
|
|
+ result = response['msgTxt'][0]['datalist'];
|
|
|
+ }
|
|
|
+ if (response['msgTxt'] && response['msgTxt'][0]) {
|
|
|
+ deviceTypeName.value = response['msgTxt'][0]['typeName'];
|
|
|
+ deviceType.value = response['msgTxt'][0]['type'];
|
|
|
}
|
|
|
|
|
|
if (result) {
|