diff --git a/eslint.config.js b/eslint.config.js index 33bb0b2..0ed943d 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -15,6 +15,7 @@ export default lintConfig({ 'ts/no-use-before-define': 0, 'no-alert': 0, 'unused-imports/no-unused-vars': 0, + 'unused-imports/no-unused-imports': 0, }, globals: { process: 'readonly' }, extends: [ diff --git a/src/apis/solution.ts b/src/apis/solution.ts index 2b01542..451780e 100644 --- a/src/apis/solution.ts +++ b/src/apis/solution.ts @@ -1,9 +1,9 @@ import http from 'libs/http' -export const getSolsList = (params: System.Page = { pageNum: 1, pageSize: 999 }): Promise> => http.get(`/sols/list`, { params }) +export const getSolsList = (params: System.Page = { pageNum: 1, pageSize: 999 }): Promise> => http.post(`/solutions/list`, params) -export const saveSols = (params: { name: string }): Promise => http.post(`/sols`, params) +export const saveSols = (params: { name: string }): Promise => http.post(`/solutions`, params) -export const editSols = (params: { id: number, name: string }): Promise => http.put(`/sols`, params) +export const editSols = (params: { id: number, name: string }): Promise => http.put(`/solutions`, params) -export const delSols = (ids: string): Promise => http.delete(`/sols/${ids}`) +export const delSols = (ids: string): Promise => http.delete(`/solutions/${ids}`) diff --git a/src/apis/system.ts b/src/apis/system.ts index 24dc490..450283f 100644 --- a/src/apis/system.ts +++ b/src/apis/system.ts @@ -6,7 +6,7 @@ export const getStatus = (): Promise => http.get('/sys/devi export const getPoint = (motor: string): Promise => http.get(`/motor/position/${motor}`) export const requireOutTray = (): Promise<{ moduleCode: string }[]> => http.get('/self-test/require-out-tray') export const setIgnoreItem = (params: { ignoreSelfTestType: string, ignore: boolean }): Promise => http.post('/self-test/set-ignore-item', params) -export const getTime = (): Promise => http.get('/sys/datetime') -export const setTime = (params: { datetime?: string }): Promise => http.post('/sys/datetime', params) +export const getTime = (): Promise<{ epochMilli: number }> => http.get('/sys/get-datetime') +export const setTime = (params: { epochMilli?: number }): Promise => http.post('/sys/set-datetime', params) export const configList = (): Promise => http.get('/sys/config-list') export const updateConfig = (params: System.SystemConfig): Promise => http.post('/sys/update-config', params) diff --git a/src/apis/user.ts b/src/apis/user.ts index 665bf9d..039ab65 100644 --- a/src/apis/user.ts +++ b/src/apis/user.ts @@ -3,5 +3,5 @@ import http from 'libs/http' export const current = (): Promise => http.get('/auth/current') export const addUser = (params: User.User): Promise => http.post('/user', params) export const updateUser = (params: User.User): Promise => http.put('/user', params) -export const userList = (params: System.Page): Promise> => http.get('/user/list', { params }) +export const userList = (params: System.Page): Promise> => http.post('/user/list', params) export const delUser = (params: string): Promise => http.delete(`/user/${params}`) diff --git a/src/components/common/FTImage/index.vue b/src/components/common/FTImage/index.vue new file mode 100644 index 0000000..3e57868 --- /dev/null +++ b/src/components/common/FTImage/index.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/src/components/common/FTTable/index.vue b/src/components/common/FTTable/index.vue index bc4253e..f4d6dbb 100644 --- a/src/components/common/FTTable/index.vue +++ b/src/components/common/FTTable/index.vue @@ -173,7 +173,7 @@ defineExpose({
- +
diff --git a/src/components/container/Item/index.vue b/src/components/container/Item/index.vue index 74df46b..168e8fd 100644 --- a/src/components/container/Item/index.vue +++ b/src/components/container/Item/index.vue @@ -20,9 +20,6 @@ const props = defineProps({ const emits = defineEmits<{ (e: 'ok'): void }>() - -const router = useRouter() -const visible = ref(false) const solutionStore = useSolutionStore() const solutionId = ref() const selectedSolutionItem = ref() @@ -68,38 +65,20 @@ const saveContainer = async () => { } const params: Container.ContainerItem = { id: solutionInfo.value.id, - type: 0, - solutionId: solutionInfo.value.solutionId, - pumpId: solutionInfo.value.pumpId, - capacityTotal: solutionInfo.value.capacityTotal, capacityUsed: solutionInfo.value.capacityUsed, - filled: solutionInfo.value.filled, } await updateContainer(params) FtMessage.success('保存成功') emits('ok') } -const onSolutionChange = (value: number) => { - if (value) { - solutionId.value = value - solutionInfo.value.solutionId = value - selectedSolutionItem.value = solutionStore.solutionList.filter(item => item.id === value)[0] - } -} -const onClose = () => { - solutionId.value = null - visible.value = false -} -const onSubmitSolution = () => { - if (!solutionStore.solutionList.length) { - // 跳转至配置酸液页面 - router.push('/solution') - return +const onSolutionChange = async () => { + const params: Container.ContainerItem = { + id: solutionInfo.value.id, + solutionId: solutionInfo.value.solutionId, + } - solutionInfo.value.solutionName = selectedSolutionItem.value.name - solutionInfo.value.solutionId = selectedSolutionItem.value.id - saveContainer() - onClose() + await updateContainer(params) + FtMessage.success('保存成功') } @@ -107,10 +86,9 @@ const onSubmitSolution = () => {
-
- {{ solutionInfo.solutionName }} - 选择酸液 -
+ + +
@@ -134,20 +112,6 @@ const onSubmitSolution = () => {
- -
- - - -
-
- - - -
-
@@ -206,20 +170,12 @@ const onSubmitSolution = () => { } .solution-select{ display:flex; - width: 120px; + width: 100%; height: 25px; - text-align: center; - margin-left: 5px; + justify-content: center; align-items: center; border-radius: 5px; } -.solution-name{ - width: 100px; - height: 25px; - display: flex; - align-items: center; - justify-content: center; -} .add-icon{ margin-right: -4px; } diff --git a/src/components/craft/AddCraft/index.vue b/src/components/craft/AddCraft/index.vue index 0e577e4..dc2f8f8 100644 --- a/src/components/craft/AddCraft/index.vue +++ b/src/components/craft/AddCraft/index.vue @@ -149,35 +149,46 @@ const cancel = () => { } const stepMap = { - preHeat: { name: '预热', method: 'preHeat', params: { type: 'heat', temperature: undefined, description: undefined } }, + preHeat: { name: '移至滴定位', method: 'preHeat', params: { type: 'heat', temperature: undefined, description: undefined } }, addThin: { - name: '加稀硝酸', + name: '选择溶液', method: 'addThin', params: { volume: undefined, description: undefined }, }, addThick: { - name: '加浓硝酸', + name: '移至加热位', method: 'addThick', params: { height: undefined, volume: undefined, description: undefined }, }, heat: { - name: '加热', + name: '开始滴定', method: 'heat', params: { temperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined }, }, // reduceLiquid: { name: '抽液', method: 'reduceLiquid', params: { height: undefined, description: undefined } }, clean: { - name: '清洗', + name: '加入磁子', method: 'clean', params: { cycle: undefined, height: undefined, volume: 2, description: undefined }, }, dry: { - name: '烘干', + name: '开始搅拌', method: 'dry', params: { temperature: undefined, time: undefined, description: undefined, minutes: undefined, seconds: undefined }, }, anneal: { - name: '退火', + name: '等待', + method: 'anneal', + params: { + temperature: undefined, + time: undefined, + description: undefined, + minutes: undefined, + seconds: undefined, + }, + }, + heater: { + name: '开始加热', method: 'anneal', params: { temperature: undefined, @@ -202,6 +213,15 @@ const addStep = (data: any) => { + + + + + + + + +
@@ -320,7 +340,7 @@ const addStep = (data: any) => { diff --git a/src/components/system/EditDate/index.vue b/src/components/system/EditDate/index.vue index c13171e..36e96a1 100644 --- a/src/components/system/EditDate/index.vue +++ b/src/components/system/EditDate/index.vue @@ -1,18 +1,29 @@ -
+
{{ currentTime }}
@@ -306,7 +305,7 @@ const containerStatus = computed(() => { - + diff --git a/src/libs/socket.ts b/src/libs/socket.ts index b03ef1e..6a9f4e1 100644 --- a/src/libs/socket.ts +++ b/src/libs/socket.ts @@ -22,6 +22,7 @@ interface socket { reconnect_timer: any reconnect_interval: number receiveMessageCallBackObj: { [key: string]: any[] } + receiveMessageCallBackTimestampObj: { [key: string]: number } initCallBacks: any // eslint-disable-next-line ts/no-unsafe-function-type receiveMessage: Function @@ -66,6 +67,7 @@ export const socket: socket = { reconnect_interval: 1000, receiveMessageCallBackObj: {}, + receiveMessageCallBackTimestampObj: {}, initCallBacks: [], // eslint-disable-next-line ts/no-unsafe-function-type registerInitCallback: (fn: Function, ...args: any) => { @@ -80,9 +82,13 @@ export const socket: socket = { const message = JSON.parse(e.data) const callbacks = socket.receiveMessageCallBackObj[message.type] if (callbacks) { - callbacks.forEach((fn) => { - fn(message.data) - }) + const timestamp = socket.receiveMessageCallBackTimestampObj[message.type] || 0 + if (message.timestamp > timestamp) { + socket.receiveMessageCallBackTimestampObj[message.type] = message.timestamp + callbacks.forEach((fn) => { + fn(message.data) + }) + } } else { // console.error('请注册当前类型的回调函数', message) diff --git a/src/libs/utils.ts b/src/libs/utils.ts index 28ec598..07b24fd 100644 --- a/src/libs/utils.ts +++ b/src/libs/utils.ts @@ -1,7 +1,4 @@ export const cmdNameMap = { - door_open: '开门', - door_close: '关门', - door_stop: '停止开关门', liquid_motor_move_to: '加液电机绝对移动', liquid_motor_origin: '加液电机回原点', liquid_motor_stop: '加液电机停止', diff --git a/src/router/routes.ts b/src/router/routes.ts index 7033582..bb14eaa 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -73,7 +73,7 @@ const authRoutes: RouteRecordRaw[] = [ name: 'solution', component: () => import('views/solution/index.vue'), meta: { - isDefault: false, + isDefault: true, title: '溶液管理', icon: n_liquid_config, activeIcon: s_liquid_config, diff --git a/src/stores/systemStore.ts b/src/stores/systemStore.ts index a893dd9..12a97c8 100644 --- a/src/stores/systemStore.ts +++ b/src/stores/systemStore.ts @@ -11,10 +11,6 @@ export const useSystemStore = defineStore('system', { selfTest: true, emergencyStop: false, currentUser: { - id: 1, - username: 'admin', - nickname: '管理员', - fixedUser: 'ENABLE', }, currentTasks: null, doorModule: { @@ -242,9 +238,6 @@ export const useSystemStore = defineStore('system', { }, ], }, - systemUser: { - username: '111', - }, errCraftList: [], loginForm: { username: import.meta.env.FT_NODE_ENV !== 'prod' ? 'admin' : '', @@ -275,9 +268,6 @@ export const useSystemStore = defineStore('system', { updateMenuExpand() { this.menuExpand = !this.menuExpand }, - updateSystemUser(data: System.SystemUser) { - this.systemUser = data - }, pushSystemList(text: any) { this.systemList.push(text) }, @@ -288,5 +278,5 @@ export const useSystemStore = defineStore('system', { }) }, }, - persist: import.meta.env.FT_NODE_ENV === 'prod', + persist: ['prod', 'dev', 'test'].includes(import.meta.env.FT_NODE_ENV), }) diff --git a/src/types/container.d.ts b/src/types/container.d.ts index 3119a97..1b64ef7 100644 --- a/src/types/container.d.ts +++ b/src/types/container.d.ts @@ -3,12 +3,12 @@ declare namespace Container { id: number createTime?: string updateTime?: string - type: number - solutionId: number - pumpId: string - capacityTotal: string | number - capacityUsed: string | number - filled: string | number + type?: number + solutionId?: number + pumpId?: string + capacityTotal?: string | number + capacityUsed?: string | number + filled?: string | number solutionName?: string } } diff --git a/src/types/system.d.ts b/src/types/system.d.ts index 6638025..3041565 100644 --- a/src/types/system.d.ts +++ b/src/types/system.d.ts @@ -8,7 +8,6 @@ declare namespace System { isDebug: boolean errorCraft: boolean menuExpand: boolean - systemUser: SystemUser loginForm: LoginForm systemLogList: SystemLog[] currentTime: string @@ -91,9 +90,6 @@ declare namespace System { command: string params: T } - interface SystemUser { - username: string - } interface LoginForm { username: string password: string diff --git a/src/types/user.d.ts b/src/types/user.d.ts index 3b1157c..2200af9 100644 --- a/src/types/user.d.ts +++ b/src/types/user.d.ts @@ -5,7 +5,8 @@ declare namespace User { updateTime?: string username?: string nickname?: string - password?: string | null + password?: string + passwordAgain?: string role?: string deleted?: string fixedUser?: string diff --git a/src/views/container/index.vue b/src/views/container/index.vue index ace80b5..4f8781e 100644 --- a/src/views/container/index.vue +++ b/src/views/container/index.vue @@ -47,7 +47,7 @@ const queryContainerList = () => {