"use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); const _sfc_main = { data() { return { // 用户数据 userData: { nickname: "张三", selectedPlot: "南地块" }, // 农场数据 farmData: { plotCount: 5, deviceCount: 12, deviceOnlineRate: 85, taskCompletionRate: 76, recentActivities: [ { title: "稻田水稻施肥", date: "2023-05-15", status: "pending", id: 1, executor: "李四" }, { title: "南地块除草", date: "2023-05-12", status: "completed", id: 2, executor: "王五" }, { title: "西北区域杀虫", date: "2023-05-08", status: "completed", id: 3, executor: "张三" } ] }, // 天气数据 weatherData: { temperature: 28, description: "晴朗", humidity: 65, windLevel: 3, rainfall: 0, advice: "今日适宜进行春玉米防虫作业,注意水分管理。" }, // 作物数据 crops: [ { name: "水稻", area: 48, progress: 75, icon: "🌾", bgColor: "#4CAF50" }, { name: "小麦", area: 36, progress: 60, icon: "🌿", bgColor: "#66BB6A" }, { name: "玉米", area: 32, progress: 85, icon: "🌽", bgColor: "#43A047" }, { name: "大豆", area: 12, progress: 40, icon: "🫘", bgColor: "#388E3C" } ], // 监控设备指标 deviceMetrics: [ { name: "在线设备", value: "28", icon: "wifi", gradient: "linear-gradient(135deg, #26A69A, #00796B)", trend: { type: "up", value: "5.2%" } }, { name: "告警设备", value: "3", icon: "error-circle", gradient: "linear-gradient(135deg, #FF7043, #E64A19)", trend: { type: "down", value: "2.1%" } }, { name: "离线设备", value: "5", icon: "close-circle", gradient: "linear-gradient(135deg, #78909C, #455A64)", trend: { type: "down", value: "1.8%" } }, { name: "数据稳定性", value: "96.3%", icon: "checkmark-circle", gradient: "linear-gradient(135deg, #66BB6A, #388E3C)", trend: { type: "up", value: "0.5%" } } ], // 农业机械指标 machineryMetrics: [ { name: "今日运行时长", value: "36.5", unit: "小时", icon: "clock", gradient: "linear-gradient(135deg, #42A5F5, #1976D2)" }, { name: "今日作业地块", value: "8", unit: "块", icon: "map", gradient: "linear-gradient(135deg, #66BB6A, #388E3C)" }, { name: "今日执行任务", value: "12", unit: "个", icon: "calendar", gradient: "linear-gradient(135deg, #FFA726, #F57C00)" }, { name: "使用率", value: "78.2%", icon: "star", gradient: "linear-gradient(135deg, #5C6BC0, #3949AB)", trend: { type: "up", value: "3.7%" } } ], // 当前选择的周期 currentPeriod: "month", // 警报摘要数据 alertSummaries: [ { title: "设备离线", value: "3 台", iconSrc: "/static/icons/offline.png", description: "最长离线时长:26 小时", type: "device-offline" }, { title: "虫害预警", value: "稻飞虱|小地老虎", iconSrc: "/static/icons/Pest_Alert.png", description: "预警等级:中", type: "pest-warning" }, { title: "气象预警", value: "强风(8级)", iconSrc: "/static/icons/weather_risk.png", description: "预计:未来 12 小时内", type: "weather-risk" }, { title: "作业延迟", value: "5 项", iconSrc: "/static/icons/task_delay.png", description: "最长延迟:3 天", type: "task-delay" } ], // 农场绩效图表数据 - 月度数据 monthlyData: { months: ["1月", "2月", "3月", "4月", "5月", "6月"], thisYearValues: [2.8, 3.4, 2.9, 3.6, 3.8, 3.2], lastYearValues: [2.5, 2.8, 2.4, 3, 3.2, 2.7] }, // 季度数据 quarterlyData: { months: ["Q1", "Q2", "Q3", "Q4"], thisYearValues: [3.2, 3.7, 4, 3.5], lastYearValues: [2.7, 3.3, 3.6, 3] }, // 年度数据 yearlyData: { months: ["2019", "2020", "2021", "2022", "2023"], thisYearValues: [2.2, 2.5, 3, 3.5, 3.8], lastYearValues: [2, 2.3, 2.7, 3.2, 3.4] } }; }, computed: { // 核心统计数据 coreStats() { return [ { label: "地块", value: this.farmData.plotCount, icon: "map" }, { label: "设备", value: this.farmData.deviceCount, icon: "setting" }, { label: "设备在线", value: this.farmData.deviceOnlineRate + "%", icon: "wifi" }, { label: "任务完成", value: this.farmData.taskCompletionRate + "%", icon: "checkmark-circle" } ]; }, // 根据当前周期计算要显示的数据 farmPerformanceData() { if (this.currentPeriod === "month") { return this.monthlyData; } else if (this.currentPeriod === "quarter") { return this.quarterlyData; } else { return this.yearlyData; } } }, methods: { // 处理切换地块 handleSwitchPlot() { common_vendor.index.showActionSheet({ itemList: ["南地块", "西北区域", "稻田", "东区试验田"], success: (res) => { this.userData.selectedPlot = ["南地块", "西北区域", "稻田", "东区试验田"][res.tapIndex]; } }); }, // 导航到个人资料 navigateToProfile() { common_vendor.index.navigateTo({ url: "/pages/profile/index" }); }, // 导航到活动详情 navigateToActivity(activity) { common_vendor.index.navigateTo({ url: `/pages/activity/detail?id=${activity.id}` }); }, // 导航到警报详情 navigateToAlertDetail(type) { common_vendor.index.__f__("log", "at pages/dashboard/index.vue:482", `Navigating to alert detail for type: ${type}`); }, // 切换周期 changePeriod(period) { this.currentPeriod = period; } }, mounted() { } }; if (!Array) { const _component_u_icon = common_vendor.resolveComponent("u-icon"); _component_u_icon(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: common_vendor.t($data.userData.nickname), b: common_vendor.t($data.userData.selectedPlot), c: common_vendor.o((...args) => $options.handleSwitchPlot && $options.handleSwitchPlot(...args)), d: common_assets._imports_0, e: common_vendor.o((...args) => $options.navigateToProfile && $options.navigateToProfile(...args)), f: common_vendor.f($data.alertSummaries, (alert, index, i0) => { return { a: alert.iconSrc, b: common_vendor.t(alert.title), c: common_vendor.t(alert.value), d: common_vendor.t(alert.description), e: index, f: common_vendor.o(($event) => $options.navigateToAlertDetail(alert.type), index) }; }), g: $data.weatherData.description === "晴朗" }, $data.weatherData.description === "晴朗" ? {} : $data.weatherData.description.includes("雨") ? {} : $data.weatherData.description.includes("云") ? {} : {}, { h: $data.weatherData.description.includes("雨"), i: $data.weatherData.description.includes("云"), j: common_vendor.t($data.weatherData.temperature), k: common_vendor.t($data.weatherData.description), l: common_vendor.t($data.weatherData.humidity), m: common_vendor.t($data.weatherData.windLevel), n: common_vendor.t($data.weatherData.rainfall), o: common_vendor.p({ name: "info", color: "#ffffff", size: "14" }), p: common_vendor.t($data.weatherData.advice), q: $data.currentPeriod === "month" ? 1 : "", r: common_vendor.o(($event) => $options.changePeriod("month")), s: $data.currentPeriod === "quarter" ? 1 : "", t: common_vendor.o(($event) => $options.changePeriod("quarter")), v: $data.currentPeriod === "year" ? 1 : "", w: common_vendor.o(($event) => $options.changePeriod("year")), x: common_vendor.p({ name: "arrow-upward", color: "#3BB44A", size: "12" }), y: common_vendor.p({ name: "arrow-upward", color: "#3BB44A", size: "12" }), z: common_vendor.f([4, 3, 2, 1, 0], (value, index, i0) => { return { a: common_vendor.t(value), b: index }; }), A: common_vendor.f($options.farmPerformanceData.months, (month, index, i0) => { return { a: $options.farmPerformanceData.lastYearValues[index] / 4 * 100 + "%", b: $options.farmPerformanceData.thisYearValues[index] / 4 * 100 + "%", c: common_vendor.t(month), d: index }; }), B: common_vendor.f($data.deviceMetrics, (metric, index, i0) => { return { a: "a869e244-3-" + i0, b: common_vendor.p({ name: metric.icon, color: "#ffffff", size: "18" }), c: metric.gradient, d: common_vendor.t(metric.name), e: common_vendor.t(metric.value), f: "a869e244-4-" + i0, g: common_vendor.p({ name: metric.trend.type === "up" ? "arrow-upward" : "arrow-downward", color: metric.trend.type === "up" ? "#3BB44A" : "#FF5252", size: "14" }), h: common_vendor.t(metric.trend.value), i: common_vendor.n(metric.trend.type), j: index }; }), C: common_vendor.f($data.machineryMetrics, (metric, index, i0) => { return common_vendor.e({ a: "a869e244-5-" + i0, b: common_vendor.p({ name: metric.icon, color: "#ffffff", size: "18" }), c: metric.gradient, d: common_vendor.t(metric.name), e: common_vendor.t(metric.value), f: metric.trend }, metric.trend ? { g: "a869e244-6-" + i0, h: common_vendor.p({ name: metric.trend.type === "up" ? "arrow-upward" : "arrow-downward", color: metric.trend.type === "up" ? "#3BB44A" : "#FF5252", size: "14" }), i: common_vendor.t(metric.trend.value), j: common_vendor.n(metric.trend.type) } : { k: common_vendor.t(metric.unit) }, { l: index }); }), D: common_vendor.p({ name: "arrow-right", color: "#ffffff", size: "14" }), E: common_vendor.f($data.farmData.recentActivities, (activity, index, i0) => { return { a: common_vendor.n(activity.status), b: common_vendor.t(activity.title), c: common_vendor.t(activity.date), d: common_vendor.t(activity.executor), e: "a869e244-8-" + i0, f: common_vendor.o(($event) => $options.navigateToActivity(activity), index), g: index }; }), F: common_vendor.p({ name: "arrow-right", color: "#3BB44A", size: "14" }) }); } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a869e244"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/dashboard/index.js.map