fix(amap):core

This commit is contained in:
wang_yp 2024-10-11 01:38:29 +08:00
parent cb83c20702
commit bc690dfcc4
13 changed files with 500 additions and 106 deletions

View File

@ -22,6 +22,7 @@ export interface UserDataType {
status: any;
identity: string;
archives_category_identity:string;
supplies_status:number
}
export interface TagDataType {

View File

@ -5,71 +5,84 @@ import { OrgChartNodeDataType } from "@/components/org";
const OrgChartSelf = () => {
const data: OrgChartNodeDataType = {
key: 0,
label: "科技有限公司",
label: "黄水武装",
children: [
{
key: 1,
label: "研发部",
label: "武装部长",
children: [
{ key: 11, label: "开发-前端" },
{ key: 12, label: "开发-后端" },
{ key: 13, label: "UI设计" },
{ key: 14, label: "产品经理" ,},
{
key: 11,
label: "文物社区支部",
children: [
{
key: 21,
label: "wangpeng",
},
{
key: 22,
label: "wangpeng1",
},
],
},
{
key: 12,
label: "花龙村支部",
children: [
{
key: 22,
label: "一组",
},
{
key: 24,
label: "二组",
children: [
{
key: 23,
label: "王鹏",
},
{
key: 29,
label: "王鹏1",
},
]
},
],
},
{ key: 13, label: "云华社区支部", children: [
{
key: 26,
label: "一组",
},
{
key: 28,
label: "二组",
},
],},
],
},
{
key: 2,
label: "销售部",
children: [
{ key: 21, label: "销售一部" },
{ key: 22, label: "销售二部" },
],
label: "教导员",
children: [],
},
{ key: 3, label: "财务部" },
{ key: 4, label: "人事部" },
],
};
return (
<>
<OrgChart data={data} direction={"horizontal"}/>
<OrgChart
data={data}
direction={"horizontal"}
renderNode={(e) => {
return <div style={{textAlign:"center"}}>
<img width={70} height={70} src="https://ww3.sinaimg.cn/mw690/006i0nC8ly1hpzqtw0eibj31o01o0kd2.jpg" alt="" />
<span style={{ color: "#fff",display:"block" }}>{e.label}</span>
</div>
}}
/>
</>
);
};
export default OrgChartSelf;
// import React from 'react';
// import OrgChart, {
// OrgChartProps,
// } from '@twp0217/react-org-chart';
// import OrgChartNodeDataType from '@twp0217/react-org-chart';
// export default () => {
// const data: OrgChartNodeDataType = require('./data.json');
// const [direction, setDirection] =
// React.useState<OrgChartProps['direction']>('horizontal');
// return (
// <div>
// <div>
// <button
// style={{ color: direction === 'horizontal' ? 'blue' : null }}
// onClick={() => setDirection('horizontal')}
// >
// horizontal
// </button>
// <button
// style={{ color: direction === 'vertical' ? 'blue' : null }}
// onClick={() => setDirection('vertical')}
// >
// vertical
// </button>
// </div>
// <OrgChart data={data} direction={direction} />
// </div>
// );
// };

View File

@ -7,8 +7,8 @@ import { useEffect, useState } from "react";
import { Store } from "antd/lib/form/interface";
import SimpleForm from "@/components/form/simple_form";
import React from "react";
import { columns, defaultConfig } from "./archivesCat_clumn";
import { columns, defaultConfigCat } from "./archivesCat_clumn";
const ArchivesCat = (props: Store) => {
const { acStore } = props;
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
@ -17,7 +17,7 @@ const ArchivesCat = (props: Store) => {
const [record, setRecord] = useState<any>(null);
useEffect(() => {
acStore.getlist();
setProjectConfig(defaultConfig);
setProjectConfig(defaultConfigCat);
}, [acStore]);
const column_widget = (any, record) => {
return (
@ -63,7 +63,7 @@ const ArchivesCat = (props: Store) => {
};
const handleAdd = () => {
setRecord(null);
setProjectConfig(defaultConfig);
setProjectConfig(defaultConfigCat);
setIsModalOpen(true);
};
const onFinishFailed = () => {};
@ -90,7 +90,7 @@ const ArchivesCat = (props: Store) => {
/>
<Modal
title={!record?.id ? "添加档案类别" : "编辑档案类别"}
width={600}
width={700}
open={isModalOpen}
afterClose={() => formRef.current?.resetFields()}
onOk={() => formRef.current?.submit()}

View File

@ -19,6 +19,21 @@ export const columns_ac: ColumnsType<UserDataType> = [
},
];
export const defaultConfigCat = [
{
type: FormType.input,
label: "档案类别名称",
name: "category_name",
value: "",
rules: [{ required: true, message: "请输入档案类别名称!" }],
},
{
type: FormType.input,
label: "档案描述",
name: "category_desc",
value: "",
},
];
export const defaultConfig = [
{
@ -42,6 +57,3 @@ export const defaultConfig = [
value: [],
},
];

View File

@ -41,9 +41,9 @@ const Emergency = (props: Store) => {
dataIndex: "status",
render: (status) =>
status === 0 ? (
<span style={{ color: "green" }}></span>
<span style={{ color: "black" }}></span>
) : (
<span style={{ color: "red" }}></span>
<span style={{ color: "green" }}></span>
),
},
{
@ -60,15 +60,17 @@ const Emergency = (props: Store) => {
>
</Button>
<Button
{
record.status === 0 ? <Button
type="dashed"
size="small"
onClick={() => {
emergencyStore.deleteItem(record.id);
emergencyStore.fish(record.identity);
}}
>
</Button>
</Button>:null
}
<Button
type="dashed"
danger
@ -80,6 +82,16 @@ const Emergency = (props: Store) => {
</Button>
<TaskArchives taskId={record?.identity} category_identity={record.archives_category_identity}/>
<Button
type="dashed"
size="small"
onClick={() => {
// trainingStore.id = record?.identity;
// setIsModalOpenUser(true);
}}
>
</Button>
</Space>
),
},

View File

@ -7,13 +7,34 @@ import HomeBottom from "@/pages/home/homeBottom/home_bottom";
import image2 from "@/static/title_line@1x.png";
import { SettingOutlined } from "@ant-design/icons";
import { useNavigate } from "react-router";
import { useEffect, useState } from "react";
const Home = observer(() => {
const navigate = useNavigate();
const [times, setTimes] = useState<any>();
const updateTime = () => {
const date = new Date();
const month = (date.getMonth() + 1).toString().padStart(2, "0");
const strDate = date.getDate().toString().padStart(2, "0");
const starHours = date.getHours().toString().padStart(2, "0");
const starMinutes = date.getMinutes().toString().padStart(2, "0");
const starSeconds = date.getSeconds().toString().padStart(2, "0");
const format = `${date.getFullYear()}-${month}-${strDate}
${starHours}:${starMinutes}:${starSeconds}`;
setTimes(format);
};
// 每秒钟更新一次时间
useEffect(() => {
let tim = setInterval(updateTime, 1000);
return () => {
clearInterval(tim);
};
}, []);
return (
<div className="contents_center">
<div className="map_container_t">
<div className="map_container_t_l">
<span>20241020 </span>
<span>{times} </span>
</div>
<div className="map_container_t_c">
<img className="twp on_to" src={image2} alt="" />
@ -30,14 +51,14 @@ const Home = observer(() => {
</div>
</div>
<div className="scr">
<div className="scrolling-text">
<span>
32,
41,
23,
</span>
</div>
<div className="scrolling-text">
<span>
32,
41,
23,
</span>
</div>
</div>
<div className="map_container_l">
<HomeLeft />
</div>

View File

@ -0,0 +1,8 @@
.kanban-item {
height: 240px;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid;
}

View File

@ -0,0 +1,276 @@
import Col from "antd/es/col";
import { Row } from "antd/lib/grid";
import * as echarts from "echarts";
import "./kanban.less";
import { useEffect } from "react";
const KanBan = () => {
const initChart = () => {
var myChart = echarts.init(document.getElementById("yibiaopan"));
var option = {
series: [
{
type: "gauge",
center: ["40%", "70%"],
startAngle: 200,
endAngle: -20,
min: 0,
max: 30,
splitNumber: 12,
itemStyle: {
color: "#FFAB91",
},
progress: {
show: true,
width: 20,
},
pointer: {
show: false,
},
axisLine: {
lineStyle: {
width: 15,
},
},
axisTick: {
distance: -45,
splitNumber: 5,
lineStyle: {
width: 2,
color: "#999",
},
},
splitLine: {
distance: -42,
length: 14,
lineStyle: {
width: 3,
color: "#999",
},
},
axisLabel: {
distance: -20,
color: "#999",
fontSize: 20,
},
anchor: {
show: false,
},
title: {
show: false,
},
detail: {
valueAnimation: true,
width: "40%",
lineHeight: 40,
borderRadius: 8,
offsetCenter: [0, "-10%"],
fontSize: 20,
fontWeight: "bolder",
formatter: "{value} °C",
color: "inherit",
},
data: [
{
value: 20,
},
],
},
{
type: "gauge",
center: ["40%", "70%"],
startAngle: 200,
endAngle: -20,
min: 0,
max: 60,
itemStyle: {
color: "#FD7347",
},
progress: {
show: true,
width: 8,
},
pointer: {
show: false,
},
axisLine: {
show: false,
},
axisTick: {
show: false,
},
splitLine: {
show: false,
},
axisLabel: {
show: false,
},
detail: {
show: false,
},
data: [
{
value: 20,
},
],
},
],
};
option && myChart.setOption(option);
};
const sourece = (id: string) => {
var myChart = echarts.init(document.getElementById(id));
var option = {
legend: {
top: "bottom",
show: false,
},
series: [
{
type: "pie",
radius: [40, 80],
center: ["50%", "50%"],
itemStyle: {
borderRadius: 2,
},
data: [
{ value: 40, name: "第三方" },
{ value: 18, name: "购买" },
{ value: 18, name: "自有" },
],
},
],
};
option && myChart.setOption(option);
};
const gailan = () => {
var myChart = echarts.init(document.getElementById("gailan"));
var option = {
xAxis: {
type: "category",
data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
axisLabel: {
show: true,
interval: 0,
rotate: 30,
},
},
grid: { top: "10%", bottom: "15%", right: "5%" },
yAxis: {
type: "value",
splitLine: {
show: false, // 去除网格线
},
},
series: [
{
data: [820, 932, 901, 934, 1290, 1330, 1320],
type: "line",
smooth: true,
areaStyle: {
opacity: 0.1,
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: "rgb(128, 255, 165)",
},
{
offset: 1,
color: "rgb(1, 191, 236)",
},
]),
},
},
],
};
option && myChart.setOption(option);
};
useEffect(() => {
initChart();
sourece("sourece");
sourece("yujing");
sourece("baozhiqi");
sourece("level");
gailan();
}, []);
return (
<>
<Row style={{ margin: "10px" }}>
<Col className="gutter-row" span={6}>
<div
className="kanban-item"
style={{ backgroundColor: "rgba(37, 52, 70, 0.4)" }}
>
<div>
<p
style={{
backgroundColor: "#29ecb4",
width: "100%",
padding: "10px",
}}
>
</p>
<p
style={{
fontSize: "30px",
margin: "0px",
fontWeight: "800",
color: "#29ecb4",
}}
>
109
</p>
<p style={{ color: "#29ecb4" }}>2024 / 12 / 12 09:10</p>
</div>
</div>
<div className="kanban-item" style={{ margin: "10px 0px" }}>
<div>
<div
id="yibiaopan"
style={{ width: "240px", height: "240px" }}
></div>
</div>
</div>
<div className="kanban-item">
<div>
<div
id="sourece"
style={{ width: "240px", height: "240px" }}
></div>
</div>
</div>
</Col>
<Col className="gutter-row" span={12}>
<div className="kanban-item">
<div></div>
</div>
<div className="kanban-item" style={{ margin: "10px 0px" }}>
<div></div>
</div>
<div className="kanban-item">
<div id="gailan" style={{ width: "100%", height: "240px" }}></div>
</div>
</Col>
<Col className="gutter-row" span={6}>
<div className="kanban-item">
<div id="yujing" style={{ width: "240px", height: "240px" }}></div>
</div>
<div className="kanban-item" style={{ margin: "10px 0px" }}>
<div
id="baozhiqi"
style={{ width: "240px", height: "240px" }}
></div>
</div>
<div className="kanban-item">
<div id="level" style={{ width: "240px", height: "240px" }}></div>
</div>
</Col>
</Row>
</>
);
};
export default KanBan;

View File

@ -1,29 +1,31 @@
import { Modal } from "antd";
import { Store } from "antd/es/form/interface";
import * as echarts from "echarts";
import { inject, observer } from "mobx-react";
import { useEffect } from "react";
import { useEffect, useState } from "react";
import KanBan from "./kanban";
const Wz = (props: Store) => {
const { homeStore } = props;
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
const initChart = (data) => {
var myChart = echarts.init(document.getElementById("wz"));
var option = {
legend: {
top: '5%',
right: 'right',
textStyle :{
color: "#fff"
},
formatter: function (name) {
top: "5%",
right: "right",
textStyle: {
color: "#fff",
},
formatter: function (name) {
let v;
data.forEach((item) => {
if (item.name === name) {
v = item.value;
}
});
return name + '-' + v;
return name + "-" + v;
},
},
series: [
{
@ -38,7 +40,7 @@ const Wz = (props: Store) => {
show: true,
borderRadius: 4,
},
data
data,
},
],
};
@ -47,10 +49,24 @@ const Wz = (props: Store) => {
useEffect(() => {
homeStore.getMm().then((res) => {
initChart(res.data?.record);
})
});
}, [homeStore]);
return <div style={{ width: "100%", height: "100%" }} id="wz"></div>;
return <>
<div onClick={() => {setIsModalOpen(true)}} style={{ width: "100%", height: "100%" }} id="wz"></div>;
<Modal
title="物资看板"
className="owner_model"
width={"80%"}
open={isModalOpen}
afterClose={() => {}}
onOk={() => {}}
footer={null}
onCancel={() => {
setIsModalOpen(false);
}}
>
<KanBan />
</Modal>
</>
};
export default inject("homeStore")(observer(Wz));
// export default Wz;
export default inject("homeStore")(observer(Wz));

View File

@ -33,6 +33,5 @@ export const defaultConfig = [
label: "分类描述",
name: "desc",
value: "",
rules: [{ required: true, message: "请输入仓库位置信息!" }],
},
];

View File

@ -39,16 +39,20 @@ const Trainings = (props: Store) => {
const [data, setData] = useState<SelectProps["options"]>([]);
const columns: ColumnsType<UserDataType> = [
{ title: "任务标题", dataIndex: "title" },
{ title: "任务描述", dataIndex: "desc" },
{ title: "任务地点", dataIndex: "address" },
{ title: "任务开始时间", dataIndex: "start_time" },
{ title: "任务结束时间", dataIndex: "end_time" },
{ title: "任务积分设置", dataIndex: "score" },
{ title: "任务类别", dataIndex: "category_name" },
{ title: "任务标题", dataIndex: "title" ,width:200},
{ title: "任务描述", dataIndex: "desc" ,width:200},
{ title: "任务地点", dataIndex: "address" ,width:200},
{ title: "任务开始时间", dataIndex: "start_time" ,width:200},
{ title: "任务结束时间", dataIndex: "end_time" ,width:200},
{ title: "任务积分设置", dataIndex: "score" ,width:200},
{ title: "任务类别", dataIndex: "category_name",width:200 },
{ title: "任务状态", dataIndex: "status",render: (status) => status===1?"已完成":"未完成",width:200},
{ title: "物资归还状态",width:200, dataIndex: "supplies_status",render: (supplies_status) => supplies_status===2?"已归还":"未归还"},
{
title: "操作",
dataIndex: "id",
width:200,
fixed:"right",
render: (any, record) => (
<Space wrap>
<Button
@ -60,6 +64,17 @@ const Trainings = (props: Store) => {
>
</Button>
{
record.status===0 ?<Button
type="dashed"
size="small"
onClick={() => {
trainingStore.fish(record.identity);
}}
>
</Button>:null
}
<Button
type="dashed"
danger
@ -80,17 +95,22 @@ const Trainings = (props: Store) => {
>
</Button>
<TaskArchives taskId={record?.identity} category_identity={record.archives_category_identity}/>
<Button
<TaskArchives
taskId={record?.identity}
category_identity={record.archives_category_identity}
/>
{
record.supplies_status===1 ?<Button
type="dashed"
size="small"
onClick={() => {
trainingStore.id = record?.identity;
setIsModalOpenUser(true);
trainingStore.back(record?.identity);
}}
>
</Button>
</Button>:null
}
</Space>
),
},
@ -120,6 +140,8 @@ const Trainings = (props: Store) => {
setRecord(data);
setId(record.id);
};
useEffect(() => {
trainingStore.getlist();
}, [trainingStore]);
@ -319,7 +341,4 @@ const Trainings = (props: Store) => {
);
};
export default inject(
"trainingStore",
"trainingCatStore",
)(observer(Trainings));
export default inject("trainingStore", "trainingCatStore")(observer(Trainings));

View File

@ -11,6 +11,8 @@ class EmergencyConfig {
static DELETE: string = "emerg"
static EDIT: string = "emerg"
static ACCESS: string = "emerg/accept"
static fish: string = "emerg/fish"
}
class EmergencyStore extends BaseStore<TagDataType> {
constructor() {
@ -23,6 +25,10 @@ class EmergencyStore extends BaseStore<TagDataType> {
await baseHttp.put(EmergencyConfig.ACCESS + "/" + id, param)
this.getlist()
}
async fish(id: string) {
await baseHttp.put(EmergencyConfig.fish + "/" + id, {})
this.getlist()
}
}
export const emergencyStore = new EmergencyStore()

View File

@ -13,7 +13,8 @@ class TrainingConfig {
static tran_user: string = "training/user"
static addScores: string = "scoreMgmt/scores"
static addAchives: string = "training/archives"
static back: string = "supplies/suppliesBack"
static fish: string = "training/taskFish"
}
class TrainingStore extends BaseStore<TagDataType> {
constructor() {
@ -24,11 +25,12 @@ class TrainingStore extends BaseStore<TagDataType> {
userList: observable,
getUserListByTraning: action,
setUserScore: action,
fish:action,
})
}
async setUserScore(ids: Array<any>) {
let res= await baseHttp.post(TrainingConfig.addScores, {"list": ids})
if (res.data==="ok"){
let res = await baseHttp.post(TrainingConfig.addScores, { "list": ids })
if (res.data === "ok") {
this.getUserListByTraning();
return true
}
@ -37,10 +39,19 @@ class TrainingStore extends BaseStore<TagDataType> {
await baseHttp.put(TrainingConfig.ACCESS + "/" + id, param)
this.getlist()
}
async fish(id: string) {
await baseHttp.put(TrainingConfig.fish + "/" + id, {})
this.getlist()
}
// 添加档案到培训
async addAcieves(param: any) {
return await baseHttp.post(TrainingConfig.addAchives, param)
}
// 添加档案到培训
async back(id: string) {
return await baseHttp.put(TrainingConfig.back + "/" + id, {task_type:2})
}
async getUserListByTraning() {
let res = await baseHttp.get(TrainingConfig.tran_user + "/" + this.id, null)
let data: Array<any> = []