23 changed files with 880 additions and 30421 deletions
@ -0,0 +1,53 @@ |
|||||
|
'use strict'; |
||||
|
const moment = require('moment') |
||||
|
|
||||
|
async function getAnspectionNotificationPhone(ctx) { |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
|
||||
|
let findOption = { |
||||
|
where: { |
||||
|
|
||||
|
}, |
||||
|
order: [['id', 'DESC']] |
||||
|
} |
||||
|
const roadRes = await models.AnspectionNotificationPhone.findAll(findOption) |
||||
|
|
||||
|
ctx.status = 200; |
||||
|
ctx.body = roadRes |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
async function addAnspectionNotificationPhone(ctx) { |
||||
|
try { |
||||
|
// const transaction = await ctx.fs.dc.orm.transaction();
|
||||
|
const models = ctx.fs.dc.models; |
||||
|
const data = ctx.request.body; |
||||
|
await models.AnspectionNotificationPhone.destroy({ where: {} }) |
||||
|
let dataList = [] |
||||
|
data.phone && data.phone.map(e => { |
||||
|
dataList.push({ |
||||
|
phone: e |
||||
|
}) |
||||
|
}) |
||||
|
await models.AnspectionNotificationPhone.bulkCreate(dataList); |
||||
|
await transaction.commit(); |
||||
|
ctx.status = 204 |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
message: typeof error == 'string' ? error : undefined |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
module.exports = { |
||||
|
getAnspectionNotificationPhone, addAnspectionNotificationPhone |
||||
|
}; |
@ -0,0 +1,106 @@ |
|||||
|
'use strict' |
||||
|
//查询路政
|
||||
|
async function getRoadadministration(ctx, next) { |
||||
|
try { |
||||
|
|
||||
|
const { limit = 10, page,keyword,startTime,endTime} = ctx.query; |
||||
|
// const distinct = 'false' == includeCount ? false : true//gis大屏需要总设备,后台管理不需要include的统计
|
||||
|
const models = ctx.fs.dc.models; |
||||
|
let where = {}; |
||||
|
|
||||
|
if(startTime && endTime){ |
||||
|
where.enforcementdate = { |
||||
|
where: { enforcementdate: { $between: [moment(startTime).format('YYYY-MM-DD'), moment(endTime).format('YYYY-MM-DD')] } }, |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
let findObj = { |
||||
|
order: [["id", "desc"]], |
||||
|
where: where, |
||||
|
|
||||
|
}; |
||||
|
if (page && limit) { |
||||
|
findObj.limit = Number(limit) |
||||
|
findObj.offset = Number(page - 1) * Number(limit) |
||||
|
} |
||||
|
let rslt = await models.Roadadministration.findAndCountAll(findObj); |
||||
|
ctx.body = rslt; |
||||
|
ctx.status = 200; |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { |
||||
|
"message": "获取路政数据失败" |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 新增路政
|
||||
|
function addRoadadministration(opts) { |
||||
|
return async function (ctx, next) { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
try { |
||||
|
let rslt = ctx.request.body; |
||||
|
await models.Roadadministration.create(rslt) |
||||
|
|
||||
|
ctx.status = 204; |
||||
|
ctx.body = { message: '添加路政数据成功' } |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { message: '添加路政失败' } |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 删除路政
|
||||
|
function delRoadadministration(opts) { |
||||
|
return async function (ctx, next) { |
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const { id } = ctx.params; |
||||
|
await models.Roadadministration.destroy({ |
||||
|
where: { |
||||
|
id: id |
||||
|
} |
||||
|
}) |
||||
|
ctx.status = 204; |
||||
|
ctx.body = { message: '删除路政信息' } |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { message: '删除健康体检' } |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 修改路政
|
||||
|
function editRoadadministration(opts) { |
||||
|
return async function (ctx, next) { |
||||
|
|
||||
|
try { |
||||
|
const models = ctx.fs.dc.models; |
||||
|
const { id } = ctx.params; |
||||
|
const body = ctx.request.body; |
||||
|
await models.Roadadministration.update( |
||||
|
body, |
||||
|
{ where: { id: id, } } |
||||
|
) |
||||
|
ctx.status = 204; |
||||
|
ctx.body = { message: '修改健康体检数据成功' } |
||||
|
} catch (error) { |
||||
|
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
||||
|
ctx.status = 400; |
||||
|
ctx.body = { message: '修改健康体检数据失败' } |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
module.exports = { |
||||
|
getRoadadministration, |
||||
|
addRoadadministration, |
||||
|
delRoadadministration, |
||||
|
editRoadadministration |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const AnspectionNotificationPhone = sequelize.define("inspection_notification_phone", { |
||||
|
id: { |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true, |
||||
|
unique: "assess_id_uindex" |
||||
|
}, |
||||
|
phone: { |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: "联系电话", |
||||
|
primaryKey: false, |
||||
|
field: "phone", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
|
||||
|
}, { |
||||
|
tableName: "inspection_notification_phone", |
||||
|
comment: "", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.AnspectionNotificationPhone = AnspectionNotificationPhone; |
||||
|
return AnspectionNotificationPhone; |
||||
|
}; |
@ -0,0 +1,65 @@ |
|||||
|
/* eslint-disable*/ |
||||
|
'use strict'; |
||||
|
|
||||
|
module.exports = dc => { |
||||
|
const DataTypes = dc.ORM; |
||||
|
const sequelize = dc.orm; |
||||
|
const Roadadministration = sequelize.define("roadadministration", { |
||||
|
id: { |
||||
|
index: 1, |
||||
|
type: DataTypes.INTEGER, |
||||
|
allowNull: false, |
||||
|
defaultValue: null, |
||||
|
comment: null, |
||||
|
primaryKey: true, |
||||
|
field: "id", |
||||
|
autoIncrement: true |
||||
|
}, |
||||
|
enforcementdate: { |
||||
|
index: 2, |
||||
|
type: DataTypes.DATE, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: '执法日期', |
||||
|
primaryKey: false, |
||||
|
field: "enforcementdate", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
roadname: { |
||||
|
index: 3, |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: '道路名称', |
||||
|
primaryKey: false, |
||||
|
field: "roadname", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
enforcementreslt: { |
||||
|
index: 4, |
||||
|
type: DataTypes.STRING, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: '执法结果', |
||||
|
primaryKey: false, |
||||
|
field: "enforcementreslt", |
||||
|
autoIncrement: false |
||||
|
}, |
||||
|
picfile: { |
||||
|
index: 4, |
||||
|
type: DataTypes.JSON, |
||||
|
allowNull: true, |
||||
|
defaultValue: null, |
||||
|
comment: '执法图片', |
||||
|
primaryKey: false, |
||||
|
field: "picfile", |
||||
|
autoIncrement: false |
||||
|
} |
||||
|
}, { |
||||
|
tableName: "roadadministration", |
||||
|
comment: "路政管理", |
||||
|
indexes: [] |
||||
|
}); |
||||
|
dc.models.Roadadministration = Roadadministration; |
||||
|
return Roadadministration; |
||||
|
}; |
@ -0,0 +1,21 @@ |
|||||
|
|
||||
|
|
||||
|
'use strict'; |
||||
|
|
||||
|
const Roadadministration = require('../../controllers/luzheng') |
||||
|
|
||||
|
module.exports = function (app, router, opts) { |
||||
|
app.fs.api.logAttr['GET/getRoadadministration'] = { content: '获取路政数据', visible: false }; |
||||
|
router.get('/getRoadadministration', Roadadministration.getRoadadministration); |
||||
|
|
||||
|
|
||||
|
app.fs.api.logAttr['POST/addRoadadministration'] = { content: '增加路政数据', visible: true }; |
||||
|
router.post('/addRoadadministration', Roadadministration.addRoadadministration(opts)); |
||||
|
|
||||
|
app.fs.api.logAttr['DEL/delRoadadministration/:id'] = { content: '删除路政数据', visible: true }; |
||||
|
router.del('/delRoadadministration/:id', Roadadministration.delRoadadministration(opts)) |
||||
|
|
||||
|
// // 修改健康体检
|
||||
|
app.fs.api.logAttr['PUT/editRoadadministration/:id'] = { content: '修改路政数据', visible: true }; |
||||
|
router.put('/editRoadadministration/:id', Roadadministration.editRoadadministration(opts)) |
||||
|
}; |
@ -0,0 +1,8 @@ |
|||||
|
create table if not exists roadadministration |
||||
|
( |
||||
|
id serial not null primary key, |
||||
|
enforcementdate timestamp, |
||||
|
roadname varchar(255), |
||||
|
enforcementreslt varchar(255), |
||||
|
picfile jsonb |
||||
|
); |
@ -0,0 +1,51 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
import { basicAction } from '@peace/utils' |
||||
|
import { ApiTable } from '$utils' |
||||
|
export function getRoadadministration (query) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'get', |
||||
|
dispatch: dispatch, |
||||
|
query: query, |
||||
|
actionType: 'GET_LU_ZHENG', |
||||
|
url: ApiTable.getRoadadministration, |
||||
|
msg: { option: '获取路政信息' }, |
||||
|
// reducer: { name: 'chcekList' }
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
export function addRoadadministration (params) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'post', |
||||
|
data: params, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'ADD_LU_ZHENG', |
||||
|
url: ApiTable.addRoadadministration, |
||||
|
msg: { option: '新增路政信息' }, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
export function delRoadadministration (id) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'delete', |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'DEL_LU_ZHENG', |
||||
|
url: ApiTable.delRoadadministration.replace(':id', id), |
||||
|
msg: { option: '删除路政信息' }, |
||||
|
}) |
||||
|
} |
||||
|
export function modifyRoadadministration (id, params) { |
||||
|
return dispatch => basicAction({ |
||||
|
type: 'put', |
||||
|
data: params, |
||||
|
dispatch: dispatch, |
||||
|
actionType: 'EDIT_LU_ZHENG', |
||||
|
url: ApiTable.modifyRoadadministration.replace(':id', id), |
||||
|
msg: { option: '修改路政信息' }, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
@ -0,0 +1,94 @@ |
|||||
|
import React, { useState, useEffect } from 'react'; |
||||
|
import { connect } from 'react-redux'; |
||||
|
import { Form, Input, Select, DatePicker, InputNumber, Button, Modal } from 'antd'; |
||||
|
import { unitList } from '../containers/assess' |
||||
|
import { getAssess, delAssess, editAssess } from '../actions/assess'; |
||||
|
import moment from 'moment'; |
||||
|
import { getRoadadministration,addRoadadministration,delRoadadministration,modifyRoadadministration } from '../actions/luzheng'; |
||||
|
// import Uploads from "../../../../components/Upload/index"
|
||||
|
const { Option } = Select; |
||||
|
|
||||
|
const AssessModal = ({ editData, check, visible, onCancel, dispatch }) => { |
||||
|
const [form] = Form.useForm(); |
||||
|
|
||||
|
return ( |
||||
|
<Modal |
||||
|
title="路政信息" |
||||
|
open={visible} |
||||
|
visible={visible} |
||||
|
cancelButtonProps={{ |
||||
|
disabled: check, |
||||
|
}} |
||||
|
onOk={() => { |
||||
|
if (check) { |
||||
|
return onCancel() |
||||
|
} |
||||
|
form.validateFields().then(values => { |
||||
|
dispatch(editAssess({ |
||||
|
...values, |
||||
|
month: moment(values.month).format('YYYY-MM-DD'), |
||||
|
assessId: editData ? editData.id : undefined |
||||
|
})).then(res => { |
||||
|
if (res.success) { |
||||
|
onCancel() |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}} |
||||
|
onCancel={() => { |
||||
|
onCancel() |
||||
|
}} |
||||
|
> |
||||
|
<Form |
||||
|
form={form} |
||||
|
initialValues={editData ? { |
||||
|
...editData, |
||||
|
month: moment(editData.month), |
||||
|
} : {}} |
||||
|
disabled={check} |
||||
|
labelCol={{ |
||||
|
span: 6, |
||||
|
}} |
||||
|
wrapperCol={{ |
||||
|
span: 18, |
||||
|
}} |
||||
|
> |
||||
|
<Form.Item name="enforcementdate" label="执法日期" rules={[{ required: true, message: '请填写' }]}> |
||||
|
{/* <Select> |
||||
|
{ |
||||
|
unitList.map(item => ( |
||||
|
<Option value={item} key={item} /> |
||||
|
)) |
||||
|
} |
||||
|
</Select> */} |
||||
|
<DatePicker/> |
||||
|
</Form.Item> |
||||
|
|
||||
|
<Form.Item name="roadname" label="执法道路" rules={[{ required: true, message: '请填写' }]}> |
||||
|
<Input/> |
||||
|
</Form.Item> |
||||
|
|
||||
|
<Form.Item name="enforcementreslt" label="执法成果" rules={[{ required: true, message: '请填写' }]}> |
||||
|
<Input/> |
||||
|
</Form.Item> |
||||
|
|
||||
|
<Form.Item name="picfile" label="执法图片"> |
||||
|
{/* <Uploads |
||||
|
maxFilesNum={1} |
||||
|
fileTypes={['mp4']} |
||||
|
maxFileSize={200} |
||||
|
/> */} |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
</Modal> |
||||
|
); |
||||
|
}; |
||||
|
|
||||
|
function mapStateToProps (state) { |
||||
|
const { auth, assess } = state |
||||
|
return { |
||||
|
user: auth.user, |
||||
|
assess: assess.data || [] |
||||
|
} |
||||
|
} |
||||
|
export default connect(mapStateToProps)(AssessModal); |
@ -0,0 +1,173 @@ |
|||||
|
import React, { useState, useEffect } from 'react'; |
||||
|
import { connect } from 'react-redux'; |
||||
|
import { getAssess, delAssess, editAssess } from '../actions/assess'; |
||||
|
import { getRoadadministration,addRoadadministration,delRoadadministration,modifyRoadadministration } from '../actions/luzheng'; |
||||
|
import ProTable from '@ant-design/pro-table'; |
||||
|
import AssessModal from '../components/luzhengmodel'; |
||||
|
import { Form, Space, DatePicker, Button, Select, Popconfirm } from 'antd' |
||||
|
import moment from 'moment'; |
||||
|
|
||||
|
export const unitList = [ |
||||
|
'县道', |
||||
|
'蒋巷镇', |
||||
|
'三江镇', |
||||
|
'塔城乡', |
||||
|
'泾口乡', |
||||
|
'八一乡', |
||||
|
'冈上镇', |
||||
|
'南新乡', |
||||
|
'富山乡', |
||||
|
'莲塘镇', |
||||
|
'金湖管理处', |
||||
|
'武阳镇', |
||||
|
'向塘镇', |
||||
|
'幽兰镇', |
||||
|
'广福镇', |
||||
|
'塘南镇', |
||||
|
'银三角管委会', |
||||
|
'黄马乡', |
||||
|
] |
||||
|
function Assess(props) { |
||||
|
const { dispatch, assess, user } = props; |
||||
|
const [assessModalVisible, setAssessModalVisible] = useState(false); |
||||
|
const [editData, setEditData] = useState(null); |
||||
|
const [query, setQuery] = useState({ page: 1, pageSize: 10 }) |
||||
|
const [loading, setLoading] = useState(false); |
||||
|
const [isCheck, setIsCheck] = useState(false) |
||||
|
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'ASSESSMANAGE')?.isshow === "true" ? true : '') |
||||
|
useEffect(() => { |
||||
|
dispatch(getRoadadministration()).then(res=>{console.log(res,'res')}) |
||||
|
return () => { }; |
||||
|
}, []); |
||||
|
|
||||
|
useEffect(() => { |
||||
|
getData() |
||||
|
}, [query]) |
||||
|
|
||||
|
const getData = () => { |
||||
|
setLoading(true) |
||||
|
dispatch(getRoadadministration(query)).then(res => { |
||||
|
setLoading(false) |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
return ( |
||||
|
<div> |
||||
|
<div style={{ marginBottom: '20px', display: 'flex', justifyContent: 'space-between' }}> |
||||
|
<Form layout="inline" onFinish={(v) => { |
||||
|
setQuery({ ...query, unit: v.unit, month: v.month ? moment(v.month).format() : undefined }) |
||||
|
}}> |
||||
|
<Form.Item name="unit" label="责任单位" > |
||||
|
<Select style={{ width: 200 }} placeholder="全部" allowClear> |
||||
|
{ |
||||
|
unitList.map(item => ( |
||||
|
<Option value={item} key={item} /> |
||||
|
)) |
||||
|
} |
||||
|
</Select> |
||||
|
</Form.Item> |
||||
|
|
||||
|
<Form.Item name="month" label="考核月份"> |
||||
|
<DatePicker picker="month" style={{ width: 200 }} /> |
||||
|
</Form.Item> |
||||
|
|
||||
|
<Form.Item> |
||||
|
<Button type="primary" htmlType="submit">搜索</Button> |
||||
|
</Form.Item> |
||||
|
</Form> |
||||
|
|
||||
|
<Button type="primary" disabled={editAble} |
||||
|
onClick={() => { |
||||
|
setAssessModalVisible(true) |
||||
|
}}>新增</Button> |
||||
|
</div> |
||||
|
<ProTable |
||||
|
columns={[{ |
||||
|
title: '执法日期', |
||||
|
dataIndex: 'enforcementdate', |
||||
|
key: 'enforcementdate', |
||||
|
}, |
||||
|
{ |
||||
|
title: '执法道路', |
||||
|
dataIndex: 'roadname', |
||||
|
key: 'roadname' |
||||
|
}, |
||||
|
{ |
||||
|
title: '执法成果', |
||||
|
dataIndex: 'enforcementreslt', |
||||
|
key: 'enforcementreslt', |
||||
|
}, |
||||
|
{ |
||||
|
title: '执法图片', |
||||
|
dataIndex: 'picfile', |
||||
|
key: 'picfile', |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
key: 'action', |
||||
|
render: (text, record) => ( |
||||
|
<span> |
||||
|
<Button type="link" onClick={() => { |
||||
|
setAssessModalVisible(true) |
||||
|
setEditData(record) |
||||
|
setIsCheck(true) |
||||
|
}}>详情</Button> |
||||
|
<Button type="link" onClick={() => { |
||||
|
setAssessModalVisible(true) |
||||
|
setEditData(record) |
||||
|
disabled = { editAble } |
||||
|
}}>编辑</Button> |
||||
|
<Popconfirm |
||||
|
title="确定删除此条数据吗?" |
||||
|
onConfirm={() => { |
||||
|
setLoading(true) |
||||
|
dispatch(delAssess({ id: record.id })).then(res => { |
||||
|
setLoading(false) |
||||
|
if (res.success) { |
||||
|
getData() |
||||
|
} |
||||
|
}) |
||||
|
}} |
||||
|
> |
||||
|
<Button type="link" danger disabled={editAble}>删除</Button> |
||||
|
</Popconfirm> |
||||
|
</span> |
||||
|
), |
||||
|
},]} |
||||
|
dataSource={assess.rows || []} |
||||
|
loading={loading} |
||||
|
pagination={{ |
||||
|
total: assess?.count || 0, |
||||
|
pageSize: 10, |
||||
|
defaultPageSize: 10, |
||||
|
showSizeChanger: false, |
||||
|
onChange: (page, pageSize) => { |
||||
|
setQuery({ |
||||
|
...query, |
||||
|
page, limit: pageSize |
||||
|
}) |
||||
|
} |
||||
|
}} |
||||
|
rowKey="key" |
||||
|
toolBarRender={false} |
||||
|
search={false} |
||||
|
/> |
||||
|
{ |
||||
|
assessModalVisible ? <AssessModal check={isCheck} visible={assessModalVisible} editData={editData} onCancel={() => { |
||||
|
getData() |
||||
|
setIsCheck(false) |
||||
|
setEditData(null) |
||||
|
setAssessModalVisible(false) |
||||
|
}} /> : '' |
||||
|
} |
||||
|
</div> |
||||
|
); |
||||
|
} |
||||
|
function mapStateToProps(state) { |
||||
|
const { auth, assess } = state |
||||
|
return { |
||||
|
user: auth.user, |
||||
|
assess: assess.data || [], |
||||
|
} |
||||
|
} |
||||
|
export default connect(mapStateToProps)(Assess); |
File diff suppressed because it is too large
Loading…
Reference in new issue