修改crud代码,增加textarea类型支持。修改版本管理展示
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
</template>
|
||||
<!-- textarea 输入框 -->
|
||||
|
||||
<template v-else-if="item.type === 'textarea' || item.type === undefined">
|
||||
<template v-else-if="item.type === 'textarea'">
|
||||
<el-input v-model="formData[item.prop]" type="textarea" v-bind="item.attrs" />
|
||||
</template>
|
||||
<!-- Select 选择器 -->
|
||||
|
||||
@@ -40,8 +40,8 @@
|
||||
<el-input v-model="formData[item.prop]" v-bind="item.attrs" />
|
||||
</template>
|
||||
<!-- textarea 输入框 -->
|
||||
<template v-if="item.type === 'textarea' || item.type === undefined">
|
||||
<el-input v-model="formData[item.prop]" v-bind="item.attrs" />
|
||||
<template v-if="item.type === 'textarea'">
|
||||
<el-input v-model="formData[item.prop]" v-bind="item.attrs" type="textarea" />
|
||||
</template>
|
||||
<!-- Select 选择器 -->
|
||||
<template v-else-if="item.type === 'select'">
|
||||
@@ -161,6 +161,10 @@
|
||||
<template v-if="item.type === 'input' || item.type === undefined">
|
||||
<el-input v-model="formData[item.prop]" v-bind="item.attrs" />
|
||||
</template>
|
||||
<!-- textarea 输入框 -->
|
||||
<template v-if="item.type === 'textarea'">
|
||||
<el-input v-model="formData[item.prop]" v-bind="item.attrs" type="textarea" />
|
||||
</template>
|
||||
<!-- Select 选择器 -->
|
||||
<template v-else-if="item.type === 'select'">
|
||||
<el-select v-model="formData[item.prop]" v-bind="item.attrs">
|
||||
|
||||
@@ -49,7 +49,7 @@ import {
|
||||
UploadRequestOptions,
|
||||
} from "element-plus";
|
||||
|
||||
import FileAPI, { FileInfo } from "@/api/file";
|
||||
import CommonApi, { FileInfo, uploadResponse } from "@/api/account/common";
|
||||
|
||||
const props = defineProps({
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ function handleUpload(options: UploadRequestOptions) {
|
||||
formData.append(key, props.data[key]);
|
||||
});
|
||||
|
||||
FileAPI.upload(formData)
|
||||
CommonApi.upload(formData)
|
||||
.then((data) => {
|
||||
resolve(data);
|
||||
})
|
||||
@@ -187,9 +187,9 @@ const handleProgress = (event: UploadProgressEvent) => {
|
||||
/**
|
||||
* 上传成功
|
||||
*/
|
||||
const handleSuccess = (fileInfo: FileInfo) => {
|
||||
const handleSuccess = (fileInfo: string) => {
|
||||
ElMessage.success("上传成功");
|
||||
modelValue.value = [...modelValue.value, fileInfo.url];
|
||||
modelValue.value = [...modelValue.value, fileInfo];
|
||||
};
|
||||
|
||||
const handleError = (error: any) => {
|
||||
@@ -200,19 +200,19 @@ const handleError = (error: any) => {
|
||||
* 删除文件
|
||||
*/
|
||||
function handleRemove(fileUrl: string) {
|
||||
FileAPI.delete(fileUrl).then(() => {
|
||||
modelValue.value = modelValue.value.filter((url) => url !== fileUrl);
|
||||
});
|
||||
// CommonApi.delete(fileUrl).then(() => {
|
||||
modelValue.value = modelValue.value.filter((url) => url !== fileUrl);
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
function handleDownload(file: UploadUserFile) {
|
||||
const { url, name } = file;
|
||||
if (url) {
|
||||
FileAPI.download(url, name);
|
||||
}
|
||||
// const { url, name } = file;
|
||||
// if (url) {
|
||||
// CommonApi.download(url, name);
|
||||
// }
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user