Quellcode durchsuchen

接API 調整中

osbert vor 6 Jahren
Ursprung
Commit
2f1fb3363f

+ 0 - 5
TEAMModelOS/ClientApp/api/classMgmt.js

@@ -1,5 +0,0 @@
-export default {
-  GetTestData: function (data) {
-    console.log(data)
-  },
-}

+ 2 - 2
TEAMModelOS/ClientApp/api/index.js

@@ -1,8 +1,8 @@
 import { fetch, post } from '@/filters/http'
 import { fetch, post } from '@/filters/http'
-import ClassMgmt from './classMgmt'
+import SchoolMgmt from './schoolMgmt'
 import talMgmt from './talMgmt'
 import talMgmt from './talMgmt'
 export default {
 export default {
-  ClassMgmt,
+  SchoolMgmt,
   talMgmt,
   talMgmt,
   //获取登录跳转链接
   //获取登录跳转链接
   getLoginLink: function (data) {
   getLoginLink: function (data) {

+ 7 - 0
TEAMModelOS/ClientApp/api/schoolMgmt.js

@@ -0,0 +1,7 @@
+import { fetch, post } from '@/filters/http'
+export default {
+  GetTestIoTData: function () {
+    return fetch('/api/testAPI/GetTestIoTData');
+},
+}
+  

+ 0 - 2
TEAMModelOS/ClientApp/store/api/index.js

@@ -1,8 +1,6 @@
 import { fetch, post } from '@/filters/http'
 import { fetch, post } from '@/filters/http'
-import classMgmt from './classMgmt'
 
 
 export default {
 export default {
-  classMgmt,
   //获取登录跳转链接
   //获取登录跳转链接
   getLoginLink: function (data) {
   getLoginLink: function (data) {
      return post('api/login/login', data);
      return post('api/login/login', data);

+ 2 - 2
TEAMModelOS/ClientApp/store/index.js

@@ -1,6 +1,6 @@
 import Vue from 'vue'
 import Vue from 'vue'
 import Vuex from 'vuex'
 import Vuex from 'vuex'
-import classMgmt from './module/classMgmt';
+import schoolMgmt from './module/schoolMgmt';
 import talMgmt from './module/talMgmt';
 import talMgmt from './module/talMgmt';
 
 
 Vue.use(Vuex)
 Vue.use(Vuex)
@@ -184,7 +184,7 @@ export default new Vuex.Store({
     }]
     }]
   },
   },
   modules: {
   modules: {
-    classMgmt,
+    schoolMgmt,
     talMgmt
     talMgmt
   }
   }
 })
 })

+ 0 - 13
TEAMModelOS/ClientApp/store/module/classMgmt.js

@@ -1,13 +0,0 @@
-export default {
-    state: {
-       test: 'test',
-    },
-    getters: {
-        
-    },
-    mutations: {
-    },
-    actions: {
-        
-    }
-}

+ 86 - 0
TEAMModelOS/ClientApp/store/module/schoolMgmt.js

