更新灌溉计划页面,添加项目选择器和总灌溉时间计算功能;优化界面样式,增加SVG图标;修复项目列表和轮灌组显示逻辑;调整配置文件,添加libVersion字段。
| | |
| | | |
| | | const PROJECT_URLS = { |
| | | JYG: 'https://irrigate.dayuyanjiuyuan.top/', // 嘉峪关项目 |
| | | // MQ: 'https://shifanqu1.dayuyanjiuyuan.top/' // 民勤项目 |
| | | MQ: 'https://no253541tf71.vicp.fun/' // 民勤项目 |
| | | MQ: 'https://shifanqu1.dayuyanjiuyuan.top/' , // 民勤项目 |
| | | TEST:'https://no253541tf71.vicp.fun/'// test项目 |
| | | // TEST:'http://192.168.40.182:8087/'// test项目 |
| | | // MQ: 'https://no253541tf71.vicp.fun/' // 民勤项目 |
| | | } |
| | | |
| | | // 尝试从本地存储获取已选择的项目 |
| | |
| | | isLoggedIn:false, |
| | | operator:"2025030416200600006", |
| | | clientId:"", |
| | | AppID:"wxbc2b6a00dd904ead" |
| | | AppID:"wxbc2b6a00dd904ead", |
| | | vcId:"" |
| | | } |
| | | }) |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.79889 24H41.7989" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M17.7988 36L5.79883 24L17.7988 12" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg> |
New file |
| | |
| | | <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#ffffff"><path d="M0 0h24v24H0z" fill="none"/><path d="M14.59 8L12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></svg> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="24" cy="24" r="20" fill="none" stroke="#1890FF" stroke-width="4"/><path d="M17 31L31 17" stroke="#1890FF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M19 19L17 17" stroke="#1890FF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M31 31L29 29" stroke="#1890FF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg> |
| | |
| | | var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = __MODS__[modId].m; m._exports = m._tempexports; var desp = Object.getOwnPropertyDescriptor(m, "exports"); if (desp && desp.configurable) Object.defineProperty(m, "exports", { set: function (val) { if(typeof val === "object" && val !== m._exports) { m._exports.__proto__ = val.__proto__; Object.keys(val).forEach(function (k) { m._exports[k] = val[k]; }); } m._tempexports = val }, get: function () { return m._tempexports; } }); __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); } return __MODS__[modId].m.exports; }; |
| | | var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } }; |
| | | var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; }; |
| | | __DEFINE__(1708314864293, function(require, module, exports) { |
| | | __DEFINE__(1742351136645, function(require, module, exports) { |
| | | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).dayjs=e()}(this,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return+(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else{var a=e.name;D[a]=e,i=a}return!r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return b},m.isValid=function(){return!(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O})); |
| | | }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); }) |
| | | return __REQUIRE__(1708314864293); |
| | | return __REQUIRE__(1742351136645); |
| | | })() |
| | | //miniprogram-npm-outsideDeps=[] |
| | | //# sourceMappingURL=index.js.map |
| | |
| | | startTime: '', // 灌溉开始时间 |
| | | pickerValue: '', // 时间选择器的值 |
| | | timePickerVisible: false, // 时间选择器是否可见 |
| | | |
| | | // 项目和轮灌组数据 |
| | | // 项目选择器相关 |
| | | projectPickerVisible: false, |
| | | projectPickerValue: [], |
| | | selectedProject: null, |
| | | projectOptions: [], |
| | | totalDuration: 0, // 添加总灌溉时间 |
| | | // 测试数据 |
| | | projectList: [ |
| | | { |
| | | id: '1', |
| | | name: '项目一', |
| | | expanded: false, // 是否展开 |
| | | totalDuration: 0, // 总时长 |
| | | id: 1, |
| | | name: '测试项目一', |
| | | groups: [ |
| | | { id: '1-1', name: '轮灌组1', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 } |
| | | { |
| | | id: 101, |
| | | name: '轮灌组A', |
| | | duration: 30, |
| | | selected: false |
| | | }, |
| | | { |
| | | id: 102, |
| | | name: '轮灌组B', |
| | | duration: 45, |
| | | selected: false |
| | | }, |
| | | { |
| | | id: 103, |
| | | name: '轮灌组C', |
| | | duration: 60, |
| | | selected: false |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | id: '2', |
| | | name: '项目二', |
| | | expanded: false, |
| | | totalDuration: 0, |
| | | id: 2, |
| | | name: '测试项目二', |
| | | groups: [ |
| | | { id: '2-1', name: '轮灌组A', selected: false, duration: 0 }, |
| | | { id: '2-2', name: '轮灌组B', selected: false, duration: 0 } |
| | | { |
| | | id: 201, |
| | | name: '轮灌组1', |
| | | duration: 40, |
| | | selected: false |
| | | }, |
| | | { |
| | | id: 202, |
| | | name: '轮灌组2', |
| | | duration: 50, |
| | | selected: false |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | id: '4', |
| | | name: '项目一', |
| | | expanded: false, // 是否展开 |
| | | totalDuration: 0, // 总时长 |
| | | id: 3, |
| | | name: '测试项目三', |
| | | groups: [ |
| | | { id: '1-1', name: '轮灌组1', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 } |
| | | ] |
| | | }, |
| | | { |
| | | id: '5', |
| | | name: '项目一', |
| | | expanded: false, // 是否展开 |
| | | totalDuration: 0, // 总时长 |
| | | groups: [ |
| | | { id: '1-1', name: '轮灌组1', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 } |
| | | ] |
| | | }, |
| | | { |
| | | id: '6', |
| | | name: '项目一', |
| | | expanded: false, // 是否展开 |
| | | totalDuration: 0, // 总时长 |
| | | groups: [ |
| | | { id: '1-1', name: '轮灌组1', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 } |
| | | ] |
| | | }, |
| | | { |
| | | id: '7', |
| | | name: '项目一', |
| | | expanded: false, // 是否展开 |
| | | totalDuration: 0, // 总时长 |
| | | groups: [ |
| | | { id: '1-1', name: '轮灌组1', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 } |
| | | ] |
| | | }, |
| | | { |
| | | id: '8', |
| | | name: '项目8', |
| | | expanded: false, // 是否展开 |
| | | totalDuration: 0, // 总时长 |
| | | groups: [ |
| | | { id: '1-1', name: '轮灌组1', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 }, |
| | | { id: '1-2', name: '轮灌组2', selected: false, duration: 0 }, |
| | | { id: '1-3', name: '轮灌组3', selected: false, duration: 0 } |
| | | ] |
| | | }, |
| | | { |
| | | id: '3', |
| | | name: '项目3', |
| | | expanded: false, |
| | | totalDuration: 0, |
| | | groups: [ |
| | | { id: '3-1', name: '轮灌组X', selected: false, duration: 0 }, |
| | | { id: '3-2', name: '轮灌组Y', selected: false, duration: 0 }, |
| | | { id: '3-3', name: '轮灌组Z', selected: false, duration: 0 } |
| | | ] |
| | | }, |
| | | { |
| | | id: '9', |
| | | name: '项目9', |
| | | expanded: false, |
| | | totalDuration: 0, |
| | | groups: [ |
| | | { id: '3-1', name: '轮灌组X', selected: false, duration: 0 }, |
| | | { id: '3-2', name: '轮灌组Y', selected: false, duration: 0 }, |
| | | { id: '3-3', name: '轮灌组Z', selected: false, duration: 0 } |
| | | ] |
| | | } |
| | | , |
| | | { |
| | | id: '10', |
| | | name: '项目10', |
| | | expanded: false, |
| | | totalDuration: 0, |
| | | groups: [ |
| | | { id: '3-1', name: '轮灌组X', selected: false, duration: 0 }, |
| | | { id: '3-2', name: '轮灌组Y', selected: false, duration: 0 }, |
| | | { id: '3-3', name: '轮灌组Z', selected: false, duration: 0 } |
| | | ] |
| | | } |
| | | , |
| | | { |
| | | id: '11', |
| | | name: '项目11', |
| | | expanded: false, |
| | | totalDuration: 0, |
| | | groups: [ |
| | | { id: '3-1', name: '轮灌组X', selected: false, duration: 0 }, |
| | | { id: '3-2', name: '轮灌组Y', selected: false, duration: 0 }, |
| | | { id: '3-3', name: '轮灌组Z', selected: false, duration: 0 } |
| | | { |
| | | id: 301, |
| | | name: '东区轮灌组', |
| | | duration: 35, |
| | | selected: false |
| | | }, |
| | | { |
| | | id: 302, |
| | | name: '西区轮灌组', |
| | | duration: 55, |
| | | selected: false |
| | | }, |
| | | { |
| | | id: 303, |
| | | name: '南区轮灌组', |
| | | duration: 25, |
| | | selected: false |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad: function (options) { |
| | | // 页面加载时可以从API获取项目和轮灌组数据 |
| | | // this.fetchProjectsAndGroups(); |
| | | // 初始化项目选择器选项 |
| | | const projectOptions = this.data.projectList.map(project => ({ |
| | | label: project.name, |
| | | value: project.id |
| | | })); |
| | | |
| | | this.setData({ |
| | | projectOptions: projectOptions // 直接使用一维数组,不需要包装成二维数组 |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | |
| | | * 时间选择器确认回调 |
| | | */ |
| | | onTimePickerConfirm: function (e) { |
| | | const { value } = e.detail; |
| | | this.setData({ |
| | | startTime: e.detail.formatValue, |
| | | pickerValue: e.detail.value, |
| | | timePickerVisible: false |
| | | timePickerVisible: false, |
| | | startTime: value |
| | | }); |
| | | }, |
| | | |
| | |
| | | * 处理时长输入 |
| | | */ |
| | | onDurationInput: function (e) { |
| | | const projectIndex = e.currentTarget.dataset.projectIndex; |
| | | const groupIndex = e.currentTarget.dataset.groupIndex; |
| | | const value = parseInt(e.detail.value) || 0; |
| | | const { groupIndex } = e.currentTarget.dataset; |
| | | const duration = parseInt(e.detail.value) || 0; |
| | | |
| | | // 更新轮灌组时长 |
| | | const durationKey = `projectList[${projectIndex}].groups[${groupIndex}].duration`; |
| | | const selectedProject = { ...this.data.selectedProject }; |
| | | selectedProject.groups[groupIndex].duration = duration; |
| | | |
| | | this.setData({ |
| | | [durationKey]: value |
| | | selectedProject |
| | | }, () => { |
| | | // 输入时长后重新计算总时间 |
| | | this.calculateTotalDuration(); |
| | | }); |
| | | |
| | | // 自动选中该轮灌组 |
| | | const selectedKey = `projectList[${projectIndex}].groups[${groupIndex}].selected`; |
| | | if (value > 0 && !this.data.projectList[projectIndex].groups[groupIndex].selected) { |
| | | this.setData({ |
| | | [selectedKey]: true |
| | | }); |
| | | } |
| | | |
| | | // 计算并更新项目总时长 |
| | | this.updateProjectTotalDuration(projectIndex); |
| | | }, |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 阻止事件冒泡 |
| | | */ |
| | | stopPropagation: function (e) { |
| | | stopPropagation: function () { |
| | | // 阻止事件冒泡,防止点击输入框时触发父元素的点击事件 |
| | | }, |
| | | |
| | |
| | | * 跳转到轮灌组详情页 |
| | | */ |
| | | navigateToGroupDetail: function (e) { |
| | | const projectIndex = e.currentTarget.dataset.projectIndex; |
| | | const groupIndex = e.currentTarget.dataset.groupIndex; |
| | | const project = this.data.projectList[projectIndex]; |
| | | const group = project.groups[groupIndex]; |
| | | |
| | | wx.navigateTo({ |
| | | url: `/pages/groupDetail/groupDetail?projectId=${project.id}&projectName=${project.name}&groupId=${group.id}&groupName=${group.name}` |
| | | }); |
| | | const { groupIndex } = e.currentTarget.dataset; |
| | | // TODO: 实现跳转逻辑 |
| | | }, |
| | | |
| | | /** |
| | | * 确认按钮点击事件 |
| | | */ |
| | | onConfirm: function () { |
| | | // 验证表单 |
| | | if (!this.validateForm()) { |
| | | return; |
| | | } |
| | | const { planCode, startTime, selectedProject } = this.data; |
| | | |
| | | // 收集选中的轮灌组 |
| | | const selectedGroups = this.getSelectedGroups(); |
| | | |
| | | // 构建提交数据 |
| | | const formData = { |
| | | planCode: this.data.planCode, |
| | | startTime: this.data.startTime, |
| | | groups: selectedGroups |
| | | }; |
| | | |
| | | // 提交数据 |
| | | this.submitForm(formData); |
| | | }, |
| | | |
| | | /** |
| | | * 验证表单 |
| | | */ |
| | | validateForm: function () { |
| | | if (!this.data.planCode) { |
| | | if (!planCode) { |
| | | wx.showToast({ |
| | | title: '请输入计划编号', |
| | | icon: 'none' |
| | | }); |
| | | return false; |
| | | return; |
| | | } |
| | | |
| | | if (!this.data.startTime) { |
| | | if (!startTime) { |
| | | wx.showToast({ |
| | | title: '请选择灌溉开始时间', |
| | | icon: 'none' |
| | | }); |
| | | return false; |
| | | return; |
| | | } |
| | | |
| | | const selectedGroups = this.getSelectedGroups(); |
| | | if (selectedGroups.length === 0) { |
| | | if (!selectedProject) { |
| | | wx.showToast({ |
| | | title: '请至少选择一个轮灌组', |
| | | title: '请选择项目', |
| | | icon: 'none' |
| | | }); |
| | | return false; |
| | | return; |
| | | } |
| | | |
| | | // 检查选中的轮灌组是否都设置了时长 |
| | | const invalidGroups = selectedGroups.filter(group => !group.duration); |
| | | if (invalidGroups.length > 0) { |
| | | wx.showToast({ |
| | | title: '请为所有选中的轮灌组设置时长', |
| | | icon: 'none' |
| | | }); |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | |
| | | // TODO: 实现确认逻辑 |
| | | console.log('提交数据:', { |
| | | planCode, |
| | | startTime, |
| | | project: selectedProject |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 获取选中的轮灌组 |
| | | */ |
| | | getSelectedGroups: function () { |
| | | const selectedGroups = []; |
| | | |
| | | this.data.projectList.forEach(project => { |
| | | project.groups.forEach(group => { |
| | | if (group.selected) { |
| | | selectedGroups.push({ |
| | | projectId: project.id, |
| | | projectName: project.name, |
| | | groupId: group.id, |
| | | groupName: group.name, |
| | | duration: group.duration |
| | | }); |
| | | } |
| | | }); |
| | | // 显示项目选择器 |
| | | showProjectPicker() { |
| | | this.setData({ |
| | | projectPickerVisible: true |
| | | }); |
| | | |
| | | return selectedGroups; |
| | | }, |
| | | |
| | | /** |
| | | * 提交表单数据 |
| | | */ |
| | | submitForm: function (formData) { |
| | | // 这里可以添加API请求逻辑,提交表单数据 |
| | | console.log('提交的表单数据:', formData); |
| | | // 项目选择器确认 |
| | | onProjectPickerConfirm(e) { |
| | | const { value } = e.detail; |
| | | const selectedProject = this.data.projectList.find(project => project.id === value[0]); |
| | | |
| | | // 模拟API请求 |
| | | wx.showLoading({ |
| | | title: '提交中...', |
| | | this.setData({ |
| | | projectPickerVisible: false, |
| | | selectedProject: selectedProject, |
| | | projectPickerValue: value |
| | | }, () => { |
| | | // 选择项目后计算总时间 |
| | | this.calculateTotalDuration(); |
| | | }); |
| | | }, |
| | | |
| | | // 项目选择器取消 |
| | | onProjectPickerCancel() { |
| | | this.setData({ |
| | | projectPickerVisible: false |
| | | }); |
| | | }, |
| | | |
| | | // 计算总灌溉时间 |
| | | calculateTotalDuration() { |
| | | if (!this.data.selectedProject) return; |
| | | |
| | | setTimeout(() => { |
| | | wx.hideLoading(); |
| | | |
| | | wx.showToast({ |
| | | title: '创建成功', |
| | | icon: 'success', |
| | | duration: 2000, |
| | | success: () => { |
| | | // 延迟返回上一页 |
| | | setTimeout(() => { |
| | | wx.navigateBack(); |
| | | }, 2000); |
| | | } |
| | | }); |
| | | }, 1500); |
| | | const totalDuration = this.data.selectedProject.groups.reduce((sum, group) => { |
| | | return sum + (parseInt(group.duration) || 0); |
| | | }, 0); |
| | | |
| | | // 实际API请求示例 |
| | | // wx.request({ |
| | | // url: 'your-api-url', |
| | | // method: 'POST', |
| | | // data: formData, |
| | | // success: (res) => { |
| | | // wx.showToast({ |
| | | // title: '创建成功', |
| | | // icon: 'success', |
| | | // duration: 2000, |
| | | // success: () => { |
| | | // setTimeout(() => { |
| | | // wx.navigateBack(); |
| | | // }, 2000); |
| | | // } |
| | | // }); |
| | | // }, |
| | | // fail: (err) => { |
| | | // wx.showToast({ |
| | | // title: '创建失败,请重试', |
| | | // icon: 'none' |
| | | // }); |
| | | // } |
| | | // }); |
| | | } |
| | | this.setData({ |
| | | totalDuration |
| | | }); |
| | | }, |
| | | }); |
| | |
| | | { |
| | | "navigationBarTitleText": "新建灌溉计划", |
| | | "usingComponents": { |
| | | "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker" |
| | | "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker", |
| | | "t-picker": "tdesign-miniprogram/picker/picker", |
| | | "t-picker-item": "tdesign-miniprogram/picker-item/picker-item" |
| | | } |
| | | } |
| | |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 项目和轮灌组嵌套列表 --> |
| | | <view class="list-container"> |
| | | <!-- 项目列表 --> |
| | | <scroll-view scroll-y="true" class="project-list"> |
| | | <block wx:for="{{projectList}}" wx:key="id"> |
| | | <view class="project-item"> |
| | | <!-- 项目名称 --> |
| | | <view class="project-header" bindtap="toggleProject" data-index="{{index}}"> |
| | | <view class="project-title"> |
| | | <image class="toggle-icon {{item.expanded ? 'expanded' : ''}}" src="/images/arrow-down.svg" mode="aspectFit"></image> |
| | | <view class="project-name">{{item.name}}</view> |
| | | </view> |
| | | <view class="project-duration">总时长: {{item.totalDuration || 0}}分钟</view> |
| | | <!-- 选择项目 --> |
| | | <view class="form-item" bindtap="showProjectPicker"> |
| | | <view class="form-label">选择项目</view> |
| | | <view class="form-input"> |
| | | <view class="picker-text {{selectedProject ? '' : 'placeholder'}}">{{selectedProject ? selectedProject.name : '请选择项目'}}</view> |
| | | <image class="arrow-icon" src="/images/arrow-right.svg" mode="aspectFit"></image> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 轮灌组列表 --> |
| | | <view class="list-container" wx:if="{{selectedProject}}"> |
| | | <view class="list-header"> |
| | | <view class="list-title-container"> |
| | | <view class="list-title">轮灌组列表</view> |
| | | <view class="total-duration"> |
| | | <text class="total-duration-label">总灌溉时间:</text> |
| | | <text class="total-duration-value">{{totalDuration}}分钟</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <scroll-view scroll-y="true" class="group-list"> |
| | | <block wx:for="{{selectedProject.groups}}" wx:key="id" wx:for-item="group" wx:for-index="groupIndex"> |
| | | <view class="group-item {{group.selected ? 'selected' : ''}}" bindtap="navigateToGroupDetail" data-group-index="{{groupIndex}}"> |
| | | <view class="group-info"> |
| | | <view class="group-name">{{group.name}}</view> |
| | | </view> |
| | | |
| | | <!-- 轮灌组列表 --> |
| | | <view class="group-list {{item.expanded ? 'expanded' : ''}}"> |
| | | <block wx:for="{{item.groups}}" wx:for-item="group" wx:for-index="groupIndex" wx:key="id"> |
| | | <view class="group-item {{group.selected ? 'selected' : ''}}" bindtap="navigateToGroupDetail" data-project-index="{{index}}" data-group-index="{{groupIndex}}"> |
| | | <view class="group-info" > |
| | | <view class="group-name">{{group.name}}</view> |
| | | </view> |
| | | <view class="group-duration"> |
| | | <input |
| | | class="duration-input" |
| | | type="number" |
| | | value="{{group.duration}}" |
| | | bindinput="onDurationInput" |
| | | data-project-index="{{index}}" |
| | | data-group-index="{{groupIndex}}" |
| | | placeholder="0" |
| | | catchtap="stopPropagation" |
| | | /> |
| | | <text class="duration-unit">分钟</text> |
| | | </view> |
| | | </view> |
| | | </block> |
| | | <view class="group-duration"> |
| | | <input |
| | | class="duration-input" |
| | | type="number" |
| | | value="{{group.duration}}" |
| | | bindinput="onDurationInput" |
| | | data-group-index="{{groupIndex}}" |
| | | placeholder="0" |
| | | catchtap="stopPropagation" |
| | | /> |
| | | <text class="duration-unit">分钟</text> |
| | | </view> |
| | | </view> |
| | | </block> |
| | |
| | | bindconfirm="onTimePickerConfirm" |
| | | bindcancel="onTimePickerCancel" |
| | | /> |
| | | |
| | | <!-- 项目选择器弹窗 --> |
| | | <t-picker |
| | | title="选择项目" |
| | | visible="{{projectPickerVisible}}" |
| | | value="{{projectPickerValue}}" |
| | | cancelBtn="取消" |
| | | confirmBtn="确认" |
| | | bindconfirm="onProjectPickerConfirm" |
| | | bindcancel="onProjectPickerCancel" |
| | | > |
| | | <t-picker-item options="{{projectOptions}}" /> |
| | | </t-picker> |
| | | </view> |
| | |
| | | flex-direction: row; |
| | | align-items: center; |
| | | background-color: #fff; |
| | | padding: 30rpx; |
| | | padding: 15rpx 30rpx; |
| | | margin-bottom: 2rpx; |
| | | width: 100%; |
| | | box-sizing: border-box; |
| | |
| | | padding-right: 20rpx; |
| | | } |
| | | |
| | | .picker-text { |
| | | flex: 1; |
| | | text-align: right; |
| | | padding-right: 20rpx; |
| | | } |
| | | |
| | | .placeholder { |
| | | color: #999; |
| | | } |
| | |
| | | height: calc(100vh - 300rpx); /* 设置固定高度,减去顶部表单和底部按钮的高度 */ |
| | | } |
| | | |
| | | /* 列表头部样式 */ |
| | | .list-header { |
| | | padding: 30rpx; |
| | | border-bottom: 1rpx solid #eee; |
| | | background-color: #fff; |
| | | } |
| | | |
| | | .list-title-container { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | } |
| | | |
| | | .list-title { |
| | | font-size: 28rpx; |
| | | font-size: 32rpx; |
| | | color: #333; |
| | | margin-bottom: 30rpx; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .list-subtitle { |
| | | font-size: 24rpx; |
| | | color: #999; |
| | | } |
| | | |
| | | /* 项目列表样式 */ |
| | |
| | | |
| | | /* 轮灌组列表样式 */ |
| | | .group-list { |
| | | display: none; |
| | | display: flex; |
| | | flex-direction: column; |
| | | background-color: #fff; |
| | | max-height: none; /* 移除最大高度限制 */ |
| | | height: auto; /* 自适应高度 */ |
| | | } |
| | | |
| | | .group-list.expanded { |
| | | display: flex; |
| | | height: 100%; /* 恢复为100%高度,因为不再需要为底部统计留空间 */ |
| | | overflow-y: auto; |
| | | } |
| | | |
| | | .group-item { |
| | |
| | | .group-item::after { |
| | | content: ''; |
| | | position: absolute; |
| | | right: 15rpx; |
| | | right: 30rpx; /* 修改为与左侧padding一致 */ |
| | | top: 50%; |
| | | transform: translateY(-50%); |
| | | width: 16rpx; |
| | |
| | | .group-duration { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-right: 20rpx; /* 为右侧箭头留出空间 */ |
| | | margin-right: 40rpx; /* 增加右边距,为箭头留出空间 */ |
| | | } |
| | | |
| | | .duration-input { |
| | |
| | | padding: 20rpx 30rpx; |
| | | background-color: #fff; |
| | | box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05); |
| | | z-index: 100; /* 提高z-index确保按钮在最上层 */ |
| | | z-index: 100; |
| | | } |
| | | |
| | | .confirm-button { |
| | | width: 100%; |
| | | height: 88rpx; |
| | | line-height: 88rpx; |
| | | height: 80rpx; |
| | | line-height: 80rpx; |
| | | text-align: center; |
| | | background-color: #1890FF; |
| | | color: #fff; |
| | | font-size: 30rpx; |
| | | border-radius: 44rpx; |
| | | font-size: 28rpx; |
| | | border-radius: 8rpx; |
| | | } |
| | | |
| | | .confirm-button-hover { |
| | | opacity: 0.8; |
| | | } |
| | | |
| | | /* TDesign Picker 样式覆盖 */ |
| | | .t-picker { |
| | | z-index: 1000; |
| | | } |
| | | |
| | | .t-picker__header { |
| | | background-color: #fff; |
| | | border-bottom: 1rpx solid #eee; |
| | | } |
| | | |
| | | .t-picker__title { |
| | | font-size: 32rpx; |
| | | color: #333; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .t-picker__cancel, |
| | | .t-picker__confirm { |
| | | font-size: 28rpx; |
| | | padding: 20rpx 30rpx; |
| | | } |
| | | |
| | | .t-picker__cancel { |
| | | color: #999; |
| | | } |
| | | |
| | | .t-picker__confirm { |
| | | color: #1890FF; |
| | | } |
| | | |
| | | .t-picker__content { |
| | | background-color: #fff; |
| | | } |
| | | |
| | | .t-picker__item { |
| | | font-size: 32rpx; |
| | | color: #333; |
| | | } |
| | | |
| | | .t-picker__item--active { |
| | | color: #1890FF; |
| | | } |
| | | |
| | | /* 总灌溉时间统计样式 */ |
| | | .total-duration { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .total-duration-label { |
| | | font-size: 28rpx; |
| | | color: #666; |
| | | margin-right: 10rpx; |
| | | } |
| | | |
| | | .total-duration-value { |
| | | font-size: 32rpx; |
| | | color: #1890FF; |
| | | font-weight: 500; |
| | | } |
| | |
| | | showProjectDialog: false, |
| | | selectedProject: '', |
| | | avatarTapCount: 0, |
| | | isFromLogin: false |
| | | isFromLogin: false, |
| | | showTipDialog:'' |
| | | }, |
| | | |
| | | openValve: function (e) { |
| | |
| | | */ |
| | | onLoad(options) { |
| | | console.log('home页面onLoad开始,参数:', options); |
| | | |
| | | //当开阀成功后调用刷新 |
| | | if (options.param === "1" || options.param === "2") { |
| | | this.setData({ |
| | | options: options |
| | | }) |
| | | } |
| | | // 检查是否从登录页面返回 |
| | | let fromLogin = false; |
| | | |
| | |
| | | // 根据项目设置对应的tag |
| | | if (project === 'JYG') { |
| | | getApp().globalData.tag = 'ym'; // 嘉峪关项目对应tag为ym |
| | | this.setData({ |
| | | userName: "嘉峪关项目" |
| | | }); |
| | | } else if (project === 'MQ') { |
| | | getApp().globalData.tag = 'mq'; // 民勤项目对应tag为mq |
| | | this.setData({ |
| | | userName: "民勤项目" |
| | | }); |
| | | // 加载民勤项目持久化参数 |
| | | return storage.getItemSafe('MQ_params') |
| | | .then(params => { |
| | | if (params) { |
| | | getApp().globalData.operator = params.operator; |
| | | getApp().globalData.clientId = params.clientId; |
| | | getApp().globalData.isLoggedIn = params.isLoggedIn; |
| | | getApp().globalData.sessionId = params.sessionId; |
| | | } |
| | | return Promise.resolve(); |
| | | }); |
| | | } else if (project === 'TEST') { |
| | | getApp().globalData.tag = 'ym'; // 测试项目对应tag为test |
| | | this.setData({ |
| | | userName: "测试项目" |
| | | }); |
| | | // 加载测试项目持久化参数 |
| | | return storage.getItemSafe('TEST_params') |
| | | .then(params => { |
| | | if (params) { |
| | | getApp().globalData.operator = params.operator; |
| | | getApp().globalData.clientId = params.clientId; |
| | | getApp().globalData.isLoggedIn = params.isLoggedIn; |
| | | getApp().globalData.sessionId = params.sessionId; |
| | | getApp().globalData.vcId = params.vcId; |
| | | } |
| | | return Promise.resolve(); |
| | | }); |
| | | } |
| | | |
| | | console.log('加载已保存的项目:', project, '域名:', baseUrl, 'tag:', getApp().globalData.tag); |
| | | |
| | | // 检查sessionId是否存在 |
| | | return storage.getItemSafe('sessionId'); |
| | | // 继续初始化页面 |
| | | this.continueInitPage(options); |
| | | } else { |
| | | // 首次进入,显示项目选择弹窗 |
| | | this.setData({ |
| | |
| | | }); // 终止后续处理 |
| | | } |
| | | }) |
| | | .then(sessionId => { |
| | | if (sessionId) { |
| | | // 如果sessionId存在,设置全局登录状态 |
| | | getApp().globalData.sessionId = sessionId; |
| | | getApp().globalData.isLoggedIn = true; |
| | | |
| | | // 尝试获取clientId |
| | | return storage.getItemSafe('clientId'); |
| | | } else { |
| | | return Promise.reject({ |
| | | type: 'session_not_found', |
| | | message: '未找到sessionId' |
| | | }); |
| | | } |
| | | }) |
| | | .then(clientId => { |
| | | if (clientId) { |
| | | getApp().globalData.clientId = clientId; |
| | | } |
| | | |
| | | .then(() => { |
| | | // 继续初始化页面 |
| | | this.continueInitPage(options); |
| | | }) |
| | |
| | | return; |
| | | } |
| | | |
| | | // 处理未找到sessionId的情况 |
| | | if (error.type === 'session_not_found' && this.data.selectedProject) { |
| | | // 检查是否已从登录页返回 |
| | | const isReturning = this.getFromLogin(); |
| | | console.log('未找到sessionId,是否从登录页返回:', isReturning); |
| | | |
| | | // 如果已经是从登录页返回的,不要再跳回去 |
| | | if (isReturning) { |
| | | console.log('已经从登录页返回,不再跳转回去'); |
| | | this.continueInitPage(options); |
| | | return; |
| | | } |
| | | |
| | | console.log('未找到sessionId,跳转到登录页'); |
| | | wx.redirectTo({ |
| | | url: `/pages/login/login?project=${this.data.selectedProject}` |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 其他未知错误,尝试继续初始化页面 |
| | | console.warn('未知错误,尝试继续初始化页面:', error); |
| | | this.continueInitPage(options); |
| | |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | |
| | | if (this.data.options.param === "1") { |
| | | this.setData({ |
| | | showTipDialog: true, |
| | | tipData: "开阀命令下发成功,因开阀需要时间,约20-60秒后可刷新快速关阀列表查看执行结果。" |
| | | }) |
| | | setTimeout(() => { |
| | | this.getOpenList(); |
| | | }, 20000) |
| | | |
| | | } else if (this.data.options.param === "2") { |
| | | this.setData({ |
| | | showTipDialog: true, |
| | | tipData: "预约开阀命令下发成功,当到达预约时间并且成功开阀后快速关阀列表会显示未关阀记录" |
| | | }) |
| | | this.getOpenList(); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | |
| | | // 获取当前已选项目和新选择的项目 |
| | | const currentProject = getApp().globalData.selectedProject; |
| | | const newProject = this.data.selectedProject; |
| | | const projectName = newProject === 'JYG' ? '嘉峪关项目' : '民勤项目'; |
| | | const projectName = newProject === 'JYG' ? '嘉峪关项目' : |
| | | newProject === 'MQ' ? '民勤项目' : |
| | | newProject === 'TEST' ? '测试项目' : '未知项目'; |
| | | |
| | | // 检查是否切换了项目(如果当前项目不同于新选择的项目) |
| | | const isProjectChanged = currentProject && currentProject !== newProject; |
| | |
| | | getApp().globalData.baseUrl = baseUrl; |
| | | getApp().globalData.selectedProject = newProject; |
| | | |
| | | // 根据项目设置对应的tag |
| | | // 根据项目设置对应的tag和clientId |
| | | if (newProject === 'JYG') { |
| | | getApp().globalData.tag = 'ym'; // 嘉峪关项目对应tag为ym |
| | | this.setData({ |
| | | userName: "嘉峪关项目" |
| | | }); |
| | | } else if (newProject === 'MQ') { |
| | | getApp().globalData.tag = 'mq'; // 民勤项目对应tag为mq |
| | | getApp().globalData.operator = '2025030517095000006'; |
| | | getApp().globalData.clientId = '2025030517095000006'; |
| | | getApp().globalData.isLoggedIn = true; |
| | | getApp().globalData.sessionId = '2025030517095000006'; |
| | | this.setData({ |
| | | userName: "民勤项目" |
| | | }); |
| | | // 持久化存储民勤项目参数 |
| | | storage.setItem('MQ_params', { |
| | | operator: '2025030517095000006', |
| | | clientId: '2025030517095000006', |
| | | isLoggedIn: true, |
| | | sessionId: '2025030517095000006' |
| | | }); |
| | | } else if (newProject === 'TEST') { |
| | | getApp().globalData.tag = 'ym'; // 测试项目对应tag为test |
| | | getApp().globalData.operator = '2025032411245000006'; |
| | | getApp().globalData.clientId = '2025032411245000006'; |
| | | getApp().globalData.isLoggedIn = true; |
| | | getApp().globalData.sessionId = '2025032411245000006'; |
| | | getApp().globalData.vcId = '2024122617295800009'; |
| | | this.setData({ |
| | | userName: "测试项目" |
| | | }); |
| | | // 持久化存储测试项目参数 |
| | | storage.setItem('TEST_params', { |
| | | operator: '2025032411245000006', |
| | | clientId: '2025032411245000006', |
| | | isLoggedIn: true, |
| | | sessionId: '2025032411245000006', |
| | | vcId: '2024122617295800009' |
| | | }); |
| | | } |
| | | |
| | | console.log('已切换到项目:', projectName, '域名:', baseUrl, 'tag:', getApp().globalData.tag); |
| | |
| | | |
| | | // 显示切换成功提示 |
| | | wx.showToast({ |
| | | title: isProjectChanged ? `已切换至${projectName},请重新登录` : `已选择${projectName}`, |
| | | title: `已选择${projectName}`, |
| | | icon: 'success', |
| | | duration: 2000 |
| | | }); |
| | | |
| | | // 如果切换了项目,延迟跳转到登录页面 |
| | | if (isProjectChanged) { |
| | | setTimeout(() => { |
| | | console.log('项目已切换,正在跳转到登录页面'); |
| | | wx.redirectTo({ |
| | | url: `/pages/login/login?project=${newProject}`, |
| | | success: () => console.log('成功跳转到登录页'), |
| | | fail: (err) => console.error('跳转到登录页失败:', err) |
| | | }); |
| | | }, 2000); |
| | | } |
| | | // 直接初始化数据 |
| | | setTimeout(() => { |
| | | console.log('项目已切换,正在初始化数据'); |
| | | this.initData(); |
| | | }, 1000); |
| | | }).catch(err => { |
| | | console.error('保存项目选择失败:', err); |
| | | wx.showToast({ |
| | |
| | | <radio value="MQ" checked="{{selectedProject === 'MQ'}}" color="#1890FF" /> |
| | | <text>民勤项目</text> |
| | | </label> |
| | | <label class="project-radio {{selectedProject === 'TEST' ? 'project-radio-selected' : ''}}"> |
| | | <radio value="TEST" checked="{{selectedProject === 'TEST'}}" color="#1890FF" /> |
| | | <text>测试项目</text> |
| | | </label> |
| | | </radio-group> |
| | | </view> |
| | | <view class="project-modal-footer"> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <t-dialog class="dialog" title="通知结果" visible="{{showTipDialog}}" content="{{tipData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="cancelDialog" /> |
| | | </view> |
| | |
| | | data: { |
| | | planCode: '', |
| | | startTime: '', |
| | | projects: [], |
| | | isRefreshing: false, // 下拉刷新状态 |
| | | planId: '' // 保存计划ID |
| | | isRefreshing: false, |
| | | projects: [] |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad: function (options) { |
| | | if (options.id) { |
| | | this.setData({ |
| | | planId: options.id |
| | | }); |
| | | // 从列表页面进入时,所有项目默认收起 |
| | | const fromListPage = options.fromList === 'true'; |
| | | this.loadIrrigationDetail(options.id, !fromListPage); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 加载灌溉计划详情 |
| | | * @param {string} id 灌溉计划ID |
| | | * @param {boolean} isFirstLoad 是否首次加载 |
| | | */ |
| | | loadIrrigationDetail: function (id, isFirstLoad = false) { |
| | | // 开始加载,设置刷新状态 |
| | | // 模拟数据 |
| | | this.setData({ |
| | | isRefreshing: true |
| | | }); |
| | | |
| | | // 保存当前项目的展开状态 |
| | | const currentExpandStates = {}; |
| | | if (!isFirstLoad && this.data.projects.length > 0) { |
| | | this.data.projects.forEach((project, index) => { |
| | | currentExpandStates[project.id] = project.expanded; |
| | | }); |
| | | } |
| | | |
| | | // 这里应该是从API获取数据 |
| | | // 以下是模拟数据 |
| | | const mockData = { |
| | | planCode: 'IRG20240317001', |
| | | startTime: '2024-03-17 08:00', |
| | | projects: [ |
| | | { |
| | | id: 1, |
| | | name: '项目A', |
| | | expanded: isFirstLoad ? true : false, // 仅在非列表页进入且首次加载时展开第一个项目 |
| | | groups: [ |
| | | { |
| | | id: 1, |
| | | name: '轮灌组A-1', |
| | | status: 'irrigated', // 已灌溉 |
| | | statusText: '已灌溉', |
| | | startTime: '2024-03-17 08:00', |
| | | endTime: '2024-03-17 09:30', |
| | | duration: 90 |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '轮灌组A-2', |
| | | status: 'irrigating', // 正在灌溉 |
| | | statusText: '正在灌溉', |
| | | startTime: '2024-03-17 09:30', |
| | | endTime: '2024-03-17 11:00', |
| | | duration: 90 |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '项目B', |
| | | expanded: false, |
| | | groups: [ |
| | | { |
| | | id: 3, |
| | | name: '轮灌组B-1', |
| | | status: 'waiting', // 未灌溉 |
| | | statusText: '未灌溉', |
| | | startTime: '2024-03-17 11:00', |
| | | endTime: '2024-03-17 12:30', |
| | | duration: 90 |
| | | }, |
| | | { |
| | | id: 4, |
| | | name: '轮灌组B-2', |
| | | status: 'waiting', // 未灌溉 |
| | | statusText: '未灌溉', |
| | | startTime: '2024-03-17 12:30', |
| | | endTime: '2024-03-17 14:00', |
| | | duration: 90 |
| | | } |
| | | ] |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: '项目C', |
| | | expanded: false, |
| | | groups: [ |
| | | { |
| | | id: 5, |
| | | name: '轮灌组C-1', |
| | | status: 'waiting', // 未灌溉 |
| | | statusText: '未灌溉', |
| | | startTime: '2024-03-17 14:00', |
| | | endTime: '2024-03-17 15:30', |
| | | duration: 90 |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | }; |
| | | |
| | | // 计算每个项目的总灌溉时长 |
| | | mockData.projects = this.calculateProjectTotalDuration(mockData.projects); |
| | | |
| | | // 如果不是首次加载,恢复项目的展开状态 |
| | | if (!isFirstLoad) { |
| | | mockData.projects.forEach(project => { |
| | | if (currentExpandStates[project.id] !== undefined) { |
| | | project.expanded = currentExpandStates[project.id]; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 模拟网络请求延迟 |
| | | setTimeout(() => { |
| | | // 设置页面数据 |
| | | this.setData({ |
| | | planCode: mockData.planCode, |
| | | startTime: mockData.startTime, |
| | | projects: mockData.projects, |
| | | isRefreshing: false // 结束刷新状态 |
| | | }); |
| | | }, 1000); |
| | | |
| | | // 实际项目中应该使用wx.request获取数据 |
| | | // wx.request({ |
| | | // url: 'https://your-api-url/irrigation/' + id, |
| | | // method: 'GET', |
| | | // success: (res) => { |
| | | // if (res.data && res.data.code === 0) { |
| | | // // 获取新数据 |
| | | // let projects = res.data.data.projects; |
| | | // |
| | | // // 如果是首次加载,设置默认展开状态 |
| | | // if (isFirstLoad) { |
| | | // projects = projects.map((project, index) => { |
| | | // return { |
| | | // ...project, |
| | | // expanded: index === 0 // 默认只展开第一个项目 |
| | | // }; |
| | | // }); |
| | | // } else { |
| | | // // 如果不是首次加载,恢复项目的展开状态 |
| | | // projects = projects.map(project => { |
| | | // return { |
| | | // ...project, |
| | | // expanded: currentExpandStates[project.id] !== undefined |
| | | // ? currentExpandStates[project.id] |
| | | // : false |
| | | // }; |
| | | // }); |
| | | // } |
| | | // |
| | | // // 计算每个项目的总灌溉时长 |
| | | // projects = this.calculateProjectTotalDuration(projects); |
| | | // |
| | | // this.setData({ |
| | | // planCode: res.data.data.planCode, |
| | | // startTime: res.data.data.startTime, |
| | | // projects: projects, |
| | | // isRefreshing: false // 结束刷新状态 |
| | | // }); |
| | | // } else { |
| | | // wx.showToast({ |
| | | // title: '获取数据失败', |
| | | // icon: 'none' |
| | | // }); |
| | | // this.setData({ |
| | | // isRefreshing: false // 结束刷新状态 |
| | | // }); |
| | | // } |
| | | // }, |
| | | // fail: () => { |
| | | // wx.showToast({ |
| | | // title: '网络错误', |
| | | // icon: 'none' |
| | | // }); |
| | | // this.setData({ |
| | | // isRefreshing: false // 结束刷新状态 |
| | | // }); |
| | | // } |
| | | // }); |
| | | }, |
| | | |
| | | /** |
| | | * 计算每个项目的总灌溉时长 |
| | | */ |
| | | calculateProjectTotalDuration: function(projects) { |
| | | return projects.map(project => { |
| | | // 计算项目下所有轮灌组的总时长 |
| | | const totalDuration = project.groups.reduce((total, group) => { |
| | | return total + (group.duration || 0); |
| | | }, 0); |
| | | |
| | | return { |
| | | ...project, |
| | | totalDuration: totalDuration |
| | | }; |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 切换项目展开/收起状态 |
| | | */ |
| | | toggleProject: function (e) { |
| | | const index = e.currentTarget.dataset.index; |
| | | const expanded = this.data.projects[index].expanded; |
| | | |
| | | // 更新项目的展开状态 |
| | | const key = `projects[${index}].expanded`; |
| | | this.setData({ |
| | | [key]: !expanded |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 导航到轮灌组详情页面 |
| | | */ |
| | | navigateToGroupDetail: function (e) { |
| | | const projectName = e.currentTarget.dataset.projectName; |
| | | const groupName = e.currentTarget.dataset.groupName; |
| | | const groupId = e.currentTarget.dataset.groupId; |
| | | const status = e.currentTarget.dataset.status; |
| | | |
| | | console.log('跳转到组详情页面,原始状态:', status); |
| | | |
| | | // 导航到组详情页面,并传递参数 |
| | | // 注意:需要将status转换为isIrrigating参数,以便在组详情页面正确显示命令状态 |
| | | wx.navigateTo({ |
| | | url: `/pages/groupDetail/groupDetail?projectName=${projectName}&groupName=${groupName}&groupId=${groupId}&status=${status}&isIrrigating=${status === 'irrigating' ? 'true' : 'false'}` |
| | | planCode: 'IRR-2024-001', |
| | | startTime: '2024-03-20 08:00', |
| | | projects: [{ |
| | | id: 1, |
| | | name: '示例项目', |
| | | groups: [ |
| | | { |
| | | id: 1, |
| | | name: '轮灌组1', |
| | | status: 'pending', |
| | | statusText: '待灌溉', |
| | | startTime: '08:00', |
| | | endTime: '09:00', |
| | | duration: 60 |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '轮灌组2', |
| | | status: 'in_progress', |
| | | statusText: '灌溉中', |
| | | startTime: '09:00', |
| | | endTime: '10:00', |
| | | duration: 60 |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: '轮灌组3', |
| | | status: 'completed', |
| | | statusText: '已完成', |
| | | startTime: '10:00', |
| | | endTime: '11:00', |
| | | duration: 60 |
| | | } |
| | | ] |
| | | }] |
| | | }); |
| | | }, |
| | | |
| | |
| | | * 下拉刷新处理函数 |
| | | */ |
| | | onPullDownRefresh: function () { |
| | | // 重新加载数据,但保持展开状态 |
| | | if (this.data.planId) { |
| | | this.loadIrrigationDetail(this.data.planId, false); |
| | | } else { |
| | | this.setData({ |
| | | isRefreshing: true |
| | | }); |
| | | |
| | | // 模拟刷新数据 |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | isRefreshing: false |
| | | }); |
| | | } |
| | | }, 1000); |
| | | }, |
| | | |
| | | /** |
| | |
| | | */ |
| | | onShareAppMessage: function () { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 导航到轮灌组详情页面 |
| | | */ |
| | | navigateToGroupDetail: function (e) { |
| | | const { projectName, groupName, groupId, status } = e.currentTarget.dataset; |
| | | wx.navigateTo({ |
| | | url: `/pages/groupDetail/groupDetail?projectName=${projectName}&groupName=${groupName}&groupId=${groupId}&status=${status}` |
| | | }); |
| | | } |
| | | }) |
| | |
| | | </view> |
| | | <image class="status-icon" src="/images/progress.svg" mode="aspectFit"></image> |
| | | </view> |
| | | |
| | | <!-- 项目信息 --> |
| | | <view class="project-info"> |
| | | <text class="label">项目名称:</text> |
| | | <text class="value">{{projects[0].name}}</text> |
| | | </view> |
| | | <!-- 灌溉时间信息 --> |
| | | <view class="time-info"> |
| | | <text class="label">灌溉开始时间:</text> |
| | | <text class="value">{{startTime}}</text> |
| | | </view> |
| | | |
| | | |
| | | </view> |
| | | |
| | | <!-- 项目和轮灌组列表 --> |
| | | <!-- 轮灌组列表 --> |
| | | <scroll-view |
| | | scroll-y="true" |
| | | class="project-list" |
| | | class="group-list" |
| | | refresher-enabled="{{true}}" |
| | | refresher-threshold="50" |
| | | refresher-triggered="{{isRefreshing}}" |
| | | bindrefresherrefresh="onPullDownRefresh"> |
| | | <view class="scroll-content"> |
| | | <block wx:for="{{projects}}" wx:key="id" wx:for-item="project" wx:for-index="projectIndex"> |
| | | <!-- 项目信息 --> |
| | | <view class="project-item {{project.expanded ? 'expanded' : 'collapsed'}}"> |
| | | <view class="project-header" bindtap="toggleProject" data-index="{{projectIndex}}"> |
| | | <image class="toggle-icon {{project.expanded ? 'expanded' : ''}}" src="/images/arrow-down.svg" mode="aspectFit"></image> |
| | | <view class="project-info"> |
| | | <view class="project-name">{{project.name}}</view> |
| | | <view class="project-duration">总灌溉时长: {{project.totalDuration || 0}}分钟</view> |
| | | </view> |
| | | <block wx:for="{{projects[0].groups}}" wx:key="id" wx:for-item="group"> |
| | | <view class="group-item {{group.status}}" bindtap="navigateToGroupDetail" data-project-name="{{projects[0].name}}" data-group-name="{{group.name}}" data-group-id="{{group.id}}" data-status="{{group.status}}"> |
| | | <!-- 轮灌组状态标识 --> |
| | | <view class="group-status-indicator"> |
| | | <view class="status-dot"></view> |
| | | <text class="status-text">{{group.statusText}}</text> |
| | | </view> |
| | | |
| | | <!-- 轮灌组列表 --> |
| | | <view class="group-list {{project.expanded ? 'expanded' : 'collapsed'}}"> |
| | | <block wx:for="{{project.groups}}" wx:key="id" wx:for-item="group"> |
| | | <view class="group-item {{group.status}}" bindtap="navigateToGroupDetail" data-project-name="{{project.name}}" data-group-name="{{group.name}}" data-group-id="{{group.id}}" data-status="{{group.status}}"> |
| | | <!-- 轮灌组状态标识 --> |
| | | <view class="group-status-indicator"> |
| | | <view class="status-dot"></view> |
| | | <text class="status-text">{{group.statusText}}</text> |
| | | </view> |
| | | |
| | | <!-- 轮灌组信息 --> |
| | | <view class="group-info"> |
| | | <view class="group-name">{{group.name}}</view> |
| | | <view class="group-time-info"> |
| | | <view class="time-row"> |
| | | <text class="time-label">开始时间:</text> |
| | | <text class="time-value">{{group.startTime}}</text> |
| | | </view> |
| | | <view class="time-row"> |
| | | <text class="time-label">结束时间:</text> |
| | | <text class="time-value">{{group.endTime}}</text> |
| | | </view> |
| | | <view class="time-row"> |
| | | <text class="time-label">灌溉时长:</text> |
| | | <text class="time-value">{{group.duration}}分钟</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | <!-- 轮灌组信息 --> |
| | | <view class="group-info"> |
| | | <view class="group-name">{{group.name}}</view> |
| | | <view class="group-time-info"> |
| | | <view class="time-row"> |
| | | <text class="time-label">开始时间:</text> |
| | | <text class="time-value">{{group.startTime}}</text> |
| | | </view> |
| | | </block> |
| | | <view class="time-row"> |
| | | <text class="time-label">结束时间:</text> |
| | | <text class="time-value">{{group.endTime}}</text> |
| | | </view> |
| | | <view class="time-row"> |
| | | <text class="time-label">灌溉时长:</text> |
| | | <text class="time-value">{{group.duration}}分钟</text> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </block> |
| | |
| | | display: flex; |
| | | flex-direction: column; |
| | | height: 100vh; |
| | | background-color: #F5F5F5; |
| | | background-color: #f5f5f5; |
| | | } |
| | | |
| | | /* 顶部信息区域样式 */ |
| | | .header-section { |
| | | background-color: #FFFFFF; |
| | | padding: 20rpx 30rpx; |
| | | margin-bottom: 20rpx; |
| | | box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); |
| | | background-color: #ffffff; |
| | | padding: 20rpx; |
| | | border-bottom: 1rpx solid #e0e0e0; |
| | | } |
| | | |
| | | .plan-info { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | margin-bottom: 20rpx; |
| | | margin-bottom: 8rpx; |
| | | min-height: 40rpx; |
| | | } |
| | | |
| | | .plan-code { |
| | | display: flex; |
| | | align-items: center; |
| | | flex: 1; |
| | | line-height: 40rpx; |
| | | } |
| | | |
| | | .plan-code .label { |
| | | color: #666; |
| | | font-size: 28rpx; |
| | | } |
| | | |
| | | .plan-code .value { |
| | | color: #333; |
| | | font-size: 28rpx; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .status-icon { |
| | | width: 68rpx; |
| | | height: 68rpx; |
| | | width: 80rpx; |
| | | height: 80rpx; |
| | | margin-left: 20rpx; |
| | | flex-shrink: 0; |
| | | margin-top: -10rpx; |
| | | margin-bottom: -10rpx; |
| | | } |
| | | |
| | | .time-info { |
| | | .time-info, .project-info { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 10rpx 0; |
| | | margin-top: 8rpx; |
| | | } |
| | | |
| | | .label { |
| | | color: #666666; |
| | | .time-info .label, .project-info .label { |
| | | color: #666; |
| | | font-size: 28rpx; |
| | | margin-right: 10rpx; |
| | | } |
| | | |
| | | .value { |
| | | color: #333333; |
| | | .time-info .value, .project-info .value { |
| | | color: #333; |
| | | font-size: 28rpx; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | /* 项目列表样式 */ |
| | |
| | | } |
| | | |
| | | .scroll-content { |
| | | padding: 0 30rpx 30rpx 30rpx; |
| | | padding: 20rpx; |
| | | } |
| | | |
| | | .project-item { |
| | |
| | | |
| | | /* 轮灌组列表样式 */ |
| | | .group-list { |
| | | background-color: #FFFFFF; |
| | | border-radius: 0 0 12rpx 12rpx; |
| | | padding: 0 20rpx; |
| | | flex: 1; |
| | | overflow: hidden; |
| | | max-height: 0; |
| | | transition: all 0.3s ease-in-out; |
| | | width: 100%; |
| | | box-sizing: border-box; |
| | | } |
| | | |
| | | .group-list.expanded { |
| | | max-height: 2000rpx; /* 足够大的高度以容纳内容 */ |
| | | padding: 0 20rpx 20rpx 20rpx; |
| | | } |
| | | |
| | | .group-list.collapsed { |
| | | max-height: 0; |
| | | padding-top: 0; |
| | | padding-bottom: 0; |
| | | } |
| | | |
| | | .group-item { |
| | | border-radius: 8rpx; |
| | | margin-top: 20rpx; |
| | | background-color: #ffffff; |
| | | border-radius: 12rpx; |
| | | padding: 20rpx; |
| | | background-color: #F9F9F9; |
| | | position: relative; |
| | | margin-bottom: 20rpx; |
| | | box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05); |
| | | } |
| | | |
| | | /* 轮灌组状态样式 */ |
| | | .group-status-indicator { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 20rpx; |
| | | margin-bottom: 16rpx; |
| | | } |
| | | |
| | | .status-dot { |
| | | width: 16rpx; |
| | | height: 16rpx; |
| | | border-radius: 50%; |
| | | margin-right: 10rpx; |
| | | margin-right: 8rpx; |
| | | } |
| | | |
| | | .group-item.pending .status-dot { |
| | | background-color: #ffd700; |
| | | } |
| | | |
| | | .group-item.in_progress .status-dot { |
| | | background-color: #4CAF50; |
| | | } |
| | | |
| | | .group-item.completed .status-dot { |
| | | background-color: #2196F3; |
| | | } |
| | | |
| | | .status-text { |
| | | font-size: 26rpx; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | /* 已灌溉状态 */ |
| | | .irrigated .status-dot { |
| | | background-color: #52C41A; |
| | | } |
| | | |
| | | .irrigated .status-text { |
| | | color: #52C41A; |
| | | } |
| | | |
| | | /* 正在灌溉状态 */ |
| | | .irrigating .status-dot { |
| | | background-color: #D43030; |
| | | } |
| | | |
| | | .irrigating .status-text { |
| | | color: #D43030; |
| | | } |
| | | |
| | | /* 未灌溉状态 */ |
| | | .waiting .status-dot { |
| | | background-color: #FAAD14; |
| | | } |
| | | |
| | | .waiting .status-text { |
| | | color: #FAAD14; |
| | | color: #666; |
| | | } |
| | | |
| | | /* 轮灌组信息样式 */ |
| | | .group-info { |
| | | padding-left: 26rpx; |
| | | margin-top: 12rpx; |
| | | } |
| | | |
| | | .group-name { |
| | | font-size: 30rpx; |
| | | font-weight: bold; |
| | | color: #333333; |
| | | margin-bottom: 20rpx; |
| | | font-size: 32rpx; |
| | | font-weight: 500; |
| | | color: #333; |
| | | margin-bottom: 12rpx; |
| | | } |
| | | |
| | | .group-time-info { |
| | | background-color: #FFFFFF; |
| | | border-radius: 8rpx; |
| | | padding: 20rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 8rpx; |
| | | } |
| | | |
| | | .time-row { |
| | | display: flex; |
| | | margin-bottom: 10rpx; |
| | | } |
| | | |
| | | .time-row:last-child { |
| | | margin-bottom: 0; |
| | | align-items: center; |
| | | } |
| | | |
| | | .time-label { |
| | | color: #666666; |
| | | color: #666; |
| | | font-size: 26rpx; |
| | | width: 150rpx; |
| | | width: 160rpx; |
| | | } |
| | | |
| | | .time-value { |
| | | color: #333333; |
| | | color: #333; |
| | | font-size: 26rpx; |
| | | } |
| | |
| | | // 获取选择的项目 - 优先使用URL参数 |
| | | if (options && options.project) { |
| | | const project = options.project; |
| | | const projectName = project === 'JYG' ? '嘉峪关项目' : '民勤项目'; |
| | | const projectName = project === 'JYG' ? '嘉峪关项目' : |
| | | project === 'MQ' ? '民勤项目' : |
| | | project === 'TEST' ? '测试项目' : '未知项目'; |
| | | |
| | | console.log(`从URL参数获取项目信息: ${project} (${projectName})`); |
| | | |
| | |
| | | // 从本地存储获取已选择的项目 |
| | | storage.getItemSafe('selectedProject').then(project => { |
| | | if (project) { |
| | | const projectName = project === 'JYG' ? '嘉峪关项目' : '民勤项目'; |
| | | const projectName = project === 'JYG' ? '嘉峪关项目' : |
| | | project === 'MQ' ? '民勤项目' : |
| | | project === 'TEST' ? '测试项目' : '未知项目'; |
| | | console.log(`从存储获取项目信息: ${project} (${projectName})`); |
| | | |
| | | this.setData({ |
| | |
| | | storage.setItem("clientId", String(data.content.clientId)); |
| | | |
| | | // 设置当前项目的tag |
| | | const tag = this.data.selectedProject === 'JYG' ? 'ym' : 'mq'; |
| | | const tag = this.data.selectedProject === 'JYG' ? 'ym' : |
| | | this.data.selectedProject === 'MQ' ? 'mq' : |
| | | this.data.selectedProject === 'TEST' ? 'test' : 'unknown'; |
| | | getApp().globalData.tag = tag; |
| | | |
| | | // 保存用户信息 |
| | |
| | | openTimeText: "", |
| | | openTime: "", |
| | | irrigateProfile: [], //获取所选灌溉方式的详细数据 |
| | | dialog_mode: true, |
| | | dialog_time: false, |
| | | dialog_water: false, |
| | | group_time: false, //是否显示选择分钟或小时的单选框 |
| | | openTime: "", //计划开泵的开始时间 |
| | | openTimeText: "", |
| | | isShowOpenTime: "false", |
| | | isOpenTiming: false, //是否是计划开阀时间样式的开阀 |
| | | postMinutes: 0, //定灌溉时长的时间 |
| | | showForceConfirm: false, |
| | | showErrorDialog: false, //错误提示 |
| | | errorData: "", |
| | | confirmBtn: { |
| | | content: '确认' |
| | | }, |
| | | radioValue: "0", //开阀方式选中的类型 |
| | | costiomTime: "", //自定义灌溉时间 |
| | | waterAmount: 0, //定量开阀的水量 |
| | | costiomWater: "", //输入的自定义水量 |
| | | isWXRefreshing: false, |
| | | irrigateProfile: [], //获取所选灌溉方式的详细数据 |
| | | }, |
| | | |
| | | // 切换 Tabs |
| | |
| | | choseCard(event) { |
| | | //显示二次确认弹窗 |
| | | this.setData({ |
| | | showConfirm: true, |
| | | // showConfirm: true, |
| | | choseItem: event.currentTarget.dataset.item, |
| | | allWaterPoints: [] |
| | | |
| | | }) |
| | | this.initDialogData(); |
| | | |
| | | // console.log(intakeId); |
| | | // wx.navigateTo({ |
| | | // url: '/pages/openCard/openCard?intakeId='+intakeId, |
| | |
| | | }); |
| | | const app = getApp(); |
| | | const data = { |
| | | intakeId: intakeId, //取水口ID |
| | | // vcId: vcId, //虚拟卡ID |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | // vcId: app.globalData.vcId, //虚拟卡ID |
| | | operator: app.globalData.clientId, //操作员 |
| | | forceOpen: !!isforce // 使用逻辑非操作符 !! 来确保 isForce 是布尔值 |
| | | }; |
| | |
| | | this.getcommonWaterPoints(); |
| | | }, |
| | | confirmDialog() { |
| | | // this.setData({ |
| | | // showConfirm: false |
| | | // }) |
| | | // this.postOpenValva(this.data.choseItem.intakeId); |
| | | this.setData({ |
| | | showConfirm: false |
| | | showConfirm: false |
| | | }) |
| | | this.postOpenValva(this.data.choseItem.intakeId); |
| | | this.initDialogData(); |
| | | }, |
| | | closeDialog() { |
| | | this.setData({ |
| | |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.intakeId, //取水口ID |
| | | // vcId: this.data.vcId, //虚拟卡ID |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | // vcId: app.globalData.vcId, //虚拟卡ID |
| | | minutes: this.data.postMinutes, //分钟 |
| | | operator: app.globalData.clientId, //操作员 |
| | | plannedOpenTime: this.data.openTime |
| | |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.intakeId, //取水口ID |
| | | // vcId: this.data.vcId, //虚拟卡ID |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | // vcId: app.globalData.vcId, //虚拟卡ID |
| | | minutes: this.data.postMinutes, //分钟 |
| | | operator: app.globalData.clientId //操作员 |
| | | }; |
| | |
| | | }) |
| | | }); |
| | | }, |
| | | // 通过小时转换成分钟 |
| | | hourToMinutes(hours) { |
| | | // 检查输入是否合法 |
| | | if (isNaN(hours) || hours < 0) { |
| | | console.error('请输入有效的小时数'); |
| | | return null; |
| | | } |
| | | // 将小时转换为分钟 |
| | | const minutes = hours * 60; |
| | | return minutes; |
| | | }, |
| | | minutesToHours(minutes) { |
| | | // 检查输入是否合法 |
| | | if (isNaN(minutes) || hours < 0) { |
| | | console.error('请输入有效的小时数'); |
| | | return null; |
| | | } |
| | | // 将小时转换为分钟 |
| | | const hours = minutes / 60; |
| | | return hours; |
| | | }, |
| | | // 选择水量后的处理 |
| | | handleWaterWrapperTap(e) { |
| | | const index = e.currentTarget.dataset.index; |
| | | console.log(index) |
| | | if (index !== undefined) { |
| | | this.data.waterAmount = parseInt(this.data.irrigateProfile[index].defaultValue) |
| | | this.setData({ |
| | | activeIndex: parseInt(index), |
| | | costiomWater: "" |
| | | }); |
| | | } |
| | | }, |
| | | }) |
| | |
| | | "t-avatar": "tdesign-miniprogram/avatar/avatar", |
| | | "t-switch": "tdesign-miniprogram/switch/switch", |
| | | "t-button": "tdesign-miniprogram/button/button", |
| | | "t-dialog": "tdesign-miniprogram/dialog/dialog" |
| | | "t-dialog": "tdesign-miniprogram/dialog/dialog", |
| | | "t-input": "tdesign-miniprogram/input/input", |
| | | "t-radio": "tdesign-miniprogram/radio/radio", |
| | | "t-radio-group": "tdesign-miniprogram/radio-group/radio-group", |
| | | "t-date-time-picker": "tdesign-miniprogram/date-time-picker/date-time-picker" |
| | | }, |
| | | "navigationBarTitleText": "常用取水口", |
| | | "navigationBarTextStyle": "white" |
| | |
| | | flex-direction: column; |
| | | padding-bottom: 10rpx; /* 增加底部填充 */ |
| | | } |
| | | .dialog{ |
| | | --td-dialog-content-font-size:40rpx; |
| | | --td-dialog-content-line-height:50rpx |
| | | } |
| | | |
| | | |
| | | .error-dialog{ |
| | | --td-dialog-title-color:red; |
| | |
| | | .water-intake-name { |
| | | font-size: 50rpx !important; |
| | | margin-left: 15rpx; |
| | | } |
| | | } |
| | | |
| | | .item-balance-img { |
| | | width: 50rpx; |
| | | height: 40rpx; |
| | | } |
| | | |
| | | .item-bottom { |
| | | display: flex; |
| | | margin-top: 10rpx; |
| | | align-items: center; |
| | | /* 垂直居中 */ |
| | | } |
| | | |
| | | .item-card { |
| | | margin-left: 10rpx; |
| | | } |
| | | |
| | | .item-card text { |
| | | font-size: 35rpx; |
| | | color: #fff; |
| | | } |
| | | |
| | | .item-balance-text { |
| | | color: #fff; |
| | | font-size: 50rpx; |
| | | margin-left: 5rpx; |
| | | } |
| | | |
| | | .item-balance-text-red { |
| | | color: #FF6A6A; |
| | | font-size: 50rpx; |
| | | margin-left: 5rpx; |
| | | } |
| | | |
| | | .item-button { |
| | | margin-left: auto; |
| | | /* 将按钮固定在右边 */ |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | /* 使按钮内部水平和垂直居中 */ |
| | | background-color: #32CD32; |
| | | color: white; |
| | | padding-left: 40rpx; |
| | | padding-right: 40rpx; |
| | | padding-bottom: 10rpx; |
| | | padding-top: 10rpx; |
| | | border-radius: 30rpx; |
| | | font-size: 35rpx; |
| | | border: none; |
| | | } |
| | | |
| | | .item-button-gray { |
| | | margin-left: auto; |
| | | /* 将按钮固定在右边 */ |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | /* 使按钮内部水平和垂直居中 */ |
| | | background-color: #8B8989; |
| | | color: #FF6A6A; |
| | | padding-left: 40rpx; |
| | | padding-right: 40rpx; |
| | | padding-bottom: 10rpx; |
| | | padding-top: 10rpx; |
| | | border-radius: 30rpx; |
| | | font-size: 35rpx; |
| | | border: none; |
| | | } |
| | | |
| | | .item-balance-text-yuan { |
| | | color: white; |
| | | margin-left: 10rpx; |
| | | margin-bottom: 10rpx; |
| | | font-size: 30rpx; |
| | | } |
| | | |
| | | .item-balance-text-yuan-red { |
| | | color: #FF6A6A; |
| | | margin-left: 10rpx; |
| | | margin-bottom: 10rpx; |
| | | font-size: 30rpx; |
| | | } |
| | | |
| | | .item-balance { |
| | | display: flex; |
| | | align-items: flex-end; |
| | | /* 底部对齐 */ |
| | | } |
| | | |
| | | .list-container { |
| | | display: flex; |
| | | flex-grow: 1; /* 占满剩余高度 */ |
| | | padding-bottom: 30rpx; |
| | | height: 100%; |
| | | flex-direction: column; /* 确保内部元素按列排列 */ |
| | | } |
| | | |
| | | .dialog { |
| | | position: fixed; |
| | | top: 50%; |
| | | left: 50%; |
| | | transform: translate(-50%, -50%); |
| | | width: 80%; |
| | | z-index: 999; |
| | | /* 保证 Dialog 在蒙层之上 */ |
| | | } |
| | | |
| | | .dialog-content { |
| | | margin-top: 50rpx; |
| | | padding: 20px; |
| | | /* Optional: 设置最大高度,以防内容过多 */ |
| | | background-color: #fff; |
| | | border-radius: 10px; |
| | | box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .dialog-title { |
| | | font-size: 38rpx; |
| | | margin-bottom: 20rpx; |
| | | text-align: center; |
| | | } |
| | | |
| | | .dialog-title-text { |
| | | font-size: 38rpx; |
| | | margin-bottom: 20rpx; |
| | | text-align: center; |
| | | } |
| | | |
| | | .dialog-title-img { |
| | | width: 50rpx; |
| | | height: 50rpx; |
| | | position: absolute; |
| | | left: 0; /* 靠左对齐 */ |
| | | margin-left: 40rpx; |
| | | } |
| | | |
| | | button { |
| | | display: block; |
| | | width: 100%; |
| | | margin: 10rpx 0; |
| | | padding: 10rpx; |
| | | border: none; |
| | | background-color: #007aff; |
| | | color: #fff; |
| | | border-radius: 15rpx; |
| | | text-align: center; |
| | | font-size: 30rpx; |
| | | } |
| | | |
| | | .overlay { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | width: 100%; |
| | | height: 100%; |
| | | background-color: rgba(0, 0, 0, 0.5); |
| | | /* 黑色半透明 */ |
| | | z-index: 998; |
| | | /* 保证蒙层在最上层 */ |
| | | } |
| | | |
| | | .close { |
| | | left: 50%; |
| | | width: 80rpx; |
| | | height: 80rpx; |
| | | z-index: 1000; |
| | | margin-top: -50rpx; |
| | | position: absolute; |
| | | transform: translate(-50%); |
| | | } |
| | | |
| | | .row { |
| | | display: flex; |
| | | justify-content: space-around; |
| | | } |
| | | |
| | | .chose-wrapper { |
| | | display: flex; |
| | | align-items: flex-end; |
| | | /* 底部对齐 */ |
| | | justify-content: center; |
| | | /* 水平居中 */ |
| | | } |
| | | |
| | | .chose-number { |
| | | font-size: 40rpx; |
| | | } |
| | | |
| | | .chose-label { |
| | | font-size: 30rpx; |
| | | margin-left: 5rpx; |
| | | margin-bottom: 5rpx; |
| | | } |
| | | |
| | | .choseitem text { |
| | | color: #1890FF; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | .choseitem { |
| | | background-color: rgba(80, 78, 78, 0.082); |
| | | border-radius: 5px; |
| | | width: 100%; |
| | | height: 5vh; |
| | | margin-left: 20rpx; |
| | | margin-top: 10rpx; |
| | | margin-right: 20rpx; |
| | | margin-bottom: 10rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .choseitemactive { |
| | | background-color: #1890FF; |
| | | border-radius: 5px; |
| | | width: 100%; |
| | | height: 5vh; |
| | | margin-left: 20rpx; |
| | | margin-top: 10rpx; |
| | | margin-right: 20rpx; |
| | | margin-bottom: 10rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .box { |
| | | padding: 32rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | background-color: var(--td-bg-color-container, #fff); |
| | | } |
| | | |
| | | .open-time { |
| | | align-items: center; |
| | | justify-content: center; |
| | | display: flex; |
| | | margin-bottom: 20rpx; |
| | | font-size: 30rpx; |
| | | } |
| | | |
| | | .item { |
| | | background-color: #1890FF; |
| | | margin-top: 20rpx; |
| | | margin-left: 20rpx; |
| | | margin-right: 20rpx; |
| | | padding: 30rpx; |
| | | border-radius: 30rpx; |
| | | } |
| | | |
| | | .item-gray { |
| | | background-color: #D3D3D3; |
| | | margin-top: 20rpx; |
| | | margin-left: 20rpx; |
| | | margin-right: 20rpx; |
| | | padding: 30rpx; |
| | | border-radius: 30rpx; |
| | | } |
| | | |
| | |
| | | "setting": { |
| | | "compileHotReLoad": true, |
| | | "urlCheck": false |
| | | } |
| | | }, |
| | | "libVersion": "trial" |
| | | } |