|
|
@@ -35,7 +35,7 @@
|
|
|
<div class="flex flex-center" style="flex: 3">
|
|
|
<main-button icon="View" title="详情" width="85" @click="View(item)"/>
|
|
|
<main-button v-if="item.type === '1'" icon="Download" title="下载" width="85" @click="downFile(item)"/>
|
|
|
- <!-- <main-button icon="UploadFilled" title="同步" width="85"/>-->
|
|
|
+ <!-- <main-button v-if="item.type === '2'" icon="Upload" title="上传文件" width="85" @click="show = true"/>-->
|
|
|
<main-button v-if='item.del' icon="Delete" title="删除" width="85" @click="removeFile(item)"/>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -51,6 +51,14 @@
|
|
|
:url-list="imgList"
|
|
|
@close='viewerClose'
|
|
|
/>
|
|
|
+ <el-dialog v-model="show"
|
|
|
+ append-to-body
|
|
|
+ center
|
|
|
+ title="附件上传(可批量)">
|
|
|
+ <uploadFile :data='{type:1,toStatus:0}' :max='20'
|
|
|
+ @close='show = false'
|
|
|
+ @success='success'/>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -59,10 +67,11 @@ import mainButton from '../../../components/main-button.vue'
|
|
|
import { bytesToSize } from '@/utils/tools.js'
|
|
|
import { useStore } from '@/store/user.js'
|
|
|
import permissionStore from '@/store/permission.js'
|
|
|
+import uploadFile from '../../../components/upload-file.vue'
|
|
|
|
|
|
export default {
|
|
|
name: 'files_list',
|
|
|
- components: { mainButton },
|
|
|
+ components: { mainButton, uploadFile },
|
|
|
props: {
|
|
|
data: Object
|
|
|
},
|
|
|
@@ -102,10 +111,19 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
+ show: false,
|
|
|
files: [],
|
|
|
showImage: false,
|
|
|
imgList: [],
|
|
|
- query: null
|
|
|
+ query: null,
|
|
|
+ fileList: [],
|
|
|
+ saveCount: 0,
|
|
|
+ libraryList: [],
|
|
|
+ sendParams: {
|
|
|
+ ids: '',
|
|
|
+ ownerId: '',
|
|
|
+ projectId: ''
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
|
@@ -134,6 +152,74 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ success (res) {
|
|
|
+ this.fileList = res.fileList.map(res => {
|
|
|
+ const item = {}
|
|
|
+ item.title = res.response.data.originalFileName
|
|
|
+ item.suffix = res.response.data.suffix
|
|
|
+ item.volume = res.response.data.volume
|
|
|
+ item.fileId = res.response.data.id
|
|
|
+ item.fileFolderId = this.id
|
|
|
+ item.projectId = this.projectId
|
|
|
+ return item
|
|
|
+ })
|
|
|
+ this.fileList.forEach(sub => {
|
|
|
+ this.saveCount++
|
|
|
+ if (['pdf', 'doc'].includes(sub.suffix)) {
|
|
|
+ this.saveLibrary(sub)
|
|
|
+ }
|
|
|
+ if (this.saveCount === this.fileList.length) {
|
|
|
+ this.saveCount = 0
|
|
|
+ this.addFile()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ saveLibrary (sub) {
|
|
|
+ const data = { category: 4, content: '' }
|
|
|
+ this.$api.common.submit(Object.assign(sub, data)).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.saveCount++
|
|
|
+ this.libraryList.push(res.data.id)
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ addFile () {
|
|
|
+ this.$api.project.fileAdd(this.fileList).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.show = false
|
|
|
+ this.$emit('reFiles')
|
|
|
+ this.$message.success(res.msg)
|
|
|
+ if (this.user.info.type !== 3) {
|
|
|
+ this.$confirm('文件上传成功,是否给业主发送提醒消息?', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.SendMsg()
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.show = false
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ SendMsg () {
|
|
|
+ this.sendParams.ids = this.fileList.map(e => e.fileId).join(',')
|
|
|
+ this.sendParams.projectId = this.projectId
|
|
|
+ this.$api.project.send(this.sendParams).then(res => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success('消息已经发送成功!')
|
|
|
+ this.$bus.emit('reFolder')
|
|
|
+ this.sendMsg = false
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
downFile (item) {
|
|
|
window.open(item.url, '')
|
|
|
},
|