Browse Source

模块提交

master
xingyongchun 2 years ago
parent
commit
da6f991838
  1. 4
      web/client/src/app.js
  2. 2
      web/client/src/index.js
  3. 2
      web/client/src/layout/components/header/index.js
  4. 16
      web/client/src/layout/containers/layout/index.js
  5. 163
      web/client/src/sections/article/components/import_model.js
  6. 96
      web/client/src/sections/article/components/modeal.js
  7. 61
      web/client/src/sections/article/containers/index.js
  8. 2
      web/client/src/sections/article/index.js
  9. 4
      web/client/src/sections/index.js
  10. 64
      web/client/src/sections/personnel/actions/article.js
  11. 9
      web/client/src/sections/personnel/actions/index.js
  12. 163
      web/client/src/sections/personnel/components/import_model.js
  13. 96
      web/client/src/sections/personnel/components/modeal.js
  14. 186
      web/client/src/sections/personnel/containers/index.js
  15. 13
      web/client/src/sections/personnel/index.js
  16. 14
      web/client/src/sections/personnel/nav-item.js
  17. 19
      web/client/src/sections/personnel/reducers/index.js
  18. 12
      web/client/src/sections/personnel/routes.js
  19. 2
      web/client/src/themes/light.json

4
web/client/src/app.js

@ -1,6 +1,6 @@
import React, { useEffect } from 'react';
import {
Auth, AlarmConfure, Article, Party
Auth, AlarmConfure, Article, Party,Personnel
} from './sections';
import Layout from './layout';
@ -19,7 +19,7 @@ function App(props) {
return (
<Layout
title={projectName}
sections={[Auth, AlarmConfure, Article, Party]}
sections={[Auth, AlarmConfure, Article,Personnel, Party,]}
/>
);
}

2
web/client/src/index.js

@ -4,4 +4,4 @@ import {
} from 'react-dom';
import App from './app';
render((<App projectName="飞尚智慧党工综合服务平台" />), document.getElementById('App'));
render((<App projectName="飞尚研发看板平台" />), document.getElementById('App'));

2
web/client/src/layout/components/header/index.js

