loulijun2021
2023-03-24 b08411e811e003ae2711e7ba8d92deaec9239de3
src/views/scgl/sckbg.vue
@@ -532,19 +532,19 @@
        :model="dialogForm"
        label-width="110px"
      >
        <el-form-item label="工单编号:">
        <el-form-item label="工单编号:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.wo_code }}</div>
        </el-form-item>
        <el-form-item label="产品编码:">
        <el-form-item label="产品编码:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.partcode }}</div>
        </el-form-item>
        <el-form-item label="产品名称:">
        <el-form-item label="产品名称:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.partname }}</div>
        </el-form-item>
        <el-form-item label="产品规格:">
        <el-form-item label="产品规格:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.partspec }}</div>
        </el-form-item>
        <el-form-item label="当前工序:">
        <el-form-item label="当前工序:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.stepname }}</div>
        </el-form-item>
        <el-form-item v-if="false" label="工序描述:">
@@ -554,20 +554,20 @@
          </div>
          <!--          </el-tooltip>-->
        </el-form-item>
        <el-form-item label="任务数量:">
        <el-form-item label="任务数量:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.planqty }}</div>
        </el-form-item>
        <el-form-item v-if="dialogTitle==='自制开始'" label="未开/已开:">
        <el-form-item v-if="dialogTitle==='自制开始'" label="未开/已开:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.noreportqty }}/{{ dialogForm.reportqty }}</div>
        </el-form-item>
        <el-form-item v-if="dialogTitle==='自制报工'" label="未报/已报:">
        <el-form-item v-if="dialogTitle==='自制报工'" label="未报/已报:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.noreportqty }}/{{ dialogForm.reportqty }}</div>
        </el-form-item>
        <el-form-item v-if="dialogTitle==='外协发料'" label="未发/已发:">
        <el-form-item v-if="dialogTitle==='外协发料'" label="未发/已发:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.noreportqty }}/{{ dialogForm.reportqty }}</div>
        </el-form-item>
        <el-form-item v-if="dialogTitle==='外协收料'" label="未收/已收:">
        <el-form-item v-if="dialogTitle==='外协收料'" label="未收/已收:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.noreportqty }}/{{ dialogForm.reportqty }}</div>
        </el-form-item>
        <!--自制开始-->
@@ -590,7 +590,7 @@
          </el-select>
        </el-form-item>
        <!--     自制报工   -->
        <el-form-item v-if="dialogTitle==='自制报工'" label="下道工序:">
        <el-form-item v-if="dialogTitle==='自制报工'" label="下道工序:" style="margin: 0 10px 0 0">
          <div style="width: 200px">{{ dialogForm.nextstepname }}</div>
        </el-form-item>
@@ -694,8 +694,11 @@
          <el-input v-model="dialogForm.remarks" type="textarea" style="width: 200px;" />
        </el-form-item>
        <div v-if="dialogTitle==='自制报工'&&dialogForm.reckway==='group'">
          <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" /> 人员列表
          <el-button v-waves type="primary" style="margin: 10px 0" @click="userAdd">增行</el-button>
          <div style="display: flex;align-items:center;height: 40px;margin-bottom: 10px">
            <i class="el-icon-s-operation" :style="{color:$store.state.settings.theme}" />
            <div style="margin: 0 15px 0 5px;">人员列表</div>
            <el-button v-waves type="primary" style="margin: 10px 0" @click="userAdd">增行</el-button>
          </div>
          <el-table
            ref="userTableDataRef"
            :data="userTableData"
@@ -704,7 +707,7 @@
            :row-class-name="tableRowClassName"
            :header-cell-style="this.$headerCellStyle"
            :cell-style="this.$cellStyle"
            height="180"
            height="188"
            highlight-current-row
            style="width: 100%"
          >
@@ -761,7 +764,13 @@
            >
              <template slot-scope="{row}">
                <div class="operationClass">
                  <el-button v-if="(row.isVisible===1&&!userIsSave)||row.isVisible===2" v-waves type="text" @click="userSave(row)">保存</el-button>
                  <el-button
                    v-if="(row.isVisible===1&&!userIsSave)||row.isVisible===2"
                    v-waves
                    type="text"
                    @click="userSave(row)"
                  >保存
                  </el-button>
                  <el-button v-if="row.isVisible===1" v-waves type="text" @click="userCancel(row)">取消</el-button>
                  <el-button v-if="row.isVisible===0" v-waves type="text" @click="userDel(row)">删除</el-button>
                  <el-button v-if="row.isVisible===0" v-waves type="text" @click="editRatio(row)">修改比例</el-button>
@@ -1496,7 +1505,7 @@
    this.getHeight()
    this.$nextTick(() => {
      $("input[name='produceCode']")[0].focus()
      $('input[name=\'produceCode\']')[0].focus()
      // this.bindQRCode('10001;001')
    })
    // webapp_urlprotocol_startup()
@@ -1510,6 +1519,7 @@
      this.dialogForm.usergroupcode = ''
      this.dialogForm.operation = ''
      this.userTableData = []
      this.UserTotal = 0
      // console.log(this.$refs.dialogForm, 'log')
      // this.$nextTick(() => {
      //   this.$refs.dialogForm.resetFields()
