zhishi
This commit is contained in:
parent
9fd23ae016
commit
17cfb910e0
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function findAll(params) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function coursePushFindList() {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getTree(params) {
|
||||
return request({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
|
||||
|
||||
// 获取员工列表
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios'
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function expertZoneFindAll(params) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios'
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function zoneCollectionFindAll(params) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios'
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function zoneCommentFindAll(params) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios'
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function expertFindAll(params) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios'
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function expertMaintenanceFindAll(params) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
|
||||
export function headCardListStatistics(query) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
// 查询角色列表
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
// 查询角色列表
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function findAll(params) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getTree(params) {
|
||||
return request({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
// 查询角色列表
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
|
||||
|
||||
// 新建操作文件
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
//查询题库树
|
||||
export function getTree() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 获取题干列表
|
||||
export function getStemList(params) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
// 查询角色列表
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 文件查看
|
||||
export function findAll(query) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
// 查询角色列表
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
// 查询角色列表
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
|
||||
|
||||
// 获取员工列表
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
// 查询角色列表
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
|
||||
|
||||
// 新建操作文件
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
|
||||
|
||||
// 新建操作文件
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 文件查看
|
||||
export function findAll(query) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function judge(query) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
//查询题库树
|
||||
export function getTree() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 获取题干列表
|
||||
export function getStemList(params) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
// 查询角色列表
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
export const getDeptTree = (id) => {
|
||||
return request({
|
||||
url: `/knowledge/commonApi/getDeptData`, method: 'get'
|
||||
|
@ -1,9 +1,9 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 文件查看
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
url: '/knowledge/system/tArchives/findAll',
|
||||
url: '/system/tArchives/findAll',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@ -12,7 +12,7 @@ export function findAll(query) {
|
||||
// 文件查看
|
||||
export function findAllDocList(query) {
|
||||
return request({
|
||||
url: '/knowledge/system/tArchives/findAllDocList',
|
||||
url: '/system/tArchives/findAllDocList',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@ -21,7 +21,7 @@ export function findAllDocList(query) {
|
||||
// 文件查看
|
||||
export function getParentId(query) {
|
||||
return request({
|
||||
url: '/knowledge/system/tArchives/getParentId',
|
||||
url: '/system/tArchives/getParentId',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
@ -31,7 +31,7 @@ export function getParentId(query) {
|
||||
//文件保存/新建文件夹
|
||||
export function save(data) {
|
||||
return request({
|
||||
url: '/knowledge/system/tArchives/save',
|
||||
url: '/system/tArchives/save',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
@ -40,7 +40,7 @@ export function save(data) {
|
||||
// 删除文件或文件夹
|
||||
export function delByIds(ids) {
|
||||
return request({
|
||||
url: '/knowledge/system/tArchives/delete',
|
||||
url: '/system/tArchives/delete',
|
||||
method: 'post',
|
||||
params:ids
|
||||
})
|
||||
@ -49,7 +49,7 @@ export function delByIds(ids) {
|
||||
// 彻底删除
|
||||
export function ackDelete(ids) {
|
||||
return request({
|
||||
url: '/knowledge/system/tArchives/ackDelete',
|
||||
url: '/system/tArchives/ackDelete',
|
||||
method: 'post',
|
||||
params:ids
|
||||
})
|
||||
@ -58,7 +58,7 @@ export function ackDelete(ids) {
|
||||
// 还原
|
||||
export function restore(ids) {
|
||||
return request({
|
||||
url: '/knowledge/system/tArchives/restore',
|
||||
url: '/system/tArchives/restore',
|
||||
method: 'post',
|
||||
params:ids
|
||||
})
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function selfDetail(id) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function testPaperInfoFindAll(params) {
|
||||
return request({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
|
||||
export function getTaskList(data) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import request from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function findTeacherByName(teacherName) {
|
||||
return request({
|
||||
|
@ -1,5 +1,5 @@
|
||||
import request from '@/axios';
|
||||
import download from '@/axios';
|
||||
import request from '@/utils/request'
|
||||
import download from '@/utils/request';
|
||||
// 查询角色列表
|
||||
export function findAll(query) {
|
||||
return request({
|
||||
|
@ -55,12 +55,12 @@ export default {
|
||||
// 大小限制(MB)
|
||||
fileSize: {
|
||||
type: Number,
|
||||
default: 5,
|
||||
default: 500,
|
||||
},
|
||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||
fileType: {
|
||||
type: Array,
|
||||
default: () => ["doc", "xls", "ppt", "txt", "pdf"],
|
||||
default: () => ["doc", "xls", "ppt", "txt", "pdf","mp4","png","jpg","zip","rar","jpeg","xlsx","docx"],
|
||||
},
|
||||
// 是否显示提示
|
||||
isShowTip: {
|
||||
|
@ -1,15 +1,5 @@
|
||||
<template>
|
||||
<!-- 文件列表 -->
|
||||
<transition-group v-if="position=='top'" class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
||||
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
||||
<el-link :href="`${file.url}`" :underline="false" target="_blank">
|
||||
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
||||
</el-link>
|
||||
<div class="ele-upload-list__item-content-action">
|
||||
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
|
||||
</div>
|
||||
</li>
|
||||
</transition-group>
|
||||
|
||||
|
||||
<div class="upload-file">
|
||||
|
||||
@ -27,9 +17,9 @@
|
||||
class="upload-file-uploader"
|
||||
ref="fileUpload"
|
||||
>
|
||||
<div class="tp-anniu" v-if="buttonType=='question'" style="margin: 0px">上传图片/视频</div>
|
||||
|
||||
<!-- 上传按钮 -->
|
||||
<el-button v-else type="primary">{{name}}</el-button>
|
||||
<el-button type="primary">{{name}}</el-button>
|
||||
</el-upload>
|
||||
<!-- 上传提示 -->
|
||||
<div class="el-upload__tip" v-if="showTip">
|
||||
@ -38,8 +28,10 @@
|
||||
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b></template>
|
||||
的文件
|
||||
</div>
|
||||
|
||||
<!-- 文件列表 -->
|
||||
<transition-group v-if="position=='bottom'" class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
||||
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
||||
|
||||
<li :key="file.uid" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
||||
<el-link @click="down(file)" :underline="false" target="_blank">
|
||||
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
|
||||
@ -53,11 +45,15 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {getToken} from "@/utils/auth";
|
||||
<script>
|
||||
import { getAccessToken } from "@/utils/auth";
|
||||
import { downloadFile } from "@/views/knowledge/views/util/file";
|
||||
const props = defineProps({
|
||||
modelValue: [String, Object, Array],
|
||||
|
||||
export default {
|
||||
props: {
|
||||
value: {
|
||||
type: [String, Object, Array],
|
||||
},
|
||||
position: {
|
||||
type: String,
|
||||
default: "bottom",
|
||||
@ -65,62 +61,49 @@ const props = defineProps({
|
||||
name: {
|
||||
type: String,
|
||||
default: "选取文件",
|
||||
|
||||
},
|
||||
uploadFileUrl:{
|
||||
type: String,
|
||||
default: "/knowledge/api/uploadfile"
|
||||
},
|
||||
buttonType: {
|
||||
type: String,
|
||||
default: 'common',
|
||||
default: "common",
|
||||
},
|
||||
// 数量限制
|
||||
limit: {
|
||||
type: Number,
|
||||
default: 1,
|
||||
},
|
||||
// 大小限制(MB)
|
||||
fileSize: {
|
||||
type: Number,
|
||||
default: 200,
|
||||
},
|
||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||
fileType: {
|
||||
type: Array,
|
||||
/*default: () => ["doc", "xls", "ppt", "txt", "pdf"],*/
|
||||
/*default: () => ['png', 'jpg', 'jpeg',"doc", "xls", "ppt", "txt", "pdf"],*/
|
||||
default: () => [],
|
||||
default: () => ["doc", "xls", "ppt", "txt", "pdf","mp4","png","jpg","zip","rar","jpeg","xlsx","docx"],
|
||||
},
|
||||
// 是否显示提示
|
||||
isShowTip: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
});
|
||||
|
||||
const {proxy} = getCurrentInstance();
|
||||
const emit = defineEmits();
|
||||
const number = ref(0);
|
||||
const uploadList = ref([]);
|
||||
const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
||||
const headers = ref({
|
||||
Authorization: "Bearer " + getToken(),
|
||||
'Tenant-id': 1
|
||||
})
|
||||
;
|
||||
const fileList = ref([]);
|
||||
const showTip = computed(
|
||||
() => props.isShowTip && (props.fileType || props.fileSize)
|
||||
);
|
||||
|
||||
watch(() => props.modelValue, val => {
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
number: 0,
|
||||
uploadList: [],
|
||||
baseUrl: "",
|
||||
headers: { Authorization: "Bearer " + getAccessToken() }, // 设置上传的请求头部
|
||||
fileList: [],
|
||||
uploadFileUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/uploadDetail", // 请求地址
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
showTip() {
|
||||
return this.isShowTip && (this.fileType || this.fileSize);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
value(val) {
|
||||
if (val) {
|
||||
let temp = 1;
|
||||
// 首先将值转为数组
|
||||
const list = Array.isArray(val) ? val : props.modelValue.split(',');
|
||||
// 然后将数组转为对象数组
|
||||
fileList.value = list.map(item => {
|
||||
const list = Array.isArray(val)? val : this.value.split(",");
|
||||
this.fileList = list.map((item) => {
|
||||
if (typeof item === "string") {
|
||||
item = { name: item, url: item };
|
||||
}
|
||||
@ -128,99 +111,86 @@ watch(() => props.modelValue, val => {
|
||||
return item;
|
||||
});
|
||||
} else {
|
||||
fileList.value = [];
|
||||
return [];
|
||||
this.fileList = [];
|
||||
}
|
||||
}, {deep: true, immediate: true});
|
||||
|
||||
// 上传前校检格式和大小
|
||||
function handleBeforeUpload(file) {
|
||||
|
||||
// 校检文件类型
|
||||
if (props.fileType.length) {
|
||||
const fileName = file.name.split('.');
|
||||
const fileExt = fileName[fileName.length - 1];
|
||||
const isTypeOk = props.fileType.indexOf(fileExt) >= 0;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
handleBeforeUpload(file) {
|
||||
if (this.fileType.length) {
|
||||
const name = file.name.split(".");
|
||||
const fileExt = name[name.length - 1];
|
||||
const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
|
||||
if (!isTypeOk) {
|
||||
proxy.$modal.msgError(`文件格式不正确, 请上传${props.fileType.join("/")}格式文件!`);
|
||||
this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 校检文件大小
|
||||
if (props.fileSize) {
|
||||
const isLt = file.size / 1024 / 1024 < props.fileSize;
|
||||
if (this.fileSize) {
|
||||
const isLt = file.size / 1024 / 1024 < this.fileSize;
|
||||
if (!isLt) {
|
||||
proxy.$modal.msgError(`上传文件大小不能超过 ${props.fileSize} MB!`);
|
||||
this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
proxy.$modal.loading("正在上传文件,请稍候...");
|
||||
number.value++;
|
||||
this.$modal.loading("正在上传文件,请稍候...");
|
||||
this.number++;
|
||||
return true;
|
||||
}
|
||||
function down(row){
|
||||
console.log(row,162)
|
||||
downloadFile(row.url,row.name)
|
||||
}
|
||||
// 文件个数超出
|
||||
function handleExceed() {
|
||||
proxy.$modal.msgError(`上传文件数量不能超过 ${props.limit} 个!`);
|
||||
}
|
||||
|
||||
// 上传失败
|
||||
function handleUploadError(err) {
|
||||
proxy.$modal.msgError("上传文件失败");
|
||||
}
|
||||
|
||||
// 上传成功回调
|
||||
function handleUploadSuccess(res, file) {
|
||||
if (res.code === 200) {
|
||||
},
|
||||
down(row) {
|
||||
console.log(row, 162);
|
||||
downloadFile(row.url, row.name);
|
||||
},
|
||||
handleExceed() {
|
||||
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
|
||||
},
|
||||
handleUploadError(err) {
|
||||
this.$modal.msgError("上传文件失败");
|
||||
},
|
||||
handleUploadSuccess(res, file) {
|
||||
if (res.code === 0) {
|
||||
if (res.data) {
|
||||
uploadList.value.push({name: res.data.fileName, url: res.data.url, size: res.data.fileSize});
|
||||
uploadedSuccessfully();
|
||||
this.uploadList.push({
|
||||
name: res.data.name,
|
||||
url: res.data.url,
|
||||
size: res.data.size,
|
||||
});
|
||||
this.uploadedSuccessfully();
|
||||
} else {
|
||||
proxy.$modal.closeLoading();
|
||||
emit("update:modelValue", fileList.value);
|
||||
this.$modal.closeLoading();
|
||||
|
||||
}
|
||||
} else {
|
||||
number.value--;
|
||||
proxy.$modal.closeLoading();
|
||||
proxy.$modal.msgError(res.msg);
|
||||
proxy.$refs.fileUpload.handleRemove(file);
|
||||
uploadedSuccessfully();
|
||||
}
|
||||
this.number--;
|
||||
this.$modal.closeLoading();
|
||||
this.$modal.msgError(res.msg);
|
||||
this.$refs.fileUpload.handleRemove(file);
|
||||
this.uploadedSuccessfully();
|
||||
}
|
||||
},
|
||||
handleDelete(index) {
|
||||
this.fileList.splice(index, 1);
|
||||
this.$emit("input", this.listToString(this.fileList));
|
||||
},
|
||||
uploadedSuccessfully() {
|
||||
if (this.number > 0 && this.uploadList.length === this.number) {
|
||||
this.fileList = this.fileList.concat(this.uploadList);
|
||||
this.uploadList = [];
|
||||
console.log(179,this.fileList)
|
||||
this.number = 0;
|
||||
this.$emit("input", this.fileList);
|
||||
|
||||
// 删除文件
|
||||
function handleDelete(index) {
|
||||
fileList.value.splice(index, 1);
|
||||
emit("update:modelValue", listToString(fileList.value));
|
||||
this.$modal.closeLoading();
|
||||
}
|
||||
|
||||
// 上传结束处理
|
||||
function uploadedSuccessfully() {
|
||||
if (number.value > 0 && uploadList.value.length === number.value) {
|
||||
fileList.value = fileList.value.filter(f => f.url !== undefined).concat(uploadList.value);
|
||||
uploadList.value = [];
|
||||
number.value = 0;
|
||||
//emit("update:modelValue", listToString(fileList.value));
|
||||
emit("update:modelValue", fileList.value);
|
||||
proxy.$modal.closeLoading();
|
||||
}
|
||||
}
|
||||
|
||||
// 获取文件名称
|
||||
function getFileName(name) {
|
||||
// 如果是url那么取最后的名字 如果不是直接返回
|
||||
},
|
||||
getFileName(name) {
|
||||
if (name.lastIndexOf("/") > -1) {
|
||||
return name.slice(name.lastIndexOf("/") + 1);
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
// 对象转成指定字符串分隔
|
||||
function listToString(list, separator) {
|
||||
},
|
||||
listToString(list, separator) {
|
||||
let strs = "";
|
||||
separator = separator || ",";
|
||||
for (let i in list) {
|
||||
@ -228,10 +198,11 @@ function listToString(list, separator) {
|
||||
strs += list[i].url + separator;
|
||||
}
|
||||
}
|
||||
return strs != '' ? strs.substr(0, strs.length - 1) : '';
|
||||
}
|
||||
return strs!= ""? strs.substr(0, strs.length - 1) : "";
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.upload-file-uploader {
|
||||
margin-bottom: 5px;
|
||||
|
12
src/main.js
12
src/main.js
@ -20,6 +20,12 @@ import { parseTime, resetForm, handleTree, addBeginAndEndTime, divide} from "@/u
|
||||
import Pagination from "@/components/Pagination";
|
||||
// 自定义表格工具扩展
|
||||
import RightToolbar from "@/components/RightToolbar"
|
||||
// 图片上传组件
|
||||
import ImageUpload from "@/components/ImageUpload/index.vue";
|
||||
// 文件上传组件
|
||||
import FileUpload from "@/components/FileUpload2/index.vue";
|
||||
// 图片预览组件
|
||||
import ImagePreview from "@/components/ImagePreview/index.vue";
|
||||
// 代码高亮插件
|
||||
// import hljs from 'highlight.js'
|
||||
// import 'highlight.js/styles/github-gist.css'
|
||||
@ -43,6 +49,9 @@ Vue.component('DictTag', DictTag)
|
||||
Vue.component('DocAlert', DocAlert)
|
||||
Vue.component('Pagination', Pagination)
|
||||
Vue.component('RightToolbar', RightToolbar)
|
||||
Vue.component("ImageUpload", ImageUpload);
|
||||
Vue.component("ImagePreview", ImagePreview);
|
||||
Vue.component("FileUpload", FileUpload);
|
||||
// 字典标签组件
|
||||
import DictTag from '@/components/DictTag'
|
||||
import DocAlert from '@/components/DocAlert'
|
||||
@ -75,7 +84,8 @@ import '@/styles/index.scss'
|
||||
// 默认点击背景不关闭弹窗
|
||||
import ElementUI from 'element-ui'
|
||||
ElementUI.Dialog.props.closeOnClickModal.default = false
|
||||
|
||||
import dayjs from "dayjs"
|
||||
Vue.prototype.$dayjs = dayjs;
|
||||
/**
|
||||
* If you don't want to use mock-server
|
||||
* you want to use MockJs for mock api
|
||||
|
@ -97,3 +97,50 @@ export function removeTenantId() {
|
||||
|
||||
export class getToken {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取预览地址
|
||||
* @param url 请求地址不带,无需带orgin
|
||||
* @param fullfilename 文件名
|
||||
* @param watermarkTxt 水印
|
||||
*/
|
||||
export function getPreViewUrl(url, fullfilename, watermarkTxt) {
|
||||
// let Base64 = require('js-base64').Base64
|
||||
let connectChart = url.indexOf("?") !== -1 ? "&" : "?";
|
||||
let urlAdded =
|
||||
website.ossUrl +
|
||||
url +
|
||||
connectChart +
|
||||
"fullfilename=" +
|
||||
randomString(8) +
|
||||
"-" +
|
||||
fullfilename +
|
||||
"&Authorization=Bearer " +
|
||||
getToken();
|
||||
let preViewUrl =
|
||||
website.preViewUrl + encodeURIComponent(Base64.encode(urlAdded));
|
||||
if (watermarkTxt) {
|
||||
preViewUrl += "&watermarkTxt=" + watermarkTxt;
|
||||
}
|
||||
return preViewUrl;
|
||||
}
|
||||
export function getPreViewUrlForPhone(url, fullfilename, watermarkTxt) {
|
||||
console.log(url,86)
|
||||
let connectChart = '&' ;
|
||||
let urlAdded = website.ossUrl +
|
||||
url +
|
||||
connectChart +
|
||||
'fullfilename=' +
|
||||
randomString(8) +
|
||||
'-' +
|
||||
fullfilename +
|
||||
'&Authorization=Bearer ' +
|
||||
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZGVudGl0eUlkIjoxLCJkZXB0SWQiOjEsIm5pY2tuYW1lIjoiR2xvYmFsIFVzZXIiLCJ0ZW5hbnQtaWQiOjEsInVzZXJuYW1lIjoiR2xvYmFsIFVzZXIiLCJleHAiOjE5NzU2NTcyNzZ9.VuFK-ubqp54VwSL3O8yprt7lMWkc77jfSboxUXtRqQ4";
|
||||
let preViewUrl =
|
||||
"https://ylgfscgk.ylgf.com:17031/kkPreview/onlinePreview?url=" + encodeURIComponent(Base64.encode(urlAdded))
|
||||
console.log(urlAdded,90)
|
||||
if (watermarkTxt) {
|
||||
preViewUrl += ('&watermarkTxt=' + watermarkTxt)
|
||||
}
|
||||
return preViewUrl;
|
||||
}
|
||||
|
@ -208,5 +208,42 @@ function handleAuthorized() {
|
||||
}
|
||||
return Promise.reject('无效的会话,或者会话已过期,请重新登录。')
|
||||
}
|
||||
let downloadLoadingInstance;
|
||||
|
||||
// 通用下载方法
|
||||
export function download(url, params, filename, config) {
|
||||
downloadLoadingInstance = ElLoading.service({text: "正在下载数据,请稍候", background: "rgba(0, 0, 0, 0.7)",})
|
||||
return axios.post(url, params, {
|
||||
transformRequest: [(params) => {
|
||||
return tansParams(params)
|
||||
}],
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||
responseType: 'blob',
|
||||
...config
|
||||
}).then(async (data) => {
|
||||
const isBlob = blobValidate(data.data);
|
||||
if (isBlob) {
|
||||
let blob = new Blob([data.data], {type: "application/vnd.ms-excel"}); // 设置文件类型excel
|
||||
let url = window.URL.createObjectURL(blob); // 创建一个临时的url指向blob对象
|
||||
// 创建url之后可以模拟对此文件对象的一系列操作,例如:预览、下载
|
||||
let a = document.createElement("a");
|
||||
a.href = url;
|
||||
a.download = filename + ".xlsx";
|
||||
a.click();
|
||||
// 释放这个临时的对象url
|
||||
window.URL.revokeObjectURL(url);
|
||||
} else {
|
||||
const resText = await data.data.text();
|
||||
const rspObj = JSON.parse(resText);
|
||||
const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
|
||||
ElMessage.error(errMsg);
|
||||
}
|
||||
downloadLoadingInstance.close();
|
||||
}).catch((r) => {
|
||||
console.error(r)
|
||||
ElMessage.error('下载文件出现错误,请联系管理员!')
|
||||
downloadLoadingInstance.close();
|
||||
})
|
||||
}
|
||||
|
||||
export default service
|
||||
|
@ -36,9 +36,9 @@
|
||||
<div class="right-box-top">
|
||||
<div class="left-ds-box">
|
||||
<div style="display: flex; align-items: center">
|
||||
<el-button class="lan-bottom" @click="centerDialogVisible = true" v-if="tabIndex != 6">上传文件</el-button>
|
||||
<el-button class="lan-bottom" @click="openUpload()" v-if="tabIndex != 6">上传文件</el-button>
|
||||
<el-button class="lan-bottom" @click="Bfolder()" v-if="tabIndex != 6">新建文件夹</el-button>
|
||||
<el-button class="dlan-bottom" @click="handleExport()" v-if="tabIndex != 6">批量导出</el-button>
|
||||
|
||||
<el-button class="hong-bottom" v-if="tabIndex != 6" @click="handleDelete">批量删除</el-button>
|
||||
<el-button class="hong-bottom" v-if="tabIndex == 6" @click="handleRealDelete">批量删除</el-button>
|
||||
<el-button class="hong-bottom" @click="returnDir" v-if="tabIndex != 6">返回</el-button>
|
||||
@ -46,7 +46,7 @@
|
||||
|
||||
<div class="input-box">
|
||||
<!-- <input type="text" @input="findAllDocLists()" v-model="queryParams.originalFilename" placeholder="输入搜索关键词"> -->
|
||||
<el-input @input="findAllDocLists()" v-model="queryParams.originalFilename" placeholder="输入搜索关键词" :prefix-icon="Search"/>
|
||||
<el-input @input="findAllDocLists()" v-model="queryParams.originalFilename" placeholder="输入搜索关键词" />
|
||||
</div>
|
||||
</div>
|
||||
<el-table
|
||||
@ -61,15 +61,15 @@
|
||||
<el-table-column property="curFilename" label="名称" width="360">
|
||||
<template #default="scope">
|
||||
<div style="display: flex;align-items: center" @click="shijian(scope.row)">
|
||||
<img src="/src/views/knowledge/assets/images/wjj.png" v-if=" scope.row.type == '0' " @click="enterDir(scope.row)"
|
||||
<img src="../../assets/images/wjj.png" v-if=" scope.row.type == '0' " @click="enterDir(scope.row)"
|
||||
style="width: 28px; height: 28px;margin-right: 5px">
|
||||
<img src="/src/views/knowledge/assets/images/wd.png" v-if=" scope.row.type == '3' " @click="view(scope.row)"
|
||||
<img src="../../assets/images/wd.png" v-if=" scope.row.type == '3' " @click="view(scope.row)"
|
||||
style="width: 28px; height: 28px;margin-right: 5px">
|
||||
<img src="/src/views/knowledge/assets/images/zp.png" v-if=" scope.row.type == '1' " @click="view(scope.row)"
|
||||
<img src="../../assets/images/zp.png" v-if=" scope.row.type == '1' " @click="view(scope.row)"
|
||||
style="width: 28px; height: 28px;margin-right: 5px">
|
||||
<img src="/src/views/knowledge/assets/images/yp.png" v-if=" scope.row.type == '4' " @click="view(scope.row)"
|
||||
<img src="../../assets/images/yp.png" v-if=" scope.row.type == '4' " @click="view(scope.row)"
|
||||
style="width: 28px; height: 28px;margin-right: 5px">
|
||||
<img src="/src/views/knowledge/assets/images/sp.png" v-if=" scope.row.type == '2' " @click="view(scope.row)"
|
||||
<img src="../../assets/images/sp.png" v-if=" scope.row.type == '2' " @click="view(scope.row)"
|
||||
style="width: 28px; height: 28px;margin-right: 5px">
|
||||
<div v-if="scope.row.curFilename" style="cursor:pointer" > {{ scope.row.curFilename }}</div>
|
||||
<div v-else > {{ scope.row.curFilename }}</div>
|
||||
@ -78,7 +78,9 @@
|
||||
</el-table-column>
|
||||
<el-table-column property="fileSize" label="大小">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.fileSize }}KB</span>
|
||||
<span >{{ (scope.row.fileSize/(1024*1024)).toFixed(1) }}MB</span>
|
||||
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="type" label="类型">
|
||||
@ -92,7 +94,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column property="createTime" label="创建时间" v-if="tabIndex != 6 ">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.createTime }}</span>
|
||||
<span>{{ formatDate(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column property="updateTime" label="删除日期" v-if="tabIndex == 6 ">
|
||||
@ -117,10 +119,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<el-dialog v-model="centerDialogVisible" title="上传文件" width="500" center>
|
||||
<el-dialog :visible.sync="centerDialogVisible" title="上传文件" width="500" center>
|
||||
<div style="display: flex">
|
||||
<span style="color: red;margin-right: 10px">*</span>
|
||||
<FileUpload v-if="centerDialogVisible" @update:modelValue="uploadUrl" :limit="5"></FileUpload>
|
||||
<FileUpload v-if="centerDialogVisible" v-model="fileInfos" :limit="5"></FileUpload>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
@ -131,7 +133,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
<el-dialog v-model="folder" title="新建文件夹" width="500" center>
|
||||
<el-dialog :visible.sync="folder" title="新建文件夹" width="500" center>
|
||||
<div class="wj-box">
|
||||
<div><span style="color: red">*</span> 名称:</div>
|
||||
<el-input v-model="form.curFilename" style="width: 240px" placeholder="请输入新建文件夹名称"/>
|
||||
@ -149,24 +151,24 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="archives">
|
||||
<script>
|
||||
import { findAll, save, delByIds, ackDelete, restore, getParentId, findAllDocList } from "@/api/knowledge/tarchives/tarchives";
|
||||
import {getPreViewUrl} from "utils/auth";
|
||||
import {downloadFileUrl,downloadFile} from "../util/file"
|
||||
import {Search} from '@element-plus/icons-vue';
|
||||
const loading = ref(true);
|
||||
const {proxy} = getCurrentInstance();
|
||||
const tabIndex = ref(1);
|
||||
import { getPreViewUrl } from "@/utils/auth";
|
||||
import { downloadFileUrl, downloadFile } from "../util/file";
|
||||
|
||||
const folder = ref(false)
|
||||
const input = ref('')
|
||||
const parentId = ref('')
|
||||
const tableData = ref([]);
|
||||
const ids = ref(null);
|
||||
const idList = ref(null);
|
||||
const selectIds = ref(null);
|
||||
const total = ref(0);
|
||||
const data = reactive({
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
tabIndex: 1,
|
||||
folder: false,
|
||||
input: '',
|
||||
parentId: '',
|
||||
tableData: [],
|
||||
ids: null,
|
||||
idList: null,
|
||||
selectIds: null,
|
||||
total: 0,
|
||||
form: {},
|
||||
queryParams: {
|
||||
originalFilename: "",
|
||||
@ -176,7 +178,6 @@ const data = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10
|
||||
},
|
||||
|
||||
rules: {
|
||||
parentId: [{ required: true, message: "上级部门不能为空", trigger: "blur" }],
|
||||
deptName: [{ required: true, message: "部门名称不能为空", trigger: "blur" }],
|
||||
@ -184,269 +185,255 @@ const data = reactive({
|
||||
email: [{ type: "email", message: "请输入正确的邮箱地址", trigger: ["blur", "change"] }],
|
||||
phone: [{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }]
|
||||
},
|
||||
});
|
||||
centerDialogVisible: false,
|
||||
presentId: null,
|
||||
fileInfos: []
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
formatDate(value) {
|
||||
const date = new Date(value);
|
||||
// 使用toISOString将日期格式化为YYYY-MM-DD
|
||||
const isoString = date.toISOString();
|
||||
// 将ISO字符串分割并取前面的日期部分
|
||||
return isoString.slice(0, 10);
|
||||
|
||||
},
|
||||
padLeftZero(str) {
|
||||
return ('00' + str).substr(str.length)
|
||||
},
|
||||
|
||||
const {queryParams, form, rules} = toRefs(data);
|
||||
|
||||
openUpload(){
|
||||
console.log(193)
|
||||
this.centerDialogVisible = true
|
||||
},
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
const centerDialogVisible = ref(false);
|
||||
const presentId = ref(null);
|
||||
const fileInfos = ref([])
|
||||
|
||||
function uploadUrl(obj) {
|
||||
fileInfos.value = obj
|
||||
}
|
||||
function cancel(){
|
||||
centerDialogVisible.value = false;
|
||||
fileInfos.value = []
|
||||
}
|
||||
function addFile() {
|
||||
if (!fileInfos.value) {
|
||||
console.log("211",fileInfos.value)
|
||||
proxy.$modal.msgError("请选择文件")
|
||||
return
|
||||
}
|
||||
if (fileInfos.value.length > 5) {
|
||||
proxy.$modal.msgError("最多只能选择五个文件")
|
||||
uploadUrl(obj) {
|
||||
this.fileInfos = obj;
|
||||
},
|
||||
cancel() {
|
||||
this.centerDialogVisible = false;
|
||||
this.fileInfos = [];
|
||||
},
|
||||
addFile() {
|
||||
console.log(this.fileInfos,207)
|
||||
if (!this.fileInfos) {
|
||||
this.$modal.msgError("请选择文件");
|
||||
return;
|
||||
}
|
||||
// const fileInfo = fileInfos.value[0]
|
||||
|
||||
fileInfos.value.forEach(fileInfo => {
|
||||
console.log(fileInfo);
|
||||
this.fileInfos.forEach(fileInfo => {
|
||||
let data = {
|
||||
parentId: presentId.value, originalFilename: fileInfo.name,
|
||||
fileUrl: fileInfo.url, fileSize: fileInfo.size
|
||||
}
|
||||
parentId: this.presentId,
|
||||
originalFilename: fileInfo.name,
|
||||
fileUrl: fileInfo.url,
|
||||
fileSize: fileInfo.size
|
||||
};
|
||||
save(data).then(res => {
|
||||
console.log(res,229)
|
||||
centerDialogVisible.value = false
|
||||
if (res.data.code==200){
|
||||
folder.value = false;
|
||||
form.value = {}
|
||||
if (res.code === 200) {
|
||||
this.folder = false;
|
||||
this.form = {};
|
||||
} else {
|
||||
// proxy.$modal.msgError(res.data.msg);
|
||||
// this.$modal.msgError(res.data.msg);
|
||||
}
|
||||
})
|
||||
this.getList();
|
||||
this.centerDialogVisible = false
|
||||
});
|
||||
proxy.$modal.msgSuccess("上传成功");
|
||||
getList();
|
||||
}
|
||||
function shijian(data) {
|
||||
if (data.type == '0'){
|
||||
enterDir(data)
|
||||
}else {
|
||||
view(data)
|
||||
}
|
||||
}
|
||||
function enterDir(data) {
|
||||
queryParams.value.pageNo =1;
|
||||
if (data.isRecycled == 1 && data.isDir == 0) {
|
||||
queryParams.value.parentId = data.id
|
||||
parentId.value = data.id
|
||||
form.value.parentId = data.id
|
||||
getList()
|
||||
}
|
||||
presentId.value = data.id
|
||||
}
|
||||
|
||||
function returnDir() {
|
||||
});
|
||||
|
||||
this.$modal.msgSuccess("上传成功");
|
||||
|
||||
},
|
||||
shijian(data) {
|
||||
if (data.type === '0') {
|
||||
this.enterDir(data);
|
||||
} else {
|
||||
this.view(data);
|
||||
}
|
||||
},
|
||||
enterDir(data) {
|
||||
this.queryParams.pageNo = 1;
|
||||
if (data.isRecycled === 1 && data.isDir === 0) {
|
||||
this.queryParams.parentId = data.id;
|
||||
this.parentId = data.id;
|
||||
this.form.parentId = data.id;
|
||||
this.getList();
|
||||
}
|
||||
this.presentId = data.id;
|
||||
},
|
||||
returnDir() {
|
||||
let data = {
|
||||
id:presentId.value
|
||||
}
|
||||
queryParams.value.pageNo =1;
|
||||
getParentId(data).then((res=>{
|
||||
console.log("260",res.data.data)
|
||||
if (res.data.data.data.parentId){
|
||||
queryParams.value.parentId = res.data.data.data.parentId
|
||||
form.value.parentId = res.data.data.data.parentId
|
||||
presentId.value = res.data.data.data.parentId
|
||||
id: this.presentId
|
||||
};
|
||||
this.queryParams.pageNo = 1;
|
||||
getParentId(data).then(res => {
|
||||
if (res.data.parentId) {
|
||||
this.queryParams.parentId = res.data.parentId;
|
||||
this.form.parentId = res.data.parentId;
|
||||
this.presentId = res.data.parentId;
|
||||
} else {
|
||||
queryParams.value.parentId = ''
|
||||
form.value.parentId = ''
|
||||
console.log("267",res.data.data.data.parentId)
|
||||
this.queryParams.parentId = '';
|
||||
this.form.parentId = '';
|
||||
}
|
||||
getList()
|
||||
}))
|
||||
}
|
||||
|
||||
this.getList();
|
||||
});
|
||||
},
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
console.log("266",selection)
|
||||
let tempId = selection.map(item => item.id)
|
||||
selectIds.value = tempId.join(',')
|
||||
ids.value = tempId.join(',')
|
||||
console.log("271",ids.value)
|
||||
}
|
||||
|
||||
|
||||
handleSelectionChange(selection) {
|
||||
let tempId = selection.map(item => item.id);
|
||||
this.selectIds = tempId.join(',');
|
||||
this.ids = tempId.join(',');
|
||||
},
|
||||
/** 文件查看 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
findAll(queryParams.value).then(response => {
|
||||
console.log(response)
|
||||
tableData.value = response.data.data.records;
|
||||
total.value = response.data.data.total;
|
||||
loading.value = false;
|
||||
getList() {
|
||||
this.loading = true;
|
||||
findAll(this.queryParams).then(response => {
|
||||
console.log(response,274)
|
||||
this.tableData = response.data.records;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
function pageCurrentChangeHandle(val) {
|
||||
loading.value = true;
|
||||
queryParams.value.pageNo = val;
|
||||
findAll(queryParams.value).then(response => {
|
||||
console.log(response)
|
||||
tableData.value = response.data.data.records;
|
||||
total.value = response.data.data.total;
|
||||
loading.value = false;
|
||||
},
|
||||
pageCurrentChangeHandle(val) {
|
||||
this.loading = true;
|
||||
this.queryParams.pageNo = val;
|
||||
findAll(this.queryParams).then(response => {
|
||||
this.tableData = response.data.records;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
function pageSizeChangeHandle(val) {
|
||||
loading.value = true;
|
||||
queryParams.value.pageNo = 1;
|
||||
queryParams.value.pageSize = val;
|
||||
findAll(queryParams.value).then(response => {
|
||||
console.log(response)
|
||||
tableData.value = response.data.data.records;
|
||||
total.value = response.data.data.total;
|
||||
loading.value = false;
|
||||
},
|
||||
pageSizeChangeHandle(val) {
|
||||
this.loading = true;
|
||||
this.queryParams.pageNo = 1;
|
||||
this.queryParams.pageSize = val;
|
||||
findAll(this.queryParams).then(response => {
|
||||
this.tableData = response.data.records;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
/** 文件查看 */
|
||||
function findAllDocLists() {
|
||||
loading.value = true;
|
||||
findAllDocList(queryParams.value).then(response => {
|
||||
console.log(response)
|
||||
tableData.value = response.data.data.records;
|
||||
total.value = response.data.data.total;
|
||||
loading.value = false;
|
||||
findAllDocLists() {
|
||||
this.loading = true;
|
||||
findAllDocList(this.queryParams).then(response => {
|
||||
this.tableData = response.data.records;
|
||||
this.total = response.data.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
clickType(type, idx) {
|
||||
this.queryParams.pageNo = 1;
|
||||
this.tableData = [];
|
||||
this.form.parentId = null;
|
||||
this.tabIndex = idx;
|
||||
this.loading = true;
|
||||
this.queryParams.parentId = null;
|
||||
this.queryParams.isRecycled = 1;
|
||||
this.queryParams.type = type;
|
||||
this.getList();
|
||||
},
|
||||
getListRecycled(idx) {
|
||||
this.tabIndex = idx;
|
||||
this.loading = true;
|
||||
this.queryParams.type = null;
|
||||
this.queryParams.parentId = null;
|
||||
this.queryParams.isRecycled = 0;
|
||||
this.getList();
|
||||
},
|
||||
closeDir() {
|
||||
this.form = {};
|
||||
this.folder = false;
|
||||
},
|
||||
/** 文件保存 */
|
||||
createDir() {
|
||||
if (!this.form.curFilename) {
|
||||
this.$modal.msgWarning("请填写文件名称");
|
||||
return;
|
||||
}
|
||||
|
||||
function clickType(type, idx) {
|
||||
queryParams.value.pageNo = 1;
|
||||
tableData.value = [];
|
||||
form.value.parentId = null;
|
||||
tabIndex.value = idx
|
||||
loading.value = true;
|
||||
queryParams.value.parentId = null
|
||||
queryParams.value.isRecycled = 1
|
||||
queryParams.value.type = type
|
||||
getList()
|
||||
}
|
||||
|
||||
function getListRecycled(idx) {
|
||||
tabIndex.value = idx
|
||||
loading.value = true;
|
||||
queryParams.value.type = null
|
||||
queryParams.value.parentId = null
|
||||
queryParams.value.isRecycled = 0
|
||||
getList()
|
||||
}
|
||||
|
||||
function closeDir() {
|
||||
form.value = {}
|
||||
folder.value = false;
|
||||
}
|
||||
|
||||
/** 文件jia保存 */
|
||||
function createDir() {
|
||||
console.log("286",form.value)
|
||||
if (!form.value.curFilename) {
|
||||
proxy.$modal.msgWarning("请填写文件名称");
|
||||
return
|
||||
}
|
||||
if (form.value.id != undefined) {
|
||||
save(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
folder.value = false;
|
||||
getList();
|
||||
if (this.form.id!== undefined) {
|
||||
save(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.folder = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
save(form.value).then(response => {
|
||||
console.log("301",response.data)
|
||||
if (response.data.code==200){
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
folder.value = false;
|
||||
form.value = {}
|
||||
getList();
|
||||
save(this.form).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.folder = false;
|
||||
this.form = {};
|
||||
this.getList();
|
||||
} else {
|
||||
proxy.$modal.msgError(response.data.msg);
|
||||
this.$modal.msgError(response.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
/** 文件删除 */
|
||||
function handleDelete(row) {
|
||||
const ids = row.id || selectIds.value;
|
||||
proxy.$modal.confirm('是否确认删除此项数据?').then(function () {
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.selectIds;
|
||||
this.$modal.confirm('是否确认删除此项数据?').then(() => {
|
||||
let data = {
|
||||
ids: ids
|
||||
}
|
||||
};
|
||||
return delByIds(data);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
/** 彻底删除 */
|
||||
function handleRealDelete(row) {
|
||||
const ids = row.id || selectIds.value;
|
||||
proxy.$modal.confirm('是否确认删除此项数据?').then(function () {
|
||||
handleRealDelete(row) {
|
||||
const ids = row.id || this.selectIds;
|
||||
this.$modal.confirm('是否确认删除此项数据?').then(() => {
|
||||
let data = {
|
||||
ids: ids
|
||||
}
|
||||
};
|
||||
return ackDelete(data);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
function handleExport(){
|
||||
|
||||
proxy.download("/knowledge/system/tArchives/export", queryParams.value, `档案管理_${new Date().getTime()}`);
|
||||
|
||||
}
|
||||
},
|
||||
handleExport() {
|
||||
this.$download("/knowledge/system/tArchives/export", this.queryParams, `档案管理_${new Date().getTime()}`);
|
||||
},
|
||||
/** 还原 */
|
||||
function restores(row) {
|
||||
const ids = row.id || ids.value;
|
||||
proxy.$modal.confirm('是否确认还原此项数据?').then(function () {
|
||||
restores(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认还原此项数据?').then(() => {
|
||||
let data = {
|
||||
ids: ids
|
||||
}
|
||||
};
|
||||
return restore(data);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("还原成功");
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("还原成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
}
|
||||
|
||||
function down(row){
|
||||
downloadFile(row.fileUrl,row.originalFilename)
|
||||
}
|
||||
function view(row){
|
||||
},
|
||||
down(row) {
|
||||
downloadFile(row.fileUrl,row.originalFilename);
|
||||
},
|
||||
view(row) {
|
||||
var preViewUrl = getPreViewUrl(downloadFileUrl + "?fileName=" + row.fileUrl, row.fileUrl, "连铝");
|
||||
window.open(preViewUrl);
|
||||
},
|
||||
Bfolder() {
|
||||
this.folder = true;
|
||||
}
|
||||
|
||||
|
||||
function Bfolder() {
|
||||
folder.value = true
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
}
|
||||
|
||||
getList()
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
.centenr {
|
||||
|
@ -1,7 +1,5 @@
|
||||
import request from "@/axios"
|
||||
import website from "@/config/website";
|
||||
import {Base64} from "js-base64";
|
||||
import {getToken} from "utils/auth";
|
||||
import request from '@/utils/request'
|
||||
import {getToken} from "@/utils/auth";
|
||||
|
||||
const apiUrl = `/knowledge/api`
|
||||
|
||||
@ -49,7 +47,7 @@ export const deleteFile = fileCode => {
|
||||
// 文件下载
|
||||
export const downloadFile = (url,fileName) => {
|
||||
request({
|
||||
url: downloadFileUrl+"?fileName=" + url,
|
||||
url: url,
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
}).then(res => {
|
||||
|
Loading…
Reference in New Issue
Block a user