Merge branch 'dev' of github.com:jetlinks/jetlinks-ui-vue into dev

This commit is contained in:
jackhoo_98 2023-03-30 15:17:50 +08:00
commit 3ea80b89c6
5 changed files with 48 additions and 37 deletions

View File

@ -66,7 +66,7 @@ import Role from './Role/index.vue';
import Menu from './Menu/index.vue';
import InitData from './InitData/index.vue';
import { modalState, formState, logoState } from './data/interface';
import { saveInit } from '@/api/initHome';
import { getInit, saveInit } from '@/api/initHome';
import { BASE_API_PATH, TOKEN_KEY } from '@/utils/variable';
import { FILE_UPLOAD } from '@/api/comm';
import { LocalStore } from '@/utils/comm';
@ -128,6 +128,18 @@ const submitData = async () => {
}
}
};
/**
* 判断是否已有配置
*/
const judgeInitSet = async () => {
const resp:any = await getInit();
if(resp.status === 200 && resp.result.length){
window.location.href = '/';
}
}
onMounted(()=>{
judgeInitSet();
});
</script>
<style scoped lang="less">
.page-container {

View File

@ -326,13 +326,13 @@ const onFormSave = () => {
..._data.message,
},
});
emit('change', {
propertiesName:
deviceMessageType.value === 'INVOKE_FUNCTION'
? _function.value?.name
: _property.value?.name,
propertiesValue: modelRef.propertiesValue,
});
// emit('change', {
// propertiesName:
// deviceMessageType.value === 'INVOKE_FUNCTION'
// ? _function.value?.name
// : _property.value?.name,
// propertiesValue: modelRef.propertiesValue,
// });
})
.catch((err: any) => {
reject(err);

View File

@ -120,17 +120,25 @@ const onTypeSelect = (key: any, _index: number) => {
};
const onTagSelect = (_data: any, _index: number) => {
const newList = [...unref(tagList)];
const indexType = newList[_index].type;
newList.splice(
_index,
1,
handleItem({ ..._data, value: undefined, type: indexType }),
);
tagList.value = newList;
const indexType = tagList.value[_index].type;
const _item = handleItem({ ..._data, value: undefined, type: indexType })
tagList.value[_index] = _item
onValueChange()
};
const onValueChange = () => {
// const _data = tagList.value.filter((item) => item?.value !== undefined);
const newValue = tagList.value.map((item: any) => {
return {
column: item.id,
type: item?.type,
value: item?.value,
};
});
emits('update:value', [{ value: newValue, name: '标签' }]);
emits('change', [{ value: newValue, name: '标签' }], tagList.value);
};
watch(
() => [props.tagData, props.value],
([newTag, newVal]) => {
@ -170,19 +178,6 @@ watch(
},
);
const onValueChange = () => {
const _data = tagList.value.filter((item) => !!item?.value);
const newValue = _data.map((item: any) => {
return {
column: item.id,
type: item?.type,
value: item?.value,
};
});
emits('update:value', [{ value: newValue, name: '标签' }]);
emits('change', [{ value: newValue, name: '标签' }], _data);
};
onMounted(() => {
if(props.value?.[0]?.value){
const arr: any[] = []

View File

@ -145,10 +145,10 @@ const onSave = (_data: any) => {
item.upperKey = 'scene.deviceId';
}
const _options: any = {
name: '-', //
type: '', //
properties: '', //
propertiesValue: '', //
// name: '-', //
// type: '', //
// properties: '', //
// propertiesValue: '', //
selector: DeviceModel.selector, //
triggerName: data.value.options?.trigger?.name || '触发设备',
...DeviceOptions.value,
@ -165,15 +165,18 @@ const onSave = (_data: any) => {
_options.propertiesValue =
(typeof _options?.propertiesValue === 'object'
? JSON.stringify(_options?.propertiesValue)
: `${_options?.propertiesValue}`) ||
DeviceModel?.selectorValues?.[0]?.value;
: _options?.propertiesValue)
}
emit('save', item, _options);
emit('save', item, JSON.parse(JSON.stringify(_options)));
};
const onProductChange = (_val: any, bol: boolean) => {
if (!bol) {
DeviceModel.selectorValues = undefined;
DeviceModel.deviceId = ''
DeviceModel.selector = 'fixed',
DeviceModel.upperKey = ''
DeviceModel.source = 'fixed'
const flag = isActionChange(
JSON.parse(_val.metadata || '{}'),
DeviceModel?.message,

View File

@ -519,9 +519,10 @@ const onType = (_type: string) => {
*/
const onSave = (data: ActionsType, options: any) => {
const { key, terms } = _data.value.branches![props.branchesName].then?.[props.thenName].actions?.[props.name]
console.log({...props.options, ...options})
const actionItem: ActionsType = {
...data,
options,
options: {...props.options, ...options},
key,
terms
}