diff --git a/packDetail/pages/analysis/index.vue b/packDetail/pages/analysis/index.vue index 6223317..41a9bb8 100644 --- a/packDetail/pages/analysis/index.vue +++ b/packDetail/pages/analysis/index.vue @@ -164,18 +164,10 @@ enableScroll: false, legend: {}, xAxis: { - // X全显示 - disabled: true, // 禁用默认X轴 - itemCount: 3, - // 可滚动 - // disableGrid: true, // 禁用网格线 - // type: 'grid', // 网格类型 - // gridType: 'dash', // 虚线样式 - // itemCount: 3, // 单屏显示数据数量 - // scrollShow: true, // 显示滚动条 - // scrollAlign: 'left', // 滚动条初始位置 - // scrollBackgroundColor: '#F7F7FF', // 滚动条背景色 - // scrollColor: '#DEE7F7' // 滚动条颜色 + disabled: false, // 启用X轴 + // 不设置itemCount,因为我们自定义显示的数据 + gridType: 'dash', // 网格类型 + dashLength: 2, }, yAxis: { gridType: "dash", @@ -403,7 +395,6 @@ // 选择年月日 radioChange(e){ this.riqinumber = e.detail.value - console.log("0000000000000",this.datetwo) this.bindDateqsChange(this.datetwo,'twotime') }, // 趋势时间 @@ -431,24 +422,38 @@ this.qushicov(); }, // 趋势接口 - // 在 qushicov 方法中修改 qushicov() { let data = { summrayMode: this.riqinumber, startTime: this.dateqs, } this.$http.post('/applet/survDeviceDeploy/waterIntegrateStatistic', data).then(iem => { - console.log("接口返回数据", iem) let lynum = iem.data.data setTimeout(() => { let categories = []; + let displayCategories = []; // 用于显示的X轴数据 let series = []; let allValues = []; // 收集所有数值 if (lynum.tableHead && lynum.tableHead.length > 0) { categories = lynum.tableIndex; + // 计算要显示的X轴数据:第一个、中间、最后一个 + if (categories.length > 0) { + const first = categories[0]; + const middle = categories[Math.floor(categories.length / 2)]; + const last = categories[categories.length - 3]; + + // 创建显示用的categories数组,只在这三个位置有值,其他为空字符串 + displayCategories = categories.map((item, index) => { + if (index === 0 || index === Math.floor(categories.length / 2) || index === categories.length - 2) { + return item; + } + return ''; + }); + } + lynum.tableHead.forEach((header, index) => { const seriesData = lynum.tableData2.map(row => { const value = row[index] === "0" ? 0 : parseFloat(row[index]) || 0; @@ -488,11 +493,9 @@ } let res = { - categories: categories, + categories: displayCategories, // 使用处理后的显示数据 series: series }; - - console.log("处理后的图表数据", res); this.chartData = JSON.parse(JSON.stringify(res)); }, 500); }) diff --git a/packDetail/pages/operations/detail.vue b/packDetail/pages/operations/detail.vue index 9c30a0f..904867d 100644 --- a/packDetail/pages/operations/detail.vue +++ b/packDetail/pages/operations/detail.vue @@ -2,17 +2,25 @@ - 选择站点: + 站点名称: {{details.stationName}} - - 维护内容: - {{details.omName}} + + 站点位置: + {{details.maintainData3}} + + + 检测情况: + {{details.maintainData1}} 负责人: {{details.maintainPerson}} + + 联系方式: + {{details.maintainData2}} + 维护时间: {{details.maintainTime}} @@ -43,6 +51,9 @@ maintainPerson:'', maintainTime:'', maintainNote:'', + maintainData1:'', + maintainData2:'', + maintainData3:'', omName:'' } } diff --git a/packDetail/pages/operations/edit.vue b/packDetail/pages/operations/edit.vue index d4e0260..eb26866 100644 --- a/packDetail/pages/operations/edit.vue +++ b/packDetail/pages/operations/edit.vue @@ -37,6 +37,19 @@ + + + 联系方式: + + + {{phoneError}} + 维护时间: @@ -100,11 +113,11 @@ tag:'', hobby: [], checkbox1: [], - reload:'true' + reload:'true', + phoneError: '', // 添加错误提示信息 } }, onLoad(options) { - console.log("00000000",JSON.parse(decodeURIComponent(options.item))) this.details = JSON.parse(decodeURIComponent(options.item)); }, onShow() { @@ -112,6 +125,25 @@ this.getazsurvMulchRecord1() }, methods:{ + // 联系方式格式校验 + validatePhone() { + const phone = this.details.maintainData2; + if (!phone) { + this.phoneError = ''; + return true; + } + + // 手机号正则表达式 + const phoneRegex = /^1[3-9]\d{9}$/; + + if (!phoneRegex.test(phone)) { + this.phoneError = '请输入正确的手机号码'; + return false; + } else { + this.phoneError = ''; + return true; + } + }, // 站点 getazsurvMulchRecord(){ this.array = [] @@ -184,6 +216,23 @@ }) return } + if(!this.details.maintainData2){ + uni.showToast({ + title: "请输入联系方式", + icon: 'none', + duration: 2000 + }) + return + } + // 添加联系方式格式校验 + if (!this.validatePhone()) { + uni.showToast({ + title: "请输入正确的手机号码", + icon: 'none', + duration: 2000 + }) + return; + } if(!this.details.maintainTime){ uni.showToast({ title: "请选择维护时间", @@ -316,4 +365,9 @@ text-align: center; color: #0472e3; } + .error-text { + color: #ff0000; + font-size: 24rpx; + margin-top: 10rpx; + } \ No newline at end of file