This commit is contained in:
wang_yp 2025-07-07 16:35:18 +08:00
parent 9f39ef3e21
commit e534e62d68
9 changed files with 96 additions and 85 deletions

View File

@ -10,7 +10,7 @@ const Dumbselect = (props) => {
return base.get(SourceConfig.Searchs + "/?name=" + username, {}).then((res) => { return base.get(SourceConfig.Searchs + "/?name=" + username, {}).then((res) => {
return res.data.record.map((item) => ({ return res.data.record.map((item) => ({
label: item.content, label: item.content,
value: item.id_card, value: item.identity,
})); }));
}); });
} }

View File

@ -41,7 +41,7 @@ export const defaultConfig = [
}, },
{ {
type: FormType.input, type: FormType.input,
label: "事件开始时间", label: "事件结束时间",
name: "end_time", name: "end_time",
value: "", value: "",
rules: [{ required: true, message: "请输入事件开始时间!" }], rules: [{ required: true, message: "请输入事件开始时间!" }],
@ -54,11 +54,14 @@ export const defaultConfig = [
rules: [{ required: true, message: "请输入影响!" }], rules: [{ required: true, message: "请输入影响!" }],
}, },
{ {
type: FormType.input, type: FormType.select,
label: "负责人名称", label: "负责人选择",
name: "director", name: "director",
value: "", value: "",
rules: [{ required: true, message: "请输入负责人名称!" }], mode: "",
selectUrl: SourceConfig.Searchs,
keys:"content",
rules: [{ required: false, message: "请选择负责人!" }],
}, },
{ {
type: FormType.input, type: FormType.input,
@ -78,6 +81,7 @@ export const defaultConfig = [
type: FormType.fetchList, type: FormType.fetchList,
label: "参与人员选择", label: "参与人员选择",
name: "part_idCard", name: "part_idCard",
mode: "multiple",
value: [], value: [],
selectUrl: SourceConfig.Searchs, selectUrl: SourceConfig.Searchs,
rules: [{ required: false, message: "请选择参与人员!" }], rules: [{ required: false, message: "请选择参与人员!" }],

View File

@ -1,18 +1,20 @@
import { FormType } from "@/components/form/interface"; import { FormType } from "@/components/form/interface";
import SimpleForm from "@/components/form/simple_form" import SimpleForm from "@/components/form/simple_form"
import { CompanyConfig } from "@/service/user_config"; import { CompanyConfig } from "@/service/user_config";
import { FormInstance } from "antd";
import React from "react";
const Share = () => { const Share = (props) => {
const formRef = React.useRef<FormInstance>(null); const { submit, formRef } = props
const onFinish = () => {
submit(formRef.current?.getFieldsValue())
}
const config: any = [ const config: any = [
{ {
type: FormType.cehckbox, type: FormType.radio,
label: "分享类型", label: "分享类型",
name: "share_type", name: "share_type",
value: [], value: "",
selectList: [{ data_name: "事件", identity: 1 }, { data_name: "属性", identity: 2 }], radioData: [{ key: "事件", val: 1 }, { key: "属性", val: 2 }],
rules: [{ required: true, message: "请选择默认数据" }], rules: [{ required: true, message: "请选择默认数据" }],
}, },
{ {
@ -30,9 +32,7 @@ const Share = () => {
formName={"user_form"} formName={"user_form"}
formRef={formRef} formRef={formRef}
colProps={25} colProps={25}
onFinish={() => { onFinish={onFinish}
formRef.current?.getFieldsValue()
}}
createCallback={() => { createCallback={() => {
}} }}

View File

@ -4,6 +4,7 @@ import {
Checkbox, Checkbox,
Drawer, Drawer,
Form, Form,
FormInstance,
Input, Input,
message, message,
Modal, Modal,
@ -11,7 +12,6 @@ import {
Popconfirm, Popconfirm,
Space, Space,
Table, Table,
Timeline,
Typography, Typography,
} from "antd"; } from "antd";
import { Store } from "antd/lib/form/interface"; import { Store } from "antd/lib/form/interface";
@ -21,10 +21,15 @@ import { DataType } from "@/util/model/interface";
import Upload from "./upload"; import Upload from "./upload";
import toExcel from "@/util/xmsx"; import toExcel from "@/util/xmsx";
import Share from "./share"; import Share from "./share";
import Things from "./things";
import React from "react";
const Source = (props: Store) => { const Source = (props: Store) => {
const { sourceStore } = props; const { sourceStore } = props;
const formRef = React.useRef<FormInstance>(null);
const [form] = Form.useForm(); const [form] = Form.useForm();
const [coloums, setColumns] = useState<any>([]); const [coloums, setColumns] = useState<any>([]);
const [record, setRecord] = useState<any>(null);
const [content, setContent] = useState([]); const [content, setContent] = useState([]);
const [selectKey, setSelectKey] = useState<Array<string>>([]); const [selectKey, setSelectKey] = useState<Array<string>>([]);
const [page, setPage] = useState<number>(1); const [page, setPage] = useState<number>(1);
@ -143,10 +148,17 @@ const Source = (props: Store) => {
> >
</Typography.Link> </Typography.Link>
<Typography.Link onClick={() => setOpen(true)}> <Typography.Link onClick={() => {
setRecord(record)
setOpen(true)
}}>
</Typography.Link> </Typography.Link>
<Typography.Link onClick={() => setShareOpen(true)}> <Typography.Link onClick={() => {
setRecord(record)
setShareOpen(true)
}
}>
</Typography.Link> </Typography.Link>
</Space> </Space>
@ -192,7 +204,6 @@ const Source = (props: Store) => {
const onChange: PaginationProps["onChange"] = (page) => { const onChange: PaginationProps["onChange"] = (page) => {
setPage(page); setPage(page);
console.log(page)
getContent(selectKey, page); getContent(selectKey, page);
cancel(); cancel();
}; };
@ -252,69 +263,28 @@ const Source = (props: Store) => {
loading={loading} loading={loading}
onClose={() => setOpen(false)} onClose={() => setOpen(false)}
> >
<Timeline <Things id={record?.idcard_identity} />
items={[
{
children: <div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p></p>
<p> </p>
<p> </p>
<p> 2025-02-12</p>
</div>,
},
{
children: <div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p></p>
<p> </p>
<p> </p>
<p> 2025-03-12</p>
</div>,
},
{
children: <div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p></p>
<p> </p>
<p> </p>
<p> 2025-02-12</p>
<p> 2025-03-12</p>
</div>,
},
{
children: <div>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p></p>
<p> </p>
<p> </p>
<p> 2025-02-12</p>
<p> 2025-03-12</p>
</div>,
},
]}
/>
</Drawer> </Drawer>
<Modal <Modal
open={shareOpen} open={shareOpen}
title="分享" title="分享"
onOk={() => { }} onOk={() => {
formRef.current?.submit()
}}
onCancel={() => { setShareOpen(false) }} onCancel={() => { setShareOpen(false) }}
> >
<Share /> <Share
formRef={formRef}
submit={async (v) => {
const data = {
...v,
user_identity: record.idcard_identity
}
const res = await sourceStore.share(data)
if (res.code === 200) {
message.success("分享成功")
}
}} />
</Modal> </Modal>
</div> </div>
); );

View File

@ -0,0 +1,31 @@
import { base } from "@/service/base"
import { EventConfig } from "@/service/user_config"
import { Timeline } from "antd"
import { useEffect, useState } from "react"
const Things = (props) => {
const { id } = props
const [item, setItem] = useState([])
useEffect(() => {
base.get(EventConfig.ThingList + "/" + id, {}).then((e) => {
setItem(e.data.record.map((item) => {
return {
children: <div>
<p>{item.name}</p>
<p>{item.content}</p>
<p>{item.effect}</p>
<p>{item.desc}</p>
<p>{item.address}</p>
<p>{item.start_time}</p>
<p>{item.end_time}</p>
</div>
}
}))
});
}, [id])
return (
<Timeline items={item} />
)
}
export default Things

View File

@ -6,6 +6,8 @@ class SourceConfig {
static Headers: string = "/desc/header"; static Headers: string = "/desc/header";
static Content: string = "/desc/content"; static Content: string = "/desc/content";
static Searchs: string = "/desc/content/idcard"; static Searchs: string = "/desc/content/idcard";
static share: string = "/share";
} }
export default SourceConfig; export default SourceConfig;

View File

@ -6,7 +6,6 @@ class UserConfig {
static DELETE: string = "/user"; static DELETE: string = "/user";
static menu: string = "/user/menu"; static menu: string = "/user/menu";
static used: string = "/user/used"; static used: string = "/user/used";
} }
class RoleConfig { class RoleConfig {
@ -44,8 +43,8 @@ class EventConfig {
static EDIT: string = "/thing"; static EDIT: string = "/thing";
static LIST: string = "/thing/list"; static LIST: string = "/thing/list";
static DELETE: string = "/thing"; static DELETE: string = "/thing";
static ThingList: string = "/thing/byIdcard";
} }
export { RoleConfig, UserConfig, MenuConfig, DepConfig, CompanyConfig,EventConfig }; export { RoleConfig, UserConfig, MenuConfig, DepConfig, CompanyConfig, EventConfig };

View File

@ -1,4 +1,4 @@
import {base} from "@/service/base"; import { base } from "@/service/base";
import { Pages } from "@/util/model/interface"; import { Pages } from "@/util/model/interface";
import { message } from "antd"; import { message } from "antd";
import { action, makeObservable, observable, runInAction } from "mobx"; import { action, makeObservable, observable, runInAction } from "mobx";
@ -39,10 +39,10 @@ class BaseStore<B> implements BaseStoreInterface<B> {
await base.delete(this.urlConfig.DELETE + "/" + id, {}) await base.delete(this.urlConfig.DELETE + "/" + id, {})
this.getlist() this.getlist()
} catch (error) { } catch (error) {
console.log(error); console.error(error);
} }
} }
// 分页 // 分页
setPages(page: Pages) { setPages(page: Pages) {
this.page = page this.page = page
@ -60,7 +60,7 @@ class BaseStore<B> implements BaseStoreInterface<B> {
this.getlist(listParam) this.getlist(listParam)
return true; return true;
} catch (error) { } catch (error) {
console.log(error); console.error(error);
} }
} }
@ -75,7 +75,7 @@ class BaseStore<B> implements BaseStoreInterface<B> {
this.getlist(listParam) this.getlist(listParam)
return true; return true;
} catch (error) { } catch (error) {
console.error(error);
} }
} }

View File

@ -17,6 +17,11 @@ class SourceStore extends BaseStore<UserDataType> {
contentList: observable contentList: observable
}) })
} }
async share(data) {
return await base.post(SourceConfig.share, {
...data
})
}
async getHead() { async getHead() {
let res = await base.get(SourceConfig.Headers, {}) let res = await base.get(SourceConfig.Headers, {})
if (res.code !== 200) { if (res.code !== 200) {
@ -57,7 +62,7 @@ class SourceStore extends BaseStore<UserDataType> {
runInAction(() => { runInAction(() => {
this.total = res.data.count; this.total = res.data.count;
}) })
return res.data.record; return res.data.record;
} }
} }