Compare commits

...

2 Commits

  1. 287
      api/app/lib/controllers/report/index.js
  2. 4
      api/app/lib/routes/report/index.js
  3. 52
      api/utils/xlsxDownload.js
  4. 12
      web/client/src/sections/fillion/actions/spotCheck.js
  5. 8
      web/client/src/sections/fillion/components/spotCheck.js
  6. 58
      web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js

287
api/app/lib/controllers/report/index.js

@ -1297,6 +1297,13 @@ async function roadSpotPrepare (ctx) {
const sequelize = ctx.fs.dc.orm; const sequelize = ctx.fs.dc.orm;
const { countyPercentage, drawPeople, level, code } = ctx.request.body; const { countyPercentage, drawPeople, level, code } = ctx.request.body;
//获取最新的一次
const lastSpotRes = await models.RoadSpotCheckPreview.findOne({
where: {
checked: true
},
order: [['date', 'DESC']],
})
// 先查上次没查的范围内的 然后比较百分比 如果重叠 再查上次查过的 // 先查上次没查的范围内的 然后比较百分比 如果重叠 再查上次查过的
@ -1318,9 +1325,9 @@ async function roadSpotPrepare (ctx) {
} }
async function getRoadSpot (key, lastRoadIds = [], inOrNot, otherWhere = []) { async function getRoadSpot (key, lastRoadIds = [], inOrNot, otherWhere = []) {
if (!lastRoadIds.length && !inOrNot) { // if (!lastRoadIds.length && !inOrNot) {
return [] // return []
} // }
return await sequelize.query(` return await sequelize.query(`
SELECT id, chainage_mileage,route_code FROM road SELECT id, chainage_mileage,route_code FROM road
WHERE del = false WHERE del = false
@ -1342,131 +1349,92 @@ async function roadSpotPrepare (ctx) {
let last = null let last = null
let spotVillageIds = [] let spotVillageIds = []
async function filterRoad (otherWhere, getRepeat = true) { //县道乡道随机抽取
async function extractRandomElement (arr) {
if (!arr.length || accumulationMileage >= targetMileage) {
return
}
const index = Math.floor(Math.random() * arr.length);
const extracted = arr.splice(index, 1)[0];
if (key == '村' && getRepeat == true) { spotRoadIds.push(extracted.id)
accumulationMileage += parseFloat(extracted.chainage_mileage)
if (accumulationMileage >= targetMileage) {
return
} else { } else {
let roadUnSpotedRes = await getRoadSpot(key, lastRoadIds, false, otherWhere) return await extractRandomElement(arr)
if (key == '乡') { }
if (code == '360121201000') {
let townY002 = roadUnSpotedRes.filter(d => d.route_code.indexOf('Y002') != -1) }
if (townY002[0] && !spotRoadIds.length) {
spotRoadIds.push(townY002[0].id) if (key == '县') {
accumulationMileage += parseFloat(townY002[0].chainage_mileage) let roadUnSpotedRes = await getRoadSpot(key, lastRoadIds, false, otherWhere) || []
} await extractRandomElement(roadUnSpotedRes)
if (countyPercentage == 75) {
if (townY002[1] && !spotRoadIds.length) {
spotRoadIds.push(townY002[1].id)
accumulationMileage += parseFloat(townY002[1].chainage_mileage)
}
}
roadUnSpotedRes = roadUnSpotedRes.filter(d => !(d.route_code.indexOf('Y002') != -1))
}
if (code == '360121105000') {
let townY031 = roadUnSpotedRes.filter(d => d.route_code.indexOf('Y031') != -1)
let townY032 = roadUnSpotedRes.filter(d => d.route_code.indexOf('Y032') != -1)
if (townY031[0] && !spotRoadIds.length) {
spotRoadIds.push(townY031[0].id)
accumulationMileage += parseFloat(townY031[0].chainage_mileage)
}
if (townY032[0] && !spotRoadIds.length) {
spotRoadIds.push(townY032[0].id)
accumulationMileage += parseFloat(townY032[0].chainage_mileage)
}
if (countyPercentage == 75) {
if (townY031[1] && !spotRoadIds.length) {
spotRoadIds.push(townY031[1].id)
accumulationMileage += parseFloat(townY031[1].chainage_mileage)
}
if (townY032[1] && !spotRoadIds.length) {
spotRoadIds.push(townY032[1].id)
accumulationMileage += parseFloat(townY032[1].chainage_mileage)
}
}
roadUnSpotedRes = roadUnSpotedRes.filter(d => !(d.route_code.indexOf('Y031') != -1) || !(d.route_code.indexOf('Y032') != -1))
if (accumulationMileage < targetMileage) {
// 还小于 说明没取够
let roadUnSpotedRepeatRes = await getRoadSpot(key, lastRoadIds, true, otherWhere)
await extractRandomElement(roadUnSpotedRepeatRes)
}
} else if (key == '乡') {
let roadUnSpotedRes = await getRoadSpot(key, lastRoadIds, false, otherWhere)
if (code == '360121201000') {
let townY002 = roadUnSpotedRes.filter(d => d.route_code.indexOf('Y002') != -1)
if (townY002[0]) {
spotRoadIds.push(townY002[0].id)
accumulationMileage += parseFloat(townY002[0].chainage_mileage)
}
if (countyPercentage == 75) {
if (townY002[1]) {
spotRoadIds.push(townY002[1].id)
accumulationMileage += parseFloat(townY002[1].chainage_mileage)
} }
} }
for (let r of roadUnSpotedRes) { roadUnSpotedRes = roadUnSpotedRes.filter(d => !(d.route_code.indexOf('Y002') != -1))
if (accumulationMileage >= targetMileage) { }
break; if (code == '360121105000') {
let townY031 = roadUnSpotedRes.filter(d => d.route_code.indexOf('Y031') != -1)
let townY032 = roadUnSpotedRes.filter(d => d.route_code.indexOf('Y032') != -1)
if (townY031[0]) {
spotRoadIds.push(townY031[0].id)
accumulationMileage += parseFloat(townY031[0].chainage_mileage)
}
if (townY032[0]) {
spotRoadIds.push(townY032[0].id)
accumulationMileage += parseFloat(townY032[0].chainage_mileage)
}
if (countyPercentage == 75) {
if (townY031[1]) {
spotRoadIds.push(townY031[1].id)
accumulationMileage += parseFloat(townY031[1].chainage_mileage)
} }
spotRoadIds.push(r.id) if (townY032[1]) {
accumulationMileage += parseFloat(r.chainage_mileage) spotRoadIds.push(townY032[1].id)
if (accumulationMileage >= targetMileage) { accumulationMileage += parseFloat(townY032[1].chainage_mileage)
break;
} }
} }
roadUnSpotedRes = roadUnSpotedRes.filter(d => !(d.route_code.indexOf('Y031') != -1) && !(d.route_code.indexOf('Y032') != -1))
} }
await extractRandomElement(roadUnSpotedRes)
if (accumulationMileage < targetMileage && getRepeat) { if (accumulationMileage < targetMileage) {
// 还小于 说明没取够 // 还小于 说明没取够
let roadUnSpotedRepeatRes = await getRoadSpot(key, lastRoadIds, true, otherWhere) let roadUnSpotedRepeatRes = await getRoadSpot(key, lastRoadIds, true, [...otherWhere, `route_code not Like 'Y032%'`, `route_code not Like 'Y002%'`, `route_code not Like 'Y031%'`])
await extractRandomElement(roadUnSpotedRepeatRes)
if (key == '乡') { }
if (code == '360121201000') {
let townY002 = roadUnSpotedRepeatRes.filter(d => d.route_code.indexOf('Y002') != -1)
if (townY002[0] && !spotRoadIds.length) {
spotRoadIds.push(townY002[0].id)
accumulationMileage += parseFloat(townY002[0].chainage_mileage)
}
if (countyPercentage == 75) {
if (townY002[1] && !spotRoadIds.length) {
spotRoadIds.push(townY002[1].id)
accumulationMileage += parseFloat(townY002[1].chainage_mileage)
}
}
roadUnSpotedRepeatRes = roadUnSpotedRepeatRes.filter(d => !(d.route_code.indexOf('Y002') != -1))
}
if (code == '360121105000') {
let townY031 = roadUnSpotedRepeatRes.filter(d => d.route_code.indexOf('Y031') != -1)
let townY032 = roadUnSpotedRepeatRes.filter(d => d.route_code.indexOf('Y032') != -1)
if (townY031[0] && !spotRoadIds.length) {
spotRoadIds.push(townY031[0].id)
accumulationMileage += parseFloat(townY031[0].chainage_mileage)
}
if (townY032[0] && !spotRoadIds.length) {
spotRoadIds.push(townY032[0].id)
accumulationMileage += parseFloat(townY032[0].chainage_mileage)
}
if (countyPercentage == 75) {
if (townY031[1] && !spotRoadIds.length) {
spotRoadIds.push(townY031[1].id)
accumulationMileage += parseFloat(townY031[1].chainage_mileage)
}
if (townY032[1] && !spotRoadIds.length) {
spotRoadIds.push(townY032[1].id)
accumulationMileage += parseFloat(townY032[1].chainage_mileage)
}
}
roadUnSpotedRepeatRes = roadUnSpotedRepeatRes.filter(d => !(d.route_code.indexOf('Y031') != -1) || !(d.route_code.indexOf('Y032') != -1))
} } else if (key == '村') {
}
for (let r of roadUnSpotedRepeatRes) { for await (let villageId of villageIdList) {
if (accumulationMileage >= targetMileage) { let roadUnSpotedRes = await getRoadSpot(key, lastRoadIds, false, [...otherWhere, `village_id=${villageId}`])
break; for (let r of roadUnSpotedRes) {
}
spotRoadIds.push(r.id) spotRoadIds.push(r.id)
accumulationMileage += parseFloat(r.chainage_mileage) accumulationMileage += parseFloat(r.chainage_mileage)
if (accumulationMileage >= targetMileage) { if (accumulationMileage >= targetMileage) {
break; break;
} }
} }
}
}
if (key == '村') {
for await (let villageId of villageIdList) {
await filterRoad([
...otherWhere,
`village_id=${villageId}`
], false)
spotVillageIds.push(villageId) spotVillageIds.push(villageId)
last = villageId last = villageId
@ -1479,10 +1447,14 @@ async function roadSpotPrepare (ctx) {
// await filterRoad(otherWhere, true) // await filterRoad(otherWhere, true)
for await (let villageId of villageIdList.reverse()) { for await (let villageId of villageIdList.reverse()) {
await filterRoad([ let roadUnSpotedRes = await getRoadSpot(key, lastRoadIds, true, [...otherWhere, `village_id=${villageId}`])
...otherWhere, for (let r of roadUnSpotedRes) {
`village_id=${villageId}` spotRoadIds.push(r.id)
], true) accumulationMileage += parseFloat(r.chainage_mileage)
if (accumulationMileage >= targetMileage) {
break;
}
}
spotVillageIds.push(villageId) spotVillageIds.push(villageId)
last = villageId last = villageId
@ -1492,10 +1464,10 @@ async function roadSpotPrepare (ctx) {
} }
} }
} }
} else {
await filterRoad(otherWhere, true)
} }
return [spotRoadIds, accumulationMileage, last, spotVillageIds] return [spotRoadIds, accumulationMileage, last, spotVillageIds]
} }
@ -1528,20 +1500,9 @@ async function roadSpotPrepare (ctx) {
//获取最新的一次
const lastSpotRes = await models.RoadSpotCheckPreview.findOne({
where: {
checked: true
},
order: [['date', 'DESC']],
})
let gather = {} //汇总 let gather = {} //汇总
if (level == '县') { if (level == '县') {
let lastCountyRoadIds = [] // 上次查得的县道id let lastCountyRoadIds = [] // 上次查得的县道id
@ -1564,6 +1525,7 @@ async function roadSpotPrepare (ctx) {
gather.countyRoad = { gather.countyRoad = {
id: 'countyRoad',
name: '南昌县交通运输局', name: '南昌县交通运输局',
//总里程 //总里程
county: countryRoadTotalMileage + countryRoadHide, county: countryRoadTotalMileage + countryRoadHide,
@ -1667,7 +1629,7 @@ async function roadSpotPrepare (ctx) {
let spotVillageIds = lastSpotRes.villageId || [] let spotVillageIds = lastSpotRes.villageId || []
let lastEndVillage = lastSpotRes.lastAbstractVillage || {} //获取每个乡镇最后一个被抽取的村 let lastEndVillage = lastSpotRes.lastAbstractVillage || {} //获取每个乡镇最后一个被抽取的村
let villageMil = lastSpotRes.villageMil || 0 //已抽取的村道公里数 let villageMil = lastSpotRes.villageMil || 0 //已抽取的村道公里数
let allTownCodeResTown = []
@ -1715,19 +1677,6 @@ async function roadSpotPrepare (ctx) {
// spotVillageIds.push(villageRes[0].id) // spotVillageIds.push(villageRes[0].id)
spotFirstVillageId = villageRes[0].id spotFirstVillageId = villageRes[0].id
} else {
allTownCodeResTown.push({
code: code,
township: townRoadTotalMileage + townRoadHide,
townshipParticipate: townRoadTotalMileage,
townshipPresent: townMil_,
townshipDifferenceValue: townMil_ - townRoadNeedMileage,
village: villageRoadTotalMileage + villageRoadTotalHide,
villageParticipate: villageRoadTotalMileage,
villagePresent: 0,
villageDifferenceValue: 0
})
} }
//按照与当前村距离排序获取村id //按照与当前村距离排序获取村id
@ -1755,6 +1704,7 @@ async function roadSpotPrepare (ctx) {
let fidOne = town.find(d => d.code == code) let fidOne = town.find(d => d.code == code)
gather[code] = { gather[code] = {
id: code,
name: fidOne.name, name: fidOne.name,
//总里程 乡 //总里程 乡
township: townRoadTotalMileage + townRoadHide, township: townRoadTotalMileage + townRoadHide,
@ -1767,7 +1717,7 @@ async function roadSpotPrepare (ctx) {
//本次抽取的乡道id //本次抽取的乡道id
townRoadId: spotTownRoadIds_, townRoadId: spotTownRoadIds_,
//总里程 村 //总里程 村
village: townRoadTotalMileage + townRoadHide, village: villageRoadTotalMileage + villageRoadTotalHide,
//纳入考核里程 村 //纳入考核里程 村
villageParticipate: villageRoadNeedMileage, villageParticipate: villageRoadNeedMileage,
//本次考核里程 村 //本次考核里程 村
@ -1838,7 +1788,7 @@ async function roadSpotPrepare (ctx) {
async function exportSpotRode (ctx) { async function exportSpotRode (ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { previewId, roadId, isgather } = ctx.query const { previewId, roadId, isgather, code } = ctx.query
const previewRes = await models.RoadSpotCheckPreview.findOne({ const previewRes = await models.RoadSpotCheckPreview.findOne({
where: { where: {
@ -1904,7 +1854,11 @@ async function exportSpotRode (ctx) {
}, { }, {
key: 'maintenanceCount', key: 'maintenanceCount',
title: '养护次数(次)', title: '养护次数(次)',
},] },
{
key: 'remark',
title: '备注',
}]
let exportData = listRes.map(({ dataValues: item }) => { let exportData = listRes.map(({ dataValues: item }) => {
@ -1922,6 +1876,7 @@ async function exportSpotRode (ctx) {
subgradeWidth: road.subgradeWidth || 0, subgradeWidth: road.subgradeWidth || 0,
chainageMileage: road.chainageMileage || 0, chainageMileage: road.chainageMileage || 0,
maintenanceCount: item.maintenanceCount, maintenanceCount: item.maintenanceCount,
remark: true
} }
}) })
@ -1961,11 +1916,55 @@ async function exportSpotRode (ctx) {
} }
async function postRoadSpotNext (ctx) {
try {
const { models } = ctx.fs.dc;
const { previewId, level, roadId } = ctx.request.body
const previewRes = await models.RoadSpotCheckPreview.findOne({
where: {
id: previewId
}
})
let nextAbstract = previewRes && previewRes.nextAbstract || {}
if (level == '县') {
nextAbstract.county = [...(nextAbstract.county || []), roadId]
}
if (level == '乡') {
nextAbstract.town = [...(nextAbstract.town || []), roadId]
}
if (level == '村') {
nextAbstract.village = [...(nextAbstract.village || []), roadId]
}
await models.RoadSpotCheckPreview.update({
nextAbstract
}, {
where: {
id: previewId
},
})
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 = { module.exports = {
reportList, reportList,
reportPosition, reportPosition,
reportDetail, createReport, deleteReport, reportHandle, reportDetail, createReport, deleteReport, reportHandle,
spotPrepare, spotCheck, spotCheckDetail, spotPrepare, spotCheck, spotCheckDetail,
roadSpotPrepare, confirmRoadSpot, roadSpotList, roadSpotDetail, roadSpotChange, roadSpotChangList, exportSpotRode, roadSpotPrepare, confirmRoadSpot, roadSpotList, roadSpotDetail, roadSpotChange, roadSpotChangList, exportSpotRode,
town town, postRoadSpotNext
}; };

4
api/app/lib/routes/report/index.js

@ -58,4 +58,8 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/town'] = { content: '获取乡镇', visible: false }; app.fs.api.logAttr['GET/town'] = { content: '获取乡镇', visible: false };
router.get('/town', report.town) router.get('/town', report.town)
app.fs.api.logAttr['POST/road/spot/next'] = { content: '纳入下次抽查', visible: false };
router.post('/road/spot/next', report.postRoadSpotNext)
} }

52
api/utils/xlsxDownload.js

@ -185,34 +185,40 @@ async function simpleExcelDown ({ data = [], header = [], fileName = moment().fo
indexCell.style = headerStyle indexCell.style = headerStyle
for (let h of header) { for (let h of header) {
const cell = row.addCell(); const cell = row.addCell();
cell.value = data[i][h.key]; if (h.key == 'remark') {
if (data[i][h.key]) {
if (exp == 'patrol' || exp == 'maintenance') { cell.value = '回头看'
if (h.key == 'projectType') {
let type = data[i][h.key]
if (type == 'road') {
cell.value = '道路'
} else if (type == 'bridge') {
cell.value = '桥梁'
} else if (type == 'culvert') {
cell.value = '涵洞'
} else if (type == 'other') {
cell.value = '其他'
}
continue
} }
if (h.key == 'reportType') { } else {
let type = data[i][h.key] cell.value = data[i][h.key];
if (type == 'patrol') {
cell.value = '巡查' if (exp == 'patrol' || exp == 'maintenance') {
} else if (type == 'conserve') { if (h.key == 'projectType') {
cell.value = '养护' let type = data[i][h.key]
if (type == 'road') {
cell.value = '道路'
} else if (type == 'bridge') {
cell.value = '桥梁'
} else if (type == 'culvert') {
cell.value = '涵洞'
} else if (type == 'other') {
cell.value = '其他'
}
continue
}
if (h.key == 'reportType') {
let type = data[i][h.key]
if (type == 'patrol') {
cell.value = '巡查'
} else if (type == 'conserve') {
cell.value = '养护'
}
continue
} }
continue
} }
} }
cell.style = style cell.style = style
} }
} }

12
web/client/src/sections/fillion/actions/spotCheck.js

@ -99,4 +99,16 @@ export function getTown (query = {}) {
msg: { error: '获取乡镇code失败' }, msg: { error: '获取乡镇code失败' },
reducer: { name: 'town' } reducer: { name: 'town' }
}); });
}
export function postRoadSpotNext (data = {}) {
return dispatch => basicAction({
type: 'post',
dispatch: dispatch,
data,
actionType: 'POST_ROAD_SPOT_NEXT',
url: 'road/spot/next',
msg: { option: '纳入下次抽查' },
reducer: { name: '' }
});
} }

8
web/client/src/sections/fillion/components/spotCheck.js

@ -154,9 +154,9 @@ const SpotCheck = ({ dispatch, user, loading, reportDetail, editData, onCancel,
if (r.name == '南昌县交通运输局') { if (r.name == '南昌县交通运输局') {
roadId = r.countyRoadId || [] roadId = r.countyRoadId || []
} else { } else {
roadId = [...r.townRoadId, ...r.villageRoadId] roadId = [...r.townRoadId, ...r.villageRoadId]
} }
return <a href={`/_api/road/spot/export?token=${user?.token}&previewId=${editData.id}&roadId=${roadId.join()}`}> 导出</a> return <a href={`/_api/road/spot/export?token=${user?.token}&code=${r.id}&previewId=${editData.id}&roadId=${roadId.join()}`}> 导出</a>
} }
}, },
] ]
@ -212,7 +212,7 @@ const SpotCheck = ({ dispatch, user, loading, reportDetail, editData, onCancel,
</Form.Item> </Form.Item>
<Form.Item > <Form.Item >
<Button disabled={countyRoadTime} style={{}} type='primary' > <Button disabled={countyRoadTime} style={{}} type='primary' >
<a href={`/_api/road/spot/export?token=${user?.token}&previewId=${currentValue.id}&roadId=${currentValue?.gather && currentValue?.gather['countyRoad']?.countyRoadId?.join()}`}> 导出</a> <a href={`/_api/road/spot/export?token=${user?.token}&previewId=${currentValue.id}&code='countyRoad'&roadId=${currentValue?.gather && currentValue?.gather['countyRoad']?.countyRoadId?.join()}`}> 导出</a>
</Button> </Button>
</Form.Item> </Form.Item>
</div> </div>
@ -286,7 +286,7 @@ const SpotCheck = ({ dispatch, user, loading, reportDetail, editData, onCancel,
</Form.Item> </Form.Item>
<Form.Item > <Form.Item >
<Button disabled={townDisabled[d.code] ? false : true} style={{}} type='primary'> <Button disabled={townDisabled[d.code] ? false : true} style={{}} type='primary'>
<a href={`/_api/road/spot/export?token=${user?.token}&previewId=${currentValue.id}&roadId=${currentValue?.gather <a href={`/_api/road/spot/export?token=${user?.token}&previewId=${currentValue.id}&code=${d.code}&roadId=${currentValue?.gather
&& [...(currentValue?.gather[d.code]?.townRoadId || []), ...(currentValue?.gather[d.code]?.villageRoadId && [...(currentValue?.gather[d.code]?.townRoadId || []), ...(currentValue?.gather[d.code]?.villageRoadId
|| [])].join()}`}> 导出</a> || [])].join()}`}> 导出</a>
</Button> </Button>

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

@ -1,9 +1,9 @@
import { connect } from 'react-redux' import { connect } from 'react-redux'
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { Button, Modal, Form, Input, Divider, Spin, Select, DatePicker, Tooltip, Table, } from 'antd' import { Button, Modal, Form, Input, Divider, Spin, Select, DatePicker, Tooltip, Table, Popconfirm } from 'antd'
import { ExclamationCircleOutlined } from '@ant-design/icons' import { ExclamationCircleOutlined } from '@ant-design/icons'
import { getVillageList } from "../actions/infor" import { getVillageList } from "../actions/infor"
import { roadSpotList, roadSpotDetail, roadSpotPrepare, confirmRoadSpot, exportSpotRode, getTown } from '../actions/spotCheck' import { roadSpotList, roadSpotDetail, roadSpotPrepare, confirmRoadSpot, exportSpotRode, getTown, postRoadSpotNext } from '../actions/spotCheck'
import moment from 'moment' import moment from 'moment'
import Adjustment from '../components/adjustment' import Adjustment from '../components/adjustment'
import SpotCheck from '../components/spotCheck' import SpotCheck from '../components/spotCheck'
@ -106,19 +106,23 @@ const MaintenanceSpotCheck = (props) => {
}, },
] ]
const queryData = (data = {}) => { const queryData = (data = {}, next = true) => {
dispatch(roadSpotList(data)).then(res => { dispatch(roadSpotList(data)).then(res => {
if (res.success) { if (res.success) {
setReportData(res?.payload.data) setReportData(res?.payload.data)
setKeyword("") if (next) {
setKeyword("")
}
} }
}) })
} }
const detailData = (data = {}) => { const detailData = (data = {}, next = true) => {
dispatch(roadSpotDetail(data)).then(res => { dispatch(roadSpotDetail(data)).then(res => {
if (res.success) { if (res.success) {
setInnerPage(1) if (next) {
setInnerPage(1)
}
setDetailList(res?.payload.data) setDetailList(res?.payload.data)
} }
}) })
@ -260,16 +264,40 @@ const MaintenanceSpotCheck = (props) => {
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
width: 210,
dataIndex: 'action', dataIndex: 'action',
render: (_, r, index) => <Button disabled={(reportData[0]?.id == record?.id && !r.roadSpotCheckPreview?.roadSpotCheckChangeLogs?.some(s => s.changeRoadId == r.roadId)) ? false : true} type="link" onClick={() => { render: (_, r, index) => <>
setEditData({ <Popconfirm
...r, alterId: r?.road?.level == '县' ? record?.countyRoadId title="是否确认纳入下次抽查?"
: r?.road?.level == '乡' ? record?.townshipRoadId onConfirm={() => {
: r?.road?.level == '村' ? record?.villageId : [], dispatch(postRoadSpotNext({ previewId: record?.id, level: r.road?.level, roadId: r.roadId })).then(async res => {
previewId: record?.id if (res.success) {
}) queryData({ startTime: dateRange[0], endTime: dateRange[1] }, false)
setIsAdjustment(true) detailData({ previewId: record?.id, keyword: keyword }, false)
}}> 调整 </Button > }
})
}}
okText="确认"
cancelText="取消"
>
<Button disabled={(reportData[0]?.id == record?.id && (
!record?.nextAbstract?.town?.includes(r.roadId)
&& !record?.nextAbstract?.village?.includes(r.roadId)
&& !record?.nextAbstract?.county?.includes(r.roadId))) ? false : true}
type="link"
> 纳入下次抽查 </Button >
</Popconfirm>
<Button disabled={(reportData[0]?.id == record?.id && !r.roadSpotCheckPreview?.roadSpotCheckChangeLogs?.some(s => s.changeRoadId == r.roadId)) ? false : true} type="link" onClick={() => {
setEditData({
...r, alterId: r?.road?.level == '县' ? record?.countyRoadId
: r?.road?.level == '乡' ? record?.townshipRoadId
: r?.road?.level == '村' ? record?.villageId : [],
previewId: record?.id
})
setIsAdjustment(true)
}}> 调整 </Button >
</>
}, },
]} ]}

Loading…
Cancel
Save