فهرست منبع

离职证明功能调整

user5 1 سال پیش
والد
کامیت
884ee8ceee

+ 7 - 0
src/api/human/depart/DepartRegistrationService.js

@@ -23,6 +23,13 @@ export default {
 			params: {id: id}
 		})
 	},
+	getByHandoverId (handoverId) {
+		return request({
+			url: prefix + '/departRegistration/getByHandoverId',
+			method: 'get',
+			params: {handoverId: handoverId}
+		})
+	},
 	updateStatusById (param) {
 		return request({
 			url: prefix + '/departRegistration/updateStatusById',

+ 23 - 0
src/api/sys/OSSService.js

@@ -259,3 +259,26 @@ export async function toHref (row) {
     })
   })
 }
+
+export async function toHrefByUrlAndName (url,name) {
+  if (url === null || url === undefined || url === '') {
+    // Message.error('没有获取到文件的url')
+    return
+  }
+  const link = document.createElement('a')
+  await getTemporaryByUrl(url).then((data) => {
+    const url = data // 完整的url则直接使用
+	  console.log('导出uel0', url)
+    // 这里是将url转成blob地址,
+    fetch(url).then(res => res.blob()).then(blob => { // 将链接地址字符内容转变成blob地址
+      link.href = URL.createObjectURL(blob)
+      link.download = name || '' // 下载文件的名字
+      // a.download = url.split('/')[url.split('/').length -1] //  // 下载文件的名字
+      document.body.appendChild(link)
+      link.click()
+      // 在资源下载完成后 清除 占用的缓存资源
+      window.URL.revokeObjectURL(link.href)
+      document.body.removeChild(link)
+    })
+  })
+}

+ 1 - 1
src/views/flowable/task/NoticePageList.vue

@@ -174,7 +174,7 @@
 			noticeService.stockUpdate(this.inputForm)
 			this.resetSearch()
 		}else if (row.taskName.includes('请点击下载离职证明')) {
-			this.$refs.departProvePopup.init(row.taskName)
+			this.$refs.departProvePopup.init(row.taskName,row.defId)
 			this.inputForm = {
 				id: row.id
 			}

+ 28 - 2
src/views/human/depart/handover/DepartProvePopup.vue

@@ -11,7 +11,7 @@
 		<div style="height: calc(100% - 80px);">
 			{{works}}
 
-			<el-button type="primary" @click="departFreemarker">离职证明</el-button>
+			<el-button type="primary" @click="toHref()">离职证明下载</el-button>
 		</div>
 		<template #footer>
 			<span class="dialog-footer">
@@ -23,22 +23,48 @@
 
 <script>
 	import enrollmentRegistrationService from '@/api/human/enrollment/EnrollmentRegistrationService'
+	import departRegistrationService from '@/api/human/depart/DepartRegistrationService'
+	import OSSSerivce, {
+		toHrefByUrlAndName
+	} from '@/api/sys/OSSService'
 
     export default {
 		data () {
 			return {
-				works: '',
+				dimissionProveUrl: '',
+				fileName: '',
 				handoverId: '',
+				works: '',
 				visible: false,
 				loading: false,
 				isAdmin: false,
 			}
 		},
+		created () {
+			this.ossService = new OSSSerivce()
+		},
+
 		methods: {
 			init (works,handoverId) {
 				this.visible = true
 				this.works = works
 				this.handoverId = handoverId
+				this.visible = true
+				this.loading = false
+				this.$nextTick(() => {
+					this.loading = true
+					console.log(this.handoverId)
+					departRegistrationService.getByHandoverId(this.handoverId).then((data) => {
+						this.dimissionProveUrl = data.dimissionProveUrl
+						this.fileName = data.name + "离职证明"
+						this.loading = false
+					})
+				})
+			},
+			toHref () {
+				console.log(this.dimissionProveUrl)
+				console.log(this.fileName)
+				toHrefByUrlAndName(this.dimissionProveUrl,this.fileName)
 			},
 			close () {
 				this.visible = false

+ 11 - 0
src/views/human/depart/registration/DepartRegistrationList.vue

@@ -146,6 +146,10 @@
 					<!--离职交接撤回-->
 					<el-button v-if="scope.row.type === '5' && scope.row.handoverType === '2' && (scope.row.createById === $store.state.user.id)" text type="primary" @click="rebackHandover(scope.row)">撤回离职交接</el-button>
 					<el-button v-if="scope.row.createById === $store.state.user.id && scope.row.type === '5'&& scope.row.handoverType === '4'" text type="primary"  @click="adjustHandover(scope.row)">驳回调整</el-button>
+
+
+					<el-button v-if="scope.row.handoverType === '5' && (scope.row.createById === $store.state.user.id)" text type="primary" @click="toHref(scope.row)">离职证明下载</el-button>
+
 				</div>
             </template>
           </vxe-column>
@@ -173,6 +177,9 @@
   import userService from '@/api/sys/UserService'
   import taskService from '@/api/flowable/TaskService'
   import DepartRegistrationEditForm from "./DepartRegistrationEditForm";
+	import OSSSerivce, {
+		toHrefByUrlAndName
+	} from '@/api/sys/OSSService'
   import pick from "lodash.pick";
   export default {
     data () {
@@ -202,6 +209,7 @@
       }
     },
     created () {
+		this.ossService = new OSSSerivce()
     },
     components: {
 		SelectTree,
@@ -236,6 +244,9 @@
       // 新增
       add () {
       },
+	toHref (row) {
+		toHrefByUrlAndName(row.dimissionProveUrl,row.name+"离职证明")
+	},
       // 修改
       edit (id) {
         id = id || this.$refs.clientTable.getCheckboxRecords().map(item => {