pull/1/head
z 2024-01-08 14:31:18 +08:00
parent 3ad49a0620
commit 079e4c17b9
16 changed files with 500 additions and 68 deletions

4
.env
View File

@ -1,5 +1,5 @@
VITE_BASE_URL=http://192.168.0.17:8001/ VITE_BASE_URL=http://192.168.0.17:8001/
VITE_PROXY=/api VITE_PROXY=/api/
VITE_FILE_URL=https://file.zcloudchina.com/YTHFile VITE_FILE_URL=https://file.zcloudchina.com/YTHFile
VITE_TEMPLATE_URL='https://qaaq.qhdsafety.com/file/' VITE_TEMPLATE_URL=https://qaaq.qhdsafety.com/file/

View 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", path: "/platform_resource_library",
redirect: "/platform_resource_library/courseware", redirect: "/platform_resource_library/courseware",

View File

@ -4,6 +4,7 @@ import {
getLevelsAndChildrenNumber, getLevelsAndChildrenNumber,
getRegulatoryType, getRegulatoryType,
getDepartmentTree, getDepartmentTree,
getLevelsCorp,
} from "@/request/data_dictionary.js"; } from "@/request/data_dictionary.js";
import { ref } from "vue"; import { ref } from "vue";
@ -112,21 +113,21 @@ export const layoutFnGetPersonnelType = async () => {
}; };
// 职务 // 职务
export const layoutFnGetDuties = async () => { export const layoutFnGetDuties = async () => {
const resData = await getLevels({ const resData = await getLevelsCorp({
DICTIONARIES_ID: "09e36ac01e9540f8bc84eab1c1a78754", DICTIONARIES_ID: "09e36ac01e9540f8bc84eab1c1a78754",
}); });
return ref(resData.list); return ref(resData.list);
}; };
// 职称 // 职称
export const layoutFnGetProfessionalTitle = async () => { export const layoutFnGetProfessionalTitle = async () => {
const resData = await getLevels({ const resData = await getLevelsCorp({
DICTIONARIES_ID: "945a6b10e59946078b500f0fbafa8679", DICTIONARIES_ID: "945a6b10e59946078b500f0fbafa8679",
}); });
return ref(resData.list); return ref(resData.list);
}; };
// 工种 // 工种
export const layoutFnGetJobType = async () => { export const layoutFnGetJobType = async () => {
const resData = await getLevels({ const resData = await getLevelsCorp({
DICTIONARIES_ID: "55484e491a5e442d839c4595380713ec", DICTIONARIES_ID: "55484e491a5e442d839c4595380713ec",
}); });
return ref(resData.list); return ref(resData.list);

View File

@ -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);
});
}

View File

