lrf402788946 4 years ago
parent
commit
835a37c705
2 changed files with 10 additions and 4 deletions
  1. 7 2
      src/views/class/index.vue
  2. 3 2
      src/views/class/newClass/daily.vue

+ 7 - 2
src/views/class/index.vue

@@ -26,7 +26,7 @@
               ></classGroup>
               ></classGroup>
             </el-tab-pane>
             </el-tab-pane>
             <el-tab-pane label="平时成绩" name="third">
             <el-tab-pane label="平时成绩" name="third">
-              <daily :data="studentList" :scoreList="pscoreList" :classInfo="classInfo" :lesson="lesson"></daily>
+              <daily :data="studentList" :scoreList="pscoreList" :classInfo="classInfo" :lesson="lesson" @save="dailyUpdate"></daily>
             </el-tab-pane>
             </el-tab-pane>
             <el-tab-pane label="作业成绩" name="forth"></el-tab-pane>
             <el-tab-pane label="作业成绩" name="forth"></el-tab-pane>
           </el-tabs>
           </el-tabs>
@@ -101,7 +101,7 @@ export default {
   methods: {
   methods: {
     ...util({ modelFetch: 'fetch' }),
     ...util({ modelFetch: 'fetch' }),
     ...classes({ getClassInfo: 'fetch' }),
     ...classes({ getClassInfo: 'fetch' }),
-    ...pscore({ getPScoreList: 'query' }),
+    ...pscore({ getPScoreList: 'query', pscoreOpera: 'opera' }),
     ...group({ groupQuery: 'query', groupDelete: 'delete', groupCreate: 'create', groupUpdate: 'update', groupInsert: 'insert', groupExit: 'exit' }),
     ...group({ groupQuery: 'query', groupDelete: 'delete', groupCreate: 'create', groupUpdate: 'update', groupInsert: 'insert', groupExit: 'exit' }),
     ...student({ getStudentList: 'query', updateStudent: 'update' }),
     ...student({ getStudentList: 'query', updateStudent: 'update' }),
     async getClass() {
     async getClass() {
@@ -232,6 +232,11 @@ export default {
       const res = await this.getPScoreList({ classid: this.user.classid });
       const res = await this.getPScoreList({ classid: this.user.classid });
       if (this.$checkRes(res)) this.$set(this, `pscoreList`, res.data);
       if (this.$checkRes(res)) this.$set(this, `pscoreList`, res.data);
     },
     },
+    // third 平时分保存(添加/修改)
+    async dailyUpdate(data) {
+      const res = await this.pscoreOpera(data);
+      if (this.$checkRes(res, '修改成功', res.errmsg || '修改失败')) this.toGetPScoreList();
+    },
     tabchange(tab) {
     tabchange(tab) {
       const { name } = tab;
       const { name } = tab;
       if (name === 'third') this.toGetPScoreList();
       if (name === 'third') this.toGetPScoreList();

+ 3 - 2
src/views/class/newClass/daily.vue

@@ -2,7 +2,7 @@
   <div id="daily">
   <div id="daily">
     <van-notice-bar color="#1989fa" background="#ecf9ff" left-icon="info-o" text="点击查看每天的评分" />
     <van-notice-bar color="#1989fa" background="#ecf9ff" left-icon="info-o" text="点击查看每天的评分" />
     <van-cell v-for="(stu, index) in data" :key="index" :title="stu.name" :value="getScore(stu.id)" @click="searchDailyList(stu)" />
     <van-cell v-for="(stu, index) in data" :key="index" :title="stu.name" :value="getScore(stu.id)" @click="searchDailyList(stu)" />
-    <van-dialog v-model="show" :show-confirm-button="user.job.includes(limitJob)" @confirm="toSave">
+    <van-dialog v-model="show" :show-confirm-button="user.job.includes(limitJob)" :show-cancel-button="user.job.includes(limitJob)" @confirm="toSave">
       <template #title>
       <template #title>
         <van-row style="padding:15px 0;" type="flex" justify="center">
         <van-row style="padding:15px 0;" type="flex" justify="center">
           <van-col span="8">{{ form.name }}</van-col>
           <van-col span="8">{{ form.name }}</van-col>
@@ -13,7 +13,7 @@
       </template>
       </template>
       <van-notice-bar v-if="user.job.includes(limitJob)" color="#1989fa" background="#ecf9ff" left-icon="info-o" text="学委可以添加/修改平时分数" />
       <van-notice-bar v-if="user.job.includes(limitJob)" color="#1989fa" background="#ecf9ff" left-icon="info-o" text="学委可以添加/修改平时分数" />
       <template v-if="user.job === '班长'">
       <template v-if="user.job === '班长'">
-        <van-field v-for="(i, index) in dailyList" :key="index" :v-model="i.score" colon type="number" :label="i.date" placeholder="请输入平时分数" border />
+        <van-field v-for="(i, index) in dailyList" :key="index" v-model="i.score" colon type="number" :label="i.date" placeholder="请输入平时分数" border />
       </template>
       </template>
       <template v-else>
       <template v-else>
         <van-cell v-for="(i, index) in dailyList" :key="index" :title="i.date" :value="i.score" />
         <van-cell v-for="(i, index) in dailyList" :key="index" :title="i.date" :value="i.score" />
@@ -89,6 +89,7 @@ export default {
     },
     },
     toSave() {
     toSave() {
       console.log(this.dailyList);
       console.log(this.dailyList);
+      this.$emit('save', _.cloneDeep(this.dailyList));
     },
     },
   },
   },
   computed: {
   computed: {