💥 feat(模块): 添加了个很棒的功能

This commit is contained in:
cclu 2025-03-26 18:59:26 +08:00
parent f4d966168e
commit c6da1f9557
19 changed files with 437 additions and 84 deletions

View File

@ -46,8 +46,19 @@ export default [
component: "@/pages/examine/record/index", component: "@/pages/examine/record/index",
} }
] ]
}, },
{
path: "/setting",
redirect: '',
name: '系统设置',
routes: [
{
path: '/setting/menu',
name: '菜单管理',
component: "@/pages/setting/menu/index",
},
]
}
] ]
} }

View File

@ -10,7 +10,7 @@
height: 30.9px; height: 30.9px;
} }
.username{ .username{
color: #fff; color: #000;
} }
&:hover { &:hover {
// background: #252a3d; // background: #252a3d;

View File

@ -1,14 +1,18 @@
import type { FC } from 'react'; import type { FC } from 'react';
import { connect } from 'umi'; import { connect } from 'umi';
import { Dropdown, Space } from 'antd'; import { Dropdown, Space } from 'antd';
import { LogoutOutlined } from '@ant-design/icons'; import { LogoutOutlined } from '@ant-design/icons';
import type { UserConnectedProps } from '@/models/user'; import type { UserConnectedProps } from '@/models/user';
import './index.less'; import './index.less';
import IconFont from '../IconFont';
const Avatar: FC<UserConnectedProps> = (props) => { const Avatar: FC<UserConnectedProps> = (props) => {
const { const {
user: { data }, dispatch, user: { data }, dispatch,
} = props; } = props;
console.log('user32323', data);
const handleLogout = () => { const handleLogout = () => {
dispatch?.({ dispatch?.({
@ -41,12 +45,16 @@ const Avatar: FC<UserConnectedProps> = (props) => {
menu={{ items }} menu={{ items }}
> >
<Space className="avatar-container"> <Space className="avatar-container">
<img {
data.avatarUrl ? <img
alt="avatar" alt="avatar"
src={data.avatar} src={data.avatarUrl}
className="avatar" className="avatar"
/> /> :
<span className="username">{data.name}</span> <IconFont name='icon-touxiang' size="36" ></IconFont>
}
<span className="username">{data.adminName}</span>
</Space> </Space>
</Dropdown> </Dropdown>
); );

View File

@ -0,0 +1,21 @@
/*
* @Author: cclu 1106109051@qq.com
* @Date: 2025-03-26 16:52:53
* @LastEditors: cclu 1106109051@qq.com
* @LastEditTime: 2025-03-26 16:55:11
* @FilePath: \cloudNew\src\components\IconFont\index.tsx
* @Description: ,`customMade`, koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
import { createFromIconfontCN } from '@ant-design/icons'
const IconEle = createFromIconfontCN({
// 该地址为iconfont中的项目地址根据实际进行修改
scriptUrl: '//at.alicdn.com/t/font_2794551_586f2xpreyu.js'
});
const IconFont = ({ name, style, size, className }: { name: string, style?: any, size: string | number, className?: any }) => {
// const newStyle = size ? { ...{ fontSize: `${size}px`,lineHeight:`${size}px` }, ...style } : {...style}
return <IconEle type={name} style={{ ...style, fontSize: `${size}px`, display: 'flex', alignItems: 'center' }} className={className} />
}
export default IconFont;

View File

@ -8,7 +8,7 @@ import ProForm, { ProFormText } from "@ant-design/pro-form";
import { Button, Col, FormInstance, Row, Tree } from "antd"; import { Button, Col, FormInstance, Row, Tree } from "antd";
// import { getServerpartTree } from "@/services/options"; // import { getServerpartTree } from "@/services/options";
import useRequest from "@ahooksjs/use-request"; import useRequest from "@ahooksjs/use-request";
import { getMerchantShopTree, getServerpartTree } from "./service"; import { getMerchantShopTree, getServerpartTree, handleGetAllServicePart } from "./service";
// import './style.less' // import './style.less'
// import { getMerchantShopTree } from "@/pages/Setting/Users/service"; // import { getMerchantShopTree } from "@/pages/Setting/Users/service";
@ -39,9 +39,19 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width,
const { loading: treeLoading, data: treeViews } = useRequest(async () => { const { loading: treeLoading, data: treeViews } = useRequest(async () => {
let data: any = [] let data: any = []
if (currentUser?.UserPattern === 2000) { if (currentUser?.UserPattern === 2000) {
data = await getMerchantShopTree({ BusinessManId: currentUser?.BusinessManID, ShowShop: false }); // data = await getMerchantShopTree({ BusinessManId: currentUser?.BusinessManID, ShowShop: false });
} else { } else {
data = await getServerpartTree(currentUser?.provinceCode, currentUser?.CityAuthority, true, true, true, false, 1000) // data = await getServerpartTree(currentUser?.provinceCode, currentUser?.CityAuthority, true, true, true, false, 1000)
let req: any = {
page: 1,
limit: 999,
sortBy: 'sort',
sortOrder: 'ASC',
code: '510000'
}
data = await handleGetAllServicePart(req)
data.data.list[0].key = data.data.list[0].id
data = data.data.list
} }
console.log('datatree', data); console.log('datatree', data);
@ -60,11 +70,11 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width,
list.push(item.children[0]) list.push(item.children[0])
} else { } else {
if (haveTest) { if (haveTest) {
if (item.value !== 424) { if (item.id !== 424) {
list.push(item) list.push(item)
} }
} else { } else {
if (item.value !== 424 && item.value !== 586) { if (item.id !== 424 && item.id !== 586) {
list.push(item) list.push(item)
} }
} }
@ -137,7 +147,7 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width,
const handleFilterList = (list: any, id: any) => { const handleFilterList = (list: any, id: any) => {
let res: any = [] let res: any = []
list.forEach((item: any) => { list.forEach((item: any) => {
if (item.value === id) { if (item.id === id) {
} else { } else {
res.push(item) res.push(item)
@ -207,22 +217,17 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width,
> >
{treeView && treeView.length > 0 ? <Tree {treeView && treeView.length > 0 ? <Tree
checkable checkable
treeData={isShowAllInTree ? [{ treeData={treeView}
label: '全部',
value: 0,
key: '0-0',
children: treeView
}] : treeView}
fieldNames={{ fieldNames={{
title: "label", title: "name",
key: "key" key: "id"
}} }}
blockNode blockNode
defaultExpandAll={isShowAllInTree ? false : true} defaultExpandAll={isShowAllInTree ? true : false}
defaultExpandedKeys={isShowAllInTree ? treeShowRow && treeShowRow.length > 0 ? treeShowRow : ['0-0'] : []} defaultExpandedKeys={isShowAllInTree ? [] : [510000]}
onCheck={(checkedKeys: React.Key[] | any, info) => { onCheck={(checkedKeys: React.Key[] | any, info) => {
const selectedIds = info.checkedNodes.filter((n: any) => n?.type === 1) const selectedIds = info.checkedNodes.filter((n: any) => n?.districtId > 0)
setSelectedId(selectedIds.map(n => n?.value)?.toString() || '') setSelectedId(selectedIds.map(n => n?.id) || '')
if (reload) { if (reload) {
actionRef?.current?.reload() actionRef?.current?.reload()
} }

View File

@ -59,3 +59,14 @@ export async function handleGetServerpartDDL(params: any) {
return data.Result_Data.List return data.Result_Data.List
} }
import requestNew from "@/utils/request"
// 新的拿到服务区的树的接口
export async function handleGetAllServicePart(params?: any) {
const data = await requestNew.get('/server-part/provinces', params)
if (data.code === 200) {
return data.data
}
return []
}

View File

@ -200,6 +200,13 @@ const BasicLayout: FC<{ user: UserModelState, global: ProfileModelState, dispatc
hideInMenu: false, hideInMenu: false,
name: "考核记录管理", name: "考核记录管理",
path: "/examine/record", path: "/examine/record",
},
{
SYSTEMMODULE_DESC: "",
guid: "6",
hideInMenu: false,
name: "菜单管理",
path: "/setting/menu",
} }
] ]

View File

@ -244,8 +244,19 @@ const UserModel: UserModelType = {
component: "@/pages/examine/record", component: "@/pages/examine/record",
} }
] ]
}, },
{
path: "/setting",
redirect: '',
name: '系统设置',
children: [
{
path: '/setting/menu',
name: '菜单管理',
component: "@/pages/setting/menu/index",
},
]
}
] ]
let indexAllMenuItemByPath: any = [] let indexAllMenuItemByPath: any = []
let indexValidMenuItemByPath: any = [] let indexValidMenuItemByPath: any = []
@ -278,6 +289,7 @@ const UserModel: UserModelType = {
'/examine/modal', '/examine/modal',
'/examine/question', '/examine/question',
'/examine/record', '/examine/record',
'/setting/menu'
], ],
rootSubmenuKeys: handleGetRootSubmenuKeys(menuRes.data), rootSubmenuKeys: handleGetRootSubmenuKeys(menuRes.data),
indexAllMenuItemById: handleGetEachDatumFromNestedDataByKey(menuRes.data, 'id'), indexAllMenuItemById: handleGetEachDatumFromNestedDataByKey(menuRes.data, 'id'),

View File

@ -14,6 +14,7 @@ const authority: PageAuthority = {
'/examine/record': [ '/examine/record': [
'/examine/record', '/examine/record',
], ],
'/setting/menu': ['/setting/menu']
}; };

View File

@ -5,7 +5,7 @@ import { Button, Col, message, Modal, Popconfirm, Row, Space, Image, Drawer } fr
import moment from "moment"; import moment from "moment";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import { connect } from "umi"; import { connect } from "umi";
import { handleAddTemplates, handleDeleteTemplates, handleGetQuestionList, handleGetTemplatesList, handleUpdateTemplates, handleUploadFile } from "./service"; import { handleAddTemplates, handleDeleteTemplates, handleGetQuestionList, handleGetTemplatesList, handleSearchModalTree, handleUpdateTemplates, handleUploadFile } from "./service";
import { handleGetExamineTypeTreeList } from "../index/service"; import { handleGetExamineTypeTreeList } from "../index/service";
import QRCode from 'qrcode'; import QRCode from 'qrcode';
import { base64ToFile } from "@/utils/publicMethods"; import { base64ToFile } from "@/utils/publicMethods";
@ -27,7 +27,7 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
// 弹出框的表单实例 // 弹出框的表单实例
const modalRef = useRef<FormInstance>() const modalRef = useRef<FormInstance>()
// 树相关的属性和方法 // 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string>() const [selectedId, setSelectedId] = useState<string[]>()
const [collapsible, setCollapsible] = useState<boolean>(false) const [collapsible, setCollapsible] = useState<boolean>(false)
// 显示新增点位的悬浮框 // 显示新增点位的悬浮框
@ -55,7 +55,7 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
const [previewIndex, setPreviewIndex] = useState<number>(0) const [previewIndex, setPreviewIndex] = useState<number>(0)
const [columnsStateMap, setColumnsStateMap] = useState<any>({ const [columnsStateMap, setColumnsStateMap] = useState<any>({
updatedAt: { show: false }, updatedAt: { show: false },
createdAt: { show: false }, // createdAt: { show: false },
operator: { show: false }, operator: { show: false },
}) })
// 显示新增大类的抽屉 // 显示新增大类的抽屉
@ -66,20 +66,42 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
const [bigTypeList, setBigTypeList] = useState<any>() const [bigTypeList, setBigTypeList] = useState<any>()
const columns: any = [ const columns: any = [
// {
// title: "巡查类型",
// dataIndex: "status",
// hideInTable: true,
// valueType: "select",
// valueEnum: {
// "1": '异常',
// "0": "正常"
// }
// },
// {
// title: "搜索内容",
// dataIndex: "anySearchParams",
// hideInTable: true,
// fieldProps: {
// }
// },
{ {
title: <div style={{ textAlign: 'center' }}></div>, title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "serverPartName", dataIndex: "serverPartName",
hideInSearch: true, hideInSearch: true,
width: 150,
ellipsis: true
},
{
title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "title",
hideInSearch: true,
width: 200, width: 200,
ellipsis: true ellipsis: true,
render: (_, record) => {
return record?.type === 'district' || record?.type === 'servicePart' ? record?.name :
record?.title
}
}, },
// {
// title: <div style={{ textAlign: 'center' }}>点位名称</div>,
// dataIndex: "title",
// hideInSearch: true,
// width: 200,
// ellipsis: true
// },
{ {
title: <div style={{ textAlign: 'center' }}></div>, title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "questions", dataIndex: "questions",
@ -127,7 +149,7 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
width: 100, width: 100,
ellipsis: true, ellipsis: true,
render: (_, record) => { render: (_, record) => {
return record?.status ? '有效' : '无效' return record?.type === 'district' || record?.type === 'servicePart' ? '' : record?.status ? '有效' : '无效'
} }
}, },
{ {
@ -175,7 +197,7 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
fixed: "right", fixed: "right",
width: 120, width: 120,
render: (_: any, record: any) => { render: (_: any, record: any) => {
return <Space> return record?.type === 'district' || record?.type === 'servicePart' ? '' : <Space>
<a onClick={() => { <a onClick={() => {
console.log('record', record); console.log('record', record);
setCurrentRow(record) setCurrentRow(record)
@ -288,11 +310,11 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
return ( return (
<div style={{ backgroundColor: '#fff', display: 'flex' }}> <div style={{ backgroundColor: '#fff', display: 'flex' }}>
{/* <LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} currentUser={currentUser} /> */} <LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} currentUser={currentUser} />
<div style={{ <div style={{
// width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)', width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
width: "100%", // width: "100%",
paddingTop: 0, paddingTop: 0,
paddingBottom: 0, paddingBottom: 0,
paddingRight: 0 paddingRight: 0
@ -305,13 +327,24 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
expandable={{ expandable={{
expandRowByClick: true expandRowByClick: true
}} }}
rowKey={(record) => {
return `${record?.id}`
}}
scroll={{ x: "100%", y: 'calc(100vh - 400px)' }} scroll={{ x: "100%", y: 'calc(100vh - 400px)' }}
headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}></span>} headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}></span>}
search={{ span: 6 }} search={{ span: 6 }}
request={async () => { request={async () => {
const req: any = { console.log('selectedId', selectedId);
if (!(selectedId && selectedId.length > 0)) {
return
} }
const data = await handleGetTemplatesList()
const req: any = {
serverPartIds: selectedId && selectedId.length > 0 ? selectedId : [],
}
const data = await handleSearchModalTree(req)
if (data && data.length > 0) { if (data && data.length > 0) {
return { data, success: true } return { data, success: true }
} }

View File

@ -43,3 +43,12 @@ export async function handleUploadFile(params?: any) {
const data = await request.post(`/oss/upload`, params) const data = await request.post(`/oss/upload`, params)
return data return data
} }
// 模版树的查询
export async function handleSearchModalTree(params?: any) {
const data = await request.post(`/questionnaire-templates/search/tree`, params)
if (data.code === 200) {
return data.data
}
return []
}

View File

@ -4,7 +4,7 @@ import { Button, Col, message, Modal, Popconfirm, Row, Space } from "antd";
import { useRef, useState } from "react"; import { useRef, useState } from "react";
import { connect } from "umi"; import { connect } from "umi";
import { handleAddQuestion, handleDeleteQuestion, handleEditQuestion, handleGetQuestionList } from "./service"; import { handleAddQuestion, handleDeleteQuestion, handleEditQuestion, handleGetQuestionList } from "./service";
import { handleGetExamineTypeList, handleGetExamineTypeTreeList } from "../index/service"; import { handleGetAddExamineType, handleGetExamineTypeList, handleGetExamineTypeTreeList } from "../index/service";
import moment from "moment"; import moment from "moment";
import AddQuestion from "./components/addQuestion"; import AddQuestion from "./components/addQuestion";
@ -227,6 +227,7 @@ const examineQuestion: React.FC<{ currentUser: any }> = (props) => {
}} }}
scroll={{ x: "100%", y: 'calc(100vh - 400px)' }} scroll={{ x: "100%", y: 'calc(100vh - 400px)' }}
request={async (params) => { request={async (params) => {
console.log('params', params);
// 拿到分类数据 将 问题数据 拼到对应的分类下面去 // 拿到分类数据 将 问题数据 拼到对应的分类下面去
const typeReq = { const typeReq = {
@ -234,6 +235,7 @@ const examineQuestion: React.FC<{ currentUser: any }> = (props) => {
"key": "" "key": ""
}] }]
} }
params?.id
let typeData = await handleGetExamineTypeTreeList(typeReq) let typeData = await handleGetExamineTypeTreeList(typeReq)
let bigType = JSON.parse(JSON.stringify(typeData)) let bigType = JSON.parse(JSON.stringify(typeData))
console.log('bigType', bigType); console.log('bigType', bigType);

View File

@ -0,0 +1,26 @@
{
// 第一层 片区
value: 81, // (id 变成value),
... // 别的一样没事
childnre: [{
// 第二层 服务区
value: 528, // (id变value)
SPRegionTypeName: "", // 片区名称
SPRegionTypeId: "", // 片区id
... // 别的一样
childnre: [{
// 第三层 实际业务
serverPartName: "", // 服务区名称
serverPartId: "", // 服务区id
SPRegionTypeName: "", // 片区名称
SPRegionTypeId: "", // 片区id
serverPartShopName:"" ,// 门店名称(可能会有)
serverPartShopId:"",// 门店id (可能会有)
... // 实际业务内容
}
]
}]
}

View File

@ -2,11 +2,12 @@ import { ConnectState } from "@/models/global";
import { ActionType, FormInstance, ProTable } from "@ant-design/pro-components"; import { ActionType, FormInstance, ProTable } from "@ant-design/pro-components";
import { useRef, useState } from "react"; import { useRef, useState } from "react";
import { connect } from "umi"; import { connect } from "umi";
import { handleDeleteRecord, handleGetRecordList, handleUpdateExtend } from "./service"; import { handleDeleteRecord, handleGetRecordList, handleGetRecordTreeList, handleUpdateExtend } from "./service";
import moment from "moment"; import moment from "moment";
import { Button, Drawer, Image, message, Popconfirm, Space } from "antd"; import { Button, Drawer, Image, message, Popconfirm, Space } from "antd";
import { handleGetServerpartDDL } from "@/components/leftSelectTree/service"; import { handleGetServerpartDDL } from "@/components/leftSelectTree/service";
import RecordDetail from "./components/recordDetail"; import RecordDetail from "./components/recordDetail";
import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
const examineRecord: React.FC<{ currentUser: any }> = (props) => { const examineRecord: React.FC<{ currentUser: any }> = (props) => {
const { currentUser } = props const { currentUser } = props
@ -26,11 +27,12 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
const [showDetail, setShowDetail] = useState<boolean>(false) const [showDetail, setShowDetail] = useState<boolean>(false)
// 判断是否点了出现的是异常处理的抽屉 // 判断是否点了出现的是异常处理的抽屉
const [showAbnormal, setShowAbnormal] = useState<boolean>(false) const [showAbnormal, setShowAbnormal] = useState<boolean>(false)
// 树相关的属性和方法
const [selectedId, setSelectedId] = useState<string[]>()
const [columnsStateMap, setColumnsStateMap] = useState<any>({ const [columnsStateMap, setColumnsStateMap] = useState<any>({
score: { show: false } score: { show: false }
}) })
const [collapsible, setCollapsible] = useState<boolean>(false)
const columns: any = [ const columns: any = [
{ {
@ -52,21 +54,20 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
format: 'YYYY-MM-DD', format: 'YYYY-MM-DD',
} }
}, },
{ // {
title: "服务区", // title: "服务区",
dataIndex: "serverPartId", // dataIndex: "serverPartId",
hideInTable: true, // hideInTable: true,
valueType: "select", // valueType: "select",
request: async () => { // request: async () => {
const req = { // const req = {
ProvinceCode: currentUser?.provinceCode, // ProvinceCode: currentUser?.provinceCode,
StatisticsType: 1000 // StatisticsType: 1000
} // }
const data = await handleGetServerpartDDL(req) // const data = await handleGetServerpartDDL(req)
return data // return data
} // }
}, // },
{ {
title: "巡查类型", title: "巡查类型",
dataIndex: "inspectionType", dataIndex: "inspectionType",
@ -81,22 +82,27 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
title: <div style={{ textAlign: 'center' }}></div>, title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "serverPartName", dataIndex: "serverPartName",
hideInSearch: true, hideInSearch: true,
width: 150, width: 200,
ellipsis: true, ellipsis: true,
render: (_, record) => { render: (_, record) => {
return record?.template.serverPartName ? record?.template.serverPartName : "-" return record?.type === 'district' || record?.type === 'servicePart' ? record?.name :
} record?.template ? record?.template.title : "-"
},
{
title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "placeName", // return record?.name ? record?.name : record?.template && record?.serverPartName ? record?.serverPartName : "-"
hideInSearch: true,
width: 150,
ellipsis: true,
render: (_, record) => {
return record?.template.title ? record?.template.title : "-"
} }
}, },
// {
// title: <div style={{ textAlign: 'center' }}>站点名称</div>,
// dataIndex: "placeName",
// hideInSearch: true,
// width: 150,
// ellipsis: true,
// render: (_, record) => {
// return record?.template && record?.template.title ? record?.template.title : "-"
// }
// },
{ {
title: <div style={{ textAlign: 'center' }}></div>, title: <div style={{ textAlign: 'center' }}></div>,
dataIndex: "placeName", dataIndex: "placeName",
@ -216,7 +222,7 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
render: (_: any, record: any) => { render: (_: any, record: any) => {
let res: any = record.extend ? JSON.parse(record.extend) : "-" let res: any = record.extend ? JSON.parse(record.extend) : "-"
return <Space> return record?.type === 'district' || record?.type === 'servicePart' ? '' : <Space>
{ {
res.situation === 1 ? res.situation === 1 ?
<a onClick={ <a onClick={
@ -264,9 +270,12 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
return ( return (
<div style={{ backgroundColor: '#fff', display: 'flex' }}> <div style={{ backgroundColor: '#fff', display: 'flex' }}>
<LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} currentUser={currentUser} />
<div style={{ <div style={{
// width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)', width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
width: "100%", // width: "100%",
paddingTop: 0, paddingTop: 0,
paddingBottom: 0, paddingBottom: 0,
paddingRight: 0 paddingRight: 0
@ -279,16 +288,25 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
expandable={{ expandable={{
expandRowByClick: true expandRowByClick: true
}} }}
rowKey={(record) => {
return `${record?.id}`
}}
scroll={{ x: "100%", y: 'calc(100vh - 400px)' }} scroll={{ x: "100%", y: 'calc(100vh - 400px)' }}
headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}></span>} headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}></span>}
search={{ span: 6 }} search={{ span: 6 }}
request={async (params) => { request={async (params) => {
// selectedId
console.log('params', params); console.log('params', params);
console.log('selectedId', selectedId);
if (!(selectedId && selectedId.length > 0)) {
return
}
const req: any = { const req: any = {
serverPartIds: selectedId && selectedId.length > 0 ? selectedId : [],
startTime: params?.startTime ? `${params?.startTime}T00:00:00` : "", startTime: params?.startTime ? `${params?.startTime}T00:00:00` : "",
endTime: params?.endTime ? `${params?.endTime}T23:59:59` : "", endTime: params?.endTime ? `${params?.endTime}T23:59:59` : "",
serverPartId: params?.serverPartId ? params?.serverPartId : undefined, // serverPartId: params?.serverPartId ? params?.serverPartId : undefined,
extend: params?.inspectionType ? [{ extend: params?.inspectionType ? [{
key: "situation", key: "situation",
value: params?.inspectionType value: params?.inspectionType
@ -296,7 +314,7 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
} }
console.log('req', req); console.log('req', req);
const data = await handleGetRecordList(req) const data = await handleGetRecordTreeList(req)
console.log('data', data); console.log('data', data);
if (data && data.length > 0) { if (data && data.length > 0) {

View File

@ -10,6 +10,15 @@ export async function handleGetRecordList(params?: any) {
return [] return []
} }
// 拿到记录的树型结构
export async function handleGetRecordTreeList(params?: any) {
const data = await request.post('/questionnaire-responses/tree', params)
if (data.code === 200) {
return data.data
}
return []
}
// 删除记录 // 删除记录
export async function handleDeleteRecord(params?: any) { export async function handleDeleteRecord(params?: any) {

View File

@ -0,0 +1,26 @@
import { Modal } from "antd";
import { connect } from "umi";
type DetailProps = {
currentUser?: any // 用户详情的公参
showDrawer: boolean // 显示悬浮框的判断
parentRow?: any // 点击的行 编辑的时候有用
}
const AddBigType = ({ currentUser, showDrawer, parentRow }: DetailProps) => {
<Modal
title={parentRow?.id ? '更新菜单' : '新建菜单'}
width={600}
open={showDrawer}
onOk={() => {
}}
onCancel={() => {
}}
/>
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.data
}))(AddBigType);

View File

@ -0,0 +1,142 @@
import { ActionType, FormInstance, ProTable } from "@ant-design/pro-components";
import { Button } from "antd";
import { useRef, useState } from "react";
import { connect } from "umi";
import { handleGetMenuList } from "./service";
const menuIndex: React.FC<{ currentUser: any }> = (props) => {
const { currentUser } = props
const actionRef = useRef<ActionType>();
const formRef = useRef<FormInstance>();
// 打开新增的悬浮框
const [openAddModal, setOpenAddModal] = useState<boolean>(false)
// 显示新增和编辑的悬浮框
// 表格组件
const columns: any = [
{
title: "菜单名称",
dataIndex: "menuName",
width: 300,
hideInSearch: true,
},
{
title: "菜单图标",
dataIndex: "menuIcon",
width: 120,
hideInSearch: true,
},
{
title: "菜单索引",
dataIndex: "id",
width: 180,
hideInSearch: true,
},
{
title: '状态',
dataIndex: 'hidden',
hideInSearch: true,
width: 180,
},
{
title: '说明',
dataIndex: 'desc',
width: 200,
hideInSearch: true
},
{
title: '操作',
dataIndex: 'option',
valueType: 'option',
hideInDescriptions: true,
width: 260,
render: (_, record) => { }
}
]
// 表格子集的columns
const childrenColumns: any = [
{
title: "模块名称",
dataIndex: "menuName",
width: 300,
hideInSearch: true,
},
{
title: "模块地址",
dataIndex: "",
width: 120,
hideInSearch: true,
},
{
title: "模块索引",
dataIndex: "id",
width: 180,
hideInSearch: true,
},
{
title: '状态',
dataIndex: 'hidden',
hideInSearch: true,
width: 180,
},
{
title: '说明',
dataIndex: 'desc',
width: 200,
hideInSearch: true
},
{
title: '操作',
dataIndex: 'option',
valueType: 'option',
hideInDescriptions: true,
width: 260,
render: (_, record) => { }
}
]
return (
<div>
<ProTable
actionRef={actionRef}
formRef={formRef}
columns={columns}
bordered
expandable={{
expandRowByClick: true
}}
rowKey={(record) => {
return `${record?.id}`
}}
scroll={{ x: "100%", y: 'calc(100vh - 400px)' }}
headerTitle={<span style={{ color: "#1890ff", fontSize: 14, fontWeight: 600 }}></span>}
request={async (params) => {
const req: any = {
}
const data = await handleGetMenuList()
console.log('data', data);
if (data && data.length > 0) {
return { data, success: true }
}
return { data: [], success: true }
}}
toolbar={{
actions: [
<Button type="primary" onClick={(e) => {
setOpenAddModal(true)
}}>
</Button>
]
}}
/>
</div>
)
}
export default connect(({ user }: ConnectState) => ({
currentUser: user.data
}))(menuIndex);

View File

@ -0,0 +1,10 @@
import request from "@/utils/request"
// 拿到类别列表接口
export async function handleGetMenuList(params?: any) {
const data = await request.get('/menus/getAll', { params })
if (data.code === 200) {
return data.data
}
return []
}

View File

@ -12,7 +12,9 @@ const { UMI_APP_BASEURL } = process.env;
// const instance = axios.create({ baseURL: 'http://home.robot-z.cn:7001/' }); // const instance = axios.create({ baseURL: 'http://home.robot-z.cn:7001/' });
// 修改baseURL为完整的API地址确保在生产环境中正确访问 // 修改baseURL为完整的API地址确保在生产环境中正确访问
const instance = axios.create({ baseURL: 'https://es.robot-z.cn' }); // const instance = axios.create({ baseURL: 'https://es.robot-z.cn' });
const instance = axios.create({ baseURL: 'https://es.eshangtech.com' });