@ -1,4 +1,4 @@
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage } from "element-plus";
/** /**
* @description 计算序号 * @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 附件添加前缀 * @description 附件添加前缀
* @param {Array} list 附件数组 * @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 根据身份证号获取出生日期和性别 * @description 根据身份证号获取出生日期和性别
* @param {String} idCard 身份证号 * @param {String} idCard 身份证号

View File

@ -86,6 +86,10 @@ const play = () => {
const pause = () => { const pause = () => {
player && player.pause(); player && player.pause();
}; };
defineExpose({
play,
pause,
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -5,7 +5,7 @@
ref="pdfRef" ref="pdfRef"
v-for="page in numOfPages" v-for="page in numOfPages"
:key="page" :key="page"
:src="src" :src="VITE_FILE_URL + src"
:page="page" :page="page"
/> />
</div> </div>
@ -18,6 +18,7 @@ import { VuePdf, createLoadingTask } from "vue3-pdfjs/esm";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useVModel } from "@vueuse/core"; import { useVModel } from "@vueuse/core";
const VITE_FILE_URL = import.meta.env.VITE_FILE_URL;
defineOptions({ defineOptions({
name: "LayoutPdf", name: "LayoutPdf",
}); });
@ -38,7 +39,7 @@ const pdfRef = ref(null);
const numOfPages = ref(0); const numOfPages = ref(0);
watchEffect(() => { watchEffect(() => {
if (props.visible) { if (props.visible) {
const loadingTask = createLoadingTask(props.src); const loadingTask = createLoadingTask(VITE_FILE_URL + props.src);
loadingTask.promise loadingTask.promise
.then((pdf) => { .then((pdf) => {
numOfPages.value = pdf.numPages; numOfPages.value = pdf.numPages;

View File

@ -20,7 +20,7 @@
> >
<div>{{ item.NAME }}</div> <div>{{ item.NAME }}</div>
<div> <div>
<el-icon @click="fnDelete(index)"> <el-icon @click.stop="fnDelete(index)">
<circle-close /> <circle-close />
</el-icon> </el-icon>
</div> </div>

View File

@ -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>

View File

@ -3,6 +3,7 @@ import { post, upload } from "./axios";
export const Login = (params) => post("/admin/check", params); // 登录 export const Login = (params) => post("/admin/check", params); // 登录
export const logout = (params) => post("/main/logout", params); // 退出登录 export const logout = (params) => post("/main/logout", params); // 退出登录
export const getAsyncRouter = (params) => post("/main/index", 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 getUserInfo = (params) => post("/user/goEditMyInfo", params); // 获取用户信息
export const setUserInfo = (params) => post("/user/editUserOwn", params); // 修改用户信息 export const setUserInfo = (params) => post("/user/editUserOwn", params); // 修改用户信息
export const getVerifyDuplicateEmail = (params) => export const getVerifyDuplicateEmail = (params) =>

View File

@ -6,6 +6,12 @@ export const getLevels = (params) =>
loading: false, loading: false,
...params, ...params,
}); });
// 获取数据字典
export const getLevelsCorp = (params) =>
post("/dictionariesCorp/getLevels", {
loading: false,
...params,
});
// 获取数据字典包括子级数量 // 获取数据字典包括子级数量
export const getLevelsAndChildrenNumber = (params) => export const getLevelsAndChildrenNumber = (params) =>
post("/dictionaries/getLevelsAndSCount", { post("/dictionaries/getLevelsAndSCount", {

View File

@ -39,3 +39,6 @@ export const getUserScheduleView = (params) =>
post("/shiftworkperiod/getWorkDate", params); // 用户管理查看排班表 post("/shiftworkperiod/getWorkDate", params); // 用户管理查看排班表
export const setDictionaryDelete = (params) => export const setDictionaryDelete = (params) =>
post("/dictionariesCorp/delete", 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); // 用户管理查看

View File

@ -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); // 体系文件批量上传文件

View File

@ -584,7 +584,7 @@ const data = reactive({
SUBORDINATION: "", SUBORDINATION: "",
SCALE: "", SCALE: "",
SCALE_TYPE: "", SCALE_TYPE: "",
TRAINTYPE: [], TRAINTYPE: "",
USERS_NUM: "", USERS_NUM: "",
FOURTYPE: "", FOURTYPE: "",
four_images: [], four_images: [],

View File

@ -390,7 +390,10 @@ import {
getUserCurrentShiftList, getUserCurrentShiftList,
getUserInfo, getUserInfo,
getUserScheduling, getUserScheduling,
getUserView,
setDictionaryDelete, setDictionaryDelete,
setUserAdd,
setUserEdit,
} from "@/request/enterprise_management.js"; } from "@/request/enterprise_management.js";
import LayoutDepartment from "@/components/department/index.vue"; import LayoutDepartment from "@/components/department/index.vue";
import LayoutUpload from "@/components/upload/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 { useRoute, useRouter } from "vue-router";
import Scheduling from "./components/scheduling.vue"; import Scheduling from "./components/scheduling.vue";
import { InfoFilled } from "@element-plus/icons-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 { import {
layoutFnGetDegreeOfEducation, layoutFnGetDegreeOfEducation,
layoutFnGetDuties, layoutFnGetDuties,
@ -416,6 +423,7 @@ import { debounce } from "throttle-debounce";
import { import {
getVerifyDeduplicationUser, getVerifyDeduplicationUser,
getVerifyDuplicateEmail, getVerifyDuplicateEmail,
setUploadImg,
} from "@/request/api.js"; } from "@/request/api.js";
import useFormValidate from "@/assets/js/useFormValidate.js"; import useFormValidate from "@/assets/js/useFormValidate.js";
@ -534,6 +542,8 @@ const data = reactive({
employmentSituationList: [], employmentSituationList: [],
allUser: 0, allUser: 0,
USERS_NUM: 0, USERS_NUM: 0,
oldPostId: "",
oldDepartId: "",
form: { form: {
ROLE_ID: "", ROLE_ID: "",
DEPARTMENT_ID: "", DEPARTMENT_ID: "",
@ -573,6 +583,24 @@ const data = reactive({
}, },
scheduleVisible: false, 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 fnGetUserRole = async () => {
const resData = await getUserInfo(); const resData = await getUserInfo();
data.roleList = resData.roleList; data.roleList = resData.roleList;
@ -624,41 +652,27 @@ const fnChangeIdCard = () => {
data.form.SEX = sex; data.form.SEX = sex;
data.form.DATE_OF_BIRTH = date; data.form.DATE_OF_BIRTH = date;
}; };
const fnGetNation = async () => { const fnGetLevels = async () => {
const { value } = await layoutFnGetNation(); const { value: nationList } = await layoutFnGetNation();
data.nationList = value; data.nationList = nationList;
}; const { value: sexList } = await layoutFnGetSex();
const fnGetSex = async () => { data.sexList = sexList;
const { value } = await layoutFnGetSex(); const { value: politicalLandscapeList } =
data.sexList = value; await layoutFnGetPoliticalLandscape();
}; data.politicalLandscapeList = politicalLandscapeList;
const fnGetPoliticalLandscape = async () => { const { value: degreeOfEducationList } = await layoutFnGetDegreeOfEducation();
const { value } = await layoutFnGetPoliticalLandscape(); data.degreeOfEducationList = degreeOfEducationList;
data.politicalLandscapeList = value; const { value: personnelTypeList } = await layoutFnGetPersonnelType();
}; data.personnelTypeList = personnelTypeList;
const fnGetDegreeOfEducation = async () => { const { value: dutiesList } = await layoutFnGetDuties();
const { value } = await layoutFnGetDegreeOfEducation(); data.dutiesList = dutiesList;
data.degreeOfEducationList = value; const { value: professionalTitleList } = await layoutFnGetProfessionalTitle();
}; data.professionalTitleList = professionalTitleList;
const fnGetPersonnelType = async () => { const { value: jobTypeList } = await layoutFnGetJobType();
const { value } = await layoutFnGetPersonnelType(); data.jobTypeList = jobTypeList;
data.personnelTypeList = value; const { value: employmentSituationList } =
}; await layoutFnGetEmploymentSituation();
const fnGetDuties = async () => { data.employmentSituationList = employmentSituationList;
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 fnDictionaryDelete = debounce( const fnDictionaryDelete = debounce(
1000, 1000,
@ -704,15 +718,7 @@ const stop = watch(
() => data.form.ISSTUDENT, () => data.form.ISSTUDENT,
(val) => { (val) => {
if (val === "true") { if (val === "true") {
fnGetNation(); fnGetLevels();
fnGetSex();
fnGetPoliticalLandscape();
fnGetDegreeOfEducation();
fnGetPersonnelType();
fnGetDuties();
fnGetProfessionalTitle();
fnGetJobType();
fnGetEmploymentSituation();
stop && stop(); stop && stop();
} }
}, },
@ -728,20 +734,82 @@ const fnSubmit = debounce(
form.WORKSTATUS = data.scheduleInfo.WORKSTATUS; form.WORKSTATUS = data.scheduleInfo.WORKSTATUS;
form.DURATION = data.scheduleInfo.DURATION; form.DURATION = data.scheduleInfo.DURATION;
form.WORKPERIOD = data.scheduleInfo.WORKPERIOD; 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 (!USER_ID) {
// if (data.allUser > data.USERS_NUM) {
if (data.USERS_NUM > data.allUser) {
ElMessage.error("已超过可创建用户数量"); ElMessage.error("已超过可创建用户数量");
return; return;
} }
const resData = await setUserAdd({ ...form });
if (data.form.ISSTUDENT === "true") await fnUploadImage(resData.USER_ID);
} else { } 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("操作成功"); ElMessage.success("操作成功");
router.back(); router.back();
}, },
{ atBegin: true } { 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> </script>
<style scoped lang="scss"></style> <style scoped lang="scss"></style>

View File

@ -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>