|
|
@ -4,7 +4,7 @@ |
|
|
<el-form label-position="top" style="margin-top: -5px;"> |
|
|
<el-form label-position="top" style="margin-top: -5px;"> |
|
|
<el-row style="margin-top: 10px"> |
|
|
<el-row style="margin-top: 10px"> |
|
|
<el-col :span="4"> |
|
|
<el-col :span="4"> |
|
|
<el-button class="customer-bun-min" type="primary" @click="handleUpload">Upload</el-button> |
|
|
|
|
|
|
|
|
<el-button class="customer-bun-min" type="primary" @click="handleUpload">上传</el-button> |
|
|
</el-col> |
|
|
</el-col> |
|
|
</el-row> |
|
|
</el-row> |
|
|
|
|
|
|
|
|
@ -19,39 +19,39 @@ |
|
|
header-align="center" |
|
|
header-align="center" |
|
|
align="left" |
|
|
align="left" |
|
|
min-width="200" |
|
|
min-width="200" |
|
|
label="File"> |
|
|
|
|
|
|
|
|
label="文件"> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column |
|
|
<el-table-column |
|
|
prop="createdBy" |
|
|
prop="createdBy" |
|
|
header-align="center" |
|
|
header-align="center" |
|
|
align="center" |
|
|
align="center" |
|
|
min-width="100" |
|
|
min-width="100" |
|
|
label="Upload By"> |
|
|
|
|
|
|
|
|
label="上传人"> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column |
|
|
<el-table-column |
|
|
prop="createDate" |
|
|
prop="createDate" |
|
|
header-align="center" |
|
|
header-align="center" |
|
|
align="center" |
|
|
align="center" |
|
|
min-width="100" |
|
|
min-width="100" |
|
|
label="Upload Time"> |
|
|
|
|
|
|
|
|
label="上传时间"> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
<el-table-column |
|
|
<el-table-column |
|
|
header-align="center" |
|
|
header-align="center" |
|
|
align="center" |
|
|
align="center" |
|
|
width="100" |
|
|
width="100" |
|
|
fixed="right" |
|
|
fixed="right" |
|
|
label="Actions"> |
|
|
|
|
|
|
|
|
label="操作"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<a type="text" size="small" v-if="scope.row.id" @click="handleDownload(scope.row)">View |</a> |
|
|
|
|
|
<a type="text" size="small" v-if="scope.row.id" @click="deleteFileReal(scope.row)"> delete</a> |
|
|
|
|
|
<a type="text" size="small" v-else @click="deleteFile(scope.$index)"> delete</a> |
|
|
|
|
|
|
|
|
<a type="text" size="small" v-if="scope.row.id" @click="handleDownload(scope.row)">查看 |</a> |
|
|
|
|
|
<a type="text" size="small" v-if="scope.row.id" @click="deleteFileReal(scope.row)"> 删除</a> |
|
|
|
|
|
<a type="text" size="small" v-else @click="deleteFile(scope.$index)"> 删除</a> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
</el-form> |
|
|
</el-form> |
|
|
|
|
|
|
|
|
<!-- File Upload Dialog --> |
|
|
<!-- File Upload Dialog --> |
|
|
<el-dialog title="UpLoad" :visible.sync="ossVisible" v-drag width="400px" append-to-body :close-on-click-modal="false"> |
|
|
|
|
|
|
|
|
<el-dialog title="文件上传" :visible.sync="ossVisible" v-drag width="400px" append-to-body :close-on-click-modal="false"> |
|
|
<el-form ref="form" class="rq" label-width="80px" label-position="top"> |
|
|
<el-form ref="form" class="rq" label-width="80px" label-position="top"> |
|
|
<el-row :gutter="10"> |
|
|
<el-row :gutter="10"> |
|
|
<slot></slot> |
|
|
<slot></slot> |
|
|
@ -64,12 +64,12 @@ |
|
|
multiple |
|
|
multiple |
|
|
:auto-upload="false"> |
|
|
:auto-upload="false"> |
|
|
<i class="el-icon-upload"></i> |
|
|
<i class="el-icon-upload"></i> |
|
|
<div class="el-upload__text">Drag files here, or<em> click to upload</em></div> |
|
|
|
|
|
|
|
|
<div class="el-upload__text">将文件拖到这里,或<em>点击上传</em></div> |
|
|
</el-upload> |
|
|
</el-upload> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
<el-col :span="24"> |
|
|
<el-col :span="24"> |
|
|
<el-form-item label="Remark" class="auto"> |
|
|
|
|
|
|
|
|
<el-form-item label="备注" class="auto"> |
|
|
<el-input type="textarea" v-model="ossForm.remark" resize="none" :autosize="{minRows: 3, maxRows: 3}"></el-input> |
|
|
<el-input type="textarea" v-model="ossForm.remark" resize="none" :autosize="{minRows: 3, maxRows: 3}"></el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-col> |
|
|
</el-col> |
|
|
@ -77,8 +77,8 @@ |
|
|
</el-form> |
|
|
</el-form> |
|
|
<span slot="footer" class="dialog-footer"> |
|
|
<span slot="footer" class="dialog-footer"> |
|
|
<!-- <el-button type="primary" :loading="uploadLoading" @click="handleUploadFiles">Confirm</el-button> --> |
|
|
<!-- <el-button type="primary" :loading="uploadLoading" @click="handleUploadFiles">Confirm</el-button> --> |
|
|
<el-button type="primary" :loading="uploadLoading" @click="submitData">Confirm</el-button> |
|
|
|
|
|
<el-button @click="ossVisible = false">Close</el-button> |
|
|
|
|
|
|
|
|
<el-button type="primary" :loading="uploadLoading" @click="submitData">确认</el-button> |
|
|
|
|
|
<el-button @click="ossVisible = false">关闭</el-button> |
|
|
</span> |
|
|
</span> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
</div> |
|
|
</div> |
|
|
@ -201,7 +201,7 @@ export default { |
|
|
// Stage files on dialog confirm |
|
|
// Stage files on dialog confirm |
|
|
handleUploadFiles() { |
|
|
handleUploadFiles() { |
|
|
if (this.fileList2.length === 0) { |
|
|
if (this.fileList2.length === 0) { |
|
|
this.$message.error('Please select file(s)'); |
|
|
|
|
|
|
|
|
this.$message.error('请选择文件'); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
this.stagedFileRemark = this.ossForm.remark || ''; |
|
|
this.stagedFileRemark = this.ossForm.remark || ''; |
|
|
@ -219,7 +219,7 @@ export default { |
|
|
this.fileList2 = []; |
|
|
this.fileList2 = []; |
|
|
this.ossForm.remark = ''; |
|
|
this.ossForm.remark = ''; |
|
|
this.ossVisible = false; |
|
|
this.ossVisible = false; |
|
|
this.$message.success('Files staged'); |
|
|
|
|
|
|
|
|
this.$message.success('文件已暂存'); |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
@ -283,7 +283,7 @@ export default { |
|
|
}); |
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
this.$message({ |
|
|
this.$message({ |
|
|
message: 'Unsupported file type', |
|
|
|
|
|
|
|
|
message: '不支持的文件类型', |
|
|
type: 'warning' |
|
|
type: 'warning' |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
@ -367,21 +367,21 @@ submitData() { |
|
|
|
|
|
|
|
|
deleteFileReal(row) { |
|
|
deleteFileReal(row) { |
|
|
if (!row || !row.id) return; |
|
|
if (!row || !row.id) return; |
|
|
this.$confirm('Are you sure you want to delete this file?', 'Delete Confirmation', { |
|
|
|
|
|
confirmButtonText: 'OK', |
|
|
|
|
|
cancelButtonText: 'Cancel', |
|
|
|
|
|
|
|
|
this.$confirm('确定要删除该文件吗?', '删除确认', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
type: 'warning' |
|
|
type: 'warning' |
|
|
}).then(() => { |
|
|
}).then(() => { |
|
|
removeOssFile([row.id]).then(({ data }) => { |
|
|
removeOssFile([row.id]).then(({ data }) => { |
|
|
if (data && data.code === 0) { |
|
|
if (data && data.code === 0) { |
|
|
const idx = this.fileList.findIndex(f => f.id === row.id); |
|
|
const idx = this.fileList.findIndex(f => f.id === row.id); |
|
|
if (idx !== -1) this.fileList.splice(idx, 1); |
|
|
if (idx !== -1) this.fileList.splice(idx, 1); |
|
|
this.$message.success(data.msg || 'File deleted'); |
|
|
|
|
|
|
|
|
this.$message.success(data.msg || '文件已删除'); |
|
|
} else { |
|
|
} else { |
|
|
this.$message.warning(data.msg || 'Delete failed'); |
|
|
|
|
|
|
|
|
this.$message.warning(data.msg || '删除失败'); |
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
this.$message.error('Delete failed:' + (err.message || err)); |
|
|
|
|
|
|
|
|
this.$message.error('删除失败:' + (err.message || err)); |
|
|
}); |
|
|
}); |
|
|
}).catch(() => { }); |
|
|
}).catch(() => { }); |
|
|
}, |
|
|
}, |
|
|
|