产品编辑单位模块 设置默认值的时候,自动把其他的关闭,不用手动取消+增加的时候自动滚动到底部
1个文件已修改
33 ■■■■■ 已修改文件
src/views/productManage/product/components/bomDialog.vue 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/productManage/product/components/bomDialog.vue
@@ -6,7 +6,7 @@
      编辑下拉框>单位
    </div>
    <div class="drawerContent">
      <el-table v-if="isTableShow" :header-cell-style="{ background: '#f1f3f8', color: '#000009' }" ref="multipleTable"
      <el-table v-if="isTableShow" :header-cell-style="{ background: '#f1f3f8', color: '#000009' }" ref="unitTable"
        :data="thatEditRow.BomTableData" tooltip-effect="dark" height="440">
        <el-table-column prop="unit" label="单位">
          <template slot-scope="scope">
@@ -20,7 +20,7 @@
        </el-table-column>
        <el-table-column label="操作" width="100">
          <template slot-scope="scope">
            <i class="el-icon-delete" id="iconStyle" @click="handleDelete(scope.row.id)"></i>
            <i class="el-icon-delete cursor_pointer" id="iconStyle" @click="handleDelete(scope.row.id,scope)"></i>
          </template>
        </el-table-column>
      </el-table>
@@ -114,16 +114,20 @@
    handleAdd() {
      this.BomTableData=this.thatEditRow.BomTableData
      this.BomTableData.push({ name: "", isDefault: false });
      debugger
      this.$nextTick(()=>{
        setTimeout(() => {
          this.$refs.unitTable.bodyWrapper.scrollTop=this.$refs.unitTable.bodyWrapper.scrollHeight
          }, 500);
      })
    },
    handleDelete(id) {
      if (this.BomTableData.length === 1) {
    handleDelete(id,scope) {
      if (this.thatEditRow.BomTableData.length === 1) {
        this.$message.warning("至少保留一条数据");
        return;
      }
      this.BomTableData = this.thatEditRow.BomTableData.filter((i) => {
        return i.id != id;
      });
      this.thatEditRow.BomTableData=this.BomTableData
      this.thatEditRow.BomTableData.splice(scope.$index,1)
      this.BomTableData=this.thatEditRow.BomTableData
    },
    async getCodeStandardList() {
      const res = await getCodeStandardList(this.obj);
@@ -149,19 +153,10 @@
    },
    switchChange(scope, val) {
      this.BomTableData=this.thatEditRow.BomTableData
      let arr = [];
      for (let i in this.BomTableData) {
        if (this.BomTableData[i].isDefault) {
          arr.push(i);
        }
        this.thatEditRow.BomTableData[i].isDefault=false
      }
      if (arr.length > 1) {
        this.$message({
          message: "只能设一个为默认",
          type: "warning",
        });
        scope.row.isDefault = !val;
      }
      scope.row.isDefault = val;
    },
    handleConfirmSave() {
      let arr = [];