diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index c3687af2..b50512d0 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -15,7 +15,8 @@ "args": [ "-p 13400", "-f http://localhost:13400", - "-g postgres://postgres:123@10.8.30.32:5432/highways4good", + // "-g postgres://postgres:123@10.8.30.32:5432/highways4good", + "-g postgres://FashionAdmin:123456@10.8.30.156:5432/highway4goodn0728", "--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5", "--qnsk yewcieZLzKZuDfig0wLZ9if9jKp2P_1jd3CMJPSa", "--qnbkt dev-highways4good", diff --git a/api/app/lib/controllers/data/index.js b/api/app/lib/controllers/data/index.js index 8112a750..eb524973 100644 --- a/api/app/lib/controllers/data/index.js +++ b/api/app/lib/controllers/data/index.js @@ -8,7 +8,8 @@ async function dataExport (ctx) { try { const models = ctx.fs.dc.models; const { userId } = ctx.fs.api - const { exp, ids, roadLevel, municipalType } = ctx.query; + const { exp, ids, roadLevel, municipalType, + patrolType } = ctx.query; if (!exp) { throw '参数错误'; @@ -89,11 +90,23 @@ async function dataExport (ctx) { const tableAttributes = models[modalOption.tableName].tableAttributes let header = [] for (let k in tableAttributes) { - const comment = tableAttributes[k].comment + let comment = tableAttributes[k].comment if (k != 'id' && comment) { if (comment == '品名' && municipalType == '出租车') { continue } + if (patrolType) { + if (patrolType == 'road') { + + } else if (patrolType == 'anomaly') { + + } else { + // 正常的之前的巡查内容 + if (comment == '工程名称') { + continue + } + } + } header.push({ title: comment || '-', key: k, diff --git a/api/app/lib/controllers/report/index.js b/api/app/lib/controllers/report/index.js index 27f2f019..d5474115 100644 --- a/api/app/lib/controllers/report/index.js +++ b/api/app/lib/controllers/report/index.js @@ -9,7 +9,7 @@ async function reportList (ctx) { where: { }, - attributes: ['id', 'road', 'time', 'projectType', 'roadSectionStart', 'roadSectionEnd', 'reportType', 'content', 'longitude', 'latitude', 'projectName'], + attributes: ['id', 'road', 'time', 'projectType', 'roadSectionStart', 'roadSectionEnd', 'reportType', 'content', 'longitude', 'latitude', 'projectName', 'handleState'], include: [{ model: models.User, attributes: ['name'] @@ -139,6 +139,31 @@ async function reportDetail (ctx) { } } +async function reportHandle (ctx) { + try { + const { models } = ctx.fs.dc; + + const { reportId } = ctx.params + const { handleState } = ctx.request.body + + await models.Report.update({ + handleState: handleState + }, { + where: { + id: reportId + } + }) + + ctx.status = 200; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} + async function createReport (ctx) { try { const { userId } = ctx.fs.api @@ -187,5 +212,5 @@ async function deleteReport (ctx) { module.exports = { reportList, reportPosition, - reportDetail, createReport, deleteReport, + reportDetail, createReport, deleteReport, reportHandle }; \ No newline at end of file diff --git a/api/app/lib/models/report.js b/api/app/lib/models/report.js index 43a7807a..71512652 100644 --- a/api/app/lib/models/report.js +++ b/api/app/lib/models/report.js @@ -167,6 +167,7 @@ module.exports = dc => { autoIncrement: false }, projectName: { + index: 17, type: DataTypes.STRING, allowNull: true, defaultValue: null, @@ -175,6 +176,16 @@ module.exports = dc => { field: "project_name", autoIncrement: false }, + handleState: { + index: 18, + type: DataTypes.STRING, + allowNull: false, + defaultValue: "已处理", + // comment: "处理状态", + primaryKey: false, + field: "handle_state", + autoIncrement: false + }, }, { tableName: "report", comment: "", diff --git a/api/app/lib/routes/report/index.js b/api/app/lib/routes/report/index.js index afd4bcbc..d3fd64dd 100644 --- a/api/app/lib/routes/report/index.js +++ b/api/app/lib/routes/report/index.js @@ -10,7 +10,10 @@ module.exports = function (app, router, opts) { router.get('/report/position', report.reportPosition); app.fs.api.logAttr['GET/report/:reportId/detail'] = { content: '获取上报详情', visible: false }; - router.get('/report/:reportId//detail', report.reportDetail); + router.get('/report/:reportId/detail', report.reportDetail); + + app.fs.api.logAttr['GET/report/:reportId/handle'] = { content: '处理上报详情', visible: false }; + router.post('/report/:reportId/handle', report.reportHandle); app.fs.api.logAttr['POST/report'] = { content: '创建上报', visible: false }; router.post('/report', report.createReport); diff --git a/scripts/1.2.1/schema/1update_report.sql b/scripts/1.2.1/schema/1update_report.sql index f562cb0b..cf54b557 100644 --- a/scripts/1.2.1/schema/1update_report.sql +++ b/scripts/1.2.1/schema/1update_report.sql @@ -1,4 +1,9 @@ alter table report add project_name varchar(512); -alter table report alter column project_type drop not null; \ No newline at end of file +alter table report alter column project_type drop not null; + +alter table report + add handle_state varchar(32) default '已处理' not null; + +comment on column report.handle_state is '待处理 / 已处理 / 不处理'; \ No newline at end of file diff --git a/weapp/src/components/uploads/index.js b/weapp/src/components/uploads/index.js new file mode 100644 index 00000000..76d44719 --- /dev/null +++ b/weapp/src/components/uploads/index.js @@ -0,0 +1,12 @@ +import React, { useState, useEffect } from 'react'; +import Taro, { useRouter } from '@tarojs/taro'; +import { View, RadioGroup, Radio, Image, Input, Picker } from '@tarojs/components'; + +const Index = () => { + + return( + 123 + ) +} + +export default Index diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index d376c2d6..2e134da7 100644 --- a/weapp/src/packages/patrol/index.jsx +++ b/weapp/src/packages/patrol/index.jsx @@ -3,6 +3,7 @@ import Taro, { useRouter } from '@tarojs/taro'; import { View, RadioGroup, Radio, Image, Input, Picker } from '@tarojs/components'; import { AtButton, AtTextarea, AtImagePicker } from 'taro-ui'; import InputPicker from '../components/inputPicker'; +import VideoUpload from '../../components/uploads' import request from '@/services/request'; import environment from '../../config'; import { getState } from '../../store/globalState'; @@ -202,6 +203,7 @@ const Index = () => { longitude, latitude, projectName, + handleState: isAnomaly ? '待处理' : undefined, } if (reportType === 'patrol') { data['scenePic'] = sceneImg @@ -556,6 +558,17 @@ const Index = () => { onImageClick={handleImgClick} /> } + {/* + { + Taro.chooseVideo({ + sourceType: ['album', 'camera'], + maxDuration: 60, + camera: 'back', + success: function (res) { + console.log(res.tempFilePath) + } + }) + }}>v */} : 养护图片: @@ -579,6 +592,7 @@ const Index = () => { onImageClick={handleImgClick} /> } + 养护中 diff --git a/web/client/src/layout/containers/layout/index.js b/web/client/src/layout/containers/layout/index.js index 08d3ce8b..dabb4eea 100644 --- a/web/client/src/layout/containers/layout/index.js +++ b/web/client/src/layout/containers/layout/index.js @@ -75,9 +75,7 @@ const LayoutContainer = props => { dom.scrollTop = 0; } }) - // if (depMessage) { - // console.log(depMessage); - // } + let contentStyle = { position: 'relative', margin: '12px 12px 0px', diff --git a/web/client/src/sections/fillion/actions/patrol.js b/web/client/src/sections/fillion/actions/patrol.js index 44ba97e3..a1befe8a 100644 --- a/web/client/src/sections/fillion/actions/patrol.js +++ b/web/client/src/sections/fillion/actions/patrol.js @@ -37,13 +37,13 @@ export function getUserList (query) { }); } -export function handleReport (data) { +export function handleReport (reportId, data) { return dispatch => basicAction({ type: 'post', dispatch: dispatch, actionType: 'HANDLE_REPORT', - url: ApiTable.handleReport, + url: ApiTable.handleReport.replace("{reportId}", reportId), data: data, - msg: { option: '获取巡查数据失败' }, + msg: { option: '处理数据' }, }); } \ No newline at end of file diff --git a/web/client/src/sections/fillion/components/patrolTable.js b/web/client/src/sections/fillion/components/patrolTable.js index 3089ada4..425c34b7 100644 --- a/web/client/src/sections/fillion/components/patrolTable.js +++ b/web/client/src/sections/fillion/components/patrolTable.js @@ -2,7 +2,7 @@ import { connect } from 'react-redux'; import './protable.less' import { Card, Button, Popconfirm, Badge, Col, Row, DatePicker, Input, Modal, Spin, Image, message, Popover } from 'antd'; import ProTable from '@ant-design/pro-table'; -import { getReportList, getReportDetail } from '../actions/patrol'; +import { getReportList, getReportDetail, handleReport } from '../actions/patrol'; import React, { useEffect, useState } from 'react'; import { httpDel } from '@peace/utils' import { PinyinHelper } from '@peace/utils'; @@ -78,7 +78,7 @@ const DetailForm = (props) => { } const DetailList = (props) => { - const { reportList, loading, dispatch, handleOpen, handelRefresh, isAnomaly, isRoad, isPatrol } = props; + const { reportList, loading, dispatch, handleOpen, handelRefresh, isAnomaly, isRoad, isPatrol, queryData } = props; const [visible, setVisible] = useState(false) const [selectRecord, setSelectRecord] = useState(); const [noProcessingPopVisible, setNoProcessingPopVisible] = useState(false); @@ -200,19 +200,25 @@ const DetailList = (props) => { , - isAnomaly ? : null, - isAnomaly ? + isAnomaly && record.handleState != '已处理' ? : null, + isAnomaly && record.handleState != '已处理' ? - + ]} visible={noProcessingSelectRecord == record.id && noProcessingPopVisible} trigger="click" onClick={() => setNoProcessingSelectRecord(record.id)} - title="是否删除该记录?" + title="是否不处理该记录?" onVisibleChange={(newVisible) => setNoProcessingPopVisible(newVisible)} > @@ -322,7 +328,6 @@ const PatrolNameList = (props) => { return { onClick: () => { if (record) { - // console.log('record:', record) let id = record.id if (selectRoad == record.id) { id = null @@ -353,7 +358,7 @@ const PatrolTable = (props) => { const isAnomaly = pathname.includes('anomaly') const isPatrol = !isRoad && !isAnomaly const reportType = isRoad ? 'road' : isAnomaly ? 'anomaly' : 'patrol'; - console.log(isRoad, pathname, isPatrol); + useEffect(() => { if (userList && userList instanceof Array) { setRecord(userList[0]); @@ -410,7 +415,7 @@ const PatrolTable = (props) => { @@ -432,7 +437,7 @@ const PatrolTable = (props) => { const handleExport = () => { if (reportList && reportList instanceof Array && reportList.length) { let ids = reportList.map(item => item.id); - exports(ids); + exports(ids, reportType); } } diff --git a/web/client/src/sections/fillion/containers/patrol.js b/web/client/src/sections/fillion/containers/patrol.js index 00437e04..f3a362af 100644 --- a/web/client/src/sections/fillion/containers/patrol.js +++ b/web/client/src/sections/fillion/containers/patrol.js @@ -17,12 +17,11 @@ const patrol = (props) => { dispatch(getUserList()) }, [true]) //批量导出 - const exports = (ids, counts) => { - // console.log(user); + const exports = (ids, reportType) => { let reportIds = ids.toString(); window.open( '/_api/' + - `data/export?exp=patrol&ids=${reportIds}&token=${user.token}`) + `data/export?exp=patrol&ids=${reportIds}&token=${user.token}&patrolType=${reportType}`) } return ( <> diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index ced032ac..f8f9f37e 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -148,6 +148,7 @@ export const ApiTable = { compileReportRectifyDetail: 'report/rectify/detail', getReportList: 'report/list', getReportDetail: 'report/{reportId}/detail', + handleReport:'report/{reportId}/handle', getUsers: 'user',