LuChongMei пре 1 година
родитељ
комит
35490bd43f

+ 61 - 16
jp-mobile/pages/fileTransmit/addFileTransmit.vue

@@ -35,17 +35,23 @@
 					<u--textarea v-model="inputForm.contentSummary" placeholder="请输入内容摘要" border="none"></u--textarea>
 				</u-form-item>
 				<u-form-item label="来文附件" prop="attachedDocumentId" labelPosition="top">
-					<u-upload :fileList="fileLists" @afterRead="afterRead" @delete="deletePic" multiple :maxCount="9"
-						width="250" height="150" accept="file" :previewImage="false">
+					<u-upload :fileList="fileLists" @afterRead="afterRead" multiple :maxCount="9" width="250"
+						height="150" accept="file" :previewImage="false">
 						<view class="addfile flex"> <u-icon size="20" bold name="plus"></u-icon></view>
 					</u-upload>
 				</u-form-item>
-				<view class="other_info" v-for="item in fileList">
+				<view class="other_info">
 					<view class="other_pdf">
-						<u--text mode="link" :text="item.name" :href="item.url"></u--text>
+						<u-cell-group>
+							<u-cell v-for="item in fileList" :title="item.name">
+								<u-icon slot="right-icon" size="28" name="trash-fill"
+									@click="deleteFile(item)"></u-icon>
+							</u-cell>
+						</u-cell-group>
 					</view>
 				</view>
-				<u-upload :fileList="imgList" multiple :maxCount="imgList.length" :previewFullImage="true"></u-upload>
+				<u-upload :fileList="imgList" @delete="deletePic" multiple :maxCount="imgList.length"
+					:previewFullImage="true"></u-upload>
 				<u--text size="12" type="error" text="请确保上传图片内容清晰可见,所有涉密敏感信息不得上传"></u--text>
 				<view class="submit_btn flex">
 					<u-button v-if="!loading" type="primary" text="提交新增" @click="formSubmit"></u-button>
@@ -54,6 +60,7 @@
 			</u--form>
 		</view>
 		<u-toast ref="uToast"></u-toast>
+
 	</view>
 </template>
 
@@ -61,6 +68,9 @@
 	import {
 		isImageFormat
 	} from "@/common/util.js"
+	import BASE_URL from '@/config.js'
+	import * as $auth from "@/common/auth.js"
+	import fileService from '@/api/file/fileService.js'
 	import gwCirculationCard2Service from '@/api/circulation/gwCirculationCard2.js'
 	export default {
 		data() {
@@ -96,6 +106,29 @@
 					}
 				})
 			},
+			// 删除文件
+			deleteFile(item) {
+				let that = this
+				uni.showModal({
+					title: '提示',
+					content: '确认删除该文件',
+					success: function(res) {
+						if (res.confirm) {
+							console.log("this.fileLists====", that.fileLists);
+							that.fileLists = that.fileLists.filter(i => !(i.url == item.url))
+							that.fileList = that.fileList.filter(i => !(i.url == item.url))
+						} else if (res.cancel) {
+							console.log('用户点击取消');
+						}
+					}
+				});
+
+			},
+			// 删除图片
+			deletePic(event) {
+				this[`imgList${event.name}`].splice(event.index, 1)
+				this[`fileLists${event.name}`].splice(event.index, 1)
+			},
 			// 新增图片
 			async afterRead(event) {
 				// 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
@@ -109,8 +142,7 @@
 					})
 				})
 				for (let i = 0; i < lists.length; i++) {
-					const result = await this.uploadFilePromise(lists[i].url)
-					// const result = "https://cdn.uviewui.com/uview/album.pdf"
+					const result = await this.uploadFilePromise(lists[i])
 					let item = this.fileLists[fileListLen]
 					this.fileLists.splice(fileListLen, 1, Object.assign(item, {
 						status: 'success',
@@ -119,9 +151,10 @@
 					}))
 					fileListLen++
 					if (isImageFormat(item.url)) {
+						item.url = BASE_URL + item.url
 						this.imgList.push(item)
 					} else {
-						const fileName = item.url.split(/[/\\]/).pop();
+						const fileName = item.url.split(/[/\\=]/).pop();
 						let a = {
 							name: fileName,
 							url: item.url
@@ -130,26 +163,38 @@
 					}
 				}
 			},
