Browse Source

报告号替换导入导出

sangwenwei 5 months ago
parent
commit
977e34da02

+ 8 - 1
src/api/cw/reportManagement/ProjectReportService.js

@@ -282,5 +282,12 @@ saveSignatureAnnotator: function (inputForm) {
 			params: {invoiceNumber: invoiceNumber,id:id}
 		})
 	},
-
+	numberReplace: function (data) {
+		return request({
+			url: prefix + '/cwProjectReport/numberReplace',
+			method: 'post',
+			data: data,
+			responseType: 'blob'
+		})
+	},
 }

+ 121 - 0
src/views/cw/reportManagement/NumberReplace.vue

@@ -0,0 +1,121 @@
+<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
+	<div>
+		<el-dialog
+			:title="title"
+			:close-on-click-modal="false"
+			draggable
+			width="1000px"
+			height="500px"
+			@close="close"
+			append-to-body
+			v-model="visible">
+
+				<el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="status === 'audit' || status === 'taskFormDetail'"
+						 label-width="135px" @submit.native.prevent>
+					<el-row  :gutter="0">
+						<el-col :span="12">
+							<el-form-item label="年份" prop="year"
+										  :rules="[{required: true, message:'请输入年份', trigger:'blur'}
+                   ]">
+								<el-input v-model="inputForm.year" @input="validateNumber" placeholder="请填写年份" clearable></el-input>
+							</el-form-item>
+						</el-col>
+
+					</el-row>
+					<el-row :gutter="0">
+						<el-col :span="12">
+							<el-form-item label="附件">
+							<el-upload
+								action=""
+								:auto-upload="false"
+								:on-change="beforeUploadDetail"
+								:show-file-list="true">
+								<el-button type="primary">导入全部</el-button>
+							</el-upload>
+							</el-form-item>
+						</el-col>
+					</el-row>
+
+				</el-form>
+
+
+			<template #footer>
+						<span class="dialog-footer">
+					  		<el-button  @click="close()" icon="el-icon-circle-close">关闭</el-button>
+					  		<el-button  v-if="method !== 'view'" type="primary" icon="el-icon-circle-check" @click="doSubmit()">确定</el-button>
+					 	</span>
+				</template>
+		</el-dialog>
+	</div>
+</template>
+
+<script>
+	import projectReportService from '@/api/cw/reportManagement/ProjectReportService'
+	export default {
+    	data(){
+    		return {
+				visible: false,
+				title: '',
+				inputForm:{
+					year:"",
+					file:[]
+				}
+			}
+		},
+		components: {
+		},
+		methods: {
+			init(){
+				this.visible = true
+				this.title = '报告号替换'
+				this.inputForm={
+					year:'',
+					file:[]
+				}
+			},
+			validateNumber() {
+				// 只允许输入数字
+				this.inputForm.year = this.inputForm.year.replace(/\D/g, '');
+			},
+			beforeUploadDetail(file){
+				this.inputForm.file.push(file)
+			},
+			doSubmit(){
+				if (this.commonJS.isEmpty(this.inputForm.year)) {
+					this.$message.warning('年份不可以为空,请输入年份')
+					return
+				}
+				const formBody = new FormData()
+				formBody.append('file', this.inputForm.file[0].raw)
+				formBody.append('year', this.inputForm.year)
+				let filename = this.inputForm.file[0].raw.name
+				projectReportService.numberReplace(formBody).then((data) =>{
+					if (data){
+						this.$utils.downloadExcel(data, filename)
+						this.$message.success('报告号替换成功')
+						this.visible = false
+						this.$emit("refreshList");
+					}
+				})
+			},
+			close(){
+				this.visible = false
+				this.$refs.inputForm.resetFields()
+				this.inputForm = {
+					file:[]
+				}
+			}
+
+		}
+    }
+</script>
+
+<style scoped>
+	/deep/ .el-input-number .el-input__inner {
+		text-align: left;
+	}
+	.el-row {
+		display: flex;
+		align-items: center; /* 垂直居中 */
+	}
+</style>

+ 9 - 1
src/views/cw/reportManagement/ReportManagementList.vue

@@ -169,6 +169,7 @@
         <template #buttons>
           <el-button v-if="hasPermission('cw_work_client:info:add')" type="primary" icon="el-icon-plus" @click="start()">新建</el-button>
 		  <el-button type="warning" icon="el-icon-download" @click="exportAllSignatureFile()" :disabled="$refs.clientTable && $refs.clientTable.getCheckboxRecords().length === 0" plain>已盖章文件下载</el-button>
+		  <el-button type="warning" icon="el-icon-download" @click="importReplaceNumber()" plain>报告号替换</el-button>
         </template>
 		  <template #tools>
 			  <vxe-button
@@ -463,6 +464,7 @@
 	  <user-select1 ref="userSelect1" @doSubmit="selectUser1"></user-select1>
 	  <user-select2 ref="userSelect2" @doSubmit="selectUser2"></user-select2>
 	  <user-select3 ref="userSelect3" @doSubmit="selectUser3"></user-select3>
+	  <NumberReplace ref="numberReplace" @refreshList="refreshList"></NumberReplace>
   </div>
 </template>
 
@@ -484,6 +486,7 @@
   import UserSelect1 from '@/views/utils/UserTreeSelectBySignatureScribe'
   import UserSelect2 from '@/views/utils/UserTreeSelectBySignatureScribe'
   import UserSelect3 from '@/views/utils/UserTreeSelect'
+  import NumberReplace from "./NumberReplace";
   export default {
     data () {
       return {
@@ -562,7 +565,8 @@
       UserSelect,
 	  UserSelect2,
 		UserSelect1,
-		UserSelect3
+		UserSelect3,
+		NumberReplace
     },
     computed: {
       userName () {
@@ -2079,6 +2083,10 @@
 			console.log(user[0].name)
 			this.searchForm.createBy=user[0].name
 		},
+		//报告号替换
+		importReplaceNumber(){
+			this.$refs.numberReplace.init()
+		}
     }
   }
 </script>