|
@@ -31,7 +31,7 @@
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
<el-link type="primary" :underline="false" @click="showFile(scope.row)">{{ scope.row.name
|
|
|
- }}</el-link>
|
|
|
+ }}</el-link>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -373,26 +373,27 @@ export default {
|
|
|
if (!isXml) {
|
|
|
this.$message.error('只能上传 XML 文件');
|
|
|
return false; // 取消上传
|
|
|
- } else {
|
|
|
- try {
|
|
|
- //对上传的xml文件信息进行处理并通过后端接口进行解析返回到父页面进行调整
|
|
|
- const formBody = new FormData()
|
|
|
- formBody.append('file', file)
|
|
|
- await this.ossService.disposeXmlFile(formBody).then((data) => {
|
|
|
- if (JSON.stringify(data) === "{}") {
|
|
|
- this.$message.warning('数电发票:' + file.name + '格式错误');
|
|
|
- this.loading = false;
|
|
|
- // 在验证失败时删除已经添加的行
|
|
|
- const index = this.fileList.findIndex(item => item.name === file.name);
|
|
|
- if (index !== -1) {
|
|
|
- this.deleteFileById(this.fileList[index], index, this.fileList);
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- } catch (error) {
|
|
|
- console.error(error);
|
|
|
- }
|
|
|
}
|
|
|
+ // else {
|
|
|
+ // try {
|
|
|
+ //对上传的xml文件信息进行处理并通过后端接口进行解析返回到父页面进行调整
|
|
|
+ // const formBody = new FormData()
|
|
|
+ // formBody.append('file', file)
|
|
|
+ // await this.ossService.disposeXmlFile(formBody).then((data) => {
|
|
|
+ // if (JSON.stringify(data) === "{}") {
|
|
|
+ // this.$message.warning('数电发票:' + file.name + '格式错误');
|
|
|
+ // this.loading = false;
|
|
|
+ // // 在验证失败时删除已经添加的行
|
|
|
+ // const index = this.fileList.findIndex(item => item.name === file.name);
|
|
|
+ // if (index !== -1) {
|
|
|
+ // this.deleteFileById(this.fileList[index], index, this.fileList);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // } catch (error) {
|
|
|
+ // console.error(error);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
// 其他判定逻辑...
|
|
|
return true; // 允许上传
|
|
|
}
|
|
@@ -523,6 +524,13 @@ export default {
|
|
|
const formBody = new FormData();
|
|
|
formBody.append('file', file.raw);
|
|
|
const data1 = await this.ossService.disposeXmlFile(formBody);
|
|
|
+ console.log(data1);
|
|
|
+
|
|
|
+ if (JSON.stringify(data1) === "{}") {
|
|
|
+ this.$message.warning({ message: `数电发票:${file.raw.name}格式错误` });
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
if (this.commonJS.isNotEmpty(data1.InvoiceNumber)) {
|
|
|
this.$message.warning({ message: `数电发票:${fileName + "<br/>发票号:" + data1.InvoiceNumber}<br/>已经上传,请勿重复上传`, dangerouslyUseHTMLString: true });
|
|
|
return
|
|
@@ -566,6 +574,10 @@ export default {
|
|
|
formBody.append('file', file.raw);
|
|
|
// 调用后端接口解析 XML 文件
|
|
|
let data2 = await this.ossService.disposeXmlFile(formBody);
|
|
|
+ if (JSON.stringify(data2) === "{}") {
|
|
|
+ this.$message.warning({ message: `数电发票:${file.raw.name}格式错误` });
|
|
|
+ return
|
|
|
+ }
|
|
|
if (Object.keys(data2).length > 0) {
|
|
|
this.fieldComparison(data2, this.fileLabel);
|
|
|
// 检查 data 是否包含 BuyerInformationBuyerName 属性
|
|
@@ -609,6 +621,7 @@ export default {
|
|
|
this.dataListNew.push(file)
|
|
|
this.fileList.push(file)
|
|
|
this.dataList = this.dataListNew
|
|
|
+
|
|
|
// 清空 fileList,如果 fileList 不为空
|
|
|
if (fileList && fileList.length > 0) {
|
|
|
this.fileList = [];
|