Selaa lähdekoodia

增加系统设置功能

dengshaobo 3 viikkoa sitten
vanhempi
commit
53ee82ede4
2 muutettua tiedostoa jossa 117 lisäystä ja 4 poistoa
  1. 19 1
      src/api/exam.ts
  2. 98 3
      src/views/choice/index.vue

+ 19 - 1
src/api/exam.ts

@@ -475,4 +475,22 @@ export const getScanAnswerPreview= (data:any):Promise<ApiResponse> => {
     method: 'get',
     params: data
   })
-}
+}
+
+// 52. 首页 更新系统学校设置
+export const updataSchoolSetting= (data:any):Promise<ApiResponse> => {
+  return request({
+    url: '/api/v1/ai_school_setting/update_value',
+    method: 'post',
+    data
+  })
+}
+
+// 53. 首页 获取系统学校设置
+export const getSchoolSetting= (data:any):Promise<ApiResponse> => {
+  return request({
+    url: '/api/v1/ai_school_setting/find_value',
+    method: 'get',
+    params: data
+  })
+}

+ 98 - 3
src/views/choice/index.vue

@@ -24,6 +24,9 @@
           <el-button @click="Refresh">
             <img src="@/assets/icon/refresh_default.png" />刷新
           </el-button>
+          <el-button @click="OpenSetting()">
+            <img src="@/assets/icon/scan_set_icon.png" />系统设置
+          </el-button>
           <el-button type="primary" @click="OpenAddExam" >
             <img src="@/assets/icon/add_icon.webp" />新增考试
           </el-button>
@@ -75,6 +78,54 @@
       />
     </div>
     <AddExam ref="addExamRef" :editData="currentEditItem" v-model="showAddExam" @success="HandleSuccess" />
+    <div class="page_dialog">
+        <el-dialog
+        title="系统设置"
+        v-model="showSetting"
+        center
+        class="page_dialog"
+        width="480px"
+      >
+        <div class="dialog_center">
+          <el-form
+            
+            ref="addStudentFormRef"
+            
+            label-width="220px"
+          >
+
+            <el-form-item label="是否忽略未扫描:"  >
+              <el-switch
+                v-model="isNoScan"
+                inline-prompt
+                active-text="是"
+                inactive-text="否" 
+                @change="EnterSetting('SCANNED_VALIDATE_FLAG')"
+              />
+              
+            </el-form-item>
+            <el-form-item label="是否忽略客观题异常:" prop="studentCode">
+              <el-switch
+                v-model="isObjectiveError"
+                inline-prompt
+                active-text="是"
+                inactive-text="否"
+                @change="EnterSetting('OBJECTIVE_VALIDATE_FLAG')"
+              />
+              
+            </el-form-item>
+          </el-form>
+        </div>
+        <!-- <template #footer>
+          <div class="dialog-footer">
+            <el-button @click="showSetting = false">取 消</el-button>
+            <el-button type="primary"  :loading="loadingSubmit"
+              >确 定</el-button
+            >
+          </div>
+        </template> -->
+      </el-dialog>
+    </div>
   </div>
 </template>
 
@@ -82,7 +133,7 @@
 import { ref, reactive,onMounted } from 'vue'
 import FiltersItem from '@/components/FiltersItem.vue';
 import AddExam from '@/components/AddExam.vue' // 注意路径可能需要调整
-import { getHeadData,getExamList ,deleteExam} from '@/api/exam'
+import { getHeadData,getExamList ,deleteExam,getSchoolSetting,updataSchoolSetting} from '@/api/exam'
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { getCourseBgColor } from '@/utils/common' 
 import { useRouter } from 'vue-router' 
@@ -92,6 +143,11 @@ const examStore = useExamStore()
 const analysisStore = useAnalysisStore()
 const router = useRouter()
 const showAddExam = ref(false)
+const showSetting = ref(false)//设置
+const isNoScan = ref(true) // 是否校验未扫描
+const isObjectiveError = ref(true) // 是否校验客观题异常
+const loadingSubmit = ref(false)//提交加载中
+
 // 新增:用于存储当前编辑的数据,null 表示新增模式
 const currentEditItem = ref<any>(null)
 
@@ -265,6 +321,44 @@ const HandleSuccess = () => {
   GoSearch();
 }
 
+//打开系统设置
+const OpenSetting=()=>{
+  showSetting.value=true;
+}
+
+//获取设置
+const GetSetting = async () => {
+
+  const res = await getSchoolSetting();
+  console.log('打印设置数据', res)
+  if(res.code==200)
+  {
+    isNoScan.value = res.data.SCANNED_VALIDATE_FLAG =='0'?true:false;
+    isObjectiveError.value = res.data.OBJECTIVE_VALIDATE_FLAG =='0'?true:false;
+  }
+
+}
+
+
+//提交设置
+const EnterSetting=(type:string)=>{
+  console.log('提交设置')
+  let value = type === 'SCANNED_VALIDATE_FLAG' ? isNoScan.value : isObjectiveError.value;
+
+  updataSchoolSetting({
+    settingType: type,
+    settingValue: value ? '0' : '1'//0 忽略  1 不忽略
+  }).then(res=>{
+    console.log('提交设置结果', res)
+    if (res.code == 200) {
+      ElMessage.success('设置成功!')
+
+    }
+  })
+
+
+}
+
 //新增考试
 const OpenAddExam = () => {
   showAddExam.value = true
@@ -323,8 +417,9 @@ const GotoExam=(item:any) => {
 
 // 组件挂载时获取初始数据
 onMounted(() => {
-  GetHeadData()
-  GoSearch()
+  GetSetting();//获取设置
+  GetHeadData();//获取头部筛选数据
+  GoSearch();//获取列表数据
 })
 </script>