zhaobing
1 year ago
19 changed files with 1142 additions and 439 deletions
@ -0,0 +1,24 @@ |
|||
'use strict'; |
|||
const moment = require('moment') |
|||
|
|||
async function appoint(ctx) { |
|||
try { |
|||
const models = ctx.fs.dc.models |
|||
const { recordId, performerId } = ctx.request.body |
|||
await models.Report.update({ |
|||
performerId |
|||
}, { where: { id: recordId } }) |
|||
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 = { |
|||
appoint |
|||
}; |
@ -1,136 +1,152 @@ |
|||
/* eslint-disable*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = dc => { |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const Project = sequelize.define("project", { |
|||
id: { |
|||
index: 1, |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true, |
|||
unique: "project_id_uindex" |
|||
}, |
|||
entryName: { |
|||
index: 2, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "项目名称", |
|||
primaryKey: false, |
|||
field: "entry_name", |
|||
autoIncrement: false |
|||
}, |
|||
projectMileage: { |
|||
index: 3, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "工程里程", |
|||
primaryKey: false, |
|||
field: "project_mileage", |
|||
autoIncrement: false |
|||
}, |
|||
investment: { |
|||
index: 4, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "投资", |
|||
primaryKey: false, |
|||
field: "investment", |
|||
autoIncrement: false |
|||
}, |
|||
buildUnit: { |
|||
index: 5, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "建设单位", |
|||
primaryKey: false, |
|||
field: "build_unit", |
|||
autoIncrement: false |
|||
}, |
|||
constructionControlUnit: { |
|||
index: 6, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "监理单位", |
|||
primaryKey: false, |
|||
field: "construction_control_unit", |
|||
autoIncrement: false |
|||
}, |
|||
designUnit: { |
|||
index: 7, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "设计单位", |
|||
primaryKey: false, |
|||
field: "design_unit", |
|||
autoIncrement: false |
|||
}, |
|||
constructionUnit: { |
|||
index: 8, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "施工单位", |
|||
primaryKey: false, |
|||
field: "construction_unit", |
|||
autoIncrement: false |
|||
}, |
|||
supervisorAndSupervisor: { |
|||
index: 9, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "监督负责人及监督人员", |
|||
primaryKey: false, |
|||
field: "supervisor_and_supervisor", |
|||
autoIncrement: false |
|||
}, |
|||
projectProgress: { |
|||
index: 10, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "项目进展情况", |
|||
primaryKey: false, |
|||
field: "project_progress", |
|||
autoIncrement: false |
|||
}, |
|||
done: { |
|||
index: 11, |
|||
type: DataTypes.BOOLEAN, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "done", |
|||
autoIncrement: false |
|||
}, |
|||
type: { |
|||
index: 12, |
|||
type: DataTypes.STRING, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "类型 道路:road / 桥梁:bridge", |
|||
primaryKey: false, |
|||
field: "type", |
|||
autoIncrement: false |
|||
} |
|||
}, { |
|||
tableName: "project", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
dc.models.Project = Project; |
|||
return Project; |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const Project = sequelize.define("project", { |
|||
id: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true, |
|||
unique: "project_id_uindex" |
|||
}, |
|||
entryName: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "项目名称", |
|||
primaryKey: false, |
|||
field: "entry_name", |
|||
autoIncrement: false |
|||
}, |
|||
projectMileage: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "工程里程", |
|||
primaryKey: false, |
|||
field: "project_mileage", |
|||
autoIncrement: false |
|||
}, |
|||
investment: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "投资", |
|||
primaryKey: false, |
|||
field: "investment", |
|||
autoIncrement: false |
|||
}, |
|||
buildUnit: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "建设单位", |
|||
primaryKey: false, |
|||
field: "build_unit", |
|||
autoIncrement: false |
|||
}, |
|||
constructionControlUnit: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "监理单位", |
|||
primaryKey: false, |
|||
field: "construction_control_unit", |
|||
autoIncrement: false |
|||
}, |
|||
designUnit: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "设计单位", |
|||
primaryKey: false, |
|||
field: "design_unit", |
|||
autoIncrement: false |
|||
}, |
|||
constructionUnit: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "施工单位", |
|||
primaryKey: false, |
|||
field: "construction_unit", |
|||
autoIncrement: false |
|||
}, |
|||
supervisorAndSupervisor: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "监督负责人及监督人员", |
|||
primaryKey: false, |
|||
field: "supervisor_and_supervisor", |
|||
autoIncrement: false |
|||
}, |
|||
projectProgress: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "项目进展情况", |
|||
primaryKey: false, |
|||
field: "project_progress", |
|||
autoIncrement: false |
|||
}, |
|||
done: { |
|||
type: DataTypes.BOOLEAN, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "done", |
|||
autoIncrement: false |
|||
}, |
|||
type: { |
|||
type: DataTypes.STRING, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "类型 道路:road / 桥梁:bridge", |
|||
primaryKey: false, |
|||
field: "type", |
|||
autoIncrement: false |
|||
}, |
|||
startTime: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "开工时间", |
|||
primaryKey: false, |
|||
field: "start_time", |
|||
autoIncrement: false |
|||
}, |
|||
remark: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "备注", |
|||
primaryKey: false, |
|||
field: "remark", |
|||
autoIncrement: false |
|||
}, |
|||
qutityUnit: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "质量检测单位", |
|||
primaryKey: false, |
|||
field: "qutity_unit", |
|||
autoIncrement: false |
|||
} |
|||
}, { |
|||
tableName: "project", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
dc.models.Project = Project; |
|||
return Project; |
|||
}; |
@ -1,206 +1,216 @@ |
|||
/* eslint-disable*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = dc => { |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const Report = sequelize.define("report", { |
|||
id: { |
|||
index: 1, |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true, |
|||
unique: "report_id_uindex" |
|||
}, |
|||
reportType: { |
|||
index: 2, |
|||
type: DataTypes.STRING, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "上报类型", |
|||
primaryKey: false, |
|||
field: "report_type", |
|||
autoIncrement: false |
|||
}, |
|||
projectType: { |
|||
index: 3, |
|||
type: DataTypes.STRING, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "工程类型", |
|||
primaryKey: false, |
|||
field: "project_type", |
|||
autoIncrement: false |
|||
}, |
|||
road: { |
|||
index: 4, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '所属道路', |
|||
primaryKey: false, |
|||
field: "road", |
|||
autoIncrement: false |
|||
}, |
|||
roadSectionStart: { |
|||
index: 5, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '开始路段', |
|||
primaryKey: false, |
|||
field: "road_section_start", |
|||
autoIncrement: false |
|||
}, |
|||
roadSectionEnd: { |
|||
index: 6, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '结束路段', |
|||
primaryKey: false, |
|||
field: "road_section_end", |
|||
autoIncrement: false |
|||
}, |
|||
longitude: { |
|||
index: 7, |
|||
type: DataTypes.DOUBLE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '经度', |
|||
primaryKey: false, |
|||
field: "longitude", |
|||
autoIncrement: false |
|||
}, |
|||
latitude: { |
|||
index: 8, |
|||
type: DataTypes.DOUBLE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '纬度', |
|||
primaryKey: false, |
|||
field: "latitude", |
|||
autoIncrement: false |
|||
}, |
|||
content: { |
|||
index: 9, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '具体内容', |
|||
primaryKey: false, |
|||
field: "content", |
|||
autoIncrement: false |
|||
}, |
|||
scenePic: { |
|||
index: 10, |
|||
type: DataTypes.ARRAY(DataTypes.STRING), |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "scene_pic", |
|||
autoIncrement: false |
|||
}, |
|||
conserveBeforePic: { |
|||
index: 11, |
|||
type: DataTypes.ARRAY(DataTypes.STRING), |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "conserve_before_pic", |
|||
autoIncrement: false |
|||
}, |
|||
conserveUnderwayPic: { |
|||
index: 12, |
|||
type: DataTypes.ARRAY(DataTypes.STRING), |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "conserve_underway_pic", |
|||
autoIncrement: false |
|||
}, |
|||
conserveAfterPic: { |
|||
index: 13, |
|||
type: DataTypes.ARRAY(DataTypes.STRING), |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "conserve_after_pic", |
|||
autoIncrement: false |
|||
}, |
|||
userId: { |
|||
index: 14, |
|||
type: DataTypes.INTEGER, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "user_id", |
|||
autoIncrement: false |
|||
}, |
|||
time: { |
|||
index: 15, |
|||
type: DataTypes.DATE, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: '创建日期', |
|||
primaryKey: false, |
|||
field: "time", |
|||
autoIncrement: false |
|||
}, |
|||
address: { |
|||
index: 16, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '具体位置', |
|||
primaryKey: false, |
|||
field: "address", |
|||
autoIncrement: false |
|||
}, |
|||
projectName: { |
|||
index: 17, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "工程名称", |
|||
primaryKey: false, |
|||
field: "project_name", |
|||
autoIncrement: false |
|||
}, |
|||
handleState: { |
|||
index: 18, |
|||
type: DataTypes.STRING, |
|||
allowNull: false, |
|||
defaultValue: "已处理", |
|||
// comment: "处理状态",
|
|||
primaryKey: false, |
|||
field: "handle_state", |
|||
autoIncrement: false |
|||
}, |
|||
codeRoad: { |
|||
index: 19, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: "", |
|||
// comment: "路线代码",
|
|||
primaryKey: false, |
|||
field: "code_road", |
|||
autoIncrement: false |
|||
}, |
|||
}, { |
|||
tableName: "report", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
dc.models.Report = Report; |
|||
return Report; |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const Report = sequelize.define("report", { |
|||
id: { |
|||
index: 1, |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true, |
|||
unique: "report_id_uindex" |
|||
}, |
|||
reportType: { |
|||
index: 2, |
|||
type: DataTypes.STRING, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "上报类型", |
|||
primaryKey: false, |
|||
field: "report_type", |
|||
autoIncrement: false |
|||
}, |
|||
projectType: { |
|||
index: 3, |
|||
type: DataTypes.STRING, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "工程类型", |
|||
primaryKey: false, |
|||
field: "project_type", |
|||
autoIncrement: false |
|||
}, |
|||
road: { |
|||
index: 4, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '所属道路', |
|||
primaryKey: false, |
|||
field: "road", |
|||
autoIncrement: false |
|||
}, |
|||
roadSectionStart: { |
|||
index: 5, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '开始路段', |
|||
primaryKey: false, |
|||
field: "road_section_start", |
|||
autoIncrement: false |
|||
}, |
|||
roadSectionEnd: { |
|||
index: 6, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '结束路段', |
|||
primaryKey: false, |
|||
field: "road_section_end", |
|||
autoIncrement: false |
|||
}, |
|||
longitude: { |
|||
index: 7, |
|||
type: DataTypes.DOUBLE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '经度', |
|||
primaryKey: false, |
|||
field: "longitude", |
|||
autoIncrement: false |
|||
}, |
|||
latitude: { |
|||
index: 8, |
|||
type: DataTypes.DOUBLE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '纬度', |
|||
primaryKey: false, |
|||
field: "latitude", |
|||
autoIncrement: false |
|||
}, |
|||
content: { |
|||
index: 9, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '具体内容', |
|||
primaryKey: false, |
|||
field: "content", |
|||
autoIncrement: false |
|||
}, |
|||
scenePic: { |
|||
index: 10, |
|||
type: DataTypes.ARRAY(DataTypes.STRING), |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "scene_pic", |
|||
autoIncrement: false |
|||
}, |
|||
conserveBeforePic: { |
|||
index: 11, |
|||
type: DataTypes.ARRAY(DataTypes.STRING), |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "conserve_before_pic", |
|||
autoIncrement: false |
|||
}, |
|||
conserveUnderwayPic: { |
|||
index: 12, |
|||
type: DataTypes.ARRAY(DataTypes.STRING), |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "conserve_underway_pic", |
|||
autoIncrement: false |
|||
}, |
|||
conserveAfterPic: { |
|||
index: 13, |
|||
type: DataTypes.ARRAY(DataTypes.STRING), |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "conserve_after_pic", |
|||
autoIncrement: false |
|||
}, |
|||
userId: { |
|||
index: 14, |
|||
type: DataTypes.INTEGER, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "user_id", |
|||
autoIncrement: false |
|||
}, |
|||
time: { |
|||
index: 15, |
|||
type: DataTypes.DATE, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: '创建日期', |
|||
primaryKey: false, |
|||
field: "time", |
|||
autoIncrement: false |
|||
}, |
|||
address: { |
|||
index: 16, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: '具体位置', |
|||
primaryKey: false, |
|||
field: "address", |
|||
autoIncrement: false |
|||
}, |
|||
projectName: { |
|||
index: 17, |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "工程名称", |
|||
primaryKey: false, |
|||
field: "project_name", |
|||
autoIncrement: false |
|||
}, |
|||
handleState: { |
|||
index: 18, |
|||
type: DataTypes.STRING, |
|||
allowNull: false, |
|||
defaultValue: "已处理", |
|||
// comment: "处理状态",
|
|||
primaryKey: false, |
|||
field: "handle_state", |
|||
autoIncrement: false |
|||
}, |
|||
routeCode: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "route_code", |
|||
autoIncrement: false |
|||
}, |
|||
performerId: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "执行者", |
|||
primaryKey: false, |
|||
field: "performer_id", |
|||
autoIncrement: false |
|||
} |
|||
|
|||
}, { |
|||
tableName: "report", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
dc.models.Report = Report; |
|||
return Report; |
|||
}; |
@ -0,0 +1,17 @@ |
|||
alter table project |
|||
add start_time timestamp with time zone; |
|||
|
|||
comment on column project.start_time is '开工时间'; |
|||
|
|||
|
|||
alter table project |
|||
add remark varchar(300); |
|||
|
|||
comment on column project.remark is '备注'; |
|||
|
|||
alter table project |
|||
add qutity_unit varchar(1024); |
|||
|
|||
comment on column project.qutity_unit is '质量检测单位'; |
|||
|
|||
|
@ -0,0 +1,4 @@ |
|||
alter table report |
|||
add performer_id integer; |
|||
|
|||
comment on column report.performer_id is '处理人'; |
@ -0,0 +1,13 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
export function appointTask(query) { |
|||
return dispatch => basicAction({ |
|||
type: 'put', |
|||
dispatch: dispatch, |
|||
data: query, |
|||
actionType: 'PUT_APPOINT_TASK', |
|||
url: ApiTable.appointTask, |
|||
msg: { option: '指派任务' }, |
|||
}); |
|||
} |
@ -0,0 +1,379 @@ |
|||
'use strict'; |
|||
|
|||
import React, { useState, useEffect, useRef } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin, Button, Popconfirm } from 'antd'; |
|||
import ProTable from '@ant-design/pro-table'; |
|||
import './protable.less' |
|||
import ProjectModal from './project/project'; |
|||
import { getProject, delProject } from "../actions/infor" |
|||
|
|||
import moment from 'moment'; |
|||
// import UserModal from './infor/details';
|
|||
const BuildingTable = (props) => { |
|||
const { dispatch, user, depData, depMessage, depLoading } = props |
|||
const [rowSelected, setRowSelected] = useState([]) |
|||
const [sitename, setSitename] = useState()//名称
|
|||
const [counts, setCounts] = useState()//shuju
|
|||
const [modalVisible, setModalVisible] = useState(false); |
|||
const [modalVisibleyilan, setModalVisibleyilan] = useState(false); |
|||
const [modalRecord, setModalRecord] = useState(); |
|||
const [typecard, setTypecard] = useState(); |
|||
const [recortd, setRecortd] = useState() |
|||
const [whichofits, setWhichofits] = useState('在建项目') |
|||
const [delet, setDelet] = useState() |
|||
const [differentiate, setDifferentiate] = useState('road') |
|||
const [grade, setGrade] = useState('project') |
|||
const [departmentInfo, setDepartment] = useState('') |
|||
const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : '') |
|||
|
|||
const ref = useRef() |
|||
const [activeKey, setActiveKey] = useState('tab1'); |
|||
//打开弹窗
|
|||
const yilanModal = (type, record) => { |
|||
setModalVisibleyilan(true); |
|||
// setModalType(type);
|
|||
if (type == 'edit') { |
|||
setModalRecord(record); |
|||
} else { |
|||
setModalRecord(null); |
|||
} |
|||
} |
|||
const getData = async () => { |
|||
const res = await dispatch(getProject({ |
|||
entryName: sitename |
|||
})); |
|||
setCounts(res.payload.data) |
|||
} |
|||
const deldatas = async (id) => { // 工程
|
|||
const query = { |
|||
projectId: id |
|||
} |
|||
dispatch(delProject(query)).then((res) => { |
|||
setDelet(res) |
|||
}) |
|||
const res = await dispatch(getProject({ |
|||
entryName: sitename |
|||
})); |
|||
setCounts(res.payload.data) |
|||
} |
|||
|
|||
const columns = { |
|||
tab1: [ |
|||
{ |
|||
title: '项目名称', |
|||
dataIndex: 'placeName', |
|||
fixed: 'left', |
|||
width: 120, |
|||
options: 1, |
|||
backgroundColor: "#ffffff", |
|||
fieldProps: { |
|||
onChange: (value, cs) => { |
|||
setSitename(value.currentTarget.value) |
|||
}, |
|||
placeholder: '请输入项目名称进行搜索', |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
}, |
|||
render: (dom, record) => { |
|||
return record.entryName |
|||
}, |
|||
}, |
|||
{ |
|||
title: '项目规模(公里)', |
|||
search: false, |
|||
dataIndex: 'containers', |
|||
|
|||
fixed: 'left', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.projectMileage |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '项目投资(万元)', |
|||
search: false, |
|||
dataIndex: 'time2', |
|||
valueType: 'dateRange', |
|||
// align: 'right',
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.investment |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '业主单位', |
|||
search: false, |
|||
dataIndex: 'time3', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.buildUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '质量监督单位', |
|||
search: false, |
|||
dataIndex: 'time3', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.qutityUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '施工单位', |
|||
search: false, |
|||
dataIndex: 'time6', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.constructionUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '设计单位', |
|||
search: false, |
|||
dataIndex: 'time5', |
|||
valueType: 'dateRange', |
|||
|
|||
|
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.designUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, { |
|||
title: '监理单位', |
|||
search: false, |
|||
dataIndex: 'time4', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.constructionControlUnit |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '开工时间', |
|||
search: false, |
|||
dataIndex: 'time7', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.startTime ? moment(record.startTime).format('YYYY-MM-DD') : '' |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '是否完成', |
|||
search: false, |
|||
dataIndex: 'time8', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.done === true ? '已完成' : '未完成' |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '备注', |
|||
search: false, |
|||
dataIndex: 'time9', |
|||
valueType: 'dateRange', |
|||
width: 120, |
|||
render: (dom, record) => { |
|||
return record.remark |
|||
}, |
|||
fieldProps: { |
|||
getPopupContainer: (triggerNode) => triggerNode.parentNode, |
|||
} |
|||
}, |
|||
{ |
|||
title: '操作', |
|||
dataIndex: 'creatTime', |
|||
valueType: 'dateTimeRange', |
|||
hideInSearch: true, |
|||
width: 160, |
|||
fixed: 'right', |
|||
render: (dom, record) => { |
|||
return <div><Button type="link" |
|||
onClick={() => { |
|||
yilanModal('edit', record) |
|||
setTypecard('compile') |
|||
setRecortd(record) |
|||
}} |
|||
disabled={editAble} |
|||
>编辑</Button><Popconfirm title='是否确认删除' onConfirm={() => { deldatas(record.id) }} disabled={editAble}> |
|||
<Button type="link" disabled={editAble}>删除</Button> |
|||
</Popconfirm></div> |
|||
|
|||
} |
|||
}, |
|||
{ |
|||
key: "direction", |
|||
hideInTable: true, |
|||
dataIndex: "direction", |
|||
order: 6, |
|||
renderFormItem: (item, { type, defaultRender, ...rest }, form, record) => { |
|||
return ( |
|||
<div> <Button |
|||
type="primary" |
|||
style={{ width: "100px" }} |
|||
onClick={() => { |
|||
yilanModal('edit', record) |
|||
setTypecard('') |
|||
}} |
|||
disabled={editAble} |
|||
> |
|||
新增 |
|||
</Button> |
|||
{/* <Button |
|||
type="primary" |
|||
style={{ width: "100px", marginLeft: 20 }} |
|||
|
|||
> |
|||
导入 |
|||
</Button> */} |
|||
</div> |
|||
|
|||
|
|||
); |
|||
}, |
|||
}, |
|||
] |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
return ( |
|||
<Spin spinning={false}> |
|||
<div className='protable-transpor'> |
|||
<ProTable |
|||
actionRef={ref} |
|||
toolbar={{ |
|||
multipleLine: true, |
|||
menu: { |
|||
activeKey, |
|||
onChange: (key) => setActiveKey(key), |
|||
items: [ |
|||
{ |
|||
key: 'tab1', |
|||
label: <span onClick={() => { |
|||
setWhichofits('在建项目') |
|||
setDifferentiate('project') |
|||
setGrade('在建项目') |
|||
|
|||
}}>在建项目{activeKey === 'tab1'}</span>, |
|||
}, |
|||
], |
|||
}, |
|||
}} |
|||
scroll={{ x: 800 }} |
|||
options={false} |
|||
ref={c => { finishedProductTable = c; }} |
|||
style={{ width: "100% ", overflow: "auto", height: '760px' }} |
|||
rowKey='id' |
|||
onReset={(v) => { |
|||
setSitename('') |
|||
}} |
|||
rowSelection={{ |
|||
selectedRowKeys: rowSelected, |
|||
onChange: (selectedRowKeys) => { |
|||
setRowSelected(selectedRowKeys); |
|||
}, |
|||
}} |
|||
columns={columns[activeKey]} |
|||
dataSource={counts || []} |
|||
request={async (params) => { |
|||
console.log(whichofits) |
|||
if (whichofits == '在建项目') { |
|||
const query = { |
|||
entryName: sitename |
|||
} |
|||
setRowSelected([]); |
|||
const res = await dispatch(getProject(query)); |
|||
setCounts(res.payload.data) |
|||
return { |
|||
...res, |
|||
total: res.payload.data ? res.payload.data.count : 0 |
|||
} |
|||
} |
|||
}} |
|||
search={{ |
|||
defaultCollapsed: false, |
|||
optionRender: (searchConfig, formProps, dom) => [ |
|||
...dom.reverse(), |
|||
<Popconfirm title="确认导出?" onConfirm={() => { props.exports(rowSelected, grade, differentiate) }} |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : ''} |
|||
> |
|||
<Button |
|||
disabled={user?.username !== 'SuperAdmin' && user?.userResources?.filter(i => i.resourceId === 'ROADMANAGE')[0].isshow === "true" ? true : ''} |
|||
> |
|||
导出 |
|||
</Button> |
|||
</Popconfirm> |
|||
], |
|||
}} |
|||
> |
|||
</ProTable> |
|||
</div> |
|||
|
|||
{modalVisibleyilan ? <ProjectModal |
|||
visible={modalVisibleyilan} |
|||
onVisibleChange={setModalVisibleyilan} |
|||
modalRecord={modalRecord} |
|||
typecard={typecard} |
|||
getData={getData} |
|||
rewkeys={'road'} |
|||
recortd={recortd} |
|||
setRecortd={setRecortd} |
|||
setDelet={setDelet} |
|||
/> : ''} |
|||
</Spin > |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth, depMessage } = state; |
|||
const pakData = (dep) => { |
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
// children: d.type >= 2 ? [] : pakData(d.subordinate)
|
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
return { |
|||
user: auth.user, |
|||
depMessage: depMessage.data || [], |
|||
depLoading: depMessage.isRequesting, |
|||
depData, |
|||
}; |
|||
} |
|||
export default connect(mapStateToProps)(BuildingTable); |
@ -0,0 +1,152 @@ |
|||
'use strict'; |
|||
import React, { useState, useEffect, useCallback, useRef } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
import { Spin } from 'antd'; |
|||
import ProForm, { ProFormText, ModalForm, ProFormSwitch, ProFormTreeSelect, ProFormSelect } from '@ant-design/pro-form'; |
|||
import { getDepUser } from '../../../organization/actions/user' |
|||
import { appointTask } from '../../actions/appointTask' |
|||
import moment from 'moment'; |
|||
|
|||
|
|||
const NominateModal = (props) => { |
|||
const { recordId, visible, user, onCancel, depMessage, loading, depUser, clientHeight, depData, onVisibleChange, dispatch } = props |
|||
const [depId, setDepId] = useState(null) |
|||
const [depUsers, setDepUsers] = useState() |
|||
const selectRef = useRef(null); |
|||
|
|||
|
|||
const handleTreeSelectChange = async (value) => { |
|||
console.log('recordId', recordId) |
|||
setDepId(value) |
|||
// 根据选择的部门ID获取对应的用户数据
|
|||
setDepUsers(null) |
|||
const res = await dispatch(getDepUser(value)); |
|||
setDepUsers(res?.payload.data); |
|||
// 清空第二个输入框的值
|
|||
if (selectRef.current) { |
|||
selectRef.current.value = ''; |
|||
} |
|||
} |
|||
|
|||
const handleFinish = async (values) => { |
|||
const { name } = values; |
|||
// 在这里使用第二个框的值进行网络请求或其他操作
|
|||
|
|||
// await dispatch(yourAction(name));
|
|||
// 其他操作...
|
|||
// 取消弹窗
|
|||
onCancel(); |
|||
}; |
|||
const dispatchGetDepUser = useCallback(async () => { |
|||
if (depId) { |
|||
const res = await dispatch(getDepUser(depId)); |
|||
setDepUsers(res?.payload.data); |
|||
} |
|||
}, [depId, dispatch]); |
|||
|
|||
useEffect(() => { |
|||
dispatchGetDepUser() |
|||
}, [dispatchGetDepUser]) |
|||
const [depMessagedata, setdepMessagedata] = useState(depMessage) |
|||
return ( |
|||
<Spin spinning={false}> |
|||
<ModalForm |
|||
title='指派' |
|||
visible={visible} |
|||
onVisibleChange={onVisibleChange} |
|||
onFinish={handleFinish} |
|||
destroyOnClose |
|||
> |
|||
<ProForm.Group> |
|||
<ProFormTreeSelect |
|||
name={['contract', 'departmentId']} |
|||
placeholder="请选择所属部门" |
|||
width="md" |
|||
label="所属部门" |
|||
required |
|||
fieldNames={{ |
|||
title: 'name', |
|||
key: 'id', |
|||
children: 'subordinate' |
|||
}} |
|||
onSelect={(selectedKeys, { selected, selectedNodes }) => { |
|||
console.log('selected', selectedKeys) |
|||
|
|||
if (selected) { |
|||
setDepSelectedKeys(selectedKeys) |
|||
setDepSelected(selectedNodes[0].name || "") |
|||
dispatch(getDepUser(selectedKeys[0])) |
|||
} |
|||
}} |
|||
fieldProps={{ |
|||
onChange: handleTreeSelectChange, |
|||
fieldNames: { |
|||
label: 'title', |
|||
|
|||
}, |
|||
treeDefaultExpandAll: false, |
|||
}} |
|||
rules={[{ required: true, message: '请选择所属部门' }]} |
|||
request={async () => { |
|||
return depData |
|||
}} |
|||
expandedKeys={["title"]} |
|||
/> |
|||
{depUsers ? <ProFormSelect |
|||
ref={selectRef} |
|||
value={null} // 设置输入框的值为null
|
|||
onValuesChange={(values) => { console.log('values1', values) }} |
|||
name="name" |
|||
label="指派人" |
|||
request={async () => { |
|||
if (depId) { |
|||
const res = await dispatch(getDepUser(depId)); |
|||
const processedUsers = res?.payload.data.map((user) => ({ |
|||
label: user.name, // 使用用户的名字作为选项的显示文本
|
|||
value: user.id, // 使用用户的id作为选项的值
|
|||
})); |
|||
return Promise.resolve(processedUsers) |
|||
|
|||
} |
|||
|
|||
}} |
|||
placeholder="请选择指派人" |
|||
rules={[{ required: true, message: '请选择指派人' }]} |
|||
/> : ''} |
|||
|
|||
|
|||
</ProForm.Group> |
|||
|
|||
</ModalForm> |
|||
</Spin> |
|||
) |
|||
} |
|||
|
|||
function mapStateToProps(state) { |
|||
const { auth, depMessage, depUser, global } = state |
|||
const pakData = (dep) => { |
|||
// console.log(dep);
|
|||
return dep.map((d) => { |
|||
return { |
|||
title: d.name, |
|||
value: d.id, |
|||
// key: d.id,
|
|||
children: pakData(d.subordinate) |
|||
} |
|||
}) |
|||
} |
|||
let depData = pakData(depMessage.data || []) |
|||
// return {
|
|||
// loading: depMessage.isRequesting,
|
|||
// depData,
|
|||
// };
|
|||
return { |
|||
user: auth.user, |
|||
clientHeight: global.clientHeight, |
|||
loading: depMessage.isRequesting, |
|||
//depMessage: depMessage.data || [],
|
|||
depUser: depUser.data || [], |
|||
depData |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(NominateModal); |
@ -1,41 +1,38 @@ |
|||
'use strict'; |
|||
|
|||
import React, { useState, useEffect } from 'react'; |
|||
import React, { useEffect, useState } from 'react'; |
|||
import { connect } from 'react-redux'; |
|||
// import { Spin, Button, Popconfirm } from 'antd';
|
|||
// import ProTable from '@ant-design/pro-table';
|
|||
// //import './protable.less'
|
|||
import moment from 'moment'; |
|||
// import { getRoadway, getProject, delRoadway, delProject } from "../actions/infor"
|
|||
// import UserModal from './infor/details';
|
|||
// import ProjectModal from './project/project';
|
|||
import '../style.less'; |
|||
import BuildingTable from '../components/buildingTable'; |
|||
const superagent = require('superagent'); |
|||
const building = (props) => { |
|||
const { dispatch, user } = props |
|||
const [data, setData] = useState() |
|||
useEffect(() => { |
|||
// dispatch(getDepMessage())
|
|||
|
|||
setData(props) |
|||
}, []); |
|||
const exports = (ids, differentiate) => { |
|||
console.log('sssss1', ids, differentiate) |
|||
let idas = ids.toString() |
|||
if (differentiate == 'bridge') { |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&token=${user.token}`) |
|||
} if (differentiate == 'project') { |
|||
window.open( |
|||
'/_api/' + `data/export/?ids=${idas || ''}&exp=${differentiate}&token=${user.token}`) |
|||
} |
|||
|
|||
const Building = (props) => { |
|||
|
|||
} |
|||
return ( |
|||
<div> |
|||
hha |
|||
</div> |
|||
<> <BuildingTable data={data} exports={exports} /> |
|||
</> |
|||
) |
|||
} |
|||
function mapStateToProps(state) { |
|||
const { auth, depMessage } = state; |
|||
// const pakData = (dep) => {
|
|||
// return dep.map((d) => {
|
|||
// return {
|
|||
// title: d.name,
|
|||
// value: d.id,
|
|||
// // children: d.type >= 2 ? [] : pakData(d.subordinate)
|
|||
// children: pakData(d.subordinate)
|
|||
// }
|
|||
// })
|
|||
// }
|
|||
// let depData = pakData(depMessage.data || [])
|
|||
const { auth } = state |
|||
return { |
|||
user: auth.user, |
|||
// depMessage: depMessage.data || [],
|
|||
// depLoading: depMessage.isRequesting,
|
|||
// depData,
|
|||
}; |
|||
} |
|||
} |
|||
export default connect(mapStateToProps)(Building); |
|||
export default connect(mapStateToProps)(building); |
Loading…
Reference in new issue