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 COPY ./api/ /var/app
WORKDIR /var/app WORKDIR /var/app
EXPOSE 8080 EXPOSE 8080
@ -7,7 +7,7 @@ RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision
RUN npm cache clean -f RUN npm cache clean -f
RUN rm -rf package-lock.json RUN rm -rf package-lock.json
RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ 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 COPY --from=builder --chown=node /var/app /home/node/app
WORKDIR /home/node/app WORKDIR /home/node/app
CMD ["node", "server.js"] 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({ const pomsPool = new Pool({
user: 'POMSAdmin', user: 'POMSAdmin',
host: '10.8.40.223', host: '10.8.40.223',
database: 'pomstest', database: 'POMS',
password: 'POMSAdmin_123', password: 'POMSAdmin_123',
port: 5432, 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 WORKDIR /var/app
@ -14,7 +14,7 @@ RUN npm run build
RUN rm -rf client/src RUN rm -rf client/src
RUN rm -rf node_modules RUN rm -rf node_modules
RUN npm install --production --registry https://nexus.ngaiot.com/repository/fs-npm/ 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 COPY --from=builder --chown=node /var/app /home/node/app
WORKDIR /home/node/app WORKDIR /home/node/app
CMD ["node", "server.js"] 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 }) { export default function ({ ...props }) {
const { const {
dispatch, actions, clientHeight, deviceMetasWithFollow, deviceList, dimensionlist, struct, token dispatch, actions, clientHeight, deviceMetasWithFollow, deviceList, dimensionlist, struct, token, thingStatus
} = props; } = props;
const [g6TreeDirection, setG6TreeDirection] = useSafeState('TB'); const [g6TreeDirection, setG6TreeDirection] = useSafeState('TB');
const [devices, setDevices] = useSafeState(null); const [devices, setDevices] = useSafeState(null);
@ -256,7 +256,7 @@ export default function ({ ...props }) {
</span> </span>
</div> </div>
{ {
devices?.instances devices?.instances && thingStatus.length > 0 && deviceMetasWithFollow?.devices?.length > 0
&& ( && (
<ZuwangMain <ZuwangMain
data={devices.instances} data={devices.instances}
@ -282,6 +282,7 @@ export default function ({ ...props }) {
token={token} token={token}
dispatch={dispatch} dispatch={dispatch}
actions={actions} 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 { const {
struct, data, resetFoldAllG6ToCenter, foldAllG6ToCenter, g6TreeDirection, emitChange, emitDataChange_, struct, data, resetFoldAllG6ToCenter, foldAllG6ToCenter, g6TreeDirection, emitChange, emitDataChange_,
width, height, collapseAll, collapsed, expanded, expandAll, changeFinish, targetNode, inputSearching, setInputSearching, width, height, collapseAll, collapsed, expanded, expandAll, changeFinish, targetNode, inputSearching, setInputSearching,
onCollapse, handleNodeEnter, handelNodeClick, token, dispatch, actions onCollapse, handleNodeEnter, handelNodeClick, token, dispatch, actions, thingStatus
} = props; } = props;
const [isGetLinkStateDone, { setTrue, setFalse }] = useBoolean(false); const [isGetLinkStateDone, { setTrue, setFalse }] = useBoolean(false);
const [devicesLinkState, setDevicesLinkState] = useSafeState(null); const [devicesLinkState, setDevicesLinkState] = useSafeState(null);
@ -242,23 +242,23 @@ export default function ({ ...props }) {
defaultTreeNodesCheckedKeys.push(a.id); defaultTreeNodesCheckedKeys.push(a.id);
} else if (deviceInfo[deviceIds[i]].type == 's.d') { } else if (deviceInfo[deviceIds[i]].type == 's.d') {
let linkState = null; let linkState = null;
if (devicesLinkState) {
linkState = devicesLinkState.find((dls) => dls.deviceId == deviceIds[i]);
if (linkState) {
linkState = linkState.status;
}
}
let linkStateMsg = ''; let linkStateMsg = '';
let LinlStateColor = '#666666'; let LinlStateColor = '#666666';
if ((linkState != null || linkState != undefined)) { let thingStatusFind = thingStatus?.find(d => d.deviceId == deviceIds[i])
if (linkState == 1) { if (thingStatusFind) {
// linkStateMsg = "(在线)" linkState = thingStatusFind?.status
} else if (linkState == 0) { if (thingStatusFind?.status == 0) {
linkStateMsg = '(离线)'; LinlStateColor = 'red'
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 = { const a = {
...deviceInfo[deviceIds[i]], ...deviceInfo[deviceIds[i]],
id: 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 }) { function DeviceMonitor ({ ...props }) {
const { const {
dispatch, actions, user, clientWidth, clientHeight, loading, dispatch, actions, user, clientWidth, clientHeight, loading,
myStructList, deviceMetasWithFollow, devices, dimensions, deviceListAlarms, factorStations, myStructList, deviceMetasWithFollow, devices, dimensions, deviceListAlarms, factorStations, thingStatus,
} = props; } = props;
const { analysis } = actions const { analysis } = actions
@ -101,15 +101,15 @@ function DeviceMonitor ({ ...props }) {
<div className="device-monitor"> <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> </div>
@ -117,12 +117,12 @@ function DeviceMonitor ({ ...props }) {
return ( return (
<Spin spinning={false}> <Spin spinning={loading}>
<ProCard title={renderTitle()} extra={renderExtra()} headerBordered> <ProCard title={renderTitle()} extra={renderExtra()} headerBordered>
{ {
extraType === 'tree' extraType === 'tree'
? deviceMetasWithFollow?.devices?.length > 0 ? deviceMetasWithFollow?.devices?.length > 0
&& devices.instances && devices.instances && thingStatus.length > 0
? ( ? (
<DeviceTree <DeviceTree
deviceMetasWithFollow={deviceMetasWithFollow} deviceMetasWithFollow={deviceMetasWithFollow}
@ -134,7 +134,7 @@ function DeviceMonitor ({ ...props }) {
clientHeight={clientHeight} clientHeight={clientHeight}
clientWidth={clientWidth} clientWidth={clientWidth}
token={token} token={token}
thingStatus={thingStatus}
/> />
) : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> ) : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
: ( : (
@ -148,10 +148,10 @@ function DeviceMonitor ({ ...props }) {
function mapStateToProps (state) { function mapStateToProps (state) {
const { const {
auth, global, myStructList, deviceMeta, deviceList, dimensionsList, deviceListAlarms, factorStations, auth, global, myStructList, deviceMeta, deviceList, dimensionsList, deviceListAlarms, factorStations, thingStatus
} = state; } = state;
return { return {
loading: myStructList?.isRequesting || deviceMeta?.isRequesting || deviceList?.isRequesting || dimensionsList?.isRequesting, loading: deviceMeta?.isRequesting || deviceList?.isRequesting || dimensionsList?.isRequesting || thingStatus?.isRequesting,
user: auth?.user, user: auth?.user,
actions: global?.actions, actions: global?.actions,
clientWidth: global?.clientWidth, clientWidth: global?.clientWidth,
@ -162,6 +162,7 @@ function mapStateToProps (state) {
dimensions: dimensionsList?.data || { dimensions: [], total: 0 }, dimensions: dimensionsList?.data || { dimensions: [], total: 0 },
deviceListAlarms: deviceListAlarms?.data || [], deviceListAlarms: deviceListAlarms?.data || [],
factorStations: factorStations?.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 WORKDIR /var/app
@ -14,7 +14,7 @@ RUN npm run build
RUN rm -rf client/src RUN rm -rf client/src
RUN rm -rf node_modules RUN rm -rf node_modules
RUN npm install --production --registry https://nexus.ngaiot.com/repository/fs-npm/ 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 COPY --from=builder --chown=node /var/app /home/node/app
WORKDIR /home/node/app WORKDIR /home/node/app
CMD ["node", "server.js"] CMD ["node", "server.js"]
Loading…
Cancel
Save