zhaobing’ 1 year ago
parent
commit
735bb6328d
  1. 4
      api/Dockerfilenew
  2. 2
      script/3.6.2/data/1_bing_anxinproject_local/index.js
  3. 4
      web-network/Dockerfilenew
  4. 5
      web-network/client/src/sections/network/components/device-tree/index.js
  5. 26
      web-network/client/src/sections/network/components/device-tree/zuwang-main.js
  6. 19
      web-network/client/src/sections/network/containers/device-monitor.js
  7. 4
      web/Dockerfilenew

4
api/Dockerfilenew

@ -1,4 +1,4 @@
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder
FROM registry.ngaiot.com/base-images/node:12-fs-dev-35 as builder
COPY ./api/ /var/app
WORKDIR /var/app
EXPOSE 8080
@ -7,7 +7,7 @@ RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision
RUN npm cache clean -f
RUN rm -rf package-lock.json
RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12
FROM registry.ngaiot.com/base-images/node:12-fs-prod-40
COPY --from=builder --chown=node /var/app /home/node/app
WORKDIR /home/node/app
CMD ["node", "server.js"]

2
script/3.6.2/data/1_bing_anxinproject_local/index.js

@ -16,7 +16,7 @@ try {
const pomsPool = new Pool({
user: 'POMSAdmin',
host: '10.8.40.223',
database: 'pomstest',
database: 'POMS',
password: 'POMSAdmin_123',
port: 5432,
})

4
web-network/Dockerfilenew

@ -1,4 +1,4 @@
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder
FROM registry.ngaiot.com/base-images/node:12-fs-dev-35 as builder
WORKDIR /var/app
@ -14,7 +14,7 @@ RUN npm run build
RUN rm -rf client/src
RUN rm -rf node_modules
RUN npm install --production --registry https://nexus.ngaiot.com/repository/fs-npm/
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20
FROM registry.ngaiot.com/base-images/node:12-fs-prod-40
COPY --from=builder --chown=node /var/app /home/node/app
WORKDIR /home/node/app
CMD ["node", "server.js"]

5
web-network/client/src/sections/network/components/device-tree/index.js

@ -17,7 +17,7 @@ const { ModifyEquipmentNetworking } = AuthorizationCode;
export default function ({ ...props }) {
const {
dispatch, actions, clientHeight, deviceMetasWithFollow, deviceList, dimensionlist, struct, token
dispatch, actions, clientHeight, deviceMetasWithFollow, deviceList, dimensionlist, struct, token, thingStatus
} = props;
const [g6TreeDirection, setG6TreeDirection] = useSafeState('TB');
const [devices, setDevices] = useSafeState(null);
@ -256,7 +256,7 @@ export default function ({ ...props }) {
</span>
</div>
{
devices?.instances
devices?.instances && thingStatus.length > 0 && deviceMetasWithFollow?.devices?.length > 0
&& (
<ZuwangMain
data={devices.instances}
@ -282,6 +282,7 @@ export default function ({ ...props }) {
token={token}
dispatch={dispatch}
actions={actions}
thingStatus={thingStatus}
/>
)
}

26
web-network/client/src/sections/network/components/device-tree/zuwang-main.js

@ -20,7 +20,7 @@ export default function ({ ...props }) {
const {
struct, data, resetFoldAllG6ToCenter, foldAllG6ToCenter, g6TreeDirection, emitChange, emitDataChange_,
width, height, collapseAll, collapsed, expanded, expandAll, changeFinish, targetNode, inputSearching, setInputSearching,
onCollapse, handleNodeEnter, handelNodeClick, token, dispatch, actions
onCollapse, handleNodeEnter, handelNodeClick, token, dispatch, actions, thingStatus
} = props;
const [isGetLinkStateDone, { setTrue, setFalse }] = useBoolean(false);
const [devicesLinkState, setDevicesLinkState] = useSafeState(null);
@ -242,23 +242,23 @@ export default function ({ ...props }) {
defaultTreeNodesCheckedKeys.push(a.id);
} else if (deviceInfo[deviceIds[i]].type == 's.d') {
let linkState = null;
if (devicesLinkState) {
linkState = devicesLinkState.find((dls) => dls.deviceId == deviceIds[i]);
if (linkState) {
linkState = linkState.status;
}
}
let linkStateMsg = '';
let LinlStateColor = '#666666';
if ((linkState != null || linkState != undefined)) {
if (linkState == 1) {
// linkStateMsg = "(在线)"
} else if (linkState == 0) {
linkStateMsg = '(离线)';
LinlStateColor = 'red';
let thingStatusFind = thingStatus?.find(d => d.deviceId == deviceIds[i])
if (thingStatusFind) {
linkState = thingStatusFind?.status
if (thingStatusFind?.status == 0) {
LinlStateColor = 'red'
linkStateMsg = '(离线)'
if (deviceInfo[deviceIds[i]]?.instance?.properties?.deviceType == "sensor") {
linkStateMsg += `\n 最后一条数据时间: \n ${moment(thingStatusFind?.latestTime).format("YYYY-MM-DD HH:mm:ss")}`
} else {
linkStateMsg += `\n 离线时间:\n ${moment(thingStatusFind?.offsetTime).format("YYYY-MM-DD HH:mm:ss")}`
}
}
}
const a = {
...deviceInfo[deviceIds[i]],
id: deviceIds[i],

19
web-network/client/src/sections/network/containers/device-monitor.js

@ -18,7 +18,7 @@ import TableShow from './tableShow'
function DeviceMonitor ({ ...props }) {
const {
dispatch, actions, user, clientWidth, clientHeight, loading,
myStructList, deviceMetasWithFollow, devices, dimensions, deviceListAlarms, factorStations,
myStructList, deviceMetasWithFollow, devices, dimensions, deviceListAlarms, factorStations, thingStatus,
} = props;
const { analysis } = actions
@ -101,15 +101,15 @@ function DeviceMonitor ({ ...props }) {
<div className="device-monitor">
设备总数:
{' '}
{dataSource.length}
{thingStatus?.length || 0}
{' '}
;
异常设备:
<span className="title-alarm">{dataSource.filter((f) => f.status === 'alarm').length}</span>
<span className="title-alarm">{thingStatus.filter((f) => f.status == 0)?.length || 0}</span>
{' '}
;
正常设备:
<span className="title-normal">{dataSource.filter((f) => f.status === 'normal').length}</span>
<span className="title-normal">{thingStatus.filter((f) => f.status != 0)?.length || 0}</span>
{' '}
;
</div>
@ -117,12 +117,12 @@ function DeviceMonitor ({ ...props }) {
return (
<Spin spinning={false}>
<Spin spinning={loading}>
<ProCard title={renderTitle()} extra={renderExtra()} headerBordered>
{
extraType === 'tree'
? deviceMetasWithFollow?.devices?.length > 0
&& devices.instances
&& devices.instances && thingStatus.length > 0
? (
<DeviceTree
deviceMetasWithFollow={deviceMetasWithFollow}
@ -134,7 +134,7 @@ function DeviceMonitor ({ ...props }) {
clientHeight={clientHeight}
clientWidth={clientWidth}
token={token}
thingStatus={thingStatus}
/>
) : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
: (
@ -148,10 +148,10 @@ function DeviceMonitor ({ ...props }) {
function mapStateToProps (state) {
const {
auth, global, myStructList, deviceMeta, deviceList, dimensionsList, deviceListAlarms, factorStations,
auth, global, myStructList, deviceMeta, deviceList, dimensionsList, deviceListAlarms, factorStations, thingStatus
} = state;
return {
loading: myStructList?.isRequesting || deviceMeta?.isRequesting || deviceList?.isRequesting || dimensionsList?.isRequesting,
loading: deviceMeta?.isRequesting || deviceList?.isRequesting || dimensionsList?.isRequesting || thingStatus?.isRequesting,
user: auth?.user,
actions: global?.actions,
clientWidth: global?.clientWidth,
@ -162,6 +162,7 @@ function mapStateToProps (state) {
dimensions: dimensionsList?.data || { dimensions: [], total: 0 },
deviceListAlarms: deviceListAlarms?.data || [],
factorStations: factorStations?.data || [],
thingStatus: thingStatus?.data || []
};
}

4
web/Dockerfilenew

@ -1,4 +1,4 @@
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder
FROM registry.ngaiot.com/base-images/node:12-fs-dev-35 as builder
WORKDIR /var/app
@ -14,7 +14,7 @@ RUN npm run build
RUN rm -rf client/src
RUN rm -rf node_modules
RUN npm install --production --registry https://nexus.ngaiot.com/repository/fs-npm/
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20
FROM registry.ngaiot.com/base-images/node:12-fs-prod-40
COPY --from=builder --chown=node /var/app /home/node/app
WORKDIR /home/node/app
CMD ["node", "server.js"]
Loading…
Cancel
Save