push im model

This commit is contained in:
wang_yp 2024-11-26 01:03:05 +08:00
parent 7bc72d4981
commit cf98c949cd
13 changed files with 110 additions and 82 deletions

View File

@ -50,7 +50,7 @@ const AliUpload = (props: UploadFileProps) => {
const handleChange: UploadProps["onChange"] = ({ fileList: newFileList }) => { const handleChange: UploadProps["onChange"] = ({ fileList: newFileList }) => {
newFileList.forEach((i) => { newFileList.forEach((i) => {
i.url = `${Config.baseUrl}uploads/` + i.name; i.url = `${Config.baseUrl}/uploads/` + i.name;
i.fileName = i.name; i.fileName = i.name;
}); });
setFileList(newFileList); setFileList(newFileList);
@ -68,7 +68,7 @@ const AliUpload = (props: UploadFileProps) => {
<Upload <Upload
listType="picture-card" listType="picture-card"
fileList={files} fileList={files}
action={`${Config.baseUrl}v1/public/fts/upload`} action={`${Config.baseUrl}/v1/public/fts/upload`}
onPreview={handlePreview} onPreview={handlePreview}
maxCount={props.maxCount ?? 4} maxCount={props.maxCount ?? 4}
onChange={handleChange} onChange={handleChange}

View File

@ -1,8 +1,8 @@
import BTable from "@/components/b_table"; import BTable from "@/components/b_table";
import { UserDataType } from "@/model/userModel"; import { UserDataType } from "@/model/userModel";
import { Button, Space } from "antd";
import { Store } from "antd/es/form/interface"; import { Store } from "antd/es/form/interface";
import { ColumnsType } from "antd/lib/table"; import { ColumnsType } from "antd/lib/table";
import dayjs from "dayjs";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import { useEffect } from "react"; import { useEffect } from "react";
@ -15,28 +15,9 @@ const GloryPlaque = (props: Store) => {
{ title: "申请人", dataIndex: "user_name" }, { title: "申请人", dataIndex: "user_name" },
{ title: "申请人手机号", dataIndex: "tel" }, { title: "申请人手机号", dataIndex: "tel" },
{ title: "悬挂地址", dataIndex: "address" }, { title: "悬挂地址", dataIndex: "address" },
{ title: "申请时间", dataIndex: "created_at" }, { title: "申请时间", dataIndex: "created_at",render:(created_at)=>(<span>{dayjs(created_at).format("YYYY-MM-DD")}</span>) },
{ title: "申请原因", dataIndex: "abbr",render: (abbr) => <span>{abbr===2?'更换':'悬挂'}</span> }, { title: "申请原因", dataIndex: "abbr",render: (abbr) => <span>{abbr===2?'更换':'悬挂'}</span> },
{ title: "申请描述", dataIndex: "desc" }, { title: "申请描述", dataIndex: "desc" },
{
title: "操作",
dataIndex: "id",
render: (any, record) => (
<div>
<Space wrap>
<Button
type="dashed"
size="small"
onClick={() => {
// edit(record);
}}
>
</Button>
</Space>
</div>
),
},
]; ];
return ( return (
<div> <div>

View File

@ -36,18 +36,12 @@ const Dispath = (props: Store) => {
{ {
type: FormType.cehckboxGroup, type: FormType.cehckboxGroup,
label: "参与队伍", label: "参与队伍",
name: "trem_id", name: "team_id",
value: [], value: [],
checkboxData: userList, checkboxData: userList,
rules: [{ required: true, message: "请选择参与队伍!" }], rules: [{ required: true, message: "请选择参与队伍!" }],
}, },
{
type: FormType.treeVideo,
label: "直播视频地址",
name: "task_video",
value: [],
rules: [{ required: true, message: "请选择直播视频地址!" }],
},
]); ]);
}; };
useEffect(() => { useEffect(() => {
@ -77,15 +71,15 @@ const Dispath = (props: Store) => {
}; };
const onFinish = (values: any) => { const onFinish = (values: any) => {
let task_video: any = []; let task_videos: any = [];
for (let i = 0; i < values.task_video.length; i++) { for (let i = 0; i < values.task_video.length; i++) {
let item = values.task_video[i]; let item = values.task_video[i];
task_video.push({ task_videos.push({
device: item.split("-")[0], device: item.split("-")[0],
channel: item.split("-")[1], channel: item.split("-")[1],
}); });
} }
if (!task_video || task_video.length === 0) { if (!task_videos || task_videos.length === 0) {
message.error("请选择视频设备"); message.error("请选择视频设备");
return; return;
} }
@ -102,13 +96,13 @@ const Dispath = (props: Store) => {
score: Number(values.score), score: Number(values.score),
count: Number(values.count), count: Number(values.count),
}; };
data.task_video = task_video; data.task_video = task_videos;
trainingStore.add(data); trainingStore.add(data);
setIsModalOpen(false); setIsModalOpen(false);
}; };
const handleSearch = (newValue: string) => { const handleSearch = (newValue: string) => {
if (newValue === "") return; if (newValue === "") return;
baseHttp.get("/supplies/list/serch", { name: newValue }).then((res) => { baseHttp.get("/v1/supplies/list/serch", { name: newValue }).then((res) => {
let data = res.data?.record ?? []; let data = res.data?.record ?? [];
data.forEach((item) => { data.forEach((item) => {
item.text = item.name; item.text = item.name;

View File

@ -127,21 +127,23 @@ const Turn = (props: Store) => {
<Modal <Modal
title="年度训练" title="年度训练"
className="owner_model" className="owner_model"
width={1100} width={1300}
open={isModalOpen} open={isModalOpen}
afterClose={() => {}} afterClose={() => {}}
onOk={() => {}} onOk={() => {}}
centered
footer={null} footer={null}
onCancel={() => { onCancel={() => {
setisModalOpen(false); setisModalOpen(false);
}} }}
> >
<> <div >
<Row> <Row>
<Col span={2}> <Col span={2}>
<div style={{ color: "#fff" }}> <div style={{ color: "#fff" }}>
<p></p> <p></p>
{trainingStore.list?.map((item) => { <div style={{ height: "600px",overflowY:"hidden" }}>
{trainingStore.list?.map((item) => {
return ( return (
<p <p
key={item.identity} key={item.identity}
@ -151,13 +153,14 @@ const Turn = (props: Store) => {
}} }}
onClick={() => { onClick={() => {
setTaskId(item.identity); setTaskId(item.identity);
getFolderhandler(item.archives_category_identity); getFolderhandler(item.identity);
}} }}
> >
{item.title} {item.title}
</p> </p>
); );
})} })}
</div>
</div> </div>
</Col> </Col>
<Col span={2}> <Col span={2}>
@ -182,10 +185,11 @@ const Turn = (props: Store) => {
})} })}
</div> </div>
</Col> </Col>
<Col span={2}> <Col span={2} style={{height:"600px",overflowY:"hidden"}}>
<div style={{ color: "#fff" }}> <div style={{ color: "#fff" }}>
<p></p> <p></p>
{imageList?.map((item) => { <div style={{height:"600px",overflowY:"scroll"}}>
{imageList?.map((item) => {
let fileType = getFileTypeFromUrl(item.file_url); let fileType = getFileTypeFromUrl(item.file_url);
switch (fileType) { switch (fileType) {
case "png": case "png":
@ -244,13 +248,13 @@ const Turn = (props: Store) => {
); );
} }
})} })}
</div>
</div> </div>
</Col> </Col>
<Col span={16}> <Col span={16}>
<div <div
style={{ style={{
color: "#fff", color: "#fff",
margin: "10px",
width: "100%", width: "100%",
display: "flex", display: "flex",
alignItems: "center", alignItems: "center",
@ -261,7 +265,7 @@ const Turn = (props: Store) => {
</div> </div>
</Col> </Col>
</Row> </Row>
</> </div>
</Modal> </Modal>
</> </>
); );

View File

@ -6,7 +6,7 @@ import "./video.less";
const HomeVideo = (props: Store) => { const HomeVideo = (props: Store) => {
const { homeStore } = props; const { homeStore } = props;
const [videoUrls, setVideoUrl] = useState<[] | null>([]); const [videoUrls, setVideoUrl] = useState<Array<string> | null>([]);
useEffect(() => { useEffect(() => {
// 获取最新任务 // 获取最新任务
homeStore.getNewTask().then((res) => { homeStore.getNewTask().then((res) => {

View File

@ -2,23 +2,23 @@ import { Store } from "antd/es/form/interface";
import { useEffect, useRef } from "react"; import { useEffect, useRef } from "react";
import videojs from "video.js"; import videojs from "video.js";
import "video.js/dist/video-js.css"; import "video.js/dist/video-js.css";
const videoJsOptions = {
autoplay: true,
controls: true,
responsive: true,
fluid: true,
sources: [
{
src: "",
type: "application/x-mpegURL",
},
],
};
const Videos = (props: Store) => { const Videos = (props: Store) => {
const { onReady } = props; const { onReady } = props;
const videoRef = useRef<HTMLDivElement>(null); let videoRef = useRef<HTMLDivElement>(null);
const playerRef = useRef<any>(null); // 使用 any 类型 let playerRef = useRef<any>(null); // 使用 any 类型
const videoJsOptions = {
autoplay: true,
controls: true,
responsive: true,
fluid: true,
sources: [
{
src: "",
type: "application/x-mpegURL",
},
],
};
useEffect(() => { useEffect(() => {
if (!props.url) return; if (!props.url) return;
videoJsOptions.sources[0].src = props.url; videoJsOptions.sources[0].src = props.url;
@ -39,6 +39,7 @@ const Videos = (props: Store) => {
player?.autoplay(videoJsOptions?.autoplay); player?.autoplay(videoJsOptions?.autoplay);
player.src(videoJsOptions?.sources); player.src(videoJsOptions?.sources);
} }
console.log(videoJsOptions.sources)
return () => { return () => {
if (playerRef.current) { if (playerRef.current) {
playerRef.current.dispose(); playerRef.current.dispose();
@ -50,7 +51,7 @@ const Videos = (props: Store) => {
return ( return (
<> <>
<div data-vjs-player style={{ width: "100%", height: "100%" }}> <div data-vjs-player style={{ width: "100%", height: "100%" }}>
<div ref={videoRef} id={props.url} style={{ width: "100%", height: "100%" }} /> <div ref={videoRef} style={{ width: "100%", height: "100%" }} />
</div> </div>
</> </>
); );

View File

@ -1,6 +1,7 @@
import { FormType } from "@/components/form/interface"; import { FormType } from "@/components/form/interface";
import { UserDataType } from "@/model/userModel"; import { UserDataType } from "@/model/userModel";
import { ColumnsType } from "antd/lib/table"; import { ColumnsType } from "antd/lib/table";
import dayjs from "dayjs";
export const columns: ColumnsType<UserDataType> = [ export const columns: ColumnsType<UserDataType> = [
{ {
title: "分类名称", title: "分类名称",
@ -17,10 +18,16 @@ export const leaveColumns: ColumnsType<UserDataType> = [
{ {
title: "请假开始时间", title: "请假开始时间",
dataIndex: "leave_start_time", dataIndex: "leave_start_time",
render(leave_start_time) {
return dayjs(leave_start_time).format("YYYY-MM-DD");
}
}, },
{ {
title: "请假结束时间", title: "请假结束时间",
dataIndex: "leave_end_time", dataIndex: "leave_end_time",
render(leave_end_time) {
return dayjs(leave_end_time).format("YYYY-MM-DD");
}
}, },
{ {
title: "请假备注", title: "请假备注",

View File

@ -39,7 +39,7 @@ const Patrol = (props: Store) => {
status === 0 ? ( status === 0 ? (
<span></span> <span></span>
) : ( ) : (
<span style={{ color: "red" }}></span> <span style={{ color: "green" }}></span>
), ),
}, },
{ {
@ -56,18 +56,17 @@ const Patrol = (props: Store) => {
> >
</Button> </Button>
<Button {record.status === 0 ? (
type="dashed" <Button
size="small" type="dashed"
onClick={() => { size="small"
patrolStore.putItem(record.id, { onClick={() => {
...record, patrolStore.fish(record.identity);
status: 1, }}
}); >
}}
> </Button>
) : null}
</Button>
<Button <Button
type="dashed" type="dashed"
danger danger
@ -95,11 +94,20 @@ const Patrol = (props: Store) => {
setId(record.id); setId(record.id);
}; };
const onFinish = (values: any) => { const onFinish = (values: any) => {
let task_video: any = [];
for (let i = 0; i < values.task_video.length; i++) {
let item = values.task_video[i];
task_video.push({
device: item.split("-")[0],
channel: item.split("-")[1],
});
}
let data = { let data = {
...values, ...values,
score: Number(values.score ?? 0), score: Number(values.score ?? 0),
user_identity: values.user_identity.map((item) => item.value), user_identity: values.user_identity.map((item) => item.value),
}; };
data.task_video = task_video;
if (!tagId) { if (!tagId) {
patrolStore.add(data); patrolStore.add(data);
} else { } else {

View File

@ -49,6 +49,7 @@ const TaskArchives = (props: TaskArchivesProps) => {
}; };
const save = async () => { const save = async () => {
message.loading("文件保存中...");
let imlist = imageList; let imlist = imageList;
imlist.forEach((element) => { imlist.forEach((element) => {
element.file_url = element.url; element.file_url = element.url;
@ -157,6 +158,7 @@ const TaskArchives = (props: TaskArchivesProps) => {
<Divider dashed /> <Divider dashed />
<AliUpload <AliUpload
imgList={imageList} imgList={imageList}
maxCount={100}
onChnage={(v) => { onChnage={(v) => {
setImageList(v); setImageList(v);
}} }}

View File

@ -43,14 +43,33 @@ const Trainings = (props: Store) => {
{ title: "任务标题", dataIndex: "title", width: 200 }, { title: "任务标题", dataIndex: "title", width: 200 },
{ title: "任务描述", dataIndex: "desc", width: 200 }, { title: "任务描述", dataIndex: "desc", width: 200 },
{ title: "任务地点", dataIndex: "address", width: 200 }, { title: "任务地点", dataIndex: "address", width: 200 },
{ title: "任务开始时间", dataIndex: "start_time", width: 200 }, {
{ title: "任务结束时间", dataIndex: "end_time", width: 200 }, title: "任务开始时间",
dataIndex: "start_time",
render: (start_time) => (
<span>{dayjs(start_time).format("YYYY-MM-DD")}</span>
),
width:200
},
{
title: "任务结束时间",
dataIndex: "end_time",
render: (end_time) => (
<span>{dayjs(end_time).format("YYYY-MM-DD")}</span>
),
width:200
},
{ title: "任务积分设置", dataIndex: "score", width: 200 }, { title: "任务积分设置", dataIndex: "score", width: 200 },
{ title: "任务类别", dataIndex: "category_name", width: 200 }, { title: "任务类别", dataIndex: "category_name", width: 200 },
{ {
title: "任务状态", title: "任务状态",
dataIndex: "status", dataIndex: "status",
render: (status) => (status === 2 ? "已完成" : "未完成"), render: (status) =>
status === 1 ? (
<span style={{ color: "black" }}></span>
) : (
<span style={{ color: "green" }}></span>
),
width: 200, width: 200,
}, },
{ {
@ -109,7 +128,7 @@ const Trainings = (props: Store) => {
</Button> </Button>
<TaskArchives <TaskArchives
taskId={record?.identity} taskId={record?.identity}
category_identity={record.archives_category_identity} category_identity={record.identity}
/> />
{record.supplies_status === 1 ? ( {record.supplies_status === 1 ? (
<Button <Button

View File

@ -22,6 +22,9 @@ export const columns: ColumnsType<UserDataType> = [
{ {
title: "是否为第三方仓库", title: "是否为第三方仓库",
dataIndex: "is_other", dataIndex: "is_other",
render(value, record, index) {
return value===1 ? "是" : "否";
},
}, },
{ {
title: "三方仓库仓库所有者", title: "三方仓库仓库所有者",

View File

@ -85,11 +85,12 @@ class HomeStore extends BaseStore<TagDataType> {
// 获取通道流 // 获取通道流
async getChannerStrem(deviceId, channel) { async getChannerStrem(deviceId, channel) {
try { try {
let data = await baseHttp.gets(Config.baseUrl+HomeConfig.channelstream, { let data = await baseHttp.gets(HomeConfig.channelstream, {
device: deviceId, device: deviceId,
channel: channel, channel: channel,
protocol: "HLS" protocol: "HLS"
}) })
console.log(data)
return data; return data;
} catch (error) { } catch (error) {
console.log(error) console.log(error)

View File

@ -11,18 +11,26 @@ class PatrolConfig {
static DELETE: string = "/v1/patrol" static DELETE: string = "/v1/patrol"
static EDIT: string = "/v1/patrol" static EDIT: string = "/v1/patrol"
static ACCESS: string = "/v1/patrol/accept" static ACCESS: string = "/v1/patrol/accept"
static Fish: string = "/v1/patrol/fish"
} }
class PatrolStore extends BaseStore<TagDataType> { class PatrolStore extends BaseStore<TagDataType> {
constructor() { constructor() {
super(PatrolConfig) super(PatrolConfig)
makeObservable(this, { makeObservable(this, {
access: action access: action,
fish: action,
}) })
} }
async access(id: number, param: any) { async access(id: number, param: any) {
await baseHttp.put(PatrolConfig.ACCESS + "/" + id, param) await baseHttp.put(PatrolConfig.ACCESS + "/" + id, param)
this.getlist() this.getlist()
} }
async fish(id: number) {
await baseHttp.put(PatrolConfig.Fish + "/" + id, {})
this.getlist()
}
} }
export const patrolStore = new PatrolStore() export const patrolStore = new PatrolStore()