ソースを参照

评估-报备项目比对处理功能

徐滕 1 週間 前
親
コミット
eac1ca3b54

+ 9 - 0
src/api/program/ProgramProjectListInfoService.js

@@ -246,5 +246,14 @@ export default class ProgramProjectListInfoService {
 			params: {reportNo:reportNo}
 		})
 	}
+	importProvincialFiling (formData) {
+		return request({
+			url: prefix + '/program/projectList/importProvincialFiling',
+			method: 'post',
+			data: formData,
+			responseType: 'blob',
+			headers: { 'Content-Type': 'multipart/form-data' }
+		})
+	}
 
 }

+ 64 - 18
src/views/finance/invoice/InvoiceList.vue

@@ -156,7 +156,6 @@
 
 					<el-button v-if="hasPermission('finance:invoice:ledgerImportExport')" type="success"
 							   @click="ledgerImportExport()" plain style="margin-left: 10px;">台账导入导出</el-button>
-					<input ref="ledgerFileInput" type="file" accept=".xls,.xlsx" style="display:none" @change="handleLedgerFileChange" />
 
 					<el-button type="danger" @click="batchDownloadInvoice()" plain style="margin-left: 10px;"
 						:disabled="$refs.invoiceTable && $refs.invoiceTable.getCheckboxRecords().length === 0">批量下载数电票</el-button>
@@ -313,6 +312,31 @@
 		<InvoiceListImport ref="invoiceListImport" @refreshDataList="refreshList"></InvoiceListImport>
 		<InvoiceListImport ref="invoiceListImport" @refreshDataList="refreshList" @import-error="handleImportError"></InvoiceListImport>
 
+		<!-- 台账导入导出对话框 -->
+		<el-dialog v-model="ledgerImportDialogVisible" title="台账导入导出" width="500" :close-on-click-modal="false">
+			<el-upload
+				ref="ledgerUpload"
+				drag
+				:auto-upload="false"
+				:on-change="handleLedgerFileChange"
+				:on-remove="handleLedgerFileRemove"
+				:limit="1"
+				accept=".xls,.xlsx"
+				:file-list="ledgerFileList"
+				style="text-align: center;"
+			>
+				<i class="el-icon-upload" style="font-size: 48px; color: #909399;"></i>
+				<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+				<template #tip>
+					<div class="el-upload__tip" style="color: #909399;">仅支持 .xls 和 .xlsx 格式的Excel文件</div>
+				</template>
+			</el-upload>
+			<template #footer>
+				<el-button @click="ledgerImportDialogVisible = false">取消</el-button>
+				<el-button type="primary" @click="submitLedgerImport" :loading="ledgerImportLoading" :disabled="ledgerFileList.length === 0">确认导入</el-button>
+			</template>
+		</el-dialog>
+
 	</div>
 </template>
 
@@ -372,7 +396,10 @@ export default {
 			processDefinitionInvalidId: '',
 			procDefInvalidKey: '',
 			dingNoticeEnabled: "",
-			isInitCompleted: false // 初始化完成标识
+			isInitCompleted: false, // 初始化完成标识
+			ledgerImportDialogVisible: false,
+			ledgerFileList: [],
+			ledgerImportLoading: false
 		}
 	},
 	financeInvoiceService: null,
@@ -408,11 +435,11 @@ export default {
 			const $toolbar = this.$refs.toolbarRef;
 			$table.connect($toolbar);
 		});
