LUCAS 2 years ago
parent
commit
628056bcab
  1. 2
      api/.vscode/launch.json
  2. 2
      api/app/lib/controllers/data/index.js
  3. 4
      api/app/lib/models/report.js
  4. 29
      api/log/development.log
  5. 29
      api/utils/xlsxDownload.js
  6. 19
      jenkinsfile_script_init_report_pic_data
  7. 11
      scripts/0.0.1/data/3_init_report_pic_data/Dockerfile
  8. 29
      scripts/0.0.1/data/3_init_report_pic_data/index.js
  9. 4
      weapp/src/pages/home/index.jsx
  10. 1
      web/client/src/sections/fillion/components/infor/videoUpload.js
  11. 13
      web/client/src/sections/fillion/components/inforTable.js
  12. 28
      web/client/src/sections/fillion/components/maintenanceTable.js
  13. 36
      web/client/src/sections/fillion/components/patrolTable.js
  14. 2
      web/client/src/sections/quanju/containers/footer/leadership/centerleft/daolu.js
  15. 4
      web/client/src/sections/quanju/containers/footer/leadership/centerleft/handong.js
  16. 2
      web/client/src/sections/quanju/containers/footer/leadership/centerleft/qiqoliang.js
  17. 2
      web/client/src/sections/quanju/containers/footer/leadership/left/echarts/leftbottomecharts.js
  18. 2
      web/client/src/sections/quanju/containers/footer/leadership/left/echarts/lefttopecharts.js
  19. 10
      web/client/src/sections/quanju/containers/footer/leadership/left/left-top.js
  20. 2
      web/client/src/sections/quanju/containers/footer/leadership/right/hudong.js
  21. 14
      web/routes/attachment/index.js

2
api/.vscode/launch.json

