diff --git a/dist.tar.gz b/dist.tar.gz index 6f65ee4c..61915564 100644 Binary files a/dist.tar.gz and b/dist.tar.gz differ diff --git a/eslint.config.js b/eslint.config.js index 6ea220f1..4e131582 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -39,5 +39,36 @@ export default [ "vue/multi-word-component-names": "off", }, }, + { + files: ["src/views/order/orderManagement/**/*.{ts,vue}"], + languageOptions: { + globals: { + window: "readonly", + document: "readonly", + navigator: "readonly", + URL: "readonly", + Blob: "readonly", + File: "readonly", + FileReader: "readonly", + Event: "readonly", + HTMLElement: "readonly", + HTMLInputElement: "readonly", + MouseEvent: "readonly", + WheelEvent: "readonly", + setTimeout: "readonly", + }, + }, + rules: { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-unsafe-function-type": "off", + "vue/attributes-order": "off", + "vue/attribute-hyphenation": "off", + "vue/no-template-shadow": "off", + "vue/no-deprecated-v-on-native-modifier": "off", + "no-empty": "off", + "no-undef": "off", + }, + }, eslintConfigPrettier, ]; diff --git a/src/api/index/index.ts b/src/api/index/index.ts index 8d28d997..a5930453 100644 --- a/src/api/index/index.ts +++ b/src/api/index/index.ts @@ -95,6 +95,21 @@ export function getMessageDetail(data:any){ } as any) } +/** 生成 IM 单点登录一次性 code(有效期 5 分钟) */ +export function loginToIm(data?: Record) { + return request({ + url: '/system', + method: 'post', + params: { + method: 'index.loginToIm', + v: '1.0', + timestamp: new Date().getTime() + }, + data: data ?? {}, + isSystemApi: true + } as any) +} + export function getI18nMessage(data:any){ return request({ url: '/system', diff --git a/src/components/ScanBox/index.vue b/src/components/ScanBox/index.vue index aa32345d..aeaa48e8 100644 --- a/src/components/ScanBox/index.vue +++ b/src/components/ScanBox/index.vue @@ -794,11 +794,16 @@ function filterNode(value: string, data: any) { return data.label && data.label.toLowerCase().includes(value.toLowerCase()) } -function handleReset() { +/** 仅重置内部 UI 状态,不向外 emit(供 defineExpose 与父组件二次调用,避免与 @reset 形成递归) */ +function applyResetState() { initCustomConditions(props.availableFields, true) activeCondition.value = null presetSearchText.value = '' filterPresetTree('') +} + +function handleReset() { + applyResetState() emit('reset') } @@ -926,7 +931,7 @@ function buildConditionsObject() { } function reset() { - handleReset() + applyResetState() } function clear() { diff --git a/src/layout/component/AiChat/index.vue b/src/layout/component/AiChat/index.vue index f1a2fba5..2408b62c 100644 --- a/src/layout/component/AiChat/index.vue +++ b/src/layout/component/AiChat/index.vue @@ -109,12 +109,14 @@ import { ref, nextTick, onMounted, watch } from 'vue' import { useAiStore, AI_IDENTITIES } from '@/stores/modules/ai' import { Plus, Clock, Close, UserFilled, Service, Position, ChatDotRound, Delete, ArrowDown } from '@element-plus/icons-vue' import type { ElScrollbar } from 'element-plus' +import { loginToIm } from '@/api/index' import dayjs from 'dayjs' const aiStore = useAiStore() const inputMessage = ref('') const scrollbarRef = ref>() const showHistory = ref(false) +const IM_LOGIN_URL = 'http://192.168.11.56:9096/' const getIconComponent = (iconName: string) => { const icons: Record = { Service } @@ -183,6 +185,18 @@ const sendMessage = () => { }, 1000) } +const openImPage = async () => { + try { + const res = await loginToIm() + const imCode = res?.data?.code + if (!imCode) return + const openUrl = `${IM_LOGIN_URL}?token=${encodeURIComponent(imCode)}` + window.open(openUrl, '_blank') + } catch (error) { + console.error('Failed to login to IM:', error) + } +} + watch(() => aiStore.messages.length, () => { if (!showHistory.value) { scrollToBottom() @@ -191,7 +205,19 @@ watch(() => aiStore.messages.length, () => { onMounted(() => { scrollToBottom() + if (aiStore.isVisible) { + openImPage() + } }) + +watch( + () => aiStore.isVisible, + isVisible => { + if (isVisible) { + openImPage() + } + } +)