lrf402788946 5 年之前
父節點
當前提交
11be2848ec
共有 3 個文件被更改,包括 118 次插入56 次删除
  1. 6 37
      src/router/index.js
  2. 80 0
      src/views/receive/index.vue
  3. 32 19
      src/views/train-plan/remind.vue

+ 6 - 37
src/router/index.js

@@ -416,43 +416,12 @@ const routes = [
         name: 'test_detail',
         component: () => import('@/views/test/detail.vue'),
       },
-
-      // {
-      //   path: '/plan/index',
-      //   name: 'plan_index',
-      //   meta: { title: '计划', sub: '管理' },
-      //   component: () => import('@/views/plan/index.vue'),
-      // },
-      // {
-      //   path: '/plan/detail',
-      //   name: 'plan_detail',
-      //   meta: { title: '计划', sub: '详情' },
-      //   component: () => import('@/views/plan/detail.vue'),
-      // },
-      // {
-      //   path: '/plan/classes',
-      //   name: 'plan_classes',
-      //   meta: { title: '安排', sub: '班级' },
-      //   component: () => import('@/views/plan/classes.vue'),
-      // },
-      // {
-      //   path: '/plan/lesson',
-      //   name: 'plan_lesson',
-      //   meta: { title: '安排', sub: '课程' },
-      //   component: () => import('@/views/plan/lesson.vue'),
-      // },
-      // {
-      //   path: '/plan/msg',
-      //   name: 'plan_msg',
-      //   meta: { title: '发送', sub: '通知' },
-      //   component: () => import('@/views/plan/msg.vue'),
-      // },
-      // {
-      //   path: '/plan/question',
-      //   name: 'plan_question',
-      //   meta: { title: '问卷', sub: '管理' },
-      //   component: () => import('@/views/plan/question.vue'),
-      // },
+      {
+        path: '/receive/index',
+        name: 'receive_index',
+        meta: { title: '通知查看' },
+        component: () => import('@/views/receive/index.vue'),
+      },
     ],
   },
   {

+ 80 - 0
src/views/receive/index.vue

@@ -0,0 +1,80 @@
+<template>
+  <div id="receive">
+    <detail-frame :title="pageTitle" v-if="view == 'list'">
+      <data-table :fields="fields" :data="list" :opera="opera" :usePage="true" :total="total" @query="search" @view="toView"></data-table>
+    </detail-frame>
+    <detail-frame :title="pageTitle" :returns="toReturns" v-else>
+      <el-table :data="detail" size="mini" border stripe>
+        <el-table-column align="center" label="名称" prop="name"></el-table-column>
+        <el-table-column align="center" label="是否查看">
+          <template v-slot="{ row }">
+            <span :style="`color:${row.status == 0 ? '#F56C6C' : '#409EFF'}`">
+              {{ row.status == 0 ? '未查看' : '已查看' }}
+            </span>
+          </template>
+        </el-table-column>
+      </el-table>
+    </detail-frame>
+  </div>
+</template>
+
+<script>
+import _ from 'lodash';
+import dataTable from '@frame/components/filter-page-table';
+import detailFrame from '@frame/layout/admin/detail-frame';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: notice } = createNamespacedHelpers('notice');
+
+export default {
+  name: 'receive',
+  props: {},
+  components: { dataTable, detailFrame },
+  data: function() {
+    return {
+      view: 'list',
+      list: [],
+      total: 0,
+      opera: [
+        {
+          label: '查看接收情况',
+          icon: 'el-icon-view',
+          method: 'view',
+        },
+      ],
+      fields: [{ label: '信息内容', prop: 'content', showTip: true }],
+      detail: [],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...notice(['query']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let res = await this.query({ skip, limit, ...info, noticeid: this.user.userid });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    toView({ data }) {
+      this.$set(this, `detail`, data.notified);
+      this.view = 'detail';
+    },
+    toReturns() {
+      this.view = 'list';
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 32 - 19
src/views/train-plan/remind.vue

@@ -1,11 +1,11 @@
 <template>
   <div id="remind">
     <detail-frame :title="pageTitle">
-      <!-- <el-row type="flex" align="middle" justify="end" class="btn_bar">
+      <el-row type="flex" align="middle" justify="end" class="btn_bar">
         <el-col :span="2">
-          <el-button type="primary" size="mini" @click="sendMsg()">发送本期通知</el-button>
+          <el-button type="primary" size="mini" @click="toSendMsg()">发送本期通知</el-button>
         </el-col>
-      </el-row> -->
+      </el-row>
       <data-table :fields="fields" :data="list" :opera="opera" @msg="toSendMsg" @view="toView" :usePage="false"></data-table>
     </detail-frame>
     <el-dialog title="通知内容" :visible.sync="dialogSend">
@@ -70,8 +70,9 @@ export default {
       }
     },
     // 通知打开
-    toSendMsg({ data }) {
-      this.$set(this, `classid`, data.id);
+    toSendMsg({ data } = {}) {
+      console.log(data);
+      if (data) this.$set(this, `classid`, data.id);
       this.dialogSend = true;
     },
     // 取消提交
@@ -82,22 +83,34 @@ export default {
     // 通知确定
     async submitForm({ data }) {
       let classid = this.classid;
-      let r = await this.classNameList(classid);
-      let elseList = [];
-      let res = await this.getStudentList({ classid });
-      var notified = res.data.map(item => ({ notifiedid: item.id }));
-      let rl = await this.modelFetch({ model: 'lesson', classid });
-      if (_.get(rl, `data`)) {
-        let { lessons } = _.get(rl, `data`);
-        elseList = _.uniq(_.compact(lessons.map(i => i.teaid)));
+      let dealData = data => {
+        let { students, teachers } = data;
+        students = students.map(item => ({ notifiedid: item.id }));
+        teachers = teachers.map(item => ({ notifiedid: item.id }));
+        let arr = [...students, ...teachers];
+        return arr;
+      };
+      //如果classid为空,就说明是本期发送,应该把每个班的人都拽出来发送
+      if (classid) {
+        let r = await this.classNameList(classid);
+        if (!r.errcode != 0) return;
+        data.notified = dealData(r.data);
+      } else {
+        let classids = this.list.map(i => i._id);
+        let rarr = [];
+        for (const classid of classids) {
+          let r = await this.classNameList(classid);
+          if (!r.errcode != 0) continue;
+          let arr = dealData(r.data);
+          rarr = [...rarr, ...arr];
+        }
+        data.notified = rarr;
       }
-      if (_.get(data, 'headteacherid')) elseList.push(_.get(data, 'headteacherid'));
-      if (_.get(data, 'lyteacherid')) elseList.push(_.get(data, 'lyteacherid'));
-      elseList = elseList.map(i => ({ notifiedid: i }));
-      data.noticeid = this.user.id;
-      data.notified = [...notified, ...elseList];
+      data.noticeid = this.user.userid;
+      let { planyearid, planid, termid } = this.defaultOption;
+      data = { ...data, planyearid, planid, termid };
       const arr = await this.noticeCreate(data);
-      if (this.$checkRes(res)) {
+      if (this.$checkRes(arr)) {
         this.$message({
           message: '通知成功',
           type: 'success',