taskid:282 remark:'commit'
This commit is contained in:
@@ -172,7 +172,6 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, defineEmits, toRaw } from 'vue';
|
||||
import { http } from '/nerv-lib/util/http';
|
||||
import { NSAxios } from '/nerv-lib/util/http/axios';
|
||||
import { UploadOutlined } from '@ant-design/icons-vue';
|
||||
import type { UploadChangeParam, UploadProps } from 'ant-design-vue';
|
||||
import { Pagination, Modal, message } from 'ant-design-vue';
|
||||
@@ -292,7 +291,12 @@
|
||||
visible.value = true;
|
||||
formState.value.id = record.id;
|
||||
fetch(uploadPic.select, { bizId: record.id, bizTpye: 1 }).then((res) => {
|
||||
fileList.value = res.data;
|
||||
fileList.value = res.data.map((item) => ({
|
||||
uid: item.id.toString(), // 使用文件的id作为唯一标识
|
||||
name: item.fileName, // 文件名
|
||||
status: 'done', // 设置默认状态为已完成
|
||||
url: item.filePath, // 文件的URL,这里假设用示例的URL格式
|
||||
}));
|
||||
});
|
||||
formState.value = JSON.parse(JSON.stringify(record));
|
||||
if (formState.value.expenditure === 0) {
|
||||
@@ -329,7 +333,6 @@
|
||||
cancelText: '取消',
|
||||
onOk() {
|
||||
fetch(carbonAssets.delete, { ids: id }).then((res) => {
|
||||
debugger;
|
||||
message.success('操作成功!');
|
||||
getDetailList();
|
||||
});
|
||||
@@ -398,18 +401,11 @@
|
||||
};
|
||||
// 上传附件
|
||||
const fileList = ref<UploadProps['fileList']>([]);
|
||||
// const headers = {
|
||||
// authorization: 'authorization-text',
|
||||
// };
|
||||
// const beforeUpload = (file: File) => {
|
||||
// return false; // 返回 true 表示允许上传
|
||||
// };
|
||||
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
|
||||
// fileList.value = [...(fileList.value || []), file];
|
||||
return false;
|
||||
};
|
||||
const handleChange = (info: UploadChangeParam) => {
|
||||
fileList.value = [...info.fileList]
|
||||
fileList.value = [...info.fileList];
|
||||
if (info.file.status !== 'uploading') {
|
||||
console.log(info.file, info.fileList);
|
||||
}
|
||||
@@ -431,20 +427,6 @@
|
||||
const uploadQuery = ref({
|
||||
bizTpye: 1,
|
||||
});
|
||||
const config = {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
};
|
||||
function createHttp() {
|
||||
/** todo 临时去除超时时间 */
|
||||
return new NSAxios({
|
||||
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
|
||||
withCredentials: true,
|
||||
});
|
||||
}
|
||||
const uploadHttp = createHttp();
|
||||
const url = '/carbon-smart/api/common/file/uploadfiles'; // 请求api
|
||||
const onSubmit = () => {
|
||||
formRef.value
|
||||
.validate()
|
||||
@@ -460,16 +442,11 @@
|
||||
if (res.data.id && fileList.value.length !== 0) {
|
||||
// uploadQuery.value.bizId = res.data.id;
|
||||
const formData = ref(new FormData());
|
||||
fileList.value.forEach(file => {
|
||||
console.log(file,'xxy');
|
||||
|
||||
formData.value.append('files[]', file);
|
||||
fileList.value.forEach((file) => {
|
||||
formData.value.append('files', file.originFileObj);
|
||||
});
|
||||
formData.value.append('bizTpye', 1);
|
||||
formData.value.append('bizId', res.data.id);
|
||||
// uploadQuery.value.files = formData.value;
|
||||
// uploadQuery.value.files = fileList.value;
|
||||
debugger;
|
||||
formData.value.append('bizTpye', 1);
|
||||
formData.value.append('bizId', res.data.id);
|
||||
fetch(uploadPic.uploadfiles, formData.value)
|
||||
.then((res) => {
|
||||
message.success('操作成功!');
|
||||
@@ -479,18 +456,6 @@
|
||||
.catch((error) => {
|
||||
console.log('error', error);
|
||||
});
|
||||
console.log(config,'xxy555');
|
||||
|
||||
// uploadHttp
|
||||
// .post(url, formData.value, config.headers)
|
||||
// .then((res) => {
|
||||
// console.log(res);
|
||||
|
||||
// })
|
||||
// .catch((res) => {
|
||||
// console.log(res);
|
||||
|
||||
// });
|
||||
} else {
|
||||
message.success('操作成功!');
|
||||
visible.value = false;
|
||||
|
Reference in New Issue
Block a user