Browse Source

冲突修改

dev
wenlele 10 months ago
parent
commit
4a0ec9d4c1
  1. 61
      api/app/lib/controllers/report/index.js
  2. 3
      web/client/src/sections/fillion/containers/maintenanceSpotCheck-new.js

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

@ -3,7 +3,8 @@ const { QueryTypes } = require('sequelize');
const moment = require('moment'); const moment = require('moment');
const xlsxDownload = require('../../../../utils/xlsxDownload.js'); const xlsxDownload = require('../../../../utils/xlsxDownload.js');
const fs = require('fs'); const fs = require('fs');
async function reportList (ctx) { const data = require('../../routes/data/index.js');
async function reportList(ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType, handleState = '', performerId = '', codeRoad } = ctx.query const { limit, page, startTime, endTime, keyword, userId, reportType, isTop, asc, projectType, handleState = '', performerId = '', codeRoad } = ctx.query
@ -149,7 +150,7 @@ async function reportList (ctx) {
} }
} }
async function reportPosition (ctx) { async function reportPosition(ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { startTime, endTime, userId, reportType } = ctx.query const { startTime, endTime, userId, reportType } = ctx.query
@ -199,7 +200,7 @@ async function reportPosition (ctx) {
} }
} }
async function reportDetail (ctx) { async function reportDetail(ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { reportId } = ctx.params const { reportId } = ctx.params
@ -228,7 +229,7 @@ async function reportDetail (ctx) {
} }
} }
async function reportHandle (ctx) { async function reportHandle(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
@ -258,7 +259,7 @@ async function reportHandle (ctx) {
} }
} }
async function createReport (ctx) { async function createReport(ctx) {
try { try {
const { userId } = ctx.fs.api const { userId } = ctx.fs.api
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
@ -280,7 +281,7 @@ async function createReport (ctx) {
} }
} }
async function deleteReport (ctx) { async function deleteReport(ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { reportId } = ctx.params; const { reportId } = ctx.params;
@ -302,7 +303,7 @@ async function deleteReport (ctx) {
} }
// TODO 小程序填写道路名称的时候的道路筛选 是一起都返回 还是不断传关键字搜索返回 // TODO 小程序填写道路名称的时候的道路筛选 是一起都返回 还是不断传关键字搜索返回
async function spotPrepare (ctx) { async function spotPrepare(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const sequelize = ctx.fs.dc.orm; const sequelize = ctx.fs.dc.orm;
@ -374,7 +375,7 @@ async function spotPrepare (ctx) {
} }
} }
async function spotCheck (ctx) { async function spotCheck(ctx) {
const transaction = await ctx.fs.dc.orm.transaction(); const transaction = await ctx.fs.dc.orm.transaction();
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
@ -476,7 +477,7 @@ async function spotCheck (ctx) {
} }
} }
} }
async function spotCheckDetail (ctx) { async function spotCheckDetail(ctx) {
const { models } = ctx.fs.dc const { models } = ctx.fs.dc
const { startTime, endTime } = ctx.query const { startTime, endTime } = ctx.query
try { try {
@ -515,7 +516,7 @@ async function spotCheckDetail (ctx) {
} }
async function roadSpotPrepare (ctx) { async function roadSpotPrepare(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const sequelize = ctx.fs.dc.orm; const sequelize = ctx.fs.dc.orm;
@ -592,7 +593,7 @@ async function roadSpotPrepare (ctx) {
'乡': `route_code LIKE 'Y%'`, '乡': `route_code LIKE 'Y%'`,
'村': `route_code LIKE 'C%'` '村': `route_code LIKE 'C%'`
} }
async function getRoadTotalMileage (key, otherWhere = [], spot) { async function getRoadTotalMileage(key, otherWhere = [], spot) {
let res = await sequelize.query(` let res = await sequelize.query(`
SELECT SELECT
SUM(COALESCE(CAST(chainage_mileage AS DOUBLE PRECISION), 0)) AS total_mileage SUM(COALESCE(CAST(chainage_mileage AS DOUBLE PRECISION), 0)) AS total_mileage
@ -604,7 +605,7 @@ async function roadSpotPrepare (ctx) {
return res[0][0].total_mileage || 0 return res[0][0].total_mileage || 0
} }
async function getRoadSpot (key, lastRoadIds = [], inOrNot, otherWhere = []) { async function getRoadSpot(key, lastRoadIds = [], inOrNot, otherWhere = []) {
if (!lastRoadIds.length && !inOrNot) { if (!lastRoadIds.length && !inOrNot) {
return [] return []
} }
@ -623,11 +624,11 @@ async function roadSpotPrepare (ctx) {
`, { type: QueryTypes.SELECT }); `, { type: QueryTypes.SELECT });
} }
async function spotRoadId (key, lastRoadIds, targetMileage, otherWhere = [], villageIdList = []) { async function spotRoadId(key, lastRoadIds, targetMileage, otherWhere = [], villageIdList = []) {
let spotRoadIds = [] let spotRoadIds = []
let accumulationMileage = 0 let accumulationMileage = 0
async function filterRoad (otherWhere, getRepeat = true) { async function filterRoad(otherWhere, getRepeat = true) {
if (key == '村' && getRepeat == true) { if (key == '村' && getRepeat == true) {
@ -859,7 +860,7 @@ async function roadSpotPrepare (ctx) {
} }
} }
async function confirmRoadSpot (ctx) { async function confirmRoadSpot(ctx) {
const transaction = await ctx.fs.dc.orm.transaction(); const transaction = await ctx.fs.dc.orm.transaction();
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
@ -919,7 +920,7 @@ async function confirmRoadSpot (ctx) {
} }
} }
async function roadSpotList (ctx) { async function roadSpotList(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { startTime, endTime, page, limit } = ctx.query const { startTime, endTime, page, limit } = ctx.query
@ -973,7 +974,7 @@ async function roadSpotList (ctx) {
} }
} }
async function roadSpotDetail (ctx) { async function roadSpotDetail(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { previewId, keyword } = ctx.query const { previewId, keyword } = ctx.query
@ -1010,7 +1011,7 @@ async function roadSpotDetail (ctx) {
} }
} }
async function roadSpotChange (ctx) { async function roadSpotChange(ctx) {
const transaction = await ctx.fs.dc.orm.transaction(); const transaction = await ctx.fs.dc.orm.transaction();
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
@ -1032,7 +1033,7 @@ async function roadSpotChange (ctx) {
} }
let previewUpdated = false let previewUpdated = false
async function updatePreview (key) { async function updatePreview(key) {
if (previewUpdated) return if (previewUpdated) return
if (previewRes[key] && previewRes[key].includes(originRoadId)) { if (previewRes[key] && previewRes[key].includes(originRoadId)) {
@ -1074,6 +1075,24 @@ async function roadSpotChange (ctx) {
let content = '' let content = ''
let curOriginRoad = roadRes.find(item => item.id == originRoadId) let curOriginRoad = roadRes.find(item => item.id == originRoadId)
let curChangeRoad = roadRes.find(item => item.id == changeRoadId) let curChangeRoad = roadRes.find(item => item.id == changeRoadId)
const level = curChangeRoad.level;
let milData = {}
if (level == '县') {
milData = { countryMil: previewRes.countryMil + parseFloat(curChangeRoad.chainageMileage) - parseFloat(curOriginRoad.chainageMileage) }
} else if (level == '乡') {
milData = { townMil: previewRes.townMil + parseFloat(curChangeRoad.chainageMileage) - parseFloat(curOriginRoad.chainageMileage) }
} else if (level == '村') {
milData = { villageMil: previewRes.villageMil + parseFloat(curChangeRoad.chainageMileage) - parseFloat(curOriginRoad.chainageMileage) }
}
await models.RoadSpotCheckPreview.update({
...milData
}, {
where: {
id: previewId
},
transaction
})
content = `${curOriginRoad.routeName}${curOriginRoad.startingPlaceName}${curOriginRoad.stopPlaceName}改为${curChangeRoad.routeName}${curChangeRoad.startingPlaceName}${curChangeRoad.stopPlaceName}` content = `${curOriginRoad.routeName}${curOriginRoad.startingPlaceName}${curOriginRoad.stopPlaceName}改为${curChangeRoad.routeName}${curChangeRoad.startingPlaceName}${curChangeRoad.stopPlaceName}`
@ -1117,7 +1136,7 @@ async function roadSpotChange (ctx) {
} }
} }
async function roadSpotChangList (ctx) { async function roadSpotChangList(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { startTime, endTime, page, limit } = ctx.query const { startTime, endTime, page, limit } = ctx.query
@ -1170,7 +1189,7 @@ async function roadSpotChangList (ctx) {
} }
} }
async function exportSpotRode (ctx) { async function exportSpotRode(ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { previewId } = ctx.query const { previewId } = ctx.query

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

@ -345,6 +345,7 @@ const MaintenanceSpotCheck = (props) => {
}} }}
onOk={() => { onOk={() => {
detailData({ previewId: expandedRowKeys[0], keyword: keyword }) detailData({ previewId: expandedRowKeys[0], keyword: keyword })
queryData()
}} }}
/> />
} }
@ -354,7 +355,7 @@ const MaintenanceSpotCheck = (props) => {
</div > </div >
) )
} }
function mapStateToProps (state) { function mapStateToProps(state) {
const { auth, roadSpotList, reportDetail, roadSpotDetail } = state const { auth, roadSpotList, reportDetail, roadSpotDetail } = state
//('state1', state) //('state1', state)
return { return {

Loading…
Cancel
Save