@@ -0,0 +1,86 @@
+export default {
+    state: {
+       data: {
+        classCount:{ // 教室總數
+            activeCount: 0, // 當前啟動教室
+            failCount: 0, // 今日故障教室數
+            updateCount: 0, // 待更新教室數
+            loginCount: 0, // 帳號登入啟動課堂數
+            total: 0 // 總教室數		
+        },
+        classInfo: [ // 開啟教室資訊
+        ],
+        hiTeachACT:{		// 教室開機數
+            today: 0,			// 今天總和
+            yesterday: 0,		// 昨天總和
+            weekAgoAVG: 0, 		// 前七天平均
+            mounthAgoAVG: 0,	// 前30天平均
+            semesterAVG: 0		// 學期平均
+        },
+        courseACT:{		// 課堂開機數
+            today: 0,			// 今天總和
+            yesterday: 0,		// 昨天總和
+            weekAgoAVG: 0, 		// 前七天平均
+            mounthAgoAVG: 0,		// 前30天平均
+            semesterAVG: 0		// 學期平均
+        },
+        participants:{	// 課堂參與人數
+            today: 0,			// 今天總和
+            yesterday: 0,		// 昨天總和
+            weekAgoAVG: 0, 		// 前七天平均
+            mounthAgoAVG: 0,		// 前30天平均
+            semesterAVG: 0		// 學期平均
+        },
+        immediateData:{ // 今日課堂數量變化
+        },	 
+        gradeClassPer:{ // 今日各年級課堂百分比
+
+        },
+        hiteachType:{ // 今日智慧教室啟用類型
+            "selfpace": 0,
+            "powerclick": 0,
+            "pptImport": 0,
+            "hteOpen": 0,
+            "blankPageAdd": 0
+        },
+        hiteachStatus:{ // 今日各版本教室開課狀態
+        },
+        classVer:{ // 智慧教室版本
+        },
+        operatingSystems:{ // 課堂作業系統
+        },
+        gradeUseStatus:{ // 各年級開課狀態
+        },
+        cumMin:	101659, // 累計教堂時數
+        mostClassUser:{	// 最多課堂使用者
+            id:	'',
+            name: '',
+            avatar: '',
+            today: 0, // 今日開課數
+            cumClass: 0 // 累計開課數
+        },
+        mostMinUser:{ // 最長時數使用者
+            id:	'',
+            name: '',
+            avatar: '',
+            mostClassMin: 0, // 最長課堂時數
+            cumMin: 0 // 累計課堂時數
+        },	
+        mostEffUser:{ // 最高效率課堂使用者
+            id:	'',
+            name: '',
+            avatar: '',
+            mostEff: 0, // 最高單堂效率值:
+            effAvg: 0 // 平均課堂效率值	
+        }
+    },
+    },
+    getters: {
+        
+    },
+    mutations: {
+    },
+    actions: {
+        
+    }
+}

+ 59 - 75
TEAMModelOS/ClientApp/view/schoolmgmtdashboard/Index.vue

@@ -68,23 +68,23 @@
                     <Row>
                     <Row>
                       <Col :span="5" style="text-align: center;">
                       <Col :span="5" style="text-align: center;">
                         <span style="color: #94998a;">{{$t('schoolMgmt.block1Title1')}}</span>
                         <span style="color: #94998a;">{{$t('schoolMgmt.block1Title1')}}</span>
-                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">4 <small>(36%)</small></h5>
+                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">{{classCount.activeCount}} <small>({{classCount.activeCount/classCount.total | percentFormat(0)}}%)</small></h5>
                       </Col>
                       </Col>
                       <Col :span="5" style="text-align: center;">
                       <Col :span="5" style="text-align: center;">
                       <span style="color: #94998a;">{{$t('schoolMgmt.block1Title2')}}</span>
                       <span style="color: #94998a;">{{$t('schoolMgmt.block1Title2')}}</span>
-                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">1 <small>(9%)</small></h5>
+                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">{{classCount.failCount}} <small>({{classCount.failCount/classCount.total | percentFormat(0)}}%)</small></h5>
                       </Col>
                       </Col>
                       <Col :span="5" style="text-align: center;">
                       <Col :span="5" style="text-align: center;">
                       <span style="color: #94998a;">{{$t('schoolMgmt.block1Title3')}}</span>
                       <span style="color: #94998a;">{{$t('schoolMgmt.block1Title3')}}</span>
-                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">3 <small>(27%)</small></h5>
+                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">{{classCount.updateCount}} <small>({{classCount.updateCount/classCount.total | percentFormat(0)}}%)</small></h5>
                       </Col>
                       </Col>
                       <Col :span="5" style="text-align: center;">
                       <Col :span="5" style="text-align: center;">
                       <span style="color: #94998a;">{{$t('schoolMgmt.block1Title4')}}</span>
                       <span style="color: #94998a;">{{$t('schoolMgmt.block1Title4')}}</span>
-                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">18 <small>(77%)</small></h5>
+                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">{{classCount.loginCount}} <small>({{classCount.loginCount/classCount.total | percentFormat(0)}}%)</small></h5>
                       </Col>
                       </Col>
                       <Col :span="4"  style="text-align: center;">
                       <Col :span="4"  style="text-align: center;">
                         <span style="color: #94998a;">{{$t('schoolMgmt.block1Title5')}}</span>
                         <span style="color: #94998a;">{{$t('schoolMgmt.block1Title5')}}</span>
-                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">11</h5>
+                        <h5 style="font-size: 2em;color: #FAFAFA;font-weight: 100;">{{classCount.total}}</h5>
                       </Col>
                       </Col>
                     </Row>
                     </Row>
                   </div>
                   </div>
