upon 10 місяців тому
батько
коміт
8c820191ff

+ 1 - 0
TEAMModelOS/ClientApp/public/lang/en-US.js

@@ -7991,6 +7991,7 @@ const LANG_EN_US = {
         delete:'Delete',
         registrationGroup:'Registration group',
         export:'Export',
+        signup:'Sign up'
     },
     activity: {
         scoreWord: {

+ 1 - 0
TEAMModelOS/ClientApp/public/lang/zh-CN.js

@@ -7992,6 +7992,7 @@ const LANG_ZH_CN = {
         delete:'删除',
         registrationGroup:'报名组别',
         export:'汇出',
+        signup:'报名'
     },
     activity: {
         scoreWord: {

+ 2 - 1
TEAMModelOS/ClientApp/public/lang/zh-TW.js

@@ -7991,7 +7991,8 @@ const LANG_ZH_TW = {
         designatedReviewer:'指定評審',
         delete:'刪除',
         registrationGroup:'報名組別',
-        export:'匯出',        
+        export:'匯出',
+        signup:'報名'
     },
     activity: {
         scoreWord: {

+ 9 - 0
TEAMModelOS/ClientApp/src/api/htcommunity.js

@@ -16,6 +16,15 @@ export default {
     jointEventFind: function(data) {
         return post('/joint/event/find', data)
     },
+    // 刪除統測活動分組
+    jointEventGroupDelete: function(data) {
+        return post('/joint/event-group/delete', data)
+    },
+    // 刪除活動行程
+    jointScheduleDelete: function(data) {
+        return post('/joint/schedule/delete', data)
+    },
+   
    
    
 	

+ 3 - 3
TEAMModelOS/ClientApp/src/utils/public.js

@@ -552,9 +552,9 @@ export default {
 				.day
 			let startTime = ''
 			let endTime = ''
-			console.error(startMonth)
-			console.error(curYear)
-			console.error(settingSemesters[curSemeterIndex])
+			//console.error(startMonth)
+			//console.error(curYear)
+			//console.error(settingSemesters[curSemeterIndex])
 			// 如果当前学校只设置了一个学期
 			if (settingSemesters.length === 1) {
 				startMonth = settingSemesters[0].month

+ 2 - 2
TEAMModelOS/ClientApp/src/view/htcommunity/htMgtExam.vue

@@ -175,8 +175,8 @@
 				<!-- 暂无数据 -->
 				<EmptyData v-if="!evaListShow.length" :top="120"></EmptyData>
 				<!-- 跨校个人评测提示UI -->
-				<CrossSchool v-else-if="examDetaiInfo && !examDetaiInfo.curSchool" :examInfo="examDetaiInfo">
-				</CrossSchool>
+				<!-- <CrossSchool v-else-if="examDetaiInfo && !examDetaiInfo.curSchool" :examInfo="examDetaiInfo">
+				</CrossSchool> -->
 				<!-- 评测数据 -->
 				<DataView v-else-if="curBarIndex == 0" :examInfo="examDetaiInfo" :correctData="correctData"
 					:simpleData="simpleData" :dataErr="dataErr" class="evaluation-base-info"></DataView>

+ 174 - 127
TEAMModelOS/ClientApp/src/view/htcommunity/htMgtHome.vue

@@ -1,7 +1,7 @@
 <template>
   <div id="app" class="app-container">
     <el-button type="primary" class="btn-new" @click="newEvent">{{this.$t("htcommunity.addEvent")}}</el-button>
-    <el-table :data="activities" class="table-main"  border v-loading="mainLoading">
+    <el-table :data="activities" class="table-main" border v-loading="mainLoading">
       <el-table-column prop="index" :label="this.$t('htcommunity.serialNumber')" min-width="50"></el-table-column>
       <el-table-column prop="name" :label="this.$t('htcommunity.activityName')"></el-table-column>
       <el-table-column prop="time" :label="this.$t('htcommunity.schedule')"></el-table-column>
@@ -30,8 +30,8 @@
     </el-dialog>
 
     <!-- 新增活動彈出視窗 -->
-    <el-dialog :title="this.$t('htcommunity.addEvent')" :visible.sync="showAddModal" width="78%" 
-    :close-on-click-modal="false" :close-on-press-escape="false" :close="resetNewActivity">
+    <el-dialog :title="this.$t('htcommunity.addEvent')" :visible.sync="showAddModal" width="85%"
+      :close-on-click-modal="false" :close-on-press-escape="false" :close="resetNewActivity">
       <el-form :model="newActivity" label-width="100px" :rules="rules" ref="newActivity">
         <div class="form-container">
           <div class="form-left">
@@ -41,80 +41,73 @@
             <el-form-item :label="this.$t('htcommunity.eventArea')">
               <el-select v-model="newActivity.region" :placeholder="this.$t('htcommunity.pleaseChoose')">
                 <!-- <el-option v-for="(name,code) in twCityArr" :label="name" :value="code" :key="code"></el-option>        -->
-                <el-option v-for="item in twCityArr" :key="item.code" :label="item.name" :value="item.code" />                                    
+                <el-option v-for="item in twCityArr" :key="item.code" :label="item.name" :value="item.code" />
               </el-select>
             </el-form-item>
-            <el-form-item :label="this.$t('htcommunity.administrator')">              
-              <el-input v-model="newActivity.admin"  ></el-input>            
+            <el-form-item :label="this.$t('htcommunity.administrator')">
+              <el-input v-model="newActivity.admin"></el-input>
             </el-form-item>
-            <el-form-item 	:label="this.$t('htcommunity.schedule')" prop="time" >
-              <el-date-picker
-                v-model="newActivity.time"
-                type="daterange"                
-                start-placeholder="Start"
-                end-placeholder="End"
-                value-format="yyyy/MM/dd"
-                style="width: 400px;"
-                >
+            <el-form-item :label="this.$t('htcommunity.schedule')" prop="time">
+              <el-date-picker v-model="newActivity.time" type="daterange" start-placeholder="Start"
+                end-placeholder="End" value-format="yyyy/MM/dd" style="width: 400px;">
               </el-date-picker>
             </el-form-item>
 
             <!-- 組別表格 -->
             <!-- <p style="font-size: medium; margin-bottom: 10px;">組別:</p> -->
-            
-            <el-form-item 	:label="this.$t('htcommunity.group')" >
+
+            <el-form-item :label="this.$t('htcommunity.group')">
               <!-- <el-tooltip content="指定評審,請檢查確認為正確醍摩豆ID" placement="bottom" effect="light"> -->
-                <el-tooltip  placement="bottom" effect="light">
-                <div slot="content" style="color: red;font-size: 1.2em;" >指定評審,請輸入醍摩豆用戶編號,檢查確認為正確醍摩豆ID</div>
-                  <i class="el-icon-warning-outline" style="font-size: 2em;" ></i>
-                </el-tooltip>
-                <!-- <span>指定評審請輸入<span class="point">手機號碼</span>、<span class="point">醍摩豆用戶編號</span>或<span class="point">電子信箱</span>等資訊進行搜尋</span> -->
-            <el-table :data="newActivity.groups" style="width: 100%;" border 
-            :cell-style="{ textAlign: 'center' }" :header-cell-style="{ textAlign: 'center' }" v-loading="groupsLoading">
-              <el-table-column prop="groupName" :label="this.$t('htcommunity.groupName')" width="180">
-                <template slot-scope="scope">
-                  <el-input v-model="scope.row.groupName"></el-input>
-                </template>
-              </el-table-column>
-              <el-table-column prop="groupJudge" :label="this.$t('htcommunity.designatedReviewer')" width="195" >
-                <template slot-scope="scope">
-                  <el-input v-model="scope.row.groupJudge"  style="width: 115px;"></el-input><span v-if="scope.row.valid">✔️</span>
-                  
-                  <el-button type="primary" icon="el-icon-search" size="mini" @click="checkTmdid(scope)" style="margin-top: 5px;" >檢查</el-button>
-                  
-                </template>
-              </el-table-column>
-              <el-table-column 	:label="this.$t('htcommunity.operation')" width="60">
-                <template slot-scope="scope">
-                  <el-button type="text" @click="removeGroup(scope.$index)">{{$t("htcommunity.delete")}}</el-button>
-                </template>
-              </el-table-column>
-            </el-table>
-            <el-button type="primary" class="btn-add" icon="el-icon-plus" @click="addGroup"></el-button>
+              <el-tooltip placement="bottom" effect="light">
+                <div slot="content" style="color: red;font-size: 1.2em;">指定評審,請輸入醍摩豆用戶編號,檢查確認為正確醍摩豆ID</div>
+                <i class="el-icon-warning-outline" style="font-size: 2em;"></i>
+              </el-tooltip>
+              <!-- <span>指定評審請輸入<span class="point">手機號碼</span>、<span class="point">醍摩豆用戶編號</span>或<span class="point">電子信箱</span>等資訊進行搜尋</span> -->
+              <el-table :data="newActivity.groups" style="width: 100%;" border :cell-style="{ textAlign: 'center' }"
+                :header-cell-style="{ textAlign: 'center' }" v-loading="groupsLoading">
+                <el-table-column prop="groupName" :label="this.$t('htcommunity.groupName')" width="180">
+                  <template slot-scope="scope">
+                    <el-input v-model="scope.row.groupName"></el-input>
+                  </template>
+                </el-table-column>
+                <el-table-column prop="groupJudge" :label="this.$t('htcommunity.designatedReviewer')" width="245">
+                  <template slot-scope="scope">                   
+                    <el-input v-model="scope.row.groupJudge" style="width: 115px;margin-right: 10px"></el-input>
+                    <el-button type="primary" icon="el-icon-search" size="mini" @click="checkTmdid(scope)"
+                    style="margin-top: 5px;">檢查</el-button>
+                    <span v-if="scope.row.valid">✔️</span>
+
+                   
+
+                  </template>
+                </el-table-column>
+                <el-table-column :label="this.$t('htcommunity.operation')" width="60">
+                  <template slot-scope="scope">
+                    <el-button type="text" @click="removeGroup(scope)">{{$t("htcommunity.delete")}}</el-button>
+                  </template>
+                </el-table-column>
+              </el-table>
+              <el-button type="primary" class="btn-add" icon="el-icon-plus" @click="addGroup"></el-button>
             </el-form-item>
           </div>
           <div class="form-right">
             <p style="font-size: medium; margin-bottom: 10px;">{{this.$t("htcommunity.importantTimetable")}}:</p>
-            <el-checkbox v-model="newActivity.requireOrderCompletion">{{this.$t("htcommunity.activitiesMustBeCompletedInOrder")}}</el-checkbox>
+            <el-checkbox
+              v-model="newActivity.requireOrderCompletion">{{this.$t("htcommunity.activitiesMustBeCompletedInOrder")}}</el-checkbox>
 
             <!-- 計畫內容表格 -->
-            
-            <el-table :data="newActivity.planContent" style="width: 100%;" border
-            :cell-style="{ textAlign: 'center' }" :header-cell-style="{ textAlign: 'center' }">
-              <el-table-column prop="step" 	:label="this.$t('htcommunity.stage')" min-width="40px">
+
+            <el-table :data="newActivity.planContent" style="width: 100%;" border :cell-style="{ textAlign: 'center' }"
+              :header-cell-style="{ textAlign: 'center' }" v-loading="scheduleLoading">
+              <el-table-column prop="step" :label="this.$t('htcommunity.stage')" min-width="30px">
                 <template slot-scope="scope">
                   {{ scope.$index + 1 }}
                 </template>
               </el-table-column>
               <el-table-column prop="schedule" :label="this.$t('htcommunity.schedule')" min-width="150px">
                 <template slot-scope="scope">
-                  <el-date-picker
-                    v-model="scope.row.schedule"
-                    type="daterange"                    
-                    start-placeholder="Start"
-                    end-placeholder="End"
-                    value-format="yyyy/MM/dd"
-                    style="width: 100%;">
+                  <el-date-picker v-model="scope.row.schedule" type="daterange" start-placeholder="Start"
+                    end-placeholder="End" value-format="yyyy/MM/dd" style="width: 100%;">
                   </el-date-picker>
                 </template>
               </el-table-column>
@@ -123,19 +116,24 @@
                   <el-input v-model="scope.row.description"></el-input>
                 </template>
               </el-table-column>
-              <el-table-column prop="online" :label="this.$t('htcommunity.Eventlayout')" min-width="60px">
+              <el-table-column prop="type" :label="this.$t('htcommunity.signup')" min-width="33px">
                 <template slot-scope="scope">
-                  <el-checkbox v-model="scope.row.online"></el-checkbox>
+                  <el-checkbox v-model="scope.row.type"></el-checkbox>                 
                 </template>
               </el-table-column>
-              <el-table-column prop="evaluation" :label="this.$t('htcommunity.examCanBeChecked')" min-width="70px">
+              <el-table-column prop="examType" :label="this.$t('htcommunity.Eventlayout')" min-width="50px">
+                <template slot-scope="scope">
+                  <el-checkbox v-model="scope.row.examType"></el-checkbox>
+                </template>
+              </el-table-column>
+              <el-table-column prop="evaluation" :label="this.$t('htcommunity.examCanBeChecked')" min-width="60px">
                 <template slot-scope="scope">
                   <el-checkbox v-model="scope.row.evaluation"></el-checkbox>
                 </template>
               </el-table-column>
-              <el-table-column :label="this.$t('htcommunity.operation')" min-width="40px"> 
+              <el-table-column :label="this.$t('htcommunity.operation')" min-width="33px">
                 <template slot-scope="scope">
-                  <el-button type="text" @click="removePlanContent(scope.$index)">{{$t("htcommunity.delete")}}</el-button>
+                  <el-button type="text" @click="removePlanContent(scope)">{{$t("htcommunity.delete")}}</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -143,7 +141,7 @@
           </div>
         </div>
       </el-form>
-      <span slot="footer" class="dialog-footer">        
+      <span slot="footer" class="dialog-footer">
         <el-button @click="cancelUpsert">{{this.$t("htcommunity.cancel")}}</el-button>
         <el-button type="primary" @click="saveNewEvent">{{this.$t("htcommunity.confirm")}}</el-button>
       </span>
@@ -162,6 +160,7 @@ export default {
       isInsert:true,
       mainLoading:false,
       groupsLoading: false,
+      scheduleLoading: false,
       //curTwCity: null,
       twCityArr: [],
       activities: [
@@ -186,7 +185,7 @@ export default {
         ],
         requireOrderCompletion: false,
         planContent: [
-          {id:'', step: 1, schedule: [], description: '報名時間', online: false, evaluation: false }
+          {id:'', step: 1, schedule: [], description: '報名時間', type: true, examType: false, evaluation: false }
         ]
       },
       // 表單驗證
@@ -213,7 +212,7 @@ export default {
       //  取得列表資料API
       this.$api.htcommunity.jointEventFind(param).then(
           res => {
-            if (res.error == null) {
+            if (res) {
               let index = 1;
 
               res.data.forEach(item=>{
@@ -300,10 +299,7 @@ export default {
         });
         scope.row.valid = false;
         this.groupsLoading = false;
-      }
-
-      
-      
+      }        
 
     },
     // 新增活動
@@ -341,13 +337,11 @@ export default {
           //{ groupName: '', groupJudge: '', valid:false }
         ],
         requireOrderCompletion: false,
-        planContent: [
-          //{ step: 1, schedule: [], description: '報名時間', online: false, evaluation: false }
+        planContent: [          
         ]
-      };
-      debugger
+      };      
       // #endregion
-      // 設定活動分組      
+      // #region 設定活動分組      
       activity.originalData.groups.forEach(item => {
         let group = {
           id: item.id,
@@ -358,52 +352,50 @@ export default {
         this.newActivity.groups.push(group);
       });
       // #endregion
-      // 設定活動時程
+      // #region 設定活動時程
       activity.originalData.schedule.forEach(item => {
         let schedule = {
           id: item.id,
           step: item.orderby,
           schedule: [this.$jsFn.dateFormat(item.startTime), this.$jsFn.dateFormat(item.endTime)],
           description: item.name,
-          online: item.examType === "regular" ? true : false,
+          type: item.type === "join" ? true : false,
+          examType: item.examType === "regular" ? true : false,
           evaluation: item.examOverwrite
-        }
-        // { step: 1, schedule: [], description: '報名時間', online: false, evaluation: false }
+        }        
         this.newActivity.planContent.push(schedule);
       });
 
       // #endregion
-
-
     },
     //查看活動評量
     viewExams(activity) {
-      let params = {
-        jointEventId: "37db8a66-660c-43a5-b8ce-6686c070973e", 
-        creatorId: "1595321354",
-        name:"活動",
-        progress:"going" 
-        }
-        //  保存试卷到cosmos
-        this.$api.htcommunity.jointEventFind(params).then(
-          res => {
-            if (res.error == null) {
-              console.log("API 資料 : ");
-              console.log(res.data);
-            } else {
+      // let params = {
+      //   jointEventId: "37db8a66-660c-43a5-b8ce-6686c070973e", 
+      //   creatorId: "1595321354",
+      //   name:"活動",
+      //   progress:"going" 
+      //   }
+      //   //  保存试卷到cosmos
+      //   this.$api.htcommunity.jointEventFind(params).then(
+      //     res => {
+      //       if (res.errCode === "") {
+      //         console.log("API 資料 : ");
+      //         console.log(res.data);
+      //       } else {
               
-            }
-          },
-          err => {
+      //       }
+      //     },
+      //     err => {console.log("API error : "+err);
             
-          }
-        )
-      // this.$router.push({
-			// 		name: "htMgtExam",
-			// 		params: {
-			// 			activity: activity
-			// 		}
-			// 	});
+      //     }
+      //   )
+      this.$router.push({
+					name: "htMgtExam",
+					params: {
+						activity: activity
+					}
+				});
     },
     //儲存新增/更新活動    
     saveNewEvent() {
@@ -412,8 +404,7 @@ export default {
       //console.log(item);
       const startTime = new Date(this.newActivity.time[0]);
       const endTime = new Date(this.newActivity.time[1]);
-      let tmdid = JSON.parse(decodeURIComponent(localStorage.getItem('t_userInfo'), "utf-8")).id;   
-      debugger   
+      let tmdid = JSON.parse(decodeURIComponent(localStorage.getItem('t_userInfo'), "utf-8")).id;         
       // 先新增/更新活動
       let dataEvent = {
         jointEventId: this.newActivity.id,
@@ -432,8 +423,7 @@ export default {
         // 新增/更新活動API
         this.$api.htcommunity.jointEventUpsert(dataEvent).then(
           async res => {
-            if (res.error == null) {
-              debugger
+            if (res.errCode === "") {              
               if (res.jointEvent.id) {//如果成功新增/更新活動 新增/更新組別                    
 
                 //#region 新增/更新組別
@@ -463,18 +453,16 @@ export default {
                         schedules: [
                         ]
                       };
-debugger
                       this.newActivity.planContent.forEach(item => {
-                        let pType = item.description === "報名時間" ? "join" : "exam";
-                        let pExamType = item.online ? "regular" : "custom";
+                        let pType = item.type === true ? "join" : "exam";
+                        let pExamType = item.type === true ? "" : (item.examType === true ? "regular" : "custom");
                         let pStartTime = new Date(item.schedule[0]);
                         let pEndTime = new Date(item.schedule[1]);
                         let upItem = {
                           id: item.id,
                           type: pType,
                           examType: pExamType,
-                          examOverwrite: item.evaluation, //評量可否重複作答 true:可 
-                          id: "", //行程ID 若給空值則會新增
+                          examOverwrite: item.evaluation, //評量可否重複作答 true:可                           
                           name: item.description, //行程名稱
                           startTime: pStartTime.getTime(),  //起始時間
                           endTime: pEndTime.getTime(), //結束時間
@@ -487,11 +475,14 @@ debugger
                       const apiCall2 = this.$api.htcommunity.jointScheduleUpsert(dataSchedule).then(
                         resSchedule => {
                           if (resSchedule.error == null) {
-                           
+                            this.resetNewActivity();
+                            this.showAddModal = false;
+                            this.getList();
+
                           } else {
                           }
                         },
-                        err => {
+                        err => {console.log("API error : "+err);
                         }
                       )
                       // #endregion
@@ -499,18 +490,18 @@ debugger
                     } else {
                     }
                   },
-                  err => {
+                  err => {console.log("API error : "+err);
                   }
                 )
                 // #endregion
              
               }
             } else {
-              r(res.error)
+              
             }
           },
-          err => {
-            j(err)
+          err => {console.log("API error : "+err);
+            
           }
         )
       } catch (e) {
@@ -518,9 +509,7 @@ debugger
       }
       finally {
         this.loading = false;
-        this.resetNewActivity();
-        this.showAddModal = false;
-        this.getList();
+       
       }
       
 
@@ -543,7 +532,7 @@ debugger
         ],
         requireOrderCompletion: false,
         planContent: [
-          { step: 1, schedule: [], description: '報名時間', online: false, evaluation: false }
+          {id:'', step: 1, schedule: [], description: '報名時間', type: true, examType: false, evaluation: false }
         ]
       };      
     },
@@ -552,16 +541,74 @@ debugger
       this.newActivity.groups.push({ groupName: '', groupJudge: '', valid:false });
     },
     //移除分組
-    removeGroup(index) {
-      this.newActivity.groups.splice(index, 1);
+    removeGroup(scope) {
+      this.$confirm('確定要刪除組別?', '提示', {
+        confirmButtonText: '確定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        try {
+          this.groupsLoading = true;
+          let param = {
+            jointEventId: this.newActivity.id,
+            groupId: scope.row.id
+          };
+          //  刪除統測活動分組API
+          this.$api.htcommunity.jointEventGroupDelete(param).then(
+            res => {
+              if (res.errCode === "") {
+                this.newActivity.groups.splice(scope.$index, 1);
+                this.groupsLoading = false;
+                // 重新取列表資料以防頁面顯示錯誤
+                this.getList();
+              } else {
+              }
+            },
+            err => { console.log("API error : " + err); }
+          )
+        } catch (error) {
+          console.log("API error : " + error);
+        } finally {
+        }       
+      }).catch(() => {       
+      }); 
     },
     //增加時程
     addPlanContent() {
-      this.newActivity.planContent.push({ step: this.newActivity.planContent.length + 1, schedule: [], description: '', online: false, evaluation: false });
+      this.newActivity.planContent.push({id:'', step: this.newActivity.planContent.length + 1, schedule: [], description: '', type: false, examType: false, evaluation: false });
     },
     //移除時程
-    removePlanContent(index) {
-      this.newActivity.planContent.splice(index, 1);
+    removePlanContent(scope) {      
+      this.$confirm('確定要刪除時程?', '提示', {
+        confirmButtonText: '確定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        try {
+          this.scheduleLoading = true;
+          let param = {
+            jointEventId: this.newActivity.id,
+            scheduleId: scope.row.id
+          };
+          //  刪除統測活動分組API
+          this.$api.htcommunity.jointScheduleDelete(param).then(
+            res => {
+              if (res.errCode === "") {
+                this.newActivity.planContent.splice(scope.$index, 1);
+                this.scheduleLoading = false;
+                // 重新取列表資料以防頁面顯示錯誤
+                this.getList();
+              } else {
+              }
+            },
+            err => { console.log("API error : " + err); }
+          )
+        } catch (error) {
+          console.log("API error : " + error);
+        } finally {
+        }       
+      }).catch(() => {       
+      });       
     }
   },
   created () {