@ -13,7 +13,7 @@
"NODE_ENV": "development"
},
"args": [
"-p 4000",
"-p 14000",
"-f http://localhost:4000",
"-g postgres://postgres:123@10.8.30.32:5432/highways4good",
"--qnak XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5",

2
api/app/lib/controllers/data/index.js

@ -104,7 +104,7 @@ async function dataExport (ctx) {
header.sort((a, b) => { return a.index - b.index })
const fileName = `${modalOption.n}_${moment().format('YYYYMMDDHHmmss')}` + '.csv'
const filePath = await xlsxDownload.simpleExcelDown({ data: exportData, header, fileName: fileName })
const filePath = await xlsxDownload.simpleExcelDown({ data: exportData, header, fileName: fileName, exp })
const fileData = fs.readFileSync(filePath);
ctx.status = 200;

4
api/app/lib/models/report.js

@ -21,7 +21,7 @@ module.exports = dc => {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "上报类型 巡查:patrol / 养护:conserve",
comment: "上报类型",
primaryKey: false,
field: "report_type",
autoIncrement: false
@ -31,7 +31,7 @@ module.exports = dc => {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "工程类型 道路:road / 桥梁:birdge / 涵洞:culvert",
comment: "工程类型",
primaryKey: false,
field: "project_type",
autoIncrement: false

29
api/log/development.log

@ -10668,3 +10668,32 @@ headers: {}
2022-07-30 12:38:46.294 - debug: [FS-LOGGER] Init.
2022-07-30 12:38:46.394 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 12:38:46.394 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-30 14:19:21.439 - debug: [FS-LOGGER] Init.
2022-07-30 14:19:21.547 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 14:19:21.547 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-30 14:30:16.777 - error: path: /publicity, error: Error: Invalid value {
uid: -1659162615,
name: 'video.mp4',
status: 'done',
storageUrl: 'project/45017725-be73-4ec7-99a5-f57c2fde5682/video.mp4',
url: 'http://rfkimpwbb.hn-bkt.clouddn.com/project/45017725-be73-4ec7-99a5-f57c2fde5682/video.mp4',
size: 2172089
}
2022-07-30 14:30:47.375 - error: path: /publicity, error: Error: Invalid value {
uid: -1659162647,
name: 'video.mp4',
status: 'done',
storageUrl: 'project/ec692a52-13e2-4bd1-80fb-5cae1386c782/video.mp4',
url: 'http://rfkimpwbb.hn-bkt.clouddn.com/project/ec692a52-13e2-4bd1-80fb-5cae1386c782/video.mp4',
size: 2172089
}
2022-07-30 16:53:41.602 - error: path: /data/export, error: 参数错误
2022-07-30 16:59:14.475 - debug: [FS-LOGGER] Init.
2022-07-30 16:59:14.573 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 16:59:14.573 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-30 17:19:58.438 - debug: [FS-LOGGER] Init.
2022-07-30 17:19:58.538 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 17:19:58.539 - info: [FS-AUTH] Inject auth and api mv into router.
2022-07-30 17:48:40.061 - debug: [FS-LOGGER] Init.
2022-07-30 17:48:40.152 - info: [FS-ATTACHMENT] Inject attachment mw into router.
2022-07-30 17:48:40.152 - info: [FS-AUTH] Inject auth and api mv into router.

29
api/utils/xlsxDownload.js

@ -16,7 +16,7 @@ async function makeDir (dir) {
}
}
async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss') } = {}) {
async function simpleExcelDown ({ data = [], header = [], fileName = moment().format('YYYY-MM-DD HH:mm:ss'), exp } = {}) {
const fileDirPath = path.join(__dirname, `../../downloadFiles`)
makeDir(fileDirPath)
const file = new xlsx.File();
@ -57,6 +57,33 @@ async function simpleExcelDown ({ data = [], header = [], fileName = moment().fo
for (let h of header) {
const cell = row.addCell();
cell.value = data[i][h.key];
if (exp == 'patrol' || exp == 'maintenance') {
if (h.key == 'projectType') {
let type = data[i][h.key]
if (type == 'road') {
cell.value = '道路'
} else if (type == 'birdge') {
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
}
}
cell.style = style
}
}

19
jenkinsfile_script_init_report_pic_data

@ -0,0 +1,19 @@
pipeline {
agent {
node{
label 'jnlp-slave'
}
}
stages {
stage('Highways4Good Api ......') {
steps {
sh 'switch-auth.sh anxinyun'
buildName "#${BUILD_NUMBER} ~/fs-cloud/${JOB_NAME}:${IMAGE_VERSION}"
buildDescription "registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}"
sh 'docker build -t registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION} ./scripts/0.0.1/data/3_init_report_pic_data'
sh 'docker push registry.cn-hangzhou.aliyuncs.com/${CLOUD}/${JOB_NAME}:${IMAGE_VERSION}'
}
}
}
}

11
scripts/0.0.1/data/3_init_report_pic_data/Dockerfile

@ -0,0 +1,11 @@
FROM repository.anxinyun.cn/base-images/nodejs12:20.10.12.2
COPY . /var/app
WORKDIR /var/app
RUN npm cache clean -f
RUN rm -rf package-lock.json
RUN npm install --registry http://10.8.30.22:7000
CMD ["node", "index.js"]

29
scripts/0.0.1/data/3_init_report_pic_data/index.js

@ -9,18 +9,31 @@ try {
const qiniu = require('qiniu');
const uuidv4 = require('uuid/v4');
// 连接数据库
// 测试环境
// const pool = new Pool({
// user: 'FashionAdmin',
// host: '10.8.30.156',
// database: 'highway4goodn0728',
// password: '123456',
// port: 5432,
// })
// // 7niu 验证
// const accessKey = '5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu'
// const secretKey = 'w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5'
// const bucket = 'anxinyun-test'
// 商用环境
const pool = new Pool({
user: 'postgres',
host: '10.8.30.32',
database: 'highways4good',
password: '123',
user: 'highwayadmin',
host: '10.8.40.223',
database: 'highway4good',
password: 'highway123',
port: 5432,
})
// 7niu 验证
const accessKey = 'XuDgkao6cL0HidoMAPnA5OB10Mc_Ew08mpIfRJK5'
const secretKey = 'yewcieZLzKZuDfig0wLZ9if9jKp2P_1jd3CMJPSa'
const bucket = 'dev-highways4good'
const accessKey = '5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu'
const secretKey = 'w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5'
const bucket = 'anxinyun'

4
weapp/src/pages/home/index.jsx

@ -51,13 +51,13 @@ const Index = () => {
{isSuperAdmin ? '查看' : '填报'}
</View>
</View>
{
{/* {
isSuperAdmin &&
<View className='card video'>
<View className='title'> </View>
<View className='btn' onClick={toVideo}>查看</View>
</View>
}
} */}
</View>
);
}

1
web/client/src/sections/fillion/components/infor/videoUpload.js

@ -36,6 +36,7 @@ const VideoUpload = (props) => {
setCounts(res.payload.data)
})
})
form.resetFields()
setIsModalVisible(false);
}
);

13
web/client/src/sections/fillion/components/inforTable.js

@ -197,7 +197,7 @@ const InForTable = (props) => {
dataIndex: 'createdAt',
valueType: 'date',
render: (dom, record) => {
return record.testTime?.slice(0,10)
return record.testTime?.slice(0, 10)
},
fieldProps: {
onChange: (value, cs) => {
@ -447,10 +447,13 @@ const InForTable = (props) => {
defaultCollapsed: false,
optionRender: (searchConfig, formProps, dom) => [
...dom.reverse(),
<Popconfirm title="确认导出?" onConfirm={() => {
// console.log(rowSelected)
props.exports(rowSelected, counts) }}>
<Popconfirm title={rowSelected.length === 0 ? '请勾选内容' : "确认导出?"}
showCancel={rowSelected.length === 0 ? false : true}
onConfirm={() => {
// console.log(rowSelected)
rowSelected.length === 0 ? null : props.exports(rowSelected, counts)
}}
>
<Button
>
导出

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

@ -12,6 +12,7 @@ import moment from 'moment';
const DetailForm = (props) => {
const { visible, data, handleClose, loading } = props;
const [qndmn] = useState(localStorage.getItem('qndmn'));
const keyList = [
{ key: '编号', name: 'id' },
{ key: '工程类型', name: 'projectType' },
@ -37,7 +38,7 @@ const DetailForm = (props) => {
{
data[obj.name] && data[obj.name] instanceof Array ? data[obj.name].map(imgSrc => {
return <div style={{ width: '44%', margin: 6 }}>
<Image src={imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无图片'
}
@ -90,6 +91,8 @@ const DetailList = (props) => {
}
}
let daySet = {};
const columns = [
{
title: '编号',
@ -97,6 +100,14 @@ const DetailList = (props) => {
dataIndex: 'id',
align: 'center',
render: (text, record) => {
let day = moment(record.time).format("YYYYMMDD")
if (daySet[day]) {
daySet[day].add(Symbol())
} else {
daySet[day] = new Set()
daySet[day].add(Symbol())
}
return day * 10000 + daySet[day].size
return moment(record.time).format("YYYYMMDD") * 10000 + record.id;
}
}, {
@ -104,6 +115,15 @@ const DetailList = (props) => {
key: 'projectType',
dataIndex: 'projectType',
align: 'center',
render: (text, record) => {
switch (text) {
case 'road': return '道路';
case 'bridge': return '桥梁';
case 'culvert': return '涵洞';
case 'other': return '其他';
default: return text;
}
}
}, {
title: '所属道路',
key: 'road',
@ -131,7 +151,7 @@ const DetailList = (props) => {
dataIndex: 'userName',
align: 'center',
render: (text, record) => {
return record.user.name
return record?.user?.name
}
}, {
title: '上报时间',
@ -263,7 +283,7 @@ const PatrolNameList = (props) => {
const MaintenanceTable = (props) => {
const { userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading } = props;
const { userList, reportList, dispatch, reportListLoading, reportDetail, reportDetailLoading, userLoading, exports } = props;
const [record, setRecord] = useState();
const [dateRange, setDateRange] = useState();
const [detailVisible, setDetailVisible] = useState(false)
@ -333,7 +353,7 @@ const MaintenanceTable = (props) => {
);
};
function mapStateToProps(state) {
function mapStateToProps (state) {
const { auth, depMessage, userList, reportList, reportDetail } = state;
const pakData = (dep) => {
return dep.map((d) => {

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

@ -13,13 +13,14 @@ import moment from 'moment';
const DetailForm = (props) => {
const { visible, data, handleClose, loading } = props;
const [qndmn] = useState(localStorage.getItem('qndmn'));
const keyList = [
{ key: '编号', name: 'id' },
{ key: '工程类型', name: 'projectType' },
{ key: '所在路段', name: 'road' },
{ key: '具体位置', name: 'address' },
{ key: '巡查内容', name: 'content' },
{ key: '病害照片', name: 'scenePic' },
{ key: '现场照片', name: 'scenePic' },
];
const renderContent = (data) => {
@ -38,7 +39,7 @@ const DetailForm = (props) => {
{
data.scenePic && data.scenePic instanceof Array ? data.scenePic.map(imgSrc => {
return <div style={{ width: '44%', margin: 6 }}>
<Image src={imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
<Image src={qndmn + '/' + imgSrc} width={'100%'} style={{ marginBottom: 4 }} />
</div>
}) : '暂无图片'
}
@ -57,7 +58,7 @@ const DetailForm = (props) => {
visible={visible}
footer={null}
onCancel={handleClose}
title={'巡管理详情'}
title={'巡管理详情'}
>
<Spin spinning={loading}>
{renderContent(data)}
@ -90,7 +91,7 @@ const DetailList = (props) => {
})
}
}
let daySet = {};
const columns = [
{
title: '编号',
@ -98,6 +99,14 @@ const DetailList = (props) => {
dataIndex: 'id',
align: 'center',
render: (text, record) => {
let day = moment(record.time).format("YYYYMMDD")
if (daySet[day]) {
daySet[day].add(Symbol())
} else {
daySet[day] = new Set()
daySet[day].add(Symbol())
}
return day * 10000 + daySet[day].size
return moment(record.time).format("YYYYMMDD") * 10000 + record.id;
}
},
@ -106,6 +115,15 @@ const DetailList = (props) => {
key: 'projectType',
dataIndex: 'projectType',
align: 'center',
render: (text, record) => {
switch (text) {
case 'road': return '道路';
case 'bridge': return '桥梁';
case 'culvert ': return '涵洞';
case 'other': return '其他';
default: return text;
}
}
},
{
title: '所属道路',
@ -205,7 +223,7 @@ const PatrolNameList = (props) => {
const columns = [
{
title: '巡人员',
title: '巡人员',
key: 'name',
dataIndex: 'name',
align: 'center'
@ -243,7 +261,7 @@ const PatrolNameList = (props) => {
return record.id == selectRoad ? 'list-row-actived' : '';
}}
toolBarRender={() => [
<Input placeholder='输入巡人员名称' onChange={doUserNameSearch} ></Input>
<Input placeholder='输入巡人员名称' onChange={doUserNameSearch} ></Input>
]}
options={false}
pagination={false}
@ -319,10 +337,10 @@ const PatrolTable = (props) => {
const tabList = [
{
key: 'tab1',
tab: '巡',
tab: '巡',
}, {
key: 'tab2',
tab: '巡轨迹查询',
tab: '巡轨迹查询',
},
];
const contentList = {
@ -388,7 +406,7 @@ const PatrolTable = (props) => {
);
};
function mapStateToProps(state) {
function mapStateToProps (state) {
const { auth, depMessage, userList, reportList, reportDetail } = state;
const pakData = (dep) => {
return dep.map((d) => {

2
web/client/src/sections/quanju/containers/footer/leadership/centerleft/daolu.js

@ -28,7 +28,7 @@ const Right = (props) => {
// const
})
}, [])
console.log("1211", nums);
// console.log("1211", nums);
const renderBody = () => {
return (

4
web/client/src/sections/quanju/containers/footer/leadership/centerleft/handong.js

@ -27,7 +27,7 @@ const Right = (props) => {
const daolus = dispatch(getdaolutongji()).then((res) => {
// console.log("[roads]", res.payload.data.roadType);
setRoads(res.payload.data.townCulvert)
console.log(res.payload.data.townCulvert);
// console.log(res.payload.data.townCulvert);
// const
})
}, [])
@ -39,7 +39,7 @@ const Right = (props) => {
{
list.map((item, index) => {
console.log(list);
// console.log(list);
return (
<li className={index} style={{

2
web/client/src/sections/quanju/containers/footer/leadership/centerleft/qiqoliang.js

@ -23,7 +23,7 @@ const Right = (props) => {
const daolus = dispatch(getdaolutongji()).then((res) => {
// console.log("[roads]", res.payload.data.roadType);
setRoads(res.payload.data.bridgeSize)
console.log(res.payload.data.bridgeSize);
// console.log(res.payload.data.bridgeSize);
// const
})
}, [])

2
web/client/src/sections/quanju/containers/footer/leadership/left/echarts/leftbottomecharts.js

@ -16,7 +16,7 @@ const Leftbottomecharts = (props) => {
}))
});
}, [])
console.log(list, count);
// console.log(list, count);
const chartRef = useRef(null);
useEffect(() => {
var chartInstance = echarts.init(chartRef.current);

2
web/client/src/sections/quanju/containers/footer/leadership/left/echarts/lefttopecharts.js

@ -31,7 +31,7 @@ const Lefttopecharts = (props) => {
// setMass(res.payload.data.index)
// // setspeed(res.payload.data.speed)
// })
console.log(mass);
// console.log(mass);
var chartInstance = echarts.init(chartRef.current);
// var dataArr = mass || 0;
var names = names()

10
web/client/src/sections/quanju/containers/footer/leadership/left/left-top.js

@ -11,6 +11,7 @@ const Lefttop = (props) => {
const [mass, setMass] = useState()
const [speed, setspeed] = useState()
const [traffic, setTraffic] = useState()
const [tim, setTim] = useState()
const [nums, setNums] = useState()
useEffect(() => {
const shuju = dispatch(getGodshuju()).then((res) => {
@ -32,9 +33,14 @@ const Lefttop = (props) => {
setNums(localStorage.getItem("num"))
}
})
}, [tim])
useEffect(() => {
const timer = setInterval(() => {
setTim(new Date())
}, 300000);
return () => clearInterval(timer);
}, [])
// console.log(mass);
// console.log(nums);
// console.log(tim);
return (
<>
<Module style={style} title={"道路拥堵指数"} >

2
web/client/src/sections/quanju/containers/footer/leadership/right/hudong.js

@ -16,7 +16,7 @@ class ReactCarousel extends Component {
} else {
j++;
x = 0;
console.log("else:" + "j=" + j + " " + "x=" + x);
// console.log("else:" + "j=" + j + " " + "x=" + x);
arr1[j][x] = arr[i];
// console.log(arr1);
x++;

14
web/routes/attachment/index.js

@ -18,9 +18,13 @@ const ext = {
module.exports = {
entry: function (app, router, opts) {
const getApiRoot = async function (ctx) {
const { apiUrl, qndmn } = opts;
ctx.status = 200;
ctx.body = { root: apiUrl, qndmn };
try {
const { apiUrl, qndmn } = opts;
ctx.status = 200;
ctx.body = { root: apiUrl, qndmn };
} catch (error) {
console.error('getApiRoot', error)
}
};
let upload = async function (ctx, next) {
@ -84,7 +88,7 @@ module.exports = {
}
router.get('/api/root', getApiRoot);
router.post('/_upload/new', upload);
router.delete('/_upload/cleanup', remove);
// router.post('/_upload/new', upload);
// router.delete('/_upload/cleanup', remove);
}
};

Loading…
Cancel
Save