This commit is contained in:
BianLzhaoMin 2025-11-19 13:25:52 +08:00
parent 3d298eaa9b
commit db33507392
4 changed files with 123 additions and 26 deletions

View File

@ -12,25 +12,32 @@ import store from './store'
import router from './router' import router from './router'
import directive from './directive' // directive import directive from './directive' // directive
import plugins from './plugins' // plugins import plugins from './plugins' // plugins
import { download } from '@/utils/request' import { download, downloadGet } from '@/utils/request'
import './assets/icons' // icon import './assets/icons' // icon
import './permission' // permission control import './permission' // permission control
import { getDicts } from "@/api/system/dict/data" import { getDicts } from '@/api/system/dict/data'
import { getConfigKey } from "@/api/system/config" import { getConfigKey } from '@/api/system/config'
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi" import {
parseTime,
resetForm,
addDateRange,
selectDictLabel,
selectDictLabels,
handleTree,
} from '@/utils/ruoyi'
// 分页组件 // 分页组件
import Pagination from "@/components/Pagination" import Pagination from '@/components/Pagination'
// 自定义表格工具组件 // 自定义表格工具组件
import RightToolbar from "@/components/RightToolbar" import RightToolbar from '@/components/RightToolbar'
// 富文本组件 // 富文本组件
import Editor from "@/components/Editor" import Editor from '@/components/Editor'
// 文件上传组件 // 文件上传组件
import FileUpload from "@/components/FileUpload" import FileUpload from '@/components/FileUpload'
// 图片上传组件 // 图片上传组件
import ImageUpload from "@/components/ImageUpload" import ImageUpload from '@/components/ImageUpload'
// 图片预览组件 // 图片预览组件
import ImagePreview from "@/components/ImagePreview" import ImagePreview from '@/components/ImagePreview'
// 字典标签组件 // 字典标签组件
import DictTag from '@/components/DictTag' import DictTag from '@/components/DictTag'
// 字典数据组件 // 字典数据组件
@ -45,6 +52,7 @@ Vue.prototype.addDateRange = addDateRange
Vue.prototype.selectDictLabel = selectDictLabel Vue.prototype.selectDictLabel = selectDictLabel
Vue.prototype.selectDictLabels = selectDictLabels Vue.prototype.selectDictLabels = selectDictLabels
Vue.prototype.download = download Vue.prototype.download = download
Vue.prototype.downloadGet = downloadGet
Vue.prototype.handleTree = handleTree Vue.prototype.handleTree = handleTree
// 全局组件挂载 // 全局组件挂载
@ -70,7 +78,7 @@ DictData.install()
*/ */
Vue.use(Element, { Vue.use(Element, {
size: Cookies.get('size') || 'medium' // set element-ui default size size: Cookies.get('size') || 'medium', // set element-ui default size
}) })
Vue.config.productionTip = false Vue.config.productionTip = false
@ -79,5 +87,5 @@ new Vue({
el: '#app', el: '#app',
router, router,
store, store,
render: h => h(App) render: (h) => h(App),
}) })

View File

@ -199,4 +199,38 @@ export function download(url, params, filename, config) {
}) })
} }
// 通用下载方法GET请求方式
export function downloadGet(url, params, filename, config) {
downloadLoadingInstance = Loading.service({
text: '正在下载数据,请稍候',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)',
})
return service
.get(url, {
params: params,
responseType: 'blob',
...config,
})
.then(async (data) => {
const isBlob = blobValidate(data)
if (isBlob) {
const blob = new Blob([data])
saveAs(blob, filename)
} else {
const resText = await data.text()
const rspObj = JSON.parse(resText)
const errMsg =
errorCode[rspObj.code] || rspObj.msg || errorCode['default']
Message.error(errMsg)
}
downloadLoadingInstance.close()
})
.catch((r) => {
console.error(r)
Message.error('下载文件出现错误,请联系管理员!')
downloadLoadingInstance.close()
})
}
export default service export default service

View File

