|
@@ -5,6 +5,7 @@
|
|
|
@onClose="$emit('update:show', false)"
|
|
|
width="1000px"
|
|
|
height="auto"
|
|
|
+ max-height="90%"
|
|
|
@onSubmit="onSubmit"
|
|
|
:loading="state.loading"
|
|
|
>
|
|
@@ -73,6 +74,35 @@
|
|
|
:min="1"
|
|
|
:max="999"
|
|
|
/>
|
|
|
+ <div class="text-table" v-if="state.form.fieldType === 'text'">
|
|
|
+ <CusTable
|
|
|
+ :data="state.textTable.data"
|
|
|
+ :table-head="state.textTable.tableHead"
|
|
|
+ :no-page="true"
|
|
|
+ >
|
|
|
+ <template #value-column-value="{scope}">
|
|
|
+ <el-switch
|
|
|
+ v-model="scope.row.value"
|
|
|
+ active-value="1"
|
|
|
+ inactive-value="0"
|
|
|
+ :disabled="state.textTable.data.length < 2"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template #do-header-value="{scope}">
|
|
|
+ <CusFormColumn
|
|
|
+ class="fcq"
|
|
|
+ :span="24"
|
|
|
+ v-model:param="state.textTable.fcqSelect"
|
|
|
+ link="select"
|
|
|
+ :options="DictionaryStore.analyzerList.filter(v => state.textTable.data.every(s => s.key !== v.dictValue))"
|
|
|
+ @change="handleChangeFcq"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ <template #do-column-value="{scope}">
|
|
|
+ <CusButton type="table-del" @click="state.textTable.data.splice(scope.$index, 1)"/>
|
|
|
+ </template>
|
|
|
+ </CusTable>
|
|
|
+ </div>
|
|
|
<CusFormColumn
|
|
|
:span="24"
|
|
|
label="备注"
|
|
@@ -100,7 +130,16 @@ const props = defineProps({
|
|
|
})
|
|
|
const state: any = reactive({
|
|
|
form: {},
|
|
|
- loading: false
|
|
|
+ loading: false,
|
|
|
+ textTable: {
|
|
|
+ tableHead: [
|
|
|
+ {value: "key", label: "分词器"},
|
|
|
+ {value: "value", label: "主要"},
|
|
|
+ {value: "do", label: "操作", width: 200, fixed: 'right'},
|
|
|
+ ],
|
|
|
+ data: [],
|
|
|
+ fcqSelect: ''
|
|
|
+ },
|
|
|
})
|
|
|
const ref_form = ref()
|
|
|
const titleCpt = computed(() => {
|
|
@@ -115,23 +154,34 @@ const titleCpt = computed(() => {
|
|
|
})
|
|
|
const onSubmit = () => {
|
|
|
ref_form.value.submit().then(() => {
|
|
|
- ElMessageBox.confirm("是否提交?", "提示", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning",
|
|
|
- } as any).then(() => {
|
|
|
- state.loading = true
|
|
|
- sysIndexFieldSaveOrUpdate(state.form).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- ElMessage.success(props.transfer.mode === 'add' ? '新增成功!' : '编辑成功!')
|
|
|
- emit('update:show', false)
|
|
|
- emit('refresh')
|
|
|
- } else {
|
|
|
- ElMessage.error(res.msg)
|
|
|
- }
|
|
|
- state.loading = false
|
|
|
+ if (state.form.fieldType === 'text' && state.textTable.data.length === 0) {
|
|
|
+ ElMessage({
|
|
|
+ message: '请至少选择一个分词器!',
|
|
|
+ grouping: true,
|
|
|
+ type: 'warning',
|
|
|
})
|
|
|
- }).catch(() => {})
|
|
|
+ } 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 => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ ElMessage.success(props.transfer.mode === 'add' ? '新增成功!' : '编辑成功!')
|
|
|
+ emit('update:show', false)
|
|
|
+ emit('refresh')
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.msg)
|
|
|
+ }
|
|
|
+ state.loading = false
|
|
|
+ })
|
|
|
+ }).catch(() => {})
|
|
|
+ }
|
|
|
}).catch((e) => {
|
|
|
ElMessage({
|
|
|
message: e[0].message,
|
|
@@ -152,23 +202,49 @@ watch(() => props.show, (n) => {
|
|
|
}
|
|
|
} else {
|
|
|
state.form = JSON.parse(JSON.stringify(props.transfer.row))
|
|
|
+ if (state.form.fieldAnalyzer) {
|
|
|
+ state.textTable.data = JSON.parse(state.form.fieldAnalyzer)
|
|
|
+ }
|
|
|
}
|
|
|
nextTick(() => {
|
|
|
ref_form.value.reset()
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
+const handleChangeFcq = (val) => {
|
|
|
+ if (val) {
|
|
|
+ state.textTable.data.push({
|
|
|
+ key: val, value: '1'
|
|
|
+ })
|
|
|
+ setTimeout(() => {
|
|
|
+ state.textTable.fcqSelect = ''
|
|
|
+ }, 100)
|
|
|
+ }
|
|
|
+}
|
|
|
watch(() => state.form.searchShow, (n) => {
|
|
|
if (n == 1) {
|
|
|
state.form.fieldType = 'text'
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
const initDictionary = () => {
|
|
|
DictionaryStore.initDict('true_false')
|
|
|
DictionaryStore.initDict('fie_type')
|
|
|
+ DictionaryStore.initDict('analyzer')
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
+:deep(.text-table) {
|
|
|
+ margin-bottom: 20px;
|
|
|
+ max-height: 400px;
|
|
|
+ width: 100%;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;
|
|
|
+ .fcq {
|
|
|
+ .el-form-item {
|
|
|
+ margin-bottom: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|