loulijun2021
2023-03-08 447af08b0fc2fe0050d361746b2449e3d376ee5b
src/views/scgl/sckbg.vue
@@ -297,7 +297,7 @@
                sortable="custom"
              />
              <el-table-column
                label="未报工数量"
                label="未收料数量"
                width="120"
              >
                <!--                sortable="custom"-->
@@ -490,7 +490,7 @@
      :visible.sync="dialogVisible"
      width="850px"
      class="dialogVisible"
      :top="dialogTitle==='自制报工'?'5vh':'15vh'"
      top="15vh"
      :close-on-click-modal="false"
      @close="handleClose"
      @closed="handleClose"
@@ -550,6 +550,7 @@
            v-model="dialogForm.eqpcode"
            style="width: 200px;"
            placeholder="请选择"
            filterable
          >
            <el-option
              v-for="item in ZZeqpArr"
@@ -563,25 +564,58 @@
        <el-form-item v-if="dialogTitle==='自制报工'" label="下道工序:">
          <div style="width: 200px">{{ dialogForm.nextstepname }}</div>
        </el-form-item>
        <el-form-item v-if="dialogTitle==='自制报工'" prop="usergroupcode" label="生产班组:">
        <!--        <el-form-item  v-if="dialogTitle==='自制报工'" prop="productionType" label="生产类型:">-->
        <!--          <el-select-->
        <!--            v-model="dialogForm.productionType"-->
        <!--            style="width: 200px;"-->
        <!--            placeholder="请选择"-->
        <!--            @change="usergroupChange111"-->
        <!--          >-->
        <!--            <el-option-->
        <!--              v-for="item in productionTypeSelect"-->
        <!--              :key="item.code"-->
        <!--              :label="item.name"-->
        <!--              :value="item.code"-->
        <!--            />-->
        <!--          </el-select>-->
        <!--        </el-form-item>-->
        <!--        <el-form-item v-if="dialogTitle==='自制报工'" :prop="dialogForm.productionType==='personal'?'':'usergroupcode'" label="生产班组:">-->
        <!--          <el-select-->
        <!--            v-model="dialogForm.usergroupcode"-->
        <!--            style="width: 200px;"-->
        <!--            placeholder="请选择"-->
        <!--            @change="usergroupChange"-->
        <!--          >-->
        <!--            <el-option-->
        <!--              v-for="item in ZZtreams"-->
        <!--              :key="item.group_code"-->
        <!--              :label="item.group_name"-->
        <!--              :value="item.group_code"-->
        <!--            />-->
        <!--          </el-select>-->
        <!--        </el-form-item>-->
        <el-form-item v-if="dialogTitle==='自制报工'" prop="productionType" label="报工人员:">
          <el-select
            v-model="dialogForm.usergroupcode"
            v-model="dialogForm.reportuser"
            style="width: 200px;"
            placeholder="请选择"
            @change="usergroupChange"
            filterable
          >
            <el-option
              v-for="item in ZZtreams"
              :key="item.group_code"
              :label="item.group_name"
              :value="item.group_code"
              v-for="item in ZZuserArr"
              :key="item.usercode"
              :label="item.username+' / '+item.usercode"
              :value="item.usercode"
            />
          </el-select>
        </el-form-item>
        <el-form-item v-if="dialogTitle==='自制报工'" label="设备名称:" prop="eqpcode">
          <el-select
            v-model="dialogForm.eqpcode"
            style="width: 200px;"
            filterable
            placeholder="请选择"
          >
            <el-option
@@ -607,6 +641,7 @@
            :disabled="parseFloat(dialogForm.noputqty)===0||dialogForm.noputqty.trim()===''"
            multiple
            collapse-tags
            filterable
          >
            <el-option
              v-for="item in badArr"
@@ -619,11 +654,12 @@
        <!--        <el-form-item v-if="dialogTitle==='自制报工'" label="报工人员:">-->
        <!--          <el-input v-model="dialogForm.remarks" type="textarea" style="width: 200px;" />-->
        <!--        </el-form-item>-->
        <el-form-item v-if="dialogTitle==='自制报工'" label="报工人:">
        <el-form-item v-if="dialogTitle==='自制报工'" label="操作人员:">
          <el-select
            v-model="dialogForm.operation"
            style="width: 200px;"
            placeholder="请选择"
            filterable
          >
            <el-option
              v-for="item in OperationArr"
