|
@@ -0,0 +1,140 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <upload :folderid="folderid"
|
|
|
+ :bindData="{ ownertable: 'sys_enterprise', ownerid: mainData.sys_enterpriseid, usetype: 'default' }"
|
|
|
+ @onSuccess="queryAttments"></upload>
|
|
|
+ <el-table
|
|
|
+ :header-cell-style="{background:'#EEEEEE',color:'#333'}"
|
|
|
+ size="mini"
|
|
|
+ border
|
|
|
+ :data="attinfo_attachment"
|
|
|
+ style="width: 100%;margin-top: 15px">
|
|
|
+ <el-table-column
|
|
|
+ prop="document"
|
|
|
+ label="文件名称">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-input v-if="actid === scope.row.attachmentid" size="mini" v-model="scope.row.document"></el-input>
|
|
|
+ <span v-else>{{scope.row.document}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="createdate"
|
|
|
+ label="上传时间">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="contentlength"
|
|
|
+ label="文件大小"
|
|
|
+ width="90">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ {{scope.row.contentlength > 1073741824?(scope.row.contentlength / Math.pow(1024,3)).toFixed(2)+'GB':scope.row.contentlength > 1048576?(scope.row.contentlength / Math.pow(1024,2)).toFixed(2)+'MB':scope.row.contentlength > 1024?(scope.row.contentlength / Math.pow(1024,1)).toFixed(2)+'KB':scope.row.contentlength+'B'}}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ width="140">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div v-if="actid === scope.row.attachmentid">
|
|
|
+ <el-button type="text" size="small" @click="saveEdit(scope.row)">保 存</el-button>
|
|
|
+ <el-button type="text" size="small" @click="refresh(actid = 0)">取 消</el-button>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <el-button type="text" size="small" @click="download(scope.row)">下 载</el-button>
|
|
|
+ <el-button class="inline-16" type="text" size="small" @click="editAttachment(scope.row)">编 辑</el-button>
|
|
|
+ <el-popconfirm
|
|
|
+ title="确定删除当前附件吗?"
|
|
|
+ @confirm="deleteAttachment(scope.row)">
|
|
|
+ <el-button slot="reference" size="small" type="text">删 除</el-button>
|
|
|
+ </el-popconfirm>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import upload from '@/components/upload/hw_obs_upload.vue'
|
|
|
+export default {
|
|
|
+ name: "index",
|
|
|
+ props:['mainData'],
|
|
|
+ components:{
|
|
|
+ upload
|
|
|
+ },
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
|
|
|
+ attinfo_attachment:[],
|
|
|
+ actid:null,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods:{
|
|
|
+ onUpload(){
|
|
|
+ console.log(this.mainData,'数据')
|
|
|
+ },
|
|
|
+ /*查询附件列表*/
|
|
|
+ async queryAttments () {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "classname": "system.attachment.Attachment",
|
|
|
+ "method": "queryFileLink",
|
|
|
+ "content": {
|
|
|
+ "ownertable": 'sys_enterprise',
|
|
|
+ "ownerid": this.mainData.sys_enterpriseid,
|
|
|
+ "usetype":"default"
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(res,'附件')
|
|
|
+ this.attinfo_attachment = res.data
|
|
|
+ },
|
|
|
+ /*编辑*/
|
|
|
+ editAttachment (row) {
|
|
|
+ this.actid = row.attachmentid
|
|
|
+ },
|
|
|
+ /*保存*/
|
|
|
+ async saveEdit (row) {
|
|
|
+ let param = {
|
|
|
+ "classname": "system.attachment.MediaCenter",
|
|
|
+ "method": "changeAttachment",
|
|
|
+ "content": {
|
|
|
+ "files": [
|
|
|
+ {
|
|
|
+ "attachmentid": row.attachmentid,
|
|
|
+ "document": row.document,
|
|
|
+ "parentid":row.parentid
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const res = await this.$api.requested(param)
|
|
|
+ res.code === 1?this.queryAttments():''
|
|
|
+ res.code === 1?this.actid = '':''
|
|
|
+ },
|
|
|
+ /*取消*/
|
|
|
+ refresh () {
|
|
|
+ this.$emit('cancelEdit')
|
|
|
+ },
|
|
|
+ /*下载*/
|
|
|
+ download (row) {
|
|
|
+ window.open(row.url)
|
|
|
+ },
|
|
|
+ /*删除*/
|
|
|
+ async deleteAttachment (row) {
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "classname": "system.attachment.Attachment",
|
|
|
+ "method": "deleteFileLink",
|
|
|
+ "content": {
|
|
|
+ "linksids":[row.linksid]
|
|
|
+ }
|
|
|
+ })
|
|
|
+ res.code === 1?this.tool.showMessage(res):''
|
|
|
+ res.code === 1?this.queryAttments():''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.queryAttments()
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|