💥 feat(模块): 添加了个很棒的功能
This commit is contained in:
parent
f4d966168e
commit
c6da1f9557
@ -46,8 +46,19 @@ export default [
|
||||
component: "@/pages/examine/record/index",
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
{
|
||||
path: "/setting",
|
||||
redirect: '',
|
||||
name: '系统设置',
|
||||
routes: [
|
||||
{
|
||||
path: '/setting/menu',
|
||||
name: '菜单管理',
|
||||
component: "@/pages/setting/menu/index",
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
height: 30.9px;
|
||||
}
|
||||
.username{
|
||||
color: #fff;
|
||||
color: #000;
|
||||
}
|
||||
&:hover {
|
||||
// background: #252a3d;
|
||||
|
||||
@ -1,14 +1,18 @@
|
||||
|
||||
import type { FC } from 'react';
|
||||
import { connect } from 'umi';
|
||||
import { Dropdown, Space } from 'antd';
|
||||
import { LogoutOutlined } from '@ant-design/icons';
|
||||
import type { UserConnectedProps } from '@/models/user';
|
||||
import './index.less';
|
||||
import IconFont from '../IconFont';
|
||||
|
||||
const Avatar: FC<UserConnectedProps> = (props) => {
|
||||
const {
|
||||
user: { data }, dispatch,
|
||||
} = props;
|
||||
console.log('user32323', data);
|
||||
|
||||
|
||||
const handleLogout = () => {
|
||||
dispatch?.({
|
||||
@ -41,12 +45,16 @@ const Avatar: FC<UserConnectedProps> = (props) => {
|
||||
menu={{ items }}
|
||||
>
|
||||
<Space className="avatar-container">
|
||||
<img
|
||||
{
|
||||
data.avatarUrl ? <img
|
||||
alt="avatar"
|
||||
src={data.avatar}
|
||||
src={data.avatarUrl}
|
||||
className="avatar"
|
||||
/>
|
||||
<span className="username">{data.name}</span>
|
||||
/> :
|
||||
<IconFont name='icon-touxiang' size="36" ></IconFont>
|
||||
}
|
||||
|
||||
<span className="username">{data.adminName}</span>
|
||||
</Space>
|
||||
</Dropdown>
|
||||
);
|
||||
|
||||
21
src/components/IconFont/index.tsx
Normal file
21
src/components/IconFont/index.tsx
Normal 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;
|
||||
@ -8,7 +8,7 @@ import ProForm, { ProFormText } from "@ant-design/pro-form";
|
||||
import { Button, Col, FormInstance, Row, Tree } from "antd";
|
||||
// import { getServerpartTree } from "@/services/options";
|
||||
import useRequest from "@ahooksjs/use-request";
|
||||
import { getMerchantShopTree, getServerpartTree } from "./service";
|
||||
import { getMerchantShopTree, getServerpartTree, handleGetAllServicePart } from "./service";
|
||||
// import './style.less'
|
||||
// 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 () => {
|
||||
let data: any = []
|
||||
if (currentUser?.UserPattern === 2000) {
|
||||
data = await getMerchantShopTree({ BusinessManId: currentUser?.BusinessManID, ShowShop: false });
|
||||
// data = await getMerchantShopTree({ BusinessManId: currentUser?.BusinessManID, ShowShop: false });
|
||||
} 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);
|
||||
|
||||
@ -60,11 +70,11 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width,
|
||||
list.push(item.children[0])
|
||||
} else {
|
||||
if (haveTest) {
|
||||
if (item.value !== 424) {
|
||||
if (item.id !== 424) {
|
||||
list.push(item)
|
||||
}
|
||||
} else {
|
||||
if (item.value !== 424 && item.value !== 586) {
|
||||
if (item.id !== 424 && item.id !== 586) {
|
||||
list.push(item)
|
||||
}
|
||||
}
|
||||
@ -137,7 +147,7 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width,
|
||||
const handleFilterList = (list: any, id: any) => {
|
||||
let res: any = []
|
||||
list.forEach((item: any) => {
|
||||
if (item.value === id) {
|
||||
if (item.id === id) {
|
||||
|
||||
} else {
|
||||
res.push(item)
|
||||
@ -207,22 +217,17 @@ const LeftSelectTree = ({ setSelectedId, reload, actionRef, currentUser, width,
|
||||
>
|
||||
{treeView && treeView.length > 0 ? <Tree
|
||||
checkable
|
||||
treeData={isShowAllInTree ? [{
|
||||
label: '全部',
|
||||
value: 0,
|
||||
key: '0-0',
|
||||
children: treeView
|
||||
}] : treeView}
|
||||
treeData={treeView}
|
||||
fieldNames={{
|
||||
title: "label",
|
||||
key: "key"
|
||||
title: "name",
|
||||
key: "id"
|
||||
}}
|
||||
blockNode
|
||||
defaultExpandAll={isShowAllInTree ? false : true}
|
||||
defaultExpandedKeys={isShowAllInTree ? treeShowRow && treeShowRow.length > 0 ? treeShowRow : ['0-0'] : []}
|
||||
defaultExpandAll={isShowAllInTree ? true : false}
|
||||
defaultExpandedKeys={isShowAllInTree ? [] : [510000]}
|
||||
onCheck={(checkedKeys: React.Key[] | any, info) => {
|
||||
const selectedIds = info.checkedNodes.filter((n: any) => n?.type === 1)
|
||||
setSelectedId(selectedIds.map(n => n?.value)?.toString() || '')
|
||||
const selectedIds = info.checkedNodes.filter((n: any) => n?.districtId > 0)
|
||||
setSelectedId(selectedIds.map(n => n?.id) || '')
|
||||
if (reload) {
|
||||
actionRef?.current?.reload()
|
||||
}
|
||||
|
||||
@ -59,3 +59,14 @@ export async function handleGetServerpartDDL(params: any) {
|
||||
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 []
|
||||
}
|
||||
@ -200,6 +200,13 @@ const BasicLayout: FC<{ user: UserModelState, global: ProfileModelState, dispatc
|
||||
hideInMenu: false,
|
||||
name: "考核记录管理",
|
||||
path: "/examine/record",
|
||||
},
|
||||
{
|
||||
SYSTEMMODULE_DESC: "",
|
||||
guid: "6",
|
||||
hideInMenu: false,
|
||||
name: "菜单管理",
|
||||
path: "/setting/menu",
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@ -244,8 +244,19 @@ const UserModel: UserModelType = {
|
||||
component: "@/pages/examine/record",
|
||||
}
|
||||
]
|
||||
|
||||
},
|
||||
{
|
||||
path: "/setting",
|
||||
redirect: '',
|
||||
name: '系统设置',
|
||||
children: [
|
||||
{
|
||||
path: '/setting/menu',
|
||||
name: '菜单管理',
|
||||
component: "@/pages/setting/menu/index",
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
let indexAllMenuItemByPath: any = []
|
||||
let indexValidMenuItemByPath: any = []
|
||||
@ -278,6 +289,7 @@ const UserModel: UserModelType = {
|
||||
'/examine/modal',
|
||||
'/examine/question',
|
||||
'/examine/record',
|
||||
'/setting/menu'
|
||||
],
|
||||
rootSubmenuKeys: handleGetRootSubmenuKeys(menuRes.data),
|
||||
indexAllMenuItemById: handleGetEachDatumFromNestedDataByKey(menuRes.data, 'id'),
|
||||
|
||||
@ -14,6 +14,7 @@ const authority: PageAuthority = {
|
||||
'/examine/record': [
|
||||
'/examine/record',
|
||||
],
|
||||
'/setting/menu': ['/setting/menu']
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@ import { Button, Col, message, Modal, Popconfirm, Row, Space, Image, Drawer } fr
|
||||
import moment from "moment";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
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 QRCode from 'qrcode';
|
||||
import { base64ToFile } from "@/utils/publicMethods";
|
||||
@ -27,7 +27,7 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
||||
// 弹出框的表单实例
|
||||
const modalRef = useRef<FormInstance>()
|
||||
// 树相关的属性和方法
|
||||
const [selectedId, setSelectedId] = useState<string>()
|
||||
const [selectedId, setSelectedId] = useState<string[]>()
|
||||
const [collapsible, setCollapsible] = useState<boolean>(false)
|
||||
|
||||
// 显示新增点位的悬浮框
|
||||
@ -55,7 +55,7 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
||||
const [previewIndex, setPreviewIndex] = useState<number>(0)
|
||||
const [columnsStateMap, setColumnsStateMap] = useState<any>({
|
||||
updatedAt: { show: false },
|
||||
createdAt: { show: false },
|
||||
// createdAt: { show: false },
|
||||
operator: { show: false },
|
||||
})
|
||||
// 显示新增大类的抽屉
|
||||
@ -66,20 +66,42 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
||||
const [bigTypeList, setBigTypeList] = useState<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>,
|
||||
dataIndex: "serverPartName",
|
||||
hideInSearch: true,
|
||||
width: 150,
|
||||
ellipsis: true
|
||||
},
|
||||
{
|
||||
title: <div style={{ textAlign: 'center' }}>点位名称</div>,
|
||||
dataIndex: "title",
|
||||
hideInSearch: true,
|
||||
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>,
|
||||
dataIndex: "questions",
|
||||
@ -127,7 +149,7 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
||||
width: 100,
|
||||
ellipsis: true,
|
||||
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",
|
||||
width: 120,
|
||||
render: (_: any, record: any) => {
|
||||
return <Space>
|
||||
return record?.type === 'district' || record?.type === 'servicePart' ? '' : <Space>
|
||||
<a onClick={() => {
|
||||
console.log('record', record);
|
||||
setCurrentRow(record)
|
||||
@ -288,11 +310,11 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
||||
|
||||
return (
|
||||
<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={{
|
||||
// width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
|
||||
width: "100%",
|
||||
width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
|
||||
// width: "100%",
|
||||
paddingTop: 0,
|
||||
paddingBottom: 0,
|
||||
paddingRight: 0
|
||||
@ -305,13 +327,24 @@ const examineModal: React.FC<{ currentUser: any }> = (props) => {
|
||||
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>}
|
||||
search={{ span: 6 }}
|
||||
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) {
|
||||
return { data, success: true }
|
||||
}
|
||||
|
||||
@ -43,3 +43,12 @@ export async function handleUploadFile(params?: any) {
|
||||
const data = await request.post(`/oss/upload`, params)
|
||||
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 []
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import { Button, Col, message, Modal, Popconfirm, Row, Space } from "antd";
|
||||
import { useRef, useState } from "react";
|
||||
import { connect } from "umi";
|
||||
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 AddQuestion from "./components/addQuestion";
|
||||
|
||||
@ -227,6 +227,7 @@ const examineQuestion: React.FC<{ currentUser: any }> = (props) => {
|
||||
}}
|
||||
scroll={{ x: "100%", y: 'calc(100vh - 400px)' }}
|
||||
request={async (params) => {
|
||||
console.log('params', params);
|
||||
|
||||
// 拿到分类数据 将 问题数据 拼到对应的分类下面去
|
||||
const typeReq = {
|
||||
@ -234,6 +235,7 @@ const examineQuestion: React.FC<{ currentUser: any }> = (props) => {
|
||||
"key": ""
|
||||
}]
|
||||
}
|
||||
params?.id
|
||||
let typeData = await handleGetExamineTypeTreeList(typeReq)
|
||||
let bigType = JSON.parse(JSON.stringify(typeData))
|
||||
console.log('bigType', bigType);
|
||||
|
||||
26
src/pages/examine/record/1.js
Normal file
26
src/pages/examine/record/1.js
Normal 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 (可能会有)
|
||||
... // 实际业务内容
|
||||
}
|
||||
|
||||
]
|
||||
}]
|
||||
|
||||
|
||||
}
|
||||
@ -2,11 +2,12 @@ import { ConnectState } from "@/models/global";
|
||||
import { ActionType, FormInstance, ProTable } from "@ant-design/pro-components";
|
||||
import { useRef, useState } from "react";
|
||||
import { connect } from "umi";
|
||||
import { handleDeleteRecord, handleGetRecordList, handleUpdateExtend } from "./service";
|
||||
import { handleDeleteRecord, handleGetRecordList, handleGetRecordTreeList, handleUpdateExtend } from "./service";
|
||||
import moment from "moment";
|
||||
import { Button, Drawer, Image, message, Popconfirm, Space } from "antd";
|
||||
import { handleGetServerpartDDL } from "@/components/leftSelectTree/service";
|
||||
import RecordDetail from "./components/recordDetail";
|
||||
import LeftSelectTree from "@/components/leftSelectTree/leftSelectTree";
|
||||
|
||||
const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
||||
const { currentUser } = props
|
||||
@ -26,11 +27,12 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
||||
const [showDetail, setShowDetail] = useState<boolean>(false)
|
||||
// 判断是否点了出现的是异常处理的抽屉
|
||||
const [showAbnormal, setShowAbnormal] = useState<boolean>(false)
|
||||
// 树相关的属性和方法
|
||||
const [selectedId, setSelectedId] = useState<string[]>()
|
||||
const [columnsStateMap, setColumnsStateMap] = useState<any>({
|
||||
score: { show: false }
|
||||
})
|
||||
|
||||
|
||||
const [collapsible, setCollapsible] = useState<boolean>(false)
|
||||
|
||||
const columns: any = [
|
||||
{
|
||||
@ -52,21 +54,20 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
||||
format: 'YYYY-MM-DD',
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "服务区",
|
||||
dataIndex: "serverPartId",
|
||||
hideInTable: true,
|
||||
valueType: "select",
|
||||
request: async () => {
|
||||
const req = {
|
||||
ProvinceCode: currentUser?.provinceCode,
|
||||
StatisticsType: 1000
|
||||
}
|
||||
const data = await handleGetServerpartDDL(req)
|
||||
return data
|
||||
}
|
||||
},
|
||||
|
||||
// {
|
||||
// title: "服务区",
|
||||
// dataIndex: "serverPartId",
|
||||
// hideInTable: true,
|
||||
// valueType: "select",
|
||||
// request: async () => {
|
||||
// const req = {
|
||||
// ProvinceCode: currentUser?.provinceCode,
|
||||
// StatisticsType: 1000
|
||||
// }
|
||||
// const data = await handleGetServerpartDDL(req)
|
||||
// return data
|
||||
// }
|
||||
// },
|
||||
{
|
||||
title: "巡查类型",
|
||||
dataIndex: "inspectionType",
|
||||
@ -81,22 +82,27 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
||||
title: <div style={{ textAlign: 'center' }}>服务区名称</div>,
|
||||
dataIndex: "serverPartName",
|
||||
hideInSearch: true,
|
||||
width: 150,
|
||||
width: 200,
|
||||
ellipsis: true,
|
||||
render: (_, record) => {
|
||||
return record?.template.serverPartName ? record?.template.serverPartName : "-"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: <div style={{ textAlign: 'center' }}>站点名称</div>,
|
||||
dataIndex: "placeName",
|
||||
hideInSearch: true,
|
||||
width: 150,
|
||||
ellipsis: true,
|
||||
render: (_, record) => {
|
||||
return record?.template.title ? record?.template.title : "-"
|
||||
return record?.type === 'district' || record?.type === 'servicePart' ? record?.name :
|
||||
record?.template ? record?.template.title : "-"
|
||||
|
||||
|
||||
|
||||
// return record?.name ? record?.name : record?.template && record?.serverPartName ? record?.serverPartName : "-"
|
||||
}
|
||||
},
|
||||
// {
|
||||
// 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>,
|
||||
dataIndex: "placeName",
|
||||
@ -216,7 +222,7 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
||||
render: (_: any, record: any) => {
|
||||
let res: any = record.extend ? JSON.parse(record.extend) : "-"
|
||||
|
||||
return <Space>
|
||||
return record?.type === 'district' || record?.type === 'servicePart' ? '' : <Space>
|
||||
{
|
||||
res.situation === 1 ?
|
||||
<a onClick={
|
||||
@ -264,9 +270,12 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
||||
|
||||
return (
|
||||
<div style={{ backgroundColor: '#fff', display: 'flex' }}>
|
||||
<LeftSelectTree setSelectedId={setSelectedId} setCollapsible={setCollapsible} collapsible={collapsible} currentUser={currentUser} />
|
||||
|
||||
|
||||
<div style={{
|
||||
// width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
|
||||
width: "100%",
|
||||
width: !collapsible ? 'calc(100% - 300px)' : 'calc(100% - 60px)',
|
||||
// width: "100%",
|
||||
paddingTop: 0,
|
||||
paddingBottom: 0,
|
||||
paddingRight: 0
|
||||
@ -279,16 +288,25 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
||||
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>}
|
||||
search={{ span: 6 }}
|
||||
request={async (params) => {
|
||||
// selectedId
|
||||
console.log('params', params);
|
||||
console.log('selectedId', selectedId);
|
||||
if (!(selectedId && selectedId.length > 0)) {
|
||||
return
|
||||
}
|
||||
|
||||
const req: any = {
|
||||
serverPartIds: selectedId && selectedId.length > 0 ? selectedId : [],
|
||||
startTime: params?.startTime ? `${params?.startTime}T00:00:00` : "",
|
||||
endTime: params?.endTime ? `${params?.endTime}T23:59:59` : "",
|
||||
serverPartId: params?.serverPartId ? params?.serverPartId : undefined,
|
||||
// serverPartId: params?.serverPartId ? params?.serverPartId : undefined,
|
||||
extend: params?.inspectionType ? [{
|
||||
key: "situation",
|
||||
value: params?.inspectionType
|
||||
@ -296,7 +314,7 @@ const examineRecord: React.FC<{ currentUser: any }> = (props) => {
|
||||
|
||||
}
|
||||
console.log('req', req);
|
||||
const data = await handleGetRecordList(req)
|
||||
const data = await handleGetRecordTreeList(req)
|
||||
console.log('data', data);
|
||||
|
||||
if (data && data.length > 0) {
|
||||
|
||||
@ -10,6 +10,15 @@ export async function handleGetRecordList(params?: any) {
|
||||
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) {
|
||||
|
||||
26
src/pages/setting/menu/components/addMenu.tsx
Normal file
26
src/pages/setting/menu/components/addMenu.tsx
Normal 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);
|
||||
142
src/pages/setting/menu/index.tsx
Normal file
142
src/pages/setting/menu/index.tsx
Normal 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);
|
||||
10
src/pages/setting/menu/service.ts
Normal file
10
src/pages/setting/menu/service.ts
Normal 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 []
|
||||
}
|
||||
@ -12,7 +12,9 @@ const { UMI_APP_BASEURL } = process.env;
|
||||
|
||||
// const instance = axios.create({ baseURL: 'http://home.robot-z.cn:7001/' });
|
||||
// 修改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' });
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user