提交 0c2bfd13 authored 作者: 钟是志's avatar 钟是志

动态菜单开发 未完成 下次直接修改 BasicLayout 文件

上级 2b4bb632
import React from "react";
import CheckRecord from "@/webPublic/FormInsertDiy/ExportComponent/CheckRecord"; // 查询类
import Apply from "@/webPublic/FormInsertDiy/AffairPage/ApplyPage"; // 申请
import BatchAudit from "@/webPublic/FormInsertDiy/AffairPage/AuditPage/BatchAudit"; // 批量审批
import Audit from "@/webPublic/FormInsertDiy/AffairPage/AuditPage/index.js"; // 审批
import Detail from "@/webPublic/FormInsertDiy/AffairPage/Detail"; //详情
export default function ActiveMenuComponent({
routerConfig,
...otherProps
}) {
const { component = "", appId } = routerConfig;
switch (component) {
case "CheckRecord": // 查询类应用
return <CheckRecord workId={appId} location={routerConfig} />;
case "Apply": // 申请类
return <Apply location={routerConfig}
workId={appId} />;
case "Audit": // 审批类
return <Audit location={routerConfig}
workId={appId} />;
case "BatchAudit": // 批量审批
return <Audit location={routerConfig}
workId={appId} />;
case "Detail": // 详情
return <Detail location={routerConfig}
{...otherProps} />;
default:
console.log(component, '没有找到此组件');
return <div>暂无此功能</div>;
}
}
import RenderForm from "@/webPublic/FormInsertDiy/RenderForm";
import { fetchTemplateById } from '@/webPublic/Services';
import { useState, useEffect } from "react";
import { Form } from 'antd';
import { getOneStopConfig } from "@/baseComponent/utils";
// const id = '1234718972352397312';
// 考核汇总页面
function OtherCheckRecord({ form, location: { pathname }, workId }) {
const [data, setData] = useState();
useEffect(() => {
const id = workId || getOneStopConfig(pathname);
setData(undefined);
fetchTemplateById(id).then(res => {
if (res) setData({...res, content: "{}"});
});
}, [pathname]);
return !!data && <RenderForm form={form} postData={data} style={{ padding: 0 }} />;
}
export default Form.create()(OtherCheckRecord)
......@@ -8,9 +8,9 @@
import { uaaRequest } from './one_stop_public/utils/request';
import config from '@/config/config';
import { message } from 'antd';
import { setOneStopConfig } from '@/webPublic/zyd_public/utils/utils';
import { setOneStopActiveMenusConfig, setOneStopConfig } from '@/webPublic/zyd_public/utils/utils';
import { getOneStopConfigList } from '@/webPublic/one_stop_public/publicServices';
import prepareShow from "@/webPublic/one_stop_public/Table/prepareShow";
import prepareShow from '@/webPublic/one_stop_public/Table/prepareShow';
// 根据模板code查询模板数据
// 查询表格中某条数据
......@@ -26,11 +26,12 @@ import prepareShow from "@/webPublic/one_stop_public/Table/prepareShow";
export const fetchTemplateByCode = (code) =>
uaaRequest('/UnifiedServicePatternApi/getDetail', { code });
export const fetchTemplateById = (id) => uaaRequest('/UnifiedAppApi/getDetail', { id }).then((res) => {
return prepareShow(res).then((x) => {
return res;
});
});
export const fetchTemplateById = (id) =>
uaaRequest('/UnifiedAppApi/getDetail', { id }).then((res) => {
return prepareShow(res).then((x) => {
return res;
});
});
/**
* 查询表格中某条数据
......@@ -50,13 +51,13 @@ export const fetchTableItem = ({ dataObjId, key, value, isBase = true }) => {
* @param {Number} pageSize
* @param {Number} pageNo
*/
export const fetchTableData = ({ dataObjId, query, pageSize, pageNo ,...other}) => {
export const fetchTableData = ({ dataObjId, query, pageSize, pageNo, ...other }) => {
return uaaRequest('/DataObjApi/getFormDataPage', {
dataObjId,
query: JSON.stringify(query),
pageNo,
pageSize,
...other,
...other,
});
};
......@@ -107,8 +108,8 @@ export const getHistoryFormDetail = ({ id, code }) => {
};
export const getTaskDefinition = (data) => {
return uaaRequest('/UnifiedAppFormApi/getTaskDefinition', data);
}
return uaaRequest('/UnifiedAppFormApi/getTaskDefinition', data);
};
/**
* 获取一站式应用列表
......@@ -135,16 +136,40 @@ export const getListByTreeList = (params = {}) => {
};
export const getOneStopMyInfo = (params = {}) => {
return uaaRequest('/UserApi/getMy', params);
return uaaRequest('/UserApi/getMy', params);
};
export function getOneStopActiveMenus(key) {
return new Promise((resolve, reject) => {
const pathList = {
'/xg/stundents_record/': [ // 一级
{
level: 3,
path: '/xg/stundents_record/student/asdasd/45380948502989040823094',
locale: '查询类页面',
component: 'CheckRecord',
authority: [this.path],
exact: true
},
],
};
setOneStopActiveMenusConfig(pathList);
if (key && pathList[key]) {
resolve(pathList[key]);
} else {
resolve(false);
}
});
}
export function getOnestopKey(key = '', formKey = 'key_list', formValue = 'value_list') {
getOneStopActiveMenus().then((res) => {});
getOneStopMyInfo({}).then((res) => {
if(res){
localStorage.setItem('user', JSON.stringify(res));
}
});
getOneStopMyInfo({}).then((res) => {
if (res) {
localStorage.setItem('user', JSON.stringify(res));
}
});
return fetchTableData({
dataObjId: config.onestopConfigDataObjId || '1248169933162938368',
......@@ -157,7 +182,9 @@ export function getOnestopKey(key = '', formKey = 'key_list', formValue = 'value
onestopConfigList[item[formKey]] = item[formValue];
}
setOneStopConfig(onestopConfigList);
getOneStopConfigList();
if (key) {
return onestopConfigList[key];
}
......
......@@ -5,7 +5,7 @@
import React from "react";
import moment from "moment";
import { Icon, message, notification } from "antd";
import { getOnestopKey } from "../../Services";
import { getOneStopActiveMenus, getOnestopKey } from "../../Services";
import FormdataWrapper from "./object-to-formdata-custom";
let messageTime = new Date().getTime() - 3000;
......@@ -243,6 +243,20 @@ export function getOneStopConfig(key) {
}
}
export function setOneStopActiveMenusConfig(value) {
window.oneStopActiveMenusConfig = value;
}
export function getOneStopActiveMenusConfig(key) {
if (window.oneStopActiveMenusConfig && typeof window.oneStopActiveMenusConfig === 'object') {
return window.oneStopActiveMenusConfig[key] || false;
} else {
return getOneStopActiveMenus(key);
}
}
export function diGuiTree(treeData = [], i = 0) {
// for (let item of treeData) {
// if(i === 2){
......@@ -297,7 +311,7 @@ export function downloadFile(url, params, fileName = "导出文件", ext = "xlsx
});
}
// 校验密码是否符合 包含数字 字母 和特殊字符 解决 中医大的安全漏洞
export default function CheckPassWord(password = "") {
// console.log(password);
if (!password || password.length < 12) {
......@@ -313,26 +327,4 @@ export default function CheckPassWord(password = "") {
}
return true;
// let includeNumber = false;
// let includeWord = false;
// for (let i = 0; i <= password.length; i++) {
// let iN = password.charCodeAt(i);
// //数字
// if (iN >= 48 && iN <= 57) {
// includeNumber = true;
// }
// // 大写 // 小写
// if ((iN >= 65 && iN <= 90) || (iN >= 97 && iN <= 122)) {
// includeWord = true;
// }
//
// if(includeWord && includeNumber){
// return true;
// }
// }
// if(includeWord && includeNumber){
// }else{
// // message.warning("密码过于简单, 请输入不小于8位的密码 且必须包含数字和字母!");
// return false;
// }
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论