loulijun2021
2022-08-23 b8ee668eaace5d422ebb27a200c3b178b82e2a6d
src/views/scgl/gd.vue
@@ -124,7 +124,7 @@
              <el-radio
                v-model="radioSelected"
                :label="row.wo_code"
                style="color: #fff;padding-left: 10px; margin-right: -25px;"
                style="color: transparent;padding-left: 10px; margin-right: -25px;"
                @change.native="getCurrentRow(row.wo_code)"
              />
            </template>
@@ -173,7 +173,12 @@
            label="产品规格"
            sortable="custom"
            width="110"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.partspec">{{ row.partspec }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="plan_qty"
            label="工单数"
@@ -185,26 +190,46 @@
            label="生产车间"
            sortable="custom"
            width="120"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.wkshp_name">{{ row.wkshp_name }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="route_name"
            label="工艺路线"
            sortable="custom"
            min-width="130"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.route_name">{{ row.route_name }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="plan_startdate"
            label="计划开始时间"
            sortable="custom"
            width="160"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.plan_startdate">{{ row.plan_startdate }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="plan_enddate"
            label="计划结束时间"
            sortable="custom"
            width="160"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.plan_enddate">{{ row.plan_enddate }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="piroque"
            label="工单等级"
@@ -215,6 +240,7 @@
              <div v-if="row.piroque==='1'">特级</div>
              <div v-if="row.piroque==='2'">紧急</div>
              <div v-if="row.piroque==='3'">正常</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
@@ -551,8 +577,15 @@
        <el-table-column
          prop="ng_qty"
          label="不良数量"
          fixed="right"
        />
        <el-table-column
          label="操作"
          fixed="right"
        >
          <template slot-scope="{row}">
            <el-button type="text" style="padding: 0;" @click="supplementSmallClick(row)">补打</el-button>
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
@@ -702,6 +735,70 @@
        </div>
      </span>
    </el-dialog>
    <!--打印预览页面  小标签-->
    <el-dialog
      title="预览"
      :visible.sync="dialogVisible2"
      width="1140"
      :close-on-click-modal="false"
      @close="dialogVisible2Close"
    >
      <!-- 要打印的区域 -->
      <div id="printMe2" style="padding: 30px;">
        <div
          style="display: flex;width: 250px;height: 150px;border: 1px solid #000;text-align: center;font-size: 10px;"
        >
          <div style="width: 60px;display: flex;flex-direction: column;border-right: 1px solid #000">
            <div
              style="display: flex;height: 75%;border-bottom:1px solid #000;
              justify-content: center;align-items: center;position: relative"
            >
              <div id="qrCode2" ref="qrCodeDiv2" style="overflow-y: hidden;height: 50px;position: absolute;left: 4px" />
            </div>
            <div style="display: flex;height: 25%;justify-content: flex-start;align-items: center">
              <div style="margin-left: 5px;width: 40px">数量:</div>
              {{ qrForm.startqty }}
            </div>
          </div>
          <div style="width:190px;display: flex;flex-direction: column">
            <div
              style="display: flex;height: 25%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center;text-align: left"
            >
              <div style="width: 60px;margin-left: 5px;">工单编号:</div>
              <div>{{ qrForm.wo_code }}</div>
            </div>
            <div
              style="display: flex;height: 25%;border-bottom:1px solid #000;justify-content: flex-start;align-items: center ;text-align: left"
            >
              <div style="width: 60px;margin-left: 5px;">产品编码:</div>
              <div>{{ qrForm.partcode }}</div>
            </div>
            <div
              style="display: flex;height: 25%;border-bottom:1px solid #000 ;justify-content: flex-start;align-items: center;text-align: left"
            >
              <div style="width:60px;margin-left: 5px;">产品名称:</div>
              <div>{{ qrForm.partname }}</div>
            </div>
            <div style="display: flex;height: 25%;justify-content: flex-start;align-items: center;text-align: left">
              <div style="width: 60px;margin-left: 5px;">下道工序:</div>
              <div>{{ qrForm.nextstepname }}</div>
            </div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
          <el-button @click="dialogVisible2 = false">取 消</el-button>
          <el-button v-print="printObj2" type="primary">确 定</el-button>
        </div>
      </span>
    </el-dialog>
  </div>
</template>
@@ -864,7 +961,37 @@
        routename: '',
        lm_date: ''
      },
      number: ''
      number: '',
      dialogVisible2: false,
      printObj2: {
        id: 'printMe2',
        popTitle: '打印模板',
        preview: false,
        extraHead: '<meta http-equiv="Content-Language" content="zh-cn"/>',
        closeCallback(vue) { // 关闭打印的回调事件(无法确定点击的是确认还是取消)
          console.log('11212', vue)
          // vue.dialogVisible = false
          vue.dialogVisible2 = false
          // vue.dialogVisible = false
        },
        beforeOpenCallback(vue) {
          vue.printLoading = true
          console.log('打开之前')
          console.log()
        },
        openCallback(vue) {
          vue.printLoading = false
          console.log('执行了打印')
        }
      },
      qrForm: {
        qrvalue: '',
        startqty: '',
        wo_code: '',
        partcode: '',
        partname: '',
        nextstepname: ''
      }
    }
  },
  created() {
@@ -1324,6 +1451,52 @@
    supplementClick() {
      this.dialogVisibleTask = false
      this.handlePrint()
    },
    // 补打小标签
    supplementSmallClick(row) {
      // let obj = {}
      this.taskTableData.forEach((item, index) => {
        if (item.seq === row.seq) {
          console.log(item)
          this.qrForm = {
            qrvalue: item.seq === this.taskTableData.length ? item.wo_code + ';' + item.stepcode : item.wo_code + ';' + this.taskTableData[item.seq].stepcode,
            startqty: item.seq === this.taskTableData.length ? item.plan_qty : this.taskTableData[item.seq].plan_qty,
            wo_code: item.wo_code,
            partcode: item.partcode,
            partname: item.partname,
            nextstepname: item.seq === this.taskTableData.length ? item.stepname : this.taskTableData[item.seq].stepname
          }
          this.$nextTick(() => {
            console.log(this.qrForm.qrvalue, 3333)
            this.bindQRCode2(this.qrForm.qrvalue)
          })
        }
      })
      // this.dialogVisibleTask = false
      this.dialogVisible2 = true
      console.log(this.qrForm, 1111)
    },
    dialogVisible2Close() {
      this.qrForm.qrvalue = ''
      this.qrForm.startqty = ''
      this.qrForm.wo_code = ''
      this.qrForm.partcode = ''
      this.qrForm.partname = ''
      this.qrForm.nextstepname = ''
      // this.$refs.qrCodeDiv2 = ''
    },
    // 生成二维码
    bindQRCode2(text) {
      new QRCode(this.$refs.qrCodeDiv2, {
        text: text,
        width: 50,
        height: 50,
        colorDark: '#000', // 二维码颜色
        colorLight: '#ffffff', // 二维码背景色
        correctLevel: QRCode.CorrectLevel.L// 容错率,L/M/H
      })
    }
  }