|
@@ -41,6 +41,11 @@
|
|
|
<span class="sort-header" @click.stop="onSortClick('minConfidence', $event)">阈值{{ sortIcon('minConfidence') }}</span>
|
|
<span class="sort-header" @click.stop="onSortClick('minConfidence', $event)">阈值{{ sortIcon('minConfidence') }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ <el-table-column label="采集指标" width="90">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <el-tag size="mini" type="info">{{ indicatorCount(row.expectedIndicators) }} 项</el-tag>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="状态" width="80">
|
|
<el-table-column label="状态" width="80">
|
|
|
<template slot-scope="{ row }">
|
|
<template slot-scope="{ row }">
|
|
|
<el-tag :type="row.isActive ? 'success' : 'info'" size="small">
|
|
<el-tag :type="row.isActive ? 'success' : 'info'" size="small">
|
|
@@ -104,6 +109,27 @@
|
|
|
<el-form-item label="识别阈值">
|
|
<el-form-item label="识别阈值">
|
|
|
<el-input-number v-model="form.minConfidence" :min="1" :max="100" />
|
|
<el-input-number v-model="form.minConfidence" :min="1" :max="100" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
+ <el-form-item label="采集指标">
|
|
|
|
|
+ <el-tag
|
|
|
|
|
+ v-for="(tag, idx) in indicators"
|
|
|
|
|
+ :key="idx"
|
|
|
|
|
+ closable
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="margin: 0 6px 6px 0;"
|
|
|
|
|
+ @close="removeIndicator(idx)"
|
|
|
|
|
+ >{{ tag }}</el-tag>
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-if="indicatorInputVisible"
|
|
|
|
|
+ ref="indicatorInput"
|
|
|
|
|
+ v-model="indicatorInput"
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ style="width: 160px;"
|
|
|
|
|
+ @keyup.enter.native="confirmIndicator"
|
|
|
|
|
+ @blur="confirmIndicator"
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-button v-else size="mini" @click="showIndicatorInput">+ 添加指标</el-button>
|
|
|
|
|
+ <div class="el-form-item-msg">该类型报告应采集的指标项名称;留空表示不校验</div>
|
|
|
|
|
+ </el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<div slot="footer">
|
|
<div slot="footer">
|
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
@@ -176,6 +202,7 @@ export default {
|
|
|
sortableColumns: { id: 'ID', typeId: '类型标识', displayName: '显示名称', family: '家族', parserPath: '解析器路径', minConfidence: '阈值', source: '来源' },
|
|
sortableColumns: { id: 'ID', typeId: '类型标识', displayName: '显示名称', family: '家族', parserPath: '解析器路径', minConfidence: '阈值', source: '来源' },
|
|
|
dialogVisible: false, isEdit: false,
|
|
dialogVisible: false, isEdit: false,
|
|
|
form: { typeId: '', displayName: '', family: '', description: '', parserPath: '', minConfidence: 10 },
|
|
form: { typeId: '', displayName: '', family: '', description: '', parserPath: '', minConfidence: 10 },
|
|
|
|
|
+ indicators: [], indicatorInput: '', indicatorInputVisible: false,
|
|
|
fpDialogVisible: false, currentType: null,
|
|
fpDialogVisible: false, currentType: null,
|
|
|
fingerprints: [], fpFormVisible: false,
|
|
fingerprints: [], fpFormVisible: false,
|
|
|
fpForm: { pattern: '', weight: 10, isExclusion: false, sortOrder: 0 },
|
|
fpForm: { pattern: '', weight: 10, isExclusion: false, sortOrder: 0 },
|
|
@@ -206,20 +233,42 @@ export default {
|
|
|
} catch (e) { this.$message.error('加载失败') }
|
|
} catch (e) { this.$message.error('加载失败') }
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
},
|
|
},
|
|
|
|
|
+ safeParseIndicators(raw) {
|
|
|
|
|
+ if (!raw) return []
|
|
|
|
|
+ try {
|
|
|
|
|
+ const arr = JSON.parse(raw)
|
|
|
|
|
+ return Array.isArray(arr) ? arr.filter(x => typeof x === 'string') : []
|
|
|
|
|
+ } catch (e) { return [] }
|
|
|
|
|
+ },
|
|
|
|
|
+ indicatorCount(raw) { return this.safeParseIndicators(raw).length },
|
|
|
|
|
+ showIndicatorInput() {
|
|
|
|
|
+ this.indicatorInputVisible = true
|
|
|
|
|
+ this.$nextTick(() => this.$refs.indicatorInput && this.$refs.indicatorInput.focus())
|
|
|
|
|
+ },
|
|
|
|
|
+ confirmIndicator() {
|
|
|
|
|
+ const v = (this.indicatorInput || '').trim()
|
|
|
|
|
+ if (v && !this.indicators.includes(v)) this.indicators.push(v)
|
|
|
|
|
+ this.indicatorInput = ''
|
|
|
|
|
+ this.indicatorInputVisible = false
|
|
|
|
|
+ },
|
|
|
|
|
+ removeIndicator(idx) { this.indicators.splice(idx, 1) },
|
|
|
handleCreate() {
|
|
handleCreate() {
|
|
|
this.isEdit = false
|
|
this.isEdit = false
|
|
|
this.form = { typeId: '', displayName: '', family: '', description: '', parserPath: '', minConfidence: 10 }
|
|
this.form = { typeId: '', displayName: '', family: '', description: '', parserPath: '', minConfidence: 10 }
|
|
|
|
|
+ this.indicators = []
|
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
|
},
|
|
},
|
|
|
handleEdit(row) {
|
|
handleEdit(row) {
|
|
|
this.isEdit = true
|
|
this.isEdit = true
|
|
|
this.form = { ...row }
|
|
this.form = { ...row }
|
|
|
|
|
+ this.indicators = this.safeParseIndicators(row.expectedIndicators)
|
|
|
this.dialogVisible = true
|
|
this.dialogVisible = true
|
|
|
},
|
|
},
|
|
|
async handleSubmit() {
|
|
async handleSubmit() {
|
|
|
this.submitting = true
|
|
this.submitting = true
|
|
|
try {
|
|
try {
|
|
|
- await saveReportType(this.form)
|
|
|
|
|
|
|
+ const payload = { ...this.form, expectedIndicators: JSON.stringify(this.indicators) }
|
|
|
|
|
+ await saveReportType(payload)
|
|
|
this.$message.success('保存成功')
|
|
this.$message.success('保存成功')
|
|
|
this.dialogVisible = false
|
|
this.dialogVisible = false
|
|
|
this.fetchTypes()
|
|
this.fetchTypes()
|