|
|
@@ -10,7 +10,7 @@
|
|
|
<span style="flex: 3">操作</span>
|
|
|
</div>
|
|
|
<el-empty v-if="folder && folder.length === 0" description="暂无数据"/>
|
|
|
- <div v-for="item in folder" :key='item.id' v-else class="flex flex-center border-bottom padding content-sp">
|
|
|
+ <div v-for="item in folder" v-else class="flex flex-center border-bottom padding content-sp">
|
|
|
<img class="icon" src="../../../assets/svg/folder/see.svg">
|
|
|
<span style="flex:2">{{ item.folderName }}</span>
|
|
|
<span style="flex: 1">{{ item.updateTime }}</span>
|
|
|
@@ -18,7 +18,7 @@
|
|
|
<div class="flex flex-center" style="flex: 3">
|
|
|
<main-button icon="View" title="详情" width="85" @click="fileView(item)"/>
|
|
|
<main-button icon="Upload" title="上传文件" width="85" @click="uploadFiles(item)"/>
|
|
|
- <main-button v-if="type === 0" icon="Pointer" title="授权操作" width="85" @click='getFileList(item)'/>
|
|
|
+ <main-button v-if="type === 0" icon="Pointer" title="授权操作" width="85"/>
|
|
|
<main-button icon="Delete" title="删除" width="85" @click="folderRemove(item)"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -37,136 +37,69 @@
|
|
|
@close='show = false'
|
|
|
@success='success'/>
|
|
|
</el-dialog>
|
|
|
-<!-- 授权操作-->
|
|
|
- <el-dialog v-model='authorizeShow' append-to-body center :show-close='false' class='custom-dialog'>
|
|
|
- <template #header="{ close, titleId, titleClass }">
|
|
|
- <div class="flex flex-justify-between">
|
|
|
- <h4 :id="titleId" :class="titleClass">{{currentRow.folderName}}</h4>
|
|
|
- <el-button type="danger" text @click="close">
|
|
|
- <el-icon class="el-icon--left"><CircleCloseFilled /></el-icon>
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- </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">
|
|
|
- <el-radio label="1" size="large">全部不可见</el-radio>
|
|
|
- <el-radio label="2" size="large">全部可见</el-radio>
|
|
|
- <el-radio label="3" size="large">全部可下载</el-radio>
|
|
|
- </el-radio-group>
|
|
|
- </div>
|
|
|
- <div v-for='(item,index) in fileData.records' :key='item'>
|
|
|
- <item1 :check='check' :data='item' :index='index' @change='change'/>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class='full-width flex flex-align-center mt-10'>
|
|
|
- <span class='font-14 bold'>授权时长</span>
|
|
|
- <el-date-picker
|
|
|
- v-model="authorizeDate"
|
|
|
- type="daterange"
|
|
|
- class='ml-20'
|
|
|
- range-separator="至"
|
|
|
- start-placeholder="开始日期"
|
|
|
- end-placeholder="截止日期"
|
|
|
- value-format='YYYY-MM-DD'
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class='full-width flex flex-align-center mt-10'>
|
|
|
- <span class='font-14 bold'>生成授权连接</span>
|
|
|
- <el-button class='ml-20' type="danger" icon="Picture" circle @click='initCode'/>
|
|
|
- <el-button type="danger" icon="Paperclip" circle />
|
|
|
- </div>
|
|
|
- <div class='full-width mt-20 border-top padding-top flex flex-justify-end'>
|
|
|
- <el-button>取消</el-button>
|
|
|
- <el-button type='primary'>关闭</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
- <el-dialog v-model='qrCodeShow' top='20%' width='400px'>
|
|
|
- <div class='flex flex-col flex-center light-purple-bg' style='height: 400rpx;width: 400rpx'>
|
|
|
- <vue-qr :text='qrCodeText' size='340' :logoSrc='logoSrc' :currentLevel='3' :logoScale='0.25'
|
|
|
- :logoCornerRadius='4'/>
|
|
|
- <span>复制二维码,通过微信进行分享</span>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import mainButton from '../../../components/main-button.vue'
|
|
|
import uploadFile from '../../../components/upload-file.vue'
|
|
|
-import item1 from '@/views/home/component/item1.vue'
|
|
|
-import VueQr from 'vue-qr/src/packages/vue-qr.vue'
|
|
|
|
|
|
export default {
|
|
|
name: 'file_list',
|
|
|
- components: { mainButton, uploadFile, item1, VueQr },
|
|
|
+ components: {mainButton, uploadFile},
|
|
|
props: {
|
|
|
folder: Array,
|
|
|
total: String,
|
|
|
type: {
|
|
|
type: Number,
|
|
|
- default: 0
|
|
|
+ default: 0,
|
|
|
}
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
show: false,
|
|
|
- authorizeShow: false,
|
|
|
currentRow: null,
|
|
|
- check: '2',
|
|
|
- fileData: null,
|
|
|
- authorizeDate: [],
|
|
|
- qrCodeShow: false,
|
|
|
- logoSrc: new URL('../../../assets/img/logo.png', import.meta.url).href,
|
|
|
- qrCodeText: '',
|
|
|
- startTime: '',
|
|
|
- endTime: ''
|
|
|
+ libraryList: [],
|
|
|
+ saveCount: 0,
|
|
|
+ fileList: [],
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
- fileView (item) {
|
|
|
+ fileView(item) {
|
|
|
if (this.type === 0) {
|
|
|
this.$router.push({
|
|
|
path: '/home/files',
|
|
|
- query: { id: item.fileFolderId }
|
|
|
+ query: {id: item.fileFolderId}
|
|
|
})
|
|
|
} else {
|
|
|
this.$router.push({
|
|
|
path: '/home/his_files',
|
|
|
- query: { id: item.id }
|
|
|
+ query: {id: item.id}
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- uploadFiles (item) {
|
|
|
+ uploadFiles(item) {
|
|
|
this.currentRow = item
|
|
|
this.show = true
|
|
|
},
|
|
|
- folderRemove (item) {
|
|
|
- this.$confirm('确认是否删除该文件夹及所包含的文件?', {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
+ folderRemove(item) {
|
|
|
+ this.$confirm("确认是否删除该文件夹及所包含的文件?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- this.$api.project.folderRemove({ ids: item.fileFolderId }).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$message.success(res.msg)
|
|
|
- this.$emit('delFolder')
|
|
|
- } else {
|
|
|
- this.$message.error(res.msg)
|
|
|
- }
|
|
|
+ .then(() => {
|
|
|
+ this.$api.project.folderRemove({ids: item.fileFolderId}).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ this.$emit('delFolder')
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
})
|
|
|
- })
|
|
|
},
|
|
|
- success (res) {
|
|
|
+ success(res) {
|
|
|
this.fileList = res.fileList.map(res => {
|
|
|
const item = {}
|
|
|
item.title = res.response.data.originalFileName
|
|
|
@@ -180,63 +113,37 @@ export default {
|
|
|
}
|
|
|
return item
|
|
|
})
|
|
|
- this.addFile()
|
|
|
- },
|
|
|
- addFile () {
|
|
|
- if (this.fileList.length === 0) {
|
|
|
- this.$message.error('请先上传相关文件')
|
|
|
- return
|
|
|
- }
|
|
|
- this.$api.project.fileAdd(this.fileList).then(res => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.show = false
|
|
|
- this.$bus.emit('reFolder')
|
|
|
- this.$message.success(res.msg)
|
|
|
- } else {
|
|
|
- this.show = false
|
|
|
- this.$message.error(res.msg)
|
|
|
- }
|
|
|
+ this.fileList.forEach(sub => {
|
|
|
+ this.saveLibrary(sub)
|
|
|
})
|
|
|
},
|
|
|
- getFileList (item) {
|
|
|
- this.currentRow = item
|
|
|
- this.$api.project.fileList({ folderId: item.fileFolderId }).then(res => {
|
|
|
+ saveLibrary(sub) {
|
|
|
+ let data = {category: 4, content: ''}
|
|
|
+ this.$api.common.submit(Object.assign(sub, data)).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
- this.authorizeShow = true
|
|
|
- this.fileData = res.data
|
|
|
- this.fileData.records = this.fileData.records.map(sub => {
|
|
|
- const item = sub
|
|
|
- sub.type = this.check
|
|
|
- return item
|
|
|
- })
|
|
|
+ this.saveCount++
|
|
|
+ this.libraryList.push(res.data.id)
|
|
|
+ if (this.saveCount === this.fileList.length) {
|
|
|
+ console.log(this.fileList.length + 'ddjdjfyydju')
|
|
|
+ this.saveCount = 0
|
|
|
+ this.addFile()
|
|
|
+ }
|
|
|
} else {
|
|
|
this.$message.error(res.msg)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- initCode () {
|
|
|
- if (this.authorizeDate.length === 0) {
|
|
|
- this.$message.error('请设置授权时间')
|
|
|
- return
|
|
|
- }
|
|
|
- this.startTime = this.authorizeDate[0]
|
|
|
- this.endTime = this.authorizeDate[1]
|
|
|
- const tmps = this.fileData.records.map(sub => {
|
|
|
- const item = { fileId: sub.id, startTime: this.startTime, endTime: this.endTime, status: sub.type }
|
|
|
- return item
|
|
|
- })
|
|
|
- const folder = [{ folderId: this.currentRow.fileFolderId, startTime: this.startTime, endTime: this.endTime, status: this.type }]
|
|
|
- this.$api.project.initCode({ files: tmps, folders: folder }).then(res => {
|
|
|
+ addFile() {
|
|
|
+ this.$api.project.fileAdd(this.fileList).then(res => {
|
|
|
if (res.code === 200) {
|
|
|
- this.qrCodeText = 'https://dev.wutongresearch.club/apply?id=' + res.data.qrcode.qrcodeId
|
|
|
- this.qrCodeShow = true
|
|
|
+ this.show = false
|
|
|
+ this.$bus.emit('reFolder')
|
|
|
+ this.$message.success(res.msg)
|
|
|
} else {
|
|
|
+ this.show = false
|
|
|
this.$message.error(res.msg)
|
|
|
}
|
|
|
})
|
|
|
- },
|
|
|
- change (res) {
|
|
|
- this.fileData[res.index] = res
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -260,9 +167,4 @@ export default {
|
|
|
width: 50px;
|
|
|
height: 46px;
|
|
|
}
|
|
|
-.custom-dialog{
|
|
|
- :deep(.el-dialog){
|
|
|
- --el-dialog-padding-primary: 0;
|
|
|
- }
|
|
|
-}
|
|
|
</style>
|