@@ -92,7 +92,7 @@
               </div>
               </div>
               <div style="height: 40%;width:100%;position: relative;overflow: auto;">
               <div style="height: 40%;width:100%;position: relative;overflow: auto;">
                 <div class="scrollstyle" style="position: absolute;right: 0px;left: 0;top: 0;bottom: 0;overflow-x: hidden;overflow-y: auto;">
                 <div class="scrollstyle" style="position: absolute;right: 0px;left: 0;top: 0;bottom: 0;overflow-x: hidden;overflow-y: auto;">
-                  <div class="classInfo" v-for="(item, index) in classInfoData" :key="index">
+                  <div class="classInfo" v-for="(item, index) in classInfo" :key="index">
                     <Row type="flex" justify="center" align="bottom" style="border-bottom: solid 1px #94998a;padding-bottom: 7px;">
                     <Row type="flex" justify="center" align="bottom" style="border-bottom: solid 1px #94998a;padding-bottom: 7px;">
                       <Col :span="15">
                       <Col :span="15">
                         <h5>{{ item.groupNum }}, {{item.groupName}}</h5>
                         <h5>{{ item.groupNum }}, {{item.groupName}}</h5>
@@ -131,25 +131,25 @@
                 <Col :span="9" class="info-col-main">
                 <Col :span="9" class="info-col-main">
                   <div class="info-col-content">
                   <div class="info-col-content">
                     <span>{{ $t('schoolMgmt.block2Title1')}}</span><br/><small>{{ $t('schoolMgmt.block2SubTitle1')}}</small>
                     <span>{{ $t('schoolMgmt.block2Title1')}}</span><br/><small>{{ $t('schoolMgmt.block2SubTitle1')}}</small>
-                    <h5>8<small>/9</small></h5>
+                    <h5>{{hiTeachACT.today}}<small>/{{hiTeachACT.yesterday}}</small></h5>
                   </div>            
                   </div>            
                 </Col>
                 </Col>
                 <Col :span="5"  class="info-col-secondary">
                 <Col :span="5"  class="info-col-secondary">
                   <div class="info-col-content border-right">
                   <div class="info-col-content border-right">
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle2')}}</small>
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle2')}}</small>
-                    <h5>8</h5>
+                    <h5>{{hiTeachACT.weekAgoAVG}}</h5>
                   </div> 
                   </div> 
                 </Col>
                 </Col>
                 <Col :span="5"  class="info-col-secondary">
                 <Col :span="5"  class="info-col-secondary">
                   <div class="info-col-content border-right">
                   <div class="info-col-content border-right">
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle3')}}</small>
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle3')}}</small>
-                    <h5>8</h5>
+                    <h5>{{hiTeachACT.mounthAgoAVG}}</h5>
                   </div> 
                   </div> 
                 </Col>
                 </Col>
                 <Col :span="5"  class="info-col-secondary">
                 <Col :span="5"  class="info-col-secondary">
                   <div class="info-col-content">
                   <div class="info-col-content">
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle4')}}</small>
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle4')}}</small>
-                    <h5>8</h5>
+                    <h5>{{hiTeachACT.semesterAVG}}</h5>
                   </div> 
                   </div> 
                 </Col>
                 </Col>
               </Row>
               </Row>
@@ -166,25 +166,25 @@
                 <Col :span="9" class="info-col-main">
                 <Col :span="9" class="info-col-main">
                   <div class="info-col-content">
                   <div class="info-col-content">
                     <span>{{ $t('schoolMgmt.block2Title2')}}</span><br/><small>{{ $t('schoolMgmt.block2SubTitle1')}}</small>
                     <span>{{ $t('schoolMgmt.block2Title2')}}</span><br/><small>{{ $t('schoolMgmt.block2SubTitle1')}}</small>
