From 6303ad5361fd8b0053d7aea5d301376e038ed411 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 15 Dec 2023 11:49:21 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=BC=95=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/app.config.js | 4 ++-- weapp/src/pages/user/index.jsx | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) 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/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 }) => { From 3202e9f79d091d125c6d2544e6b94c41a5bda0df Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 15 Dec 2023 13:58:29 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=8A=BD=E6=9F=A5=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=B8=B2=E6=9F=93=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/skeleton/index.jsx | 35 +++++++++++++++ .../components/skeleton/index.scss | 43 +++++++++++++++++++ .../spotCheckRoadDetail/index.jsx | 3 +- 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 weapp/src/packages/maintenanceSpotCheck/components/skeleton/index.jsx create mode 100644 weapp/src/packages/maintenanceSpotCheck/components/skeleton/index.scss 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/spotCheckRoadDetail/index.jsx b/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx index c3831876..fc52c940 100644 --- a/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx +++ b/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx @@ -3,6 +3,7 @@ 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' @@ -70,7 +71,7 @@ function Index() { >调整 - ) : } + ) : } ) } From fb6442b4d03c2351f56f98a8d2cb3737a6e70895 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 15 Dec 2023 14:42:01 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E9=81=93=E8=B7=AF=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E5=AD=97=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenanceSpotCheck/spotChange/index.jsx | 46 +++++++++++------- weapp/src/packages/patrol/index.jsx | 47 ++++++++++++------- 2 files changed, 57 insertions(+), 36 deletions(-) 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')} + > - - + + { ...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) - } - }); if (key == 'routeName') { + // routeName关键字筛选 + let routeName = [] + roadList.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 +774,6 @@ const Index = () => { setSectionNoList(sectionNo) } - setRouteNameList(routeName) - if (nextValue?.routeName) { setRouteCodeDisabled(false) } else { @@ -1046,17 +1050,24 @@ const Index = () => { 路线名称: - 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 && Date: Fri, 15 Dec 2023 15:32:56 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=8A=BD=E6=9F=A5=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../spotCheckRoadDetail/index.jsx | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx b/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx index fc52c940..0b39afad 100644 --- a/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx +++ b/weapp/src/packages/maintenanceSpotCheck/spotCheckRoadDetail/index.jsx @@ -15,6 +15,7 @@ function Index() { const [keyword, setKeyword] = useState('') const [roadDetailList, setRoadDetailList] = useState([]) + const [isNoData, setIsNoData] = useState(false) useDidShow(() => { getDetail() @@ -30,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 || '--'} @@ -71,7 +68,23 @@ function Index() { >调整 - ) : } + ) : + } + + const renderNoData = () => { + return + } + + return ( + setKeyword(v)} + onActionClick={getDetail} + /> + 抽查日期:{moment(spotItem.date).format('YYYY-MM-DD')} + {isNoData ? renderNoData() : renderList()} ) } From 0a5ca8d0e73f3f3f2bc3ce3c9f2d329f3c462d14 Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 15 Dec 2023 16:15:23 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E9=81=93=E8=B7=AF?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8E=BF=E4=B9=A1=E6=9D=91=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- weapp/src/packages/patrol/index.jsx | 80 +++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 17 deletions(-) diff --git a/weapp/src/packages/patrol/index.jsx b/weapp/src/packages/patrol/index.jsx index 879b725a..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,19 +757,19 @@ const Index = () => { } } - const handleRoadCheckChange = (value, key) => { + const handleRoadCheckChange = (value, key, typeList = roadTypeList) => { let nextValue = { ...roadChecked, [key]: value } let routeCode = [] let sectionNo = [] - let data = [...roadList] + let data = roadList.filter(r => r.level === typeList.find(t => t.checked).value) if (key == 'routeName') { // routeName关键字筛选 let routeName = [] - roadList.forEach(item => { + data.forEach(item => { if (item.routeName && !routeName.includes(item.routeName)) { routeName.push(item.routeName) } @@ -1043,15 +1074,42 @@ 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} + })} + + + 路线名称: { />} - - 道路类型: - { }} - disabled={true} - /> - : '' } From 5c49318d5bde4066eaabbae0e216a1df3f5594fe Mon Sep 17 00:00:00 2001 From: liujiangyong Date: Fri, 15 Dec 2023 16:58:24 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=B7=AF=E6=AE=B5api?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/data/road.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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;