From af787ba1af994e981526c7a2a825c9655e53afb2 Mon Sep 17 00:00:00 2001 From: wang_yp <357754663@qq.com> Date: Thu, 20 Feb 2025 10:04:23 +0800 Subject: [PATCH] first commit --- git.sh | 19 +------ src/pages/source/source.tsx | 89 +++++++----------------------- src/pages/source/source_config.tsx | 13 ----- src/service/source_config.ts | 4 +- src/store/source.ts | 29 +++++++++- 5 files changed, 52 insertions(+), 102 deletions(-) diff --git a/git.sh b/git.sh index 5600fc3..a1c1f60 100644 --- a/git.sh +++ b/git.sh @@ -12,21 +12,4 @@ git push # scp -r ./card/ root@81.68.81.205:/mnt/www/html/shouka -# rm -rf card/ - -# task -# pc -# 1、首页统计 -# 1、组织架构,组织架构图 -# 2、武装力量 报表 -# 3、年度训练 查看档案 -# 4、物资管理 处突 -# 5、档案管理 报表 -# 6、评优 -# 7 -# 2、物资借用以及归还 -# 3、任务关联档案 -# app -# 1、退伍军人 列表 详情 申请领取光荣牌 -# 2、接收任务 -# 3、任务列表 \ No newline at end of file +# rm -rf card/ \ No newline at end of file diff --git a/src/pages/source/source.tsx b/src/pages/source/source.tsx index 731f8c6..87763e8 100644 --- a/src/pages/source/source.tsx +++ b/src/pages/source/source.tsx @@ -1,96 +1,47 @@ import React, { useEffect, useState } from "react"; -import { Button, Space, Modal, FormInstance } from "antd"; +import { Space } from "antd"; import { Store } from "antd/lib/form/interface"; import { inject, observer } from "mobx-react"; import BTable from "@/components/b_table"; -import SimpleForm from "@/components/form/simple_form"; -import { columns, defaultConfig } from "./source_config"; import "./source.less"; -import { base as baseHttp } from '@/service/base'; - const Source = (props: Store) => { const { sourceStore } = props; - const [isModalOpen, setIsModalOpen] = useState(false); - const formRef = React.useRef(null); - const [userId, setId] = useState(null); - const [record, setRecord] = useState(null); - + const [coloums,setColumns] = useState([]) + const [content,setContent] = useState([]) // 获取列表数据 useEffect(() => { - sourceStore.getlist(); + sourceStore.getHead().then((res)=>{ + res.forEach(element => { + element.dataIndex = "dbs_"+element.identity.toLowerCase() + element.title = element.data_name + }); + setColumns(res) + }); + sourceStore.geContent().then((res)=>{ + res.forEach(element => { + element.key = "dbs_"+element.identity + }); + setContent(res) + }); }, [sourceStore]); - const gotoDetail = () => {}; - const upload = (f,e) => { - let param = new FormData(); - param.append("file", f.target.files[0]); - param.append("identity", e.identity); - baseHttp.upload("public/fts/upload",param) - }; + return (
- { sourceStore.deleteItem(id); }} actionCloumn={(e)=>{ - return <> - - { - upload(f,e) - }} - /> - + }} editCallback={(record) => { - setIsModalOpen(true); - formRef.current?.setFieldsValue(record); - setRecord(record); - setId(record.id); }} /> - - formRef.current?.resetFields()} - onOk={() => formRef.current?.submit()} - okText="确定" - cancelText="取消" - onCancel={() => { - setId(null); - setRecord(null); - setIsModalOpen(false); - }} - > - { - sourceStore.add(formRef.current?.getFieldsValue()); - setIsModalOpen(false); - }} - createCallback={() => { - formRef.current?.setFieldsValue(record); - }} - formDatas={defaultConfig as any} - > -
); diff --git a/src/pages/source/source_config.tsx b/src/pages/source/source_config.tsx index 6726ddd..1ad6646 100644 --- a/src/pages/source/source_config.tsx +++ b/src/pages/source/source_config.tsx @@ -19,17 +19,4 @@ export const columns: ColumnsType = [ dataIndex: "resource_name", width: 200, }, - { - title: "上传用户", - dataIndex: "user_name", - width: 200, - }, - { - title: "上传时间", - dataIndex: "created_at", - width: 200, - render: (created_at) => ( - {dayjs(created_at).format("YYYY-MM-DD")} - ), - }, ]; diff --git a/src/service/source_config.ts b/src/service/source_config.ts index a095836..c9fcf6c 100644 --- a/src/service/source_config.ts +++ b/src/service/source_config.ts @@ -1,8 +1,10 @@ class SourceConfig { static ADD: string = "/desc"; static EDIT: string = "/desc"; - static LIST: string = "/desc/list"; + static LIST: string = "/desc/content"; static DELETE: string = "/desc"; + static Headers: string = "/desc/header"; + static Content: string = "/desc/content"; } export default SourceConfig; \ No newline at end of file diff --git a/src/store/source.ts b/src/store/source.ts index dd5b877..7fd9362 100644 --- a/src/store/source.ts +++ b/src/store/source.ts @@ -1,14 +1,41 @@ -import { makeObservable } from "mobx"; +import { action, makeObservable, observable } from "mobx"; import BaseStore from "./baseStore"; import { UserDataType } from "@/model/userModel"; import SourceConfig from "@/service/source_config"; +import { base } from "@/service/base"; +import { message } from "antd"; class SourceStore extends BaseStore { + headlist =[] + contentList =[] constructor() { super(SourceConfig) makeObservable(this, { + getHead:action, + + headlist:observable, + contentList:observable }) } + async getHead(){ + let res = await base.get(SourceConfig.Headers, {}) + if (res.code !== 200) { + message.error(res.msg) + return false + } + this.headlist = res.data.record; + return res.data.record; + } + + async geContent(){ + let res = await base.get(SourceConfig.Content, {}) + if (res.code !== 0) { + message.error(res.msg) + return false + } + this.contentList = res.data; + return res.data; + } } const sourceStore = new SourceStore(); export default sourceStore; \ No newline at end of file