王震
2023-12-07 75e035a10a0faeff6b2ec4b9fcbf98d1536274f2
src/views/warehouse/pallettransports/index.vue
@@ -52,10 +52,15 @@
            </div>
          </div>
          <div>
            <el-table class="pallet-transports-material-table" :data="palletTransportsMaterialData" 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 type="selection" width="55"> </el-table-column>
                          <!--单选框 @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>
              <el-table-column prop="partDesc" label="零件描述" align="center" show-overflow-tooltip>
@@ -78,10 +83,10 @@
              </el-table-column>
              <el-table-column label="操作" align="center" width="100">
                <template slot-scope="scope">
                  <el-button v-show="!scope.row.canEdit" type="text" :disabled="scope.row.detailExistState"
                    @click="scope.row.canEdit = true">编辑</el-button>
                  <el-button v-show="scope.row.canEdit" type="text" :disabled="scope.row.detailExistState"
                    @click="updateMaterial(scope.row)">保存</el-button>
                  <!-- <el-button v-show="!scope.row.canEdit" type="text" :disabled="scope.row.detailExistState"
                    @click="scope.row.canEdit = true">编辑</el-button> -->
                  <!-- <el-button v-show="scope.row.canEdit" type="text" :disabled="scope.row.detailExistState"
                    @click="updateMaterial(scope.row)">保存</el-button> -->
                  <el-button type="text" :disabled="scope.row.detailExistState"
                    @click="delMaterial(scope.row)">删除</el-button>
                </template>
@@ -360,6 +365,19 @@
  },
  created() { },
  methods: {
             // 单行选中
         handleCurrentChange(row) {
               this.palletTransportsMaterialData.forEach((item) => {
                  // 排他,每次选择时把其他选项都清除
                  if (item.id !== row.id) {
                     item.commonChecked = false
                  }else{
              item.commonChecked = true
            }
               })
          this.palletTransportsMaterialSelectionChange([row])
          console.log(row);
         },
    // 工艺类型中文格式化
    formatStateType(row, column, cellValue) {
      this.stateOptions.forEach((obj) => {
@@ -408,7 +426,8 @@
                unit: item.unit,
                transportsId: item.transportsId,
                detailExistState: item.detailExistState,
                canEdit: false
                canEdit: false,
                commonChecked: false
              }
              this.palletTransportsMaterialData.push(palletTransportsMaterial)
            })