Commit 227ba29e authored by 何远江's avatar 何远江

1

parent 47237c63
...@@ -154,7 +154,8 @@ import { onMounted, ref, watch } from 'vue' ...@@ -154,7 +154,8 @@ import { onMounted, ref, watch } from 'vue'
const props = defineProps<{ item?: any; index: number }>() const props = defineProps<{ item?: any; index: number }>()
const emits = defineEmits(['remove']) const emits = defineEmits(['remove'])
const excelChangeStore = useVariableExcelChangeStore() const excelChangeStore = useVariableExcelChangeStore()
const { getScriptList, getSpecList, getFilterMapFieldsList, getFilterMapFieldsFlatList } = storeToRefs(excelChangeStore) const { getScriptList, getSpecList, getFilterMapFieldsList, getFilterMapFieldsFlatList } =
storeToRefs(excelChangeStore)
const scriptChange = (sitem, e) => { const scriptChange = (sitem, e) => {
if (e) { if (e) {
...@@ -194,6 +195,7 @@ watch( ...@@ -194,6 +195,7 @@ watch(
const filterMapFieldChange = (e) => { const filterMapFieldChange = (e) => {
if (e) { if (e) {
// 找到匹配的过滤字段
getFilterMapFieldsFlatList.value.some((items) => { getFilterMapFieldsFlatList.value.some((items) => {
if (items.filedName == e) { if (items.filedName == e) {
props.item.filterFiled = items props.item.filterFiled = items
...@@ -201,25 +203,21 @@ const filterMapFieldChange = (e) => { ...@@ -201,25 +203,21 @@ const filterMapFieldChange = (e) => {
} }
return false return false
}) })
// 如果没有脚本,设置一个空的脚本
if (!props.item?.filterScripts || props.item?.filterScripts?.length == 0) {
props.item.filterScripts = [
{
content: '',
scriptName: ''
}
]
}
} else { } else {
// 置空
props.item.filterFiled = null props.item.filterFiled = null
props.item.filterScripts = []
} }
} }
watch(
() => props.item.filterMapFiled,
(val) => {
if (!props.item?.filterScripts) {
props.item.filterScripts = []
}
// 如果有值,添加脚本
if (val && props.item.filterScripts?.length == 0) {
props.item.filterScripts.push({
content: '',
scriptName: ''
})
}
}
)
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment