|
@@ -155,32 +155,42 @@ const titleCpt = computed(() => {
|
|
|
})
|
|
|
const onSubmit = () => {
|
|
|
ref_form.value.submit().then(() => {
|
|
|
- if (state.form.fieldType === 'text' && state.textTable.data.length === 0) {
|
|
|
- ElMessage({
|
|
|
- message: '请至少选择一个分词器!',
|
|
|
- grouping: true,
|
|
|
- type: 'warning',
|
|
|
- })
|
|
|
- } else {
|
|
|
- ElMessageBox.confirm("是否提交?", "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- } as any).then(() => {
|
|
|
- state.loading = true
|
|
|
- if (state.form.fieldType === 'text') {
|
|
|
- state.form.fieldAnalyzer = JSON.stringify(state.textTable.data)
|
|
|
- }
|
|
|
- sysIndexFieldSaveOrUpdate(state.form).then(res => {
|
|
|
- ElMessage.success(props.transfer.mode === 'add' ? '新增成功!' : '编辑成功!')
|
|
|
- emit('update:show', false)
|
|
|
- emit('refresh')
|
|
|
- state.loading = false
|
|
|
- }).catch(() => {
|
|
|
- state.loading = false
|
|
|
+ if (state.form.fieldType === 'text') {
|
|
|
+ if (state.textTable.data.length < 2) {
|
|
|
+ ElMessage({
|
|
|
+ message: '请至少选择两个分词器!',
|
|
|
+ grouping: true,
|
|
|
+ type: 'warning',
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (state.textTable.data.filter(v => v.value == 1).length !== 1) {
|
|
|
+ ElMessage({
|
|
|
+ message: '仅可有一个主要分词器!',
|
|
|
+ grouping: true,
|
|
|
+ type: 'warning',
|
|
|
})
|
|
|
- }).catch(() => {})
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+ ElMessageBox.confirm("是否提交?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ } as any).then(() => {
|
|
|
+ state.loading = true
|
|
|
+ if (state.form.fieldType === 'text') {
|
|
|
+ state.form.fieldAnalyzer = JSON.stringify(state.textTable.data)
|
|
|
+ }
|
|
|
+ sysIndexFieldSaveOrUpdate(state.form).then(res => {
|
|
|
+ ElMessage.success(props.transfer.mode === 'add' ? '新增成功!' : '编辑成功!')
|
|
|
+ emit('update:show', false)
|
|
|
+ emit('refresh')
|
|
|
+ state.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ state.loading = false
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
}).catch((e) => {
|
|
|
ElMessage({
|
|
|
message: e[0].message,
|
|
@@ -215,7 +225,7 @@ watch(() => props.show, (n) => {
|
|
|
const handleChangeFcq = (val) => {
|
|
|
if (val) {
|
|
|
state.textTable.data.push({
|
|
|
- key: val, value: '1'
|
|
|
+ key: val, value: '0'
|
|
|
})
|
|
|
setTimeout(() => {
|
|
|
state.textTable.fcqSelect = ''
|