<template>
	<view class="container">
		<view class="right-top_header">
			<view class="right-top_header_right">
				<view class="titleItem">
					<view>
						切换计划
					</view>
					<view class="regionText">
						<picker @click="$refs.locationTree1._show()" :disabled="true">
							<view v-if="planTreeInfo.planPbsName==''" style="color: gray;">
								请选择
							</view>
							<view v-else>
								<view style="width: 98%;text-align: right" class="ellipsis">
									{{planTreeInfo.planPbsName}}
								</view>
							</view>
						</picker>
						<image src="/static/icon-right-ccc.png"
							style="width: 10rpx;height: 20rpx;display: inline-block;"></image>
					</view>
				</view>
				<view class="titleItem">
					<view>
						切换WBS/TASK
					</view>
					<view class="regionText">
						<picker @click="$refs.locationTree2._show()" :disabled="true">
							<view v-if="planTreeInfo.planWbsTaskName==''" style="color: gray;">
								请选择
							</view>
							<view v-else>
								<view style="width: 98%;text-align: right" class="ellipsis">
									{{planTreeInfo.planWbsTaskName}}
								</view>
							</view>
						</picker>
						<image src="/static/icon-right-ccc.png"
							style="width: 10rpx;height: 20rpx;display: inline-block;"></image>
					</view>
				</view>
			</view>
			<view class="right-top_header_left">
				<view @click="onDeviceYearClick(item)" :class="{ active: deviceYearInfo.id == item.id }"
					v-for="item in deviceYearList" :key="item.id">
					{{ item.year }}
				</view>
			</view>
		</view>
		<view class="minCharts_container">
			<view class="container_title">
				进度曲线
			</view>
			<view class="minCharts">
				<view class="" v-if="columnarChart1.categories.length > 0">
					<!-- <u-charts canvas-id="columnarChart1" chartType="mix" :opts="columnarChart1" ref="columnarChart1"
						:cWidth="cWidth" :cHeight="cHeight" :legends="true" /> -->
					<qiun-data-charts type="mix" :ontouch="true" :opts="opts" :chartData="columnarChart1" />
				</view>
				<view class="no_data" v-else>
					<image src="/static/bthgIcon/noData.png"></image>
					<view>暂无数据</view>
				</view>
			</view>
		</view>
		<!-- 检查部位 -->
		<tki-tree style="z-index: 9999;" ref="locationTree1" @confirm="(val) => onPlanPbsChange(val)" idKey='id'
			:range="planPbsTreeList" rangeKey="name" confirmColor="#4e8af7" :selectParent="true" />
		<tki-tree style="z-index: 9999;" ref="locationTree2" @confirm="(val) => onPlanWbsTaskChange(val)" idKey='id'
			:range="planTreeList" rangeKey="jobName" confirmColor="#4e8af7" :selectParent="true" />
	</view>
</template>