-			uploadFilePromise(url) {
+			uploadFilePromise(param) {
 				return new Promise((resolve, reject) => {
 					let a = uni.uploadFile({
-						url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
-						filePath: url,
+						url: this.BASE_URL + '/file/upload?uploadPath=filtransmit',
+						filePath: param.url,
 						name: 'file',
-						formData: {
-							user: 'test'
+						header: {
+							"token": $auth.getUserToken()
 						},
+						formData: param,
 						success: (res) => {
 							setTimeout(() => {
-								resolve(res.data.data)
+								resolve(res.data)
 							}, 1000)
 						}
-					});
-				})
+					})
+				});
+			},
+			// 下载文件
+			download(param) {
+
+				fileService.download(param).then(data)
 			},
+
 			// 表单提交
 			formSubmit() {
 				this.loading = true
+				let files = []
+				this.fileLists.forEach(item => {
+					files.push(item.url)
+				})
+				this.inputForm.attachedDocumentId = files.join(",");
 				// this.$refs['inputForm'].validate((valid) => {
 				// 	if (valid) {
 				gwCirculationCard2Service.save(this.inputForm).then((data) => {

+ 24 - 21
jp-mobile/pages/fileTransmit/examineFile.vue

@@ -77,6 +77,7 @@
 
 <script>
 	import fileCard from "./fileCard.vue"
+	import BASE_URL from '@/config.js'
 	import signInput from "@/components/am-sign-input/am-sign-input.vue"
 	import officeUserSelect from "@/components/office-user-select/office-user-select.vue"
 	import userService from "@/api/sys/userService"
@@ -126,8 +127,8 @@
 				isAll: false,
 				show: false,
 				one: true,
-				action: "", //上传服务器的地址
-				header: {}, //图片上传携带头部信息
+				action: this.BASE_URL + '/file/upload?uploadPath=sign', //上传服务器的地址
+				header: {"token": $auth.getUserToken()}, //图片上传携带头部信息
 				auditForm: {
 					id: '',
 					gwId: '',
@@ -186,6 +187,8 @@
 			 * 签名完成回调
 			 */
 			signToUrl(e) {
+				console.log("签字=====",e);
+				this.auditForm.signfj = e.data
 				if (e.error_code && e.error_code === '201') {
 					uni.showToast({
 						title: e.msg,
@@ -206,7 +209,7 @@
 					}
 					this.showToast(param);
 					setTimeout(() => {
-						uni.redirectTo({
+						uni.navigateTo({
 							url: 'pages/fileTransmit/fileTransmitList?type=1'
 						});
 					}, 500)
@@ -225,24 +228,24 @@
 					data.state = '3'
 					gwCirculationCard2Service.save(data).then(res => {
 						let param = {
-								type: 'success',
-								message: data,
-								iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
-							}
-							this.showToast(param);
-							setTimeout(() => {
-								uni.redirectTo({
-									url: 'pages/fileTransmit/fileTransmitList?type=3'
-								});
-							}, 500)
-						}).catch(() => {
-							let param = {
-								type: 'error',
-								message: data,
-								iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png',
-							}
-							this.showToast(param);
-						})
+							type: 'success',
+							message: data,
+							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png',
+						}
+						this.showToast(param);
+						setTimeout(() => {
+							uni.navigateTo({
+								url: 'pages/fileTransmit/fileTransmitList?type=3'
+							});
+						}, 500)
+					}).catch(() => {
+						let param = {
+							type: 'error',
+							message: data,
+							iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/error.png',
+						}
+						this.showToast(param);
+					})
 				})
 			}
 		}

+ 58 - 33
jp-mobile/pages/fileTransmit/fileCard.vue

@@ -63,7 +63,7 @@
 								{{item.content}}
 							</view>
 							<view class="flex " style="line-height: 20px;">
-								<u--image :src="src" width="80px" height="20px"></u--image>
+								<u--image :src="BASE_URL + item.signfj" width="80px" height="20px"></u--image>
 								{{item.updateTime}}
 							</view>
 						</view>
@@ -79,7 +79,7 @@
 								{{leader.content}}
 							</view>
 							<view class="flex " style="line-height: 20px;">
-								<u--image :src="src" width="80px" height="20px"></u--image>
+								<u--image :src="BASE_URL + leader.signfj" width="80px" height="20px"></u--image>
 								{{leader.updateTime}}
 							</view>
 						</view>
@@ -91,7 +91,13 @@
 					</u-col>
 					<u-col span="11" class="info_abstract">
 						<view v-for="item in undertakeInfo" class="info_abstract_v">
-							{{item.content}} {{item.updateTime}}
+							<view>
+								{{item.content}}
+							</view>
+							<view class="flex " style="line-height: 20px;">
+								<u--image :src="BASE_URL + item.signfj" width="80px" height="20px"></u--image>
+								{{item.updateTime}}
+							</view>
 						</view>
 					</u-col>
 				</u-row>
@@ -108,7 +114,8 @@
 					附件:
 					<view class="other_info" v-for="item in fileList">
 						<view class="other_pdf  flex  ">
-							<u--text mode="link" :text="item.name" :href="item.url"></u--text>
+							<u--text decoration='underline' color='#36a7f3' :text="item.name"
+								@click="download(item)"></u--text>
 						</view>
 					</view>
 					<u-upload :fileList="imgList" name="3" multiple :maxCount="imgList.length" :previewFullImage="true"
@@ -118,10 +125,10 @@
 
 		</view>
 		<u-overlay :show="ismask">
-				<view class="warp">
-					<view class="rect"><u-button plain loading loadingText="加载中"></u-button></view>
-				</view>
-			</u-overlay>
+			<view class="warp">
+				<view class="rect"><u-button plain loading loadingText="加载中"></u-button></view>
+			</view>
+		</u-overlay>
 	</view>
 </template>
 
@@ -129,6 +136,8 @@
 	import {
 		isImageFormat
 	} from "@/common/util.js"
+	import BASE_URL from '@/config.js'
+	import fileService from '@/api/file/fileService.js'
 	import gwCirculationCard2Service from '@/api/circulation/gwCirculationCard2.js'
 	import gwFlowService from '@/api/circulation/gwFlowService.js'
 
@@ -137,46 +146,50 @@
 			gwCirculationCard2Service.queryById(this.gwId).then(data => {
 				this.inputForm = data
 				this.inputForm.receivingTime = this.inputForm.receivingTime.substring(5, 10)
+				this.fileLists = this.inputForm.attachedDocumentId.split(",")
+				this.fileLists.forEach(item => {
+					console.log("item==========",item);
+					if (isImageFormat(item)) {
+						let img = {url:BASE_URL+item}
+						this.imgList.push(img)
+					} else {
+						const fileName = item.split(/[/\\=]/).pop();
+						let a = {
+							name: fileName,
+							url: item
+						}
+						this.fileList.push(a)
+					}
+				})
 			})
 			gwFlowService.queryByGwId(this.gwId).then(data => {
-				data.forEach(item =>{
-					if(item.which == 0 && item.state ==0) {
+				data.forEach(item => {
+					if (item.which == 0 && item.state == 0) {
 						this.officeInfo.push(item)
-					}else if(item.which==1 && item.state ==0){
+					} else if (item.which == 1 && item.state == 0) {
 						this.leaderInfo.push(item)
-					}else if(item.which==2 && item.state ==0) {
+					} else if (item.which == 2 && item.state == 0) {
 						this.undertakeInfo.push(item)
 					}
 				})
 				this.ismask = false
 			})
-			this.fileLists.forEach(item => {
-				if (isImageFormat(item.url)) {
-					this.imgList.push(item)
-				} else {
-					const fileName = item.url.split(/[/\\]/).pop();
-					let a = {
-						name: fileName,
-						url: item.url
-					}
-					this.fileList.push(a)
-				}
-			})
+
 		},
 		data() {
 			return {
-				ismask:true,
+				ismask: true,
 				src: 'https://cdn.uviewui.com/uview/album/1.jpg',
 				// 公文附件
 				fileLists: [],
 				fileList: [],
 				imgList: [],
 				// 办公室信息
-				officeInfo:[],
+				officeInfo: [],
 				// 领导信息
-				leaderInfo:[],
+				leaderInfo: [],
 				// 承办信息
-				undertakeInfo:[],
+				undertakeInfo: [],
 				inputForm: {
 					id: '',
 					yearNum: '',
@@ -207,6 +220,17 @@
 				},
 			}
 		},
+		methods:{
+			// 下载文件
+			download(param) {
+			console.log("param=====",param);
+			let item = {
+				uploadPath:'filtransmit/2024/3/',
+				name:param.name
+			}
+				fileService.download(item).then()
+			},
+		},
 		props: {
 			isoffice: {
 				type: Boolean,
@@ -230,11 +254,12 @@
 
 <style>
 	.warp {
-			display: flex;
-			align-items: center;
-			justify-content: center;
-			height: 100%;
-		}
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		height: 100%;
+	}
+
 	.card_main {
 		width: 100%;
 		background-color: #fefefe;