|
|
@@ -1,51 +1,98 @@
|
|
|
<template>
|
|
|
<div class='flex flex-justify-between flex-col full-width '>
|
|
|
- <div class='flex full-width full-height border-bottom padding-bottom bold '>
|
|
|
- <span class='flex-child-average text-center'>文件/文件夹名称</span>
|
|
|
- <span class='flex-child-average text-center'>更新(上传)时间</span>
|
|
|
- <span class='flex-child-average text-center'>权限设置</span>
|
|
|
- </div>
|
|
|
- <div class='border-bottom padding-right padding-left mt-10' style='height: 500px'>
|
|
|
- <div class='flex flex-align-center mb-10 flex-justify-between border-bottom'>
|
|
|
- <div class='bold'>文件夹相关权限</div>
|
|
|
- <el-radio-group v-model="check" @change='allChange'>
|
|
|
- <el-radio label="3" size="large">不可查看</el-radio>
|
|
|
- <el-radio label="1" size="large">可见</el-radio>
|
|
|
- <el-radio label="2" size="large">可编辑</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </div>
|
|
|
- <div style='overflow-y: scroll; height: 450px'>
|
|
|
- <div v-for='(item,index) in fileList' :key='item.id'>
|
|
|
- <item1 :check='item.check' :data='item' :index='index' @change='change'/>
|
|
|
+ <el-tabs type='border-card'>
|
|
|
+ <el-tab-pane label='授权文件夹'>
|
|
|
+ <div class='flex full-width full-height border-bottom padding-bottom bold '>
|
|
|
+ <span class='flex-child-average text-center'>文件夹名称</span>
|
|
|
+ <span class='flex-child-average text-center'>更新(上传)时间</span>
|
|
|
+ <span class='flex-child-average text-center'>权限设置</span>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class='full-width flex flex-align-center mt-10'>
|
|
|
- <span class='font-14 bold'>授权时长</span>
|
|
|
- <el-date-picker
|
|
|
- v-model="authorizeDate"
|
|
|
- class='ml-20'
|
|
|
- end-placeholder="截止日期"
|
|
|
- range-separator="至"
|
|
|
- start-placeholder="开始日期"
|
|
|
- type="daterange"
|
|
|
- value-format='YYYY-MM-DD'
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class='full-width flex flex-align-center mt-10'>
|
|
|
- <span class='font-14 bold'>生成授权连接</span>
|
|
|
- <el-button circle class='ml-20' icon="Picture" type="danger" @click='initCode'/>
|
|
|
-<!-- <el-button circle icon="Paperclip" type="danger"/>-->
|
|
|
- </div>
|
|
|
- <div class='full-width mt-20 border-top padding-top flex flex-justify-end'>
|
|
|
- <el-button @click='close'>取消</el-button>
|
|
|
- <el-button type='primary' @click='close'>关闭</el-button>
|
|
|
- </div>
|
|
|
+ <div class='border-bottom padding-right padding-left mt-10' style='height: 500px'>
|
|
|
+ <div class='flex flex-align-center mb-10 flex-justify-between border-bottom'>
|
|
|
+ <div class='bold'>文件夹相关权限</div>
|
|
|
+ <el-radio-group v-model="check" @change='allChange($event,1)'>
|
|
|
+ <el-radio label="1" size="large">可见</el-radio>
|
|
|
+ <el-radio label="2" size="large">可编辑</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </div>
|
|
|
+ <div style='overflow-y: scroll; height: 450px' v-loading='loading'>
|
|
|
+ <div v-for='(item,index) in folderList' :key='item.id'>
|
|
|
+ <item1 :check='item.check' :data='item' :index='index' @change='change($event,1)'/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class='full-width flex flex-align-center mt-10'>
|
|
|
+ <span class='font-14 bold'>授权时长</span>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="authorizeDate"
|
|
|
+ class='ml-20'
|
|
|
+ end-placeholder="截止日期"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ type="daterange"
|
|
|
+ value-format='YYYY-MM-DD'
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class='full-width flex flex-align-center mt-10'>
|
|
|
+ <span class='font-14 bold'>生成授权连接</span>
|
|
|
+ <el-button circle class='ml-20' icon="Picture" type="danger" @click='initCode(1)'/>
|
|
|
+ <!-- <el-button circle icon="Paperclip" type="danger"/>-->
|
|
|
+ </div>
|
|
|
+ <div class='full-width mt-20 border-top padding-top flex flex-justify-end'>
|
|
|
+ <el-button @click='close'>取消</el-button>
|
|
|
+ <el-button type='primary' @click='close'>关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label='授权文件'>
|
|
|
+ <div class='flex full-width full-height border-bottom padding-bottom bold '>
|
|
|
+ <span class='flex-child-average text-center'>文件名称</span>
|
|
|
+ <span class='flex-child-average text-center'>更新(上传)时间</span>
|
|
|
+ <span class='flex-child-average text-center'>权限设置</span>
|
|
|
+ </div>
|
|
|
+ <div class='border-bottom padding-right padding-left mt-10' style='height: 500px'>
|
|
|
+ <div class='flex flex-align-center mb-10 flex-justify-between border-bottom'>
|
|
|
+ <div class='bold'>文件相关权限</div>
|
|
|
+ <el-radio-group v-model="check" @change='allChange($event,2)'>
|
|
|
+ <el-radio label="3" size="large">不可查看</el-radio>
|
|
|
+ <el-radio label="1" size="large">可见</el-radio>
|
|
|
+ <el-radio label="2" size="large">可编辑</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </div>
|
|
|
+ <div style='overflow-y: scroll; height: 450px'>
|
|
|
+ <div v-for='(item,index) in fileList' :key='item.id'>
|
|
|
+ <item1 :check='item.check' :data='item' :index='index' @change='change($event,2)'/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class='full-width flex flex-align-center mt-10'>
|
|
|
+ <span class='font-14 bold'>授权时长</span>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="authorizeDate"
|
|
|
+ class='ml-20'
|
|
|
+ end-placeholder="截止日期"
|
|
|
+ range-separator="至"
|
|
|
+ start-placeholder="开始日期"
|
|
|
+ type="daterange"
|
|
|
+ value-format='YYYY-MM-DD'
|
|
|
+ format='YYYY-MM-DD'
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ <div class='full-width flex flex-align-center mt-10'>
|
|
|
+ <span class='font-14 bold'>生成授权连接</span>
|
|
|
+ <el-button circle class='ml-20' icon="Picture" type="danger" @click='initCode(2)'/>
|
|
|
+ <!-- <el-button circle icon="Paperclip" type="danger"/>-->
|
|
|
+ </div>
|
|
|
+ <div class='full-width mt-20 border-top padding-top flex flex-justify-end'>
|
|
|
+ <el-button @click='close'>取消</el-button>
|
|
|
+ <el-button type='primary' @click='close'>关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
<el-dialog v-model='qrCodeShow' top='20%' width='400px'>
|
|
|
<div class='flex flex-col flex-center' style='height: 400rpx;width: 400rpx'>
|
|
|
<vue-qr :currentLevel='3' :logoCornerRadius='4' :logoScale='0.25' :logoSrc='logoSrc' :text='qrCodeText'
|
|
|
size='340'/>
|
|
|
- <span>复制二维码,通过微信进行分享</span>
|
|
|
+ <span>右键复制二维码,通过微信进行分享</span>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
@@ -54,6 +101,7 @@
|
|
|
<script>
|
|
|
import item1 from '@/views/home/component/item1.vue'
|
|
|
import VueQr from 'vue-qr/src/packages/vue-qr.vue'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'authorize',
|
|
|
components: { item1, VueQr },
|
|
|
@@ -74,37 +122,46 @@ export default {
|
|
|
watch: {
|
|
|
list: {
|
|
|
handler (val) {
|
|
|
- this.fileList = val
|
|
|
- this.fileList.map(sub => {
|
|
|
+ val = val.map(sub => {
|
|
|
sub.check = this.check
|
|
|
return sub
|
|
|
})
|
|
|
+ this.folderList = val.filter(sub => sub.type !== '1')
|
|
|
+ this.fileList = val.filter(sub => sub.type === '1')
|
|
|
},
|
|
|
immediate: true
|
|
|
}
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
+ loading: false,
|
|
|
check: '2',
|
|
|
authorizeDate: [],
|
|
|
fileData: null,
|
|
|
qrCodeShow: false,
|
|
|
fileList: [],
|
|
|
- qrCodeText: ''
|
|
|
+ folderList: [],
|
|
|
+ qrCodeText: '',
|
|
|
+ defaultDate: []
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
close () {
|
|
|
this.$emit('close')
|
|
|
},
|
|
|
- initCode () {
|
|
|
+ initCode (type) {
|
|
|
+ this.loading = true
|
|
|
+ let list = this.folderList
|
|
|
+ if (type === 2) {
|
|
|
+ list = this.fileList
|
|
|
+ }
|
|
|
if (this.authorizeDate.length === 0) {
|
|
|
this.$message.error('请设置授权时间')
|
|
|
return
|
|
|
}
|
|
|
this.startTime = this.authorizeDate[0]
|
|
|
this.endTime = this.authorizeDate[1]
|
|
|
- const fileTmps = this.fileList.filter(sub => sub.type === '1').map(sub => {
|
|
|
+ const fileTmps = list.filter(sub => sub.type === '1').map(sub => {
|
|
|
const item = { fileId: sub.id, startTime: this.startTime, endTime: this.endTime, status: sub.check }
|
|
|
return item
|
|
|
})
|
|
|
@@ -114,11 +171,17 @@ export default {
|
|
|
endTime: this.endTime,
|
|
|
status: this.check
|
|
|
}]
|
|
|
- const folderTmp = this.fileList.filter(sub => sub.type === '2').map(sub => {
|
|
|
+ const folderTmp = list.filter(sub => sub.type === '2').map(sub => {
|
|
|
const item = { folderId: sub.id, startTime: this.startTime, endTime: this.endTime, status: sub.check }
|
|
|
return item
|
|
|
})
|
|
|
- this.$api.project.initCode({ files: fileTmps, folders: folder.concat(folderTmp), type: 1, projectId: this.projectId }).then(res => {
|
|
|
+ this.$api.project.initCode({
|
|
|
+ files: fileTmps,
|
|
|
+ folders: folder.concat(folderTmp),
|
|
|
+ type: 1,
|
|
|
+ projectId: this.projectId
|
|
|
+ }).then(res => {
|
|
|
+ this.loading = false
|
|
|
if (res.code === 200) {
|
|
|
this.qrCodeText = 'https://dev.wutongresearch.club/apply?id=' + res.data.qrcode.qrcodeId + '&roleName=服务商'
|
|
|
this.qrCodeShow = true
|
|
|
@@ -127,32 +190,64 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- allChange (res) {
|
|
|
- this.fileList.forEach(sub => {
|
|
|
- sub.check = res
|
|
|
- return sub
|
|
|
- })
|
|
|
+ allChange (res, type) {
|
|
|
+ console.log(res)
|
|
|
+ if (type === 1) {
|
|
|
+ this.folderList.forEach(sub => {
|
|
|
+ sub.check = res
|
|
|
+ return sub
|
|
|
+ })
|
|
|
+ console.log(this.folderList)
|
|
|
+ } else {
|
|
|
+ this.fileList.forEach(sub => {
|
|
|
+ sub.check = res
|
|
|
+ return sub
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
- change (res) {
|
|
|
- this.fileList[res.index] = res
|
|
|
- let seeCount = 0
|
|
|
- let editCount = 0
|
|
|
- let notCount = 0
|
|
|
- this.fileList.forEach(sub => {
|
|
|
- if (sub.check === '1') {
|
|
|
- seeCount = seeCount + 1
|
|
|
- } else if (sub.check === '2') {
|
|
|
- editCount = editCount + 1
|
|
|
+ change (res, type) {
|
|
|
+ if (type === 1) {
|
|
|
+ this.folderList[res.index] = res
|
|
|
+ let seeCount = 0
|
|
|
+ let editCount = 0
|
|
|
+ let notCount = 0
|
|
|
+ this.folderList.forEach(sub => {
|
|
|
+ if (sub.check === '1') {
|
|
|
+ seeCount = seeCount + 1
|
|
|
+ } else if (sub.check === '2') {
|
|
|
+ editCount = editCount + 1
|
|
|
+ } else {
|
|
|
+ notCount = notCount + 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (editCount >= seeCount || editCount > 0) {
|
|
|
+ this.check = '2'
|
|
|
+ } else if (seeCount > 0) {
|
|
|
+ this.check = '1'
|
|
|
} else {
|
|
|
- notCount = notCount + 1
|
|
|
+ this.check = '3'
|
|
|
}
|
|
|
- })
|
|
|
- if (editCount >= seeCount || editCount > 0) {
|
|
|
- this.check = '2'
|
|
|
- } else if (seeCount > 0) {
|
|
|
- this.check = '1'
|
|
|
} else {
|
|
|
- this.check = '3'
|
|
|
+ this.fileList[res.index] = res
|
|
|
+ let seeCount = 0
|
|
|
+ let editCount = 0
|
|
|
+ let notCount = 0
|
|
|
+ this.fileList.forEach(sub => {
|
|
|
+ if (sub.check === '1') {
|
|
|
+ seeCount = seeCount + 1
|
|
|
+ } else if (sub.check === '2') {
|
|
|
+ editCount = editCount + 1
|
|
|
+ } else {
|
|
|
+ notCount = notCount + 1
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (editCount >= seeCount || editCount > 0) {
|
|
|
+ this.check = '2'
|
|
|
+ } else if (seeCount > 0) {
|
|
|
+ this.check = '1'
|
|
|
+ } else {
|
|
|
+ this.check = '3'
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|