-                    <h5>54<small>/65</small></h5>
+                    <h5>{{courseACT.today}}<small>/{{courseACT.yesterday}}</small></h5>
                   </div>            
                   </div>            
                 </Col>
                 </Col>
                 <Col :span="5"  class="info-col-secondary">
                 <Col :span="5"  class="info-col-secondary">
                   <div class="info-col-content border-right">
                   <div class="info-col-content border-right">
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle2')}}</small>
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle2')}}</small>
-                    <h5>61.2</h5>
+                    <h5>{{courseACT.weekAgoAVG}}</h5>
                   </div> 
                   </div> 
                 </Col>
                 </Col>
                 <Col :span="5"  class="info-col-secondary">
                 <Col :span="5"  class="info-col-secondary">
                   <div class="info-col-content border-right">
                   <div class="info-col-content border-right">
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle3')}}</small>
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle3')}}</small>
-                    <h5>58.9</h5>
+                    <h5>{{courseACT.mounthAgoAVG}}</h5>
                   </div> 
                   </div> 
                 </Col>
                 </Col>
                 <Col :span="5"  class="info-col-secondary">
                 <Col :span="5"  class="info-col-secondary">
                   <div class="info-col-content">
                   <div class="info-col-content">
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle4')}}</small>
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle4')}}</small>
-                    <h5>53.1</h5>
+                    <h5>{{courseACT.semesterAVG}}</h5>
                   </div> 
                   </div> 
                 </Col>
                 </Col>
               </Row>
               </Row>
@@ -201,25 +201,25 @@
                 <Col :span="9" class="info-col-main">
                 <Col :span="9" class="info-col-main">
                   <div class="info-col-content">
                   <div class="info-col-content">
                     <span>{{ $t('schoolMgmt.block2Title3')}}</span><br/><small>{{ $t('schoolMgmt.block2SubTitle1')}}</small>
                     <span>{{ $t('schoolMgmt.block2Title3')}}</span><br/><small>{{ $t('schoolMgmt.block2SubTitle1')}}</small>
-                    <h5>1,892<small>/2,863</small></h5>
+                    <h5>{{participants.today}}<small>/{{participants.yesterday}}</small></h5>
                   </div>            
                   </div>            
                 </Col>
                 </Col>
                 <Col :span="5"  class="info-col-secondary">
                 <Col :span="5"  class="info-col-secondary">
                   <div class="info-col-content border-right">
                   <div class="info-col-content border-right">
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle2')}}</small>
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle2')}}</small>
-                    <h5>2,542</h5>
+                    <h5>{{participants.weekAgoAVG}}</h5>
                   </div> 
                   </div> 
                 </Col>
                 </Col>
                 <Col :span="5"  class="info-col-secondary">
                 <Col :span="5"  class="info-col-secondary">
                   <div class="info-col-content border-right">
                   <div class="info-col-content border-right">
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle3')}}</small>
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle3')}}</small>
-                    <h5>2,301</h5>
+                    <h5>{{participants.mounthAgoAVG}}</h5>
                   </div> 
                   </div> 
                 </Col>
                 </Col>
                 <Col :span="5"  class="info-col-secondary">
                 <Col :span="5"  class="info-col-secondary">
                   <div class="info-col-content">
                   <div class="info-col-content">
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle4')}}</small>
                     <br/><small>{{ $t('schoolMgmt.block2SubTitle4')}}</small>
-                    <h5>2,436</h5>
+                    <h5>{{participants.semesterAVG}}</h5>
                   </div> 
                   </div> 
                 </Col>
                 </Col>
               </Row>
               </Row>
@@ -548,61 +548,11 @@ import RingPie from '@/components/schoolMgmtDashboard/RingPie'
 import LegendPie from '@/components/schoolMgmtDashboard/LegendPie'
 import LegendPie from '@/components/schoolMgmtDashboard/LegendPie'
 import ClassLine from '@/components/schoolMgmtDashboard/ClassLine'
 import ClassLine from '@/components/schoolMgmtDashboard/ClassLine'
 import ClassBar from '@/components/schoolMgmtDashboard/ClassBar'
 import ClassBar from '@/components/schoolMgmtDashboard/ClassBar'
