peng.peng
10 months ago
30 changed files with 656 additions and 202 deletions
@ -0,0 +1,90 @@ |
|||
'use strict' |
|||
|
|||
const request = require('superagent') |
|||
const moment = require('moment') |
|||
|
|||
|
|||
// function getFileCarImages (opts) {
|
|||
|
|||
// return async function (ctx, next) {
|
|||
// let error = { message: '文件夹名称更新失败' }
|
|||
// const models = ctx.fs.dc.models
|
|||
// const { page, limit, } = ctx.query
|
|||
// try {
|
|||
// let searchWhere = {}
|
|||
// let option = {
|
|||
// where: searchWhere,
|
|||
// order: [["id", "desc"]],
|
|||
// }
|
|||
|
|||
|
|||
// option.where = searchWhere
|
|||
|
|||
// let limit_ = limit || 10
|
|||
// let page_ = page || 1
|
|||
// let offset = (page_ - 1) * limit_
|
|||
// if (limit && page) {
|
|||
// option.limit = limit_
|
|||
// option.offset = offset
|
|||
// }
|
|||
|
|||
// const res = await models.CarImages.findAndCount(option)
|
|||
|
|||
// error = null
|
|||
// } catch (err) {
|
|||
// ctx.status = 500
|
|||
// ctx.body = { detail: err, ...error }
|
|||
// }
|
|||
|
|||
// if (error) {
|
|||
// ctx.status = 400
|
|||
// ctx.body = { ...error }
|
|||
// } else {
|
|||
// ctx.status = 200
|
|||
// ctx.body = { message: '文件夹名称更新成功' }
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
|
|||
|
|||
function getFileCarImages (opts) { |
|||
return async function (ctx, next) { |
|||
|
|||
const models = ctx.fs.dc.models |
|||
const { page, limit, } = ctx.query |
|||
const Op = ctx.fs.dc.ORM.Op |
|||
let errMsg = { message: '获取图片失败' } |
|||
try { |
|||
let searchWhere = {} |
|||
let option = { |
|||
where: searchWhere, |
|||
order: [["id", "ASC"]], |
|||
} |
|||
|
|||
|
|||
option.where = searchWhere |
|||
|
|||
let limit_ = limit || 10 |
|||
let page_ = page || 1 |
|||
let offset = (page_ - 1) * limit_ |
|||
if (limit && page) { |
|||
option.limit = limit_ |
|||
option.offset = offset |
|||
} |
|||
|
|||
const res = await models.CarImages.findAndCount(option) |
|||
ctx.status = 200 |
|||
ctx.body = res |
|||
} catch (error) { |
|||
|
|||
ctx.status = 400 |
|||
ctx.body = errMsg |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
module.exports = { |
|||
getFileCarImages |
|||
} |
@ -0,0 +1,44 @@ |
|||
/* eslint-disable*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = dc => { |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const CarImages = sequelize.define("carImages", { |
|||
id: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true, |
|||
unique: "car_images_id_uindex" |
|||
}, |
|||
url: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "图片路径", |
|||
primaryKey: false, |
|||
field: "url", |
|||
autoIncrement: false |
|||
}, |
|||
time: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "时间", |
|||
primaryKey: false, |
|||
field: "time", |
|||
autoIncrement: false |
|||
} |
|||
}, { |
|||
tableName: "car_images", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
dc.models.CarImages = CarImages; |
|||
return CarImages; |
|||
}; |
@ -0,0 +1,10 @@ |
|||
'use strict' |
|||
|
|||
const images = require('../../controllers/images') |
|||
|
|||
module.exports = function (app, router, opts, panCode) { |
|||
|
|||
router.get('/car/images', images.getFileCarImages(opts)) |
|||
|
|||
|
|||
} |
Binary file not shown.
@ -0,0 +1,16 @@ |
|||
create table car_images |
|||
( |
|||
id serial |
|||
constraint car_images_pk |
|||
primary key, |
|||
url varchar, |
|||
time timestamptz |
|||
); |
|||
|
|||
comment on column car_images.url is '图片路径'; |
|||
|
|||
comment on column car_images.time is '时间'; |
|||
|
|||
create unique index car_images_id_uindex |
|||
on car_images (id); |
|||
|
@ -0,0 +1,5 @@ |
|||
alter table road_spot_check_preview |
|||
add last_abstract_village jsonb; |
|||
|
|||
comment on column road_spot_check_preview.last_abstract_village is '每个乡上次抽查的最后一个村'; |
|||
|
@ -0,0 +1,3 @@ |
|||
export default { |
|||
navigationBarTitleText: '抽查详情' |
|||
} |
@ -0,0 +1,99 @@ |
|||
import React, { useEffect, useState } from 'react' |
|||
import Taro, { useRouter, useDidShow } from '@tarojs/taro' |
|||
import { View } from '@tarojs/components' |
|||
import { AtButton, AtSearchBar } from 'taro-ui' |
|||
import { NoData } from '@/components/index' |
|||
import Skeleton from '../components/skeleton' |
|||
import moment from 'moment' |
|||
import request from '@/services/request' |
|||
import { getRoadSpotDetail } from '@/services/api' |
|||
import './index.scss' |
|||
|
|||
function Index() { |
|||
const { item, isOld } = useRouter().params |
|||
const spotItem = item ? JSON.parse(decodeURIComponent(item)) : null |
|||
|
|||
const [keyword, setKeyword] = useState('') |
|||
const [roadDetailList, setRoadDetailList] = useState([]) |
|||
const [isNoData, setIsNoData] = useState(false) |
|||
|
|||
useDidShow(() => { |
|||
getDetail() |
|||
}) |
|||
|
|||
const getDetail = () => { |
|||
if (spotItem) { |
|||
Taro.showLoading({ title: '加载中' }) |
|||
request.get(`${getRoadSpotDetail()}?previewId=${spotItem.id}&keyword=${keyword}`).then(res => { |
|||
Taro.hideLoading() |
|||
if (res.statusCode === 200) { |
|||
setRoadDetailList(res.data) |
|||
} else { |
|||
Taro.showToast({ title: '获取详情失败', icon: 'error' }) |
|||
} |
|||
if (res.data?.length) { |
|||
setIsNoData(false) |
|||
} else { |
|||
setIsNoData(true) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
const renderList = () => { |
|||
return roadDetailList.length ? roadDetailList.map(item => <View key={item.id} className='card'> |
|||
<View className='item'>道路类型:{item.road?.level ? (item.road?.level + '道') : '--'}</View> |
|||
<View className='item'>路线名称:{item.road?.routeName || '--'}</View> |
|||
<View className='item at-row'> |
|||
<View className='at-col-6'>路线代码:{item.road?.routeCode || '--'}</View> |
|||
<View className='at-col-6'>路段序号:{item.road?.sectionNo || '--'}</View> |
|||
</View> |
|||
<View className='item at-row'> |
|||
<View className='at-col-6'>起点地名:{item.road?.startingPlaceName || '--'}</View> |
|||
<View className='at-col-6'>止点地名:{item.road?.stopPlaceName || '--'}</View> |
|||
</View> |
|||
<View className='item'>里程:{item.road?.chainageMileage || '--'}</View> |
|||
<View className='item at-row'> |
|||
<View className='at-col-6'>养护次数(次):{item.maintenanceCount}</View> |
|||
<View className='at-col-3'> |
|||
<AtButton |
|||
className='edit-btn' |
|||
type='primary' |
|||
size='small' |
|||
onClick={() => Taro.navigateTo({ url: `/packages/maintenanceSpotCheck/spotCheckRoadDetail/index?detail=${encodeURIComponent(JSON.stringify(item))}` })} |
|||
>详情</AtButton> |
|||
</View> |
|||
<View className='at-col-3'> |
|||
<AtButton |
|||
className='edit-btn' |
|||
type='primary' |
|||
size='small' |
|||
onClick={() => Taro.navigateTo({ url: `/packages/maintenanceSpotCheck/spotChange/index?detail=${encodeURIComponent(JSON.stringify(item))}&spot=${encodeURIComponent(JSON.stringify(spotItem))}` })} |
|||
disabled={ |
|||
isOld === 'true' || |
|||
item.roadSpotCheckPreview?.roadSpotCheckChangeLogs?.some(l => l.changeRoadId == item.roadId) |
|||
} |
|||
>调整</AtButton> |
|||
</View> |
|||
</View> |
|||
</View>) : <Skeleton length={3} /> |
|||
} |
|||
|
|||
const renderNoData = () => { |
|||
return <View style={{ marginTop: 100 }}><NoData /></View> |
|||
} |
|||
|
|||
return (<View className='page'> |
|||
<AtSearchBar |
|||
placeholder='道路名称关键字' |
|||
showActionButton |
|||
value={keyword} |
|||
onChange={v => setKeyword(v)} |
|||
onActionClick={getDetail} |
|||
/> |
|||
<View className='top flex'>抽查日期:{moment(spotItem.date).format('YYYY-MM-DD')}</View> |
|||
{isNoData ? renderNoData() : renderList()} |
|||
</View>) |
|||
} |
|||
|
|||
export default Index |
@ -0,0 +1,29 @@ |
|||
.page { |
|||
background-color: #fff; |
|||
height: 100vh; |
|||
font-size: 28px; |
|||
padding-bottom: 40px; |
|||
|
|||
.top { |
|||
height: 90px; |
|||
} |
|||
|
|||
.card { |
|||
padding: 20px; |
|||
border: gainsboro 1px solid; |
|||
border-radius: 10px; |
|||
background-color: #fff; |
|||
box-shadow: 10px 10px 5px rgb(219, 218, 218); |
|||
margin: 0 0 20px 20px; |
|||
width: calc(100% - 40px); |
|||
box-sizing: border-box; |
|||
|
|||
.item { |
|||
padding: 10px 0; |
|||
|
|||
.edit-btn { |
|||
width: 100px; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -1,3 +1,3 @@ |
|||
export default { |
|||
navigationBarTitleText: '抽查详情' |
|||
navigationBarTitleText: '抽查道路详情' |
|||
} |
@ -1,91 +1,61 @@ |
|||
import React, { useEffect, useState } from 'react' |
|||
import Taro, { useRouter, useDidShow } from '@tarojs/taro' |
|||
import { View } from '@tarojs/components' |
|||
import { AtButton, AtSearchBar } from 'taro-ui' |
|||
import { NoData } from '@/components/index' |
|||
import Skeleton from '../components/skeleton' |
|||
import moment from 'moment' |
|||
import request from '@/services/request' |
|||
import { getRoadSpotDetail } from '@/services/api' |
|||
import React from 'react' |
|||
import Taro, { useRouter } from '@tarojs/taro' |
|||
import { View, Text } from '@tarojs/components' |
|||
import { AtList, AtListItem } from "taro-ui" |
|||
import './index.scss' |
|||
|
|||
function Index() { |
|||
const { item, isOld } = useRouter().params |
|||
const spotItem = item ? JSON.parse(decodeURIComponent(item)) : null |
|||
|
|||
const [keyword, setKeyword] = useState('') |
|||
const [roadDetailList, setRoadDetailList] = useState([]) |
|||
const [isNoData, setIsNoData] = useState(false) |
|||
|
|||
useDidShow(() => { |
|||
getDetail() |
|||
}) |
|||
|
|||
const getDetail = () => { |
|||
if (spotItem) { |
|||
Taro.showLoading({ title: '加载中' }) |
|||
request.get(`${getRoadSpotDetail()}?previewId=${spotItem.id}&keyword=${keyword}`).then(res => { |
|||
Taro.hideLoading() |
|||
if (res.statusCode === 200) { |
|||
setRoadDetailList(res.data) |
|||
} else { |
|||
Taro.showToast({ title: '获取详情失败', icon: 'error' }) |
|||
} |
|||
if (res.data?.length) { |
|||
setIsNoData(false) |
|||
} else { |
|||
setIsNoData(true) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
const renderList = () => { |
|||
return roadDetailList.length ? roadDetailList.map(item => <View key={item.id} className='card'> |
|||
<View className='item'>道路类型:{item.road?.level ? (item.road?.level + '道') : '--'}</View> |
|||
<View className='item'>路线名称:{item.road?.routeName || '--'}</View> |
|||
<View className='item at-row'> |
|||
<View className='at-col-6'>路线代码:{item.road?.routeCode || '--'}</View> |
|||
<View className='at-col-6'>路段序号:{item.road?.sectionNo || '--'}</View> |
|||
</View> |
|||
<View className='item at-row'> |
|||
<View className='at-col-6'>起点地名:{item.road?.startingPlaceName || '--'}</View> |
|||
<View className='at-col-6'>止点地名:{item.road?.stopPlaceName || '--'}</View> |
|||
</View> |
|||
<View className='item'>里程:{item.road?.chainageMileage || '--'}</View> |
|||
<View className='item at-row'> |
|||
<View className='at-col-6'>养护次数(次):{item.maintenanceCount}</View> |
|||
<View className='at-col-6'> |
|||
<AtButton |
|||
className='edit-btn' |
|||
type='primary' |
|||
size='small' |
|||
onClick={() => Taro.navigateTo({ url: `/packages/maintenanceSpotCheck/spotChange/index?detail=${encodeURIComponent(JSON.stringify(item))}&spot=${encodeURIComponent(JSON.stringify(spotItem))}` })} |
|||
disabled={ |
|||
isOld === 'true' || |
|||
item.roadSpotCheckPreview?.roadSpotCheckChangeLogs?.some(l => l.changeRoadId == item.roadId) |
|||
} |
|||
>调整</AtButton> |
|||
</View> |
|||
</View> |
|||
</View>) : <Skeleton length={3} /> |
|||
} |
|||
const roadCode = [ |
|||
{ title: "八一乡", value: "360121206000" }, |
|||
{ title: "东新乡", value: "360121205000" }, |
|||
{ title: "富山乡", value: "360121204000" }, |
|||
{ title: "冈上镇", value: "360121107000" }, |
|||
{ title: "广福镇", value: "360121108000" }, |
|||
{ title: "黄马乡", value: "360121203000" }, |
|||
{ title: "蒋巷镇", value: "360121105000" }, |
|||
{ title: "金湖管理处", value: "330052" }, |
|||
{ title: "泾口乡", value: "360121200000" }, |
|||
{ title: "莲塘镇", value: "360121100000" }, |
|||
{ title: "南新乡", value: "360121201000" }, |
|||
{ title: "三江镇", value: "360121102000" }, |
|||
{ title: "塔城乡", value: "360121202000" }, |
|||
{ title: "塘南镇", value: "360121103000" }, |
|||
{ title: "武阳镇", value: "360121106000" }, |
|||
{ title: "向塘镇", value: "360121101000" }, |
|||
{ title: "银三角管委会", value: "360121471000" }, |
|||
{ title: "幽兰镇", value: "360121104000" }, |
|||
] |
|||
|
|||
const renderNoData = () => { |
|||
return <View style={{ marginTop: 100 }}><NoData /></View> |
|||
function Index() { |
|||
const { detail } = useRouter().params |
|||
const detailItem = detail ? JSON.parse(decodeURIComponent(detail)) : null |
|||
|
|||
let townshipCode = '' |
|||
const targetValue = detailItem?.road?.townshipCode ?? '' |
|||
const foundItem = roadCode.find(item => item.value === targetValue) |
|||
if (foundItem) { |
|||
townshipCode = foundItem.title |
|||
} else { |
|||
townshipCode = "--" |
|||
} |
|||
|
|||
return (<View className='page'> |
|||
<AtSearchBar |
|||
placeholder='道路名称关键字' |
|||
showActionButton |
|||
value={keyword} |
|||
onChange={v => setKeyword(v)} |
|||
onActionClick={getDetail} |
|||
/> |
|||
<View className='top flex'>抽查日期:{moment(spotItem.date).format('YYYY-MM-DD')}</View> |
|||
{isNoData ? renderNoData() : renderList()} |
|||
</View>) |
|||
return ( |
|||
<View className='page'> |
|||
<AtList> |
|||
<AtListItem title='所属乡镇' extraText={townshipCode} /> |
|||
<AtListItem title='所属行政村' extraText={detailItem.road?.village?.name || '--'} /> |
|||
<AtListItem title='道路名称' extraText={detailItem.road?.routeName || '--'} /> |
|||
<AtListItem title='道路代码' extraText={detailItem.road?.routeCode || '--'} /> |
|||
<AtListItem title='起点桩号' extraText={detailItem.road?.startStation || '--'} /> |
|||
<AtListItem title='止点桩号' extraText={detailItem.road?.stopStation || '--'} /> |
|||
<AtListItem title='技术等级' extraText={detailItem.road?.technicalLevel || '--'} /> |
|||
<AtListItem title='路面类型' extraText={detailItem.road?.pavementType || '--'} /> |
|||
<AtListItem title='路面宽度' extraText={detailItem.road?.pavementWidth || '--'} /> |
|||
<AtListItem title='路基宽度' extraText={detailItem.road?.subgradeWidth || '--'} /> |
|||
<AtListItem title='桩号里程' extraText={detailItem.road?.chainageMileage || '--'} /> |
|||
<AtListItem title='养护次数(次)' extraText={detailItem.maintenanceCount} /> |
|||
</AtList> |
|||
</View> |
|||
) |
|||
} |
|||
|
|||
export default Index |
@ -1,29 +1,9 @@ |
|||
.page { |
|||
background-color: #fff; |
|||
height: 100vh; |
|||
font-size: 28px; |
|||
padding-bottom: 40px; |
|||
|
|||
.top { |
|||
height: 90px; |
|||
} |
|||
|
|||
.card { |
|||
padding: 20px; |
|||
border: gainsboro 1px solid; |
|||
border-radius: 10px; |
|||
background-color: #fff; |
|||
box-shadow: 10px 10px 5px rgb(219, 218, 218); |
|||
margin: 0 0 20px 20px; |
|||
width: calc(100% - 40px); |
|||
box-sizing: border-box; |
|||
|
|||
.item { |
|||
padding: 10px 0; |
|||
background-color: #fff; |
|||
// font-size: 28px; |
|||
|
|||
.edit-btn { |
|||
width: 100px; |
|||
} |
|||
} |
|||
.at-list__item-extra { |
|||
max-width: 470px; |
|||
} |
|||
} |
Binary file not shown.
@ -0,0 +1,15 @@ |
|||
import { basicAction } from '@peace/utils' |
|||
import { ApiTable } from '$utils' |
|||
|
|||
|
|||
export function getCarImages (query) { |
|||
return dispatch => basicAction({ |
|||
type: 'get', |
|||
dispatch: dispatch, |
|||
actionType: 'GET_CAR_IMAGES', |
|||
url: ApiTable.getCarImages, |
|||
query, |
|||
msg: { error: '获取图片失败' }, |
|||
reducer: { name: 'carimage' } |
|||
}) |
|||
} |
@ -0,0 +1,124 @@ |
|||
// import React, { useState, useEffect } from 'react'
|
|||
// import { connect } from 'react-redux'
|
|||
// import { getCarImages } from '../actions/carimages'
|
|||
// import ProTable from '@ant-design/pro-table'
|
|||
// import { Form, Space, DatePicker, Button, Select, Popconfirm, Image, Tooltip } from 'antd'
|
|||
// import moment from 'moment'
|
|||
|
|||
|
|||
// function Carimages (props) {
|
|||
// const { dispatch, assess, user } = props
|
|||
// const [query, setQuery] = useState({ page: 1, pageSize: 10, })
|
|||
// const [loading, setLoading] = useState(false)
|
|||
// const [datasource, setdatasource] = useState([])
|
|||
// const [dateRange, setDateRange] = useState(['1970-1-1', '2099-12-31'])
|
|||
// const { RangePicker } = DatePicker
|
|||
// const [total, settotal] = useState(0)
|
|||
// const [editAble, setEditAble] = useState(user?.username !== 'SuperAdmin' && user?.userResources?.find(i => i.resourceId === 'ASSESSMANAGE')?.isshow === "true" ? true : '')
|
|||
// useEffect(() => {
|
|||
|
|||
// return () => { }
|
|||
// }, [])
|
|||
|
|||
// useEffect(() => {
|
|||
// getData()
|
|||
// }, [query])
|
|||
|
|||
|
|||
|
|||
|
|||
// const getData = () => {
|
|||
// console.log(query, 'query')
|
|||
// dispatch(getCarImages({ ...query })).then(res => {
|
|||
// if (res?.success) {
|
|||
// setdatasource(res?.payload?.data?.rows)
|
|||
// settotal(res?.payload?.data?.count)
|
|||
// }
|
|||
// })
|
|||
// }
|
|||
|
|||
|
|||
// return (
|
|||
// <div>
|
|||
// <div style={{ marginBottom: '20px', display: 'flex', justifyContent: 'space-between' }}>
|
|||
// <Form layout="inline" onFinish={(v) => {
|
|||
|
|||
// setQuery({
|
|||
// ...query, page: 1, unit: v.unit, startTime: v?.time && moment(v?.time[0]).startOf('day').format('YYYY-MM-DD HH:mm:ss'),
|
|||
// endTime: v?.time && moment(v?.time[1]).add(1, 'days').endOf('day').format('YYYY-MM-DD HH:mm:ss')
|
|||
// })
|
|||
// }}>
|
|||
|
|||
// {/* <Form.Item>
|
|||
// <Button type="primary" htmlType="submit">搜索</Button>
|
|||
// </Form.Item> */}
|
|||
// </Form>
|
|||
|
|||
// {/* <Button type="primary" disabled={editAble}
|
|||
// onClick={() => {
|
|||
// setAssessModalVisible(true)
|
|||
// }}>新增</Button> */}
|
|||
// </div>
|
|||
// <ProTable
|
|||
// columns={[
|
|||
// {
|
|||
// title: '序号',
|
|||
// dataIndex: 'id',
|
|||
// key: 'id',
|
|||
// defaultSortOrder: 'ascend',
|
|||
// },
|
|||
// {
|
|||
// title: '抓拍图片',
|
|||
// dataIndex: 'url',
|
|||
// key: 'url',
|
|||
// render: (t, r) => {
|
|||
// if (r?.url && r?.id) {
|
|||
// return <span style={{ marginRight: 10 }}>
|
|||
// <Image src={r?.url} width={200} />
|
|||
// </span>
|
|||
// } else {
|
|||
// return '--'
|
|||
// }
|
|||
// }
|
|||
// },
|
|||
// {
|
|||
// title: '日期',
|
|||
// dataIndex: 'time',
|
|||
// key: 'time',
|
|||
// render: (t, r) => {
|
|||
// const localTime = moment.utc(r?.time).format('YYYY-MM-DD HH:mm:ss')
|
|||
// return r?.time ? localTime : '--'
|
|||
// }
|
|||
// },
|
|||
// ]}
|
|||
// dataSource={datasource || []}
|
|||
// loading={loading}
|
|||
// pagination={{
|
|||
// total: total || 0,
|
|||
// pageSize: 10,
|
|||
// defaultPageSize: 10,
|
|||
// showSizeChanger: false,
|
|||
// onChange: (page, pageSize) => {
|
|||
// setQuery({
|
|||
// ...query,
|
|||
// page,
|
|||
// limit: pageSize
|
|||
// })
|
|||
// }
|
|||
// }}
|
|||
// rowKey="key"
|
|||
// toolBarRender={false}
|
|||
// search={false}
|
|||
// />
|
|||
|
|||
// </div>
|
|||
// )
|
|||
// }
|
|||
// function mapStateToProps (state) {
|
|||
// const { auth, assess } = state
|
|||
// return {
|
|||
// user: auth.user,
|
|||
// assess: assess.data || [],
|
|||
// }
|
|||
// }
|
|||
// export default connect(mapStateToProps)(Carimages)
|
Loading…
Reference in new issue