Browse Source

养护抽查修改

dev
wenlele 1 year ago
parent
commit
701dd5c6b9
  1. 24
      api/app/lib/controllers/data/road.js
  2. 3
      api/app/lib/index.js
  3. 3
      api/app/lib/routes/data/index.js
  4. 14
      web/client/src/sections/fillion/actions/infor.js
  5. 27
      web/client/src/sections/fillion/components/infor/details.js
  6. 38
      web/client/src/sections/fillion/components/transportationTable.js
  7. 9
      web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js
  8. 1
      web/client/src/utils/webapi.js

24
api/app/lib/controllers/data/road.js

@ -39,7 +39,10 @@ async function get (ctx) {
let findOption = {
where: {},
order: [['id', 'DESC']]
order: [['id', 'DESC']],
}
if (level == '村') {
findOption.include = [{ model: models.Village, }]
}
if (alterId) {
findOption.where.id = { $notIn: alterId }
@ -173,8 +176,27 @@ async function del (ctx) {
}
}
async function getVillageList (ctx) {
try {
const models = ctx.fs.dc.models;
const { } = ctx.query;
const res = await models.Village.findAll()
ctx.status = 200;
ctx.body = res
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
message: typeof error == 'string' ? error : undefined
}
}
}
module.exports = {
importIn,
getRoadSection,
get, edit, del,
getVillageList,
};

3
api/app/lib/index.js

@ -94,6 +94,9 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq
VillageDistance.belongsTo(Village, { foreignKey: 'calcVillage', targetKey: 'id' });
Village.hasMany(VillageDistance, { foreignKey: 'calcVillage', sourceKey: 'id' });
Road.belongsTo(Village, { foreignKey: 'villageId', targetKey: 'id' });
};

3
api/app/lib/routes/data/index.js

@ -111,6 +111,9 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['DEL/road/:roadId'] = { content: '删除道路数据', visible: false };
router.del('/road/:roadId', road.del);
app.fs.api.logAttr['GET/village/list'] = { content: '获取村庄数据', visible: true };
router.get('/village/list', road.getVillageList);
// 道路 END
// 桥梁

14
web/client/src/sections/fillion/actions/infor.js