@ -61,7 +61,7 @@ function Header(props) {
<div className="header-title" style={{}}>
{/* <img style={{ width: 30, height: 30 }} src="/assets/images/logo.png" /> */}
<span style={{ marginLeft: 10 }}>
党建工会后台管理
研发看板后台管理
</span>
</div>

16
web/client/src/layout/containers/layout/index.js

@ -48,13 +48,12 @@ function LayoutContainer(props) {
// 根据登录验证,如果尚未登录,则不可跳转/article
useEffect(() => {
const { pathname } = location;
const rightList = ['/article'];
const rightList = ["/article"];
if (rightList.every((path) => pathname.indexOf(path) == -1)) {
if (!sessionStorage.getItem("user")) {
dispatch(push("/article"));
// if (!sessionStorage.getItem("user")) {
// dispatch(push("/article"));
// }
}
}
}, [location]);
const [themeName, setThemeName] = useState(
localStorage.getItem("theme-name") || "light"
@ -231,9 +230,4 @@ function mapStateToProps(state) {
export default connect(mapStateToProps)(LayoutContainer);
var pathList = [
'/article',
'/party',
'/organization'
];
var pathList = ["/article", "/party", "/organization", "/personnel"];

163
web/client/src/sections/article/components/import_model.js

@ -0,0 +1,163 @@
/*
* @description :
* @Date : 2021-04-07 14:39:33
* @FilePath : \web\client\src\sections\user\components\userManagement\importUser.js
* @useStrict : use strict
*/
'use strict';
import React, { useState } from 'react';
import { connect } from 'react-redux';
import { Button, Input, Card, Modal, Upload, message } from 'antd';
import { Request } from '@peace/utils'
import request from 'superagent'
import XLSX from 'xlsx'
// import { userBulkAdd } from '../../actions'
//TODO 下载模板和上传文件读取
const ImportUser = props => {
const { user, dispatch, handleCancel, params,editData } = props
const [msg, setMsg] = useState('')
const [loading, setLoading] = useState('')
const [postData, setPostData] = useState([])
const confirm = () => {
if (postData.length) {
setLoading(true)
// dispatch(userBulkAdd(postData, params.departmentId ? params.departmentId : null)).then(res => {
// if (res.success) {
// }
// setLoading(false)
// })
} else {
message.warn('没有数据可以提交,请上传数据文件')
}
}
return (
<Modal
visible={props.importVisible}
onOk={confirm}
confirmLoading={loading}
onCancel={() => {
setMsg('')
setLoading(false)
setPostData([])
handleCancel()
}}
destroyOnClose
>
{/* <Button size="small" type='primary' onClick={() => {
Request.get(`attachments?src=upload/files/1.jpg&filename=${encodeURIComponent('1.jpg')}&token=${user.token}`).then(res => {
})
}}>下载模板</Button> */}
<a href={'/_api/' + `attachments?src=files/用户信息导入模板.xlsx&filename=${encodeURIComponent('用户信息导入模板.xlsx')}&token=${user.token}`} >
<Button size="small" type='primary' >下载模板</Button>
</a>
<div style={{ marginTop: 10 }}>下载模板后填写完整后上传</div>
<div style={{ marginTop: 10 }}>
<Upload {...{
name: 'user_d',
action: '/',
maxCount: 1,
showUploadList: {
showRemoveIcon: false
},
beforeUpload: (file) => {
setMsg('')
setPostData([])
const extNames = file.name.split('.');
let isDAE = false;
if (extNames.length > 0) {
let fileType = extNames[extNames.length - 1].toLowerCase();
isDAE = ['xlsx', 'xls'].some((f) => f == fileType);
}
if (!isDAE) {
setMsg(`只能上传 ${['xlsx', 'xls'].join()} 格式的文件!`);
return false;
}
},
onChange(info) {
},
customRequest: async (data) => {
const { file, onSuccess, onError } = data
const reader = new FileReader(); // 使用 FileReader 读取数据
reader.onload = function (e) { // 数据读取完成后的回调函数
const data = new Uint8Array(e.target.result);
const workbook = XLSX.read(data, { type: 'array' }); // workbook 是 xlsx 解析 excel 后返回的对象
const firstSheetName = workbook.SheetNames[0]; // 获取第一个 sheet 的名字
const worksheet = workbook.Sheets[firstSheetName]; // 获取第一个 sheet 的内容
const res = XLSX.utils.sheet_to_json(worksheet); // 使用 utils 里的方法转换内容为便于使用的数组
const error = (msg) => {
setMsg(msg)
onError({ message: msg })
}
if (res.length > 1000) {
error('一次性上传数据行数应小于1000行,请分批上传')
return
}
if (!res.length) {
error('请填写至少一行数据')
return
}
let postData = []
const pattern = /^1[3|4|5|6|7|8|9]\d{9}$/
for (let i = 0; i < res.length; i++) {
let d = res[i]
let name = String(d['姓名']).trim();
let phone = String(d['手机号码']).trim();
let account = String(d['账号']).trim();
let peopleCode = d['人员编号'] && String(d['人员编号']).trim();
if (!name || !phone || !account || !peopleCode) {
error(`${i + 1} 行有空值,请填写后重新上传`)
return
}
if (!pattern.test(phone)) {
error(`${i + 1} 行手机号码错误`)
return
}
if (name.length > 128 || account.length > 128) {
error(`${i + 1} 行数据字符长度大于 128,请更改后重新上传`)
return
}
if (postData.some(p => p.account == account)) {
error(`${i + 1} 行账号重复,请更改后重新上传`)
return
}
postData.push({
name, phone, account, peopleCode
})
}
if (postData.length) {
setPostData(postData)
}
let msg = '文件解析完成,点击确定按钮上传保存!'
setMsg(msg)
onSuccess({ message: msg })
};
reader.readAsArrayBuffer(file); // 读取数据
},
}}>
<Button>上传文件</Button>
</Upload>
<br />
<span>{msg}</span>
</div>
</Modal >
)
}
function mapStateToProps(state) {
const { auth, customizeList } = state;
return {
user: auth.user,
}
}
export default connect(mapStateToProps)(ImportUser);

96
web/client/src/sections/article/components/modeal.js

@ -0,0 +1,96 @@
import React,{useState,useEffect} from 'react'
import { Modal, Form, Input, Button,DatePicker,Select } from 'antd'
import dayjs from 'dayjs';
function modeal(props) {
const [form] = Form.useForm();
const { visible, handleOk, handleCancel, editData } = props
console.log(editData)
useEffect(() => {
if (editData && visible) {
form.setFieldsValue({
name_project: editData.name_project,
part_people: editData.part_people,
build_time: dayjs(editData?.build_time),
publish_time: dayjs(editData.publish_time),
progress:editData.progress
})
}
}, [editData, visible])
return (
<Modal
visible={visible}
onCancel={handleCancel}
footer={null}
title="研发看板项目编辑"
>
<Form
name="basic"
labelAlign="left"
form={form}
onFinish={handleOk}
autoComplete="off"
>
<Form.Item
label="项目计划"
name="name_project"
rules={[{ required: true, message: '请输入项目计划' }]}
>
<Input/>
</Form.Item>
<Form.Item
label="投入人力"
name="part_people"
rules={[{ required: true, message: '请输入人员姓名' }]}
>
<Input/>
</Form.Item>
<Form.Item
label="构建时间"
name="build_time"
rules={[{ required: true, message: '请选择时间' }]}
>
<DatePicker />
</Form.Item>
<Form.Item
label="发布时间"
name="publish_time"
rules={[{ required: true, message: '请选择时间' }]}
>
<DatePicker />
</Form.Item>
<Form.Item
label="目前进度"
name="progress"
rules={[{ required: true, message: '请选择进度' }]}
>
<Select><Select.Option value="需求评审中">需求评审中</Select.Option>
<Select.Option value="研发中">研发中</Select.Option>
<Select.Option value="测试中">测试中</Select.Option>
<Select.Option value="已发布">已发布</Select.Option>
</Select>
</Form.Item>
<Form.Item noStyle={true}>
<div style={{
padding: '12px 0',
width: '100%',
textAlign: 'right',
}}>
<Button
style={{ marginRight: 16, width: 88 }}
onClick={handleCancel}
>取消</Button>
<Button
htmlType="submit"
type="primary"
style={{ marginRight: 16, width: 88 }}
// onClick={() => handleOk(form)}
>确定</Button>
</div>
</Form.Item>
</Form>
</Modal>
)
}
export default modeal

61
web/client/src/sections/article/containers/index.js

@ -7,6 +7,8 @@ import Action from "../actions/index";
import moment from "moment";
import { push } from "react-router-redux";
import { Scroller } from "$components";
import ProjectModeal from '../components/modeal'
import ImportModeal from '../components/import_model'
export const Default = (props) => {
const { dispatch } = props;
@ -14,60 +16,56 @@ export const Default = (props) => {
const [state, setState] = useState(); //状态
const [day, setDay] = useState(); //发布时间
const [counts, setCounts] = useState(); //数据
const [visible, setVisible] = useState(false); //弹窗
const [editData, setEditData] = useState(); //数据
const [importVisible, setImportVisible] = useState(false); //弹窗
const tableActionRef = useRef();
const dataSore = [{ name_project: '企服v1.0.1', part_people: '投入研发3、测试1', build_time: new Date( ), publish_time: new Date( ), progress: '研发中' }]
const columns = [
{
title: "项目计划",
dataIndex: "name",
key: "name",
dataIndex: "name_project",
key: "name_project",
hideInSearch: true,
render: (dom, record) => {
return record.title;
return record.name_project;
},
},
{
title: "投入人力",
key: "category",
dataIndex: "category",
dataIndex: "part_people",
hideInSearch: true,
render: (dom, record) => {
return record.type === 0
? "活动风采"
: record.type === 1
? "党建资讯"
: "工会资讯";
return record.part_people
},
},
{
title: "构建时间",
key: "since",
dataIndex: "createdAt",
key: "build_time",
dataIndex: "build_time",
hideInSearch: true,
render: (dom, record) => {
return record.publisher === null ? "SuperAdmin" : record.publisher;
return moment(record.build_time).format('YYYY-MM-DD')
},
},
{
title: "发布时间",
key: "dateRange",
dataIndex: "createdAtRange",
key: "publish_time",
dataIndex: "publish_time",
hideInSearch: true,
render: (dom, record) => {
return record.publisher === null ? "SuperAdmin" : record.publisher;
return moment(record.publish_time).format('YYYY-MM-DD')
},
},
{
title: "目前进度",
dataIndex: "regionName",
valueType: "select",
dataIndex: "progress",
hideInSearch: true,
order: 3,
render: (dom, record) => {
return record.status === 0
? "草稿"
: record.status === 1
? "已发布"
: "已撤回";
return record.progress
},
},
{
@ -110,7 +108,7 @@ export const Default = (props) => {
type="primary"
style={{ width: "200px" }}
onClick={() => {
dispatch(push(`article/update/post`));
setImportVisible(true)
}}
>
项目信息导入
@ -119,6 +117,15 @@ export const Default = (props) => {
},
},
];
const handleCancel = () => {
setVisible(false)
}
const handOk = () => {
}
const importHandleCancel = () => {
setImportVisible(false)
}
//删除资讯
const delDataList = (ids, type) => {
dispatch(Action.delDataList(ids)).then((res) => {
@ -130,8 +137,8 @@ export const Default = (props) => {
};
//编辑
const editor = (record) => {
dispatch(push(`article/update/put`));
localStorage.setItem("modifyData", JSON.stringify(record));
setVisible(true)
setEditData(record)
};
return (
<div style={{ height: "100%" }}>
@ -140,7 +147,7 @@ export const Default = (props) => {
actionRef={tableActionRef}
columns={columns}
options={false}
dataSource={(counts || {}).data || []}
dataSource={dataSore}
search={{
optionRender: false,
collapsed: false,
@ -173,6 +180,8 @@ export const Default = (props) => {
}}
/>
</Scroller>
<ProjectModeal visible={visible} handleOk={handOk} editData={editData} handleCancel={handleCancel}></ProjectModeal>
<ImportModeal importVisible={importVisible} handleCancel={importHandleCancel} editData={editData}></ImportModeal>
</div>
);
};

2
web/client/src/sections/article/index.js

@ -5,7 +5,7 @@ import nativeItem from './nav-item';
export default {
key: 'article',
name: '资讯管理',
name: '项目信息',
reducers,
routes,
actions,

4
web/client/src/sections/index.js

@ -2,6 +2,8 @@ import Auth from './auth';
import AlarmConfure from './homePage';
import Article from './article'
import Party from './party'
import Personnel from './personnel'
export {
Auth, AlarmConfure, Article, Party
Auth, AlarmConfure, Article, Party,Personnel
};

64
web/client/src/sections/personnel/actions/article.js

@ -0,0 +1,64 @@
"use strict";
import { ApiTable } from "$utils";
import { Request } from "@peace/utils";
import { basicAction } from "@peace/utils";
export function addArticle(articleObj) {
return (dispatch) =>
basicAction({
type: "post",
dispatch: dispatch,
data: articleObj,
actionType: "ADD_ARTICLE",
url: `${ApiTable.addArticle}`,
msg: { error: "新增文章失败" },
reducer: { name: "articleInsertInfo" },
});
}
export function editArticle(articleObj) {
return (dispatch) =>
basicAction({
type: "put",
dispatch: dispatch,
data: articleObj,
actionType: "EDIT_ARTICLE",
url: `${ApiTable.addArticle}`,
msg: { error: "编辑文章失败" },
reducer: { name: "articleInsertInfo" },
});
}
export function getDataList(query) {
return (dispatch) =>
basicAction({
type: "get",
dispatch: dispatch,
actionType: "GET_DATALIST",
url: ApiTable.getDataList,
query: query,
msg: { error: "获取文章信息失败" },
reducer: {
name: "articlesfrom",
},
});
}
export function delDataList(id) {
return (dispatch) =>
basicAction({
type: "del",
dispatch: dispatch,
actionType: "DEL_DATALIST11",
url: ApiTable.delDataList + `?id=${id}`,
query: { id: id },
msg: { error: "删除文章信息失败" },
});
}
export const MODIFYARTICAL = {
REQUEST_SUCCESS: "MODIFY_ARTICAL_SUCCESS",
};
export function setModifyData(data) {
return (dispatch) => {
dispatch({ type: MODIFYARTICAL.REQUEST_SUCCESS, payload: { data } });
};
}

9
web/client/src/sections/personnel/actions/index.js

@ -0,0 +1,9 @@
"use strict";
import { addArticle, editArticle, getDataList, delDataList } from "./article";
export default {
addArticle,
editArticle,
getDataList,
delDataList,
};

163
web/client/src/sections/personnel/components/import_model.js

@ -0,0 +1,163 @@
/*
* @description :
* @Date : 2021-04-07 14:39:33
* @FilePath : \web\client\src\sections\user\components\userManagement\importUser.js
* @useStrict : use strict
*/
'use strict';
import React, { useState } from 'react';
import { connect } from 'react-redux';
import { Button, Input, Card, Modal, Upload, message } from 'antd';
import { Request } from '@peace/utils'
import request from 'superagent'
import XLSX from 'xlsx'
// import { userBulkAdd } from '../../actions'
//TODO 下载模板和上传文件读取
const ImportUser = props => {
const { user, dispatch, handleCancel, params,editData } = props
const [msg, setMsg] = useState('')
const [loading, setLoading] = useState('')
const [postData, setPostData] = useState([])
const confirm = () => {
if (postData.length) {
setLoading(true)
// dispatch(userBulkAdd(postData, params.departmentId ? params.departmentId : null)).then(res => {
// if (res.success) {
// }
// setLoading(false)
// })
} else {
message.warn('没有数据可以提交,请上传数据文件')
}
}
return (
<Modal
visible={props.importVisible}
onOk={confirm}
confirmLoading={loading}
onCancel={() => {
setMsg('')
setLoading(false)
setPostData([])
handleCancel()
}}
destroyOnClose
>
{/* <Button size="small" type='primary' onClick={() => {
Request.get(`attachments?src=upload/files/1.jpg&filename=${encodeURIComponent('1.jpg')}&token=${user.token}`).then(res => {
})
}}>下载模板</Button> */}
<a href={'/_api/' + `attachments?src=files/用户信息导入模板.xlsx&filename=${encodeURIComponent('用户信息导入模板.xlsx')}&token=${user.token}`} >
<Button size="small" type='primary' >下载模板</Button>
</a>
<div style={{ marginTop: 10 }}>下载模板后填写完整后上传</div>
<div style={{ marginTop: 10 }}>
<Upload {...{
name: 'user_d',
action: '/',
maxCount: 1,
showUploadList: {
showRemoveIcon: false
},
beforeUpload: (file) => {
setMsg('')
setPostData([])
const extNames = file.name.split('.');
let isDAE = false;
if (extNames.length > 0) {
let fileType = extNames[extNames.length - 1].toLowerCase();
isDAE = ['xlsx', 'xls'].some((f) => f == fileType);
}
if (!isDAE) {
setMsg(`只能上传 ${['xlsx', 'xls'].join()} 格式的文件!`);
return false;
}
},
onChange(info) {
},
customRequest: async (data) => {
const { file, onSuccess, onError } = data
const reader = new FileReader(); // 使用 FileReader 读取数据
reader.onload = function (e) { // 数据读取完成后的回调函数
const data = new Uint8Array(e.target.result);
const workbook = XLSX.read(data, { type: 'array' }); // workbook 是 xlsx 解析 excel 后返回的对象
const firstSheetName = workbook.SheetNames[0]; // 获取第一个 sheet 的名字
const worksheet = workbook.Sheets[firstSheetName]; // 获取第一个 sheet 的内容
const res = XLSX.utils.sheet_to_json(worksheet); // 使用 utils 里的方法转换内容为便于使用的数组
const error = (msg) => {
setMsg(msg)
onError({ message: msg })
}
if (res.length > 1000) {
error('一次性上传数据行数应小于1000行,请分批上传')
return
}
if (!res.length) {
error('请填写至少一行数据')
return
}
let postData = []
const pattern = /^1[3|4|5|6|7|8|9]\d{9}$/
for (let i = 0; i < res.length; i++) {
let d = res[i]
let name = String(d['姓名']).trim();
let phone = String(d['手机号码']).trim();
let account = String(d['账号']).trim();
let peopleCode = d['人员编号'] && String(d['人员编号']).trim();
if (!name || !phone || !account || !peopleCode) {
error(`${i + 1} 行有空值,请填写后重新上传`)
return
}
if (!pattern.test(phone)) {
error(`${i + 1} 行手机号码错误`)
return
}
if (name.length > 128 || account.length > 128) {
error(`${i + 1} 行数据字符长度大于 128,请更改后重新上传`)
return
}
if (postData.some(p => p.account == account)) {
error(`${i + 1} 行账号重复,请更改后重新上传`)
return
}
postData.push({
name, phone, account, peopleCode
})
}
if (postData.length) {
setPostData(postData)
}
let msg = '文件解析完成,点击确定按钮上传保存!'
setMsg(msg)
onSuccess({ message: msg })
};
reader.readAsArrayBuffer(file); // 读取数据
},
}}>
<Button>上传文件</Button>
</Upload>
<br />
<span>{msg}</span>
</div>
</Modal >
)
}
function mapStateToProps(state) {
const { auth, customizeList } = state;
return {
user: auth.user,
}
}
export default connect(mapStateToProps)(ImportUser);

96
web/client/src/sections/personnel/components/modeal.js

@ -0,0 +1,96 @@
import React,{useState,useEffect} from 'react'
import { Modal, Form, Input, Button,DatePicker,Select } from 'antd'
import dayjs from 'dayjs';
function modeal(props) {
const [form] = Form.useForm();
const { visible, handleOk, handleCancel, editData } = props
console.log(editData)
useEffect(() => {
if (editData && visible) {
form.setFieldsValue({
name_project: editData.name_project,
part_people: editData.part_people,
build_time: dayjs(editData?.build_time),
publish_time: dayjs(editData.publish_time),
progress:editData.progress
})
}
}, [editData, visible])
return (
<Modal
visible={visible}
onCancel={handleCancel}
footer={null}
title="研发看板项目编辑"
>
<Form
name="basic"
labelAlign="left"
form={form}
onFinish={handleOk}
autoComplete="off"
>
<Form.Item
label="项目计划"
name="name_project"
rules={[{ required: true, message: '请输入项目计划' }]}
>
<Input/>
</Form.Item>
<Form.Item
label="投入人力"
name="part_people"
rules={[{ required: true, message: '请输入人员姓名' }]}
>
<Input/>
</Form.Item>
<Form.Item
label="构建时间"
name="build_time"
rules={[{ required: true, message: '请选择时间' }]}
>
<DatePicker />
</Form.Item>
<Form.Item
label="发布时间"
name="publish_time"
rules={[{ required: true, message: '请选择时间' }]}
>
<DatePicker />
</Form.Item>
<Form.Item
label="目前进度"
name="progress"
rules={[{ required: true, message: '请选择进度' }]}
>
<Select><Select.Option value="需求评审中">需求评审中</Select.Option>
<Select.Option value="研发中">研发中</Select.Option>
<Select.Option value="测试中">测试中</Select.Option>
<Select.Option value="已发布">已发布</Select.Option>
</Select>
</Form.Item>
<Form.Item noStyle={true}>
<div style={{
padding: '12px 0',
width: '100%',
textAlign: 'right',
}}>
<Button
style={{ marginRight: 16, width: 88 }}
onClick={handleCancel}
>取消</Button>
<Button
htmlType="submit"
type="primary"
style={{ marginRight: 16, width: 88 }}
// onClick={() => handleOk(form)}
>确定</Button>
</div>
</Form.Item>
</Form>
</Modal>
)
}
export default modeal

186
web/client/src/sections/personnel/containers/index.js

@ -0,0 +1,186 @@
import PropTypes from "prop-types";
import React, { useEffect, useState, useRef } from "react";
import { connect } from "react-redux";
import { Button, Popconfirm } from "antd";
import ProTable from "@ant-design/pro-table";
import Action from "../actions/index";
import moment from "moment";
import { push } from "react-router-redux";
import { Scroller } from "$components";
import ProjectModeal from '../components/modeal'
import ImportModeal from '../components/import_model'
export const Default = (props) => {
const { dispatch } = props;
const [heading, setHeading] = useState(); //标题
const [state, setState] = useState(); //状态
const [day, setDay] = useState(); //发布时间
const [counts, setCounts] = useState(); //数据
const [visible, setVisible] = useState(false); //弹窗
const [editData, setEditData] = useState(); //数据
const [importVisible, setImportVisible] = useState(false); //弹窗
const tableActionRef = useRef();
const dataSore = [{ name_project: '企服v1.0.1', part_people: '投入研发3、测试1', build_time: new Date( ), publish_time: new Date( ), progress: '研发中' }]
const columns = [
{
title: "人员姓名",
dataIndex: "name_project",
key: "name_project",
hideInSearch: true,
render: (dom, record) => {
return record.name_project;
},
},
{
title: "岗位",
key: "category",
dataIndex: "part_people",
hideInSearch: true,
render: (dom, record) => {
return record.part_people
},
},
{
title: "本周工作计划",
key: "build_time",
dataIndex: "build_time",
hideInSearch: true,
render: (dom, record) => {
return moment(record.build_time).format('YYYY-MM-DD')
},
},
{
title: "操作",
key: "since",
dataIndex: "createdAt",
valueType: "dateTime",
hideInSearch: true,
render: (dom, record) => {
return (
<div>
<a
onClick={() => {
editor(record);
}}
>
编辑
</a>
<Popconfirm
title="确认删除?"
onConfirm={() => {
delDataList(record.id);
}}
>
<Button type="link">删除</Button>
</Popconfirm>
</div>
)
},
},
{
key: "direction",
hideInTable: true,
dataIndex: "direction",
order: 6,
renderFormItem: (item, { type, defaultRender, ...rest }, form) => {
return (
<Button
type="primary"
style={{ width: "200px" }}
onClick={() => {
setImportVisible(true)
}}
>
项目信息导入
</Button>
);
},
},
];
const handleCancel = () => {
setVisible(false)
}
const handOk = () => {
}
const importHandleCancel = () => {
setImportVisible(false)
}
//删除资讯
const delDataList = (ids, type) => {
dispatch(Action.delDataList(ids)).then((res) => {
if (res.success) {
// 刷新
tableActionRef.current.reload();
}
});
};
//编辑
const editor = (record) => {
setVisible(true)
setEditData(record)
};
return (
<div style={{ height: "100%" }}>
<Scroller containerId={"article-container-query"} height={"100%"}>
<ProTable
actionRef={tableActionRef}
columns={columns}
options={false}
dataSource={dataSore}
search={{
optionRender: false,
collapsed: false,
}}
request={async (params) => {
let query = {
type: -1,
searchValue: heading,
status: state,
page: params.current,
limit: params.pageSize,
publishTime:
day && day.length && day[0].trim() != ""
? JSON.stringify([
moment(day[0]).startOf("day"),
moment(day[1]).endOf("day"),
])
: null,
};
const res = await dispatch(Action.getDataList(query));
setCounts(res.payload.data);
return {
...res,
total: res.payload.data ? res.payload.data.total : 0,
};
}}
rowKey="id"
pagination={{
showSizeChanger: true,
}}
/>
</Scroller>
<ProjectModeal visible={visible} handleOk={handOk} editData={editData} handleCancel={handleCancel}></ProjectModeal>
<ImportModeal importVisible={importVisible} handleCancel={importHandleCancel} editData={editData}></ImportModeal>
</div>
);
};
Default.propTypes = {
second: PropTypes.third,
};
const mapStateToProps = (state) => ({});
export default connect(mapStateToProps)(Default);
const data = [
{ name: 'yongchu', age: '18', 任务1: 'v1', 计划1: 'time1' },
{ name: 'yongchu', age: '18', 任务1: 'v1', 计划1: 'time1' },
{ name: 'yongchu', age: '18', 任务1: 'v1', 计划1: 'time1' },
{ name: '大王', age: '18', 任务1: 'v1', 计划1: 'time1' },
{ name: '大王', age: '18', 任务1: 'v1', 计划1: 'time1' }
]

13
web/client/src/sections/personnel/index.js

@ -0,0 +1,13 @@
import routes from './routes';
import reducers from './reducers';
import actions from './actions';
import nativeItem from './nav-item';
export default {
key: 'personnel',
name: '人员任务',
reducers,
routes,
actions,
getNavItem: nativeItem
};

14
web/client/src/sections/personnel/nav-item.js

@ -0,0 +1,14 @@
import React from 'react';
import { Link } from 'react-router-dom';
import { Menu } from 'antd';
import { BarChartOutlined } from '@ant-design/icons';
export function getNavItem() {
return (
<Menu.Item key="personnel" icon={<BarChartOutlined />}>
<Link to="/personnel">项目信息</Link>
</Menu.Item>
);
}
export default getNavItem;

19
web/client/src/sections/personnel/reducers/index.js

@ -0,0 +1,19 @@
'use strict';
const initModifyData = {
data: null
}
function modifyData(state = initModifyData, actions) {
const { type, payload } = actions
switch (type) {
case 'MODIFY_ARTICAL_SUCCESS':
return Object.assign({}, state, { data: payload.data });
default:
return state;
}
}
export default {
modifyData,
}

12
web/client/src/sections/personnel/routes.js

@ -0,0 +1,12 @@
import Container from './containers';
export default [
{
type: 'inner',
route: {
path: '/personnel',
key: 'personnel',
component: Container,
}
},
];

2
web/client/src/themes/light.json

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save