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

View File

@ -1,8 +1,8 @@
import BTable from "@/components/b_table";
import { UserDataType } from "@/model/userModel";
import { Button, Space } from "antd";
import { Store } from "antd/es/form/interface";
import { ColumnsType } from "antd/lib/table";
import dayjs from "dayjs";
import { inject, observer } from "mobx-react";
import { useEffect } from "react";
@ -15,28 +15,9 @@ const GloryPlaque = (props: Store) => {
{ title: "申请人", dataIndex: "user_name" },
{ title: "申请人手机号", dataIndex: "tel" },
{ 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: "desc" },
{
title: "操作",
dataIndex: "id",
render: (any, record) => (
<div>
<Space wrap>
<Button
type="dashed"
size="small"
onClick={() => {
// edit(record);
}}
>
</Button>
</Space>
</div>
),
},
];
return (
<div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,14 +43,33 @@ const Trainings = (props: Store) => {
{ 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: "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: "category_name", width: 200 },
{
title: "任务状态",
dataIndex: "status",
render: (status) => (status === 2 ? "已完成" : "未完成"),
render: (status) =>
status === 1 ? (
<span style={{ color: "black" }}></span>
) : (
<span style={{ color: "green" }}></span>
),
width: 200,
},
{
@ -105,11 +124,11 @@ const Trainings = (props: Store) => {
setIsModalOpenUser(true);
}}
>
</Button>
<TaskArchives
taskId={record?.identity}
category_identity={record.archives_category_identity}
category_identity={record.identity}
/>
{record.supplies_status === 1 ? (
<Button

View File

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

View File

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

View File

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