|
|
@@ -48,6 +48,12 @@
|
|
|
<StatusTag :type="row.isActive ? 'success' : 'info'" :text="row.isActive ? '启用' : '停用'" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="关联商品" width="160">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span v-if="row.linkedProductId">{{ row.productName || ('商品#' + row.linkedProductId) }}</span>
|
|
|
+ <span v-else class="text-faint">— 未链接</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="脚本状态" width="110">
|
|
|
<template slot-scope="{ row }">
|
|
|
<StatusTag v-if="row.scriptStatus === 'generating'" type="warning" size="small" text="生成中" />
|
|
|
@@ -104,6 +110,18 @@
|
|
|
<el-form-item label="识别阈值">
|
|
|
<el-input-number v-model="form.minConfidence" :min="1" :max="100" />
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="关联商品">
|
|
|
+ <el-select
|
|
|
+ v-model="form.linkedProductId"
|
|
|
+ placeholder="选择关联商品(清空=不可链接)"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-option v-for="p in products" :key="p.id" :label="p.name" :value="p.id" />
|
|
|
+ </el-select>
|
|
|
+ <div class="el-form-item-msg">配置后小程序报告上传页该类型展示「查看商品」入口;留空=不可链接</div>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="采集指标">
|
|
|
<el-tag
|
|
|
v-for="(tag, idx) in indicators"
|
|
|
@@ -184,6 +202,7 @@
|
|
|
<script>
|
|
|
import { getReportTypes, saveReportType, toggleReportType, deleteReportType,
|
|
|
getFingerprints, saveFingerprint, deleteFingerprint } from '@/api/reportParser'
|
|
|
+import { getProductList } from '@/api/admin'
|
|
|
import SortMixin from '@/mixins/SortMixin'
|
|
|
|
|
|
export default {
|
|
|
@@ -195,8 +214,9 @@ export default {
|
|
|
types: [], keyword: '',
|
|
|
sortableColumns: { id: 'ID', typeId: '类型标识', displayName: '显示名称', family: '家族', parserPath: '解析器路径', minConfidence: '阈值', source: '来源' },
|
|
|
dialogVisible: false, isEdit: false,
|
|
|
- form: { typeId: '', displayName: '', family: '', description: '', parserPath: '', minConfidence: 10 },
|
|
|
+ form: { typeId: '', displayName: '', family: '', description: '', parserPath: '', minConfidence: 10, linkedProductId: null },
|
|
|
indicators: [], indicatorInput: '', indicatorInputVisible: false,
|
|
|
+ products: [],
|
|
|
fpDialogVisible: false, currentType: null,
|
|
|
fingerprints: [], fpFormVisible: false,
|
|
|
fpForm: { pattern: '', weight: 10, isExclusion: false, sortOrder: 0 },
|
|
|
@@ -212,11 +232,20 @@ export default {
|
|
|
(t.family || '').toLowerCase().includes(kw))
|
|
|
}
|
|
|
},
|
|
|
- mounted() { this.fetchTypes() },
|
|
|
+ mounted() { this.fetchTypes(); this.loadProducts() },
|
|
|
methods: {
|
|
|
loadList() {
|
|
|
this.fetchTypes()
|
|
|
},
|
|
|
+ async loadProducts() {
|
|
|
+ try {
|
|
|
+ const res = await getProductList({ page: 1, size: 100 })
|
|
|
+ const data = res.data || {}
|
|
|
+ this.products = (data.records || []).map(p => ({ id: p.id, name: p.name }))
|
|
|
+ } catch (e) {
|
|
|
+ this.products = []
|
|
|
+ }
|
|
|
+ },
|
|
|
async fetchTypes() {
|
|
|
this.loading = true
|
|
|
try {
|
|
|
@@ -248,13 +277,13 @@ export default {
|
|
|
removeIndicator(idx) { this.indicators.splice(idx, 1) },
|
|
|
handleCreate() {
|
|
|
this.isEdit = false
|
|
|
- this.form = { typeId: '', displayName: '', family: '', description: '', parserPath: '', minConfidence: 10 }
|
|
|
+ this.form = { typeId: '', displayName: '', family: '', description: '', parserPath: '', minConfidence: 10, linkedProductId: null }
|
|
|
this.indicators = []
|
|
|
this.dialogVisible = true
|
|
|
},
|
|
|
handleEdit(row) {
|
|
|
this.isEdit = true
|
|
|
- this.form = { ...row }
|
|
|
+ this.form = { ...row, linkedProductId: row.linkedProductId != null ? row.linkedProductId : null }
|
|
|
this.indicators = this.safeParseIndicators(row.expectedIndicators)
|
|
|
this.dialogVisible = true
|
|
|
},
|