wkyy vor 1 Jahr
Ursprung
Commit
9b7a02b0a8
1 geänderte Dateien mit 55 neuen und 14 gelöschten Zeilen
  1. 55 14
      pages/workOrderManagement/workOrderStatistics.vue

+ 55 - 14
pages/workOrderManagement/workOrderStatistics.vue

@@ -21,7 +21,7 @@
 							待指派
 						</view>
 						<view class="state-number">
-							2
+							{{createdNum}}
 						</view>
 					</view>
 					<view class="state-item state2">
@@ -29,7 +29,7 @@
 							进行中
 						</view>
 						<view class="state-number">
-							3
+							{{dispatchedNum}}
 						</view>
 					</view>
 					<view class="state-item state3">
@@ -37,7 +37,7 @@
 							已解决
 						</view>
 						<view class="state-number">
-							33
+							{{endedNum}}
 						</view>
 					</view>
 					<view class="state-item state4">
@@ -45,7 +45,7 @@
 							已关闭
 						</view>
 						<view class="state-number">
-							34
+							{{closedNum}}
 						</view>
 					</view>
 				</view>
@@ -58,10 +58,10 @@
 				<view class="progress">
 					<view class="progress-item">
 						<view class="circle-progress">
-							<u-circle-progress active-color="#FF7B00" width="136" :percent="12">
+							<u-circle-progress active-color="#FF7B00" width="136" :percent="createdPercent">
 								<view class="u-progress-content">
 
-									<text class='u-progress-info1'>12%</text>
+									<text class='u-progress-info1'>{{createdPercent}}%</text>
 								</view>
 							</u-circle-progress>
 						</view>
@@ -71,10 +71,10 @@
 					</view>
 					<view class="progress-item">
 						<view class="circle-progress">
-							<u-circle-progress active-color="#008FA9" width="136" :percent="15">
+							<u-circle-progress active-color="#008FA9" width="136" :percent="dispatchedPercent">
 								<view class="u-progress-content">
 
-									<text class='u-progress-info2'>15%</text>
+									<text class='u-progress-info2'>{{dispatchedPercent}}%</text>
 								</view>
 							</u-circle-progress>
 						</view>
@@ -84,10 +84,10 @@
 					</view>
 					<view class="progress-item">
 						<view class="circle-progress">
-							<u-circle-progress active-color="#18C272" width="136" :percent="73">
+							<u-circle-progress active-color="#18C272" width="136" :percent="endedPercent">
 								<view class="u-progress-content">
 
-									<text class='u-progress-info3'>73%</text>
+									<text class='u-progress-info3'>{{endedPercent}}%</text>
 								</view>
 							</u-circle-progress>
 						</view>
@@ -127,10 +127,13 @@
 	export default {
 		data() {
 			return {
-				createdNum: 0,
-				dispatchedNum: 0,
-				endedNum: 0,
-				closedNum: 0,
+				createdPercent: 0,
+				dispatchedPercent: 0,
+				endedPercent: 0,
+				createdNum: 0, //待指派
+				dispatchedNum: 0, //进行中
+				endedNum: 0, //已解决
+				closedNum: 0, //已关闭
 				workForm: {
 					qkey: '',
 					startDate: '',
@@ -175,12 +178,50 @@
 		},
 		methods: {
 			getRptByStatus() {
+				this.createdNum = 0;
+				this.dispatchedNum = 0;
+				this.endedNum = 0;
+				this.closedNum = 0;
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
 				})
 				API_workOrder.rptByStatus(this.workForm).then((res) => {
 					uni.hideLoading();
+					var list = res.data;
+					if(list != null) {
+						for (var i = 0; i < list.length; i++) {
+							if(list[i].status == 'created') {
+								this.createdNum = list[i].rpt_count;
+							}
+							if (list[i].status == 'dispatched') {
+								this.dispatchedNum = list[i].rpt_count;
+							}
+							if (list[i].status == 'ended') {
+								this.endedNum = list[i].rpt_count;
+							}
+							if (list[i].status == 'closed') {
+								this.closedNum = list[i].rpt_count;
+							}
+						}
+					}
+					
+					var num = this.createdNum + this.dispatchedNum + this.endedNum;
+					if(this.createdNum != 0) {
+						this.createdPercent = this.createdNum/num*100;
+					} else {
+						this.createdPercent = 0;
+					}
+					if(this.dispatchedNum != 0) {
+						this.dispatchedPercent = this.dispatchedNum/num*100;
+					} else {
+						this.dispatchedPercent = 0;
+					}
+					if(this.endedNum != 0) {
+						this.endedPercent = this.endedNum/num*100;
+					} else {
+						this.endedPercent = 0;
+					}
 				}).catch(error => {
 					uni.showToast({
 						title: error,