Skip to content

Commit 5f4904d

Browse files
perf: Optimize parameter setting interaction
1 parent aee48fe commit 5f4904d

File tree

1 file changed

+34
-2
lines changed

1 file changed

+34
-2
lines changed

frontend/src/views/system/parameter/index.vue

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@ const loadData = () => {
3030
}
3131
})
3232
}
33+
34+
const beforeChange = (): Promise<boolean> => {
35+
return new Promise((resolve) => {
36+
if (!state.parameterForm['chat.rows_of_data']) {
37+
return resolve(true)
38+
}
39+
ElMessageBox.confirm(t('parameter.excessive_data_volume'), t('parameter.prompt'), {
40+
confirmButtonType: 'primary',
41+
confirmButtonText: t('common.confirm2'),
42+
cancelButtonText: t('common.cancel'),
43+
customClass: 'confirm-no_icon confirm_no_icon_parameter',
44+
autofocus: false,
45+
callback: (action: any) => {
46+
resolve(action && action === 'confirm')
47+
},
48+
})
49+
})
50+
}
3351
const buildParam = () => {
3452
const changedItemArray = Object.keys(state.parameterForm).map((key: string) => {
3553
return {
@@ -99,7 +117,10 @@ onMounted(() => {
99117
</el-tooltip>
100118
</div>
101119
<div class="value">
102-
<el-switch v-model="state.parameterForm['chat.rows_of_data']" />
120+
<el-switch
121+
v-model="state.parameterForm['chat.rows_of_data']"
122+
:before-change="beforeChange"
123+
/>
103124
</div>
104125
</div>
105126
</div>
@@ -111,7 +132,18 @@ onMounted(() => {
111132
</div>
112133
</div>
113134
</template>
114-
135+
<style lang="less">
136+
.confirm_no_icon_parameter {
137+
.ed-message-box__header {
138+
margin-bottom: var(--ed-messagebox-padding-primary);
139+
}
140+
.ed-message-box__message > p {
141+
font-size: 14px;
142+
font-weight: 400;
143+
line-height: 22px;
144+
}
145+
}
146+
</style>
115147
<style lang="less" scoped>
116148
.parameter {
117149
.title {

0 commit comments

Comments
 (0)