@ -76,6 +76,7 @@
<el-dropdown <el-dropdown
trigger="click" trigger="click"
v-if="scope.row.fileType == 0" v-if="scope.row.fileType == 0"
@command="handleCommand"
> >
<span class="el-dropdown-link"> <span class="el-dropdown-link">
<i <i
@ -87,7 +88,10 @@
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item <el-dropdown-item
:key="item.label" :key="item.label"
@click="item.click(scope.row)" :command="{
row: scope.row,
item,
}"
v-for="item in dropdownList" v-for="item in dropdownList"
> >
{{ item.label }} {{ item.label }}
@ -300,7 +304,7 @@ export default {
icon: 'el-icon-download', icon: 'el-icon-download',
type: 'info', type: 'info',
click: this.handleBatchDownload, click: this.handleBatchDownload,
component: 'DownloadTags', // component: 'DownloadTags',
}, },
{ {
label: '共享', label: '共享',
@ -321,7 +325,7 @@ export default {
dropdownList: [ dropdownList: [
{ {
label: '下载', label: '下载',
click: this.handleMove, click: this.handleBatchDownload_1,
}, },
{ {
label: '移动', label: '移动',
@ -333,11 +337,11 @@ export default {
}, },
{ {
label: '共享', label: '共享',
click: this.handleShare, click: this.handleShare_1,
}, },
{ {
label: '重命名', label: '重命名',
click: this.handleMove, click: this.handleMove_1,
}, },
{ {
label: '添加副本', label: '添加副本',
@ -549,10 +553,27 @@ export default {
// //
this.selectedFilesForDownload = this.selectedRows.map((row) => ({ this.selectedFilesForDownload = this.selectedRows.map((row) => ({
id: row.id, id: row.id,
name: row.name,
})) }))
this.dialogConfig.outerTitle = '批量下载'
this.dialogConfig.outerVisible = true this.downloadGet(
'screen/document/downLoad',
{
ids: this.selectedRows.map((row) => row.id).join(','),
},
`文档_${new Date().getTime()}.zip`,
)
},
//
handleBatchDownload_1(row) {
console.log(row, 9999)
// this.downloadGet(
// 'screen/document/downLoad',
// {
// id: row.id,
// },
// `_${new Date().getTime()}.zip`,
// )
}, },
// //
@ -574,6 +595,21 @@ export default {
} }
}, },
handleShare_1(row) {
this.selectedFilesForShare = [
{
id: row.id,
name: row.name,
},
]
this.dialogConfig.outerTitle = '共享'
this.dialogConfig.outerVisible = true
this.dialogConfig.outerComponent = 'SharePermissionForm'
this.dialogConfig.outerComponentProps = {
selectedFiles: this.selectedFilesForShare,
}
},
// //
handleAddCopy() { handleAddCopy() {
if (this.selectedRows.length === 0) { if (this.selectedRows.length === 0) {
@ -708,6 +744,12 @@ export default {
// //
// this.$modal.msgSuccess('') // this.$modal.msgSuccess('')
}, },
//
handleCommand(command) {
// console.log('', command)
command.item.click(command.row)
},
}, },
} }
</script> </script>

View File

@ -89,13 +89,23 @@ export default {
}, },
// //
async moveDocument(fileId, targetParentId, parentId, parentIds) { async moveDocument(
fileId,
targetParentId,
parentId,
parentIds,
type,
toType,
publicFolderId,
) {
const params = { const params = {
id: fileId, id: fileId,
toId: targetParentId,
newParentId: targetParentId, newParentId: targetParentId,
parentId: parentId, parentId,
parentIds: parentIds, parentIds: parentIds,
type,
toType,
publicFolderId,
} }
try { try {
const res = await copyDocCenterAPI(params) const res = await copyDocCenterAPI(params)
@ -129,6 +139,9 @@ export default {
this.selectedFolder.id, this.selectedFolder.id,
file.parentId, file.parentId,
file.parentIds, file.parentIds,
file.type,
this.selectedFolder.type,
file.publicFolderId,
), ),
) )