zss
2023-12-11 c880739ec4cd5ede33b31eb98ad5f7628ea288e5
src/views/warehouse/pallettransports/index.vue
@@ -52,14 +52,14 @@
            </div>
          </div>
          <div>
            <el-table class="pallet-transports-material-table" :data="palletTransportsMaterialData" @current-change="handleCurrentChange" style="width: 100%;"
              height="350px" border @selection-change="palletTransportsMaterialSelectionChange" stripe
            <el-table class="pallet-transports-material-table" @current-change="handleCurrentChange"  :data="palletTransportsMaterialData" style="width: 100%;"
              height="350px" border  stripe
              ref="palletTransportsMaterialTable">
                          <!--单选框-->
                  <el-table-column align="center"  label="单选">
                     <template slot-scope="scope">
                        <el-checkbox class="table-single-checkbox" v-model="scope.row.commonChecked" disabled></el-checkbox>
                     </template>
                          <!--单选框 @selection-change="palletTransportsMaterialSelectionChange"-->
                  <el-table-column align="center"  width="55" label="单选">
                       <template slot-scope="scope">
                          <el-checkbox v-model="scope.row.commonChecked" @change="handleCurrentChange(scope.row)" ></el-checkbox>
                       </template>
                  </el-table-column>
              <el-table-column prop="partNo" label="零件号" align="center" show-overflow-tooltip>
              </el-table-column>
@@ -365,18 +365,17 @@
  },
  created() { },
  methods: {
           // 单行选中
      handleCurrentChange(row) {
            if (row != null) {
             // 单行选中
         handleCurrentChange(row) {
               this.palletTransportsMaterialData.forEach((item) => {
                  // 排他,每次选择时把其他选项都清除
                  if (item.id !== row.id) {
                     item.commonChecked = false
                  } else {
                     item.commonChecked = true
                  }
                  }else{
              item.commonChecked = true
            }
               })
            }
          this.palletTransportsMaterialSelectionChange([row])
         },
    // 工艺类型中文格式化
    formatStateType(row, column, cellValue) {
@@ -518,12 +517,10 @@
    openLocationDialog() {
      if (this.palletTransportsMaterialMultipleSelection.length > 0) {
        let flag = true
        console.log(this.palletTransportsMaterialMultipleSelection)
        this.palletTransportsMaterialMultipleSelection.forEach((item) => {
          if (item.detailExistState) {
            flag = false
          }
          console.log(item.detailExistState)
        })
        if (flag) {
          this.showLocation = true
@@ -578,8 +575,6 @@
    },
    // 获取移库明细数据列表
    getPalletTransportsDetailData() {
      // console.log("对应工单",this.WorkOrder);
      // console.log("选中物料需求",this.palletTransportsMaterialMultipleSelection);
      let transportsDetails =[]
      transportsDetails = this.palletTransportsMaterialMultipleSelection.map(el =>{
        return{
@@ -604,10 +599,8 @@
                this.innerVisible = false
                this.$message.success('添加移库明细成功')
                let materialRow = selectionList[selectionList.length - 1]
                console.log("materialRow-----",materialRow);
                this.palletTransportsMaterialData.forEach(ele=>{
                  if(ele.id==materialRow.id){
                    console.log("ele-------",ele);
                      ele.transferQuantity = materialRow.surplusQuantity
                      ele.surplusQuantity = 0
                  }
@@ -652,7 +645,6 @@
    },
    // 打开单个明细批量更新库位弹框
    openSingleLocationDialog(row) {
      console.log(row);
      if (row.state === '01initial') {
        this.detailList = []
        this.detailList.push(row)
@@ -663,17 +655,15 @@
    },
    // 删除移库明细
    delDetail(row) {
      /* const delRow = this.palletTransportsDetailData.find((item) => {
       const delRow = this.palletTransportsDetailData.find((item) => {
        return item.id === row.id
      }) */
      })
      delPalletTransportsDetailObj(row.id).then((response) => {
        const resData = response.data
        if (resData.code === 0) {
          // const findRowIndex = this.palletTransportsDetailData.indexOf(delRow)
          // this.palletTransportsDetailData.splice(findRowIndex, 1)
          const findRowIndex = this.palletTransportsDetailData.indexOf(delRow)
          this.palletTransportsDetailData.splice(findRowIndex, 1)
          this.$message.success('移库明细删除成功')
          // this.getPalletTransportsMaterialData()
          const currRow = this.currPalletTransportsRow
          this.getPallettransportsData().then(() => {
            if (currRow) {
@@ -705,6 +695,7 @@
            if (resData.code === 0) {
              this.$message.success('执行成功')
              // this.getPalletTransportsMaterialData()
              this.palletTransportsDetailData=[]
              const currRow = this.currPalletTransportsRow
              this.getPallettransportsData().then(() => {
                if (currRow) {
@@ -739,12 +730,10 @@
    },
    palletTransportsMaterialSelectionChange(val) {
      this.palletTransportsMaterialMultipleSelection = val
      console.log(this.palletTransportsMaterialMultipleSelection);
      if(val && val.length>0){
        let ids =[]
        this.palletTransportsMaterialMultipleSelection.forEach(el =>{ids.push(el.id)})
        let pId = ids[ids.length - 1];
        console.log(pId);
        if(pId!=null){
          selectAll({
              transportsId:this.currPalletTransportsRow.id,