@@ -636,7 +672,8 @@
        <el-form-item v-if="dialogTitle==='自制报工'" label="备注:">
          <el-input v-model="dialogForm.remarks" type="textarea" style="width: 200px;" />
        </el-form-item>
        <div v-if="dialogTitle==='自制报工'">
        <!--        <div v-if="dialogTitle==='自制报工'">-->
        <div v-if="false">
          <i class="el-icon-s-operation" style="color:#42b983;" /> 人员列表
          <el-button type="primary" style="margin: 10px 0" @click="userAdd">增行</el-button>
          <el-table
@@ -899,63 +936,127 @@
      @close="dialogVisible2Close"
    >
      <!-- 要打印的区域 -->
      <div id="printMe2" style="padding: 30px;">
      <div id="printMe2">
        <div
          style="display: flex;width: 280px;height: 150px;border: 1px solid #000;text-align: center;font-size: 10px;"
          style="display: flex;width: 220px;height: 130px;border: 1px solid #000;text-align: center;font-size: 12px"
        >
          <div style="width: 90px;display: flex;flex-direction: column;border-right: 1px solid #000">
          <div style="width: 70px;display: flex;flex-direction: column;border-right: 1px solid #000">
            <div
              style="display: flex;height: 90px;border-bottom:1px solid #000;
              style="display: flex;height: 60%;border-bottom:1px solid #000;
              justify-content: center;align-items: center;position: relative"
            >
              <div id="qrCode2" ref="qrCodeDiv2" style="overflow-y: hidden;height:60px;position: absolute;left: 14px;" />
              <div
                id="qrCode2"
                ref="qrCodeDiv2"
                style="overflow-y: hidden;height:71%;position: absolute;left: 7px;"
              />
            </div>
            <div
              style="display: flex;height: 30px;justify-content: flex-start;border-bottom:1px solid #000;align-items: center"
              style="display: flex;height:  20%;justify-content: flex-start;border-bottom:1px solid #000;align-items: center"
            >
              <div style="margin-left: 5px;width: 28px">数量:</div>
              {{ qrForm.startqty }}
              <div style="margin-left: 3px; ">数量:{{ qrForm.startqty }}</div>
            </div>
            <div style="display: flex;height: 30px;justify-content: flex-start;align-items: center">
              <div style="margin-left: 5px;width: 42px">处理人:</div>
              {{ qrForm.operator }}
            <div style="display: flex;height:  20%;justify-content: flex-start;align-items: center;">
              <div style="margin-left: 3px; ">操作:{{ qrForm.operator }}</div>
            </div>
          </div>
          <div style="width:190px;display: flex;flex-direction: column">
          <div style="width:150px;display: flex;flex-direction: column">
            <div
              style="display: flex;height: 20%;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 style="margin-left: 3px;">编号:{{ qrForm.wo_code }}</div>
            </div>
            <div
              style="display: flex;height: 20%;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 style="margin-left: 3px;">产品编码:{{ qrForm.partcode }}</div>
            </div>
            <div
              style="display: flex;height: 20%;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 style="margin-left: 3px;">产品名称:{{ qrForm.partname }}</div>
            </div>
            <div
              style="display: flex;height: 20%;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.nextstepname }}</div>
              <div style="margin-left: 3px;">下道工序:{{ qrForm.nextstepname }}</div>
            </div>
            <div style="display: flex;height: 20%;justify-content: flex-start;align-items: center;text-align: left">
              <div style="width: 60px;margin-left: 5px;">处理时间:</div>
              <div>{{ qrForm.operatorTime }}</div>
              <div style=" margin-left: 3px;">时间: {{ qrForm.operatorTime }}</div>
              <!--                <div>{{ qrForm.operatorTime?qrForm.operatorTime.substring(5):'' }}</div>-->
              <!--                <div>{{ qrForm.operatorTime }}</div>-->
            </div>
          </div>
        </div>
        <!--        -->
        <!--        -->
        <!--        <div-->
        <!--          style="display: flex;width: 280px;height: 150px;border: 1px solid #000;text-align: center;font-size: 10px;"-->
        <!--        >-->
        <!--          <div style="width: 90px;display: flex;flex-direction: column;border-right: 1px solid #000">-->
        <!--            <div-->
        <!--              style="display: flex;height: 90px;border-bottom:1px solid #000;-->
        <!--              justify-content: center;align-items: center;position: relative"-->
        <!--            >-->
        <!--              <div id="qrCode2" ref="qrCodeDiv2" style="overflow-y: hidden;height:60px;position: absolute;left: 14px;" />-->
        <!--            </div>-->
        <!--            <div-->
        <!--              style="display: flex;height: 30px;justify-content: flex-start;border-bottom:1px solid #000;align-items: center"-->
        <!--            >-->
        <!--              <div style="margin-left: 5px;width: 28px">数量:</div>-->
        <!--              {{ qrForm.startqty }}-->
        <!--            </div>-->
        <!--            <div style="display: flex;height: 30px;justify-content: flex-start;align-items: center">-->
        <!--              <div style="margin-left: 5px;width: 42px">处理人:</div>-->
        <!--              {{ qrForm.operator }}-->
        <!--            </div>-->
        <!--          </div>-->
        <!--          <div style="width:190px;display: flex;flex-direction: column">-->
        <!--            <div-->
        <!--              style="display: flex;height: 20%;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: 20%;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: 20%;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: 20%;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.nextstepname }}</div>-->
        <!--            </div>-->
        <!--            <div style="display: flex;height: 20%;justify-content: flex-start;align-items: center;text-align: left">-->
        <!--              <div style="width: 60px;margin-left: 5px;">处理时间:</div>-->
        <!--              <div>{{ qrForm.operatorTime }}</div>-->
        <!--            </div>-->
        <!--          </div>-->
        <!--        </div>-->
      </div>
      <span slot="footer" class="dialog-footer">
        <div class="footerButton">
