|
|
@ -14,7 +14,7 @@ import { DeviceTypes } from '../constant'; |
|
|
|
import qs from "qs"; |
|
|
|
|
|
|
|
import '../style.less'; |
|
|
|
import TableShow from './tableShow' |
|
|
|
import TableShow from './tableShow' |
|
|
|
function DeviceMonitor ({ ...props }) { |
|
|
|
const { |
|
|
|
dispatch, actions, user, clientWidth, clientHeight, loading, |
|
|
@ -30,13 +30,19 @@ function DeviceMonitor ({ ...props }) { |
|
|
|
|
|
|
|
|
|
|
|
let strucParam = JSON.parse((qs.parse(props.location?.search.slice(1)) || {})?.strucData) |
|
|
|
console.log(1111, strucParam) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
if (strucParam?.thingId) { |
|
|
|
dispatch(analysis.getThingsDeploy(strucParam?.thingId)) |
|
|
|
dispatch(analysis.getThingsDeploy(strucParam?.thingId)).then(res => { |
|
|
|
console.log(3213, res); |
|
|
|
if (res.success) { |
|
|
|
const instances = res?.payload?.data?.instances; |
|
|
|
if (instances) { |
|
|
|
const deviceIds = Object.keys(instances).filter((k) => instances[k]?.type == 's.d'); |
|
|
|
dispatch(analysis.getDevicesAlarms(deviceIds, { limit: 5 })); |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
dispatch(analysis.getDeviceMetaDeployed(strucParam?.thingId)) |
|
|
|
} |
|
|
|
}, []); |
|
|
@ -107,59 +113,6 @@ function DeviceMonitor ({ ...props }) { |
|
|
|
return result; |
|
|
|
}, [devices, deviceListAlarms]); |
|
|
|
|
|
|
|
// 筛选过滤数据
|
|
|
|
const filterDataSource = () => { |
|
|
|
const { |
|
|
|
name, deviceType, productType, productName, location, status, |
|
|
|
} = params; |
|
|
|
return dataSource.filter((s) => (name ? s.name ? (s.name.indexOf(name) != -1 || PinyinHelper.isPinyinMatched(s.name, name)) : false : true) |
|
|
|
&& (location ? s.location ? (s.location.indexOf(location) != -1 || PinyinHelper.isPinyinMatched(s.location, location)) : false : true) |
|
|
|
&& (deviceType ? s.deviceTypeId == deviceType : true) |
|
|
|
&& (productType ? s.productType == productType : true) |
|
|
|
&& (status ? s.status == status : true) |
|
|
|
&& (productName ? s.productName ? (s.productName.indexOf(productName) != -1 || PinyinHelper.isPinyinMatched(s.productName, productName)) : false : true)); |
|
|
|
}; |
|
|
|
|
|
|
|
// const deviceTypeIds = Func.uniqueArr(dataSource, 'deviceTypeId');
|
|
|
|
// const productTypeIds = Func.uniqueArr(dataSource, 'productType');
|
|
|
|
|
|
|
|
const columns = [{ |
|
|
|
title: '名称', |
|
|
|
dataIndex: 'name', |
|
|
|
ellipsis: true, |
|
|
|
|
|
|
|
}, { |
|
|
|
title: '设备类型', |
|
|
|
dataIndex: 'deviceType', |
|
|
|
// valueEnum: Func.transValueEnum(deviceTypeIds, 'deviceTypeId', 'deviceType'),
|
|
|
|
// fieldProps: Func.getSelectCommonProps(),
|
|
|
|
|
|
|
|
}, { |
|
|
|
title: '产品名称', |
|
|
|
dataIndex: 'productName', |
|
|
|
ellipsis: true, |
|
|
|
|
|
|
|
}, { |
|
|
|
title: '产品型号', |
|
|
|
dataIndex: 'productType', |
|
|
|
// valueEnum: Func.transValueEnum(productTypeIds, 'productType', 'productType'),
|
|
|
|
// fieldProps: Func.getSelectCommonProps(),
|
|
|
|
}, { |
|
|
|
title: '测点', |
|
|
|
dataIndex: 'location', |
|
|
|
|
|
|
|
}, { |
|
|
|
title: '状态', |
|
|
|
dataIndex: 'status', |
|
|
|
filters: true, |
|
|
|
onFilter: true, |
|
|
|
valueEnum: { |
|
|
|
normal: { text: '正常', status: 'Success' }, |
|
|
|
alarm: { text: '异常', status: 'Error' }, |
|
|
|
}, |
|
|
|
// fieldProps: Func.getSelectCommonProps(),
|
|
|
|
}]; |
|
|
|
|
|
|
|
const renderTitle = () => ( |
|
|
|
<div className="device-monitor"> |
|
|
|
设备总数: |
|
|
@ -177,10 +130,9 @@ function DeviceMonitor ({ ...props }) { |
|
|
|
个; |
|
|
|
</div> |
|
|
|
); |
|
|
|
const data = filterDataSource(); |
|
|
|
|
|
|
|
return ( |
|
|
|
// <div>div</div>
|
|
|
|
// <LayoutContent>
|
|
|
|
|
|
|
|
<Spin spinning={false}> |
|
|
|
<ProCard title={renderTitle()} extra={renderExtra()} headerBordered> |
|
|
|
{ |
|
|
@ -193,18 +145,18 @@ function DeviceMonitor ({ ...props }) { |
|
|
|
deviceList={devices} |
|
|
|
dimensionlist={dimensions} |
|
|
|
dispatch={dispatch} |
|
|
|
actions={actions} |
|
|
|
struct={strucParam} |
|
|
|
clientHeight={clientHeight} |
|
|
|
clientWidth={clientWidth} |
|
|
|
/> |
|
|
|
) : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> |
|
|
|
: ( |
|
|
|
<TableShow thingId={strucParam.thingId} project={strucParam.projectId}/> |
|
|
|
<TableShow thingId={strucParam.thingId} project={strucParam.projectId} /> |
|
|
|
) |
|
|
|
} |
|
|
|
</ProCard> |
|
|
|
</Spin> |
|
|
|
// </LayoutContent>
|
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|