Browse Source

调整班主任和任课老师查看校本评测API

liqk 4 years ago
parent
commit
856c28951a

+ 10 - 8
TEAMModelOS/ClientApp/src/common/BaseLayout.vue

@@ -214,32 +214,34 @@
                         icon: 'iconfont icon-activityS',
                         name: this.$t('system.menu.scAc'),
                         router: '',
-                        role: 'admin',
-                        permission: 'schoolAc-read|schoolAc-upd',
+                        // role: 'admin',
+                        // permission: 'schoolAc-read|schoolAc-upd',
+                        role: 'teacher|admin',
+                        permission: '',
                         child: [
                             {
                                 icon: 'iconfont icon-test',
                                 name: this.$t('system.menu.scEv'),
                                 router: '/home/schoolEvaluation',
                                 tag: '*',
-                                role: 'admin',
-                                permission: 'schoolAc-read|schoolAc-upd'
+                                role: 'teacher|admin',
+                                permission: ''
                             },
                             {
                                 icon: 'iconfont icon-vote',
                                 name: this.$t('system.menu.scVote'),
                                 router: '/home/manageVote',
                                 tag: '*',
-                                role: 'admin',
-                                permission: 'schoolAc-read|schoolAc-upd'
+                                role: 'teacher|admin',
+                                permission: ''
                             },
                             {
                                 icon: 'iconfont icon-questionnaire',
                                 name: this.$t('system.menu.scQu'),
                                 router: '/home/manageQuestionnaire',
                                 tag: '*',
-                                role: 'admin',
-                                permission: 'schoolAc-read|schoolAc-upd'
+                                role: 'teacher|admin',
+                                permission: ''
                             },
                         ]
                     },

+ 39 - 16
TEAMModelOS/ClientApp/src/view/learnactivity/MgtPrivEva.vue

@@ -5,7 +5,17 @@
             <!--评测列表-->
             <div class="evaluation-list-wrap" slot="left">
                 <div class="evaluation-list-title">
-                    <span>{{$t('learnActivity.mgtScEv.listLabel')}}</span>
+                    <span v-if="!$store.state.userInfo.isHeadmaster">{{$t('learnActivity.mgtScEv.listLabel')}}</span>
+                    <Dropdown v-else class="sort-dropdown" trigger="click" placement="bottom-start" @on-click="function(e){ curEvValue = e }" @on-visible-change="dropdownStates">
+                        <span style="cursor: pointer;">
+                            <!-- {{$t('learnActivity.mgtScEv.period')}} -->
+                            <b class="title">{{ curEvLabel }}</b>
+                            <Icon type="ios-arrow-down" style="margin-left:8px;"></Icon>
+                        </span>
+                        <DropdownMenu slot="list" v-for="(item,index) in evFilter" :value="item.value" :key="index">
+                            <DropdownItem :name="item.value">{{ item.label }}</DropdownItem>
+                        </DropdownMenu>
+                    </Dropdown>
                     <Icon type="md-add" class=" to-create-icon" @click="goToCreate" :title="$t('learnActivity.mgtScEv.create')" />
                     <Icon type="md-trash" v-show="evaListShow.length" class="to-create-icon" :title="$t('learnActivity.mgtScEv.delete')" @click="deleteEvaluation" />
                     <Icon type="md-create" v-show="evaListShow.length && evaListShow[curEvaIndex].progress == 'pending'" class="to-create-icon" @click="editEvaluation" :title="$t('learnActivity.mgtScEv.edit')" />
