guhongwei 4 年之前
父节点
当前提交
65adf593ce
共有 1 个文件被更改,包括 20 次插入12 次删除
  1. 20 12
      parts/print/certCard.vue

+ 20 - 12
parts/print/certCard.vue

@@ -7,7 +7,7 @@
             <el-button type="primary" size="mini" @click="clickView()"> 打印预览</el-button>
           </el-col>
           <el-col :span="24">
-            <data-table :fields="fields" :data="list" :opera="opera" :usePage="false"></data-table>
+            <data-table :fields="fields" :select="true" @handleSelect="handleSelect" :data="list" :opera="opera" :usePage="false"></data-table>
           </el-col>
         </el-col>
       </span>
@@ -87,23 +87,31 @@ export default {
       beijingImage: require('@/assets/zhengshu.jpg'),
       // 证书列表
       certList: [],
+      // 选择学生的列表
+      selectList: [],
     };
   },
   created() {},
   methods: {
     // 打印预览
     clickView() {
-      this.display = 'listView';
-      let certList = this.list;
-      let end_date = { end_date: moment(this.enddate).format('YYYY  年  MM  月 DD  日') };
-      let year = this.startdate.substring(0, 4);
-      let month = this.startdate.substring(5, 7);
-      for (const val of certList) {
-        val.year = year;
-        val.month = month;
-      }
-      console.log(certList);
-      this.$set(this, `certList`, certList);
+      let certList = this.selectList;
+      if (certList.length == 0) {
+        alert('選擇');
+      } else {
+        this.display = 'listView';
+        let end_date = { end_date: moment(this.enddate).format('YYYY  年  MM  月 DD  日') };
+        let year = this.startdate.substring(0, 4);
+        let month = this.startdate.substring(5, 7);
+        for (const val of certList) {
+          val.year = year;
+          val.month = month;
+        }
+        this.$set(this, `certList`, certList);
+      }
+    },
+    handleSelect(data) {
+      this.$set(this, `selectList`, data);
     },
     toPrint() {
       this.$print(this.$refs.print);