@@ -1254,9 +1355,14 @@
        startqtySum: '', // 不能超过的数值
        operation: getCookie('navTabId'), // 报工人(收料人)
        remarks: ''// 备注
        remarks: '', // 备注
        productionType: 'personal'// 生产类型
      },
      productionTypeSelect: [
        { code: 'personal', name: '个人类型' },
        { code: 'team', name: '班组类型' }
      ], // 生产类型数组
      ZZuserArr: [], // 自制用户所有
      ZZtreams: [], // 自制生产班组数组
      ZZeqpArr: [], // 自制设备名称
@@ -1297,6 +1403,9 @@
        ],
        startqty: [
          { required: true, message: '请输入报工数量', trigger: ['blur', 'change'] }
        ],
        productionType: [
          { required: true, message: '请选择生产类型', trigger: ['blur', 'change'] }
        ]
      },
      activeName: '',
@@ -1397,6 +1506,13 @@
    this.getMesOrderSelectUserAll() // 获取所有人员
  },
  methods: {
    // 选择生产类型
    usergroupChange111(val) {
      console.log(val)
      if (val === 'personal') {
        this.dialogForm.usergroupcode = ''
      }
    },
    tableRowClassName({ row, rowIndex }) {
      return 'custom-row'
@@ -1685,7 +1801,7 @@
        this.dialogForm.startqty = obj.noreportqty
        this.dialogForm.nextstepname = obj.nextstepname
        this.dialogForm.nextstepcode = obj.nextstepcode
        this.dialogForm.nextstepcode = obj.nextstepcode ? obj.nextstepcode : obj.stepcode
        this.dialogForm.startqtySum = obj.noreportqty
      })
@@ -1746,7 +1862,7 @@
        this.dialogForm.stepcode = obj.stepcode
        this.dialogForm.nextstepname = obj.nextstepname
        this.dialogForm.nextstepcode = obj.nextstepcode
        this.dialogForm.nextstepcode = obj.nextstepcode ? obj.nextstepcode : obj.stepcode
        this.dialogForm.noputqty = obj.noputqty
        this.dialogForm.stepseq = obj.seq
