马宇豪
2024-11-21 cc3e08bda13360c88b7189e8f8d043b60783c7fb
src/views/safetyReview/baseSet/openApply/index.vue
@@ -1,8 +1,18 @@
<template>
    <div class="app-container">
        <div style="margin-bottom: 10px">
          <el-button type="primary" plain icon="Open">开启专家申请</el-button>
          <el-button type="danger" plain icon="TurnOff">关闭专家申请</el-button>
<!--          <el-button type="primary" plain icon="Open">开启专家申请</el-button>-->
<!--          <el-button type="danger" plain icon="TurnOff">关闭专家申请</el-button>-->
          <el-switch
              v-model="applyStatus"
              inline-prompt
              style="--el-switch-on-color: #ff4949; --el-switch-off-color: #13ce66"
              active-text="关闭专家申请"
              inactive-text="开启专家申请"
              active-value="2"
              inactive-value="1"
              @change="handleChange"
          />
        </div>
        <!-- 表格数据 -->
        <el-table v-loading="loading" :data="dataList" :border="true">
@@ -28,7 +38,7 @@
<script setup>
import {getCurrentInstance, onMounted, reactive, ref, toRefs} from "vue";
import {ElMessage, ElMessageBox} from "element-plus";
import {delDict, getDictList} from "@/api/backManage/evaluate";
import {getApplyList, getSettings, updateSettings} from "@/api/backManage/evaluate";
const { proxy } = getCurrentInstance();
const loading = ref(false);
const busRef = ref();
@@ -36,8 +46,7 @@
const data = reactive({
    queryParams: {
        pageNum: 1,
        pageSize: 10,
        dictType: dictType.value
        pageSize: 10
    },
    total: 0,
    dataList: [
@@ -49,16 +58,45 @@
const { queryParams, total, dataList } = toRefs(data);
onMounted(() => {
    // getList();
  getList()
  getApplyStatus()
});
const applyStatus = ref()
const isInitialized = ref(false)
const getApplyStatus = async ()=>{
  const res = await getSettings()
  if(res.code == 200){
    applyStatus.value = res.data
    isInitialized.value = true
  }else{
    ElMessage.warning(res.msg)
  }
}
const handleChange = (val)=>{
  if (!isInitialized.value) return
  changeStatus(val);
}
const changeStatus = async (val) => {
  const res = await updateSettings({ sysSettings: val });
  if (res.code == 200) {
    ElMessage.success('专家申请设置已更新');
    await getList()
  } else {
    ElMessage.warning(res.msg);
  }
}
const getList = async () => {
    loading.value = true;
    const res = await getDictList(data.queryParams);
    const res = await getApplyList(data.queryParams);
    if(res.code === 200){
        dataList.value = res.data.list
        total.value = res.data.total
        dataList.value = res.rows
        total.value = res.total
    }else{
        ElMessage.warning(res.message)
        ElMessage.warning(res.msg)
    }
    loading.value = false;
}
@@ -102,7 +140,26 @@
</script>
<style>
.pag-container{
float: right;
margin-top: 10px;
  float: right;
  margin-top: 10px;
}
.el-switch__core{
  height: 32px;
  padding: 10px 30px;
  border-radius: 16px;
  .el-switch__inner{
    height: 32px;
  }
  .el-switch__action{
    width: 24px;
    height: 24px;
    left: 4px;
  }
}
.el-switch.is-checked .el-switch__core .el-switch__action{
  left: calc(100% - 28px);
}
</style>