-		this.getDingNoticeDictValue()
+		//this.getDingNoticeDictValue()
 		this.refreshList();
 	},
 	activated() {
-		this.getDingNoticeDictValue()
+		//this.getDingNoticeDictValue()
 		this.refreshList()
 	},
 	methods: {
@@ -421,28 +448,47 @@ export default {
 			this.$refs.invoiceListImport.init()
 		},
 
-		// 台账导入导出
+		// 台账导入导出 - 打开弹窗
 		ledgerImportExport() {
-			this.$refs.ledgerFileInput.click()
+			this.ledgerImportDialogVisible = true
+			this.ledgerFileList = []
 		},
-		handleLedgerFileChange(event) {
-			const file = event.target.files[0]
-			if (!file) return
-
+		// 台账导入导出 - 文件选择
+		handleLedgerFileChange(file) {
+			const fileName = file.name.toLowerCase()
+			if (!fileName.endsWith('.xls') && !fileName.endsWith('.xlsx')) {
+				this.$message.error('仅支持 .xls 和 .xlsx 格式的Excel文件')
+				this.ledgerFileList = []
+				this.$refs.ledgerUpload.clearFiles()
+				return
+			}
+			this.ledgerFileList = [file]
+		},
+		// 台账导入导出 - 文件移除
+		handleLedgerFileRemove() {
+			this.ledgerFileList = []
+		},
+		// 台账导入导出 - 确认提交
+		submitLedgerImport() {
+			if (this.ledgerFileList.length === 0) {
+				this.$message.warning('请先选择文件')
+				return
+			}
+			const file = this.ledgerFileList[0].raw
 			const formData = new FormData()
 			formData.append('file', file)
 
-			this.loading = true
+			this.ledgerImportLoading = true
 			this.financeInvoiceService.importLedger(formData).then((res) => {
+				this.ledgerImportLoading = false
+				this.ledgerImportDialogVisible = false
+				this.ledgerFileList = []
+				this.$refs.ledgerUpload.clearFiles()
 				this.$utils.downloadExcel(res, '评估公司台账_' + this.moment(new Date()).format('YYYY-MM-DD') + '.xlsx')
 				this.$message.success('台账导出成功')
-				this.loading = false
 			}).catch((err) => {
+				this.ledgerImportLoading = false
 				this.$message.error('台账导入导出失败:' + (err.message || '未知错误'))
-				this.loading = false
-			}).finally(() => {
-				// 清空input,允许重复选择同一文件
-				event.target.value = ''
 			})
 		},
 
@@ -1155,7 +1201,7 @@ export default {
 				this.$message.error('操作失败,请重试')
 			})
 		},
-		getDingNoticeDictValue() {
+		/*getDingNoticeDictValue() {
 			let params = {
 				label: '是否接收钉钉通知',
 				type: "ding_notice_enabled"
@@ -1166,7 +1212,7 @@ export default {
 			}).catch(() => {
 				this.$message.error('操作失败,请重试')
 			})
-		}
+		}*/
 	}
 }
 </script>

+ 6 - 0
src/views/program/commonIssue/CommonIssueList.vue

@@ -99,6 +99,12 @@
               </template>
             </vxe-column>
             <vxe-column field="sortOrder" title="排序" width="80"></vxe-column>
+            <vxe-column field="createByName" title="创建人" width="100"></vxe-column>
+            <vxe-column field="createTime" title="创建时间" width="160">
+              <template #default="scope">
+                <span>{{ scope.row.createTime ? scope.row.createTime.substring(0, 19) : '' }}</span>
+              </template>
+            </vxe-column>
             <vxe-column title="操作" width="200" fixed="right" align="center">
               <template #default="scope">
                 <el-button v-if="hasPermission('program:commonIssue:edit')" text type="primary"

+ 86 - 0
src/views/program/registered/ProjectList.vue

@@ -100,6 +100,7 @@
 					<!--			v-if="(hasPermission('program:registered:add') && overArchiveFlag === 0)" v-show="isOver"-->
 					<el-button v-if="(hasPermission('program:registered:add') && overArchiveFlag === 0)" v-show="isOver"
 						type="primary" icon="el-icon-plus" @click="start()">新建</el-button>
+					<el-button v-if="hasPermission('program:registered:importProvincialFiling')" type="success" icon="el-icon-upload" @click="importDialogVisible = true" plain>项目备案导入</el-button>
 					<a style="color:red;" v-show="!isOver">已登记项目存在信息未填写完成情况,请补充完整(可通过筛选项筛选归档状态为:已归档、超期已归档。进行查看)</a>
 				</template>
 			</vxe-toolbar>
