This commit is contained in:
parent
3d298eaa9b
commit
db33507392
38
src/main.js
38
src/main.js
|
|
@ -12,25 +12,32 @@ import store from './store'
|
|||
import router from './router'
|
||||
import directive from './directive' // directive
|
||||
import plugins from './plugins' // plugins
|
||||
import { download } from '@/utils/request'
|
||||
import { download, downloadGet } from '@/utils/request'
|
||||
|
||||
import './assets/icons' // icon
|
||||
import './permission' // permission control
|
||||
import { getDicts } from "@/api/system/dict/data"
|
||||
import { getConfigKey } from "@/api/system/config"
|
||||
import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"
|
||||
import { getDicts } from '@/api/system/dict/data'
|
||||
import { getConfigKey } from '@/api/system/config'
|
||||
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'
|
||||
// 字典数据组件
|
||||
|
|
@ -45,6 +52,7 @@ Vue.prototype.addDateRange = addDateRange
|
|||
Vue.prototype.selectDictLabel = selectDictLabel
|
||||
Vue.prototype.selectDictLabels = selectDictLabels
|
||||
Vue.prototype.download = download
|
||||
Vue.prototype.downloadGet = downloadGet
|
||||
Vue.prototype.handleTree = handleTree
|
||||
|
||||
// 全局组件挂载
|
||||
|
|
@ -70,14 +78,14 @@ DictData.install()
|
|||
*/
|
||||
|
||||
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
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
render: (h) => h(App),
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@
|
|||
<el-dropdown
|
||||
trigger="click"
|
||||
v-if="scope.row.fileType == 0"
|
||||
@command="handleCommand"
|
||||
>
|
||||
<span class="el-dropdown-link">
|
||||
<i
|
||||
|
|
@ -87,7 +88,10 @@
|
|||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item
|
||||
:key="item.label"
|
||||
@click="item.click(scope.row)"
|
||||
:command="{
|
||||
row: scope.row,
|
||||
item,
|
||||
}"
|
||||
v-for="item in dropdownList"
|
||||
>
|
||||
{{ item.label }}
|
||||
|
|
@ -300,7 +304,7 @@ export default {
|
|||
icon: 'el-icon-download',
|
||||
type: 'info',
|
||||
click: this.handleBatchDownload,
|
||||
component: 'DownloadTags',
|
||||
// component: 'DownloadTags',
|
||||
},
|
||||
{
|
||||
label: '共享',
|
||||
|
|
@ -321,7 +325,7 @@ export default {
|
|||
dropdownList: [
|
||||
{
|
||||
label: '下载',
|
||||
click: this.handleMove,
|
||||
click: this.handleBatchDownload_1,
|
||||
},
|
||||
{
|
||||
label: '移动',
|
||||
|
|
@ -333,11 +337,11 @@ export default {
|
|||
},
|
||||
{
|
||||
label: '共享',
|
||||
click: this.handleShare,
|
||||
click: this.handleShare_1,
|
||||
},
|
||||
{
|
||||
label: '重命名',
|
||||
click: this.handleMove,
|
||||
click: this.handleMove_1,
|
||||
},
|
||||
{
|
||||
label: '添加副本',
|
||||
|
|
@ -549,10 +553,27 @@ export default {
|
|||
// 将选中的文件转换为下载组件需要的格式
|
||||
this.selectedFilesForDownload = this.selectedRows.map((row) => ({
|
||||
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() {
|
||||
if (this.selectedRows.length === 0) {
|
||||
|
|
@ -708,6 +744,12 @@ export default {
|
|||
// 这里可以根据搜索值进行数据筛选
|
||||
// this.$modal.msgSuccess('搜索功能待实现')
|
||||
},
|
||||
|
||||
// 处理下拉菜单点击
|
||||
handleCommand(command) {
|
||||
// console.log('下拉菜单点击', command)
|
||||
command.item.click(command.row)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -89,13 +89,23 @@ export default {
|
|||
},
|
||||
|
||||
// 添加副本
|
||||
async moveDocument(fileId, targetParentId, parentId, parentIds) {
|
||||
async moveDocument(
|
||||
fileId,
|
||||
targetParentId,
|
||||
parentId,
|
||||
parentIds,
|
||||
type,
|
||||
toType,
|
||||
publicFolderId,
|
||||
) {
|
||||
const params = {
|
||||
id: fileId,
|
||||
toId: targetParentId,
|
||||
newParentId: targetParentId,
|
||||
parentId: parentId,
|
||||
parentId,
|
||||
parentIds: parentIds,
|
||||
type,
|
||||
toType,
|
||||
publicFolderId,
|
||||
}
|
||||
try {
|
||||
const res = await copyDocCenterAPI(params)
|
||||
|
|
@ -129,6 +139,9 @@ export default {
|
|||
this.selectedFolder.id,
|
||||
file.parentId,
|
||||
file.parentIds,
|
||||
file.type,
|
||||
this.selectedFolder.type,
|
||||
file.publicFolderId,
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue