工作流 上下文参数使用++
This commit is contained in:
		
							parent
							
								
									948f2ea5ae
								
							
						
					
					
						commit
						56ac06f47d
					
				@ -1,4 +1,11 @@
 | 
				
			|||||||
<script setup lang="ts">
 | 
					<script setup lang="ts">
 | 
				
			||||||
 | 
					import {fetchGetSystemVarList} from "@/service/api/system-variable";
 | 
				
			||||||
 | 
					import { onMounted, ref, computed} from 'vue'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					onMounted(() => {
 | 
				
			||||||
 | 
					  getSystemVariables();
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const content = defineModel<{ key: string; value: string | number | boolean; type: string }[]>('value', {
 | 
					const content = defineModel<{ key: string; value: string | number | boolean; type: string }[]>('value', {
 | 
				
			||||||
  required: true,
 | 
					  required: true,
 | 
				
			||||||
  default: () => []
 | 
					  default: () => []
 | 
				
			||||||
@ -25,6 +32,34 @@ const dynamicInputRule = [
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					const inputValue = ref('');
 | 
				
			||||||
 | 
					const syncOptions = ref([
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    label: String,
 | 
				
			||||||
 | 
					    value: String
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const  getSystemVariables = async () =>{
 | 
				
			||||||
 | 
					  const { error,data } = await fetchGetSystemVarList();
 | 
				
			||||||
 | 
					  if (!error) {
 | 
				
			||||||
 | 
					    syncOptions.value = data.map(item => ({
 | 
				
			||||||
 | 
					      label: item.variableName,
 | 
				
			||||||
 | 
					      value: item.variableKey.replace("$",'')
 | 
				
			||||||
 | 
					    }));
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  console.log("syncOptions"+syncOptions.value[0].value)
 | 
				
			||||||
 | 
					  console.log("syncOptions"+syncOptions.value[0].label)
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const filteredOptions = computed(() => {
 | 
				
			||||||
 | 
					  return inputValue.value
 | 
				
			||||||
 | 
					    ? syncOptions.value.filter(opt =>
 | 
				
			||||||
 | 
					      opt.label.includes(inputValue.value) ||
 | 
				
			||||||
 | 
					      opt.value.includes(inputValue.value))
 | 
				
			||||||
 | 
					    : syncOptions.value
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const typeOptions = [
 | 
					const typeOptions = [
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
@ -87,12 +122,33 @@ const handleUpdateType = (index: number) => {
 | 
				
			|||||||
        :rule="dynamicInputRule"
 | 
					        :rule="dynamicInputRule"
 | 
				
			||||||
        :path="`${path}[${index}].value`"
 | 
					        :path="`${path}[${index}].value`"
 | 
				
			||||||
      >
 | 
					      >
 | 
				
			||||||
        <NInput
 | 
					<!--        <NInput-->
 | 
				
			||||||
 | 
					<!--          v-if="content[index].type === 'string'"-->
 | 
				
			||||||
 | 
					<!--          v-model:value="content[index].value as string"-->
 | 
				
			||||||
 | 
					<!--          placeholder="value"-->
 | 
				
			||||||
 | 
					<!--          @keydown.enter.prevent-->
 | 
				
			||||||
 | 
					<!--        />-->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <n-mention
 | 
				
			||||||
          v-if="content[index].type === 'string'"
 | 
					          v-if="content[index].type === 'string'"
 | 
				
			||||||
          v-model:value="content[index].value as string"
 | 
					          v-model:value="content[index].value as string"
 | 
				
			||||||
          placeholder="value"
 | 
					          placeholder="value"
 | 
				
			||||||
 | 
					          :options="syncOptions"
 | 
				
			||||||
 | 
					          default-value="@"
 | 
				
			||||||
 | 
					          :prefix="['$']"
 | 
				
			||||||
          @keydown.enter.prevent
 | 
					          @keydown.enter.prevent
 | 
				
			||||||
        />
 | 
					        />
 | 
				
			||||||
 | 
					        <NPopover trigger="hover"
 | 
				
			||||||
 | 
					                  v-if="content[index].type === 'string'"
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					          <template #trigger>
 | 
				
			||||||
 | 
					            <NButton text>
 | 
				
			||||||
 | 
					              <SvgIcon icon="ant-design:info-circle-outlined" class="text-18px color-blue" />
 | 
				
			||||||
 | 
					            </NButton>
 | 
				
			||||||
 | 
					          </template>
 | 
				
			||||||
 | 
					          输入$提示变量信息
 | 
				
			||||||
 | 
					        </NPopover>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        <NInputNumber
 | 
					        <NInputNumber
 | 
				
			||||||
          v-if="content[index].type === 'number'"
 | 
					          v-if="content[index].type === 'number'"
 | 
				
			||||||
          v-model:value="content[index].value as number"
 | 
					          v-model:value="content[index].value as number"
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user