fix(icc add hls)
This commit is contained in:
parent
4e5deeb177
commit
984768ad78
|
|
@ -90,6 +90,7 @@
|
||||||
"webpack-manifest-plugin": "^4.0.2",
|
"webpack-manifest-plugin": "^4.0.2",
|
||||||
"workbox-webpack-plugin": "^6.4.1"
|
"workbox-webpack-plugin": "^6.4.1"
|
||||||
},
|
},
|
||||||
|
"proxy":"http://127.0.0.1:12216/v1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node scripts/start.js",
|
"start": "node scripts/start.js",
|
||||||
"build": "node scripts/build.js",
|
"build": "node scripts/build.js",
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ export interface FormDatas {
|
||||||
radioData?: Array<any>,
|
radioData?: Array<any>,
|
||||||
rules: Array<rules>,
|
rules: Array<rules>,
|
||||||
model: "multiple" | "tags" | undefined
|
model: "multiple" | "tags" | undefined
|
||||||
|
treeMultiple?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SimpleFormData {
|
export interface SimpleFormData {
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export const FormTreeSelect = (v: FormDatas) => {
|
||||||
value: "identity",
|
value: "identity",
|
||||||
children: "children"
|
children: "children"
|
||||||
}}
|
}}
|
||||||
multiple
|
multiple={v.treeMultiple}
|
||||||
showSearch
|
showSearch
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,16 @@
|
||||||
import { HomeOutlined, UserSwitchOutlined, DatabaseOutlined, PaperClipOutlined, SettingOutlined } from '@ant-design/icons';
|
import { HomeOutlined, UserSwitchOutlined, DatabaseOutlined, PaperClipOutlined, SettingOutlined, WechatWorkOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
export const items = [
|
export const items = [
|
||||||
{
|
{
|
||||||
key: "/",
|
key: "/",
|
||||||
label: `首页看板`,
|
label: `首页看板`,
|
||||||
icon: <HomeOutlined />
|
icon: <HomeOutlined />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "/work",
|
||||||
|
label: `工作区`,
|
||||||
|
icon: <WechatWorkOutlined />,
|
||||||
|
children: [{ key: "/work/list", label: `工作区` }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: "/user",
|
key: "/user",
|
||||||
|
|
|
||||||
|
|
@ -76,9 +76,4 @@ export const columns: ColumnsType<UserDataType> = [
|
||||||
width: 150,
|
width: 150,
|
||||||
dataIndex: "email",
|
dataIndex: "email",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "上级单位名称",
|
|
||||||
width: 150,
|
|
||||||
dataIndex: "email",
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,8 @@
|
||||||
/* eslint-disable react-hooks/exhaustive-deps */
|
/* eslint-disable react-hooks/exhaustive-deps */
|
||||||
import { Checkbox, Modal, Space } from "antd";
|
import { Space } from "antd";
|
||||||
import { Store } from "antd/lib/form/interface";
|
|
||||||
import "./index.less";
|
import "./index.less";
|
||||||
import ReactECharts from 'echarts-for-react';
|
import ReactECharts from 'echarts-for-react';
|
||||||
import { inject, observer } from "mobx-react";
|
const Dashbord = () => {
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
const Dashbord = (props: Store) => {
|
|
||||||
const { usrStore } = props;
|
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false)
|
|
||||||
const [plainOptions, setOption] = useState();
|
|
||||||
const [check, setCheck] = useState([])
|
|
||||||
const options = {
|
const options = {
|
||||||
grid: { top: 8, right: 8, bottom: 24, left: 36 },
|
grid: { top: 8, right: 8, bottom: 24, left: 36 },
|
||||||
xAxis: {
|
xAxis: {
|
||||||
|
|
@ -30,59 +23,12 @@ const Dashbord = (props: Store) => {
|
||||||
trigger: 'axis',
|
trigger: 'axis',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
useEffect(() => {
|
|
||||||
getColumn()
|
|
||||||
getHead()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const getHead = async () => {
|
|
||||||
const res = await usrStore.getHead()
|
|
||||||
if (res.length > 0) {
|
|
||||||
res.forEach((element) => {
|
|
||||||
element.label = element.data_name;
|
|
||||||
element.value = element.identity;
|
|
||||||
element.editable = true;
|
|
||||||
});
|
|
||||||
setOption(res)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const getColumn = async () => {
|
|
||||||
const res = await usrStore.getUsed()
|
|
||||||
if (res.length === 0) {
|
|
||||||
console.log(res)
|
|
||||||
setIsModalOpen(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const onChange = (checkedValues) => {
|
|
||||||
setCheck(checkedValues)
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleOk = async () => {
|
|
||||||
const res = await usrStore.setUsed({ identitys: check })
|
|
||||||
console.log(res)
|
|
||||||
}
|
|
||||||
return (
|
return (
|
||||||
<div className="contentBox">
|
<div className="contentBox">
|
||||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
<ReactECharts option={options} />
|
<ReactECharts option={options} />
|
||||||
</Space>
|
</Space>
|
||||||
<Modal
|
|
||||||
title={"常用列设置"}
|
|
||||||
width={600}
|
|
||||||
height={600}
|
|
||||||
open={isModalOpen}
|
|
||||||
onOk={handleOk}
|
|
||||||
okText="确定"
|
|
||||||
cancelText="取消"
|
|
||||||
onCancel={() => {
|
|
||||||
setIsModalOpen(false);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Checkbox.Group options={plainOptions} defaultValue={[]} onChange={onChange} />
|
|
||||||
</Modal>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
export default inject("usrStore")(observer(Dashbord));
|
export default Dashbord;
|
||||||
|
|
|
||||||
|
|
@ -1,56 +1,47 @@
|
||||||
import { FormType } from "@/components/form/interface";
|
import { FormType } from "@/components/form/interface";
|
||||||
import { UserDataType } from "@/model/userModel";
|
import { UserDataType } from "@/model/userModel";
|
||||||
import { CompanyConfig, DepConfig } from "@/service/user_config";
|
import { CompanyConfig } from "@/service/user_config";
|
||||||
import { ColumnsType } from "antd/lib/table";
|
import { ColumnsType } from "antd/lib/table";
|
||||||
export const defaultConfig = [
|
export const defaultConfig = [
|
||||||
{
|
{
|
||||||
type: FormType.input,
|
type: FormType.input,
|
||||||
label: "部门名称",
|
label: "科室名称",
|
||||||
name: "dep_name",
|
name: "dep_name",
|
||||||
value: "",
|
value: "",
|
||||||
rules: [{ required: true, message: "请输入部门名称!" }],
|
rules: [{ required: true, message: "请输入科室名称!" }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: FormType.input,
|
type: FormType.input,
|
||||||
label: "部门描述",
|
label: "科室描述",
|
||||||
name: "desc",
|
name: "desc",
|
||||||
value: "",
|
value: "",
|
||||||
rules: [{ required: true, message: "请输入部门描述" }],
|
rules: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: FormType.input,
|
type: FormType.input,
|
||||||
label: "负责人",
|
label: "负责人",
|
||||||
name: "head",
|
name: "head",
|
||||||
value: "",
|
value: "",
|
||||||
rules: [{ required: true, message: "请输入负责人" }],
|
rules: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: FormType.input,
|
type: FormType.input,
|
||||||
label: "部门电话",
|
label: "科室电话",
|
||||||
name: "phone",
|
name: "phone",
|
||||||
value: "",
|
value: "",
|
||||||
rules: [{ required: true, message: "请输入部门电话" }],
|
rules: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: FormType.input,
|
type: FormType.input,
|
||||||
label: "部门邮箱",
|
label: "科室邮箱",
|
||||||
name: "email",
|
name: "email",
|
||||||
value: "",
|
value: "",
|
||||||
rules: [{ required: true, message: "请输入部门邮箱" }],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: FormType.select,
|
|
||||||
label: "上级部门",
|
|
||||||
name: "p_id",
|
|
||||||
value: 0,
|
|
||||||
selectUrl: DepConfig.LIST,
|
|
||||||
keys: "dep_name",
|
|
||||||
rules: [],
|
rules: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: FormType.treeSelect,
|
type: FormType.treeSelect,
|
||||||
label: "所属单位",
|
label: "所属单位",
|
||||||
name: "company_id",
|
name: "company_identity",
|
||||||
value: 0,
|
value: 0,
|
||||||
selectUrl: CompanyConfig.LIST,
|
selectUrl: CompanyConfig.LIST,
|
||||||
keys: "name",
|
keys: "name",
|
||||||
|
|
@ -60,14 +51,15 @@ export const defaultConfig = [
|
||||||
|
|
||||||
export const columns: ColumnsType<UserDataType> = [
|
export const columns: ColumnsType<UserDataType> = [
|
||||||
{
|
{
|
||||||
title: "部门名称",
|
title: "科室名称",
|
||||||
dataIndex: "dep_name",
|
dataIndex: "dep_name",
|
||||||
width: 200,
|
width: 200,
|
||||||
fixed: "left",
|
fixed: "left",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "部门描述",
|
title: "科室描述",
|
||||||
dataIndex: "dep_desc",
|
dataIndex: "desc",
|
||||||
|
width: 200,
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -75,17 +67,12 @@ export const columns: ColumnsType<UserDataType> = [
|
||||||
dataIndex: "head",
|
dataIndex: "head",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "部门电话",
|
title: "科室电话",
|
||||||
width: 150,
|
width: 150,
|
||||||
dataIndex: "phone",
|
dataIndex: "phone",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "部门邮箱",
|
title: "科室邮箱",
|
||||||
width: 150,
|
|
||||||
dataIndex: "email",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "上级部门名称",
|
|
||||||
width: 150,
|
width: 150,
|
||||||
dataIndex: "email",
|
dataIndex: "email",
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ const Dep = (props: Store) => {
|
||||||
return (
|
return (
|
||||||
<div className="contentBox">
|
<div className="contentBox">
|
||||||
<BTable
|
<BTable
|
||||||
|
btnText="添加科室"
|
||||||
store={depStore}
|
store={depStore}
|
||||||
scroll={{ x: "max-content" }}
|
scroll={{ x: "max-content" }}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,49 @@
|
||||||
const Used = () => {
|
import { Button, Checkbox, message, Space } from "antd";
|
||||||
return <p>常用</p>
|
import { Store } from "antd/es/form/interface";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
const Used = (props: Store) => {
|
||||||
|
const { sourceStore, usrStore } = props;
|
||||||
|
const [coloums, setColumns] = useState<any>([]);
|
||||||
|
const [selectKey, setSelectKey] = useState<Array<string>>([]);
|
||||||
|
useEffect(() => {
|
||||||
|
sourceStore.getHead().then((res) => {
|
||||||
|
res.forEach((element) => {
|
||||||
|
element.dataIndex = element.identity;
|
||||||
|
element.title = element.data_name;
|
||||||
|
element.label = element.data_name;
|
||||||
|
element.value = element.identity;
|
||||||
|
element.editable = true;
|
||||||
|
});
|
||||||
|
setColumns(res);
|
||||||
|
});
|
||||||
|
getColumn()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const getColumn = async () => {
|
||||||
|
const res = await usrStore.getUsed()
|
||||||
|
const list: any = res?.map((element) => element.column_identity)
|
||||||
|
setSelectKey(list)
|
||||||
|
}
|
||||||
|
const save = async () => {
|
||||||
|
await usrStore.setUsed({ identitys: selectKey })
|
||||||
|
getColumn()
|
||||||
|
message.success("保存成功")
|
||||||
|
};
|
||||||
|
return <>
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Checkbox.Group
|
||||||
|
options={coloums}
|
||||||
|
defaultValue={selectKey}
|
||||||
|
value={selectKey}
|
||||||
|
onChange={(v) => {
|
||||||
|
setSelectKey(v);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Button onClick={save}>保存</Button>
|
||||||
|
</Space>
|
||||||
|
</>
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Used;
|
export default inject("sourceStore", "usrStore")(observer(Used));
|
||||||
|
|
@ -15,7 +15,7 @@ const Role = (props: Store) => {
|
||||||
return (
|
return (
|
||||||
<div className="contentBox">
|
<div className="contentBox">
|
||||||
<BTable
|
<BTable
|
||||||
btnText="添加职位"
|
btnText="添加角色"
|
||||||
store={roleStore}
|
store={roleStore}
|
||||||
scroll={{ x: "max-content" }}
|
scroll={{ x: "max-content" }}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,18 @@ import { ColumnsType } from "antd/lib/table";
|
||||||
export const defaultConfig = [
|
export const defaultConfig = [
|
||||||
{
|
{
|
||||||
type: FormType.input,
|
type: FormType.input,
|
||||||
label: "职位名称",
|
label: "角色名称",
|
||||||
name: "name",
|
name: "name",
|
||||||
value: "",
|
value: "",
|
||||||
rules: [{ required: true, message: "请输入职位名称!" }],
|
rules: [{ required: true, message: "请输入角色名称!" }],
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
type: FormType.input,
|
type: FormType.input,
|
||||||
label: "职位描述",
|
label: "角色描述",
|
||||||
name: "desc",
|
name: "desc",
|
||||||
value: "",
|
value: "",
|
||||||
rules: [{ required: true, message: "请输入职位描述" }],
|
rules: [{ required: true, message: "请输入角色描述" }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: FormType.select,
|
type: FormType.select,
|
||||||
|
|
@ -45,6 +45,7 @@ export const defaultConfig = [
|
||||||
name: "menu_id",
|
name: "menu_id",
|
||||||
selectUrl: MenuConfig.LIST,
|
selectUrl: MenuConfig.LIST,
|
||||||
value: "",
|
value: "",
|
||||||
|
treeMultiple:true,
|
||||||
rules: [{ required: true, message: "请选择菜单" }],
|
rules: [{ required: true, message: "请选择菜单" }],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -59,12 +60,12 @@ export const defaultConfig = [
|
||||||
|
|
||||||
export const columns: ColumnsType<UserDataType> = [
|
export const columns: ColumnsType<UserDataType> = [
|
||||||
{
|
{
|
||||||
title: "职位名称",
|
title: "角色名称",
|
||||||
dataIndex: "name",
|
dataIndex: "name",
|
||||||
fixed: "left",
|
fixed: "left",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "职位描述",
|
title: "角色描述",
|
||||||
dataIndex: "desc",
|
dataIndex: "desc",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ const Source = (props: Store) => {
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
const item = newData[index];
|
const item = newData[index];
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
let res = await sourceStore.modefyData(row, item.id_card);
|
let res = await sourceStore.modefyData(row, item.idcard_identity);
|
||||||
if (res) {
|
if (res) {
|
||||||
getContent(selectKey, 1);
|
getContent(selectKey, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +83,7 @@ const Source = (props: Store) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
sourceStore.geContent(list, index, 20).then((res) => {
|
sourceStore.geContent(list, index, 20).then((res) => {
|
||||||
res.forEach((element) => {
|
res.forEach((element) => {
|
||||||
element.key = element.identity;
|
element.key = JSON.stringify(element);
|
||||||
});
|
});
|
||||||
setContent(res);
|
setContent(res);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|
@ -103,7 +103,7 @@ const Source = (props: Store) => {
|
||||||
for (let i = 0; i < rowKeys.length; i++) {
|
for (let i = 0; i < rowKeys.length; i++) {
|
||||||
let obj = {};
|
let obj = {};
|
||||||
for (const key in rowKeys[i]) {
|
for (const key in rowKeys[i]) {
|
||||||
if (key.indexOf("dbs") > -1) {
|
if (key !== "idcard_identity" && key !== "key") {
|
||||||
obj[key] = rowKeys[i][key];
|
obj[key] = rowKeys[i][key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { Button, message, Upload, UploadProps } from "antd";
|
||||||
const Uploads = () => {
|
const Uploads = () => {
|
||||||
const props: UploadProps = {
|
const props: UploadProps = {
|
||||||
name: "file",
|
name: "file",
|
||||||
action: `http://127.0.0.1:12216/v1/public/fts/uploadFore`,
|
action: `http://127.0.0.1:12216/v1/public/fts/upload`,
|
||||||
headers: {
|
headers: {
|
||||||
authorization: window.localStorage.getItem("token")??''
|
authorization: window.localStorage.getItem("token")??''
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ export const defaultConfig = [
|
||||||
label: "联系电话",
|
label: "联系电话",
|
||||||
name: "tel",
|
name: "tel",
|
||||||
value: "",
|
value: "",
|
||||||
|
rule:[{ required: true, message: "联系电话不能为空" }]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: FormType.input,
|
type: FormType.input,
|
||||||
|
|
@ -45,7 +46,7 @@ export const defaultConfig = [
|
||||||
selectUrl: DepConfig.LIST,
|
selectUrl: DepConfig.LIST,
|
||||||
keys: "dep_name",
|
keys: "dep_name",
|
||||||
value: "",
|
value: "",
|
||||||
rules: [{ required: true, message: "所属部门不能为空" }],
|
rules: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: FormType.treeSelect,
|
type: FormType.treeSelect,
|
||||||
|
|
@ -125,5 +126,8 @@ export const columns: ColumnsType<UserDataType> = [
|
||||||
{
|
{
|
||||||
title: "角色",
|
title: "角色",
|
||||||
dataIndex: "",
|
dataIndex: "",
|
||||||
|
render: (render) => (
|
||||||
|
<span>{render.role[0]?.name}</span>
|
||||||
|
),
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,292 @@
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
Checkbox,
|
||||||
|
Drawer,
|
||||||
|
Form,
|
||||||
|
FormInstance,
|
||||||
|
Input,
|
||||||
|
message,
|
||||||
|
Modal,
|
||||||
|
PaginationProps,
|
||||||
|
Popconfirm,
|
||||||
|
Space,
|
||||||
|
Table,
|
||||||
|
Typography,
|
||||||
|
Upload,
|
||||||
|
} from "antd";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { DataType } from "@/util/model/interface";
|
||||||
|
import toExcel from "@/util/xmsx";
|
||||||
|
import React from "react";
|
||||||
|
import Things from "../source/things";
|
||||||
|
import Share from "../source/share";
|
||||||
|
|
||||||
|
const Work = (props: Store) => {
|
||||||
|
const { sourceStore, usrStore } = props;
|
||||||
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
|
const [form] = Form.useForm();
|
||||||
|
const [coloums, setColumns] = useState<any>([]);
|
||||||
|
const [record, setRecord] = useState<any>(null);
|
||||||
|
const [content, setContent] = useState([]);
|
||||||
|
const [selectKey, setSelectKey] = useState<Array<string>>([]);
|
||||||
|
const [page, setPage] = useState<number>(1);
|
||||||
|
const [editingKey, setEditingKey] = useState("");
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [selectedRowKeys, setSelectedRowKeys] = useState<React.Key[]>([]);
|
||||||
|
const [rowKeys, setRowKeys] = useState<any[]>([]);
|
||||||
|
const isEditing = (record) => record.key === editingKey;
|
||||||
|
const [open, setOpen] = useState<boolean>(false);
|
||||||
|
const [shareOpen, setShareOpen] = useState<boolean>(false);
|
||||||
|
|
||||||
|
const edit = (record: any) => {
|
||||||
|
form.setFieldsValue({ ...record });
|
||||||
|
setEditingKey(record.key);
|
||||||
|
};
|
||||||
|
// 获取列表数据
|
||||||
|
useEffect(() => {
|
||||||
|
usrStore.getUsed().then((res) => {
|
||||||
|
res.forEach((element) => {
|
||||||
|
element.dataIndex = element.column_identity;
|
||||||
|
element.title = element.head.data_name;
|
||||||
|
element.label = element.head.data_name;
|
||||||
|
element.value = element.column_identity;
|
||||||
|
element.editable = true;
|
||||||
|
});
|
||||||
|
setColumns(res);
|
||||||
|
})
|
||||||
|
getContent([], 1);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [sourceStore]);
|
||||||
|
const save = async (key: React.Key) => {
|
||||||
|
try {
|
||||||
|
const row = (await form.validateFields()) as DataType;
|
||||||
|
const newData: any = [...content];
|
||||||
|
const index = newData.findIndex((item: any) => key === item.key);
|
||||||
|
if (index > -1) {
|
||||||
|
const item = newData[index];
|
||||||
|
setLoading(true);
|
||||||
|
let res = await sourceStore.modefyData(row, item.idcard_identity);
|
||||||
|
if (res) {
|
||||||
|
getContent(selectKey, 1);
|
||||||
|
}
|
||||||
|
setLoading(false);
|
||||||
|
setEditingKey("");
|
||||||
|
}
|
||||||
|
} catch (errInfo) {
|
||||||
|
console.log("Validate Failed:", errInfo);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const getContent = (list, index) => {
|
||||||
|
setLoading(true);
|
||||||
|
sourceStore.geContent(list, index, 20).then((res) => {
|
||||||
|
res.forEach((element) => {
|
||||||
|
element.key = JSON.stringify(element);
|
||||||
|
});
|
||||||
|
setContent(res);
|
||||||
|
setLoading(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
const getHead = () => {
|
||||||
|
let head = coloums.filter((value) => selectKey.includes(value.identity));
|
||||||
|
return head;
|
||||||
|
};
|
||||||
|
|
||||||
|
const saveClo = () => {
|
||||||
|
let list: any = [];
|
||||||
|
if (rowKeys.length === 0) {
|
||||||
|
message.info("请选择需要导出的列");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < rowKeys.length; i++) {
|
||||||
|
let obj = {};
|
||||||
|
for (const key in rowKeys[i]) {
|
||||||
|
if (key !== "idcard_identity" && key !== "key") {
|
||||||
|
obj[key] = rowKeys[i][key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.push(obj);
|
||||||
|
}
|
||||||
|
toExcel(getHead(), list, "test.xlsx", "Sheet1");
|
||||||
|
};
|
||||||
|
const cancel = () => {
|
||||||
|
setEditingKey("");
|
||||||
|
};
|
||||||
|
interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
|
||||||
|
editing: boolean;
|
||||||
|
dataIndex: string;
|
||||||
|
fixed: string;
|
||||||
|
index: number;
|
||||||
|
}
|
||||||
|
const actionCloumn = {
|
||||||
|
title: "操作",
|
||||||
|
with: 200,
|
||||||
|
fixed: "right",
|
||||||
|
render: (_: any, record) => {
|
||||||
|
const editable = isEditing(record);
|
||||||
|
return editable ? (
|
||||||
|
<span>
|
||||||
|
<Typography.Link
|
||||||
|
onClick={() => {
|
||||||
|
save(record.key);
|
||||||
|
}}
|
||||||
|
style={{ marginInlineEnd: 8 }}
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</Typography.Link>
|
||||||
|
<Popconfirm title="Sure to cancel?" onConfirm={cancel}>
|
||||||
|
取消
|
||||||
|
</Popconfirm>
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<Space>
|
||||||
|
<Typography.Link
|
||||||
|
disabled={editingKey !== ""}
|
||||||
|
onClick={() => edit(record)}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Typography.Link>
|
||||||
|
<Typography.Link onClick={() => {
|
||||||
|
setRecord(record)
|
||||||
|
setOpen(true)
|
||||||
|
}}>
|
||||||
|
查看事件
|
||||||
|
</Typography.Link>
|
||||||
|
<Typography.Link onClick={() => {
|
||||||
|
setRecord(record)
|
||||||
|
setShareOpen(true)
|
||||||
|
}
|
||||||
|
}>
|
||||||
|
分享
|
||||||
|
</Typography.Link>
|
||||||
|
</Space>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const EditableCell: React.FC<React.PropsWithChildren<EditableCellProps>> = ({
|
||||||
|
editing,
|
||||||
|
dataIndex,
|
||||||
|
children,
|
||||||
|
...restProps
|
||||||
|
}) => {
|
||||||
|
const inputNode = <Input />;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<td {...restProps}>
|
||||||
|
{editing ? (
|
||||||
|
<Form.Item name={dataIndex} style={{ margin: 0 }}>
|
||||||
|
{inputNode}
|
||||||
|
</Form.Item>
|
||||||
|
) : (
|
||||||
|
children
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const mergedColumns = coloums.map((col) => {
|
||||||
|
if (!col.editable) {
|
||||||
|
return col;
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
...col,
|
||||||
|
onCell: (record: DataType) => ({
|
||||||
|
record,
|
||||||
|
dataIndex: col.dataIndex,
|
||||||
|
title: col.title,
|
||||||
|
editing: isEditing(record),
|
||||||
|
}),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
const onChange: PaginationProps["onChange"] = (page) => {
|
||||||
|
setPage(page);
|
||||||
|
getContent(selectKey, page);
|
||||||
|
cancel();
|
||||||
|
};
|
||||||
|
const rowSelection = {
|
||||||
|
selectedRowKeys,
|
||||||
|
preserveSelectedRowKeys: true,
|
||||||
|
fixed: true,
|
||||||
|
onChange: (keys, rowKeys, info) => {
|
||||||
|
setSelectedRowKeys(keys);
|
||||||
|
setRowKeys(rowKeys);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Upload />
|
||||||
|
<Space>
|
||||||
|
<Checkbox.Group
|
||||||
|
options={coloums}
|
||||||
|
defaultValue={selectKey}
|
||||||
|
onChange={(v) => {
|
||||||
|
setSelectKey(v);
|
||||||
|
getContent(v, 1);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Button onClick={saveClo}>导出</Button>
|
||||||
|
</Space>
|
||||||
|
|
||||||
|
<Form form={form} component={false}>
|
||||||
|
<Table
|
||||||
|
loading={loading}
|
||||||
|
scroll={{ x: "max-content", scrollToFirstRowOnChange: true }}
|
||||||
|
components={{
|
||||||
|
body: { cell: EditableCell },
|
||||||
|
}}
|
||||||
|
bordered
|
||||||
|
rowSelection={rowSelection}
|
||||||
|
dataSource={content}
|
||||||
|
columns={[...mergedColumns, actionCloumn]}
|
||||||
|
rowClassName="editable-row"
|
||||||
|
pagination={{
|
||||||
|
onChange: onChange,
|
||||||
|
total: sourceStore.total,
|
||||||
|
current: page,
|
||||||
|
pageSize: 20,
|
||||||
|
showSizeChanger: false,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form>
|
||||||
|
</Space>
|
||||||
|
|
||||||
|
<Drawer
|
||||||
|
closable
|
||||||
|
title="事件"
|
||||||
|
placement="right"
|
||||||
|
open={open}
|
||||||
|
loading={loading}
|
||||||
|
onClose={() => setOpen(false)}
|
||||||
|
>
|
||||||
|
<Things id={record?.idcard_identity} />
|
||||||
|
</Drawer>
|
||||||
|
<Modal
|
||||||
|
open={shareOpen}
|
||||||
|
title="分享"
|
||||||
|
onOk={() => {
|
||||||
|
formRef.current?.submit()
|
||||||
|
}}
|
||||||
|
onCancel={() => { setShareOpen(false) }}
|
||||||
|
>
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("sourceStore", "usrStore")(observer(Work));
|
||||||
|
|
@ -11,6 +11,7 @@ import Dep from "@/pages/dep";
|
||||||
import Company from "@/pages/company";
|
import Company from "@/pages/company";
|
||||||
import Event from "@/pages/event";
|
import Event from "@/pages/event";
|
||||||
import { My } from "@/pages/my";
|
import { My } from "@/pages/my";
|
||||||
|
import Work from "@/pages/work";
|
||||||
|
|
||||||
const routers = createHashRouter([
|
const routers = createHashRouter([
|
||||||
{
|
{
|
||||||
|
|
@ -27,6 +28,11 @@ const routers = createHashRouter([
|
||||||
index: true,
|
index: true,
|
||||||
element: <User />,
|
element: <User />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/work/list",
|
||||||
|
index: true,
|
||||||
|
element: <Work />,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/source/list",
|
path: "/source/list",
|
||||||
index: true,
|
index: true,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
class Config {
|
class Config {
|
||||||
static baseUrl = "https://hj.quwanya.cn/v1"
|
static baseUrl = ""
|
||||||
}
|
}
|
||||||
export default Config;
|
export default Config;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue