diff --git a/src/api/account/center.ts b/src/api/account/center.ts index 67414ce9..2a6eacc7 100644 --- a/src/api/account/center.ts +++ b/src/api/account/center.ts @@ -9,7 +9,7 @@ export const updateMeInfo_api = (data:object) => server.put(`/user/detail`,data) // 修改登录用户密码 export const updateMepsd_api = (data:object) => server.put(`/user/passwd`,data); // 第三方账号解绑 -export const unBind_api = (appId: string) => server.post(`/application/sso/${appId}/unbind/me`, []); +export const unBind_api = (appId: string) => server.request.post(`/application/sso/${appId}/unbind/me`); /** * 校验字段合法性 * @param type 类型 diff --git a/src/components/Layout/BasicLayoutPage.vue b/src/components/Layout/BasicLayoutPage.vue index 97d0ae30..0121209e 100644 --- a/src/components/Layout/BasicLayoutPage.vue +++ b/src/components/Layout/BasicLayoutPage.vue @@ -136,6 +136,7 @@ const breadcrumb = computed(() => watchEffect(() => { if (router.currentRoute) { const paths = router.currentRoute.value.name as string + console.log(paths) if (paths) { const _metas = findRouteMeta(paths) state.selectedKeys = _metas.map(item => item.path) diff --git a/src/components/Layout/components/Notice.vue b/src/components/Layout/components/Notice.vue index 51d9a5df..25570448 100644 --- a/src/components/Layout/components/Notice.vue +++ b/src/components/Layout/components/Notice.vue @@ -25,7 +25,7 @@ import { getListByUnRead_api } from '@/api/account/notificationRecord'; import NoticeInfo from './NoticeInfo.vue'; import { getWebSocket } from '@/utils/websocket'; -import { notification, Button } from 'ant-design-vue'; +import { notification, Button } from 'jetlinks-ui-components'; import { changeStatus_api } from '@/api/account/notificationRecord'; import { useUserInfo } from '@/store/userInfo'; diff --git a/src/components/Layout/components/UserInfo.vue b/src/components/Layout/components/UserInfo.vue index 68bfc63e..38cc3e16 100644 --- a/src/components/Layout/components/UserInfo.vue +++ b/src/components/Layout/components/UserInfo.vue @@ -28,6 +28,7 @@ diff --git a/src/router/menu.ts b/src/router/menu.ts index 0224dc75..48fe3918 100644 --- a/src/router/menu.ts +++ b/src/router/menu.ts @@ -1,4 +1,4 @@ -export const LoginPath = '/login' +export const LoginPath = '/user/login' export const InitHomePath = '/init-home' export const AccountCenterBindPath = '/account/center/bind' export const InitLicense = '/init-license' diff --git a/src/store/menu.ts b/src/store/menu.ts index 16f65155..509f182a 100644 --- a/src/store/menu.ts +++ b/src/store/menu.ts @@ -100,7 +100,6 @@ export const useMenuStore = defineStore({ // 是否存在通知订阅 const hasMessageSub = resp.result.some((item: { code: string }) => item.code === MESSAGE_SUBSCRIBE_MENU_CODE) - console.log('hasMessageSub', hasMessageSub) if (!hasMessageSub) { AccountMenu.children = AccountMenu.children.filter((item: { code: string }) => ![NotificationSubscriptionCode, NotificationRecordCode].includes(item.code) ) } diff --git a/src/store/product.ts b/src/store/product.ts index b3216727..7122c8cb 100644 --- a/src/store/product.ts +++ b/src/store/product.ts @@ -25,7 +25,7 @@ export const useProductStore = defineStore({ } }, async refresh(id: string) { - this.getDetail(id) + await this.getDetail(id) const res = await getDeviceNumber(encodeQuery({ terms: { productId: id } })) if (res.status === 200) { this.current.count = res.result diff --git a/src/utils/menu.ts b/src/utils/menu.ts index 2a08cba4..0fc4c8e7 100644 --- a/src/utils/menu.ts +++ b/src/utils/menu.ts @@ -212,6 +212,7 @@ export const findCodeRoute = (asyncRouterMap: any[]) => { function getDetail(code: string, url: string) { const detail = findDetailRouteItem(code, url) if (!detail) return + routeMeta[(detail as MenuItem).code] = { path: detail.url, title: detail.name, @@ -243,11 +244,19 @@ export const findCodeRoute = (asyncRouterMap: any[]) => { getDetail(_code, url) }) } - - getDetail(route.code, route.url) - + const _code = route.appId ? `/${route.appId}${route.url}` : route.code + if (!route.appId) { + getDetail(_code, route.url) + } else { + routeMeta[_code] = { + path: `/${route.appId}${route.url}`, + title: route.name, + parentName: code, + buttons: [] + } + } if (route.children) { - findChildren(route.children, route.code) + findChildren(route.children, _code) } }) } @@ -262,9 +271,11 @@ export function filterAsyncRouter(asyncRouterMap: any, parentCode = '', level = const menusData: any[] = [] const silderMenus: any[] = [] _asyncRouterMap.forEach((route: any) => { + const hasAppId = route.appId const _route: any = { - path: `${route.url}`, - name: route.code, + path: hasAppId ? `/${route.appId}${route.url}` : `${route.url}`, + name: hasAppId ? `/${route.appId}${route.url}` : route.code, + url: hasAppId ? `/${route.appId}${route.url}` : route.url, meta: { icon: route.icon, title: route.name, @@ -274,7 +285,6 @@ export function filterAsyncRouter(asyncRouterMap: any, parentCode = '', level = } const silder = { ..._route } - // 查看是否有隐藏子路由 route.children = findChildrenRoute(route.code, route.url, route.children) route.children = findDetailRoutes(route.children) @@ -287,7 +297,7 @@ export function filterAsyncRouter(asyncRouterMap: any, parentCode = '', level = if (showChildren && _route.children.length) { _route.component = level === 1 ? BasicLayoutPage : BlankLayoutPage - _route.redirect = route.children[0].url + _route.redirect = _route.children[0].url } else { const myComponent = resolveComponent(route.code) // _route.component = myComponent ? myComponent : BlankLayoutPage; @@ -300,7 +310,11 @@ export function filterAsyncRouter(asyncRouterMap: any, parentCode = '', level = } } } else { - _route.component = route.component || resolveComponent(route.code) || BlankLayoutPage + if (hasAppId) { + _route.component = route.component || resolveComponent('iframe') + } else { + _route.component = route.component || resolveComponent(route.code) || BlankLayoutPage + } } menusData.push(_route) silderMenus.push(silder) diff --git a/src/views/device/Product/Detail/DeviceAccess/index.vue b/src/views/device/Product/Detail/DeviceAccess/index.vue index b7aa4c1c..bd765654 100644 --- a/src/views/device/Product/Detail/DeviceAccess/index.vue +++ b/src/views/device/Product/Detail/DeviceAccess/index.vue @@ -288,10 +288,10 @@ model="CARD" :defaultParams="{ ...temp, - sorts: [ + sorts: productStore.current?.accessId ? [ { name: 'id', value: productStore.current?.accessId }, { name: 'createTime', order: 'desc' }, - ], + ] : [{ name: 'createTime', order: 'desc' }], }" :params="queryParams" @cancelSelect="cancelSelect" @@ -412,7 +412,6 @@ import { modify, } from '@/api/device/product'; import { isNoCommunity } from '@/utils/utils'; -const productStore = useProductStore(); import Driver from 'driver.js'; import 'driver.js/dist/driver.min.css'; import { marked } from 'marked'; @@ -420,7 +419,9 @@ import type { TableColumnType } from 'ant-design-vue'; import { useMenuStore } from '@/store/menu'; import _ from 'lodash'; import { accessConfigTypeFilter } from '@/utils/setting'; +import DeviceApi from '@/api/media/device'; +const productStore = useProductStore(); const tableRef = ref(); const formRef = ref(); const menuStore = useMenuStore(); @@ -844,7 +845,9 @@ const submitData = async () => { obj.metadata = JSON.stringify(mdata); } } - // 保存或者更新设备接入 + // DeviceApi.getConfiguration(current.value?.protocol, current.value?.transport) + // visible.value = false; + // 保存或者更新设备接入 const resp: any = obj.id ? await updateDevice(obj) : await saveDevice(obj); diff --git a/src/views/device/components/Metadata/Import/index.vue b/src/views/device/components/Metadata/Import/index.vue index abdb4010..7bda1309 100644 --- a/src/views/device/components/Metadata/Import/index.vue +++ b/src/views/device/components/Metadata/Import/index.vue @@ -227,7 +227,7 @@ const handleImport = async () => { if (props?.type === 'device') { await instanceStore.refresh(id as string) } else { - await productStore.refresh(id as string) + await productStore.getDetail(id as string) } metadataStore.set('importMetadata', true) // Store.set(SystemConst.GET_METADATA, true) @@ -257,22 +257,12 @@ const handleImport = async () => { } loading.value = false if (resp.success) { - if (props?.type === 'device') { - // const detail = instanceStore.current - // detail.metadata = JSON.stringify(paramsDevice) - // instanceStore.setCurrent(detail) - message.success('导入成功') - } else { - // const detail = productStore.current - // detail.metadata = params.metadata - // productStore.setCurrent(detail) - message.success('导入成功') - } + message.success('导入成功') } if (props?.type === 'device') { await instanceStore.refresh(id as string) } else { - await productStore.refresh(id as string) + await productStore.getDetail(id as string) } metadataStore.set('importMetadata', true) // Store.set(SystemConst.GET_METADATA, true) diff --git a/src/views/iframe/index.vue b/src/views/iframe/index.vue index e70e948e..f808a3bf 100644 --- a/src/views/iframe/index.vue +++ b/src/views/iframe/index.vue @@ -14,6 +14,7 @@ import { LocalStore } from '@/utils/comm'; import { getAppInfo_api } from '@/api/system/apply'; const iframeUrl = ref(''); +const route = useRoute() const handle = async (appId: string, url: string) => { const res = await getAppInfo_api(appId); @@ -25,7 +26,7 @@ const handle = async (appId: string, url: string) => { } if (res.result.provider === 'internal-standalone') { //{baseUrl}/api/application/sso/{appId}/login?redirect={menuUrl} - const urlStandalone = `${res.result.page.baseUrl}/api/application/sso/${appId}/login?redirect=${menuUrl}?layout=false`; + const urlStandalone = `${res.result.page.baseUrl}/#/api/application/sso/${appId}/login?redirect=${menuUrl}&layout=false`; iframeUrl.value = urlStandalone; // console.log(urlStandalone); } else if (res.result.provider === 'internal-integrated') { @@ -41,9 +42,9 @@ const handle = async (appId: string, url: string) => { }; watchEffect(() => { - const params = location.pathname.split('/')?.[1]; - const url = location.pathname.split('/').slice(2).join('/'); - // console.log(params, url); + const params = route.path.split('/')?.[1]; + const url = route.path.split('/').slice(2).join('/'); + console.log(params, url); handle(params, url); }); diff --git a/src/views/init-home/data/baseMenu.ts b/src/views/init-home/data/baseMenu.ts index 7bd9aacf..2f749d08 100644 --- a/src/views/init-home/data/baseMenu.ts +++ b/src/views/init-home/data/baseMenu.ts @@ -22,7 +22,11 @@ export const USER_CENTER_MENU_DATA = { { permission: 'user', action: ['update-self-pwd'] - } + }, + { + permission: 'system_config', + actions: ['query'], + }, ] } ] diff --git a/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue b/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue index 86516c7d..cc5fe7d2 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/actions/FunctionItem.vue @@ -65,12 +65,12 @@ const handleOptions = computed(() => { { label: _item.trueText || true, value: _item.trueValue || true, - id: _item.trueValue || true, + id: String(_item.trueValue || true), }, { label: _item.falseText || false, value: _item.falseValue || false, - id: _item.falseValue || false, + id: String(_item.falseValue || false), }, ]; } diff --git a/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue b/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue index 66e79d5f..167f84c1 100644 --- a/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue +++ b/src/views/rule-engine/Scene/Save/action/Device/actions/WriteProperty.vue @@ -135,13 +135,15 @@ const handleOptions = computed(() => { return [ { label: _item.trueText || true, + name: _item.trueText || true, value: _item.trueValue || true, - id: _item.trueValue || true, + id: String(_item.trueValue || true), }, { label: _item.falseText || false, + name: _item.falseText || false, value: _item.falseValue || false, - id: _item.falseValue || false, + id: String(_item.falseValue || false), }, ]; } @@ -149,6 +151,7 @@ const handleOptions = computed(() => { return _item?.elements.map((i: any) => { return { label: i.text, + name: i.text, value: i.value, id: i.value, }; @@ -168,7 +171,7 @@ const onChange = () => { }); }; -const onValueChange = (val: any) => { +const onValueChange = (val: any, label: string) => { const obj = { [`${propertyModelRef.properties}`]: { value: propertyModelRef?.propertiesValue, @@ -176,7 +179,7 @@ const onValueChange = (val: any) => { }, }; emit('update:value', obj); - emit('change', val?.name || val) + emit('change', label || val) }; watch( diff --git a/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue b/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue index 53433a86..c0248b84 100644 --- a/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue +++ b/src/views/rule-engine/Scene/Save/action/ListItem/FilterCondition.vue @@ -83,7 +83,7 @@ import ParamsDropdown, { DoubleParamsDropdown } from '../../components/ParamsDro import { inject } from 'vue' import { useSceneStore } from 'store/scene' import { storeToRefs } from 'pinia'; -import {cloneDeep, flattenDeep, isArray, set} from 'lodash-es' +import { cloneDeep, flattenDeep, isArray, isObject, set } from 'lodash-es' import { Form } from 'jetlinks-ui-components' import {treeFilter} from "@/utils/comm"; import { timeTypeKeys } from '@/views/rule-engine/Scene/Save/components/Terms/util' @@ -177,12 +177,21 @@ const handOptionByColumn = (option: any) => { termTypeOptions.value = option.termTypes || [] tabsOptions.value[0].component = option.type columnType.value = option.type - const _options = isArray(option.options) ? option.options : [] + const _options = option.options if (option.type === 'boolean') { - valueOptions.value = _options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [ - { label: '是', value: true }, - { label: '否', value: false }, - ] + // 处理_options为Object时 + if (isObject(_options)) { + const bool = (_options as any)?.bool + valueOptions.value = [ + { label: bool.falseText, name: bool.falseText, value: bool.falseValue, id: bool.falseValue }, + { label: bool.trueText, name: bool.trueText, value: bool.trueValue, id: bool.trueValue }, + ] + } else { + valueOptions.value = _options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [ + { label: '是', name: '是', value: 'true', id: 'true' }, + { label: '否', name: '否', value: 'false', id: 'false' }, + ] + } } else if(option.type === 'enum') { valueOptions.value = _options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [] } else{ diff --git a/src/views/rule-engine/Scene/Save/components/DropdownButton/Menus.vue b/src/views/rule-engine/Scene/Save/components/DropdownButton/Menus.vue index caf8b729..a4e76bda 100644 --- a/src/views/rule-engine/Scene/Save/components/DropdownButton/Menus.vue +++ b/src/views/rule-engine/Scene/Save/components/DropdownButton/Menus.vue @@ -11,7 +11,7 @@ diff --git a/src/views/rule-engine/Scene/Save/components/ParamsDropdown/index.vue b/src/views/rule-engine/Scene/Save/components/ParamsDropdown/index.vue index 385bb201..954a3db3 100644 --- a/src/views/rule-engine/Scene/Save/components/ParamsDropdown/index.vue +++ b/src/views/rule-engine/Scene/Save/components/ParamsDropdown/index.vue @@ -38,6 +38,7 @@ @@ -162,6 +163,7 @@ watchEffect(() => { const option = getOption(_options, props.value as string, props.valueName) // 回显label值 myValue.value = props.value mySource.value = props.source + console.log(_options, props.value, props.valueName, option) if (option) { label.value = option[props.labelName] || option.name treeOpenKeys.value = openKeysByTree(_options, props.value, props.valueName) diff --git a/src/views/rule-engine/Scene/Save/components/Terms/ParamsItem.vue b/src/views/rule-engine/Scene/Save/components/Terms/ParamsItem.vue index c84abc93..31037e00 100644 --- a/src/views/rule-engine/Scene/Save/components/Terms/ParamsItem.vue +++ b/src/views/rule-engine/Scene/Save/components/Terms/ParamsItem.vue @@ -81,7 +81,7 @@ import { ContextKey, arrayParamsKey, timeTypeKeys } from './util' import { useSceneStore } from 'store/scene' import { storeToRefs } from 'pinia'; import { Form } from 'jetlinks-ui-components' -import {isArray, pick} from 'lodash-es' +import { isArray, isObject, pick } from 'lodash-es' const sceneStore = useSceneStore() const { data: formModel } = storeToRefs(sceneStore) @@ -178,10 +178,20 @@ const handOptionByColumn = (option: any) => { } if (option.dataType === 'boolean') { - valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [ - { label: '是', value: true, id: true }, - { label: '否', value: false, id: false }, - ] + // 处理_options为Object时 + const _options = option.options || option.others + if (isObject(_options)) { + const bool = (_options as any)?.bool + valueOptions.value = [ + { label: bool.falseText, value: String(bool.falseValue)}, + { label: bool.trueText, value: String(bool.trueValue)}, + ] + } else { + valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [ + { label: '是', value: 'true' }, + { label: '否', value: 'false' }, + ] + } } else if(option.dataType === 'enum') { valueOptions.value = option.options?.map((item: any) => ({ ...item, label: item.name, value: item.id})) || [] } else{ diff --git a/src/views/system/Apply/Save/components/EditForm.vue b/src/views/system/Apply/Save/components/EditForm.vue index b75ba98a..84cd8aa3 100644 --- a/src/views/system/Apply/Save/components/EditForm.vue +++ b/src/views/system/Apply/Save/components/EditForm.vue @@ -1439,7 +1439,7 @@