From bc690dfcc4f8cfbebf7a0d3ef311965ada48c78c Mon Sep 17 00:00:00 2001 From: wang_yp <357754663@qq.com> Date: Fri, 11 Oct 2024 01:38:29 +0800 Subject: [PATCH] fix(amap):core --- src/model/userModel.ts | 1 + src/pages/OrgChart.tsx | 111 +++++---- src/pages/archives/archivesCat.tsx | 10 +- src/pages/archives/archivesCat_clumn.tsx | 18 +- src/pages/emergency/index.tsx | 22 +- src/pages/home/home.tsx | 37 ++- src/pages/home/homeRigrt/kanban.less | 8 + src/pages/home/homeRigrt/kanban.tsx | 276 +++++++++++++++++++++++ src/pages/home/homeRigrt/wz.tsx | 48 ++-- src/pages/materialMgmt/mcat_column.tsx | 1 - src/pages/training/training.tsx | 51 +++-- src/store/emergency.ts | 6 + src/store/training.ts | 17 +- 13 files changed, 500 insertions(+), 106 deletions(-) create mode 100644 src/pages/home/homeRigrt/kanban.less create mode 100644 src/pages/home/homeRigrt/kanban.tsx diff --git a/src/model/userModel.ts b/src/model/userModel.ts index c2283d9..ca9716c 100644 --- a/src/model/userModel.ts +++ b/src/model/userModel.ts @@ -22,6 +22,7 @@ export interface UserDataType { status: any; identity: string; archives_category_identity:string; + supplies_status:number } export interface TagDataType { diff --git a/src/pages/OrgChart.tsx b/src/pages/OrgChart.tsx index 8ee9bce..7b8af1f 100644 --- a/src/pages/OrgChart.tsx +++ b/src/pages/OrgChart.tsx @@ -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 ( <> - + { + return
+ + {e.label} +
+ }} + /> ); }; 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('horizontal'); - -// return ( -//
-//
-// -// -//
-// -//
-// ); -// }; diff --git a/src/pages/archives/archivesCat.tsx b/src/pages/archives/archivesCat.tsx index d07a321..d9e35f6 100644 --- a/src/pages/archives/archivesCat.tsx +++ b/src/pages/archives/archivesCat.tsx @@ -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(false); @@ -17,7 +17,7 @@ const ArchivesCat = (props: Store) => { const [record, setRecord] = useState(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) => { /> formRef.current?.resetFields()} onOk={() => formRef.current?.submit()} diff --git a/src/pages/archives/archivesCat_clumn.tsx b/src/pages/archives/archivesCat_clumn.tsx index a52f220..6673e9d 100644 --- a/src/pages/archives/archivesCat_clumn.tsx +++ b/src/pages/archives/archivesCat_clumn.tsx @@ -19,6 +19,21 @@ export const columns_ac: ColumnsType = [ }, ]; +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: [], }, ]; - - - \ No newline at end of file diff --git a/src/pages/emergency/index.tsx b/src/pages/emergency/index.tsx index 2700a8b..aa7f840 100644 --- a/src/pages/emergency/index.tsx +++ b/src/pages/emergency/index.tsx @@ -41,9 +41,9 @@ const Emergency = (props: Store) => { dataIndex: "status", render: (status) => status === 0 ? ( - 进行中 + 进行中 ) : ( - 已完成 + 已完成 ), }, { @@ -60,15 +60,17 @@ const Emergency = (props: Store) => { > 编辑 - + :null + } + ), }, diff --git a/src/pages/home/home.tsx b/src/pages/home/home.tsx index 7a04b08..0b88e9e 100644 --- a/src/pages/home/home.tsx +++ b/src/pages/home/home.tsx @@ -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(); + 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 (
- 2024年10月20号 + {times}
@@ -30,14 +51,14 @@ const Home = observer(() => {
-
- - 仓库3,2号货架,单兵装备,即将临期, - 仓库4,1号货架,单兵装备,即将临期, - 仓库2,3号货架,单兵装备,即将临期 - -
+
+ + 仓库3,2号货架,单兵装备,即将临期, + 仓库4,1号货架,单兵装备,即将临期, + 仓库2,3号货架,单兵装备,即将临期 +
+
diff --git a/src/pages/home/homeRigrt/kanban.less b/src/pages/home/homeRigrt/kanban.less new file mode 100644 index 0000000..260a9d8 --- /dev/null +++ b/src/pages/home/homeRigrt/kanban.less @@ -0,0 +1,8 @@ +.kanban-item { + height: 240px; + color: #fff; + display: flex; + align-items: center; + justify-content: center; + border: 1px solid; +} diff --git a/src/pages/home/homeRigrt/kanban.tsx b/src/pages/home/homeRigrt/kanban.tsx new file mode 100644 index 0000000..7939d7b --- /dev/null +++ b/src/pages/home/homeRigrt/kanban.tsx @@ -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 ( + <> + + +
+
+

+ 安全运行天数 +

+

+ 109 +

+

2024 / 12 / 12 星期四 09:10

+
+
+
+
+
+
+
+
+
+
+
+
+ + + +
+
暂无视频
+
+
+
暂无视频
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+ +
+ + ); +}; + +export default KanBan; diff --git a/src/pages/home/homeRigrt/wz.tsx b/src/pages/home/homeRigrt/wz.tsx index 8c94739..2f227fe 100644 --- a/src/pages/home/homeRigrt/wz.tsx +++ b/src/pages/home/homeRigrt/wz.tsx @@ -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(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
; + return <> +
{setIsModalOpen(true)}} style={{ width: "100%", height: "100%" }} id="wz">
; + {}} + onOk={() => {}} + footer={null} + onCancel={() => { + setIsModalOpen(false); + }} + > + + + }; -export default inject("homeStore")(observer(Wz)); -// export default Wz; +export default inject("homeStore")(observer(Wz)); \ No newline at end of file diff --git a/src/pages/materialMgmt/mcat_column.tsx b/src/pages/materialMgmt/mcat_column.tsx index e8d7d3a..33f9240 100644 --- a/src/pages/materialMgmt/mcat_column.tsx +++ b/src/pages/materialMgmt/mcat_column.tsx @@ -33,6 +33,5 @@ export const defaultConfig = [ label: "分类描述", name: "desc", value: "", - rules: [{ required: true, message: "请输入仓库位置信息!" }], }, ]; diff --git a/src/pages/training/training.tsx b/src/pages/training/training.tsx index 91a7257..e1baede 100644 --- a/src/pages/training/training.tsx +++ b/src/pages/training/training.tsx @@ -39,16 +39,20 @@ const Trainings = (props: Store) => { const [data, setData] = useState([]); const columns: ColumnsType = [ - { 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) => ( + { + record.status===0 ?:null + } - - + :null + } + ), }, @@ -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)); diff --git a/src/store/emergency.ts b/src/store/emergency.ts index 7c9f22a..ee9248b 100644 --- a/src/store/emergency.ts +++ b/src/store/emergency.ts @@ -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 { constructor() { @@ -23,6 +25,10 @@ class EmergencyStore extends BaseStore { 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() diff --git a/src/store/training.ts b/src/store/training.ts index 0d61648..b7b9f08 100644 --- a/src/store/training.ts +++ b/src/store/training.ts @@ -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 { constructor() { @@ -24,11 +25,12 @@ class TrainingStore extends BaseStore { userList: observable, getUserListByTraning: action, setUserScore: action, + fish:action, }) } async setUserScore(ids: Array) { - 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 { 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 = []