@@ -1822,6 +1938,10 @@
    },
    // 用户添加
    userAdd() {
      if (this.userTableData.find(i => i.isVisible === 1)) {
        return this.$message.info('请先保存当前行信息!')
      }
      let number = Math.random() * Math.random()// 作为删除时的标识符
      number = number === 0 ? (10 + Math.random()) : number
      console.log(this.userTableData, 6)
@@ -1901,7 +2021,7 @@
      this.dialogForm.reportqty = '', // 已报数量
      this.dialogForm.noreportqty = '', // 未报数量
      this.dialogForm.startqty = '', // 开(报)工数量
      this.dialogForm.reportuser = '', // 报工人员
      this.dialogForm.wxcode = '', // 外协供应商编码
      this.dialogForm.outuser = '', // 发料人员
      this.dialogForm.taskqty = '', // 任务数量
@@ -1995,10 +2115,10 @@
              if (res.code === '200') {
                this.dialogVisible = false
                this.$message.success('收料成功!')
                if (this.dialogForm.nextstepcode === '') {
                  this.WXprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.inuser).username)
                  this.dialogVisible2 = true
                }
                // if (this.dialogForm.nextstepcode === '') {
                this.WXprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.inuser).username)
                this.dialogVisible2 = true
                // }
                this.tabClick()
                this.$store.state.app.buttonIsDisabled = false
              } else {
@@ -2034,9 +2154,9 @@
            if (parseFloat(this.dialogForm.startqtySum) < parseFloat(this.dialogForm.startqty) + parseFloat(this.dialogForm.noputqty)) {
              return this.$message.info('报工数量加不良数量不能大于了未报数量!')
            }
            if (this.userTableData.length < 1) {
              return this.$message.info('人员列表不能为空!')
            }
            // if (this.userTableData.length < 1) {
            //   return this.$message.info('人员列表不能为空!')
            // }
            if (parseFloat(this.dialogForm.noputqty) > 0) {
              if (this.dialogForm.badcode.length < 1) {
@@ -2044,13 +2164,13 @@
              }
            }
            // this.userTableData = [...new Set(this.userTableData)]// 数组去重
            this.userTableData = this.userTableData.filter(item => item.usercode !== '')
            // this.userTableData = this.userTableData.filter(item => item.usercode !== '')
            // 数组中对象相同的去重
            this.userTableData = this.userTableData.filter((currentValue, currentIndex, selfArr) => {
              return selfArr.findIndex(item => item.usercode === currentValue.usercode) === currentIndex
            })
            // this.userTableData = this.userTableData.filter((currentValue, currentIndex, selfArr) => {
            //   return selfArr.findIndex(item => item.usercode === currentValue.usercode) === currentIndex
            // })
            // console.log(this.userTableData, 1)
            const reportuser = this.userTableData.map(item => item.usercode).join(';')
            // const reportuser = this.userTableData.map(item => item.usercode).join(';')
            const data = {
              mesordercode: this.dialogForm.wo_code, // 工单编号
              partcode: this.dialogForm.partcode, // 产品编码
@@ -2058,7 +2178,8 @@
              stepcode: this.dialogForm.stepcode, // 工序编码
              eqpcode: this.dialogForm.eqpcode, // 设备编码
              usergroupcode: this.dialogForm.usergroupcode, // 班组编码
              reportuser: reportuser, // 报工人员
              // reportuser: reportuser, // 报工人员
              reportuser: this.dialogForm.reportuser, // 报工人员
              taskqty: this.dialogForm.planqty, // 任务数量
              // startqty: this.dialogForm.startqty, // 开工数量
              startqty: this.dialogForm.reportqty, // 开工数量
@@ -2073,10 +2194,10 @@
              if (res.code === '200') {
                this.dialogVisible = false
                this.$message.success('报工成功!')
                if (this.dialogForm.nextstepcode === '') {
                  this.ZZprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.operation).username)
                  this.dialogVisible2 = true
                }
                // if (this.dialogForm.nextstepcode === '') {
                this.ZZprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.operation).username)
                this.dialogVisible2 = true
                // }
                this.tabClick()
                this.$store.state.app.buttonIsDisabled = false
              } else {
@@ -2092,9 +2213,9 @@
      new QRCode(this.$refs.qrCodeDiv2, {
        text: text,
        // width: 50,
        width: 60,
        width: 55,
        // height: 50,
        height: 60,
        height: 55,
        colorDark: '#000', // 二维码颜色
        colorLight: '#ffffff', // 二维码背景色
        correctLevel: QRCode.CorrectLevel.L// 容错率,L/M/H