@@ -458,6 +459,30 @@
 		<!--			  </div>-->
 		<!--		  </template>-->
 		<!--	  </el-dialog>-->
+		<!-- 省级备案导入对话框 -->
+		<el-dialog v-model="importDialogVisible" title="省级项目备案数据导入" width="500" :close-on-click-modal="false">
+			<el-upload
+				ref="importUpload"
+				drag
+				:auto-upload="false"
+				:on-change="handleImportFileChange"
+				:on-remove="handleImportFileRemove"
+				:limit="1"
+				accept=".xls,.xlsx"
+				:file-list="importFileList"
+				style="text-align: center;"
+			>
+				<i class="el-icon-upload" style="font-size: 48px; color: #909399;"></i>
+				<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+				<template #tip>
+					<div class="el-upload__tip" style="color: #909399;">仅支持 .xls 和 .xlsx 格式的Excel文件</div>
+				</template>
+			</el-upload>
+			<template #footer>
+				<el-button @click="importDialogVisible = false">取消</el-button>
+				<el-button type="primary" @click="submitImport" :loading="importLoading" :disabled="importFileList.length === 0">确认导入</el-button>
+			</template>
+		</el-dialog>
 	</div>
 </template>
 
@@ -490,6 +515,9 @@ export default {
 			applyUserName: '',
 			showHideItem: false,
 			dialogVisible: false,
+			importDialogVisible: false,
+			importFileList: [],
+			importLoading: false,
 			showHideIcon: 'el-icon-arrow-down',
 			showHideName: '展示',
 			searchForm: {
@@ -2102,6 +2130,64 @@ export default {
 			console.log(user[0].name)
 			this.searchForm.createById = user[0].name
 		},
+		// 省级备案导入 - 文件选择
+		handleImportFileChange(file) {
+			const fileName = file.name.toLowerCase()
+			if (!fileName.endsWith('.xls') && !fileName.endsWith('.xlsx')) {
+				this.$message.error('仅支持 .xls 和 .xlsx 格式的Excel文件')
+				this.importFileList = []
+				this.$refs.importUpload.clearFiles()
+				return
+			}
+			this.importFileList = [file]
+		},
+		// 省级备案导入 - 文件移除
+		handleImportFileRemove() {
+			this.importFileList = []
+		},
+		// 省级备案导入 - 提交
+		submitImport() {
+			if (this.importFileList.length === 0) {
+				this.$message.warning('请先选择文件')
+				return
+			}
+			const file = this.importFileList[0].raw
+			const formData = new FormData()
+			formData.append('file', file)
+			this.importLoading = true
+			this.programProjectListInfoService.importProvincialFiling(formData).then((res) => {
+				this.importLoading = false
+				this.importDialogVisible = false
+				this.importFileList = []
+				this.$refs.importUpload.clearFiles()
+				// 触发文件下载
+				const blob = new Blob([res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' })
+				const url = window.URL.createObjectURL(blob)
+				const link = document.createElement('a')
+				link.href = url
+				link.download = '省级备案数据_' + file.name
+				link.click()
+				window.URL.revokeObjectURL(url)
+				this.$message.success('导入成功')
+			}).catch((err) => {
+				this.importLoading = false
+				// 尝试从blob中解析错误信息
+				if (err.response && err.response.data) {
+					const reader = new FileReader()
+					reader.onload = () => {
+						try {
+							const errorMsg = JSON.parse(reader.result)
+							this.$message.error(errorMsg.message || '导入失败')
+						} catch (e) {
+							this.$message.error('导入失败,请检查文件格式')
+						}
+					}
+					reader.readAsText(err.response.data)
+				} else {
+					this.$message.error('导入失败:' + (err.message || '未知错误'))
+				}
+			})
+		},
 	}
 }
 </script>