Browse Source

fix bugs

dev
巴林闲侠 1 year ago
parent
commit
1dffa9fece
  1. 8
      api/app/lib/controllers/report/index.js
  2. 4
      web/client/src/sections/fillion/components/maintenanceTable.js
  3. 38
      web/client/src/sections/fillion/components/patrolTable.js
  4. 9
      web/client/src/sections/fillion/containers/maintenanceSpotCheck.js

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

@ -403,10 +403,15 @@ async function spotCheck (ctx) {
return item.id return item.id
}) })
let checkCount = Math.ceil(prepareRes.reportCount * (prepareRes.percentage / 100)) let checkCount = Math.ceil(prepareRes.reportCount * (prepareRes.percentage / 100))
const reportRes = findUsers.length && checkCount ? await models.Report.findAll({ const reportRes = findUsers.length && checkCount ? await models.Report.findAll({
where: { where: {
reportType: 'conserve', reportType: 'conserve',
userId: { $in: findUsers } userId: { $in: findUsers },
include: [{
model: models.User,
attributes: ['name']
}]
}, },
order: sequelize.random(), // 随机排序 order: sequelize.random(), // 随机排序
limit: checkCount, // 限制返回的记录数 limit: checkCount, // 限制返回的记录数
@ -419,7 +424,6 @@ async function spotCheck (ctx) {
id: previewId id: previewId
} }
}) })
if (reportRes.length) { if (reportRes.length) {
let spotDate = moment().format('YYYY-MM-DD') let spotDate = moment().format('YYYY-MM-DD')
await models.ReportSpotCheck.bulkCreate(reportRes.map(r => { await models.ReportSpotCheck.bulkCreate(reportRes.map(r => {

4
web/client/src/sections/fillion/components/maintenanceTable.js

@ -20,6 +20,7 @@ const DetailForm = (props) => {
const keyList = [ const keyList = [
{ key: '道路类型', name: 'reportType' }, { key: '道路类型', name: 'reportType' },
{ key: '其他', name: 'projectType' }, { key: '其他', name: 'projectType' },
{ key: '路线代码', name: 'codeRoad' },
{ key: '路线名称', name: 'road' }, { key: '路线名称', name: 'road' },
{ key: '养护路段', name: 'roadSectionStart' }, { key: '养护路段', name: 'roadSectionStart' },
{ key: '具体位置', name: 'address' }, { key: '具体位置', name: 'address' },
@ -216,7 +217,8 @@ const DetailList = (props) => {
dataIndex: 'projectType', dataIndex: 'projectType',
align: 'center', align: 'center',
render: (text, record) => { render: (text, record) => {
return reportTypeText(text) return record.projectType.length > 0 ? reportTypeText(text) : record.codeRoad.length > 0 ? record.codeRoad[0] === 'X' ? '县道'
: record.codeRoad[0] === 'Y' ? '乡道' : '村道' : ''
} }
}, { }, {
title: '所属道路', title: '所属道路',

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

@ -53,6 +53,7 @@ const DetailForm = (props) => {
{ key: '处理详情', name: 'handleContent', skip: !isAnomaly }, { key: '处理详情', name: 'handleContent', skip: !isAnomaly },
{ key: '处理图片', name: 'handlePic', skip: !isAnomaly }, { key: '处理图片', name: 'handlePic', skip: !isAnomaly },
{ key: '处理人', name: 'performerName', skip: !isAnomaly }, { key: '处理人', name: 'performerName', skip: !isAnomaly },
{ key: '路线代码', name: 'codeRoad', skip: !isPatrol },
{ key: '道路类型', name: 'reportType', skip: !isPatrol }, { key: '道路类型', name: 'reportType', skip: !isPatrol },
@ -72,6 +73,7 @@ const DetailForm = (props) => {
//{ key: '路线代码', name: 'codeRoad', skip: !isPatrol }, //{ key: '路线代码', name: 'codeRoad', skip: !isPatrol },
{ key: '上报图片', name: 'scenePic', skip: !isPatrol }, { key: '上报图片', name: 'scenePic', skip: !isPatrol },
{ key: '上报视频', name: 'videoUrl', skip: !isPatrol }, { key: '上报视频', name: 'videoUrl', skip: !isPatrol },
]; ];
const keyListOld = [ const keyListOld = [
// { key: '编号', name: 'id' }, // { key: '编号', name: 'id' },
@ -248,6 +250,24 @@ const DetailList = (props) => {
let basicDate = null; let basicDate = null;
let counter = 0; let counter = 0;
//指派任务 //指派任务
const reportTypeText = (text) => {
switch (text) {
case 'road': return '道路';
//
case 'countyRoad': return '县道';
case 'villageRoad': return '乡道';
case 'rusticRoad': return '村道';
//
case 'bridge': return '桥梁';
case 'culvert': return '涵洞';
case 'other': return '其他';
//
case 'conserve': return '养护';
case 'patrol': return '巡查';
case 'construction': return '在建';
default: return text;
}
}
const columns = [ const columns = [
// isPatrol ? { // isPatrol ? {
// title: '编号1', // title: '编号1',
@ -275,22 +295,8 @@ const DetailList = (props) => {
dataIndex: 'projectType', dataIndex: 'projectType',
align: 'center', align: 'center',
render: (text, record) => { render: (text, record) => {
switch (text) { return record.projectType.length > 0 ? reportTypeText(text) : record.codeRoad.length > 0 ? record.codeRoad[0] === 'X' ? '县道'
case 'road': return '道路'; : record.codeRoad[0] === 'Y' ? '乡道' : '村道' : ''
//
case 'countyRoad': return '县道';
case 'villageRoad': return '乡道';
case 'rusticRoad': return '村道';
//
case 'bridge': return '桥梁';
case 'culvert': return '涵洞';
case 'other': return '其他';
//
case 'conserve': return '养护';
case 'patrol': return '巡查';
case 'construction': return '在建';
default: return text;
}
} }
} : '', } : '',
isRoad ? isRoad ?

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

@ -39,6 +39,7 @@ const DetailForm = (props) => {
{ key: '其他', name: 'projectType' }, { key: '其他', name: 'projectType' },
{ key: '道路类型', name: 'reportType' }, { key: '道路类型', name: 'reportType' },
{ key: '路线名称', name: 'road' }, { key: '路线名称', name: 'road' },
{ key: '路线代码', name: 'codeRoad' },
{ key: '养护路段', name: 'roadSectionStart' }, { key: '养护路段', name: 'roadSectionStart' },
{ key: '具体位置', name: 'address' }, { key: '具体位置', name: 'address' },
{ key: '路面类型', name: 'roadType' }, { key: '路面类型', name: 'roadType' },
@ -413,6 +414,10 @@ const MaintenanceSpotCheck = (props) => {
const okHandler = async () => { const okHandler = async () => {
if (previewId !== 0) { if (previewId !== 0) {
const res = await dispatch(getSpotCheck({ previewId })) const res = await dispatch(getSpotCheck({ previewId }))
const data = res.payload.data?.map(item => {
return { report: item }
})
setReportData(data)
form.resetFields() form.resetFields()
setVis(false) setVis(false)
} }
@ -476,7 +481,7 @@ const MaintenanceSpotCheck = (props) => {
<Button type='primary' onClick={extractHandler}>开始抽取</Button> <Button type='primary' onClick={extractHandler}>开始抽取</Button>
</div> </div>
</Form.Item> </Form.Item>
<Form.Item label='抽查结果' name='result'> <Form.Item label='抽查总数' name='result'>
<Input disabled /> <Input disabled />
</Form.Item> </Form.Item>
<Form.Item label='抽查乡镇' name='village'> <Form.Item label='抽查乡镇' name='village'>
@ -494,7 +499,7 @@ const MaintenanceSpotCheck = (props) => {
</div> </div>
) )
} }
function mapStateToProps(state) { function mapStateToProps (state) {
const { auth, spotCheckDetail, reportDetail } = state const { auth, spotCheckDetail, reportDetail } = state
//('state1', state) //('state1', state)
return { return {

Loading…
Cancel
Save