fix: rebuild MES as compilable go-zero+ent backend (renamed bj_power_mes), restore 3 workstation projects from pristine original, align naming; all Go projects go build clean
This commit is contained in:
@@ -1,14 +1,58 @@
|
||||
import React from 'react'
|
||||
import { Layout } from '@douyinfe/semi-ui'
|
||||
import { useLocation, useOutlet } from 'react-router-dom'
|
||||
import React, {useEffect, useState} from 'react'
|
||||
import {Layout} from '@douyinfe/semi-ui'
|
||||
import {useLocation, useOutlet} from 'react-router-dom'
|
||||
import Breadcrumb from '@/layouts/breadcrumb'
|
||||
import Menu from '@/layouts/menu'
|
||||
import {useSystemApi} from '@/api/system'
|
||||
import {useWorkOrderApi} from '@/api/work-order'
|
||||
import RecoveryDialog from '@/components/recovery-dialog'
|
||||
import useGlobalStore from '@/stores'
|
||||
import './index.scss'
|
||||
import { CSSTransition, SwitchTransition } from 'react-transition-group'
|
||||
|
||||
export default () => {
|
||||
const location = useLocation()
|
||||
const outlet = useOutlet()
|
||||
const api = useSystemApi()
|
||||
const woApi = useWorkOrderApi()
|
||||
const [recoveryPending, setRecoveryPending] = useState(false)
|
||||
const [recoveryVisible, setRecoveryVisible] = useState(false)
|
||||
const { connected, showStopGuide } = useGlobalStore(state => state)
|
||||
|
||||
const checkRecovery = () => {
|
||||
api.getStatus()
|
||||
.then(status => {
|
||||
if (status.recoveryPending && !recoveryVisible) {
|
||||
setRecoveryPending(true)
|
||||
setRecoveryVisible(true)
|
||||
}
|
||||
if (status.stopPending) {
|
||||
woApi.queryWorkOrders({ page: 1, limit: 100, statuses: ['CANCELLING'] })
|
||||
.then(res => {
|
||||
if (res.data && res.data.length > 0) {
|
||||
showStopGuide({ orderId: res.data[0].id, phase: 'cancelling' })
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
checkRecovery()
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
if (connected) {
|
||||
checkRecovery()
|
||||
}
|
||||
}, [connected])
|
||||
|
||||
const handleRecoveryClose = () => {
|
||||
setRecoveryVisible(false)
|
||||
setRecoveryPending(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Layout.Sider style={{ backgroundColor: 'var(--semi-color-bg-1)' }}>
|
||||
@@ -21,18 +65,15 @@ export default () => {
|
||||
<Breadcrumb />
|
||||
</Layout.Header>
|
||||
<Layout.Content>
|
||||
{/*<SwitchTransition mode="out-in">*/}
|
||||
{/* <CSSTransition*/}
|
||||
{/* key={location.key}*/}
|
||||
{/* in={true}*/}
|
||||
{/* timeout={300}*/}
|
||||
{/* classNames="fade">*/}
|
||||
{outlet}
|
||||
{/*</CSSTransition>*/}
|
||||
{/*</SwitchTransition>*/}
|
||||
{outlet}
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
</Layout.Content>
|
||||
|
||||
<RecoveryDialog
|
||||
visible={recoveryVisible}
|
||||
onClose={handleRecoveryClose}
|
||||
/>
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user