@@ -1583,21 +1593,21 @@
      if (this.$refs.elTabs.currentName === '0') {
        this.$nextTick(() => {
          this.getMesOrderStepSearch()
          $("input[name='produceCode']")[0].focus()
          $('input[name=\'produceCode\']')[0].focus()
          this.WXform.orderstepqrcode = ''
        })
      }
      if (this.$refs.elTabs.currentName === '1') {
        this.$nextTick(() => {
          this.getMesOrderWxStepSearch()
          $("input[name='WXproduceCode']")[0].focus()
          $('input[name=\'WXproduceCode\']')[0].focus()
          this.form.orderstepqrcode = ''
        })
      }
      if (this.$refs.elTabs.currentName === '2') {
        this.$nextTick(() => {
          this.getBadList()
          $("input[name='badProduceCode']")[0].focus()
          $('input[name=\'badProduceCode\']')[0].focus()
          this.badForm.orderstepqrcode = ''
        })
      }
@@ -1802,9 +1812,11 @@
        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
        this.$refs.userTableDataRef.doLayout()
      })
      await this.getMesOrderStepStartSelectEqp()
@@ -1863,7 +1875,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
@@ -1926,6 +1938,7 @@
    async getUserTableData() {
      const { data: res } = await MesOrderGroupSelectUser({ usergroupcode: this.dialogForm.usergroupcode })
      this.userTableData = res
      this.UserTotal = res.length
      this.userTableData.forEach(item => {
        let number = Math.random() * Math.random()// 作为删除时的标识符
        number = number === 0 ? (10 + Math.random()) : number
@@ -1937,19 +1950,24 @@
      this.ZZuserArr = [...this.ZZuserArr].filter(x => [...this.userTableData].every(y => y.usercode !== x.usercode))
      this.calculatedValue()
      this.$refs.tableDataRef.doLayout()
      this.$nextTick(() => {
        this.$refs.tableDataRef.doLayout()
        this.$refs.userTableDataRef.doLayout()
      })
    },
    calculatedValue() {
      const total = 100; let value = 0
      const total = 100
      let value = 0
      this.userTableData.forEach(item => {
        item.ratio = parseFloat((100 / this.userTableData.length).toFixed(2))
        value += item.ratio
      })
      console.log(value, 1)
      this.UserTotal = this.userTableData.length
      if (value !== total) {
        // let temp = this.userTableData
        // temp[temp.length-1].ratio=temp[temp.length-1].ratio+(total-value)
        this.userTableData[ this.userTableData.length - 1].ratio = parseFloat((this.userTableData[ this.userTableData.length - 1].ratio + (total - value)).toFixed(2))
        this.userTableData[this.userTableData.length - 1].ratio = parseFloat((this.userTableData[this.userTableData.length - 1].ratio + (total - value)).toFixed(2))
      }
    },
    // 修改分配比列
@@ -2026,6 +2044,7 @@
          this.userTableData.splice(index, 1)
        }
      })
      this.UserTotal = this.userTableData.length
    },
    // 用户列表人员名称值选中
    usernameChange(val, row) {
@@ -2158,11 +2177,11 @@
              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.WXprint2(this.OperationArr.find(item => item.usercode === getCookie('navTabId')).username)
                  this.dialogVisible2 = true
                }
                // if (this.dialogForm.nextstepcode === '') {
                // this.WXprint2(this.OperationArr.find(item => item.usercode === this.dialogForm.inuser).username)
                this.WXprint2(this.OperationArr.find(item => item.usercode === getCookie('navTabId')).username)
                this.dialogVisible2 = true
                // }
                this.tabClick()
                this.$store.state.app.buttonIsDisabled = false
              } else {
@@ -2211,9 +2230,9 @@
            if (this.dialogForm.reckway === 'group') {
              let sum = 0
              this.userTableData.forEach(item => {
                sum += item.ratio
                sum += parseFloat(item.ratio)
              })
              if (sum !== 100) {
              if (Math.round(sum * 100) / 100 !== 100) {
                return this.$message.info('分配比例总和必须为100!')
              }
            }
@@ -2235,7 +2254,10 @@
              eqpcode: this.dialogForm.eqpcode, // 设备编码
              usergroupcode: this.dialogForm.usergroupcode, // 班组编码
              // reportuser: reportuser, // 报工人员
              reportuser: this.dialogForm.reckway === 'group' ? this.userTableData : [{ usercode: this.dialogForm.operation, ratio: 100 }],
              reportuser: this.dialogForm.reckway === 'group' ? this.userTableData : [{
                usercode: this.dialogForm.operation,
                ratio: 100
              }],
              taskqty: this.dialogForm.planqty, // 任务数量
              // startqty: this.dialogForm.startqty, // 开工数量
              startqty: this.dialogForm.reportqty, // 开工数量
@@ -2254,10 +2276,10 @@
              if (res.code === '200') {
                this.dialogVisible = false
                this.$message.success('报工成功!')
                if (this.dialogForm.nextstepcode === '') {
                  this.ZZprint2(this.OperationArr.find(item => item.usercode === getCookie('navTabId')).username)
                  this.dialogVisible2 = true
                }
                // if (this.dialogForm.nextstepcode === '') {
                this.ZZprint2(this.OperationArr.find(item => item.usercode === getCookie('navTabId')).username)
                this.dialogVisible2 = true
                // }
                this.tabClick()
                this.$store.state.app.buttonIsDisabled = false
              } else {