-
+import { mapState } from 'vuex'
 export default {
 export default {
   name:'smart-dashboard',
   name:'smart-dashboard',
   data () {
   data () {
     return {
     return {
-      classInfoData:[
-        {
-          groupNum: 'GE305', 			// 教室代號
-          groupName: this.$t('schoolMgmt.text1') + '3',		// 教室名稱
-          groupTotal: 50,				// 上課人數
-          system: 'Hiteach 3 TBL',	// 使用版本
-          serialExp: '2021-09-30',	// 序號到期時間
-          whiteBoardDriver: 'HBI082', // 電子白板資訊
-          IRSDriver: 'RF05H',			// IRS資訊
-          teacher:{					// 教師資訊
-            name: 'picc',
-            id: 'picc#1234'
-          },
-          mode: 0, 					// 0:未啟動,1: 運行中,  2: 報修中
-          usetime: '--:--:--', 		// 使用時間          
-          hot: 7 						// 教室熱度
-        }, 
-        {
-          groupNum: 'GE305', 			// 教室代號
-          groupName: this.$t('schoolMgmt.text1') + '3',		// 教室名稱
-          groupTotal: 50,				// 上課人數
-          system: 'Hiteach 3 TBL',	// 使用版本
-          serialExp: '2021-09-30',	// 序號到期時間
-          whiteBoardDriver: 'HBI082', // 電子白板資訊
-          IRSDriver: 'RF05H',			// IRS資訊
-          teacher:{					// 教師資訊
-            name: 'picc',
-            id: 'picc#1234'
-          },
-          mode: 1, 					// 0:未啟動,1: 運行中,  2: 報修中
-          usetime: ' 00:45:03', 		// 使用時間
-          hot: 7 						// 教室熱度
-        },  
-        {
-          groupNum: 'GE305', 			// 教室代號
-          groupName: this.$t('schoolMgmt.text1') + '3',		// 教室名稱
-          groupTotal: 50,				// 上課人數
-          system: 'Hiteach 3 TBL',	// 使用版本
-          serialExp: '2021-09-30',	// 序號到期時間
-          whiteBoardDriver: 'HBI082', // 電子白板資訊
-          IRSDriver: 'RF05H',			// IRS資訊
-          teacher:{					// 教師資訊
-            name: 'picc',
-            id: 'picc#1234'
-          },
-          mode: 2, 					// 0:未啟動,1: 運行中,  2: 報修中
-          usetime: '--:--:--', 		// 使用時間
-          hot: 7 						// 教室熱度
-        },  
-      ],
       scolBeg:{
       scolBeg:{
         percent: '',
         percent: '',
         today: '',
         today: '',
@@ -656,11 +606,25 @@ export default {
       ]
       ]
     }
     }
   },
   },
-  components:{
-    LegendPie,
-    RingPie,
-    ClassBar,
-    ClassLine
+  computed:{
+    ...mapState({
+      schoolData: state => state.schoolMgmt.data,
+    }),
+    classCount(){ // 教室總數
+      return this.schoolData.classCount
+    },
+    classInfo(){ // 開啟教室資訊
+      return this.schoolData.classInfo
+    },
+    hiTeachACT(){ //教室開機數
+      return this.schoolData.hiTeachACT
+    }, 
+    courseACT(){ // 課堂開機數
+      return this.schoolData.courseACT
+    },
+    participants(){ //課堂參與人數
+      return this.schoolData.participants
+    },    
   },
   },
   methods:{
   methods:{
     pieHeightLight: function(type, value) {
     pieHeightLight: function(type, value) {
@@ -728,10 +692,30 @@ export default {
       }
       }
     }
     }
   },
   },
+  filters: {
+    commaFormat: function(value) { // 加上千分位符號
+      return value.toString().replace(/^(-?\d+?)((?:\d{3})+)(?=\.\d+$|$)/, function (all, pre, groupOf3Digital) {
+        return pre + groupOf3Digital.replace(/\d{3}/g, ',$&');
+      })
+    },
+    percentFormat: function(num, pos){
+      return (num* 100).toFixed(pos) 
+    }
+  },
+  components:{
+    LegendPie,
+    RingPie,
+    ClassBar,
+    ClassLine
+  },
   created(){
   created(){
-    this.$api.ClassMgmt.GetTestData('234234');
+    let _this = this;
+    this.$api.SchoolMgmt.GetTestIoTData({}).then(res => {
+      _this.$store.state.schoolMgmt.data = res
+    })
   },
   },
   mounted(){
   mounted(){
+    console.log(this.schoolData)
     var c=document.getElementById("floorplan");
     var c=document.getElementById("floorplan");
     var ctx=c.getContext("2d");
     var ctx=c.getContext("2d");
     var img=document.getElementById("planImg");
     var img=document.getElementById("planImg");