-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Expand file tree
/
Copy pathindex.vue
More file actions
125 lines (120 loc) · 3.58 KB
/
index.vue
File metadata and controls
125 lines (120 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<template>
<NodeContainer :nodeModel="nodeModel">
<h5 class="title-decoration-1 mb-8">{{ $t('workflow.nodeSetting') }}</h5>
<el-card shadow="never" class="card-never">
<el-form
@submit.prevent
:model="form_data"
label-position="top"
require-asterisk-position="right"
label-width="auto"
ref="NodeFormRef"
>
<el-form-item
:label="$t('workflow.nodes.dataSourceLocalNode.fileFormat.label')"
:rules="{
type: 'array',
required: true,
message: $t('workflow.nodes.dataSourceLocalNode.fileFormat.requiredMessage'),
trigger: 'change',
}"
prop="file_type_list"
>
<el-select
v-model="form_data.file_type_list"
:placeholder="$t('workflow.nodes.dataSourceLocalNode.fileFormat.requiredMessage')"
class="w-240"
clearable
multiple
allow-create
filterable
default-first-option
>
<template #label="{ label, value }">
<span>{{ label }} </span>
</template>
<el-option
v-for="item in file_type_list_options"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
<el-form-item
:label="$t('workflow.nodes.dataSourceLocalNode.maxFileNumber.label')"
:rules="{
required: true,
message: $t('common.inputPlaceholder'),
trigger: 'change',
}"
prop="file_count_limit"
>
<el-input-number
v-model="form_data.file_count_limit"
:min="1"
:max="1000"
:value-on-clear="0"
controls-position="right"
class="w-full"
:step="1"
:step-strictly="true"
/>
</el-form-item>
<el-form-item
:label="$t('workflow.nodes.dataSourceLocalNode.maxFileCountNumber.label')"
:rules="{
required: true,
message: $t('common.inputPlaceholder'),
trigger: 'change',
}"
prop="file_size_limit"
>
<el-input-number
v-model="form_data.file_size_limit"
:min="1"
:max="1000"
:value-on-clear="0"
controls-position="right"
class="w-full"
:step="1"
:step-strictly="true"
/>
</el-form-item>
</el-form>
</el-card>
</NodeContainer>
</template>
<script setup lang="ts">
import NodeContainer from '@/workflow/common/NodeContainer.vue'
import { computed, onMounted, ref } from 'vue'
import { set } from 'lodash'
const NodeFormRef = ref()
const props = defineProps<{ nodeModel: any }>()
const file_type_list_options = ['TXT', 'DOCX', 'PDF', 'HTML', 'XLS', 'XLSX', 'ZIP', 'CSV']
const form = {
file_type_list: ['TXT', 'DOCX', 'PDF', 'HTML', 'XLS', 'XLSX', 'ZIP', 'CSV'],
file_size_limit: 100,
file_count_limit: 50,
}
const form_data = computed({
get: () => {
if (props.nodeModel.properties.node_data) {
return props.nodeModel.properties.node_data
} else {
set(props.nodeModel.properties, 'node_data', form)
}
return props.nodeModel.properties.node_data
},
set: (value) => {
set(props.nodeModel.properties, 'node_data', value)
},
})
const validate = () => {
return NodeFormRef.value.validate()
}
onMounted(() => {
set(props.nodeModel, 'validate', validate)
})
</script>
<style lang="scss" scoped></style>