lrf402788946 vor 4 Jahren
Ursprung
Commit
8bbb8cda78
6 geänderte Dateien mit 155 neuen und 5 gelöschten Zeilen
  1. 0 1
      src/main.js
  2. 1 0
      src/router/index.js
  3. 41 3
      src/store/index.js
  4. 1 0
      src/views/index.vue
  5. 106 0
      src/views/question/dir/dir-quest.vue
  6. 6 1
      src/views/question/index.vue

+ 0 - 1
src/main.js

@@ -12,7 +12,6 @@ import '@/plugins/loading';
 import '@/plugins/setting';
 import InitStomp from '@/plugins/stomp';
 import moment from 'moment';
-moment.lang('zh-cn');
 Vue.prototype.$moment = moment;
 Vue.config.productionTip = false;
 

+ 1 - 0
src/router/index.js

@@ -47,6 +47,7 @@ const router = new VueRouter({
 
 router.beforeEach((to, form, next) => {
   store.commit('setUser');
+  store.commit('setClass');
   let user = store.state.user;
   if (user) {
     console.log('已登录');

+ 41 - 3
src/store/index.js

@@ -4,15 +4,37 @@ import login from '@frame/store/login';
 import trainplan from '@frame/store/trainplan';
 import classes from '@frame/store/classes';
 import director from '@frame/store/director';
-import lesson from "@frame/store/lesson";
+import lesson from '@frame/store/lesson';
+import dirPlan from '@frame/store/dir-plan';
+import location from '@frame/store/location';
+import teacher from '@frame/store/teacher';
+import dept from '@frame/store/dept';
+import subject from '@frame/store/subject';
+import teaPlan from '@frame/store/tea-plan';
+import student from '@frame/store/student';
+import completion from '@frame/store/question-completion';
+import nation from '@frame/store/nation';
+import school from '@frame/store/school';
+import termquest from '@frame/store/termquest';
+import questionnaire from '@frame/store/questionnaire';
+import bedroom from '@frame/store/bedroom';
+import util from '@frame/store/util';
+import attendance from '@frame/store/attendance';
+import leave from '@frame/store/leave';
 
 import * as ustate from '@frame/store/user/state';
 import * as umutations from '@frame/store/user/mutations';
 Vue.use(Vuex);
 
 export default new Vuex.Store({
-  state: { ...ustate },
-  mutations: { ...umutations },
+  state: { ...ustate, classid: undefined },
+  mutations: {
+    ...umutations,
+    setClass(state) {
+      let classid = sessionStorage.getItem('classid');
+      if (classid) state.classid = classid;
+    },
+  },
   actions: {},
   modules: {
     trainplan,
@@ -20,5 +42,21 @@ export default new Vuex.Store({
     classes,
     director,
     lesson,
+    dirPlan,
+    location,
+    teacher,
+    dept,
+    subject,
+    teaPlan,
+    student,
+    completion,
+    nation,
+    school,
+    termquest,
+    questionnaire,
+    bedroom,
+    util,
+    attendance,
+    leave,
   },
 });

+ 1 - 0
src/views/index.vue

@@ -15,6 +15,7 @@
           <span v-else>
             <el-col :span="24" class="list" v-for="(item, index) in classList" :key="index" @click.native="classBtn(item.id)">
               <p>班级时间:{{ item.startdate }}~{{ item.enddate }}</p>
+              <p>第{{ item.term }}期-第{{ item.batch }}批</p>
               <p>
                 班级名称:{{ item.name }}<span style="margin-left:20px;">班级人数:{{ item.number }}</span>
               </p>

+ 106 - 0
src/views/question/dir/dir-quest.vue

@@ -0,0 +1,106 @@
+<template>
+  <div id="dir-quest">
+    <template v-if="view == 'list'">
+      <el-card style="margin:10px" v-for="(i, index) in questList" :key="index" @click.native="toDetail(i, 'detail')">
+        <p>{{ i.name }}</p>
+        <p>类型:{{ i.type == 0 ? '常用问卷' : '非常用问卷' }}</p>
+      </el-card>
+    </template>
+    <template v-else>
+      <el-row>
+        <el-col :span="3" style="margin:5px 10px">
+          <el-button type="text" size="mini" icon="el-icon-arrow-left" @click="view = 'list'">返回</el-button>
+        </el-col>
+      </el-row>
+      <van-panel title="进度" :status="`${student.answertotal || 0}/${student.alltotal || 0}`">
+        <van-cell-group>
+          <van-cell v-for="(i, index) in student.list" :key="index" :title="i.name" :value="i.completion" />
+        </van-cell-group>
+      </van-panel>
+    </template>
+  </div>
+</template>
+
+<script>
+import _ from 'lodash';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: completion } = createNamespacedHelpers('completion');
+const { mapActions: classes } = createNamespacedHelpers('classes');
+const { mapActions: termquest } = createNamespacedHelpers('termquest');
+const { mapActions: questionnaire } = createNamespacedHelpers('questionnaire');
+const { mapActions: util } = createNamespacedHelpers('util');
+export default {
+  name: 'dir-quest',
+  props: {},
+  components: {},
+  data: function() {
+    return {
+      view: 'list', //detail
+      questList: [],
+      classInfo: {},
+      student: {
+        list: [],
+      },
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...completion({ getCompletion: 'query' }),
+    ...classes({ getClass: 'fetch' }),
+    ...termquest({ getTermQuestList: 'query' }),
+    ...questionnaire({ getQuestionnaireList: 'query', allFetch: 'mergeRequest' }),
+    ...util({ modelFetch: 'fetch' }),
+    async search() {
+      //查询班级信息,获得期,批次
+      let res = await this.getClass(this.classid);
+      if (!this.$checkRes(res)) {
+        this.$notify({ type: 'danger', message: '没有查询到班级' });
+        return;
+      } else this.$set(this, `classInfo`, res.data);
+      let ql = [];
+      //查询所有问卷
+      const quest = await this.getQuestionnaireList({ type: 0 });
+      if (this.$checkRes(quest)) {
+        ql = ql.concat(quest.data);
+      }
+      //查询这期的所有问卷,id=>数据
+      let rql = await this.modelFetch({ model: 'termquest', termid: res.data.termid });
+      if (this.$checkRes(rql)) {
+        let ids = _.get(rql.data, `questionnaireid`);
+        if (ids) {
+          let questList = await this.allFetch({ method: 'fetch', data: ids });
+          ql = ql.concat(questList.filter(f => f.status == 1));
+        }
+      }
+      this.$set(this, `questList`, ql);
+    },
+    async toDetail(data, type) {
+      this.view = type;
+      let { id: questionnaireid } = data;
+      let { id: batch } = this.classInfo;
+      let res = await this.getCompletion({ type: '2', typeid: batch, questionnaireid });
+      if (this.$checkRes(res)) {
+        let { data: completion, answertotal, alltotal, completiontotal } = res;
+        completion = completion.map(i => {
+          i.completion.includes('NaN') ? (i.completion = '-') : '';
+          return i;
+        });
+        this.$set(this, `student`, { list: completion, answertotal, alltotal, completiontotal });
+      }
+    },
+  },
+  computed: {
+    ...mapState(['user', 'classid']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 6 - 1
src/views/question/index.vue

@@ -6,7 +6,7 @@
           <NavBar v-show="navShow" :title="title" :isleftarrow="isleftarrow"> </NavBar>
         </el-col>
         <el-col :span="24" class="main">
-          調查問卷
+          <dir-quest v-if="user.type == 1"></dir-quest>
         </el-col>
         <el-col :span="24" class="foot">
           <footInfo></footInfo>
@@ -17,15 +17,20 @@
 </template>
 
 <script>
+import dirQuest from './dir/dir-quest.vue';
 import NavBar from '@/layout/common/topInfo.vue';
 import footInfo from '@/layout/common/footInfo.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
   name: 'index',
   props: {},
   components: {
     NavBar,
     footInfo,
+    dirQuest,
   },
   data: function() {
     return {