Commit 0b6ab4f1014c3f7e3b6b4e5c828586834976e0e1
Merge branch 'fix/chart-bug' into 'main_dev'
fix(src/packages/components): 修复多个实时组合,页面崩溃问题,移除不需要代码 See merge request yunteng/thingskit-view!243
Showing
1 changed file
with
4 additions
and
25 deletions
| ... | ... | @@ -6,12 +6,8 @@ |
| 6 | 6 | <n-code word-wrap :code="toString(targetData.option.dataset)" language="json"></n-code> |
| 7 | 7 | </n-card> |
| 8 | 8 | <n-tag type="info"> 目前支持实时多属性 </n-tag> |
| 9 | - <!-- <n-tag type="warning">示例:res.xxxx</n-tag> --> | |
| 10 | - <!-- <span>目前支持实时多属性</span> --> | |
| 11 | - <!-- <n-input type="textarea" @input="handleTestInput($event, option)" size="small" placeholder="请输入"></n-input> | |
| 12 | - <n-code word-wrap :code="toString(testInputValue)" language="json"></n-code> --> | |
| 13 | 9 | <n-divider /> |
| 14 | - <div v-for="(item, index) in cacheGroupList" :key="item.key + index"> | |
| 10 | + <div v-for="(item, index) in groupList" :key="item.key + index"> | |
| 15 | 11 | <n-space justify="space-between"> |
| 16 | 12 | <n-ellipsis> 组件id </n-ellipsis> |
| 17 | 13 | <n-input size="small" v-model:value="item.id" :disabled="true"></n-input> |
| ... | ... | @@ -28,7 +24,6 @@ |
| 28 | 24 | </n-space> |
| 29 | 25 | <n-space vertical justify="space-between"> |
| 30 | 26 | <n-ellipsis>数据内容 </n-ellipsis> |
| 31 | - <!-- @update:value="handleInput(groupList!, item.id, $event)" --> | |
| 32 | 27 | <n-input |
| 33 | 28 | type="textarea" |
| 34 | 29 | size="small" |
| ... | ... | @@ -54,28 +49,16 @@ const { targetData } = useTargetData() |
| 54 | 49 | |
| 55 | 50 | const { groupList, option } = toRefs(targetData.value as unknown as Recordable) |
| 56 | 51 | |
| 57 | -const cacheGroupList = computed(()=>{ | |
| 58 | - return (groupList.value as unknown as CreateComponentType[]).reverse() | |
| 59 | -}) | |
| 60 | - | |
| 61 | 52 | const saveHistoryInputValueList = ref<saveHistoryInputValueListType>([]) |
| 62 | 53 | |
| 63 | -const handleSelectDataKey = (key:string, options:SelectOption[], currentComponentId:string, groupList:CreateComponentType[]) => { | |
| 64 | - saveHistoryInputValueList.value.push({ | |
| 54 | +const handleSelectDataKey = (key:string, _:SelectOption[], currentComponentId:string, groupList:CreateComponentType[]) => { | |
| 55 | + saveHistoryInputValueList.value.unshift({ | |
| 65 | 56 | id:currentComponentId, |
| 66 | 57 | inputValue:key |
| 67 | 58 | }) |
| 68 | 59 | handleGroupListById(groupList, currentComponentId, key, option.value.dataset) |
| 69 | 60 | } |
| 70 | 61 | |
| 71 | -// const handleInput = (groupList: CreateComponentType[], id: string, inputValue: string) => { | |
| 72 | -// saveHistoryInputValueList.value.unshift({ | |
| 73 | -// id, | |
| 74 | -// inputValue | |
| 75 | -// }) | |
| 76 | -// handleGroupListById(groupList, id, inputValue, option.value.dataset) | |
| 77 | -// } | |
| 78 | - | |
| 79 | 62 | const executeFn = (inputValue: string, dataset: any) => { |
| 80 | 63 | try { |
| 81 | 64 | return Function('res', `return ${dataset[inputValue]}`)(dataset) |
| ... | ... | @@ -119,10 +102,6 @@ const dataCacheKeys = computed(()=>{ |
| 119 | 102 | return [] |
| 120 | 103 | }) |
| 121 | 104 | |
| 122 | -const cacheTargetDataGroupList = computed(()=>{ | |
| 123 | - return (targetData.value?.groupList as unknown as CreateComponentType[]).reverse() | |
| 124 | -}) | |
| 125 | - | |
| 126 | 105 | watch( |
| 127 | 106 | () => targetData.value, |
| 128 | 107 | (newValue: CreateComponentType | CreateComponentGroupType) => { |
| ... | ... | @@ -132,7 +111,7 @@ watch( |
| 132 | 111 | newValue.saveHistoryInput = JSON.stringify(uniqHistoryInputValueList) |
| 133 | 112 | window.localStorage.setItem('CACHE_HISTORY_INPUT_VALUE', JSON.stringify(uniqHistoryInputValueList)) |
| 134 | 113 | } |
| 135 | - cacheTargetDataGroupList.value?.forEach((item: CreateComponentType) => { | |
| 114 | + newValue?.groupList?.forEach((item: CreateComponentType) => { | |
| 136 | 115 | uniqHistoryInputValueList.forEach((uniqueItem: historyInputValue) => { |
| 137 | 116 | if (uniqueItem.id === item.id) { |
| 138 | 117 | // eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ... | ... |