zhouwx
2024-08-19 cd84a28754fc1b3fadb7027245333d6d3ff330a3
src/views/hazardousChemicals/overdueWarning/index.vue
@@ -72,6 +72,7 @@
import {getCurrentInstance, onMounted, onUnmounted, reactive, ref, toRefs} from "vue";
import {ElMessage, ElMessageBox} from "element-plus";
import {delWarning, getWarning, handleWarning} from "@/api/hazardousChemicals/warning";
import {unWarningCount} from "@/api/hazardousChemicals/count";
const { proxy } = getCurrentInstance();
const loading = ref(false);
const dialogRef = ref();
@@ -90,6 +91,7 @@
const classHourRef = ref();
onMounted(()=>{
  getList()
  getUnCount()
})
onUnmounted(()=>{
@@ -102,10 +104,20 @@
  if(res.code == 200){
    data.dataList = res.data.list
    data.total = res.data.total
  }else{
    ElMessage.warning(res.message)
  }
  loading.value = false
}
const getUnCount = async () => {
  const res = await unWarningCount()
  if(res.code == 200){
    data.untreatedTotal = res.data
  }else{
    ElMessage.warning(res.message)
  }
}
const openDialog = (type, value) => {
@@ -120,6 +132,7 @@
    state: null
  }
  getList()
  getUnCount()
}
const handleDelete = (val) => {
  ElMessageBox.confirm(
@@ -135,6 +148,7 @@
        if(res.code == 200){
          ElMessage.success('数据删除成功')
          await getList()
          await getUnCount()
        }else{
          ElMessage.warning(res.message)
        }
@@ -151,10 +165,17 @@
        type: 'warning',
      })
      .then( async() => {
        const res = await handleWarning(val.id)
        console.log("val",val)
        const param = {
          id: val.id,
          state: 1,
          companyId: val.companyId,
        }
        const res = await handleWarning(param)
        if(res.code == 200){
          ElMessage.success('处理成功')
          await getList()
          await getUnCount()
        }else{
          ElMessage.warning(res.message)
        }