修改测试问题
This commit is contained in:
@@ -275,6 +275,7 @@
|
||||
<a-tree-select
|
||||
v-model:value="editFormState.collectionNode"
|
||||
:tree-line="true"
|
||||
@select="selectNode"
|
||||
:tree-data="collectingNodes">
|
||||
</a-tree-select>
|
||||
</a-form-item>
|
||||
@@ -320,8 +321,9 @@
|
||||
<a-upload
|
||||
v-model:file-list="fileList"
|
||||
name="file"
|
||||
action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
|
||||
:headers="headers"
|
||||
accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf"
|
||||
@remove="handleFileRemove"
|
||||
:before-upload="beforeUpload"
|
||||
@change="handleChange">
|
||||
<a-button>
|
||||
<upload-outlined></upload-outlined>
|
||||
@@ -353,6 +355,7 @@
|
||||
energyConsumption,
|
||||
carbonEmissionFactorLibrary,
|
||||
carbonInventoryCheck,
|
||||
uploadPic,
|
||||
} from '/@/api/carbonEmissionFactorLibrary';
|
||||
import { group } from '/@/api/deviceManage';
|
||||
import { debug, log } from 'node:console';
|
||||
@@ -844,6 +847,9 @@
|
||||
// 点击凭证弹出框
|
||||
const openVoucher = ref(false);
|
||||
const downLoadVoucher = () => {
|
||||
fetch(carbonInventoryCheck.voucherDownloadList, { bizType: 2 }).then((res) => {
|
||||
voucherData.value = res.data
|
||||
});
|
||||
openVoucher.value = true;
|
||||
};
|
||||
const selectedRowKeys = ref([]);
|
||||
@@ -851,29 +857,7 @@
|
||||
selectedRowKeys.value = selectedKeys;
|
||||
};
|
||||
|
||||
const voucherData = [
|
||||
{
|
||||
key: '1',
|
||||
name: 'John Brown',
|
||||
age: 32,
|
||||
address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
|
||||
tags: ['nice', 'developer'],
|
||||
},
|
||||
{
|
||||
key: '2',
|
||||
name: 'Jim Green',
|
||||
age: 42,
|
||||
address: 'London No. 2 Lake Park, London No. 2 Lake Park',
|
||||
tags: ['loser'],
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
name: 'Joe Black',
|
||||
age: 32,
|
||||
address: 'Sidney No. 1 Lake Park, Sidney No. 1 Lake Park',
|
||||
tags: ['cool', 'teacher'],
|
||||
},
|
||||
];
|
||||
const voucherData = ref([]);
|
||||
const onCloseVoucher = () => {
|
||||
openVoucher.value = false;
|
||||
};
|
||||
@@ -909,6 +893,14 @@
|
||||
editFormState.value.collectionNode = record.carbonSource;
|
||||
editFormState.value.factorId = record.factorId;
|
||||
selectedRowKeysEdit.value = [record.factorId];
|
||||
fetch(uploadPic.select, { bizId: record.id, bizType: 2 }).then((res) => {
|
||||
fileList.value = res.data.map((item) => ({
|
||||
uid: item.id.toString(), // 使用文件的id作为唯一标识
|
||||
name: item.fileName, // 文件名
|
||||
status: 'done', // 设置默认状态为已完成
|
||||
url: item.filePath, // 文件的URL,这里假设用示例的URL格式
|
||||
}));
|
||||
});
|
||||
editData.value = true;
|
||||
};
|
||||
const getNewTable = () => {
|
||||
@@ -946,23 +938,35 @@
|
||||
},
|
||||
);
|
||||
};
|
||||
const selectNode = (value) => {
|
||||
debugger;
|
||||
};
|
||||
// 上传附件
|
||||
const fileList = ref<UploadProps['fileList']>([]);
|
||||
const beforeUpload: UploadProps['beforeUpload'] = (file) => {
|
||||
return false;
|
||||
};
|
||||
const handleChange = (info: UploadChangeParam) => {
|
||||
fileList.value = [...info.fileList];
|
||||
if (info.file.status !== 'uploading') {
|
||||
console.log(info.file, info.fileList);
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
message.success(`${info.file.name} file uploaded successfully`);
|
||||
message.success(`${info.file.name} 文件上传成功`);
|
||||
} else if (info.file.status === 'error') {
|
||||
message.error(`${info.file.name} file upload failed.`);
|
||||
message.error(`${info.file.name} 文件上传失败`);
|
||||
}
|
||||
};
|
||||
|
||||
const fileList = ref([]);
|
||||
const headers = {
|
||||
authorization: 'authorization-text',
|
||||
const handleFileRemove = (file) => {
|
||||
const newFileList = [];
|
||||
fileList.value.forEach((item) => {
|
||||
if (item.uid !== file.uid) {
|
||||
newFileList.push(item);
|
||||
}
|
||||
});
|
||||
fileList.value = newFileList;
|
||||
};
|
||||
// 编辑数据提交
|
||||
// 数据提交;
|
||||
const submitEditData = () => {
|
||||
editFormRef.value
|
||||
.validate()
|
||||
@@ -978,8 +982,26 @@
|
||||
editFormState.value.collectionNode = editFormState.value.collectionNode.value;
|
||||
}
|
||||
fetch(carbonInventoryCheck.updateTable, editFormState.value).then((res) => {
|
||||
editData.value = false;
|
||||
getPFYTableList(getTableId.value);
|
||||
if (fileList.value.length !== 0) {
|
||||
const formData = ref(new FormData());
|
||||
fileList.value.forEach((file) => {
|
||||
formData.value.append('files', file.originFileObj);
|
||||
});
|
||||
formData.value.append('bizType', 2);
|
||||
formData.value.append('bizId', editFormState.value.id);
|
||||
fetch(uploadPic.uploadfiles, formData.value)
|
||||
.then((res) => {
|
||||
message.success('操作成功!');
|
||||
editData.value = false;
|
||||
getPFYTableList(getTableId.value);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error', error);
|
||||
});
|
||||
} else {
|
||||
editData.value = false;
|
||||
getPFYTableList(getTableId.value);
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
|
Reference in New Issue
Block a user