fix: form solts

This commit is contained in:
xingyu4j
2022-12-06 14:12:57 +08:00
parent 1bdde35dc9
commit f841ca11a5
9 changed files with 20 additions and 55 deletions

View File

@ -64,8 +64,8 @@
:rules="rules"
ref="formRef"
>
<template #tags>
<el-select v-model="tags" multiple placeholder="请选择">
<template #tags="form">
<el-select v-model="form['tags']" multiple placeholder="请选择">
<el-option v-for="item in tagsOptions" :key="item" :label="item" :value="item" />
</el-select>
</template>
@ -130,7 +130,6 @@ const dialogVisible = ref(false) // 是否显示弹出层
const dialogTitle = ref('edit') // 弹出层标题
const formRef = ref<FormExpose>() // 表单 Ref
const detailData = ref() // 详情 Ref
const tags = ref()
// 获取标签
const tagsOptions = ref()
@ -148,7 +147,6 @@ const setDialogTile = (type: string) => {
// 新增操作
const handleCreate = () => {
tags.value = null
setDialogTile('create')
}
@ -162,7 +160,6 @@ const handleUpdate = async (rowId: number) => {
setDialogTile('update')
// 设置数据
const res = await SensitiveWordApi.getSensitiveWordApi(rowId)
tags.value = res.tags
unref(formRef)?.setValues(res)
}
@ -188,7 +185,6 @@ const submitForm = async () => {
// 提交请求
try {
const data = unref(formRef)?.formModel as SensitiveWordApi.SensitiveWordVO
data.tags = tags.value
if (actionType.value === 'create') {
await SensitiveWordApi.createSensitiveWordApi(data)
message.success(t('common.createSuccess'))