优化结构
This commit is contained in:
@@ -18,21 +18,6 @@
|
||||
<el-form-item label="内容:" prop="content">
|
||||
<RichEdit v-model="formData.content" />
|
||||
</el-form-item>
|
||||
<el-form-item label="作者:" prop="userID">
|
||||
<el-select
|
||||
v-model="formData.userID"
|
||||
placeholder="请选择作者"
|
||||
style="width: 100%"
|
||||
:clearable="true"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, key) in dataSource.userID"
|
||||
:key="key"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件:" prop="attachments">
|
||||
<SelectFile v-model="formData.attachments" />
|
||||
</el-form-item>
|
||||
@@ -47,7 +32,6 @@
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
getInfoDataSource,
|
||||
createInfo,
|
||||
updateInfo,
|
||||
findInfo
|
||||
@@ -72,21 +56,12 @@
|
||||
const formData = ref({
|
||||
title: '',
|
||||
content: '',
|
||||
userID: undefined,
|
||||
attachments: []
|
||||
})
|
||||
// 验证规则
|
||||
const rule = reactive({})
|
||||
|
||||
const elFormRef = ref()
|
||||
const dataSource = ref([])
|
||||
const getDataSourceFunc = async () => {
|
||||
const res = await getInfoDataSource()
|
||||
if (res.code === 0) {
|
||||
dataSource.value = res.data
|
||||
}
|
||||
}
|
||||
getDataSourceFunc()
|
||||
|
||||
// 初始化方法
|
||||
const init = async () => {
|
||||
|
||||
@@ -108,9 +108,7 @@
|
||||
<el-table-column align="left" label="标题" prop="title" width="120" />
|
||||
<el-table-column align="left" label="作者" prop="userID" width="120">
|
||||
<template #default="scope">
|
||||
<span>{{
|
||||
filterDataSource(dataSource.userID, scope.row.userID)
|
||||
}}</span>
|
||||
<span>{{ filterDataSource(dataSource.userID, scope.row.userID) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="附件" prop="attachments" width="200">
|
||||
@@ -199,21 +197,6 @@
|
||||
<el-form-item label="内容:" prop="content">
|
||||
<RichEdit v-model="formData.content" />
|
||||
</el-form-item>
|
||||
<el-form-item label="作者:" prop="userID">
|
||||
<el-select
|
||||
v-model="formData.userID"
|
||||
placeholder="请选择作者"
|
||||
style="width: 100%"
|
||||
:clearable="true"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, key) in dataSource.userID"
|
||||
:key="key"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="附件:" prop="attachments">
|
||||
<SelectFile v-model="formData.attachments" />
|
||||
</el-form-item>
|
||||
@@ -254,15 +237,12 @@
|
||||
const formData = ref({
|
||||
title: '',
|
||||
content: '',
|
||||
userID: undefined,
|
||||
attachments: []
|
||||
})
|
||||
const dataSource = ref([])
|
||||
const dataSource = ref({ userID: [] })
|
||||
const getDataSourceFunc = async () => {
|
||||
const res = await getInfoDataSource()
|
||||
if (res.code === 0) {
|
||||
dataSource.value = res.data
|
||||
}
|
||||
if (res.code === 0) dataSource.value = res.data
|
||||
}
|
||||
getDataSourceFunc()
|
||||
|
||||
@@ -457,7 +437,6 @@
|
||||
formData.value = {
|
||||
title: '',
|
||||
content: '',
|
||||
userID: undefined,
|
||||
attachments: []
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user