Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev
This commit is contained in:
commit
f2b1b6250e
|
@ -80,6 +80,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { ActionsType } from '@/components/Table/index';
|
import type { ActionsType } from '@/components/Table/index';
|
||||||
import { PropType } from 'vue';
|
import { PropType } from 'vue';
|
||||||
|
import BadgeStatus from '@/components/BadgeStatus/index.vue';
|
||||||
|
|
||||||
type EmitProps = {
|
type EmitProps = {
|
||||||
// (e: 'update:modelValue', data: Record<string, any>): void;
|
// (e: 'update:modelValue', data: Record<string, any>): void;
|
||||||
|
|
|
@ -88,6 +88,17 @@ const TypeMap = new Map([
|
||||||
['edge-child-device', 'edge'],
|
['edge-child-device', 'edge'],
|
||||||
['network', 'network'],
|
['network', 'network'],
|
||||||
]);
|
]);
|
||||||
|
// DataMap后期优化
|
||||||
|
const DataMap = new Map();
|
||||||
|
DataMap.set('fixed-media', { type: 'media', title: '视频类设备接入' });
|
||||||
|
DataMap.set('gb28181-2016', { type: 'media', title: '视频类设备接入' });
|
||||||
|
DataMap.set('OneNet', { type: 'cloud', title: '云平台接入' });
|
||||||
|
DataMap.set('Ctwing', { type: 'cloud', title: '云平台接入' });
|
||||||
|
DataMap.set('modbus-tcp', { type: 'channel', title: '通道类设备接入' });
|
||||||
|
DataMap.set('opc-ua', { type: 'channel', title: '通道类设备接入' });
|
||||||
|
DataMap.set('official-edge-gateway', { type: 'edge', title: '官方接入' });
|
||||||
|
DataMap.set('edge-child-device', { type: 'edge', title: '官方接入' });
|
||||||
|
DataMap.set('network', { type: 'network', title: '自定义设备接入' });
|
||||||
|
|
||||||
const getTypeList = (result: Record<string, any>) => {
|
const getTypeList = (result: Record<string, any>) => {
|
||||||
const list = [];
|
const list = [];
|
||||||
|
@ -161,12 +172,14 @@ const queryProviders = async () => {
|
||||||
// dataSource.value = getTypeList(resp.result)[0].list.filter(
|
// dataSource.value = getTypeList(resp.result)[0].list.filter(
|
||||||
// (item) => item.name !== '插件设备接入',
|
// (item) => item.name !== '插件设备接入',
|
||||||
// );
|
// );
|
||||||
if (route.query.save) {
|
|
||||||
// 视频中心-设备快速添加产品, 添加接入网关
|
// 快速添加接入网关
|
||||||
|
if (route.query.save && route.query?.type) {
|
||||||
|
const type = route.query.type;
|
||||||
goProviders(
|
goProviders(
|
||||||
dataSource.value
|
dataSource.value
|
||||||
.find((f: any) => f.title === '视频类设备接入')
|
.find((f: any) => f.title === DataMap.get(type).title)
|
||||||
?.list?.find((f: any) => f.id === route.query.type),
|
?.list?.find((f: any) => f.id === type),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,6 +119,10 @@ const onFinish = async (values: any) => {
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
onlyMessage('操作成功', 'success');
|
onlyMessage('操作成功', 'success');
|
||||||
history.back();
|
history.back();
|
||||||
|
if ((window as any).onTabSaveSuccess) {
|
||||||
|
(window as any).onTabSaveSuccess(resp);
|
||||||
|
setTimeout(() => window.close(), 300);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -413,6 +413,10 @@ const saveData = async () => {
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
onlyMessage('操作成功', 'success');
|
onlyMessage('操作成功', 'success');
|
||||||
history.back();
|
history.back();
|
||||||
|
if ((window as any).onTabSaveSuccess) {
|
||||||
|
(window as any).onTabSaveSuccess(resp);
|
||||||
|
setTimeout(() => window.close(), 300);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -501,6 +501,10 @@ const saveData = async () => {
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
onlyMessage('操作成功', 'success');
|
onlyMessage('操作成功', 'success');
|
||||||
history.back();
|
history.back();
|
||||||
|
if ((window as any).onTabSaveSuccess) {
|
||||||
|
(window as any).onTabSaveSuccess(resp);
|
||||||
|
setTimeout(() => window.close(), 300);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -264,7 +264,11 @@ const onFinish = async (values: any) => {
|
||||||
id === ':id' ? await save(params) : await update({ ...params, id });
|
id === ':id' ? await save(params) : await update({ ...params, id });
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
onlyMessage('操作成功', 'success');
|
onlyMessage('操作成功', 'success');
|
||||||
history.back();
|
history.back();
|
||||||
|
if ((window as any).onTabSaveSuccess) {
|
||||||
|
(window as any).onTabSaveSuccess(resp);
|
||||||
|
setTimeout(() => window.close(), 300);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -654,7 +654,7 @@ const saveData = () => {
|
||||||
onlyMessage('操作成功', 'success');
|
onlyMessage('操作成功', 'success');
|
||||||
if (route.query.save) {
|
if (route.query.save) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window?.onSaveSuccess(resp.result);
|
window?.onTabSaveSuccess(resp.result);
|
||||||
window.close();
|
window.close();
|
||||||
} else {
|
} else {
|
||||||
history.back();
|
history.back();
|
||||||
|
|
|
@ -124,7 +124,7 @@ const onFinish = async (values: any) => {
|
||||||
|
|
||||||
if (route.query.save) {
|
if (route.query.save) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window?.onSaveSuccess(resp.result);
|
window?.onTabSaveSuccess(resp.result);
|
||||||
window.close();
|
window.close();
|
||||||
} else {
|
} else {
|
||||||
history.back();
|
history.back();
|
||||||
|
|
|
@ -522,7 +522,6 @@ const saveData = () => {
|
||||||
onlyMessage('操作成功', 'success');
|
onlyMessage('操作成功', 'success');
|
||||||
history.back();
|
history.back();
|
||||||
if ((window as any).onTabSaveSuccess) {
|
if ((window as any).onTabSaveSuccess) {
|
||||||
console.log(123);
|
|
||||||
if (resp.result?.id) {
|
if (resp.result?.id) {
|
||||||
(window as any).onTabSaveSuccess(resp);
|
(window as any).onTabSaveSuccess(resp);
|
||||||
setTimeout(() => window.close(), 300);
|
setTimeout(() => window.close(), 300);
|
||||||
|
|
|
@ -319,7 +319,7 @@ const handleAdd = () => {
|
||||||
const tab: any = window.open(
|
const tab: any = window.open(
|
||||||
`${origin}/#/iot/link/accessConfig/detail/:id?save=true&view=false&type=${props.channel}`,
|
`${origin}/#/iot/link/accessConfig/detail/:id?save=true&view=false&type=${props.channel}`,
|
||||||
);
|
);
|
||||||
tab.onSaveSuccess = async (value: string) => {
|
tab.onTabSaveSuccess = async (value: string) => {
|
||||||
await getGatewayList();
|
await getGatewayList();
|
||||||
handleClick(value);
|
handleClick(value);
|
||||||
};
|
};
|
||||||
|
|
|
@ -86,6 +86,7 @@ import { storeToRefs } from 'pinia';
|
||||||
import {cloneDeep, flattenDeep, isArray, set} from 'lodash-es'
|
import {cloneDeep, flattenDeep, isArray, set} from 'lodash-es'
|
||||||
import { Form } from 'jetlinks-ui-components'
|
import { Form } from 'jetlinks-ui-components'
|
||||||
import {treeFilter} from "@/utils/comm";
|
import {treeFilter} from "@/utils/comm";
|
||||||
|
import { timeTypeKeys } from '@/views/rule-engine/Scene/Save/components/Terms/util'
|
||||||
|
|
||||||
const sceneStore = useSceneStore()
|
const sceneStore = useSceneStore()
|
||||||
const { data: formModel } = storeToRefs(sceneStore)
|
const { data: formModel } = storeToRefs(sceneStore)
|
||||||
|
@ -160,7 +161,7 @@ const showDelete = ref(false)
|
||||||
const columnOptions: any = inject('filter-params') //
|
const columnOptions: any = inject('filter-params') //
|
||||||
const termTypeOptions = ref<Array<{ id: string, name: string}>>([]) // 条件值
|
const termTypeOptions = ref<Array<{ id: string, name: string}>>([]) // 条件值
|
||||||
const valueOptions = ref<any[]>([]) // 默认手动输入下拉
|
const valueOptions = ref<any[]>([]) // 默认手动输入下拉
|
||||||
const arrayParamsKey = ['nbtw', 'btw', 'in', 'nin']
|
const arrayParamsKey = ['nbtw', 'btw', 'in', 'nin', 'contains_all', 'contains_any', 'not_contains']
|
||||||
const valueColumnOptions = ref<any[]>([])
|
const valueColumnOptions = ref<any[]>([])
|
||||||
|
|
||||||
const tabsOptions = ref<Array<TabsOption>>(
|
const tabsOptions = ref<Array<TabsOption>>(
|
||||||
|
@ -285,7 +286,19 @@ const columnSelect = (e: any) => {
|
||||||
|
|
||||||
const termsTypeSelect = (e: { key: string, name: string }) => {
|
const termsTypeSelect = (e: { key: string, name: string }) => {
|
||||||
const oldValue = isArray(paramsValue.value!.value) ? paramsValue.value!.value[0] : paramsValue.value!.value
|
const oldValue = isArray(paramsValue.value!.value) ? paramsValue.value!.value[0] : paramsValue.value!.value
|
||||||
const value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue
|
let value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue
|
||||||
|
|
||||||
|
// 如果上次的值 在 timeTypeKeys中 则不变
|
||||||
|
if (timeTypeKeys.includes(e.key)) {
|
||||||
|
if (tabsOptions.value[0].component !== 'int') {
|
||||||
|
value = undefined
|
||||||
|
}
|
||||||
|
tabsOptions.value[0].component = 'int'
|
||||||
|
} else if (!timeTypeKeys.includes(e.key) && tabsOptions.value[0].component == 'int') {
|
||||||
|
value = undefined
|
||||||
|
tabsOptions.value[0].component = 'date'
|
||||||
|
}
|
||||||
|
|
||||||
paramsValue.value = {
|
paramsValue.value = {
|
||||||
source: paramsValue.value?.source || tabsOptions.value[0].key,
|
source: paramsValue.value?.source || tabsOptions.value[0].key,
|
||||||
value: value
|
value: value
|
||||||
|
|
|
@ -77,7 +77,7 @@ import DropdownButton from '../DropdownButton'
|
||||||
import { getOption } from '../DropdownButton/util'
|
import { getOption } from '../DropdownButton/util'
|
||||||
import ParamsDropdown, { DoubleParamsDropdown } from '../ParamsDropdown'
|
import ParamsDropdown, { DoubleParamsDropdown } from '../ParamsDropdown'
|
||||||
import { inject } from 'vue'
|
import { inject } from 'vue'
|
||||||
import { ContextKey } from './util'
|
import { ContextKey, arrayParamsKey, timeTypeKeys } from './util'
|
||||||
import { useSceneStore } from 'store/scene'
|
import { useSceneStore } from 'store/scene'
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { Form } from 'jetlinks-ui-components'
|
import { Form } from 'jetlinks-ui-components'
|
||||||
|
@ -157,7 +157,6 @@ const valueOptions = ref<any[]>([]) // 默认手动输入下拉
|
||||||
const metricOption = ref<any[]>([]) // 根据termType获取对应指标值
|
const metricOption = ref<any[]>([]) // 根据termType获取对应指标值
|
||||||
const isMetric = ref<boolean>(false) // 是否为指标值
|
const isMetric = ref<boolean>(false) // 是否为指标值
|
||||||
const tabsOptions = ref<Array<TabsOption>>([{ label: '手动输入', key: 'manual', component: 'string' }])
|
const tabsOptions = ref<Array<TabsOption>>([{ label: '手动输入', key: 'manual', component: 'string' }])
|
||||||
const arrayParamsKey = ['nbtw', 'btw', 'in', 'nin']
|
|
||||||
const metricsCacheOption = ref<any[]>([]) // 缓存指标值
|
const metricsCacheOption = ref<any[]>([]) // 缓存指标值
|
||||||
|
|
||||||
const handOptionByColumn = (option: any) => {
|
const handOptionByColumn = (option: any) => {
|
||||||
|
@ -280,7 +279,18 @@ const columnSelect = (option: any) => {
|
||||||
|
|
||||||
const termsTypeSelect = (e: { key: string, name: string }) => {
|
const termsTypeSelect = (e: { key: string, name: string }) => {
|
||||||
const oldValue = isArray(paramsValue.value!.value) ? paramsValue.value!.value[0] : paramsValue.value!.value
|
const oldValue = isArray(paramsValue.value!.value) ? paramsValue.value!.value[0] : paramsValue.value!.value
|
||||||
const value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue
|
let value = arrayParamsKey.includes(e.key) ? [ oldValue, undefined ] : oldValue
|
||||||
|
// 如果上次的值 在 timeTypeKeys中 则不变
|
||||||
|
if (timeTypeKeys.includes(e.key)) {
|
||||||
|
if (tabsOptions.value[0].component !== 'int') {
|
||||||
|
value = undefined
|
||||||
|
}
|
||||||
|
tabsOptions.value[0].component = 'int'
|
||||||
|
} else if (!timeTypeKeys.includes(e.key) && tabsOptions.value[0].component == 'int') {
|
||||||
|
value = undefined
|
||||||
|
tabsOptions.value[0].component = 'date'
|
||||||
|
}
|
||||||
|
|
||||||
paramsValue.value = {
|
paramsValue.value = {
|
||||||
source: paramsValue.value?.source || tabsOptions.value[0].key,
|
source: paramsValue.value?.source || tabsOptions.value[0].key,
|
||||||
value: value
|
value: value
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { BranchesThen } from '@/views/rule-engine/Scene/typings'
|
import { BranchesThen } from '@/views/rule-engine/Scene/typings'
|
||||||
|
|
||||||
export const ContextKey = 'columnOptions'
|
export const ContextKey = 'columnOptions'
|
||||||
|
export const arrayParamsKey = ['nbtw', 'btw', 'in', 'nin', 'contains_all', 'contains_any', 'not_contains']
|
||||||
|
export const timeTypeKeys = ['time_gt_now', 'time_lt_now']
|
||||||
|
|
||||||
|
|
||||||
export const handleParamsData = (data: any[], key: string = 'column'): any[] => {
|
export const handleParamsData = (data: any[], key: string = 'column'): any[] => {
|
||||||
return data?.map(item => {
|
return data?.map(item => {
|
||||||
|
|
|
@ -1771,7 +1771,7 @@ function getOrgIdList() {
|
||||||
// 添加角色/组织
|
// 添加角色/组织
|
||||||
function clickAddItem(data: string[], target: string) {
|
function clickAddItem(data: string[], target: string) {
|
||||||
const tab: any = window.open(`${origin}/#/system/${target}?save=true`);
|
const tab: any = window.open(`${origin}/#/system/${target}?save=true`);
|
||||||
tab.onSaveSuccess = (value: string) => {
|
tab.onTabSaveSuccess = (value: string) => {
|
||||||
data.push(value);
|
data.push(value);
|
||||||
if (target === 'Role') getRoleIdList();
|
if (target === 'Role') getRoleIdList();
|
||||||
else getOrgIdList();
|
else getOrgIdList();
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
:status="slotProps.state?.value"
|
:status="slotProps.state?.value"
|
||||||
:statusText="slotProps.state?.text"
|
:statusText="slotProps.state?.text"
|
||||||
:statusNames="{
|
:statusNames="{
|
||||||
enabled: 'success',
|
enabled: 'processing',
|
||||||
disabled: 'error',
|
disabled: 'error',
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
:status="slotProps.state.value"
|
:status="slotProps.state.value"
|
||||||
:text="slotProps.state.text"
|
:text="slotProps.state.text"
|
||||||
:statusNames="{
|
:statusNames="{
|
||||||
enabled: 'success',
|
enabled: 'processing',
|
||||||
disabled: 'error',
|
disabled: 'error',
|
||||||
}"
|
}"
|
||||||
></BadgeStatus>
|
></BadgeStatus>
|
||||||
|
@ -201,6 +201,7 @@ import { ActionsType } from '@/components/Table';
|
||||||
import { getImage } from '@/utils/comm';
|
import { getImage } from '@/utils/comm';
|
||||||
import { useMenuStore } from '@/store/menu';
|
import { useMenuStore } from '@/store/menu';
|
||||||
import { message } from 'jetlinks-ui-components';
|
import { message } from 'jetlinks-ui-components';
|
||||||
|
import BadgeStatus from '@/components/BadgeStatus/index.vue';
|
||||||
|
|
||||||
const menuStory = useMenuStore();
|
const menuStory = useMenuStore();
|
||||||
const permission = 'system/Apply';
|
const permission = 'system/Apply';
|
||||||
|
|
|
@ -187,7 +187,7 @@ function delDepartment(id: string) {
|
||||||
}
|
}
|
||||||
function refresh(id: string) {
|
function refresh(id: string) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window?.onSaveSuccess && window.onSaveSuccess(id);
|
window?.onTabSaveSuccess && window.onTabSaveSuccess(id);
|
||||||
window.close();
|
window.close();
|
||||||
getTree();
|
getTree();
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ const confirm = () => {
|
||||||
|
|
||||||
if (route.query.save) {
|
if (route.query.save) {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
window?.onSaveSuccess(resp.result.id);
|
window?.onTabSaveSuccess(resp.result.id);
|
||||||
window.close();
|
window.close();
|
||||||
} else jumpPage(`system/Role/Detail`, { id: resp.result.id });
|
} else jumpPage(`system/Role/Detail`, { id: resp.result.id });
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,7 +345,7 @@ const form = reactive({
|
||||||
IsShow: (...typeList: modalType[]) => typeList.includes(props.type),
|
IsShow: (...typeList: modalType[]) => typeList.includes(props.type),
|
||||||
clickAddItem: (prop: 'roleIdList' | 'orgIdList', target: string) => {
|
clickAddItem: (prop: 'roleIdList' | 'orgIdList', target: string) => {
|
||||||
const tab: any = window.open(`${origin}/#/system/${target}?save=true`);
|
const tab: any = window.open(`${origin}/#/system/${target}?save=true`);
|
||||||
tab.onSaveSuccess = (value: string) => {
|
tab.onTabSaveSuccess = (value: string) => {
|
||||||
form.data[prop] = [...(form.data[prop] || []), value];
|
form.data[prop] = [...(form.data[prop] || []), value];
|
||||||
if (prop === 'roleIdList') form.getRoleList();
|
if (prop === 'roleIdList') form.getRoleList();
|
||||||
else form.getDepartmentList();
|
else form.getDepartmentList();
|
||||||
|
|
Loading…
Reference in New Issue