zhouwx
2025-01-13 d7620e8613678ee38cdfd02c6b647d4fe6e1411f
src/views/onlineEducation/classCertManage/index.vue
@@ -25,6 +25,7 @@
        style="margin-left: 30px;"
      >
      </el-date-picker>
      <el-input size="small" style="margin-left: 30px;width: 200px" v-model="queryParams.idcard" placeholder="请输入身份证号"></el-input>
      <el-select v-model="queryParams.institutionName"  size="small" style="margin-left: 40px;" placeholder="请选择平台">
        <el-option
          v-for="item in platformList"
@@ -69,7 +70,7 @@
        <template #default="scope">
          <el-button size="mini" type="text" style="color: #1890ff" @click="viewPic(scope.row)">查看</el-button>
          <el-button size="mini" type="text" style="color: #1890ff" @click="downloadByBlob(scope.row)">下载</el-button>
          <el-button size="mini" type="text" style="color: #1890ff">打印</el-button>
          <el-button size="mini" type="text" style="color: #1890ff" @click="print(scope.row)">打印</el-button>
        </template>
      </el-table-column>
    </el-table>
@@ -92,10 +93,26 @@
        </el-image>
      </div>
    </el-dialog>
    <el-dialog
      :visible.sync="printDialog"
      width="500px"
      :before-close="handlePrintClose">
      <div style="display: flex;flex-direction: column;align-items: flex-end">
        <el-button type="primary" style="margin-bottom: 5px" v-print="'#printPic'">打印</el-button>
      </div>
      <div style="display: flex;justify-content: center" ref="printPic" id="printPic">
        <el-image
          style="width: 85%; height: auto;margin-top: 10px"
          :src="printUrl"
          >
        </el-image>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import { listBatch, listQuestion } from '@/api/onlineEducation/student'
import { listPlatSelect } from '@/api/onlineEducation/plat'
import moment from 'moment/moment'
@@ -120,6 +137,7 @@
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        idcard: '',
        institutionName: '',
        startTime: '',
        endTime: '',
@@ -128,17 +146,34 @@
      trainOrgList: [],
      jsonData: [],
      json_fields: {
        ID: "id",
        姓名: "name",
        身份证号: "idcard",
        推送平台: "institutionName",
        所属机构: "trainOrgName",
        批次: "batchName",
        证书生成时间: "certTime",
        'ID': {
          field: 'id',
          callback: value => {
            return '&nbsp;'+value
          }
        },
        '姓名': "name",
        '身份证号': {
          field: 'idcard',
          callback: value => {
            return '&nbsp;'+value
          }
        },
        '推送平台': "institutionName",
        '所属机构': {
          field: 'trainOrgName',
          callback: value => {
            return '&nbsp;'+value
          }
        },
        '批次': "batchName",
        '证书生成时间': "certTime",
      },
      picDialog: false,
      viewUrl: '',
      srcList: []
      srcList: [],
      printDialog: false,
      printUrl: '',
    };
  },
  created() {
@@ -209,6 +244,7 @@
        pageNum: 1,
        pageSize: 10,
        institutionName: '',
        idcard: '',
        startTime: '',
        endTime: '',
        trainOrgName: ''
@@ -225,6 +261,15 @@
      this.viewUrl = ''
      // this.srcList = []
      this.picDialog = false
    },
    handlePrintClose() {
      this.printUrl = ''
      this.printDialog = false
    },
    print(val){
      this.printUrl = val.certUrl
      this.printDialog = true
    },
    downloadByBlob(val) {
      let image = new Image()
@@ -254,3 +299,12 @@
  }
};
</script>
<style media="printPic" scoped>
@page {
  margin: 0; /* this affects the margin in the printer settings */
  display: block;
  width: 100%;
  overflow: hidden;
}
</style>