forked from integrated_whb/integrated_whb_vue
init
parent
079e4c17b9
commit
fb75396024
|
@ -125,6 +125,30 @@ export default [
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/risk_control",
|
||||
redirect: "/risk_control/risk_point",
|
||||
meta: { title: "风险管控", model: MODEL["1"] },
|
||||
component: "children",
|
||||
children: [
|
||||
{
|
||||
path: "/risk_control/risk_point",
|
||||
meta: { title: "风险点(单元)", isSubMenu: false },
|
||||
component: "children",
|
||||
children: [
|
||||
{
|
||||
path: "",
|
||||
component: "risk_control/risk_point/index",
|
||||
},
|
||||
{
|
||||
path: "/risk_control/risk_point/view",
|
||||
meta: { title: "查看", activeMenu: "/risk_control/risk_point" },
|
||||
component: "risk_control/risk_point/view",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: "/platform_resource_library",
|
||||
redirect: "/platform_resource_library/courseware",
|
||||
|
|
|
@ -140,8 +140,8 @@ export const layoutFnGetEmploymentSituation = async () => {
|
|||
return ref(resData.list);
|
||||
};
|
||||
// 部门树
|
||||
export const layoutFnGetDepartmentTree = async () => {
|
||||
const resData = await getDepartmentTree();
|
||||
export const layoutFnGetDepartmentTree = async (params) => {
|
||||
const resData = await getDepartmentTree(params);
|
||||
return ref(JSON.parse(resData.zTreeNodes));
|
||||
};
|
||||
// 无法确定DICTIONARIES_ID的数据字典
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
:props="{
|
||||
children: 'nodes',
|
||||
label: 'name',
|
||||
disabled: '',
|
||||
}"
|
||||
:render-after-expand="false"
|
||||
accordion
|
||||
|
@ -51,10 +50,16 @@ const props = defineProps({
|
|||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
rootDisabled: {
|
||||
type: String,
|
||||
default: "N",
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const modelValue = useVModel(props, "modelValue", emits);
|
||||
const departmentTree = await layoutFnGetDepartmentTree();
|
||||
const departmentTree = await layoutFnGetDepartmentTree({
|
||||
rootDisabled: props.rootDisabled,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<template>
|
||||
<div class="tc mt-20 mb-20">
|
||||
<img :src="src" alt="" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useQRCode } from "@vueuse/integrations/useQRCode.js";
|
||||
|
||||
defineOptions({
|
||||
name: "LayoutQrCode",
|
||||
});
|
||||
const props = defineProps({
|
||||
src: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
const src = useQRCode(() => props.src, {
|
||||
width: 200,
|
||||
height: 200,
|
||||
margin: 1,
|
||||
correctLevel: "H",
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
|
@ -8,7 +8,7 @@
|
|||
:height="height"
|
||||
:max-height="maxHeight"
|
||||
:highlight-current-row="highlightCurrentRow"
|
||||
:row-key="rowKey"
|
||||
:row-key="getRowKey"
|
||||
:row-class-name="rowClassName"
|
||||
:show-header="showHeader"
|
||||
:show-summary="showSummary"
|
||||
|
@ -117,6 +117,11 @@ const handleSizeChange = (val) => {
|
|||
});
|
||||
emits("get-data");
|
||||
};
|
||||
const getRowKey = (row) => {
|
||||
if (!props.rowKey) return;
|
||||
if (typeof props.rowKey === "string") return row[props.rowKey];
|
||||
else return props.rowKey(row);
|
||||
};
|
||||
const rowClick = (row, column, event) => {
|
||||
emits("row-click", row, column, event);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import { post, upload } from "@/request/axios.js";
|
||||
|
||||
export const getRiskPointList = (params) => post("/riskunit/list", params); // 风险点单元列表
|
||||
export const setRiskPointDelete = (params) => post("/riskunit/delete", params); // 风险点单元删除
|
||||
export const setRiskPointImport = (params) =>
|
||||
upload("/riskunit/readExcel", params); // 风险点单元导入
|
||||
export const setRiskPointBatchDelete = (params) =>
|
||||
post("/riskunit/deleteAll", params); // 风险点单元批量删除
|
||||
export const getRiskPointView = (params) => post("/riskunit/goEdit", params); // 风险点单元查看
|
||||
export const setRiskPointAdd = (params) => post("/riskunit/add", params); // 风险点单元添加
|
||||
export const setRiskPointEdit = (params) => post("/riskunit/edit", params); // 风险点单元修改
|
||||
export const getRiskPointInspectList = (params) =>
|
||||
post("/riskunit/getRisByUnitId", params); // 风险点单元检查内容
|
|
@ -54,7 +54,12 @@
|
|||
label="监管部门"
|
||||
prop="checkedIds"
|
||||
>
|
||||
<layout-department v-model="form.checkedIds" multiple show-checkbox />
|
||||
<layout-department
|
||||
v-model="form.checkedIds"
|
||||
multiple
|
||||
show-checkbox
|
||||
root-disabled="Y"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="BZ">
|
||||
<el-input
|
||||
|
|
|
@ -245,8 +245,8 @@ const fnQrCodeDialogChangeShow = () => {
|
|||
const fnQrCode = () => {
|
||||
if (data.info.CORPINFO_ID) {
|
||||
fnQrCodeDialogChangeShow();
|
||||
// TODO: 扫码跳转到企业信息页面
|
||||
data.qrCodeDialog.src = useQRCode("https://vueuse.org", {
|
||||
// TODO: 扫码页面
|
||||
data.qrCodeDialog.src = useQRCode(data.info.CORPINFO_ID, {
|
||||
width: 200,
|
||||
height: 200,
|
||||
margin: 1,
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
v-model="visible"
|
||||
:title="type === 'edit' ? '修改' : '新增'"
|
||||
:before-close="fnClose"
|
||||
>
|
||||
<el-form ref="formRef" :rules="rules" :model="form" label-width="150px">
|
||||
<el-form-item label="部门" prop="DEPARTMENT_ID">
|
||||
<layout-department v-model="form.DEPARTMENT_ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="风险点(单元)名称" prop="RISKUNITNAME">
|
||||
<el-input v-model="form.RISKUNITNAME" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="fnClose">取消</el-button>
|
||||
<el-button type="primary" @click="fnSubmit"> 确定 </el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { useVModels } from "@vueuse/core";
|
||||
import LayoutDepartment from "@/components/department/index.vue";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import useFormValidate from "@/assets/js/useFormValidate.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { setRiskPointAdd, setRiskPointEdit } from "@/request/risk_control.js";
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
form: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => ({}),
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(["update:visible", "update:form", "get-data"]);
|
||||
const { visible, form } = useVModels(props, emits);
|
||||
const rules = {
|
||||
RISKUNITNAME: [
|
||||
{ required: true, message: "风险点(单元)不能为空", trigger: "blur" },
|
||||
],
|
||||
DEPARTMENT_ID: [
|
||||
{ required: true, message: "管控部门不能为空", trigger: "change" },
|
||||
],
|
||||
};
|
||||
const formRef = ref(null);
|
||||
const fnClose = () => {
|
||||
formRef.value.resetFields();
|
||||
visible.value = false;
|
||||
};
|
||||
const fnSubmit = debounce(
|
||||
1000,
|
||||
async () => {
|
||||
await useFormValidate(formRef);
|
||||
props.type === "add"
|
||||
? await setRiskPointAdd({ ...form.value })
|
||||
: await setRiskPointEdit({ ...form.value });
|
||||
ElMessage.success("操作成功");
|
||||
fnClose();
|
||||
emits("get-data");
|
||||
},
|
||||
{ atBegin: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
|
@ -0,0 +1,48 @@
|
|||
<template>
|
||||
<el-dialog v-model="visible" title="查看二维码">
|
||||
<div id="printContent">
|
||||
<el-divider content-position="left">风险点(单元)信息</el-divider>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="风险点(单元)">
|
||||
{{ info.RISKUNITNAME }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="管控部门">
|
||||
{{ info.DEPT_NAME }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="所属公司">
|
||||
{{ info.CORP_NAME }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="管控负责人">
|
||||
{{ info.HEADMAN }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<layout-qr-code :src="info.RISKUNIT_ID" />
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="visible = false">关闭</el-button>
|
||||
<el-button type="primary" v-print="'#printContent'">打印</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useVModel } from "@vueuse/core";
|
||||
import LayoutQrCode from "@/components/qr_code/index.vue";
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
info: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default: () => ({}),
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(["update:visible"]);
|
||||
const visible = useVModel(props, "visible", emits);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
|
@ -0,0 +1,248 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<el-form
|
||||
:model="searchForm"
|
||||
label-width="50px"
|
||||
@submit.prevent="fnResetPaginationTransfer"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="6">
|
||||
<el-form-item
|
||||
label="风险点(单元)"
|
||||
prop="KEYWORDS"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-input
|
||||
v-model="searchForm.KEYWORDS"
|
||||
placeholder="请输入关键字"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="部门" prop="DEPTIDS">
|
||||
<layout-department
|
||||
v-model="searchForm.DEPTIDS"
|
||||
multiple
|
||||
show-checkbox
|
||||
collapse-tags
|
||||
root-disabled="Y"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label-width="10px">
|
||||
<el-button type="primary" native-type="submit">搜索</el-button>
|
||||
<el-button native-type="reset" @click="fnResetPaginationTransfer">
|
||||
重置
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label-width="10px" class="end">
|
||||
<el-button>打印</el-button>
|
||||
<el-button @click="fnImportDialogChangeShow"> 导入 </el-button>
|
||||
<el-button @click="fnExport">导出</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-card>
|
||||
<layout-card>
|
||||
<layout-table
|
||||
ref="tableRef"
|
||||
:data="list"
|
||||
v-model:pagination="pagination"
|
||||
@get-data="fnGetDataTransfer"
|
||||
row-key="RISKUNIT_ID"
|
||||
>
|
||||
<el-table-column reserve-selection type="selection" width="55" />
|
||||
<el-table-column label="序号" width="70">
|
||||
<template v-slot="{ $index }">
|
||||
{{ serialNumber(pagination, $index) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="DEPT_NAME_ALL" label="所属部门" />
|
||||
<el-table-column prop="RISKUNITNAME" label="风险点(单元)" />
|
||||
<el-table-column label="操作" width="200">
|
||||
<template v-slot="{ row }">
|
||||
<el-button type="primary" text link @click="fnPrint(row)">
|
||||
二维码
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
text
|
||||
link
|
||||
@click="
|
||||
router.push({
|
||||
path: '/risk_control/risk_point/view',
|
||||
query: {
|
||||
RISKUNIT_ID: row.RISKUNIT_ID,
|
||||
RISKUNITNAME: row.RISKUNITNAME,
|
||||
DEPT_NAME: row.DEPT_NAME,
|
||||
},
|
||||
})
|
||||
"
|
||||
>
|
||||
查看
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
text
|
||||
link
|
||||
@click="fnAddOrEdit(row.RISKUNIT_ID, 'edit')"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
text
|
||||
link
|
||||
@click="fnDelete(row.RISKUNIT_ID)"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<template #button>
|
||||
<el-button type="primary" @click="fnAddOrEdit('', 'add')">
|
||||
新增
|
||||
</el-button>
|
||||
<el-button type="danger" @click="fnBatchDelete"> 批量删除 </el-button>
|
||||
</template>
|
||||
</layout-table>
|
||||
</layout-card>
|
||||
<layout-import-file
|
||||
v-model:visible="data.importDialogVisible"
|
||||
template-url="/template/riskunitExcelTemplate.xls"
|
||||
@submit="fnSubmitImport"
|
||||
/>
|
||||
<add
|
||||
v-model:visible="data.addOrEditDialog.visible"
|
||||
v-model:form="data.addOrEditDialog.form"
|
||||
:type="data.addOrEditDialog.type"
|
||||
@get-data="fnResetPaginationTransfer"
|
||||
/>
|
||||
<print
|
||||
v-model:visible="data.printDialog.visible"
|
||||
:info="data.printDialog.info"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { serialNumber } from "@/assets/js/utils.js";
|
||||
import useListData from "@/assets/js/useListData.js";
|
||||
import LayoutDepartment from "@/components/department/index.vue";
|
||||
import {
|
||||
getRiskPointList,
|
||||
getRiskPointView,
|
||||
setRiskPointBatchDelete,
|
||||
setRiskPointDelete,
|
||||
setRiskPointImport,
|
||||
} from "@/request/risk_control.js";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { nextTick, reactive } from "vue";
|
||||
import LayoutImportFile from "@/components/import_file/index.vue";
|
||||
import Add from "./components/add.vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import Print from "./components/print.vue";
|
||||
|
||||
const router = useRouter();
|
||||
const { list, pagination, searchForm, fnGetData, fnResetPagination, tableRef } =
|
||||
useListData(getRiskPointList);
|
||||
const data = reactive({
|
||||
importDialogVisible: false,
|
||||
addOrEditDialog: {
|
||||
visible: false,
|
||||
type: "",
|
||||
form: {
|
||||
DEPARTMENT_ID: "",
|
||||
RISKUNITNAME: "",
|
||||
},
|
||||
},
|
||||
printDialog: {
|
||||
visible: false,
|
||||
info: {},
|
||||
},
|
||||
});
|
||||
const fnGetDataTransfer = () => {
|
||||
fnGetData({
|
||||
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
|
||||
});
|
||||
};
|
||||
const fnResetPaginationTransfer = () => {
|
||||
fnResetPagination({
|
||||
DEPTIDS: searchForm.value.DEPTIDS?.join(","),
|
||||
});
|
||||
};
|
||||
const fnDelete = debounce(
|
||||
1000,
|
||||
async (RISKUNIT_ID) => {
|
||||
await ElMessageBox.confirm("确定要删除吗?", { type: "warning" });
|
||||
await setRiskPointDelete({ RISKUNIT_ID });
|
||||
ElMessage.success("删除成功");
|
||||
fnResetPaginationTransfer();
|
||||
},
|
||||
{ atBegin: true }
|
||||
);
|
||||
const fnImportDialogChangeShow = () => {
|
||||
data.importDialogVisible = !data.importDialogVisible;
|
||||
};
|
||||
const fnSubmitImport = async (formData) => {
|
||||
const resData = await setRiskPointImport(formData);
|
||||
if (resData.resultStr) {
|
||||
ElMessage({
|
||||
dangerouslyUseHTMLString: true,
|
||||
message: resData.resultStr,
|
||||
type: resData.resultType,
|
||||
});
|
||||
}
|
||||
fnImportDialogChangeShow();
|
||||
fnResetPaginationTransfer();
|
||||
};
|
||||
const fnExport = async () => {
|
||||
const selectionData = tableRef.value.getSelectionRows();
|
||||
if (selectionData.length === 0) {
|
||||
ElMessage.warning("请选择需要导出至excel报表的记录信息");
|
||||
return;
|
||||
}
|
||||
await ElMessageBox.confirm("确定要导出到excel吗?", { type: "warning" });
|
||||
const DATA_IDS = selectionData.map((item) => item.RISKUNIT_ID).join(",");
|
||||
window.location.href =
|
||||
import.meta.env[import.meta.env.DEV ? "VITE_PROXY" : "VITE_BASE_URL"] +
|
||||
"/riskunit/excel?" +
|
||||
"&KEYWORDS=" +
|
||||
searchForm.value.KEYWORDS +
|
||||
"&DATA_IDS=" +
|
||||
DATA_IDS;
|
||||
};
|
||||
const fnBatchDelete = async () => {
|
||||
const selectionData = tableRef.value.getSelectionRows();
|
||||
if (selectionData.length === 0) {
|
||||
ElMessage.warning("请选中要删除的项");
|
||||
return;
|
||||
}
|
||||
await ElMessageBox.confirm("确定要删除选中的数据吗?", { type: "warning" });
|
||||
const DATA_IDS = selectionData.map((item) => item.RISKUNIT_ID).join(",");
|
||||
await setRiskPointBatchDelete({ DATA_IDS });
|
||||
ElMessage.success("删除成功");
|
||||
fnResetPaginationTransfer();
|
||||
};
|
||||
const fnAddOrEdit = async (RISKUNIT_ID, type) => {
|
||||
data.addOrEditDialog.visible = true;
|
||||
await nextTick();
|
||||
data.addOrEditDialog.type = type;
|
||||
if (type === "edit") {
|
||||
const resData = await getRiskPointView({ RISKUNIT_ID });
|
||||
data.addOrEditDialog.form = resData.pd;
|
||||
}
|
||||
};
|
||||
const fnPrint = (row) => {
|
||||
data.printDialog.visible = true;
|
||||
data.printDialog.info = row;
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
|
@ -0,0 +1,55 @@
|
|||
<template>
|
||||
<layout-card>
|
||||
<el-divider content-position="left"> 风险点(单元)信息 </el-divider>
|
||||
<el-descriptions :column="2" border>
|
||||
<el-descriptions-item label="风险点(单元)">
|
||||
{{ RISKUNITNAME }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="管控部门">
|
||||
{{ DEPT_NAME }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-divider content-position="left"> 检查内容 </el-divider>
|
||||
<layout-table :data="list" :show-pagination="false">
|
||||
<el-table-column type="index" label="序号" width="50" align="center" />
|
||||
<el-table-column prop="PARTSNAME" label="辨识部位" />
|
||||
<el-table-column prop="risk_descr" label="存在风险" />
|
||||
<el-table-column label="风险分级">
|
||||
<template v-slot="{ row }">
|
||||
<span v-if="row.LEVELID === 'levelD'" class="text-blue">
|
||||
低风险/D级
|
||||
</span>
|
||||
<span v-else-if="row.LEVELID === 'levelC'" class="text-yellow">
|
||||
一般风险/C级
|
||||
</span>
|
||||
<span v-else-if="row.LEVELID === 'levelB'" class="text-orange">
|
||||
较大风险/B级
|
||||
</span>
|
||||
<span v-else-if="row.LEVELID === 'levelA'" class="text-red">
|
||||
重大风险/A级
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="MEASURES" label="管控措施" />
|
||||
<el-table-column prop="ACCIDENTS_NAME" label="事故类型" />
|
||||
<el-table-column prop="EME_MEASURES" label="应急处置措施" />
|
||||
</layout-table>
|
||||
</layout-card>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useRoute } from "vue-router";
|
||||
import { getRiskPointInspectList } from "@/request/risk_control.js";
|
||||
import useListData from "@/assets/js/useListData.js";
|
||||
|
||||
const route = useRoute();
|
||||
const { RISKUNIT_ID, RISKUNITNAME, DEPT_NAME } = route.query;
|
||||
const { list } = useListData(getRiskPointInspectList, {
|
||||
otherParams: {
|
||||
RISK_UNIT_ID: RISKUNIT_ID,
|
||||
},
|
||||
usePagination: false,
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
|
@ -0,0 +1,76 @@
|
|||
<template>
|
||||
<el-dialog v-model="visible" title="新建文件夹" :before-close="fnClose">
|
||||
<el-form ref="formRef" :model="data.form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="文件名" prop="NAME">
|
||||
<el-input v-model="data.form.NAME" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="REMARKS">
|
||||
<el-input
|
||||
v-model="data.form.REMARKS"
|
||||
type="textarea"
|
||||
:autosize="{
|
||||
minRows: 3,
|
||||
}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="fnClose">取消</el-button>
|
||||
<el-button type="primary" @click="fnSubmit"> 确定 </el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useVModel } from "@vueuse/core";
|
||||
import { reactive, ref } from "vue";
|
||||
import useFormValidate from "@/assets/js/useFormValidate.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import { setSystemDocumentsAddFolder } from "@/request/system_operation.js";
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
mfolderId: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(["update:visible", "get-data"]);
|
||||
const visible = useVModel(props, "visible", emits);
|
||||
const rules = {
|
||||
NAME: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
||||
};
|
||||
const formRef = ref(null);
|
||||
const data = reactive({
|
||||
form: {
|
||||
NAME: "",
|
||||
REMARKS: "",
|
||||
},
|
||||
});
|
||||
const fnClose = () => {
|
||||
formRef.value.resetFields();
|
||||
visible.value = false;
|
||||
};
|
||||
const fnSubmit = debounce(
|
||||
1000,
|
||||
async () => {
|
||||
await useFormValidate(formRef);
|
||||
await setSystemDocumentsAddFolder({
|
||||
...data.form,
|
||||
PARENT_ID: props.mfolderId,
|
||||
});
|
||||
fnClose();
|
||||
ElMessage.success("保存成功");
|
||||
emits("get-data");
|
||||
},
|
||||
{ atBegin: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
|
@ -0,0 +1,77 @@
|
|||
<template>
|
||||
<el-dialog v-model="visible" title="上传文件" :before-close="fnClose">
|
||||
<el-form ref="formRef" :model="data.form" :rules="rules" label-width="80px">
|
||||
<el-form-item label="附件" prop="file">
|
||||
<layout-upload
|
||||
v-model:file-list="data.form.file"
|
||||
accept=".pdf"
|
||||
:limit="99"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="fnClose">取消</el-button>
|
||||
<el-button type="primary" @click="fnSubmit"> 确定 </el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useVModel } from "@vueuse/core";
|
||||
import { reactive, ref } from "vue";
|
||||
import useFormValidate from "@/assets/js/useFormValidate.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import { setSystemDocumentsBatchUploadFile } from "@/request/system_operation.js";
|
||||
import LayoutUpload from "@/components/upload/index.vue";
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
mfolderId: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(["update:visible", "get-data"]);
|
||||
const visible = useVModel(props, "visible", emits);
|
||||
const rules = {
|
||||
file: [{ required: true, message: "附件不能为空", trigger: "change" }],
|
||||
};
|
||||
const formRef = ref(null);
|
||||
const data = reactive({
|
||||
form: {
|
||||
file: [],
|
||||
},
|
||||
});
|
||||
const fnClose = () => {
|
||||
formRef.value.resetFields();
|
||||
visible.value = false;
|
||||
};
|
||||
const fnSubmit = debounce(
|
||||
1000,
|
||||
async () => {
|
||||
await useFormValidate(formRef);
|
||||
const formData = new FormData();
|
||||
Object.keys(data.form).forEach((key) => {
|
||||
formData.append(key, data.form[key]);
|
||||
});
|
||||
formData.delete("file");
|
||||
formData.append("PARENT_ID", props.mfolderId);
|
||||
for (let i = 0; i < data.form.file.length; i++) {
|
||||
formData.append("FFILE", data.form.file[i].raw);
|
||||
}
|
||||
await setSystemDocumentsBatchUploadFile(formData);
|
||||
fnClose();
|
||||
ElMessage.success("保存成功");
|
||||
emits("get-data");
|
||||
},
|
||||
{ atBegin: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
|
@ -0,0 +1,91 @@
|
|||
<template>
|
||||
<el-dialog v-model="visible" title="上传文件" :before-close="fnClose">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="data.form"
|
||||
:rules="rules"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="文件名" prop="NAME">
|
||||
<el-input v-model="data.form.NAME" />
|
||||
</el-form-item>
|
||||
<el-form-item label="附件" prop="file">
|
||||
<layout-upload v-model:file-list="data.form.file" accept=".pdf" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="REMARKS">
|
||||
<el-input
|
||||
v-model="data.form.REMARKS"
|
||||
type="textarea"
|
||||
:autosize="{
|
||||
minRows: 3,
|
||||
}"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="fnClose">取消</el-button>
|
||||
<el-button type="primary" @click="fnSubmit"> 确定 </el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useVModel } from "@vueuse/core";
|
||||
import { reactive, ref } from "vue";
|
||||
import useFormValidate from "@/assets/js/useFormValidate.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import { setSystemDocumentsUploadFile } from "@/request/system_operation.js";
|
||||
import LayoutUpload from "@/components/upload/index.vue";
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
mfolderId: {
|
||||
type: String,
|
||||
required: true,
|
||||
default: "",
|
||||
},
|
||||
});
|
||||
const emits = defineEmits(["update:visible", "get-data"]);
|
||||
const visible = useVModel(props, "visible", emits);
|
||||
const rules = {
|
||||
NAME: [{ required: true, message: "名称不能为空", trigger: "blur" }],
|
||||
file: [{ required: true, message: "附件不能为空", trigger: "change" }],
|
||||
};
|
||||
const formRef = ref(null);
|
||||
const data = reactive({
|
||||
form: {
|
||||
NAME: "",
|
||||
file: [],
|
||||
REMARKS: "",
|
||||
},
|
||||
});
|
||||
const fnClose = () => {
|
||||
formRef.value.resetFields();
|
||||
visible.value = false;
|
||||
};
|
||||
const fnSubmit = debounce(
|
||||
1000,
|
||||
async () => {
|
||||
await useFormValidate(formRef);
|
||||
const formData = new FormData();
|
||||
Object.keys(data.form).forEach((key) => {
|
||||
formData.append(key, data.form[key]);
|
||||
});
|
||||
formData.delete("file");
|
||||
formData.append("PARENT_ID", props.mfolderId);
|
||||
formData.append("FFILE", data.form.file[0].raw);
|
||||
await setSystemDocumentsUploadFile(formData);
|
||||
fnClose();
|
||||
ElMessage.success("保存成功");
|
||||
emits("get-data");
|
||||
},
|
||||
{ atBegin: true }
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss"></style>
|
|
@ -20,7 +20,6 @@
|
|||
path: '/system_operation/system_documents',
|
||||
query: {
|
||||
MFOLDER_ID: row.MFOLDER_ID,
|
||||
MFOLDER_NAME: row.NAME,
|
||||
},
|
||||
})
|
||||
"
|
||||
|
@ -31,7 +30,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column v-if="MFOLDER_ID !== '0'" label="文件名">
|
||||
<template v-slot="{ row }">
|
||||
{{ row.NAME }}{{ getFileSuffix(row.FILEPATH) }}
|
||||
{{ row.NAME }}
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
|
@ -87,8 +86,7 @@
|
|||
<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>
|
||||
{{ row.SHARE === "no" ? "私有文件" : "公共文件" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="REMARKS" label="备注说明" show-overflow-tooltip />
|
||||
|
@ -118,7 +116,7 @@
|
|||
<el-button
|
||||
v-if="MFOLDER_ID === '0' && buttonJurisdiction.add"
|
||||
type="primary"
|
||||
@click="fnAddFolder"
|
||||
@click="data.addFolderDialogVisible = true"
|
||||
>
|
||||
新建文件夹
|
||||
</el-button>
|
||||
|
@ -126,14 +124,14 @@
|
|||
<el-button
|
||||
v-if="buttonJurisdiction.add"
|
||||
type="primary"
|
||||
@click="fnUploadFile"
|
||||
@click="data.uploadFileDialogVisible = true"
|
||||
>
|
||||
上传文件
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="buttonJurisdiction.add"
|
||||
type="primary"
|
||||
@click="fnBatchUploadFile"
|
||||
@click="data.batchUploadFileDialogVisible = true"
|
||||
>
|
||||
批量上传
|
||||
</el-button>
|
||||
|
@ -153,11 +151,29 @@
|
|||
:src="data.videoDialog.src"
|
||||
v-model:visible="data.videoDialog.visible"
|
||||
/>
|
||||
<add-folder
|
||||
v-model:visible="data.addFolderDialogVisible"
|
||||
:mfolder-id="MFOLDER_ID"
|
||||
@get-data="fnResetPaginationTransfer"
|
||||
/>
|
||||
<upload-folder
|
||||
v-model:visible="data.uploadFileDialogVisible"
|
||||
:mfolder-id="MFOLDER_ID"
|
||||
@get-data="fnResetPaginationTransfer"
|
||||
/>
|
||||
<batch-upload-file
|
||||
v-model:visible="data.batchUploadFileDialogVisible"
|
||||
:mfolder-id="MFOLDER_ID"
|
||||
@get-data="fnResetPaginationTransfer"
|
||||
/>
|
||||
</layout-card>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { getSystemDocumentsList } from "@/request/system_operation.js";
|
||||
import {
|
||||
getSystemDocumentsList,
|
||||
setSystemDocumentsDelete,
|
||||
} from "@/request/system_operation.js";
|
||||
import { reactive, ref } from "vue";
|
||||
import LayoutPdf from "@/components/pdf/index";
|
||||
import LayoutTxt from "@/components/txt/index.vue";
|
||||
|
@ -166,7 +182,6 @@ import {
|
|||
serialNumber,
|
||||
calculateFileSize,
|
||||
interceptTheSuffix,
|
||||
getFileSuffix,
|
||||
} from "@/assets/js/utils";
|
||||
import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
|
||||
import { onBeforeRouteUpdate, useRoute, useRouter } from "vue-router";
|
||||
|
@ -175,17 +190,17 @@ 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";
|
||||
import AddFolder from "./components/add_folder.vue";
|
||||
import UploadFolder from "./components/upload_file.vue";
|
||||
import BatchUploadFile from "./components/batch_upload_file.vue";
|
||||
|
||||
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,
|
||||
{
|
||||
|
@ -209,6 +224,9 @@ const data = reactive({
|
|||
visible: false,
|
||||
src: "",
|
||||
},
|
||||
addFolderDialogVisible: false,
|
||||
uploadFileDialogVisible: false,
|
||||
batchUploadFileDialogVisible: false,
|
||||
});
|
||||
const buttonJurisdiction = await useButtonJurisdiction("mfolder");
|
||||
const fnGetDataTransfer = () => {
|
||||
|
@ -223,7 +241,6 @@ const fnResetPaginationTransfer = () => {
|
|||
};
|
||||
onBeforeRouteUpdate((to) => {
|
||||
MFOLDER_ID.value = to.query.MFOLDER_ID || mfolderIdDefault;
|
||||
MFOLDER_NAME.value = to.query.MFOLDER_NAME || mfolderNameDefault;
|
||||
fnResetPaginationTransfer();
|
||||
});
|
||||
const fnDelete = debounce(
|
||||
|
@ -232,7 +249,7 @@ const fnDelete = debounce(
|
|||
await ElMessageBox.confirm(`确定要删除吗?`, {
|
||||
type: "warning",
|
||||
});
|
||||
await setDepartmentDelete({ MFOLDER_ID, FILEPATH: FILEPATH || "" });
|
||||
await setSystemDocumentsDelete({ MFOLDER_ID, FILEPATH: FILEPATH || "" });
|
||||
ElMessage.success("删除成功");
|
||||
fnResetPaginationTransfer();
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue