86134
2023-11-18 b99cd0f6b3ad780eb6fc93170135df30147f503b
src/views/product/workbench/batchproductout-form-new.vue
@@ -12,7 +12,7 @@
    title="汇报产出"
    :visible.sync="innerVisible"
    append-to-body
    @close="$emit('update:currshowlist', false)"
    @close="handleClose"
    :show="currshowlist"
    :close-on-click-modal="false"
    class="batch-product-out-form"
@@ -359,6 +359,7 @@
  data() {
    return {
      innerVisible: false,
      staffNameList: [],
      personSelection: [],
      saveDisabled: false,
      currDutyInitproducts: [], // 用于缓存页面中原有的staff产出记录,并且是属于当前班次下的,用于勾选人员时作为原数据参照
@@ -374,6 +375,35 @@
    }
  },
  methods: {
    initProductList(){
      let val = this.personSelection
      //按人员报工
      if(this.groupStatus){
        this.products = []
        this.addProductOutForPerson()
      }else{
        //按组报工
        let nameList = []
        val.forEach(obj=>{
          nameList.push(obj.staffName)
        })
        let staffName = Array.from(new Set(nameList)).join(",")
        if(staffName!=''){
          this.products = this.productList
          this.products.forEach(item=>{
            item.staffName = staffName
          })
        }else{
          this.products = []
        }
      }
    },
    handleClose(){
      this.$emit('update:currshowlist', false)
      this.$nextTick(()=>{
        this.$refs.productOutPersonList.clearSelection()
      })
    },
    isNumber(value) {
      var reg = /^[0-9]+(.[0-9]{1,4})?$/
      if (
@@ -419,6 +449,9 @@
      // 再去与products(此为页面的实时数据,用户有改动即更新)对比,将其中存在的相同人员的生产数量和生产批次同步过来,若products中生产数量或生产批次不存在值,则不进行同步,沿用原来的。
      // 最后,将组装好的选中人员信息,更新到products(按照班次进行),注意更新之后选中人员信息在products位置顺序
      this.personSelection = val
      if(this.currshowlist){
        this.initProductList()
      }
    },
    // 根据选中的人员,生成人员产出信息,并且放在右边列表的最前面
    addProductOutForPerson() {
@@ -502,20 +535,21 @@
      saveProductOuts2() {
         this.clickDateArr.push(new Date().getTime())
         var productOutputList = []
         this.productList.forEach(a=>{
         this.products.forEach(a=>{
            productOutputList.push({
               partId: a.partId,
               productQty: a.outNum,
               outBatchNo: a.outBatchNo,
               scrapQty: a.scrapQty,
               remark: a.remark,
          wdr: a.wdr,
              wdr: a.wdr,
               staffNo: a.staffNo,
               staffName: a.staffName,
               status: a.status,
               dutyRecordId: a.dutyRecordId,
               productStaffIds: a.productStaffIds,
               productStaffs: a.productStaffs
               productStaffs: a.productStaffs,
               sortNo: a.sortNo
            })
         })
         var productMains = {
@@ -1055,14 +1089,14 @@
            this.products.push(this.productList[i])
          }
          this.$nextTick(() => {
            this.$refs.productOutPersonList.clearSelection()
            this.$refs.productOutPersonList.toggleAllSelection()
          })
        } else {
          for (let i = 0; i < this.productList.length; i++) {
            this.products.push(this.productList[i])
          }
          this.$nextTick(() => {
            this.$refs.productOutPersonList.clearSelection()
            this.$refs.productOutPersonList.toggleAllSelection()
          })
        }
      }