<script>
	import uCharts from '@/components/u-charts/component.vue';
	import {
		pxToRpx,
		dateformat
	} from "@/utils/tool.js";
  import dayjs from "dayjs";
	export default {
		components: {
			uCharts,
		},
		data() {
			return {
				projectSn: "",
				cWidth: 0,
				cHeight: 0,
				safeDetailInfo: {},
				safeProblemList: [],
				columnarChart1: {
					categories: [],
					series: [{
							name: '本期计划',
							index: 1,
							color: "#80ABD4",
							type: "column",
							data: []
						},
						{
							name: '本期实际',
							index: 1,
							color: "#D3D1FC",
							type: "column",
							data: []
						},
						{
							name: '累计计划',
							type: "line",
							color: "#0458AA",
							data: []
						},
						{
							name: '累计实际',
							type: "line",
							color: "#08B1CA",
							data: []
						},
					]
				},
				opts: {},

				deviceYearInfo: {
					id: '',
					year: '全部'
				},
				deviceYearList: [],
				planTreeList: [],
				planPbsTreeList: [],
				planTreeInfo: {
					planPbsId: '',
					planPbsName: '',
					planWbsTaskId: '',
					planWbsTaskName: '',
				}
			}
		},
		created() {

			const that = this;
			// uni.getSystemInfo({
			// 	success: function(res) {
			// 		that.cWidth = res.windowWidth - pxToRpx(28) - pxToRpx(24);
			// 	}
			// });
		},
		mounted() {
			const that = this;
			uni.getSystemInfo({
				success: function(res) {
					console.log(res.windowWidth);
					console.log(11111, res.windowHeight);
					that.cWidth = res.windowWidth - uni.upx2px(36 + 14) - uni.upx2px(30 + 14) - uni.upx2px(24 +
						14);
					that.cHeight = uni.upx2px(530)
				}
			});
			this.projectSn = JSON.parse(uni.getStorageSync('projectDetail')).projectSn;
			// this.getDeviceYearList();
			this.getPlanPbsTreeList();
		},
		onShow() {

		},
		onLoad(options) {

		},
		methods: {
			getPlanRecordTreeList() {
				const that = this;
				let data = {
					projectSn: this.projectSn,
					pageNo: 1,
					pageSize: -1,
					pbsId: this.planTreeInfo.planPbsId
				};
				this.sendRequest({
					url: 'xmgl/planRecord/tree/page',
					data,
					method: 'get',
					success(result) {
						if (result.success) {
							that.planTreeList = result.result.records.map((item, index) => {
								if (index == 0) {
									item.checked = true;
									that.planTreeInfo.planWbsTaskId = item.id;
									that.planTreeInfo.planWbsTaskName = item.jobName
								}
								return item
							});
							that.getDeviceYearList();
						}
					}
				})
			},
			getPlanPbsTreeList() {
				const that = this;
				let data = {
					projectSn: this.projectSn,
					// title: this.switchScheduleInfo.title,
					pageNo: 1,
					pageSize: -1
				};
				this.sendRequest({
					url: 'xmgl/planPbs/tree/page',
					data,
					method: 'get',
					success(result) {
						if (result.success) {
							that.planPbsTreeList = result.result.records.map((item, index) => {
								if (index == 0) {
									item.checked = true;
									that.planTreeInfo.planPbsId = "1899717371193204738";
									that.planTreeInfo.planPbsName = " 220kV变电站";
									// that.planTreeInfo.planPbsId = item.id;
									// that.planTreeInfo.planPbsName = item.name
								}
								return item
							});
							that.getPlanRecordTreeList();
						}
					}
				})
			},
			onPlanPbsChange(val) {
				this.planTreeInfo.planPbsId = val[0].id;
				this.planTreeInfo.planPbsName = val[0].name
				this.getPlanRecordTreeList();
			},
			onPlanWbsTaskChange(val) {
				this.planTreeInfo.planWbsTaskId = val[0].id;
				this.planTreeInfo.planWbsTaskName = val[0].jobName;
				console.log(val, 33333334444)
				this.getDeviceYearList();
			},
			//查询装置主进度计划年份信息
			getDeviceYearList() {
				// const that = this;
				// let data = {
				// 	recordId: this.planTreeInfo.planWbsTaskId,
				// 	projectSn: this.projectSn,
				// 	pageNo: 1,
				// 	pageSize: -1,
				// 	deviceUnitId: '',
				// 	year: ""
				// };
				// console.log(this.projectSn)
				// this.sendRequest({
				// 	url: 'xmgl/planRecord/getPlanCurve',
				// 	data,
				// 	method: 'get',
				// 	success(res) {
				// 		if (res.code == 200) {
				// 			that.deviceYearList = res.result.reduce((prev, cur) => {
				// 					const findIndex = prev.findIndex(item => item.year == dateformat(cur
				// 						.time, 'yyyy'));
				// 					if (findIndex == -1) {
				// 						prev.push({
				// 							id: prev.length,
				// 							year: dateformat(cur.time, 'yyyy'),
				// 						});
				// 					}
				// 					return prev;
				// 				},
				// 				[]);
				// 			that.deviceYearInfo = that.deviceYearList[0];
				// 			console.log(
				// 				'查询装置主进度计划年份信息', that.deviceYearList);
				// 			that.getDeviceScheduleList();
				// 		}
				// 	}
				// })
				this.deviceYearInfo = {
					id: '',
					year: '全部'
				};
				this.getDeviceScheduleList();
			},
			onDeviceYearClick(row) {
				if (row.id == this.deviceYearInfo.id) return;
				this.deviceYearInfo = row;
				this.getDeviceScheduleList(1);
			},
			getDeviceScheduleList(type) {
				const that = this;
				let data = {
					projectSn: this.projectSn,
					pageNo: 1,
					pageSize: -1,
					deviceUnitId: '',
					recordId: this.planTreeInfo.planWbsTaskId,
					year: this.deviceYearInfo.year == '全部' ? '' : this.deviceYearInfo.year
				};
				console.log(this.projectSn)
				this.sendRequest({
					url: 'xmgl/planRecord/getPlanCurve',
					data,
					method: 'get',
					success(res) {
						if (res.code == 200) {
							const obj = {
            '1899717371193204738': [
              {
                time: '2024-12-01',
                plan: 0.0002,
                actual: 0.0,
                planTotal: 0.0002,
                actualTotal: 0.0
              },
              {
                time: '2025-01-01',
                plan: 0.0002,
                actual: 0.0,
                planTotal: 0.0004,
                actualTotal: 0.0
              },
              {
                time: '2025-02-01',
                plan: 0.0016,
                actual: 0,
                planTotal: 0.002,
                actualTotal: 0
              },
              {
                time: '2025-03-01',
                plan: 0.0556,
                actual: 0.0575,
                planTotal: 0.0575,
                actualTotal: 0.0575
              },
              {
                time: '2025-04-01',
                plan: 0.0327,
                actual: 0.0027,
                planTotal: 0.0902,
                actualTotal: 0.0854
              },
              {
                time: '2025-05-01',
                plan: 0.0806,
                actual: 0,
                planTotal: 0.1708,
                actualTotal: 0.0854
              },
              {
                time: '2025-06-01',
                plan: 0.2717,
                actual: 0,
                planTotal: 0.4425,
                actualTotal: 0.0854
              },
              {
                time: '2025-07-01',
                plan: 0.0625,
                actual: 0,
                planTotal: 0.5047,
                actualTotal: 0.0854
              },
              {
                time: '2025-08-01',
                plan: 0.0917,
                actual: 0,
                planTotal: 0.5964,
                actualTotal: 0.0854
              },
              {
                time: '2025-09-01',
                plan: 0.1501,
                actual: 0,
                planTotal: 0.7474,
                actualTotal: 0.0854
              },
              {
                time: '2025-10-01',
                plan: 0.1061,
                actual: 0,
                planTotal: 0.8535,
                actualTotal: 0.0854
              },
              {
                time: '2025-11-01',
                plan: 0.0919,
                actual: 0,
                planTotal: 0.9454,
                actualTotal: 0.0854
              },
              {
                time: '2025-12-01',
                plan: 0.0508,
                actual: 0,
                planTotal: 0.9963,
                actualTotal: 0.0854
              },
              {
                time: '2026-01-01',
                plan: 0.0038,
                actual: 0,
                planTotal: 1.0,
                actualTotal: 0.0854
              },
              {
                time: '2026-02-01',
                plan: 0,
                actual: 0,
                planTotal: 1,
                actualTotal: 0.0854
              },
              {
                time: '2026-03-01',
                plan: 0,
                actual: 0,
                planTotal: 1,
                actualTotal: 0.0854
              },
              {
                time: '2026-04-01',
                plan: 0,
                actual: 0,
                planTotal: 1,
                actualTotal: 0.0854
              }
            ],
            '1899402366709522433': [
              {
                time: '2024-11-01',
                plan: 0.011,
                actual: 0.0224,
                planTotal: 0.011,
                actualTotal: 0.0224
              },
              {
                time: '2024-12-01',
                plan: 0.0495,
                actual: 0.0479,
                planTotal: 0.0605,
                actualTotal: 0.0704
              },
              {
                time: '2025-01-01',
                plan: 0.0385,
                actual: 0.0385,
                planTotal: 0.099,
                actualTotal: 0.1088
              },
              {
                time: '2025-02-01',
                plan: 0.0394,
                actual: 0.0394,
                planTotal: 0.1029,
                actualTotal: 0.1128
              },
              {
                time: '2025-03-01',
                plan: 0.0294,
                actual: 0.0267,
                planTotal: 0.1323,
                actualTotal: 0.1395
              },
              {
                time: '2025-04-01',
                plan: 0.1143,
                actual: 0,
                planTotal: 0.2467,
                actualTotal: 0
              },
              {
                time: '2025-05-01',
                plan: 0.0888,
                actual: 0,
                planTotal: 0.3355,
                actualTotal: 0
              },
              {
                time: '2025-06-01',
                plan: 0.0697,
                actual: 0,
                planTotal: 0.4052,
                actualTotal: 0
              },
              {
                time: '2025-07-01',
                plan: 0.0691,
                actual: 0,
                planTotal: 0.4743,
                actualTotal: 0
              },
              {
                time: '2025-08-01',
                plan: 0.1161,
                actual: 0,
                planTotal: 0.5903,
                actualTotal: 0
              },
              {
                time: '2025-09-01',
                plan: 0.1198,
                actual: 0,
                planTotal: 0.7101,
                actualTotal: 0
              },
              {
                time: '2025-10-01',
                plan: 0.0322,
                actual: 0,
                planTotal: 0.7423,
                actualTotal: 0
              },

              {
                time: '2025-11-01',
                plan: 0.0278,
                actual: 0,
                planTotal: 0.7701,
                actualTotal: 0
              },
              {
                time: '2025-12-01',
                plan: 0.0389,
                actual: 0,
                planTotal: 0.8091,
                actualTotal: 0
              },
              {
                time: '2026-01-01',
                plan: 0.0158,
                actual: 0,
                planTotal: 0.8249,
                actualTotal: 0
              },
              {
                time: '2026-02-01',
                plan: 0.0248,
                actual: 0,
                planTotal: 0.8497,
                actualTotal: 0
              },

              {
                time: '2026-03-01',
                plan: 0.0483,
                actual: 0,
                planTotal: 0.8981,
                actualTotal: 0
              },
              {
                time: '2026-04-01',
                plan: 0.049,
                actual: 0,
                planTotal: 0.9471,
                actualTotal: 0
              },
              {
                time: '2026-05-01',
                plan: 0.0256,
                actual: 0,
                planTotal: 0.9727,
                actualTotal: 0
              },
              {
                time: '2026-06-01',
                plan: 0.0136,
                actual: 0,
                planTotal: 0.9863,
                actualTotal: 0
              },
              {
                time: '2026-07-01',
                plan: 0.0137,
                actual: 0,
                planTotal: 0.9999,
                actualTotal: 0
              },
              {
                time: '2026-08-01',
                plan: 0,
                actual: 0,
                planTotal: 1,
                actualTotal: 0
              },
              {
                time: '2026-09-01',
                plan: 0,
                actual: 0,
                planTotal: 1,
                actualTotal: 0
              },
              {
                time: '2026-10-01',
                plan: 0,
                actual: 0,
                planTotal: 1,
                actualTotal: 0
              }
            ],
            '1899707045882109953': [
              {
                time: '2024-11-01',
                plan: 0.0044,
                actual: 0.0001,
                planTotal: 0.0004,
                actualTotal: 0.0001
              },
              {
                time: '2024-12-01',
                plan: 0.0079,
                actual: 0.0062,
                planTotal: 0.0082,
                actualTotal: 0.0064
              },
              {
                time: '2025-01-01',
                plan: 0.0186,
                actual: 0.0247,
                planTotal: 0.0268,
                actualTotal: 0.0311
              },
              {
                time: '2025-02-01',
                plan: 0.0132,
                actual: 0.062,
                planTotal: 0.04,
                actualTotal: 0.0373
              },
              {
                time: '2025-03-01',
                plan: 0.0255,
                actual: 0.0255,
                planTotal: 0.0671,
                actualTotal: 0.0628
              },
              {
                time: '2025-04-01',
                plan: 0.0393,
                actual: 0.0393,
                planTotal: 0.1061,
                actualTotal: 0.102
              },
              {
                time: '2025-05-01',
                plan: 0.0538,
                actual: 0,
                planTotal: 0.1599,
                actualTotal: 0
              },
              {
                time: '2025-06-01',
                plan: 0.0706,
                actual: 0,
                planTotal: 0.2304,
                actualTotal: 0
              },
              {
                time: '2025-07-01',
                plan: 0.079,
                actual: 0,
                planTotal: 0.3095,
                actualTotal: 0
              },
              {
                time: '2025-08-01',
                plan: 0.1004,
                actual: 0,
                planTotal: 0.3998,
                actualTotal: 0
              },
              {
                time: '2025-09-01',
                plan: 0.1214,
                actual: 0,
                planTotal: 0.5213,
                actualTotal: 0
              },
              {
                time: '2025-10-01',
                plan: 0.02,
                actual: 0.0012,
                planTotal: 0.5413,
                actualTotal: 0.0012
              },
              {
                time: '2025-11-01',
                plan: 0.0372,
                actual: 0,
                planTotal: 0.5785,
                actualTotal: 0
              },
              {
                time: '2025-12-01',
                plan: 0.0379,
                actual: 0,
                planTotal: 0.6164,
                actualTotal: 0
              },
              {
                time: '2026-01-01',
                plan: 0.0474,
                actual: 0,
                planTotal: 0.6638,
                actualTotal: 0
              },
              {
                time: '2026-02-01',
                plan: 0.0325,
                actual: 0,
                planTotal: 0.6963,
                actualTotal: 0
              },
              {
                time: '2026-03-01',
                plan: 0.0077,
                actual: 0,
                planTotal: 0.704,
                actualTotal: 0
              },
              {
                time: '2026-04-01',
                plan: 0.0583,
                actual: 0,
                planTotal: 0.7623,
                actualTotal: 0
              },
              {
                time: '2026-05-01',
                plan: 0.0199,
                actual: 0,
                planTotal: 0.7822,
                actualTotal: 0
              },
              {
                time: '2026-06-01',
                plan: 0.1193,
                actual: 0,
                planTotal: 0.8815,
                actualTotal: 0
              },
              {
                time: '2026-07-01',
                plan: 0.1394,
                actual: 0,
                planTotal: 0.9009,
                actualTotal: 0
              },
              {
                time: '2026-08-01',
                plan: 0.041,
                actual: 0,
                planTotal: 0.9419,
                actualTotal: 0
              },
              {
                time: '2026-09-01',
                plan: 0.0239,
                actual: 0,
                planTotal: 0.9658,
                actualTotal: 0
              },
              {
                time: '2026-10-01',
                plan: 0.029,
                actual: 0,
                planTotal: 0.9948,
                actualTotal: 0
              }
            ],
            '1899716729003319298': [
              {
                time: '2025-01-01',
                plan: 0,
                actual: 0,
                planTotal: 0.017,
                actualTotal: 0
              },
              {
                time: '2025-02-01',
                plan: 0,
                actual: 0,
                planTotal: 0.0253,
                actualTotal: 0
              },
              {
                time: '2025-03-01',
                plan: 0.036,
                actual: 0,
                planTotal: 0.0613,
                actualTotal: 0
              },
              {
                time: '2025-04-01',
                plan: 0.0881,
                actual: 0.1473,
                planTotal: 0.1494,
                actualTotal: 0.1473
              },
              {
                time: '2025-05-01',
                plan: 0.1263,
                actual: 0,
                planTotal: 0.2757,
                actualTotal: 0
              },
              {
                time: '2025-06-01',
                plan: 0.0838,
                actual: 0,
                planTotal: 0.3596,
                actualTotal: 0
              },
              {
                time: '2025-07-01',
                plan: 0.0886,
                actual: 0,
                planTotal: 0.4482,
                actualTotal: 0
              },
              {
                time: '2025-08-01',
                plan: 0.1468,
                actual: 0,
                planTotal: 0.595,
                actualTotal: 0
              },
              {
                time: '2025-09-01',
                plan: 0.1332,
                actual: 0,
                planTotal: 0.7282,
                actualTotal: 0
              },
              {
                time: '2025-10-01',
                plan: 0.1151,
                actual: 0,
                planTotal: 0.8433,
                actualTotal: 0
              },
              {
                time: '2025-11-01',
                plan: 0.0589,
                actual: 0,
                planTotal: 0.9022,
                actualTotal: 0
              },
              {
                time: '2025-12-01',
                plan: 0.0347,
                actual: 0,
                planTotal: 0.9368,
                actualTotal: 0
              },
              {
                time: '2026-01-01',
                plan: 0.0122,
                actual: 0,
                planTotal: 0.9491,
                actualTotal: 0
              },
              {
                time: '2026-02-01',
                plan: 0.0284,
                actual: 0,
                planTotal: 0.9775,
                actualTotal: 0
              },
              {
                time: '2026-03-01',
                plan: 0.009,
                actual: 0,
                planTotal: 0.9784,
                actualTotal: 0
              },
              {
                time: '2026-04-01',
                plan: 0.0177,
                actual: 0,
                planTotal: 0.9961,
                actualTotal: 0
              },
              {
                time: '2026-05-01',
                plan: 0.039,
                actual: 0,
                planTotal: 1,
                actualTotal: 0
              }
            ],
            '1899716789845893121': [
              {
                time: '2025-01-01',
                plan: 0.0147,
                actual: 0,
                planTotal: 0.0147,
                actualTotal: 0
              },
              {
                time: '2025-02-01',
                plan: 0.012,
                actual: 0,
                planTotal: 0.0267,
                actualTotal: 0
              },
              {
                time: '2025-03-01',
                plan: 0.0336,
                actual: 0,
                planTotal: 0.0603,
                actualTotal: 0
              },
              {
                time: '2025-04-01',
                plan: 0.0912,
                actual: 0.158,
                planTotal: 0.1516,
                actualTotal: 0.158
              },
              {
                time: '2025-05-01',
                plan: 0.1415,
                actual: 0,
                planTotal: 0.2931,
                actualTotal: 0
              },
              {
                time: '2025-06-01',
                plan: 0.0856,
                actual: 0,
                planTotal: 0.3787,
                actualTotal: 0
              },
              {
                time: '2025-07-01',
                plan: 0.1169,
                actual: 0,
                planTotal: 0.4956,
                actualTotal: 0
              },

              {
                time: '2025-08-01',
                plan: 0.0934,
                actual: 0,
                planTotal: 0.589,
                actualTotal: 0
              },
              {
                time: '2025-09-01',
                plan: 0.0944,
                actual: 0,
                planTotal: 0.6834,
                actualTotal: 0
              },
              {
                time: '2025-10-01',
                plan: 0.129,
                actual: 0,
                planTotal: 0.8124,
                actualTotal: 0
              },
              {
                time: '2025-11-01',
                plan: 0.072,
                actual: 0,
                planTotal: 0.8844,
                actualTotal: 0
              },
              {
                time: '2025-12-01',
                plan: 0.0403,
                actual: 0,
                planTotal: 0.9247,
                actualTotal: 0
              },
              {
                time: '2026-01-01',
                plan: 0.0155,
                actual: 0,
                planTotal: 0.9402,
                actualTotal: 0
              },
              {
                time: '2026-02-01',
                plan: 0.382,
                actual: 0,
                planTotal: 0.9784,
                actualTotal: 0
              },
              {
                time: '2026-03-01',
                plan: 0,
                actual: 0,
                planTotal: 0.9784,
                actualTotal: 0
              },
              {
                time: '2026-04-01',
                plan: 0.55,
                actual: 0,
                planTotal: 0.984,
                actualTotal: 0
              },
              {
                time: '2026-05-01',
                plan: 0.16,
                actual: 0,
                planTotal: 1,
                actualTotal: 0
              },
              {
                time: '2026-06-01',
                plan: 0,
                actual: 0,
                planTotal: 1,
                actualTotal: 0
              }
            ],
            '1899716853611896834': [
              {
                time: '2025-01-01',
                plan: 0,
                actual: 0,
                planTotal: 0.01,
                actualTotal: 0
              },
              {
                time: '2025-02-01',
                plan: 0.0079,
                actual: 0,
                planTotal: 0.0079,
                actualTotal: 0
              },
              {
                time: '2025-03-01',
                plan: 0.0316,
                actual: 0,
                planTotal: 0.0396,
                actualTotal: 0
              },
              {
                time: '2025-04-01',
                plan: 0.0633,
                actual: 0.0857,
                planTotal: 0.1029,
                actualTotal: 0.0857
              },
              {
                time: '2025-05-01',
                plan: 0.0997,
                actual: 0,
                planTotal: 0.2026,
                actualTotal: 0
              },
              {
                time: '2025-06-01',
                plan: 0.1001,
                actual: 0,
                planTotal: 0.3027,
                actualTotal: 0
              },
              {
                time: '2025-07-01',
                plan: 0.082,
                actual: 0,
                planTotal: 0.3848,
                actualTotal: 0
              },
              {
                time: '2025-08-01',
                plan: 0.1264,
                actual: 0,
                planTotal: 0.5111,
                actualTotal: 0
              },
              {
                time: '2025-09-01',
                plan: 0.1325,
                actual: 0,
                planTotal: 0.6436,
                actualTotal: 0
              },
              {
                time: '2025-10-01',
                plan: 0.1233,
                actual: 0,
                planTotal: 0.7669,
                actualTotal: 0
              },
              {
                time: '2025-11-01',
                plan: 0.1003,
                actual: 0,
                planTotal: 0.8673,
                actualTotal: 0
              },
              {
                time: '2025-12-01',
                plan: 0.0356,
                actual: 0,
                planTotal: 0.9028,
                actualTotal: 0
              },
              {
                time: '2026-01-01',
                plan: 0.0359,
                actual: 0,
                planTotal: 0.9387,
                actualTotal: 0
              },
              {
                time: '2026-02-01',
                plan: 0.1183,
                actual: 0,
                planTotal: 0.9505,
                actualTotal: 0
              },
              {
                time: '2026-03-01',
                plan: 0.0206,
                actual: 0,
                planTotal: 0.9711,
                actualTotal: 0
              },
              {
                time: '2026-04-01',
                plan: 0.073,
                actual: 0,
                planTotal: 0.9784,
                actualTotal: 0
              },
              {
                time: '2026-05-01',
                plan: 0.05,
                actual: 0,
                planTotal: 0.9834,
                actualTotal: 0
              },
              {
                time: '2026-06-01',
                plan: 0.0042,
                actual: 0,
                planTotal: 0.9978,
                actualTotal: 0
              }
            ],
            '1899717264007766017': [
              {
                time: '2025-01-01',
                plan: 0,
                actual: 0,
                planTotal: 0.004,
                actualTotal: 0
              },
              {
                time: '2025-02-01',
                plan: 0.0056,
                actual: 0,
                planTotal: 0.006,
                actualTotal: 0
              },
              {
                time: '2025-03-01',
                plan: 0.0406,
                actual: 0,
                planTotal: 0.0466,
                actualTotal: 0
              },
              {
                time: '2025-04-01',
                plan: 0.1527,
                actual: 0.1661,
                planTotal: 0.1993,
                actualTotal: 0.1661
              },
              {
                time: '2025-05-01',
                plan: 0.151,
                actual: 0,
                planTotal: 0.3503,
                actualTotal: 0
              },
              {
                time: '2025-06-01',
                plan: 0.1601,
                actual: 0,
                planTotal: 0.5104,
                actualTotal: 0
              },
              {
                time: '2025-07-01',
                plan: 0.1124,
                actual: 0,
                planTotal: 0.6227,
                actualTotal: 0
              },
              {
                time: '2025-08-01',
                plan: 0.0863,
                actual: 0,
                planTotal: 0.7091,
                actualTotal: 0
              },
              {
                time: '2025-09-01',
                plan: 0.1165,
                actual: 0,
                planTotal: 0.8255,
                actualTotal: 0
              },
              {
                time: '2025-10-01',
                plan: 0.0667,
                actual: 0,
                planTotal: 0.8923,
                actualTotal: 0
              },
              {
                time: '2025-11-01',
                plan: 0.0379,
                actual: 0,
                planTotal: 0.9301,
                actualTotal: 0
              },
              {
                time: '2025-12-01',
                plan: 0.0185,
                actual: 0,
                planTotal: 0.9486,
                actualTotal: 0
              },
              {
                time: '2026-01-01',
                plan: 0.2941,
                actual: 0,
                planTotal: 0.9781,
                actualTotal: 0
              },
              {
                time: '2026-02-01',
                plan: 0.0383,
                actual: 0,
                planTotal: 0.9818,
                actualTotal: 0
              },
              {
                time: '2026-03-01',
                plan: 0.0,
                actual: 0,
                planTotal: 0.9818,
                actualTotal: 0
              },
              {
                time: '2026-04-01',
                plan: 0.0182,
                actual: 0,
                planTotal: 0.9999,
                actualTotal: 0
              },
              {
                time: '2026-05-01',
                plan: 0.0,
                actual: 0,
                planTotal: 1,
                actualTotal: 0
              },
              {
                time: '2026-06-01',
                plan: 0.0,
                actual: 0,
                planTotal: 1,
                actualTotal: 0
              }
            ]
          };

          const resultList = obj[that.planTreeInfo.planPbsId] || res.result;
							that.deviceYearList = resultList.reduce((prev, cur) => {
									const findIndex = prev.findIndex(item => item.year == dateformat(cur
										.time, 'yyyy'));
									if (findIndex == -1) {
										prev.push({
											id: prev.length,
											year: dateformat(cur.time, 'yyyy'),
										});
									}
									return prev;
								},[{
									id: '',
									year: '全部'
								}]);
							if(type != 1) {
								that.deviceYearInfo = that.deviceYearList[0];
							}
							
							that.opts = {
								color: [
									"#5181F6",
									"#00DBB6",
									"#F67F51",
									"#FF515A",
									"#8B5CFF",
									"#00CA69",
								],
								width: that.cWidth,
								height: that.cHeight,
								
								padding: [uni.upx2px(30), 0, uni.upx2px(20), uni.upx2px(20)],
								enableScroll: true,
								animation: false,
								duration:  0,
								legend: {
									show: true,
									itemGap: uni.upx2px(10),
								},
								fontSize: uni.upx2px(22),
							
								dataLabel: false,
								dataPointShape: true,
								background: "#FFFFFF",
								xAxis: {
									disableGrid: true,
									// type: "grid",
									axisLine: false,
									gridColor: "#fff",
									gridType: "dash",
									dashLength: 7,
									itemCount: 5,
									fontSize: uni.upx2px(23),
									lineHeight: uni.upx2px(40),
									// scrollShow: true,
								},
								yAxis: {
									disabled: false,
									disableGrid: false,
									gridType: "dash",
									dashLength: uni.upx2px(8),
									gridColor: "#CCCCCC",
									padding: uni.upx2px(20),
									showTitle: true,
									splitNumber: 10,
									data: [
										{
											position: "right",
											title: "累计(%)",
											textAlign: "left",
											titleFontSize: uni.upx2px(26),
											titleOffsetY: uni.upx2px(-5),
										},{
											position: "left",
											title: "本期(进度%)",
											titleFontSize: uni.upx2px(26),
											titleOffsetY: uni.upx2px(-5),
											titleOffsetX: uni.upx2px(15),
										},
									],
								},
								extra: {
									mix: {
										column: {
											width: uni.upx2px(20),
										},
										line: {
											width: uni.upx2px(4),
										}
									},
								},
							};
							
							that.columnarChart1 = {
								categories: resultList.map(item => dateformat(item.time, 'yyyy-MM')),
								series: [{
										name: '本期计划',
										color: 'rgba(255,127,80,1)',
										index: 1,
										type: "column",
										data: resultList.map(item => (item.plan * 100).toFixed(2))
									},
									{
										name: '本期实际',
										color: 'rgba(136,206,251,1)',
										index: 1,
										type: "column",
										data: resultList.map(item => (item.actual * 100).toFixed(2))
									},
									{
										name: '累计计划',
										type: "line",
										
										color: 'rgba(218,112,214,1)',
										data: resultList.map(item => (item.planTotal * 100).toFixed(2))
									},
									{
										name: '累计实际',
										type: "line",
										color: 'rgba(50,205,50,1)',
										data: resultList.map(item => (item.actualTotal * 100).toFixed(2))
									},
								]
							};
							console.log(222222, that.columnarChart1)
							
							// that.$nextTick(() => {
							// 	that.$refs.columnarChart1.changeData('columnarChart1', that.columnarChart1)
							// })
						}
					}
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.titleItem:not(:first-child) {
		padding: 20rpx 0;
	}

	.titleItem {
		font-size: 28rpx;
		display: flex;


		>view:first-child {
			width: 200rpx;
		}

		.regionText {
			flex: 1;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-left: 16%;
			width: 380rpx;
			white-space: nowrap;
			text-overflow: ellipsis;
			overflow: hidden;

			uni-picker {
				width: 100%;
			}
		}
	}

	.no_data {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		text-align: center;
		color: rgba(0, 0, 0, 0.5);
		font-size: 28rpx;

		uni-image {
			width: 300rpx;
			height: 300rpx;
			display: block;
			margin: 0 auto;
		}
	}

	.container {
		margin-top: 24rpx;
		// padding: 0 20rpx 20rpx;
		padding: 0 32rpx;

		.minCharts_container {
			// padding: 0 32rpx;

			.minCharts {
				width: calc(100%);
				background: #FFFFFF;
				box-shadow: 0px 10rpx 20rpx 0px rgba(46, 91, 255, 0.2);
				border-radius: 8rpx;
				border: 2rpx solid rgba(102, 111, 232, 0.08);
				padding: 24rpx;
				margin-top: 20rpx;
				min-height: calc(400rpx);
				position: relative;
			}
		}


		.right-top_header {
			display: flex;
			flex-direction: column;
			align-items: flex-start;
			justify-content: space-between;
			overflow-y: scroll;

			.right-top_header_right {
				width: 100%;
			}

			.right-top_header_left {
				display: flex;

				>view {
					border: 1px solid #0056A8;
					padding: 6rpx 12rpx;
					font-size: 24rpx;
					color: #0056a8;
					cursor: pointer;
					position: relative;
					border-radius: 6rpx;
				}

				>view:not(:first-child) {
					margin-left: 20rpx;
				}

				>view.active {
					background-color: #2B8DF3;
					border-color: #2B8DF3;
					color: white;
				}
			}
		}
	}

	.container_title {
		font-size: 30rpx;
		font-weight: bold;
		position: relative;
		margin-left: 20rpx;
		margin-bottom: 16rpx;
		margin-top: 32rpx;
		color: #2D8EF3;
	}

	.container_title::after {
		content: '';
		position: absolute;
		left: -20rpx;
		top: 50%;
		width: 4rpx;
		height: 80%;
		transform: translateY(-50%);
		background-color: #2D8EF3;
	}
</style>