| | |
| | | <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"> |
| | |
| | | <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(); |
| | |
| | | const data = reactive({ |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | dictType: dictType.value |
| | | pageSize: 10 |
| | | }, |
| | | total: 0, |
| | | dataList: [ |
| | |
| | | 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; |
| | | } |
| | |
| | | </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> |