@@ -98,6 +108,7 @@ export default {
     inject: ['reload'],
     data() {
         return {
+            curEvValue:0,
             split1: 0.2,
             scope: '',//school 校本 private 个人
             showBack: false,
@@ -109,15 +120,34 @@ export default {
             examDetaiInfo: {},
             targetList: [],
             isLoading: false,
-            filterPeriod: undefined,
             schoolBase: {
                 period: []
             },
+            evFilter:[
+                {
+                    label:'我发布的评测',
+                    value:0
+                },
+                {
+                    label:'数学评测',
+                    value:1
+                },
+                {
+                    label:'英语评测',
+                    value:2
+                }
+            ],
             scoreLoading: false,
             answerLoading: false
         }
     },
     methods: {
+        dropdownStates(flag) {
+            if (!flag) this.filterByTag()
+        },
+        filterByTag() {
+            this.curEvaIndex = 0
+        },
         // 模拟教师评分数据
         mockScoring() {
             this.scoreLoading = true
@@ -387,10 +417,6 @@ export default {
             (res) => {
                 if (res) {
                     this.schoolBase = res.school_base
-                    // 預設搜尋給第一個
-                    if (res.school_base.period && res.school_base.period.length) {
-                        this.filterPeriod = res.school_base.period[0].id
-                    }
                 }
             }
         ).finally(() => {
@@ -410,16 +436,13 @@ export default {
         }
     },
     computed: {
-        filterPeriodName: function () {
-            let pId = this.filterPeriod
-            let name = ''
-            if (pId) {
-                let temp = this.$store.state.user.schoolProfile.school_base.period.filter(item => {
-                    return pId == item.id
-                })
-                if (temp.length > 0) name = temp[0].name
-            }
-            return name
+        curEvLabel: function () {
+            let value = this.curEvValue
+            console.log(this.curEvValue)
+            let curObj = this.evFilter.find(item=>{
+                return item.value == value
+            })
+            return curObj.label
         },
     }
 }

+ 6 - 4
TEAMModelOS/ClientApp/src/view/learnactivity/MgtSchoolEva.vue

@@ -15,9 +15,9 @@
                             <DropdownItem :name="item.id">{{ item.name }}</DropdownItem>
                         </DropdownMenu>
                     </Dropdown>
-                    <Icon type="md-add" class=" to-create-icon" @click="goToCreate" :title="$t('learnActivity.mgtScEv.create')" />
-                    <Icon type="md-trash" v-show="evaListShow.length" class="to-create-icon" :title="$t('learnActivity.mgtScEv.delete')" @click="deleteEvaluation" />
-                    <Icon type="md-create" v-show="evaListShow.length && evaListShow[curEvaIndex] && evaListShow[curEvaIndex].progress == 'pending'" class="to-create-icon" @click="editEvaluation" :title="$t('learnActivity.mgtScEv.edit')" />
+                    <Icon type="md-add" class=" to-create-icon" @click="goToCreate" :title="$t('learnActivity.mgtScEv.create')" v-if="$access.can('admin.*|schoolAc-upd')"/>
+                    <Icon type="md-trash" v-show="evaListShow.length" class="to-create-icon" :title="$t('learnActivity.mgtScEv.delete')" @click="deleteEvaluation" v-if="$access.can('admin.*|schoolAc-upd')"/>
+                    <Icon type="md-create" v-show="evaListShow.length && evaListShow[curEvaIndex] && evaListShow[curEvaIndex].progress == 'pending'" class="to-create-icon" @click="editEvaluation" :title="$t('learnActivity.mgtScEv.edit')" v-if="$access.can('admin.*|schoolAc-upd')"/>
                 </div>
                 <div class="evaluation-list-main">
                     <vuescroll>
@@ -330,8 +330,10 @@ export default {
 
         //查询评测列表
         findEvaluation() {
+            console.log('123456',this.$access.hasRole('admin'))
             let requestData = {
-                code: this.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId
+                code: this.scope == 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
+                classIds:this.$access.hasRole('admin') ? undefined : this.$store.state.userInfo.teachClasses
             }
             this.$api.learnActivity.FindExamInfo(requestData).then(
                 res => {

+ 7 - 7
TEAMModelOS/Controllers/Common/ExamController.cs

@@ -218,18 +218,18 @@ namespace TEAMModelOS.Controllers
             {
                 if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
                 var query = $"select c.id,c.name,c.code,c.period,c.startTime,c.endTime,c.stuCount,c.type,c.progress,c.examType,c.createTime, c.subjects, c.grades, c.scope from c ";
-                if (!requert.TryGetProperty("classIds", out JsonElement classIds)) {
-
+                if (requert.TryGetProperty("classIds", out JsonElement classIds)) {
+                    List<string> ids = classIds.ToObject<List<string>>();
                     HashSet<string> strs = new HashSet<string>();
-                    if (classIds.GetArrayLength() > 1)
+                    if (ids.Count > 1)
                     {
-                        for (int i = 0;i< classIds.GetArrayLength();i++) {
-                            strs.Add($"array_contains(c.targetClassIds,'{classIds[i].ToJsonString()}')");
-                        }                       
+                        foreach (string id in ids) {
+                            strs.Add($"array_contains(c.targetClassIds,'{id}')");
+                        }                           
                     }
                     else
                     {
-                        string ssr = classIds.GetArrayLength() > 0 ? classIds[0].ToJsonString() : "";
+                        string ssr = ids.Count > 0 ? ids[0] : "";
                         strs.Add($"array_contains(c.targetClassIds,'{ssr}')");
                     }
                     string ss = string.Join(" or ", strs);