first commit
This commit is contained in:
parent
fae77a64c2
commit
af787ba1af
19
git.sh
19
git.sh
|
@ -12,21 +12,4 @@ git push
|
||||||
|
|
||||||
# scp -r ./card/ root@81.68.81.205:/mnt/www/html/shouka
|
# scp -r ./card/ root@81.68.81.205:/mnt/www/html/shouka
|
||||||
|
|
||||||
# rm -rf card/
|
# rm -rf card/
|
||||||
|
|
||||||
# task
|
|
||||||
# pc
|
|
||||||
# 1、首页统计
|
|
||||||
# 1、组织架构,组织架构图
|
|
||||||
# 2、武装力量 报表
|
|
||||||
# 3、年度训练 查看档案
|
|
||||||
# 4、物资管理 处突
|
|
||||||
# 5、档案管理 报表
|
|
||||||
# 6、评优
|
|
||||||
# 7
|
|
||||||
# 2、物资借用以及归还
|
|
||||||
# 3、任务关联档案
|
|
||||||
# app
|
|
||||||
# 1、退伍军人 列表 详情 申请领取光荣牌
|
|
||||||
# 2、接收任务
|
|
||||||
# 3、任务列表
|
|
|
@ -1,96 +1,47 @@
|
||||||
import React, { useEffect, useState } from "react";
|
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 { Store } from "antd/lib/form/interface";
|
||||||
import { inject, observer } from "mobx-react";
|
import { inject, observer } from "mobx-react";
|
||||||
import BTable from "@/components/b_table";
|
import BTable from "@/components/b_table";
|
||||||
import SimpleForm from "@/components/form/simple_form";
|
|
||||||
import { columns, defaultConfig } from "./source_config";
|
|
||||||
import "./source.less";
|
import "./source.less";
|
||||||
import { base as baseHttp } from '@/service/base';
|
|
||||||
|
|
||||||
const Source = (props: Store) => {
|
const Source = (props: Store) => {
|
||||||
const { sourceStore } = props;
|
const { sourceStore } = props;
|
||||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
const [coloums,setColumns] = useState([])
|
||||||
const formRef = React.useRef<FormInstance>(null);
|
const [content,setContent] = useState([])
|
||||||
const [userId, setId] = useState<Number | null>(null);
|
|
||||||
const [record, setRecord] = useState<any>(null);
|
|
||||||
|
|
||||||
// 获取列表数据
|
// 获取列表数据
|
||||||
useEffect(() => {
|
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]);
|
}, [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 (
|
return (
|
||||||
<div className="contentBox">
|
<div className="contentBox">
|
||||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
<Button type="default" onClick={() => setIsModalOpen(true)}>
|
|
||||||
添加数据集
|
|
||||||
</Button>
|
|
||||||
<BTable
|
<BTable
|
||||||
store={sourceStore}
|
store={sourceStore}
|
||||||
scroll={{ x: "max-content" }}
|
scroll={{ x: "max-content" }}
|
||||||
columns={columns}
|
columns={coloums}
|
||||||
dataSource={sourceStore.list}
|
dataSource={content}
|
||||||
deleteCallback={(id) => {
|
deleteCallback={(id) => {
|
||||||
sourceStore.deleteItem(id);
|
sourceStore.deleteItem(id);
|
||||||
}}
|
}}
|
||||||
actionCloumn={(e)=>{
|
actionCloumn={(e)=>{
|
||||||
return <>
|
|
||||||
<Button size="small" onClick={() => gotoDetail()}>
|
|
||||||
查看数据集
|
|
||||||
</Button>
|
|
||||||
<input
|
|
||||||
type="file"
|
|
||||||
name="文件上传"
|
|
||||||
accept=".xlsx"
|
|
||||||
onChange={(f)=>{
|
|
||||||
upload(f,e)
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
}}
|
}}
|
||||||
editCallback={(record) => {
|
editCallback={(record) => {
|
||||||
setIsModalOpen(true);
|
|
||||||
formRef.current?.setFieldsValue(record);
|
|
||||||
setRecord(record);
|
|
||||||
setId(record.id);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Modal
|
|
||||||
title={!userId ? "添加数据集" : "编辑数据集"}
|
|
||||||
width={800}
|
|
||||||
open={isModalOpen}
|
|
||||||
afterClose={() => formRef.current?.resetFields()}
|
|
||||||
onOk={() => formRef.current?.submit()}
|
|
||||||
okText="确定"
|
|
||||||
cancelText="取消"
|
|
||||||
onCancel={() => {
|
|
||||||
setId(null);
|
|
||||||
setRecord(null);
|
|
||||||
setIsModalOpen(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<SimpleForm
|
|
||||||
formName={"source_form"}
|
|
||||||
formRef={formRef}
|
|
||||||
colProps={25}
|
|
||||||
onFinish={() => {
|
|
||||||
sourceStore.add(formRef.current?.getFieldsValue());
|
|
||||||
setIsModalOpen(false);
|
|
||||||
}}
|
|
||||||
createCallback={() => {
|
|
||||||
formRef.current?.setFieldsValue(record);
|
|
||||||
}}
|
|
||||||
formDatas={defaultConfig as any}
|
|
||||||
></SimpleForm>
|
|
||||||
</Modal>
|
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,17 +19,4 @@ export const columns: ColumnsType<UserDataType> = [
|
||||||
dataIndex: "resource_name",
|
dataIndex: "resource_name",
|
||||||
width: 200,
|
width: 200,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "上传用户",
|
|
||||||
dataIndex: "user_name",
|
|
||||||
width: 200,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "上传时间",
|
|
||||||
dataIndex: "created_at",
|
|
||||||
width: 200,
|
|
||||||
render: (created_at) => (
|
|
||||||
<span>{dayjs(created_at).format("YYYY-MM-DD")}</span>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
class SourceConfig {
|
class SourceConfig {
|
||||||
static ADD: string = "/desc";
|
static ADD: string = "/desc";
|
||||||
static EDIT: string = "/desc";
|
static EDIT: string = "/desc";
|
||||||
static LIST: string = "/desc/list";
|
static LIST: string = "/desc/content";
|
||||||
static DELETE: string = "/desc";
|
static DELETE: string = "/desc";
|
||||||
|
static Headers: string = "/desc/header";
|
||||||
|
static Content: string = "/desc/content";
|
||||||
}
|
}
|
||||||
|
|
||||||
export default SourceConfig;
|
export default SourceConfig;
|
|
@ -1,14 +1,41 @@
|
||||||
import { makeObservable } from "mobx";
|
import { action, makeObservable, observable } from "mobx";
|
||||||
import BaseStore from "./baseStore";
|
import BaseStore from "./baseStore";
|
||||||
import { UserDataType } from "@/model/userModel";
|
import { UserDataType } from "@/model/userModel";
|
||||||
import SourceConfig from "@/service/source_config";
|
import SourceConfig from "@/service/source_config";
|
||||||
|
import { base } from "@/service/base";
|
||||||
|
import { message } from "antd";
|
||||||
|
|
||||||
class SourceStore extends BaseStore<UserDataType> {
|
class SourceStore extends BaseStore<UserDataType> {
|
||||||
|
headlist =[]
|
||||||
|
contentList =[]
|
||||||
constructor() {
|
constructor() {
|
||||||
super(SourceConfig)
|
super(SourceConfig)
|
||||||
makeObservable(this, {
|
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();
|
const sourceStore = new SourceStore();
|
||||||
export default sourceStore;
|
export default sourceStore;
|
Loading…
Reference in New Issue