mirror of
https://gitee.com/anji-plus/report.git
synced 2026-04-13 10:38:34 +08:00
报表管理图片上传
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
<!--
|
||||
此组件问题很多后面有时间重写
|
||||
-->
|
||||
<template>
|
||||
<div class="w-full">
|
||||
<div class="upload">
|
||||
@@ -87,7 +90,7 @@
|
||||
props: {
|
||||
...basicProps,
|
||||
},
|
||||
emits: ['uploadChange', 'delete'],
|
||||
emits: ['uploadChange', 'delete', 'update:value'],
|
||||
setup(props, { emit }) {
|
||||
const getCSSProperties = computed(() => {
|
||||
return {
|
||||
@@ -110,9 +113,7 @@
|
||||
watch(
|
||||
() => props.value,
|
||||
() => {
|
||||
state.imgList = props.value.map((item) => {
|
||||
return getImgUrl(item);
|
||||
});
|
||||
state.imgList = props.value ? [props.value] : []
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
@@ -135,6 +136,7 @@
|
||||
state.originalImgList.splice(index, 1);
|
||||
emit('uploadChange', state.originalImgList);
|
||||
emit('delete', state.originalImgList);
|
||||
emit('update:value', '')
|
||||
},
|
||||
onNegativeClick: () => {},
|
||||
});
|
||||
@@ -179,12 +181,14 @@
|
||||
const { code } = res;
|
||||
const message = res.msg || res.message || '上传失败';
|
||||
const result = res[infoField];
|
||||
console.log('asd', result)
|
||||
//成功
|
||||
if (code === ResultEnum.SUCCESS) {
|
||||
let imgUrl: string = getImgUrl(result.photo);
|
||||
let imgUrl: string = getImgUrl(result.urlPath);
|
||||
state.imgList.push(imgUrl);
|
||||
state.originalImgList.push(result.photo);
|
||||
state.originalImgList.push(result.urlPath);
|
||||
emit('uploadChange', state.originalImgList);
|
||||
emit('update:value', state.originalImgList[0])
|
||||
} else message.error(message);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* @Author: qianlishi
|
||||
* @Date: 2025-01-03 01:01:14
|
||||
* @LastEditors: qianlishi
|
||||
* @LastEditTime: 2025-01-10 16:55:03
|
||||
* @LastEditTime: 2025-01-13 22:34:35
|
||||
*/
|
||||
import { computed, h } from 'vue';
|
||||
import { cloneDeep } from 'lodash-es';
|
||||
@@ -11,6 +11,10 @@ import { isObject } from '@/utils/is';
|
||||
import { NButton, NTag } from 'naive-ui'
|
||||
import { enable } from '@/enums/common'
|
||||
import { FormSchema } from '@/components/Base/Jsq-crud/src/components/Jsq-searchForm';
|
||||
import { useGlobSetting } from '@/hooks/setting';
|
||||
import { useUserStore } from '@/store/modules/user';
|
||||
const globSetting = useGlobSetting();
|
||||
const userStore = useUserStore();
|
||||
|
||||
// 表单配置
|
||||
export const getFormSchemas = ({ params }: Record<string, any>) => {
|
||||
@@ -160,6 +164,18 @@ export const getDialogRecordingSchemas = () => {
|
||||
dictCode: "ENABLE_FLAG"
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '报表缩略图',
|
||||
field: 'reportImage',
|
||||
component: "BasicUpload",
|
||||
componentProps: {
|
||||
action: globSetting.apiUrl + '/file/upload',
|
||||
headers: {
|
||||
'authorization': userStore.token
|
||||
},
|
||||
max: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
return schemas
|
||||
|
||||
Reference in New Issue
Block a user