diff --git a/api/app/lib/controllers/data/road.js b/api/app/lib/controllers/data/road.js
index e95ae7d1..b12d1a67 100644
--- a/api/app/lib/controllers/data/road.js
+++ b/api/app/lib/controllers/data/road.js
@@ -1,7 +1,7 @@
'use strict';
const roadKeyMap = require('./road.json')
-async function importIn (ctx) {
+async function importIn(ctx) {
// 数据导入
try {
const models = ctx.fs.dc.models;
@@ -32,7 +32,7 @@ async function importIn (ctx) {
}
}
-async function get (ctx) {
+async function get(ctx) {
try {
const models = ctx.fs.dc.models;
const { codePrefix, level, road, sectionStart, sectionEnd, alterId } = ctx.query;
@@ -86,14 +86,14 @@ async function get (ctx) {
}
}
-async function getRoadSection (ctx) {
+async function getRoadSection(ctx) {
try {
const models = ctx.fs.dc.models;
const { level, road, sectionStart, sectionEnd } = ctx.query;
let findOption = {
where: {},
order: [['id', 'DESC']],
- attributes: ['id', 'routeName', 'startingPlaceName', 'stopPlaceName', 'routeCode', 'sectionNo']
+ attributes: ['id', 'routeName', 'startingPlaceName', 'stopPlaceName', 'routeCode', 'sectionNo', 'level']
}
if (level) {
@@ -129,7 +129,7 @@ async function getRoadSection (ctx) {
}
}
-async function edit (ctx) {
+async function edit(ctx) {
try {
const models = ctx.fs.dc.models;
const data = ctx.request.body;
@@ -155,7 +155,7 @@ async function edit (ctx) {
}
}
-async function del (ctx) {
+async function del(ctx) {
try {
const models = ctx.fs.dc.models;
const { roadId } = ctx.params;
@@ -176,7 +176,7 @@ async function del (ctx) {
}
}
-async function getVillageList (ctx) {
+async function getVillageList(ctx) {
try {
const models = ctx.fs.dc.models;
const { } = ctx.query;
diff --git a/weapp/src/app.config.js b/weapp/src/app.config.js
index e70f0d41..96117e24 100644
--- a/weapp/src/app.config.js
+++ b/weapp/src/app.config.js
@@ -51,7 +51,7 @@ export default {
]
},
usingComponents: {
- 'chart-wx': 'components/wx-chart/chart',
+ // 'chart-wx': 'components/wx-chart/chart',
"van-icon": "components/vant-weapp/icon/index",
"van-dropdown-menu": "components/vant-weapp/dropdown-menu/index",
"van-dropdown-item": "components/vant-weapp/dropdown-item/index",
@@ -60,7 +60,7 @@ export default {
"van-row": "components/vant-weapp/row/index",
"van-col": "components/vant-weapp/col/index",
"van-transition": "components/vant-weapp/transition/index",
- "ec-canvas": "components/ec-canvas/ec-canvas"
+ // "ec-canvas": "components/ec-canvas/ec-canvas"
}
}
diff --git a/weapp/src/packages/maintenanceSpotCheck/components/skeleton/index.jsx b/weapp/src/packages/maintenanceSpotCheck/components/skeleton/index.jsx
new file mode 100644
index 00000000..c92c44ff
--- /dev/null
+++ b/weapp/src/packages/maintenanceSpotCheck/components/skeleton/index.jsx
@@ -0,0 +1,35 @@
+/*
+* 骨架屏
+*/
+import React from 'react'
+import { View } from '@tarojs/components'
+import './index.scss'
+
+export default function Skeleton(props) {
+ const { length } = props
+
+ const render = () => {
+ let node = []
+ for (let i = 0; i < length; i++) {
+ node.push(
+
+
+
+
+
+
+
+
+
+
+ )
+ }
+ return node
+ }
+
+ return (
+
+ {render()}
+
+ )
+}
diff --git a/weapp/src/packages/maintenanceSpotCheck/components/skeleton/index.scss b/weapp/src/packages/maintenanceSpotCheck/components/skeleton/index.scss
new file mode 100644
index 00000000..fda28566
--- /dev/null
+++ b/weapp/src/packages/maintenanceSpotCheck/components/skeleton/index.scss
@@ -0,0 +1,43 @@
+.screen-root {
+ width: 100%;
+ height: 100%;
+ display: flex;
+ justify-content: center;
+ margin-top: 20vh;
+}
+
+.ul {
+ background-color: #fff;
+ margin: 0 auto;
+ padding: 20px;
+ width: 90vw;
+}
+
+.li {
+ background-image: linear-gradient(90deg, #f2f2f2 25%, #e6e6e6 37%, #f2f2f2 63%);
+ width: 100%;
+ height: 0.9rem;
+ list-style: none;
+ background-size: 400% 100%;
+ margin-top: 0.9rem;
+ background-position: 100% 50%;
+ animation: skeleton-loading 1.4s ease infinite;
+}
+
+.li:first-child {
+ width: 38%;
+}
+
+.li:last-child {
+ width: 61%;
+}
+
+@keyframes skeleton-loading {
+ 0% {
+ background-position: 100% 50%;
+ }
+
+ 100% {
+ background-position: 0 50%;
+ }
+}
\ No newline at end of file
diff --git a/weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx b/weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx
index 14207dd4..9861c3ae 100644
--- a/weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx
+++ b/weapp/src/packages/maintenanceSpotCheck/spotChange/index.jsx
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react'
import Taro, { useRouter } from '@tarojs/taro'
-import { View, Text, Picker, } from '@tarojs/components'
+import { View, Text, Picker, Input } from '@tarojs/components'
import { AtButton, AtIcon, } from 'taro-ui'
import request from '@/services/request'
import { roadSpotChange, roadUrl } from '@/services/api'
@@ -77,18 +77,23 @@ function Index() {
[key]: value
}
- let routeName = []
let routeCode = []
let sectionNo = []
let data = [...road]
- data.forEach(v => {
- if (v.routeName && !routeName.includes(v.routeName)) {
- routeName.push(v.routeName)
+ if (key == 'routeName') {
+ // routeName关键字筛选
+ let routeName = []
+ road.forEach(item => {
+ if (item.routeName && !routeName.includes(item.routeName)) {
+ routeName.push(item.routeName)
+ }
+ })
+ if (value) {
+ routeName = routeName.filter(item => item.indexOf(value) > -1)
}
- });
+ setNameList(routeName)
- if (key == 'routeName') {
nextValue.routeCode = ''
nextValue.sectionNo = ''
data?.forEach(v => {
@@ -115,8 +120,6 @@ function Index() {
setNoList(sectionNo)
}
- setNameList(routeName)
-
if (nextValue?.routeName) {
setRouteCodeDisabled(false)
} else {
@@ -181,16 +184,23 @@ function Index() {
*路线名称
- handleCheckChange(nameList[e.detail.value], 'routeName')}
- >
-
- {checked.routeName || '请选择'}
+
+
+ handleCheckChange(e.detail.value, 'routeName')}
+ />
+ handleCheckChange(nameList[e.detail.value], 'routeName')}
+ >
-
-
+
+
{
getDetail()
@@ -29,21 +31,17 @@ function Index() {
} else {
Taro.showToast({ title: '获取详情失败', icon: 'error' })
}
+ if (res.data?.length) {
+ setIsNoData(false)
+ } else {
+ setIsNoData(true)
+ }
})
}
}
- return (
- setKeyword(v)}
- onActionClick={getDetail}
- />
- 抽查日期:{moment(spotItem.date).format('YYYY-MM-DD')}
-
- {roadDetailList.length ? roadDetailList.map(item =>
+ const renderList = () => {
+ return roadDetailList.length ? roadDetailList.map(item =>
道路类型:{item.road?.level ? (item.road?.level + '道') : '--'}
路线名称:{item.road?.routeName || '--'}
@@ -70,7 +68,23 @@ function Index() {
>调整
- ) : }
+ ) :
+ }
+
+ const renderNoData = () => {
+ return
+ }
+
+ return (
+ setKeyword(v)}
+ onActionClick={getDetail}
+ />
+ 抽查日期:{moment(spotItem.date).format('YYYY-MM-DD')}
+ {isNoData ? renderNoData() : renderList()}
)
}
diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx
index 120343d1..7abd6448 100644
--- a/weapp/src/packages/patrol/index.jsx
+++ b/weapp/src/packages/patrol/index.jsx
@@ -206,6 +206,23 @@ const Index = () => {
const [appointUser, setAppointUser] = useState(null) // 责任人在userList的index
const [handleAdvice, setHandleAdvice] = useState('') // 处理意见
+ const [roadTypeList, setRoadTypeList] = useState([
+ {
+ value: '县',
+ text: '县道',
+ checked: true
+ },
+ {
+ value: '乡',
+ text: '乡道',
+ checked: false
+ },
+ {
+ value: '村',
+ text: '村道',
+ checked: false
+ },
+ ]);
const [routeNameList, setRouteNameList] = useState([]);
const [routeCodeList, setRouteCodeList] = useState([]);
const [sectionNoList, setSectionNoList] = useState([]);
@@ -328,7 +345,19 @@ const Index = () => {
setHandleCenter(data.handleContent)
}
setIsBeforeReport(dayjs(data.time).diff('2023-08-03 00:00:00', 'h') < 0)
-
+ // 设置道路类型
+ let items = roadTypeList
+ const head = data.codeRoad?.slice(0, 1)
+ const level = head
+ ? head === 'X'
+ ? '县' : head === 'Y'
+ ? '乡' : '村'
+ : ''
+ for (let i = 0, len = items.length; i < len; ++i) {
+ items[i].checked = items[i].value === (data.road_?.level || level)
+ }
+ setRoadTypeList(items)
+ // 设置道路路段
setRoadChecked({
routeName: data.road,
routeCode: data.codeRoad,
@@ -378,6 +407,7 @@ const Index = () => {
})
}
})
+ // 获取道路路段列表
request.get(getRoadSection()).then(res => {
Taro.hideLoading()
if (res.statusCode == 200 || res.statusCode == 204) {
@@ -390,12 +420,13 @@ const Index = () => {
let routeCode = []
let sectionNo = []
+ const selLevel = roadTypeList.find(item => item.checked).value
data.forEach(item => {
nextSourceRoadStartSel.push(item.startingPlaceName)
nextSourceRoadEndSel.push(item.stopPlaceName)
nextCodeRoadSel.push(item.routeCode)
- if (item.routeName && !routeName.includes(item.routeName)) {
+ if (item.routeName && !routeName.includes(item.routeName) && item.level === selLevel) {
routeName.push(item.routeName)
}
if (item.routeCode && !routeCode.includes(item.routeCode)) {
@@ -726,22 +757,28 @@ const Index = () => {
}
}
- const handleRoadCheckChange = (value, key) => {
+ const handleRoadCheckChange = (value, key, typeList = roadTypeList) => {
let nextValue = {
...roadChecked,
[key]: value
}
- let routeName = []
let routeCode = []
let sectionNo = []
- let data = [...roadList]
- data.forEach(v => {
- if (v.routeName && !routeName.includes(v.routeName)) {
- routeName.push(v.routeName)
- }
- });
+ let data = roadList.filter(r => r.level === typeList.find(t => t.checked).value)
if (key == 'routeName') {
+ // routeName关键字筛选
+ let routeName = []
+ data.forEach(item => {
+ if (item.routeName && !routeName.includes(item.routeName)) {
+ routeName.push(item.routeName)
+ }
+ })
+ if (value) {
+ routeName = routeName.filter(item => item.indexOf(value) > -1)
+ }
+ setRouteNameList(routeName)
+
nextValue.routeCode = ''
nextValue.sectionNo = ''
data?.forEach(v => {
@@ -768,8 +805,6 @@ const Index = () => {
setSectionNoList(sectionNo)
}
- setRouteNameList(routeName)
-
if (nextValue?.routeName) {
setRouteCodeDisabled(false)
} else {
@@ -1039,24 +1074,58 @@ const Index = () => {
}
})
}
+
+ function roadTypeChange(e) {
+ let items = roadTypeList
+ for (let i = 0, len = items.length; i < len; ++i) {
+ items[i].checked = items[i].value === e.detail.value
+ }
+ handleRoadCheckChange('', 'routeName', items)
+ setRoadTypeList(items)
+ }
+
return (
{
isPatrol || isAnomaly ? <>
+
+ * 道路类型:
+
+
+ {roadTypeList.map((item, i) => {
+ return {item.text}
+ })}
+
+
+
* 路线名称:
- handleRoadCheckChange(routeNameList[e.detail.value], 'routeName')}
- disabled={isView}
- >
-
- {roadChecked.routeName || '请选择路线名称'}
+
+ handleRoadCheckChange(e.detail.value, 'routeName')}
+ disabled={isView}
+ />
+ handleRoadCheckChange(routeNameList[e.detail.value], 'routeName')}
+ disabled={isView}
+ >
-
-
+
+
{!isView && {
/>}
-
- * 道路类型:
- { }}
- disabled={true}
- />
-
> : ''
}
diff --git a/weapp/src/pages/user/index.jsx b/weapp/src/pages/user/index.jsx
index a26a1acd..0c982254 100644
--- a/weapp/src/pages/user/index.jsx
+++ b/weapp/src/pages/user/index.jsx
@@ -11,8 +11,6 @@ import moreImg from '../../static/img/my/more.svg';
import pswdImg from '../../static/img/my/pswd.svg';
import reportImg from '../../static/img/my/report.svg';
-import Common from '../../components/echartForWx/common'; // 如果这行删掉微信小程序编译就一直死循环,待解决
-
const { webUrl } = cfg;
const Index = ({ ...props }) => {