lrf402788946 4 роки тому
батько
коміт
6b06cd8ad1
2 змінених файлів з 23 додано та 2 видалено
  1. 17 2
      parts/print/certCard.vue
  2. 6 0
      store/student.js

+ 17 - 2
parts/print/certCard.vue

@@ -92,7 +92,7 @@ export default {
         // { label: '日常分数', prop: 'daily' },
         // { label: '日常分数', prop: 'daily' },
         // { label: '作业分数', prop: 'task' },
         // { label: '作业分数', prop: 'task' },
         // { label: '团队分数', prop: 'groupscore' },
         // { label: '团队分数', prop: 'groupscore' },
-        { label: '是否打印证书', prop: '' },
+        { label: '是否打印证书', prop: 'cert', format: i => (i === '1' ? '已打印' : '未打印') },
       ],
       ],
       beijingImage: require('@/assets/zhengshu.jpg'),
       beijingImage: require('@/assets/zhengshu.jpg'),
       // 证书列表
       // 证书列表
@@ -103,7 +103,7 @@ export default {
   },
   },
   created() {},
   created() {},
   methods: {
   methods: {
-    ...mapActions(['computedIsFine']),
+    ...mapActions(['computedIsFine', 'cert']),
     // 打印预览
     // 打印预览
     clickView() {
     clickView() {
       let certList = this.selectList;
       let certList = this.selectList;
@@ -128,6 +128,15 @@ export default {
       this.$set(this, `selectList`, data);
       this.$set(this, `selectList`, data);
     },
     },
     toPrint() {
     toPrint() {
+      this.$confirm('是否更改学生的打印证书状态为已打印?', '打印证书', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      })
+        .then(() => {
+          this.toConfirmCert();
+        })
+        .catch(() => {});
       this.$print(this.$refs.print);
       this.$print(this.$refs.print);
     },
     },
     // 結束時間
     // 結束時間
@@ -171,6 +180,12 @@ export default {
       }
       }
       return false;
       return false;
     },
     },
+    // 确认证书为已打印
+    async toConfirmCert() {
+      const ids = this.certList.map(i => i._id);
+      const res = await this.cert(ids);
+      this.$checkRes(res, '证书状态修改成功', res.errmsg || '证书状态修改失败');
+    },
   },
   },
   computed: {
   computed: {
     ...mapState(['user', 'defaultOption']),
     ...mapState(['user', 'defaultOption']),

+ 6 - 0
store/student.js

@@ -14,6 +14,7 @@ const api = {
   batUpdateBedroom: `/api/train/student/updatabedroom`,
   batUpdateBedroom: `/api/train/student/updatabedroom`,
   computedIsFine: `/api/train/student/finestudent`,
   computedIsFine: `/api/train/student/finestudent`,
   export: `/api/train/student/export`,
   export: `/api/train/student/export`,
+  printCert: `/api/train/student/printcert`,
 };
 };
 const state = () => ({});
 const state = () => ({});
 const mutations = {};
 const mutations = {};
@@ -76,6 +77,11 @@ const actions = {
     const res = await this.$axios.$post(`${api.export}`, payload);
     const res = await this.$axios.$post(`${api.export}`, payload);
     return res;
     return res;
   },
   },
+  // 修改学生证书状态
+  async cert({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.printCert}`, { ids: payload });
+    return res;
+  },
   async mergeRequest({ commit, dispatch }, { method, data }) {
   async mergeRequest({ commit, dispatch }, { method, data }) {
     let toRequest = () => {
     let toRequest = () => {
       let res = [];
       let res = [];