|
|
@@ -8,47 +8,92 @@
|
|
|
<slot v-if="!onlyread" name="upload"></slot>
|
|
|
</div>
|
|
|
<el-table
|
|
|
- :header-cell-style="{background:'#EEEEEE',color:'#333'}"
|
|
|
+ :header-cell-style="{ background: '#EEEEEE', color: '#333' }"
|
|
|
size="mini"
|
|
|
border
|
|
|
:data="attinfos"
|
|
|
- style="width: 100%">
|
|
|
- <el-table-column
|
|
|
- prop="document"
|
|
|
- :label="$t('文件名称')">
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-table-column prop="document" :label="$t('文件名称')">
|
|
|
<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>
|
|
|
+ <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="$t('上传时间')">
|
|
|
+ <el-table-column prop="createdate" :label="$t('上传时间')">
|
|
|
</el-table-column>
|
|
|
- <el-table-column
|
|
|
- prop="contentlength"
|
|
|
- :label="$t('文件大小')"
|
|
|
- width="90">
|
|
|
+ <el-table-column prop="contentlength" :label="$t('文件大小')" 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'}}
|
|
|
+ {{
|
|
|
+ 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="$t('操作')"
|
|
|
- width="170">
|
|
|
+ <el-table-column :label="$t('操作')" width="170">
|
|
|
<template slot-scope="scope">
|
|
|
<div v-if="actid === scope.row.attachmentid">
|
|
|
- <el-button type="text" size="small" @click="saveEdit(scope.row)" :disabled="status === '已失败' || status === '已结案'">{{$t('保 存')}}</el-button>
|
|
|
- <el-button type="text" size="small" @click="refresh(actid = 0)" :disabled="status === '已失败' || status === '已结案'">{{$t('取 消')}}</el-button>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ @click="saveEdit(scope.row)"
|
|
|
+ :disabled="status === '已失败' || status === '已结案'"
|
|
|
+ >{{ $t("保 存") }}</el-button
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ @click="refresh((actid = 0))"
|
|
|
+ :disabled="status === '已失败' || status === '已结案'"
|
|
|
+ >{{ $t("取 消") }}</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
<div v-else>
|
|
|
- <el-button type="text" size="small" @click="download(scope.row)" :disabled="status === '已失败' || status === '已结案'">{{$t('下 载')}}</el-button>
|
|
|
- <el-button type="text" size="small" @click="seeClick(scope.row)" >{{$t('预 览')}}</el-button>
|
|
|
- <el-button :disabled="onlyread || status === '已失败' || status === '已结案' " class="inline-16" type="text" size="small" @click="editAttachment(scope.row)" >{{$t('编 辑')}}</el-button>
|
|
|
- <el-popconfirm :confirm-button-text="$t('确定')" :cancel-button-text="$t('取消')"
|
|
|
- :title="$t('确定删除当前附件吗')+'?'"
|
|
|
- @confirm="deleteAttachment(scope.row)">
|
|
|
- <el-button :disabled="onlyread || status === '已失败' || status === '已结案' || scope.row.usetype === 'undelete'" slot="reference" size="small" type="text" >{{$t('删 除')}}</el-button>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ @click="download(scope.row)"
|
|
|
+ :disabled="status === '已失败' || status === '已结案'"
|
|
|
+ >{{ $t("下 载") }}</el-button
|
|
|
+ >
|
|
|
+ <el-button type="text" size="small" @click="seeClick(scope.row)">{{
|
|
|
+ $t("预 览")
|
|
|
+ }}</el-button>
|
|
|
+ <el-button
|
|
|
+ :disabled="onlyread || status === '已失败' || status === '已结案'"
|
|
|
+ class="inline-16"
|
|
|
+ type="text"
|
|
|
+ size="small"
|
|
|
+ @click="editAttachment(scope.row)"
|
|
|
+ >{{ $t("编 辑") }}</el-button
|
|
|
+ >
|
|
|
+ <el-popconfirm
|
|
|
+ :confirm-button-text="$t('确定')"
|
|
|
+ :cancel-button-text="$t('取消')"
|
|
|
+ :title="$t('确定删除当前附件吗') + '?'"
|
|
|
+ @confirm="deleteAttachment(scope.row)"
|
|
|
+ >
|
|
|
+ <el-button
|
|
|
+ :disabled="
|
|
|
+ onlyread ||
|
|
|
+ status === '已失败' ||
|
|
|
+ status === '已结案' ||
|
|
|
+ scope.row.usetype === 'undelete'
|
|
|
+ "
|
|
|
+ slot="reference"
|
|
|
+ size="small"
|
|
|
+ type="text"
|
|
|
+ >{{ $t("删 除") }}</el-button
|
|
|
+ >
|
|
|
</el-popconfirm>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -59,88 +104,104 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import SeeFile from '@/components/file-block/components/SeeFile1'
|
|
|
+import SeeFile from "@/components/file-block/components/SeeFile1";
|
|
|
export default {
|
|
|
- props:['attinfos','onlyread','status'],
|
|
|
- data () {
|
|
|
+ props: ["attinfos", "onlyread", "status"],
|
|
|
+ data() {
|
|
|
return {
|
|
|
- actid:null,
|
|
|
- seeFile: '',
|
|
|
- isSeeFileShow:false
|
|
|
- }
|
|
|
+ actid: null,
|
|
|
+ seeFile: "",
|
|
|
+ isSeeFileShow: false,
|
|
|
+ };
|
|
|
},
|
|
|
- components:{SeeFile},
|
|
|
- methods:{
|
|
|
- refresh () {
|
|
|
- this.$emit('cancelEdit')
|
|
|
+ components: { SeeFile },
|
|
|
+ methods: {
|
|
|
+ refresh() {
|
|
|
+ this.$emit("cancelEdit");
|
|
|
},
|
|
|
- editAttachment (row) {
|
|
|
- this.actid = row.attachmentid
|
|
|
+ editAttachment(row) {
|
|
|
+ this.actid = row.attachmentid;
|
|
|
},
|
|
|
- download (row) {
|
|
|
- window.open(row.url)
|
|
|
- this.downloadRecord(row)
|
|
|
+ download(row) {
|
|
|
+ window.open(row.url);
|
|
|
+ this.downloadRecord(row);
|
|
|
},
|
|
|
/*保存下载操作记录*/
|
|
|
- async downloadRecord(row){
|
|
|
+ async downloadRecord(row) {
|
|
|
const res = await this.$api.requested({
|
|
|
- "id": 10020701,
|
|
|
- "content": {
|
|
|
- "linksid": row.linksid,
|
|
|
- "attachmentid": row.attachmentid
|
|
|
- }
|
|
|
- })
|
|
|
+ id: 10020701,
|
|
|
+ content: {
|
|
|
+ linksid: row.linksid,
|
|
|
+ attachmentid: row.attachmentid,
|
|
|
+ },
|
|
|
+ });
|
|
|
},
|
|
|
- async saveEdit (row) {
|
|
|
+ async saveEdit(row) {
|
|
|
let param = {
|
|
|
- "classname": "system.attachment.MediaCenter",
|
|
|
- "method": "changeAttachment",
|
|
|
- "content": {
|
|
|
- "files": [
|
|
|
+ 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.$emit('onSuccess'):''
|
|
|
- res.code === 1?this.actid = '':''
|
|
|
+ attachmentid: row.attachmentid,
|
|
|
+ document: row.document,
|
|
|
+ parentid: row.parentid,
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ };
|
|
|
+ const res = await this.$api.requested(param);
|
|
|
+ res.code === 1 ? this.$emit("onSuccess") : "";
|
|
|
+ res.code === 1 ? (this.actid = "") : "";
|
|
|
},
|
|
|
|
|
|
- async deleteAttachment (row) {
|
|
|
+ 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.$emit('onSuccess'):''
|
|
|
+ classname: "system.attachment.Attachment",
|
|
|
+ method: "deleteFileLink",
|
|
|
+ content: {
|
|
|
+ linksids: [row.linksid],
|
|
|
+ },
|
|
|
+ });
|
|
|
+ res.code === 1 ? this.tool.showMessage(res) : "";
|
|
|
+ res.code === 1 ? this.$emit("onSuccess") : "";
|
|
|
},
|
|
|
seeClick(item) {
|
|
|
- console.log(item)
|
|
|
- if(item.postfix == 'png' || item.postfix == 'PNG' || item.postfix == 'jpg' || item.postfix == 'JPG' || item.postfix == 'bmp' || item.postfix == 'BMP'
|
|
|
- || item.postfix == 'gif' || item.postfix == 'GIG' || item.postfix == 'WEBP' || item.postfix == 'webp' || item.postfix == 'svg' || item.postfix == 'SVG'
|
|
|
- || item.postfix == 'TIFF' || item.postfix == 'tiff' || item.postfix == 'MP4' || item.postfix == 'mp4' || item.postfix == 'ogg' || item.postfix == 'webm') {
|
|
|
- this.seeFile = item
|
|
|
- this.$refs.seeFile.dialogVisible = true
|
|
|
- } else if (item.postfix == 'PDF' || item.postfix == 'pdf'){
|
|
|
- window.open(item.url,'_blank')
|
|
|
- }else {
|
|
|
+ console.log(item);
|
|
|
+ if (
|
|
|
+ item.postfix == "png" ||
|
|
|
+ item.postfix == "PNG" ||
|
|
|
+ item.postfix == "jpg" ||
|
|
|
+ item.postfix == "JPG" ||
|
|
|
+ item.postfix == "bmp" ||
|
|
|
+ item.postfix == "BMP" ||
|
|
|
+ item.postfix == "gif" ||
|
|
|
+ item.postfix == "GIG" ||
|
|
|
+ item.postfix == "WEBP" ||
|
|
|
+ item.postfix == "webp" ||
|
|
|
+ item.postfix == "svg" ||
|
|
|
+ item.postfix == "SVG" ||
|
|
|
+ item.postfix == "TIFF" ||
|
|
|
+ item.postfix == "tiff" ||
|
|
|
+ item.postfix == "MP4" ||
|
|
|
+ item.postfix == "mp4" ||
|
|
|
+ item.postfix == "ogg" ||
|
|
|
+ item.postfix == "webm"
|
|
|
+ ) {
|
|
|
+ this.seeFile = item;
|
|
|
+ this.$refs.seeFile.dialogVisible = true;
|
|
|
+ } else if (item.postfix == "PDF" || item.postfix == "pdf") {
|
|
|
+ window.open(item.url, "_blank");
|
|
|
+ } else {
|
|
|
this.$notify({
|
|
|
- title:this.$t('提示'),
|
|
|
- message:this.$t('该文件暂不支持'),
|
|
|
- type:'warning'
|
|
|
- })
|
|
|
+ title: this.$t("提示"),
|
|
|
+ message: this.$t("该文件暂不支持"),
|
|
|
+ type: "warning",
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
<style>
|
|
|
</style>
|