提交 b9f16523 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 新增标签权重字段

上级 64ae5f48
...@@ -29,7 +29,8 @@ const form = reactive({ ...@@ -29,7 +29,8 @@ const form = reactive({
update_status: '2', update_status: '2',
update_rule: { type: 1, info: 1 }, update_rule: { type: 1, info: 1 },
status: '1', status: '1',
label: '' label: '',
weight: 0
}) })
watchEffect(() => { watchEffect(() => {
if (props.data) { if (props.data) {
...@@ -39,7 +40,7 @@ watchEffect(() => { ...@@ -39,7 +40,7 @@ watchEffect(() => {
} catch (error) { } catch (error) {
console.log(error) console.log(error)
} }
Object.assign(form, props.data, { update_rule: updateRule }) Object.assign(form, props.data, { update_rule: updateRule, weight: parseFloat(props.data.weight) })
} }
}) })
...@@ -56,7 +57,15 @@ function handleSubmit() { ...@@ -56,7 +57,15 @@ function handleSubmit() {
} }
// 新建 // 新建
function handleCreate() { function handleCreate() {
const params = pick({ ...form, update_rule: JSON.stringify(form.update_rule) }, ['name', 'type_id', 'update_status', 'update_rule', 'status', 'label']) const params = pick({ ...form, update_rule: JSON.stringify(form.update_rule) }, [
'name',
'type_id',
'update_status',
'update_rule',
'status',
'label',
'weight'
])
createLabel(params).then(() => { createLabel(params).then(() => {
ElMessage({ message: '创建成功', type: 'success' }) ElMessage({ message: '创建成功', type: 'success' })
emit('update') emit('update')
...@@ -65,7 +74,16 @@ function handleCreate() { ...@@ -65,7 +74,16 @@ function handleCreate() {
} }
// 修改 // 修改
function handleUpdate() { function handleUpdate() {
const params = pick({ ...form, update_rule: JSON.stringify(form.update_rule) }, ['id', 'name', 'type_id', 'update_status', 'update_rule', 'status', 'label']) const params = pick({ ...form, update_rule: JSON.stringify(form.update_rule) }, [
'id',
'name',
'type_id',
'update_status',
'update_rule',
'status',
'label',
'weight'
])
updateLabel(params).then(() => { updateLabel(params).then(() => {
ElMessage({ message: '修改成功', type: 'success' }) ElMessage({ message: '修改成功', type: 'success' })
emit('update') emit('update')
...@@ -90,6 +108,9 @@ function handleUpdate() { ...@@ -90,6 +108,9 @@ function handleUpdate() {
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="标签权重" prop="weight">
<el-slider v-model="form.weight" :max="1" :step="0.1" />
</el-form-item>
<el-form-item label="更新频率" prop="update_status"> <el-form-item label="更新频率" prop="update_status">
<el-radio-group v-model="form.update_status"> <el-radio-group v-model="form.update_status">
<el-radio v-for="item in updateStatusRuleList" :key="item.value" :value="item.value" :disabled="item.value === '1'"> <el-radio v-for="item in updateStatusRuleList" :key="item.value" :value="item.value" :disabled="item.value === '1'">
......
...@@ -27,6 +27,7 @@ export interface Label { ...@@ -27,6 +27,7 @@ export interface Label {
updated_time: string updated_time: string
updated_operator: Operator updated_operator: Operator
label: string label: string
weight: string
} }
// 标签更新规则 // 标签更新规则
export interface LabelUpdateRule { export interface LabelUpdateRule {
......
...@@ -66,6 +66,7 @@ const listOptions = computed(() => { ...@@ -66,6 +66,7 @@ const listOptions = computed(() => {
} }
}, },
{ label: '标签目录', prop: 'tag_type.name' }, { label: '标签目录', prop: 'tag_type.name' },
{ label: '标签权重', prop: 'weight' },
{ {
label: '更新频率', label: '更新频率',
prop: 'update_status', prop: 'update_status',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论