hdy
2024-05-12 5eda9ebc27193dfdbe5941499bf213815d1e98f6
点位订阅
已修改3个文件
56 ■■■■ 文件已修改
jcdm-ui/package.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/bs/workshop/index.vue 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package-lock.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/package.json
@@ -49,7 +49,7 @@
    "js-cookie": "3.0.1",
    "jsencrypt": "3.0.0-rc.1",
    "nprogress": "0.2.0",
    "qrcode": "^1.5.3",
    "qrcodejs2": "^0.0.2",
    "quill": "1.3.7",
    "screenfull": "5.0.2",
    "sortablejs": "1.10.2",
@@ -57,7 +57,6 @@
    "vue-count-to": "1.0.13",
    "vue-cropper": "0.5.5",
    "vue-meta": "2.4.0",
    "vue-qr": "^4.0.9",
    "vue-router": "3.4.9",
    "vuedraggable": "2.24.3",
    "vuex": "3.6.0"
jcdm-ui/src/views/main/bs/workshop/index.vue
@@ -28,11 +28,11 @@
<!--      </el-form>-->
      <div>
        <div id="printMe">
          <div ref="canvasWrapper"></div>
          <div ref="canvasWrapper" id="canvasWrapper"></div>
          <p>1111</p>
        </div>
        <button @click="print">打印</button>
        <button @click="test1">生成二维码</button>
        <el-button @click="print">打印</el-button>
        <el-button @click="test1">生成二维码</el-button>
      </div>
    </el-card>
@@ -176,7 +176,7 @@
</template>
<script>
import QRCode from 'qrcode'
import QRCode from 'qrcodejs2'
import { listWorkshop, getWorkshop, delWorkshop, addWorkshop, updateWorkshop } from "@/api/main/bs/workshop/workshop";
export default {
@@ -234,32 +234,35 @@
  },
  created() {
    this.getList();
    this.test1();
    // this.test1();
  },
  methods: {
    print() {
      // 本页面直接打印(有bug单岁先不要删)
      // let oldStr = window.document.body.innerHTML;
      // let newStr = document.getElementById('printMe').innerHTML;
      // document.body.innerHTML = newStr;
      // window.print();
      // document.body.innerHTML = oldStr;
      // return false;
      let printMe = document.querySelector('#printMe');
      let printWindow = window.open('', '_blank');
      printWindow.document.write(printMe.innerHTML);
      printWindow.document.close();
      printWindow.focus();
      printWindow.print();
      printWindow.close();
      // 新开页面打印
      let newStr = document.getElementById('printMe').innerHTML;
      let newWin = window.open('', '_blank');
      newWin.document.body.innerHTML = newStr;
      newWin.print();
      return false;
    },
    test1(){
      QRCode.toCanvas(this.text, {
        width: 40,
        // height: 40,
        margin: 1,
      }, (error, canvas) => {
        if (error) {
          console.error(error)
          return
        }
        // 在canvas的父元素中插入canvas元素
        this.$refs.canvasWrapper.appendChild(canvas)
      document.getElementById('canvasWrapper').innerHTML = '';
      this.$nextTick(() => {
        let qrCode = new QRCode('canvasWrapper',{
          width: 50,
          height: 50,
          text: this.text,
          colorDark: '#000',
          colorLight: '#fff'
        })
      })
    },
    advancedQuery(){
package-lock.json
@@ -1,5 +1,5 @@
{
  "name": "Jcdm-Mes",
  "name": "Jcdm042-Mes",
  "lockfileVersion": 2,
  "requires": true,
  "packages": {}