forked from integrated_whb/integrated_whb_vue
init
parent
3ad49a0620
commit
079e4c17b9
4
.env
4
.env
|
@ -1,5 +1,5 @@
|
|||
VITE_BASE_URL=http://192.168.0.17:8001/
|
||||
VITE_PROXY=/api
|
||||
VITE_PROXY=/api/
|
||||
VITE_FILE_URL=https://file.zcloudchina.com/YTHFile
|
||||
VITE_TEMPLATE_URL='https://qaaq.qhdsafety.com/file/'
|
||||
VITE_TEMPLATE_URL=https://qaaq.qhdsafety.com/file/
|
||||
|
||||
|
|
|
@ -112,6 +112,19 @@ export default [
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/system_operation",
|
||||
redirect: "/system_operation/system_documents",
|
||||
meta: { title: "体系运行", model: MODEL["1"] },
|
||||
component: "children",
|
||||
children: [
|
||||
{
|
||||
path: "/system_operation/system_documents",
|
||||
meta: { title: "体系文件", isSubMenu: false },
|
||||
component: "system_operation/system_documents/index",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/platform_resource_library",
|
||||
redirect: "/platform_resource_library/courseware",
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
getLevelsAndChildrenNumber,
|
||||
getRegulatoryType,
|
||||
getDepartmentTree,
|
||||
getLevelsCorp,
|
||||
} from "@/request/data_dictionary.js";
|
||||
import { ref } from "vue";
|
||||
|
||||
|
@ -112,21 +113,21 @@ export const layoutFnGetPersonnelType = async () => {
|
|||
};
|
||||
// 职务
|
||||
export const layoutFnGetDuties = async () => {
|
||||
const resData = await getLevels({
|
||||
const resData = await getLevelsCorp({
|
||||
DICTIONARIES_ID: "09e36ac01e9540f8bc84eab1c1a78754",
|
||||
});
|
||||
return ref(resData.list);
|
||||
};
|
||||
// 职称
|
||||
export const layoutFnGetProfessionalTitle = async () => {
|
||||
const resData = await getLevels({
|
||||
const resData = await getLevelsCorp({
|
||||
DICTIONARIES_ID: "945a6b10e59946078b500f0fbafa8679",
|
||||
});
|
||||
return ref(resData.list);
|
||||
};
|
||||
// 工种
|
||||
export const layoutFnGetJobType = async () => {
|
||||
const resData = await getLevels({
|
||||
const resData = await getLevelsCorp({
|
||||
DICTIONARIES_ID: "55484e491a5e442d839c4595380713ec",
|
||||
});
|
||||
return ref(resData.list);
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
import { ElMessageBox } from "element-plus";
|
||||
import { getFileName, getFileSuffix } from "@/assets/js/utils.js";
|
||||
|
||||
export default async function useDownloadFile(url, name) {
|
||||
if (!url) throw new Error("没有下载地址");
|
||||
await ElMessageBox.confirm("确定要下载此文件吗?", { type: "warning" });
|
||||
const FILE_URL = import.meta.env.VITE_FILE_URL;
|
||||
name = name ? name + getFileSuffix(url) : getFileName(url);
|
||||
fetch(FILE_URL + url)
|
||||
.then((res) => res.blob())
|
||||
.then((blob) => {
|
||||
const a = document.createElement("a");
|
||||
document.body.appendChild(a);
|
||||
a.style.display = "none";
|
||||
const url = window.URL.createObjectURL(blob);
|
||||
a.href = url;
|
||||
a.download = `${name}`;
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
window.URL.revokeObjectURL(url);
|
||||
});
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
/**
|
||||
* @description 计算序号
|
||||
|
@ -266,16 +266,6 @@ export function secondConversion(second) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 下载附件
|
||||
* @param {string} filePah 下载路径
|
||||
**/
|
||||
export async function downloadFile(filePah) {
|
||||
const FILE_URL = import.meta.env.VITE_FILE_URL;
|
||||
await ElMessageBox.confirm("确定要下载此文件吗?", { type: "warning" });
|
||||
window.open(FILE_URL + filePah, "_blank");
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 附件添加前缀
|
||||
* @param {Array} list 附件数组
|
||||
|
@ -319,6 +309,18 @@ export function translationStatus(status, list) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 计算文件大小
|
||||
* @param {number | string} size 文件kb
|
||||
* @return {string} 计算后的文件大小
|
||||
**/
|
||||
export function calculateFileSize(size) {
|
||||
return size > 1024
|
||||
? (size / 1024 + "").substring(0, (size / 1024 + "").lastIndexOf(".") + 3) +
|
||||
"MB"
|
||||
: size + "KB";
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 根据身份证号获取出生日期和性别
|
||||
* @param {String} idCard 身份证号
|
||||
|
|
|
@ -86,6 +86,10 @@ const play = () => {
|
|||
const pause = () => {
|
||||
player && player.pause();
|
||||
};
|
||||
defineExpose({
|
||||
play,
|
||||
pause,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
ref="pdfRef"
|
||||
v-for="page in numOfPages"
|
||||
:key="page"
|
||||
:src="src"
|
||||
:src="VITE_FILE_URL + src"
|
||||
:page="page"
|
||||
/>
|
||||
</div>
|
||||
|
@ -18,6 +18,7 @@ import { VuePdf, createLoadingTask } from "vue3-pdfjs/esm";
|
|||
import { ElMessage } from "element-plus";
|
||||
import { useVModel } from "@vueuse/core";
|
||||
|
||||
const VITE_FILE_URL = import.meta.env.VITE_FILE_URL;
|
||||
defineOptions({
|
||||
name: "LayoutPdf",
|
||||
});
|
||||
|
@ -38,7 +39,7 @@ const pdfRef = ref(null);
|
|||
const numOfPages = ref(0);
|
||||
watchEffect(() => {
|
||||
if (props.visible) {
|
||||
const loadingTask = createLoadingTask(props.src);
|
||||
const loadingTask = createLoadingTask(VITE_FILE_URL + props.src);
|
||||
loadingTask.promise
|
||||
.then((pdf) => {
|
||||
numOfPages.value = pdf.numPages;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
>
|
||||
<div>{{ item.NAME }}</div>
|
||||
<div>
|
||||
<el-icon @click="fnDelete(index)">
|
||||
<el-icon @click.stop="fnDelete(index)">
|
||||
<circle-close />
|
||||
</el-icon>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<template>
|
||||
<el-dialog title="视频" v-model="visible">
|
||||
<ali-player :source="fnSrc(src)" ref="playerRef" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useVModel } from "@vueuse/core";
|
||||
import AliPlayer from "@/components/ali-player/index.vue";
|
||||
import { ref, watchEffect } from "vue";
|
||||
|
||||
const VITE_FILE_URL = import.meta.env.VITE_FILE_URL;
|
||||
defineOptions({
|
||||
name: "LayoutVideo",
|
||||
});
|
||||
const props = defineProps({
|
||||
src: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
visible: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(["update:visible"]);
|
||||
const visible = useVModel(props, "visible", emits);
|
||||
const playerRef = ref(null);
|
||||
const fnSrc = (src) => {
|
||||
if (src.indexOf("http") !== -1 || src.indexOf("https") !== -1) return src;
|
||||
else return VITE_FILE_URL + src;
|
||||
};
|
||||
watchEffect(() => {
|
||||
if (visible.value) {
|
||||
playerRef.value && playerRef.value.play();
|
||||
} else {
|
||||
playerRef.value && playerRef.value.pause();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
|
@ -3,6 +3,7 @@ import { post, upload } from "./axios";
|
|||
export const Login = (params) => post("/admin/check", params); // 登录
|
||||
export const logout = (params) => post("/main/logout", params); // 退出登录
|
||||
export const getAsyncRouter = (params) => post("/main/index", params); // 获取动态路由
|
||||
export const getHasMenu = (params) => post("/head/hasMenu", params); // 获取有没有权限访问路由
|
||||
export const getUserInfo = (params) => post("/user/goEditMyInfo", params); // 获取用户信息
|
||||
export const setUserInfo = (params) => post("/user/editUserOwn", params); // 修改用户信息
|
||||
export const getVerifyDuplicateEmail = (params) =>
|
||||
|
|
|
@ -6,6 +6,12 @@ export const getLevels = (params) =>
|
|||
loading: false,
|
||||
...params,
|
||||
});
|
||||
// 获取数据字典
|
||||
export const getLevelsCorp = (params) =>
|
||||
post("/dictionariesCorp/getLevels", {
|
||||
loading: false,
|
||||
...params,
|
||||
});
|
||||
// 获取数据字典包括子级数量
|
||||
export const getLevelsAndChildrenNumber = (params) =>
|
||||
post("/dictionaries/getLevelsAndSCount", {
|
||||
|
|
|
@ -39,3 +39,6 @@ export const getUserScheduleView = (params) =>
|
|||
post("/shiftworkperiod/getWorkDate", params); // 用户管理查看排班表
|
||||
export const setDictionaryDelete = (params) =>
|
||||
post("/dictionariesCorp/delete", params); // 数据字典删除
|
||||
export const setUserAdd = (params) => post("/user/saveUser", params); // 用户管理添加
|
||||
export const setUserEdit = (params) => post("/user/editUser", params); // 用户管理修改
|
||||
export const getUserView = (params) => post("/user/goEditUser", params); // 用户管理查看
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import { post, upload } from "@/request/axios.js";
|
||||
|
||||
export const getSystemDocumentsTree = (params) =>
|
||||
post("/mfolder/listTree", params); // 体系文件树
|
||||
export const getSystemDocumentsList = (params) => post("/mfolder/list", params); // 体系文件列表
|
||||
export const setSystemDocumentsDelete = (params) =>
|
||||
post("/mfolder/delete", params); // 体系文件删除
|
||||
export const setSystemDocumentsAddFolder = (params) =>
|
||||
post("/mfolder/add", params); // 体系文件添加文件夹
|
||||
export const setSystemDocumentsUploadFile = (params) =>
|
||||
upload("/mfolder/upload", params); // 体系文件上传文件
|
||||
export const setSystemDocumentsBatchUploadFile = (params) =>
|
||||
upload("/mfolder/batchUpload", params); // 体系文件批量上传文件
|
|
@ -584,7 +584,7 @@ const data = reactive({
|
|||
SUBORDINATION: "",
|
||||
SCALE: "",
|
||||
SCALE_TYPE: "",
|
||||
TRAINTYPE: [],
|
||||
TRAINTYPE: "",
|
||||
USERS_NUM: "",
|
||||
FOURTYPE: "",
|
||||
four_images: [],
|
||||
|
|
|
@ -390,7 +390,10 @@ import {
|
|||
getUserCurrentShiftList,
|
||||
getUserInfo,
|
||||
getUserScheduling,
|
||||
getUserView,
|
||||
setDictionaryDelete,
|
||||
setUserAdd,
|
||||
setUserEdit,
|
||||
} from "@/request/enterprise_management.js";
|
||||
import LayoutDepartment from "@/components/department/index.vue";
|
||||
import LayoutUpload from "@/components/upload/index.vue";
|
||||
|
@ -399,7 +402,11 @@ import { getPostListAll } from "@/request/data_dictionary.js";
|
|||
import { useRoute, useRouter } from "vue-router";
|
||||
import Scheduling from "./components/scheduling.vue";
|
||||
import { InfoFilled } from "@element-plus/icons-vue";
|
||||
import { idCardGetDateAndGender } from "@/assets/js/utils.js";
|
||||
import {
|
||||
addingPrefixToFile,
|
||||
idCardGetDateAndGender,
|
||||
image2Base64,
|
||||
} from "@/assets/js/utils.js";
|
||||
import {
|
||||
layoutFnGetDegreeOfEducation,
|
||||
layoutFnGetDuties,
|
||||
|
@ -416,6 +423,7 @@ import { debounce } from "throttle-debounce";
|
|||
import {
|
||||
getVerifyDeduplicationUser,
|
||||
getVerifyDuplicateEmail,
|
||||
setUploadImg,
|
||||
} from "@/request/api.js";
|
||||
import useFormValidate from "@/assets/js/useFormValidate.js";
|
||||
|
||||
|
@ -534,6 +542,8 @@ const data = reactive({
|
|||
employmentSituationList: [],
|
||||
allUser: 0,
|
||||
USERS_NUM: 0,
|
||||
oldPostId: "",
|
||||
oldDepartId: "",
|
||||
form: {
|
||||
ROLE_ID: "",
|
||||
DEPARTMENT_ID: "",
|
||||
|
@ -573,6 +583,24 @@ const data = reactive({
|
|||
},
|
||||
scheduleVisible: false,
|
||||
});
|
||||
const fnGetData = async () => {
|
||||
if (!USER_ID) return;
|
||||
const resData = await getUserView({ USER_ID });
|
||||
const form = resData.pd;
|
||||
form.PASSWORD = "666666";
|
||||
form.periodStr = resData.periodStr;
|
||||
form.ISSTUDENT = resData.pd.ISSTUDENT.toString();
|
||||
if (form.USERAVATARURL_CONVERT)
|
||||
form.faceFile = [
|
||||
{ url: form.USERAVATARPREFIX + form.USERAVATARURL_CONVERT },
|
||||
];
|
||||
data.scheduleInfo = resData.period;
|
||||
data.oldPostId = form.POST_ID;
|
||||
data.oldDepartId = form.DEPARTMENT_ID;
|
||||
form.userCerFile = addingPrefixToFile(resData.userCerList);
|
||||
data.form = { ...data.form, ...form };
|
||||
};
|
||||
fnGetData();
|
||||
const fnGetUserRole = async () => {
|
||||
const resData = await getUserInfo();
|
||||
data.roleList = resData.roleList;
|
||||
|
@ -624,41 +652,27 @@ const fnChangeIdCard = () => {
|
|||
data.form.SEX = sex;
|
||||
data.form.DATE_OF_BIRTH = date;
|
||||
};
|
||||
const fnGetNation = async () => {
|
||||
const { value } = await layoutFnGetNation();
|
||||
data.nationList = value;
|
||||
};
|
||||
const fnGetSex = async () => {
|
||||
const { value } = await layoutFnGetSex();
|
||||
data.sexList = value;
|
||||
};
|
||||
const fnGetPoliticalLandscape = async () => {
|
||||
const { value } = await layoutFnGetPoliticalLandscape();
|
||||
data.politicalLandscapeList = value;
|
||||
};
|
||||
const fnGetDegreeOfEducation = async () => {
|
||||
const { value } = await layoutFnGetDegreeOfEducation();
|
||||
data.degreeOfEducationList = value;
|
||||
};
|
||||
const fnGetPersonnelType = async () => {
|
||||
const { value } = await layoutFnGetPersonnelType();
|
||||
data.personnelTypeList = value;
|
||||
};
|
||||
const fnGetDuties = async () => {
|
||||
const { value } = await layoutFnGetDuties();
|
||||
data.dutiesList = value;
|
||||
};
|
||||
const fnGetProfessionalTitle = async () => {
|
||||
const { value } = await layoutFnGetProfessionalTitle();
|
||||
data.professionalTitleList = value;
|
||||
};
|
||||
const fnGetJobType = async () => {
|
||||
const { value } = await layoutFnGetJobType();
|
||||
data.jobTypeList = value;
|
||||
};
|
||||
const fnGetEmploymentSituation = async () => {
|
||||
const { value } = await layoutFnGetEmploymentSituation();
|
||||
data.employmentSituationList = value;
|
||||
const fnGetLevels = async () => {
|
||||
const { value: nationList } = await layoutFnGetNation();
|
||||
data.nationList = nationList;
|
||||
const { value: sexList } = await layoutFnGetSex();
|
||||
data.sexList = sexList;
|
||||
const { value: politicalLandscapeList } =
|
||||
await layoutFnGetPoliticalLandscape();
|
||||
data.politicalLandscapeList = politicalLandscapeList;
|
||||
const { value: degreeOfEducationList } = await layoutFnGetDegreeOfEducation();
|
||||
data.degreeOfEducationList = degreeOfEducationList;
|
||||
const { value: personnelTypeList } = await layoutFnGetPersonnelType();
|
||||
data.personnelTypeList = personnelTypeList;
|
||||
const { value: dutiesList } = await layoutFnGetDuties();
|
||||
data.dutiesList = dutiesList;
|
||||
const { value: professionalTitleList } = await layoutFnGetProfessionalTitle();
|
||||
data.professionalTitleList = professionalTitleList;
|
||||
const { value: jobTypeList } = await layoutFnGetJobType();
|
||||
data.jobTypeList = jobTypeList;
|
||||
const { value: employmentSituationList } =
|
||||
await layoutFnGetEmploymentSituation();
|
||||
data.employmentSituationList = employmentSituationList;
|
||||
};
|
||||
const fnDictionaryDelete = debounce(
|
||||
1000,
|
||||
|
@ -704,15 +718,7 @@ const stop = watch(
|
|||
() => data.form.ISSTUDENT,
|
||||
(val) => {
|
||||
if (val === "true") {
|
||||
fnGetNation();
|
||||
fnGetSex();
|
||||
fnGetPoliticalLandscape();
|
||||
fnGetDegreeOfEducation();
|
||||
fnGetPersonnelType();
|
||||
fnGetDuties();
|
||||
fnGetProfessionalTitle();
|
||||
fnGetJobType();
|
||||
fnGetEmploymentSituation();
|
||||
fnGetLevels();
|
||||
stop && stop();
|
||||
}
|
||||
},
|
||||
|
@ -728,20 +734,82 @@ const fnSubmit = debounce(
|
|||
form.WORKSTATUS = data.scheduleInfo.WORKSTATUS;
|
||||
form.DURATION = data.scheduleInfo.DURATION;
|
||||
form.WORKPERIOD = data.scheduleInfo.WORKPERIOD;
|
||||
if (fnFindValueInList("dutiesList", form.DUTIES)) {
|
||||
form.letDutiesType = "select";
|
||||
form.DUTIESValue = "";
|
||||
} else {
|
||||
form.letDutiesType = "value";
|
||||
form.DUTIESValue = form.DUTIES;
|
||||
}
|
||||
if (fnFindValueInList("professionalTitleList", form.TITLE)) {
|
||||
form.letTitleType = "select";
|
||||
form.letTitleValue = "";
|
||||
} else {
|
||||
form.letTitleType = "value";
|
||||
form.letTitleValue = form.TITLE;
|
||||
}
|
||||
if (fnFindValueInList("jobTypeList", form.TYPE_OF_WORK)) {
|
||||
form.letTypeOfWorkType = "select";
|
||||
form.letTypeOfWorkValue = "";
|
||||
} else {
|
||||
form.letTypeOfWorkType = "value";
|
||||
form.letTypeOfWorkValue = form.TYPE_OF_WORK;
|
||||
}
|
||||
if (data.form.faceFile?.[0]?.raw) {
|
||||
const resData = await image2Base64(data.form.faceFile[0].url);
|
||||
form.USERAVATARPREFIX = resData.substring(
|
||||
0,
|
||||
resData.indexOf("base64,") + 7
|
||||
);
|
||||
form.USERAVATARURL = resData.substring(resData.indexOf("base64,") + 7);
|
||||
}
|
||||
if (!USER_ID) {
|
||||
// 添加
|
||||
if (data.USERS_NUM > data.allUser) {
|
||||
if (data.allUser > data.USERS_NUM) {
|
||||
ElMessage.error("已超过可创建用户数量");
|
||||
return;
|
||||
}
|
||||
const resData = await setUserAdd({ ...form });
|
||||
if (data.form.ISSTUDENT === "true") await fnUploadImage(resData.USER_ID);
|
||||
} else {
|
||||
// 修改
|
||||
if (
|
||||
data.oldDepartId !== data.form.DEPARTMENT_ID ||
|
||||
data.oldPostId !== data.form.POST_ID
|
||||
) {
|
||||
await ElMessageBox.confirm(
|
||||
"如变更了部门或岗位,保存后将删除该用户所有清单,是否确定?",
|
||||
{ type: "warning" }
|
||||
);
|
||||
form.OPERATIONTYPE = 1;
|
||||
}
|
||||
await setUserEdit({ ...form });
|
||||
if (data.form.ISSTUDENT === "true")
|
||||
await fnUploadImage(data.form.USER_ID);
|
||||
}
|
||||
ElMessage.success("操作成功");
|
||||
router.back();
|
||||
},
|
||||
{ atBegin: true }
|
||||
);
|
||||
const fnUploadImage = async (USER_ID) => {
|
||||
const formData = new FormData();
|
||||
for (let i = 0; i < data.form.userCerFile.length; i++) {
|
||||
if (data.form.userCerFile[i].raw)
|
||||
formData.append("FFILE", data.form.userCerFile[i].raw);
|
||||
}
|
||||
formData.append("FOREIGN_KEY", USER_ID);
|
||||
formData.append("TYPE", 18);
|
||||
await setUploadImg(formData);
|
||||
};
|
||||
const fnFindValueInList = (list, value) => {
|
||||
let existence = false;
|
||||
for (let i = 0; i < data[list].length; i++) {
|
||||
if (data[list][i].DICTIONARIES_ID === value) {
|
||||
existence = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return existence;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
||||
|
|
|
@ -0,0 +1,255 @@
|
|||
<template>
|
||||
<layout-card>
|
||||
<layout-table
|
||||
:data="list"
|
||||
v-model:pagination="pagination"
|
||||
@get-data="fnGetDataTransfer"
|
||||
>
|
||||
<el-table-column label="序号" width="60">
|
||||
<template #default="{ $index }">
|
||||
{{ serialNumber(pagination, $index) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="MFOLDER_ID === '0'" label="目录名" width="220">
|
||||
<template v-slot="{ row }">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="
|
||||
router.push({
|
||||
path: '/system_operation/system_documents',
|
||||
query: {
|
||||
MFOLDER_ID: row.MFOLDER_ID,
|
||||
MFOLDER_NAME: row.NAME,
|
||||
},
|
||||
})
|
||||
"
|
||||
>
|
||||
{{ row.NAME }}<el-icon><ArrowRight /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="MFOLDER_ID !== '0'" label="文件名">
|
||||
<template v-slot="{ row }">
|
||||
{{ row.NAME }}{{ getFileSuffix(row.FILEPATH) }}
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-if="interceptTheSuffix(row.FILEPATH, '.txt')"
|
||||
@click="fnPreviewTxt(row.FILEPATH)"
|
||||
>
|
||||
[预览]
|
||||
</el-button>
|
||||
<el-button
|
||||
text
|
||||
link
|
||||
type="primary"
|
||||
v-if="interceptTheSuffix(row.FILEPATH, '.pdf')"
|
||||
@click="fnPreviewPdf(row.FILEPATH)"
|
||||
>
|
||||
[预览]
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
v-if="interceptTheSuffix(row.FILEPATH, '.mp4')"
|
||||
@click="fnPreviewVideo(row.FILEPATH)"
|
||||
>
|
||||
[预览]
|
||||
</el-button>
|
||||
<a
|
||||
v-if="
|
||||
interceptTheSuffix(row.FILEPATH, '.doc') ||
|
||||
interceptTheSuffix(row.FILEPATH, '.xls') ||
|
||||
interceptTheSuffix(row.FILEPATH, '.ppt') ||
|
||||
interceptTheSuffix(row.FILEPATH, '.docx') ||
|
||||
interceptTheSuffix(row.FILEPATH, '.xlsx') ||
|
||||
interceptTheSuffix(row.FILEPATH, '.pptx')
|
||||
"
|
||||
:href="
|
||||
'http://view.officeapps.live.com/op/view.aspx?src=' +
|
||||
VITE_FILE_URL +
|
||||
row.FILEPATH
|
||||
"
|
||||
target="_blank"
|
||||
>
|
||||
[预览]
|
||||
</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="MFOLDER_ID === '0'" prop="num" label="文件数量" />
|
||||
<el-table-column v-if="MFOLDER_ID !== '0'" label="文件大小">
|
||||
<template v-slot="{ row }">
|
||||
{{ calculateFileSize(row.FILESIZE) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="CTIME" label="上传时间" />
|
||||
<el-table-column prop="UNAME" label="上传者" />
|
||||
<el-table-column label="是否共享">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="row.SHARE === 'no'">私有文件</span>
|
||||
<span v-else>公共文件</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="REMARKS" label="备注说明" show-overflow-tooltip />
|
||||
<el-table-column label="操作" width="120">
|
||||
<template v-slot="{ row }">
|
||||
<el-button
|
||||
v-if="buttonJurisdiction.del && row.UNAME !== 'init'"
|
||||
type="primary"
|
||||
text
|
||||
link
|
||||
@click="fnDelete(row.MFOLDER_ID, row.FILEPATH)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
<el-button
|
||||
v-show="MFOLDER_ID !== '0'"
|
||||
type="primary"
|
||||
text
|
||||
link
|
||||
@click="useDownloadFile(row.FILEPATH)"
|
||||
>
|
||||
下载
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #button>
|
||||
<el-button
|
||||
v-if="MFOLDER_ID === '0' && buttonJurisdiction.add"
|
||||
type="primary"
|
||||
@click="fnAddFolder"
|
||||
>
|
||||
新建文件夹
|
||||
</el-button>
|
||||
<template v-if="MFOLDER_ID !== '0'">
|
||||
<el-button
|
||||
v-if="buttonJurisdiction.add"
|
||||
type="primary"
|
||||
@click="fnUploadFile"
|
||||
>
|
||||
上传文件
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="buttonJurisdiction.add"
|
||||
type="primary"
|
||||
@click="fnBatchUploadFile"
|
||||
>
|
||||
批量上传
|
||||
</el-button>
|
||||
<el-button @click="router.back"> 返回 </el-button>
|
||||
</template>
|
||||
</template>
|
||||
</layout-table>
|
||||
<layout-pdf
|
||||
:src="data.pdfDialog.src"
|
||||
v-model:visible="data.pdfDialog.visible"
|
||||
/>
|
||||
<layout-txt
|
||||
:src="data.txtDialog.src"
|
||||
v-model:visible="data.txtDialog.visible"
|
||||
/>
|
||||
<layout-video
|
||||
:src="data.videoDialog.src"
|
||||
v-model:visible="data.videoDialog.visible"
|
||||
/>
|
||||
</layout-card>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getSystemDocumentsList } from "@/request/system_operation.js";
|
||||
import { reactive, ref } from "vue";
|
||||
import LayoutPdf from "@/components/pdf/index";
|
||||
import LayoutTxt from "@/components/txt/index.vue";
|
||||
import LayoutVideo from "@/components/video/index";
|
||||
import {
|
||||
serialNumber,
|
||||
calculateFileSize,
|
||||
interceptTheSuffix,
|
||||
getFileSuffix,
|
||||
} from "@/assets/js/utils";
|
||||
import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
|
||||
import { onBeforeRouteUpdate, useRoute, useRouter } from "vue-router";
|
||||
import useListData from "@/assets/js/useListData.js";
|
||||
import { useUserStore } from "@/pinia/user.js";
|
||||
import { ArrowRight } from "@element-plus/icons-vue";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { setDepartmentDelete } from "@/request/enterprise_management.js";
|
||||
import useDownloadFile from "@/assets/js/useDownloadFile.js";
|
||||
|
||||
const VITE_FILE_URL = import.meta.env.VITE_FILE_URL;
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
const userStore = useUserStore();
|
||||
const mfolderIdDefault = "0";
|
||||
const mfolderNameDefault = "(无)此项为顶级目录";
|
||||
const MFOLDER_ID = ref(route.query.MFOLDER_ID || mfolderIdDefault);
|
||||
const MFOLDER_NAME = ref(route.query.MFOLDER_NAME || mfolderNameDefault);
|
||||
const { list, pagination, fnGetData, fnResetPagination } = useListData(
|
||||
getSystemDocumentsList,
|
||||
{
|
||||
otherParams: {
|
||||
MFOLDER_ID: MFOLDER_ID.value,
|
||||
SHARE: "no",
|
||||
CORPINFO_ID: userStore.getUserInfo.CORPINFO_ID,
|
||||
},
|
||||
}
|
||||
);
|
||||
const data = reactive({
|
||||
pdfDialog: {
|
||||
visible: false,
|
||||
src: "",
|
||||
},
|
||||
videoDialog: {
|
||||
visible: false,
|
||||
src: "",
|
||||
},
|
||||
txtDialog: {
|
||||
visible: false,
|
||||
src: "",
|
||||
},
|
||||
});
|
||||
const buttonJurisdiction = await useButtonJurisdiction("mfolder");
|
||||
const fnGetDataTransfer = () => {
|
||||
fnGetData({
|
||||
MFOLDER_ID: MFOLDER_ID.value,
|
||||
});
|
||||
};
|
||||
const fnResetPaginationTransfer = () => {
|
||||
fnResetPagination({
|
||||
MFOLDER_ID: MFOLDER_ID.value,
|
||||
});
|
||||
};
|
||||
onBeforeRouteUpdate((to) => {
|
||||
MFOLDER_ID.value = to.query.MFOLDER_ID || mfolderIdDefault;
|
||||
MFOLDER_NAME.value = to.query.MFOLDER_NAME || mfolderNameDefault;
|
||||
fnResetPaginationTransfer();
|
||||
});
|
||||
const fnDelete = debounce(
|
||||
1000,
|
||||
async (MFOLDER_ID, FILEPATH) => {
|
||||
await ElMessageBox.confirm(`确定要删除吗?`, {
|
||||
type: "warning",
|
||||
});
|
||||
await setDepartmentDelete({ MFOLDER_ID, FILEPATH: FILEPATH || "" });
|
||||
ElMessage.success("删除成功");
|
||||
fnResetPaginationTransfer();
|
||||
},
|
||||
{ atBegin: true }
|
||||
);
|
||||
const fnPreviewTxt = async (FILEPATH) => {
|
||||
data.txtDialog.visible = true;
|
||||
data.txtDialog.src = FILEPATH;
|
||||
};
|
||||
const fnPreviewPdf = (FILEPATH) => {
|
||||
data.pdfDialog.visible = true;
|
||||
data.pdfDialog.src = FILEPATH;
|
||||
};
|
||||
const fnPreviewVideo = (FILEPATH) => {
|
||||
data.videoDialog.visible = true;
|
||||
data.videoDialog.src = FILEPATH;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
Loading…
Reference in New Issue