wenlele
2 years ago
61 changed files with 2305 additions and 496 deletions
@ -0,0 +1,13 @@ |
|||
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder |
|||
COPY . /var/app |
|||
WORKDIR /var/app |
|||
EXPOSE 8080 |
|||
RUN npm config set registry=https://nexus.ngaiot.com/repository/fs-npm/ |
|||
RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json |
|||
RUN npm cache clean -f |
|||
RUN rm -rf package-lock.json |
|||
RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ |
|||
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12 |
|||
COPY --from=builder --chown=node /var/app /home/node/app |
|||
WORKDIR /home/node/app |
|||
CMD ["node", "server.js"] |
@ -0,0 +1,91 @@ |
|||
'use strict'; |
|||
|
|||
async function getTask(ctx) { |
|||
try { |
|||
const models = ctx.fs.dc.models |
|||
const query = ctx.query |
|||
const whereopt = { |
|||
isdanger: query.isdanger |
|||
} |
|||
const whereRoadOpt = { |
|||
id: query.id |
|||
} |
|||
const taskRes = await models.TaskManage.findAndCountAll({ |
|||
order: [['id', 'DESC']], |
|||
attributes: ['id', 'dangerDescription', 'isdanger', 'issuanceTime', 'reportTime'], |
|||
include: [ |
|||
{ |
|||
attributes: ['id', 'routeName', 'routeCode'], |
|||
model: models.Road, |
|||
where: query.id == undefined ? {} : whereRoadOpt |
|||
|
|||
}, |
|||
{ |
|||
attributes: ['id', 'name'], |
|||
model: models.User |
|||
} |
|||
], |
|||
where: query.isdanger == undefined ? {} : whereopt |
|||
}) |
|||
ctx.body = taskRes |
|||
ctx.status = 200 |
|||
} |
|||
catch (error) { |
|||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|||
ctx.status = 400; |
|||
ctx.body = { |
|||
message: '获取失败' |
|||
} |
|||
} |
|||
} |
|||
|
|||
//删除任务
|
|||
async function delTask(ctx) { |
|||
try { |
|||
const models = ctx.fs.dc.models |
|||
const { id } = ctx.params |
|||
await models.TaskManage.destroy({ where: { id: id } }) |
|||
ctx.status = 204 |
|||
} catch (error) { |
|||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|||
ctx.status = 400; |
|||
ctx.body = { |
|||
message: '删除失败' |
|||
} |
|||
} |
|||
|
|||
} |
|||
//编辑任务
|
|||
async function editTask(ctx) { |
|||
//const transaction = await ctx.fs.dc.orm.transaction();
|
|||
try { |
|||
const models = ctx.fs.dc.models |
|||
const params = ctx.request.body |
|||
const road = await models.Road.findOne({ where: { id: params.routeId } }) |
|||
const user = await models.User.findOne({ where: { id: params.userId } }) |
|||
if (!params.id) { |
|||
await models.TaskManage.create({ |
|||
roadid: road.id, userid: user.id, dangerDescription: params.dangerDescription.trim() |
|||
}) |
|||
} else { |
|||
await models.TaskManage.update({ |
|||
roadid: road.id, userid: user.id, dangerDescription: params.dangerDescription.trim() |
|||
}, { where: { id: params.id } }) |
|||
} |
|||
ctx.status = 204 |
|||
} catch (error) { |
|||
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); |
|||
ctx.status = 400; |
|||
ctx.body = { |
|||
message: '新增失败' |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
module.exports = { |
|||
getTask, delTask, editTask |
|||
}; |
@ -0,0 +1,87 @@ |
|||
/* eslint-disable*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = dc => { |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const TaskManage = sequelize.define("taskManage", { |
|||
id: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "id", |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true |
|||
}, |
|||
roadid: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "道路id", |
|||
primaryKey: false, |
|||
field: "roadid", |
|||
autoIncrement: false, |
|||
references: { |
|||
key: "id", |
|||
model: "road" |
|||
} |
|||
}, |
|||
dangerDescription: { |
|||
type: DataTypes.CHAR, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "隐患说明", |
|||
primaryKey: false, |
|||
field: "danger_description", |
|||
autoIncrement: false |
|||
}, |
|||
issuanceTime: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "下发时间", |
|||
primaryKey: false, |
|||
field: "issuance_time", |
|||
autoIncrement: false |
|||
}, |
|||
userid: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "用户id", |
|||
primaryKey: false, |
|||
field: "userid", |
|||
autoIncrement: false, |
|||
references: { |
|||
key: "id", |
|||
model: "user" |
|||
} |
|||
}, |
|||
isdanger: { |
|||
type: DataTypes.BOOLEAN, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "是否存在安全隐患,flase(不存在)", |
|||
primaryKey: false, |
|||
field: "isdanger", |
|||
autoIncrement: false |
|||
}, |
|||
reportTime: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "上报时间", |
|||
primaryKey: false, |
|||
field: "report_time", |
|||
autoIncrement: false |
|||
} |
|||
}, { |
|||
tableName: "task_manage", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
dc.models.TaskManage = TaskManage; |
|||
return TaskManage; |
|||
}; |
@ -0,0 +1,22 @@ |
|||
podTemplate { |
|||
node('pod-templ-jenkins-slave-common') { |
|||
|
|||
env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${IOT}/${JOB_NAME}" |
|||
env.IMAGE_NAME_SHORT = "${IOT}/${JOB_NAME}" |
|||
env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/Highways4Good.git" |
|||
|
|||
stage('Run shell') { |
|||
git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" |
|||
|
|||
container('image-builder') { |
|||
sh''' |
|||
find . -depth -name '.svn' -type d -exec rm -rf {} + |
|||
/kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./api/Dockerfilenew --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup |
|||
''' |
|||
} |
|||
|
|||
buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" |
|||
buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,25 @@ |
|||
podTemplate { |
|||
node('pod-templ-jenkins-slave-common') { |
|||
|
|||
env.IMAGE_NAME = "${IOT_IMAGES_REGISTRY}/${IOT}/${JOB_NAME}" |
|||
env.IMAGE_NAME_SHORT = "${IOT}/${JOB_NAME}" |
|||
env.CODE_ADDR = "${GIT_ADDRESS}/free-sun/Highways4Good.git" |
|||
|
|||
stage('Run shell') { |
|||
git branch: 'dev', credentialsId: 'gitea-builder', url: "${CODE_ADDR}" |
|||
|
|||
container('image-builder') { |
|||
sh''' |
|||
pwd |
|||
ls -al |
|||
|
|||
/kaniko/executor --context=${BUILD_WORKSPACE} --dockerfile=./web/Dockerfilenew --destination=${IMAGE_NAME}:${IMAGE_VERSION} --cache=false --cleanup |
|||
|
|||
''' |
|||
} |
|||
|
|||
buildName "${IMAGE_NAME_SHORT}:${IMAGE_VERSION}" |
|||
buildDescription "${IMAGE_NAME}:${IMAGE_VERSION}" |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,2 @@ |
|||
ALTER TABLE public."user" |
|||
ADD COLUMN isadmin boolean; |
@ -0,0 +1,16 @@ |
|||
create table public.task_manage( |
|||
id SERIAL PRIMARY KEY , |
|||
roadId integer not null references public.road(id), |
|||
danger_description char(300), |
|||
issuance_time timestamp, |
|||
userId integer NOT NULL references public.user(id), |
|||
isdanger boolean, |
|||
report_time timestamp |
|||
); |
|||
comment on column public.task_manage.id is 'id'; |
|||
comment on column public.task_manage.roadId is '道路id'; |
|||
comment on column public.task_manage.danger_description is '隐患说明'; |
|||
comment on column public.task_manage.issuance_time is '下发时间'; |
|||
comment on column public.task_manage.userId is '用户id'; |
|||
comment on column public.task_manage.isdanger is '是否存在安全隐患,flase(不存在)'; |
|||
comment on column public.task_manage.report_time is '上报时间'; |
@ -0,0 +1,9 @@ |
|||
alter table report |
|||
add project_name varchar(512); |
|||
|
|||
alter table report alter column project_type drop not null; |
|||
|
|||
alter table report |
|||
add handle_state varchar(32) default '已处理' not null; |
|||
|
|||
comment on column report.handle_state is '待处理 / 已处理 / 不处理'; |
@ -1,7 +1,9 @@ |
|||
{ |
|||
"projectname": "%E5%9B%9B%E5%A5%BD%E5%85%AC%E8%B7%AF", |
|||
"setting": { |
|||
"compileHotReLoad": true |
|||
"compileHotReLoad": true, |
|||
"bigPackageSizeSupport": true |
|||
}, |
|||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html" |
|||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", |
|||
"libVersion": "2.32.2" |
|||
} |
@ -0,0 +1,12 @@ |
|||
import React, { useState, useEffect } from 'react'; |
|||
import Taro, { useRouter } from '@tarojs/taro'; |
|||
import { View, RadioGroup, Radio, Image, Input, Picker } from '@tarojs/components'; |
|||
|
|||
const Index = () => { |
|||
|
|||
return( |
|||
<View>123</View> |
|||
) |
|||
} |
|||
|
|||
export default Index |
After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,17 @@ |
|||
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node:12-dev as builder |
|||
COPY . /var/app |
|||
WORKDIR /var/app |
|||
EXPOSE 8080 |
|||
RUN npm config set registry=https://nexus.ngaiot.com/repository/fs-npm/ |
|||
RUN echo "{\"time\":\"$BUILD_TIMESTAMP\",\"build\": \"$BUILD_NUMBER\",\"revision\": \"$SVN_REVISION_1\",\"URL\":\"$SVN_URL_1\"}" > version.json |
|||
RUN npm cache clean -f |
|||
RUN rm -rf package-lock.json |
|||
RUN npm install --registry https://nexus.ngaiot.com/repository/fs-npm/ |
|||
RUN npm run build |
|||
RUN rm -rf client/src |
|||
RUN rm -rf node_modules |
|||
RUN npm install --production --force --registry https://nexus.ngaiot.com/repository/fs-npm/ |
|||
FROM registry.cn-hangzhou.aliyuncs.com/fs-devops/node-16:7.22-06-20 |
|||
COPY --from=builder --chown=node /var/app /home/node/app |
|||
WORKDIR /home/node/app |
|||
CMD ["node", "server.js"] |
After Width: | Height: | Size: 59 KiB |
After Width: | Height: | Size: 27 KiB |
@ -0,0 +1,35 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function getTask(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
query: query, |
|||
actionType: 'GET_TASK', |
|||
url: ApiTable.getTask, |
|||
msg: { error: '获取任务信息' }, |
|||
reducer: { name: 'task' } |
|||
}); |
|||
} |
|||
|
|||
export function delTask(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'del', |
|||
dispatch: dispatch, |
|||
actionType: 'DEL_TASK', |
|||
url: ApiTable.delTask.replace("{taskId}", query?.id), |
|||
msg: { option: '删除任务信息' }, |
|||
}); |
|||
} |
|||
|
|||
export function editTask(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_TASK', |
|||
url: ApiTable.editTask, |
|||
msg: { option: '编辑或新增任务信息' }, |
|||
}); |
|||
} |
@ -0,0 +1,180 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { Modal, Form, Input, Select, DatePicker, AutoComplete, Col, Button, Row } from 'antd'; |
|||
|
|||
import { MinusCircleOutlined, PlusOutlined, PlusCircleOutlined } from '@ant-design/icons'; |
|||
const Search = Input.Search |
|||
const { TextArea } = Input; |
|||
import moment from 'moment'; |
|||
|
|||
const EditGuanlang = (props) => { |
|||
const { visible, onCancel, editData, handleSaveScore, readOnly, companys, searchCompany, applyState } = props; |
|||
const [form] = Form.useForm(); |
|||
const [replyFiles, setReplyFiles] = useState([]); |
|||
const [companyOpts, setCompanyOpts] = useState([]); |
|||
const [stationItem, setStationItem] = useState(null); |
|||
const [deviceList, setDeviceList] = useState([]); |
|||
|
|||
useEffect(() => { |
|||
if (!visible) { |
|||
form.resetFields() |
|||
} |
|||
}, [visible]) |
|||
|
|||
useEffect(() => { |
|||
if (editData) { |
|||
let revertData = Object.assign({}, editData); |
|||
Object.keys(editData).forEach(key => { |
|||
if (key == 'accidentTime') { |
|||
revertData[key] = editData[key] && moment(editData[key]); |
|||
} |
|||
if (key == 'images') { |
|||
// const list = (editData[key] || '').split(',') || []
|
|||
if (editData[key]) { |
|||
|
|||
revertData[key] = JSON.parse(editData[key]); |
|||
} |
|||
} |
|||
}); |
|||
form.setFieldsValue({ ...revertData }); |
|||
} |
|||
}, [editData]) |
|||
|
|||
useEffect(() => { |
|||
if (companys && companys.length) { |
|||
let list = []; |
|||
companys.forEach(item => { |
|||
list.push({ label: item.company, value: item.company }) |
|||
}) |
|||
setCompanyOpts(list); |
|||
} |
|||
}, [companys]) |
|||
|
|||
useEffect(() => { |
|||
if (editData && companys && companys.length) { |
|||
handleSelectCompany(null, { value: editData.companyName }) |
|||
let list = ((editData || {}).accidentStations || []).map(item => item.stationId) |
|||
form.setFieldsValue({ stations: list }) |
|||
} |
|||
}, [companys, editData]) |
|||
|
|||
|
|||
const handleSave = () => { |
|||
const data = form.getFieldsValue(true); |
|||
console.log(data, 'data') |
|||
handleSaveScore(); |
|||
} |
|||
|
|||
const onFileUploaded = (fileList) => { |
|||
setReplyFiles(fileList); |
|||
} |
|||
|
|||
const handleSelectCompany = (v, opt) => { |
|||
const { value } = opt; |
|||
const target = companys.filter(c => c.company == value); |
|||
setDeviceList(target[0]?.deviceInfos || []); |
|||
|
|||
} |
|||
const data1 = [ |
|||
{ label: '2021年12月', value: '2021年12月' }, |
|||
{ label: '2021年11月', value: '2021年11月' }, |
|||
{ label: '2021年10月', value: '2021年10月' }, |
|||
{ label: '2021年9月', value: '2021年9月' }, |
|||
{ label: '2021年8月', value: '2021年8月' }, |
|||
{ label: '2021年7月', value: '2021年7月' }, |
|||
{ label: '2021年6月', value: '2021年6月' }, |
|||
{ label: '2021年5月', value: '2021年5月' }, |
|||
{ label: '2021年4月', value: '2021年4月' }, |
|||
{ label: '2021年3月', value: '2021年3月' }, |
|||
{ label: '2021年2月', value: '2021年2月' }, |
|||
{ label: '2021年1月', value: '2021年1月' }] |
|||
|
|||
const data2 = [ |
|||
{ label: '噪声传感器', value: '噪声传感器' }, |
|||
{ label: '导轮式固定测斜仪', value: '导轮式固定测斜仪' }, |
|||
{ label: '闭合式磁通量传感器', value: '闭合式磁通量传感器' }, |
|||
{ label: '扬尘监测系统', value: '扬尘监测系统' }, |
|||
{ label: '空气质量监测系统', value: '空气质量监测系统' }, |
|||
{ label: '车辆动态称重系统', value: '车辆动态称重系统' }, |
|||
{ label: '多通道振动采集仪', value: '多通道振动采集仪' }, |
|||
{ label: '应急照明控制器', value: '应急照明控制器' }, |
|||
{ label: '钢筋计', value: '钢筋计' }, |
|||
{ label: '噪声传感器', value: '噪声传感器' }, |
|||
{ label: '风速风向仪', value: '风速风向仪' }, |
|||
{ label: '静力水准仪', value: '静力水准仪' }, |
|||
{ label: '表面式应变计', value: '表面式应变计' }, |
|||
{ label: '光纤光栅锚索计', value: '光纤光栅锚索计' }, |
|||
{ label: '加速度计', value: '加速度计' }, |
|||
{ label: '闭合式磁通量传感器', value: '闭合式磁通量传感器' }, |
|||
{ label: '开环式磁通量传感器', value: '开环式磁通量传感器' }, |
|||
{ label: '压差式变形测量传感器', value: '压差式变形测量传感器' }, |
|||
{ label: '多通道振动采集仪', value: '多通道振动采集仪' }, |
|||
{ label: '压电式传感器', value: '压电式传感器' }, |
|||
{ label: '钢筋计', value: '钢筋计' }, |
|||
{ label: '盒式固定测斜仪', value: '盒式固定测斜仪' }, |
|||
{ label: '拉线位移传感器', value: '拉线位移传感器' }, |
|||
{ label: '表面式应变计', value: '表面式应变计' }, |
|||
{ label: '芯型土压力计', value: '芯型土压力计' }, |
|||
{ label: '芯型锚索计', value: '芯型锚索计' }, |
|||
{ label: '收敛仪', value: '收敛仪' }, |
|||
{ label: '激光测距仪 ', value: '激光测距仪 ' }, |
|||
{ label: '磁电式传感器', value: '磁电式传感器' }, |
|||
{ label: '压电式传感器', value: '压电式传感器' }, |
|||
{ label: '锚索计', value: '锚索计' }, |
|||
{ label: '静力水准仪 ', value: '静力水准仪 ' }, |
|||
{ label: '移动测斜仪 ', value: '移动测斜仪 ' } |
|||
] |
|||
return ( |
|||
<Modal |
|||
title="数据汇集" |
|||
visible={visible} |
|||
destroyOnClose |
|||
width={600} |
|||
// onOk={handleSave}
|
|||
onCancel={onCancel} |
|||
footer={null} |
|||
> |
|||
<Form form={form} labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} onFinish={handleSave}> |
|||
|
|||
|
|||
<Row> |
|||
<Col span={20}> |
|||
<Form.Item |
|||
label={'历史数据'} |
|||
name={'startposition'}> |
|||
<Select options={data1} defaultValue="2021年12月" mode="multiple"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
|
|||
</Row> |
|||
<Row> |
|||
|
|||
<Col span={20}> |
|||
<Form.Item |
|||
label={'传感器设备'} |
|||
name={'endposition'}> |
|||
<Select options={data2} defaultValue="噪声传感器" mode="multiple"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Form.Item wrapperCol={{ span: 12, offset: 6 }}> |
|||
<Col span={24} style={{ display: 'flex', justifyContent: 'space-around' }}> |
|||
<Button htmlType="submit" onClick={() => { |
|||
onCancel() |
|||
}}> |
|||
取消 |
|||
</Button> |
|||
<Button type="primary" onClick={() => { |
|||
onCancel() |
|||
}}> |
|||
确定 |
|||
</Button> |
|||
</Col> |
|||
</Form.Item> |
|||
</Form> |
|||
*汇集历史数据,接入物联网监测数据,实现大数据的接入解算。 |
|||
</Modal > |
|||
) |
|||
} |
|||
|
|||
|
|||
export default EditGuanlang; |
@ -0,0 +1,211 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { Modal, Form, Input, Select, DatePicker, AutoComplete, Col, Button,Row } from 'antd'; |
|||
|
|||
import { MinusCircleOutlined, PlusOutlined,PlusCircleOutlined } from '@ant-design/icons'; |
|||
const Search = Input.Search |
|||
const { TextArea } = Input; |
|||
import moment from 'moment'; |
|||
|
|||
const EditGuanlang = (props) => { |
|||
const { visible, onCancel, editData, handleSaveScore, readOnly, companys, searchCompany, applyState } = props; |
|||
const [form] = Form.useForm(); |
|||
const [replyFiles, setReplyFiles] = useState([]); |
|||
const [companyOpts, setCompanyOpts] = useState([]); |
|||
const [stationItem, setStationItem] = useState(null); |
|||
const [deviceList, setDeviceList] = useState([]); |
|||
|
|||
useEffect(() => { |
|||
if (!visible) { |
|||
form.resetFields() |
|||
} |
|||
}, [visible]) |
|||
|
|||
useEffect(() => { |
|||
if (editData) { |
|||
let revertData = Object.assign({}, editData); |
|||
Object.keys(editData).forEach(key => { |
|||
if (key == 'accidentTime') { |
|||
revertData[key] = editData[key] && moment(editData[key]); |
|||
} |
|||
if (key == 'images') { |
|||
// const list = (editData[key] || '').split(',') || []
|
|||
if (editData[key]) { |
|||
|
|||
revertData[key] = JSON.parse(editData[key]); |
|||
} |
|||
} |
|||
}); |
|||
form.setFieldsValue({ ...revertData }); |
|||
} |
|||
}, [editData]) |
|||
|
|||
useEffect(() => { |
|||
if (companys && companys.length) { |
|||
let list = []; |
|||
companys.forEach(item => { |
|||
list.push({ label: item.company, value: item.company }) |
|||
}) |
|||
setCompanyOpts(list); |
|||
} |
|||
}, [companys]) |
|||
|
|||
useEffect(() => { |
|||
if (editData && companys && companys.length) { |
|||
handleSelectCompany(null, { value: editData.companyName }) |
|||
let list = ((editData || {}).accidentStations || []).map(item => item.stationId) |
|||
form.setFieldsValue({ stations: list }) |
|||
} |
|||
}, [companys, editData]) |
|||
|
|||
|
|||
const handleSave = () => { |
|||
const data = form.getFieldsValue(true); |
|||
console.log(data,'data') |
|||
handleSaveScore(); |
|||
} |
|||
|
|||
const onFileUploaded = (fileList) => { |
|||
setReplyFiles(fileList); |
|||
} |
|||
|
|||
const handleSelectCompany = (v, opt) => { |
|||
const { value } = opt; |
|||
const target = companys.filter(c => c.company == value); |
|||
setDeviceList(target[0]?.deviceInfos || []); |
|||
|
|||
} |
|||
|
|||
return ( |
|||
<Modal |
|||
title="新增摄像头" |
|||
visible={visible} |
|||
destroyOnClose |
|||
width={1000} |
|||
// onOk={handleSave}
|
|||
onCancel={onCancel} |
|||
footer={null} |
|||
> |
|||
<Form form={form} labelCol={{ span: 8 }} wrapperCol={{ span: 16 }} onFinish={handleSave}> |
|||
<img src='/assets/images/tiptop.png' style={{width:'100%'}}></img> |
|||
<Row style={{marginBottom:'20px'}}> |
|||
<Col span={20}> <a>配置属性</a> </Col> |
|||
<Col span={2}> <Button>视频格式转换</Button> </Col> |
|||
{/* <Col span={2}> <Button>测试</Button> </Col> */} |
|||
|
|||
</Row> |
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
// style={{ width: 'calc(45% - 4px' }}
|
|||
label={'设备名称'} |
|||
rules={[{ required: true, message: '设备名称为必填项' }]} |
|||
name={'guanlangname'}> |
|||
<Input placeholder="请输入设备名称、常用项目或者位置定义"/> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'云台支持'} |
|||
name={'roadnamee'} |
|||
rules={[{ required: true, message: '所在道路名称不能为空' }]} |
|||
> |
|||
<Select options={[{label:'支持',value:'支持'},{label:'不支持',value:'不支持'}]} defaultValue="支持"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'高清切换'} |
|||
name={'startposition'}> |
|||
<Select options={[{label:'支持',value:'支持'},{label:'不支持',value:'不支持'}]} defaultValue="支持"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'语音支持'} |
|||
name={'endposition'}> |
|||
<Select options={[{label:'支持',value:'支持'},{label:'不支持',value:'不支持'}]} defaultValue="支持"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
style={{ width: 'calc(45%-4px' }} |
|||
label={'内存'} |
|||
name={'guanlangmaterial'} |
|||
rules={[{ required: true, message: '管廊材质不能为空' }]}> |
|||
<Select options={[{label:'8g',value:'8g'},{label:'16g',value:'16g'},{label:'32g',value:'32g'} |
|||
,{label:'64g',value:'64g'},{label:'128g',value:'128g'},{label:'256g',value:'256g'},{label:'>256g',value:'>256g'}]} defaultValue="未安装"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'序列设备号'} |
|||
name={'guanlanglayer'} |
|||
rules={[{ required: true, message: '序列设备号不能为空' }]}> |
|||
<Input placeholder="请输入序列设备号"/> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
|
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
style={{ width: 'calc(45%-4px' }} |
|||
label={'安装位置'} |
|||
name={'guanlanglength'} |
|||
rules={[{ required: true, message: '安装位置不能为空' }]}> |
|||
<Input placeholder="请输入高德经纬度坐标"/> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
|
|||
<Form.Item |
|||
label={'通道号'} |
|||
name={'manageunit'} |
|||
rules={[{ required: true, message: '通道号不能为空' }]}> |
|||
<Col span={24} style={{ display: 'flex', justifyContent: 'space-around' }}> |
|||
<Input/> |
|||
|
|||
</Col> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Row> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'设备类型'} |
|||
name={'startposition'}> |
|||
<Select options={[{label:'枪机',value:'枪机'},{label:'球机',value:'球机'},{label:'其他',value:'其他'}]} placeholder="请选择摄像头类型"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
<Col span={12}> |
|||
<Form.Item |
|||
label={'设备能力'} |
|||
name={'endposition'}> |
|||
<Select options={[{label:'普通摄像头',value:'普通摄像头'},{label:'人流量计数',value:'人流量计数'},{label:'热成像',value:'热成像'},{label:'AI摄像头',value:'AI摄像头'},{label:'其他',value:'其他'}]} placeholder="请选择能力"></Select> |
|||
</Form.Item> |
|||
</Col> |
|||
</Row> |
|||
<Form.Item wrapperCol={{ span: 12, offset: 6 }}> |
|||
<Col span={24} style={{ display: 'flex', justifyContent: 'space-around' }}> |
|||
<Button htmlType="submit" onClick={()=>{ |
|||
onCancel() |
|||
}}> |
|||
取消 |
|||
</Button> |
|||
<Button type="primary" htmlType="submit"> |
|||
确定 |
|||
</Button> |
|||
</Col> |
|||
</Form.Item> |
|||
</Form> |
|||
|
|||
</Modal > |
|||
) |
|||
} |
|||
|
|||
|
|||
export default EditGuanlang; |
@ -0,0 +1,152 @@ |
|||
import React, { useState, useEffect, useRef } from 'react'; |
|||
import { Modal, Form, Input, Select, Button } from 'antd'; |
|||
import { connect } from 'react-redux'; |
|||
import { getRoadway } from '../../actions/infor' |
|||
import { getUserList } from '../../actions/patrol'; |
|||
import { editTask } from '../../actions/task'; |
|||
|
|||
const AddModal = (props) => { |
|||
const { dispatch, recordRow, visible, onClose, user, lookVal } = props |
|||
const { TextArea } = Input |
|||
const [form] = Form.useForm() |
|||
const [inputVal, setIputVal] = useState(undefined) |
|||
const [selectVal, setSelectVal] = useState('') |
|||
const [roadRes, setRoadRes] = useState([])//路线列表
|
|||
const [userList, setUserList] = useState([])//用户列表
|
|||
useEffect(async () => { |
|||
const res = await dispatch(getUserList()) |
|||
setUserList(res?.payload.data) |
|||
}, [true]) |
|||
|
|||
const onChange = () => { |
|||
form.resetFields(['code'])//清空具体某个表单的值
|
|||
} |
|||
useEffect(() => { |
|||
form.setFieldsValue(recordRow ? { 'name': recordRow?.road.id, 'code': recordRow?.road.id, 'danger': recordRow?.dangerDescription, 'user': recordRow?.user.id } : {}) |
|||
}, [recordRow]) |
|||
useEffect(async () => { |
|||
const res = await dispatch(getRoadway({})) |
|||
setRoadRes(res?.payload.data) |
|||
}, []) |
|||
//新增和修改
|
|||
const handleSaveUpdate = () => { |
|||
form.validateFields().then((values) => { |
|||
//console.log('values', recordRow)
|
|||
//console.log('values', values)
|
|||
const val = { |
|||
dangerDescription: values.danger, |
|||
userId: values.user, |
|||
routeId: values.name, |
|||
id: recordRow?.id |
|||
} |
|||
dispatch(editTask(val)).then(res => { |
|||
if (res.success) { |
|||
onClose() |
|||
form.resetFields() |
|||
} |
|||
}) |
|||
}) |
|||
} |
|||
|
|||
return ( |
|||
<Modal visible={visible} |
|||
title={lookVal ? '查看' : recordRow ? '编辑任务' : '新增数据'} |
|||
onCancel={() => { |
|||
onClose() |
|||
form.resetFields()//清空所有个表单的值
|
|||
setSelectVal('')//置空路线代码的选择
|
|||
}} |
|||
onOk={ |
|||
handleSaveUpdate |
|||
} |
|||
footer={ |
|||
lookVal ? null : [ |
|||
<Button onClick={() => { onClose(); form.resetFields(); setSelectVal('') }}>取消</Button>, |
|||
<Button type='primary' onClick={handleSaveUpdate}>确认</Button> |
|||
] |
|||
} |
|||
> |
|||
<Form form={form}> |
|||
<Form.Item |
|||
label="路线名称" |
|||
name="name" |
|||
//initialValues={recordRow?.road.routeName}
|
|||
rules={[{ required: true, message: '路线名称' }]} > |
|||
<Select |
|||
disabled={lookVal ? true : false} |
|||
allowClear='true' |
|||
showSearch |
|||
placeholder="请输入关键词" |
|||
onChange={(value) => { |
|||
onChange() |
|||
setSelectVal(value) |
|||
}} |
|||
filterOption={(input, option) => |
|||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()) |
|||
} |
|||
options={roadRes?.map((item) => ({ |
|||
label: item.routeName, |
|||
value: item.id |
|||
}) |
|||
)} |
|||
/> |
|||
</Form.Item> |
|||
<Form.Item |
|||
label="路线代码" |
|||
name="code" |
|||
rules={[{ required: true, message: '路线代码' }]}> |
|||
<Select |
|||
disabled={lookVal ? true : false} |
|||
placeholder="请输入关键词" |
|||
value={selectVal} |
|||
> |
|||
<Select.Option key={selectVal}>{selectVal}</Select.Option> |
|||
</Select> |
|||
</Form.Item> |
|||
<Form.Item |
|||
label="隐患说明" |
|||
name="danger" |
|||
rules={[{ required: true, message: '隐患说明' }]}> |
|||
<TextArea disabled={lookVal ? true : false} /> |
|||
</Form.Item> |
|||
<Form.Item |
|||
label="责任人" |
|||
name="user" |
|||
rules={[{ required: true, message: '责任人' }]}> |
|||
<Select |
|||
disabled={lookVal ? true : false} |
|||
allowClear='true' |
|||
showSearch |
|||
placeholder="请输入负责人" |
|||
options={userList?.map((item) => ({ |
|||
label: item.name, |
|||
value: item.id |
|||
}) |
|||
)} |
|||
/> |
|||
</Form.Item> |
|||
{lookVal ? <Form.Item |
|||
label="下发时间" |
|||
name="issuanceTime" |
|||
> |
|||
<Input disabled={lookVal ? true : false} /> |
|||
</Form.Item> : ''} |
|||
{lookVal ? <Form.Item |
|||
label="图片说明" |
|||
name="picture" |
|||
> |
|||
<Input disabled={lookVal ? true : false} /> |
|||
</Form.Item> : ''} |
|||
</Form> |
|||
</Modal > |
|||
|
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(AddModal) |
@ -0,0 +1,9 @@ |
|||
import React from 'react' |
|||
|
|||
export default function Jiekouguanli() { |
|||
return ( |
|||
<div> |
|||
<img src='/assets/images/jiekou.png' style={{width:'100%'}}></img> |
|||
</div> |
|||
) |
|||
} |
@ -0,0 +1,186 @@ |
|||
'use strict'; |
|||
import React, { useState, useEffect } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Button, Table, Spin, Select, Divider, Popconfirm } from 'antd'; |
|||
import moment from 'moment'; |
|||
import { debounce } from 'lodash' |
|||
import AddModal from '../components/task/addTaskModal'; |
|||
import { getRoadway } from '../actions/infor' |
|||
import { getTask } from '../actions/task' |
|||
import { delTask } from '../actions/task' |
|||
|
|||
const Task = (props) => { |
|||
const { dispatch } = props |
|||
const [addModalVis, setAddModalVis] = useState(false) |
|||
const [roadRes, setRoadRes] = useState([])//路线列表
|
|||
const [selectVal, setSelectVal] = useState('all')//选择框得值
|
|||
const [inputVal, setIputVal] = useState(undefined) |
|||
const [taskRes, setTaskRes] = useState([]) |
|||
const [recordRow, setRecordRow] = useState(null) |
|||
const [lookVal, setLookval] = useState('') |
|||
useEffect(async () => { |
|||
const res = await dispatch(getRoadway({})) |
|||
setRoadRes(res.payload.data) |
|||
}, []) |
|||
|
|||
const getData = async (querySelect = { id: inputVal, isdanger: selectVal === 'all' ? undefined : selectVal === 'y' ? true : false }) => { |
|||
const task = await dispatch(getTask(querySelect)) |
|||
setTaskRes(task.payload?.data) |
|||
} |
|||
useEffect(async () => { |
|||
getData() |
|||
}, []) |
|||
//搜索道路名称
|
|||
const searchRoadName = async (value) => { |
|||
const task = await dispatch(getTask({ id: value, isdanger: selectVal === 'all' ? undefined : selectVal === 'y' ? true : false })) |
|||
setTaskRes(task.payload?.data) |
|||
setIputVal(value) |
|||
} |
|||
//选择安全是否消除
|
|||
const changeSelect = async (value) => { |
|||
console.log('value', value) |
|||
const task1 = await dispatch(getTask({ id: inputVal, isdanger: value === 'all' ? undefined : value === 'y' ? true : false })) |
|||
setTaskRes(task1.payload?.data) |
|||
setSelectVal(value) |
|||
} |
|||
//刪除task
|
|||
const delTaskHandler = async (record) => { |
|||
const res = await dispatch(delTask({ id: record.id })) |
|||
if (res.success) { |
|||
getData() |
|||
} |
|||
} |
|||
//查看
|
|||
const look = (record) => { |
|||
setAddModalVis(true) |
|||
setLookval(record) |
|||
setRecordRow(record); |
|||
|
|||
} |
|||
//配置表格列
|
|||
const columns = [{ |
|||
title: '路线名称', |
|||
render: (_, record) => { |
|||
return <div>{record.road.routeName}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '路线代码', |
|||
render: (_, record) => { |
|||
return <div>{record.road.routeCode}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '隐患说明', |
|||
dataIndex: 'dangerDescription', |
|||
//with: 20,
|
|||
// textWrap: 'word-break',
|
|||
// ellipsis: true
|
|||
}, |
|||
{ |
|||
title: '下发时间', |
|||
render: (_, record) => { |
|||
return <div>{record.issuanceTime ? moment(record?.issuanceTime).format('YYYY-MM-DD HH:mm:ss') : ''}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '责任人', |
|||
//with: 20,
|
|||
render: (_, record) => { |
|||
return <div>{record.user.name}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '是否消除隐患', |
|||
render: (_, record) => { |
|||
return <div>{record.isdanger === null ? '' : record.isdanger === 'true' ? '是' : '否'}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '上报时间', |
|||
render: (_, record) => { |
|||
return <div>{record.reportTime ? moment(record.reportTime).format('YYYY-MM-DD HH:mm:ss') : ''}</div> |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
render: (dom, record) => { |
|||
return <div> |
|||
{record.reportTime ? '' : <Button type='link' onClick={() => { |
|||
setRecordRow(record); |
|||
setAddModalVis(true) |
|||
}}>编辑</Button>} |
|||
<Popconfirm title='确定要删除吗?' onConfirm={() => { delTaskHandler(record) }}><Button type='link'>刪除</Button></Popconfirm> |
|||
<Button type='link' onClick={() => { look(record) }}>查看</Button> |
|||
</div> |
|||
|
|||
} |
|||
}, |
|||
] |
|||
|
|||
//配置分页
|
|||
const paginationOpt = { |
|||
defaultCurrent: 1, |
|||
defaultPageSize: 5, |
|||
total: taskRes?.count, |
|||
showSizeChanger: true, |
|||
showQuickJumper: true, |
|||
pageSizeOptions: ["5", "10", "15"], |
|||
showTotal: function () { |
|||
return `共有${taskRes?.count}条` |
|||
} |
|||
} |
|||
|
|||
|
|||
return (<div className='taskMenu'> |
|||
<div style={{ display: 'flex', flexWrap: ' nowrap', justifyContent: 'space-between' }}> |
|||
<div style={{ marginLeft: 20 }}> |
|||
路线名称: <Select |
|||
allowClear='true' |
|||
showSearch |
|||
placeholder="请输入关键词" |
|||
//optionFilterProp="children"
|
|||
onChange={(value) => { searchRoadName(value) }} |
|||
//onSearch={(value) => { console.log('11111', value) }}
|
|||
filterOption={(input, option) => |
|||
(option?.label ?? '').toLowerCase().includes(input.toLowerCase()) |
|||
} |
|||
options={roadRes?.map((item) => ({ |
|||
label: item.routeName, |
|||
value: item.id |
|||
}) |
|||
)} |
|||
/> |
|||
</div> |
|||
<div> |
|||
是否存在安全隐患: <Select placeholder='请输入关键词' |
|||
options={[{ value: 'all', label: '全部' }, { value: 'y', label: '是' }, { value: 'n', label: '否' }]} |
|||
|
|||
onChange={(value) => { changeSelect(value) }}> |
|||
</Select> |
|||
</div> |
|||
<div > |
|||
<Button type='primary' onClick={() => { setRecordRow(null); setAddModalVis(true) }}>新增</Button> |
|||
</div> |
|||
</div> |
|||
<Divider style={{ marginTop: 10 }} /> |
|||
<Table columns={columns} dataSource={taskRes?.rows} size="small" pagination={paginationOpt}> |
|||
</Table> |
|||
<AddModal visible={addModalVis} onClose={() => { setAddModalVis(false); getData(); setRecordRow(null); setLookval(null) }} recordRow={recordRow} |
|||
lookVal={lookVal} |
|||
></AddModal> |
|||
|
|||
</div >) |
|||
|
|||
|
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
//const { task } = state;
|
|||
return { |
|||
|
|||
//isRequesting: task.isRequesting,
|
|||
} |
|||
} |
|||
|
|||
export default connect(mapStateToProps)(Task); |
@ -1,42 +1,243 @@ |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Input, Table, Button, Select, message, Popconfirm } from 'antd'; |
|||
// import { getAccidentInfo, createAccidentInfo, deleteAccidentInfo, editAccidentInfo, getAllCompany } from '../actions/device';
|
|||
|
|||
// import EditAccidentModal from '../components/editAccidentModal';
|
|||
import EditGuanlang from '../components/editGuanlang'; |
|||
import '../style.less'; |
|||
import { getDepMessage, getReportStatistic } from "../actions/infor" |
|||
import VideoTable from '../components/videoTable'; |
|||
const superagent = require('superagent'); |
|||
const Videois = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
//批量导出
|
|||
const exports = (ids, counts) => { |
|||
// console.log(user);
|
|||
let reportIds = []; |
|||
if (ids.length) |
|||
reportIds = ids |
|||
else |
|||
reportIds = (counts || {}).ids || []; |
|||
superagent.post('/_report/http') |
|||
.send({ id: reportIds.map(i => Number(i)) }).end((err, res) => { |
|||
const resTextIs = res.text.split('/').pop() |
|||
window.open( |
|||
'/_api/' + |
|||
`attachments?src=files/${resTextIs}&filename=${encodeURIComponent(resTextIs)}&token=${user.token}`) |
|||
}) |
|||
} |
|||
return ( |
|||
<> <VideoTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
import { Func } from '$utils'; |
|||
|
|||
import moment from 'moment'; |
|||
var recordId = null; |
|||
const Guanlang = (props) => { |
|||
const { dispatch, user, totalPage, companys, creditScore } = props |
|||
const [data, setData] = useState([]) |
|||
const [modalVisible, setModalVisible] = useState(false); |
|||
const [modalRecord, setModalRecord] = useState(); |
|||
const [companyName, setCompanyName] = useState(null) |
|||
const [creditCode, setCreditCode] = useState(null) |
|||
const [pageSize, setPageSize] = useState(10); |
|||
const [currentPage, setCurrentPage] = useState(1); |
|||
const [applyStatus, setApplyStatus] = useState(null); |
|||
const [applyState, setApplyState] = useState('check'); // check 查看;create 新增; apply 初审; approve 复审
|
|||
const [editModal, setEditModal] = useState(false); |
|||
const [readOnly, setReadOnly] = useState(false); |
|||
|
|||
const accidentInfo= [] |
|||
// const initial = (params, search = false) => {
|
|||
// dispatch(getAccidentInfo(params)).then(() => { if (search) setCurrentPage(1) })
|
|||
// }
|
|||
|
|||
useEffect(() => { |
|||
const params = { limit: pageSize, offset: currentPage } |
|||
// initial(params)
|
|||
}, [true]) |
|||
|
|||
|
|||
const openModal = (record, state) => { |
|||
if (state == 'check') { |
|||
setReadOnly(true) |
|||
} else { |
|||
setReadOnly(false) |
|||
} |
|||
searchCompany(record.companyName) |
|||
setApplyState(state); |
|||
setModalVisible(true); |
|||
setModalRecord(record); |
|||
} |
|||
const search = () => { |
|||
const params = { company: companyName, applyStatus, limit: pageSize, offset: 1 } |
|||
// initial(params, true)
|
|||
} |
|||
const clearSearch = () => { |
|||
setCompanyName(null) |
|||
setCreditCode(null) |
|||
const params = { limit: pageSize, offset: currentPage } |
|||
// initial(params)
|
|||
} |
|||
const columns = [ |
|||
{ |
|||
title: '序号', |
|||
dataIndex: 'companyName', |
|||
key: 'companyName', |
|||
|
|||
}, |
|||
{ |
|||
title: '设备名称', |
|||
dataIndex: 'accidentTime', |
|||
key: 'accidentTime', |
|||
|
|||
render: (text) => { |
|||
return moment(text).format('YYYY-MM-DD') |
|||
} |
|||
}, |
|||
{ |
|||
title: '设备状态', |
|||
dataIndex: 'stationName', |
|||
key: 'stationName', |
|||
|
|||
render: (v, t) => { |
|||
let list = t.accidentStations.map(item => item.stationName); |
|||
return list.join(','); |
|||
} |
|||
}, |
|||
{ |
|||
title: '接入类型', |
|||
dataIndex: 'stationName', |
|||
key: 'stationName', |
|||
|
|||
render: (v, t) => { |
|||
let list = t.accidentStations.map(item => item.stationName); |
|||
return list.join(','); |
|||
} |
|||
}, |
|||
{ |
|||
title: '设备厂家', |
|||
dataIndex: 'stationName', |
|||
key: 'stationName', |
|||
|
|||
render: (v, t) => { |
|||
let list = t.accidentStations.map(item => item.stationName); |
|||
return list.join(','); |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
render: (record) => { |
|||
return ( |
|||
<span> |
|||
<a onClick={() => openModal(record, 'check')}>查看 </a> |
|||
<a onClick={() => openModal(record, 'edit')}>编辑 </a> |
|||
<Popconfirm |
|||
title="确认删除" |
|||
onConfirm={() => { |
|||
// console.log(record)
|
|||
// dispatch(deleteAccidentInfo(record.id)).then((res) => {
|
|||
// if (res.success) {
|
|||
// message.success('删除记录成功');
|
|||
// search();
|
|||
// }
|
|||
// }
|
|||
// )
|
|||
} |
|||
} |
|||
> |
|||
<a>删除 </a> |
|||
</Popconfirm> |
|||
</span> |
|||
) |
|||
} |
|||
} |
|||
]; |
|||
|
|||
const handleSaveScore = (data) => { |
|||
console.log('执行了') |
|||
setModalVisible(false); |
|||
// if (applyState == 'create')
|
|||
// dispatch(createAccidentInfo(data)).then(res => {
|
|||
// if (res.success) {
|
|||
// message.success('事故资讯添加成功');
|
|||
// setModalVisible(false);
|
|||
// search();
|
|||
// }
|
|||
// })
|
|||
// else if (applyState == 'edit') {
|
|||
// dispatch(editAccidentInfo(data)).then(res => {
|
|||
// if (res.success) {
|
|||
// message.success('事故资讯编辑成功');
|
|||
// setModalVisible(false);
|
|||
// search();
|
|||
// }
|
|||
// })
|
|||
// }
|
|||
} |
|||
var timer = null; |
|||
const searchCompany = (companyName) => { |
|||
if (timer) { |
|||
clearTimeout(timer) |
|||
} else { |
|||
timer = setTimeout(() => { |
|||
// dispatch(getAllCompany({ companyName }));
|
|||
}, 400); |
|||
} |
|||
} |
|||
|
|||
const spanStyle = { diplay: 'inline-block', marginLeft: 10 } |
|||
const inputStyle = { width: 200 } |
|||
return ( |
|||
<div style={{ margin: 5 }}> |
|||
<div style={{ marginBottom: 10 }}> |
|||
<span style={spanStyle}> |
|||
设备搜索: |
|||
<Input style={inputStyle} placeholder='请输入' value={companyName} onChange={(v) => setCompanyName(v.target.value)}></Input> |
|||
</span> |
|||
<span style={{...spanStyle,marginLeft: 40}}> |
|||
接入类型: |
|||
<Input style={inputStyle} placeholder='请输入' value={companyName} onChange={(v) => setCompanyName(v.target.value)}></Input> |
|||
</span> |
|||
<span style={{...spanStyle,marginLeft: 40}}> |
|||
厂家筛选: |
|||
<Input style={inputStyle} placeholder='请输入' value={companyName} onChange={(v) => setCompanyName(v.target.value)}></Input> |
|||
</span> |
|||
<span style={{...spanStyle,marginLeft: 40}}> |
|||
查询状态: |
|||
<Input style={inputStyle} placeholder='请输入' value={companyName} onChange={(v) => setCompanyName(v.target.value)}></Input> |
|||
</span> |
|||
<Button type='primary' onClick={() => search()} style={{ marginLeft: 15 }}>查询</Button> |
|||
<Button onClick={() => { setModalVisible(true); setApplyState('create'); setReadOnly(false); setModalRecord(null) }} style={{ marginLeft: 15 }}>新增</Button> |
|||
</div> |
|||
|
|||
<div> |
|||
<Table |
|||
rowKey='id' |
|||
columns={columns} |
|||
dataSource={accidentInfo} |
|||
pagination={{ |
|||
total: totalPage, |
|||
showSizeChanger: true, |
|||
showQuickJumper: true, |
|||
current: currentPage, |
|||
showTotal: (total) => { |
|||
return <span style={{ fontSize: 15 }}>{`共${Math.ceil(total / pageSize)}页,${total}项`}</span> |
|||
}, |
|||
onShowSizeChange: (currentPage, pageSize) => { |
|||
setCurrentPage(currentPage); |
|||
setPageSize(pageSize); |
|||
const params = { company: companyName, creditCode, limit: pageSize, offset: currentPage } |
|||
// initial(params)
|
|||
}, |
|||
onChange: (page, pageSize) => { |
|||
setCurrentPage(page); |
|||
setPageSize(pageSize); |
|||
const params = { company: companyName, creditCode, limit: pageSize, offset: page } |
|||
// initial(params)
|
|||
} |
|||
}} |
|||
/> |
|||
|
|||
{modalVisible ? <EditGuanlang |
|||
visible={modalVisible} |
|||
onCancel={() => { setModalVisible(false) }} |
|||
handleSaveScore={handleSaveScore} |
|||
// searchCompany={searchCompany}
|
|||
companys={companys} |
|||
editData={modalRecord} |
|||
readOnly={readOnly} |
|||
applyState={applyState} |
|||
></EditGuanlang> : ''} |
|||
</div> |
|||
</div> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
} |
|||
const { auth, accidentInfo, allCompany } = state |
|||
return { |
|||
// user: auth?.user,
|
|||
// accidentInfo: accidentInfo?.data && accidentInfo?.data.rows || [],
|
|||
// totalPage: accidentInfo.data && accidentInfo.data.count,
|
|||
// companys: allCompany.data && allCompany.data.rows || []
|
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(Videois); |
|||
export default connect(mapStateToProps)(Guanlang); |
|||
|
|||
|
Loading…
Reference in new issue