zhouwx
2025-02-13 0bc2784f60f30108cf6fa133b774703bda861721
src/views/hazardousChemicals/systemManage/warehouse/index.vue
@@ -28,11 +28,26 @@
    </div>
    <!-- 表格数据 -->
    <el-table v-loading="loading" :data="dataList" :border="true">
      <el-table-column type="expand">
        <template #default="props">
          <el-table :data="props.row.warehouseCupboards" style="width: 90%;margin-left: 5%" :row-key="getRowKeys"  border>
            <el-table-column label="存储柜名" prop="cupboardName" align="center" />
            <el-table-column label="描述" prop="mess" align="center" />
            <el-table-column label="操作" show-overflow-tooltip width="150" >
              <template #default="scope">
                <el-button size="small" text type="primary" @click="addCupboard('edit',scope.row)">编辑</el-button>
                <el-button size="small" text type="danger" @click="delCup(scope.row)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
        </template>
      </el-table-column>
      <el-table-column label="序号" type="index" align="center" width="80" />
      <el-table-column label="仓库名称" prop="name" align="center"  />
      <el-table-column label="描述" prop="remark" align="center" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200" >
        <template #default="scope">
          <el-button link type="primary" @click="addCupboard('add',scope.row)">新增存储柜</el-button>
          <el-button link type="primary" @click="openDialog('edit',scope.row)">编辑</el-button>
          <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
        </template>
@@ -48,6 +63,8 @@
    />
    <warehouse-dialog ref="dialogRef" @getList=getList></warehouse-dialog>
    <cupboard-dialog ref="cupDialogRef" @getList=getList></cupboard-dialog>
  </div>
</template>
@@ -55,10 +72,12 @@
import {getCurrentInstance, onMounted, onUnmounted, reactive, ref, toRefs} from "vue";
import {ElMessage, ElMessageBox} from "element-plus";
import warehouseDialog from "./components/warehouseDialog.vue";
import {delWarehouse, getWarehouse} from "@/api/hazardousChemicals/warehouse";
import cupboardDialog from "./components/cupboard.vue"
import {delCupboard, delWarehouse, getWarehouse} from "@/api/hazardousChemicals/warehouse";
const { proxy } = getCurrentInstance();
const loading = ref(false);
const dialogRef = ref();
const cupDialogRef = ref();
const data = reactive({
  queryParams: {
    pageNum: 1,
@@ -123,6 +142,30 @@
        }
      })
}
const delCup = (val) => {
  ElMessageBox.confirm(
      '确定删除此条数据?',
      '提示',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
      })
      .then( async() => {
        const res = await delCupboard(val.id)
        if(res.code == 200){
          ElMessage.success('数据删除成功')
          await getList()
        }else{
          ElMessage.warning(res.message)
        }
      })
}
const addCupboard = (type,value) => {
  cupDialogRef.value.openDialog(type, value);
}
const getRowKeys = (row) => {
  return row.name
}
</script>