@ -111,6 +111,19 @@ export function putRoadway (query) {
msg: { option: query?.roadId ? '编辑' : '新增' + '道路信息' },
});
}
export function getVillageList(query={}) { // fId, limit, offset, searchTxt
return dispatch => basicAction({
type: 'get',
dispatch: dispatch,
actionType: 'GET_VILLAGE_LIST',
url: ApiTable.getVillageList,
query,
msg: { error: '获取村庄数据失败' },
reducer: { name: 'villageList' }
});
}
export function getBridge (query) {
return dispatch => basicAction({
type: 'get',
@ -434,3 +447,4 @@ export function getxiuyangas (query) {
reducer: { name: 'xiuyang' }
});
}

27
web/client/src/sections/fillion/components/infor/details.js

@ -6,14 +6,14 @@ import { putRoadway, putSpecificVehicle, putHouseholds,putCircuit,putVehicle,put
import { putBridge } from "../../actions/infor"
import _ from 'lodash'
const UserModal = (props) => {
const { visible, onVisibleChange, typecard, rewkeys, data, recortd, sitename,setDelet, dispatch, setRecortd, engineering,whichofits } = props
const { visible, onVisibleChange, typecard, rewkeys, data, recortd, sitename, setDelet, dispatch, setRecortd, engineering, whichofits, villageList } = props
const [newlys, setNewlys] = useState() //必填数据
const [newlysay, setNewlysay] = useState() //处理hou
const [records, setRecords] = useState()//处理
const [recordsay, setRecordsay] = useState()//必填数据
// const [success, setSuccess] = useState() //状态
// const [establishment, setEstablishment] = useState() //业户类型
// console.log(recortd)
useEffect(() => {
const array = []
if (rewkeys === 'transportation') {
@ -272,6 +272,17 @@ const UserModal = (props) => {
{typecard == 'compile' ?
<ProForm.Group
>
{rewkeys == 'transportation' && whichofits == '村' ?
<ProFormSelect
width="md"
// rules={[{ required: true, message: "必填" }]}
options={villageList || []}
placeholder="请选择村道"
showSearch={true}
name='villageId'
label='村道选择'
/> : null
}
<ProFormText
name={newlys?.[0]?.type}
width="md"
@ -314,6 +325,17 @@ const UserModal = (props) => {
</ProForm.Group>
: <ProForm.Group>
{rewkeys == 'transportation' && whichofits == '村' ?
<ProFormSelect
width="md"
// rules={[{ required: true, message: "必填" }]}
options={villageList || []}
placeholder="请选择村道"
showSearch={true}
name='villageId'
label='村道选择'
/> : null
}
<ProFormText
name={newlys?.[0]?.type}
width="md"
@ -347,6 +369,7 @@ const UserModal = (props) => {
label='类型'
/> : null
}
{newlysay?.map((item, index) => {
return <ProFormText width="md"
name={item?.type} label={newlysay[index]?.name} placeholder="请输入名称" key={index}

38
web/client/src/sections/fillion/components/transportationTable.js

@ -4,12 +4,12 @@ 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 { getRoadway, getProject, delRoadway, delProject, getVillageList } from "../actions/infor"
import UserModal from './infor/details';
import ProjectModal from './project/project';
const TransporTationTable = (props) => {
const { dispatch, user, depData, depMessage, depLoading } = props
const { dispatch, user, depData, depMessage, depLoading, villageList } = props
const [rowSelected, setRowSelected] = useState([])
const [sitename, setSitename] = useState()//名称
const [counts, setCounts] = useState()//shuju
@ -76,8 +76,15 @@ const TransporTationTable = (props) => {
setDelet(res)
})
}
useEffect(async () => {
console.log('whichofits', whichofits)
dispatch(getVillageList({}))
}, [])
useEffect(async () => {
let query = {}
if (whichofits === '县') {
query.level = '县'
@ -90,6 +97,9 @@ const TransporTationTable = (props) => {
const uniqueArray = [...new Set(res.payload.data?.map(item => item.routeName))];
setRoadData(uniqueArray)
}, [whichofits])
const columns = {
tab1: [
{
@ -2411,6 +2421,20 @@ const TransporTationTable = (props) => {
},
},
], tab3: [
{
title: '村庄',
search: false,
dataIndex: 'containers',
fixed: 'left',
width: 120,
render: (dom, record) => {
return record.village?.name || '--'
},
fieldProps: {
getPopupContainer: (triggerNode) => triggerNode.parentNode,
}
},
{
title: '路线名称',
dataIndex: 'placeName',
@ -2468,7 +2492,7 @@ const TransporTationTable = (props) => {
return record.townshipCode
},
fieldProps: {
getPopupContainer: (triggerNode) => triggerNode.parentNode,
getPopupContainer: (c) => triggerNode.parentNode,
}
}, {
title: '起点地名',
@ -3915,6 +3939,7 @@ const TransporTationTable = (props) => {
typecard={typecard}
rewkeys={'transportation'}
data={data}
villageList={villageList?.map(v => ({ value: v.id, label: v.name })) || []} //村道列表
recortd={recortd}
whichofits={whichofits}
setRecortd={setRecortd}
@ -3926,6 +3951,8 @@ const TransporTationTable = (props) => {
modalRecord={modalRecord}
typecard={typecard}
rewkeys={'road'}
whichofits={whichofits}
villageList={villageList?.map(v => ({ value: v.id, label: v.name })) || []} //村道列表
recortd={recortd}
setRecortd={setRecortd}
setDelet={setDelet}
@ -4011,7 +4038,7 @@ const data = [
{ name: "面层厚度", type: 'surfaceThickness' },
]
function mapStateToProps (state) {
const { auth, depMessage } = state;
const { auth, depMessage, villageList } = state;
const pakData = (dep) => {
return dep.map((d) => {
return {
@ -4028,6 +4055,7 @@ function mapStateToProps(state) {
depMessage: depMessage.data || [],
depLoading: depMessage.isRequesting,
depData,
villageList: villageList?.data || []
};
}
export default connect(mapStateToProps)(TransporTationTable);

9
web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js

@ -1,6 +1,7 @@
import { connect } from 'react-redux';
import React, { useEffect, useState } from 'react';
import { Button, Modal, Form, Input, Divider, Spin, Select, DatePicker, Descriptions, Table } from 'antd'
import { Button, Modal, Form, Input, Divider, Spin, Select, DatePicker, Tooltip, Table } from 'antd'
import { ExclamationCircleOutlined } from '@ant-design/icons';
import { roadSpotList, roadSpotDetail, roadSpotPrepare, confirmRoadSpot, exportSpotRode } from '../actions/spotCheck';
import moment from 'moment'
import Adjustment from '../components/adjustment'
@ -225,7 +226,9 @@ const MaintenanceSpotCheck = (props) => {
<Form form={form}>
<Form.Item
label="抽取比例(%)"
label={<div>抽取比例(%)<Tooltip title='默认抽查乡道比例为25%、抽查村道比例为10%'>
<ExclamationCircleOutlined style={{ marginLeft: 6 }} />
</Tooltip></div>}
name="percentValue"
rules={[
{ required: true, message: '请选择抽取比例' },
@ -235,7 +238,7 @@ const MaintenanceSpotCheck = (props) => {
// },
]}
>
<Select style={{}} placeholder="请选择抽取比例" options={[{ value: 25, label: '25%', }, { value: 50, label: '50%', }]} />
<Select style={{}} placeholder="请选择抽取比例" options={[{ value: 50, label: '50%', }, { value: 75, label: '75%', }]} />
</Form.Item>
<Form.Item className="ant-row" style={{

1
web/client/src/utils/webapi.js

@ -70,6 +70,7 @@ export const ApiTable = {
getRoadway: 'road',
putRoadway: 'road',
delRoadway: 'road/{roadId}',
getVillageList:'village/list', //获取村庄
//道路统计
getBgroadstatistics: "build/road_state",

Loading…
Cancel
Save