Pārlūkot izejas kodu

新增非安全学校设置

WANG 5 gadi atpakaļ
vecāks
revīzija
e781e636fb

+ 6 - 0
src/modules/basic/routes/routes.js

@@ -15,6 +15,7 @@ import resource_list from "../view/resource_list.vue";
 import sys_prop_list from "../view/sys_prop_list";
 import client_config from "../view/clientConfig";
 import school_config from "../view/school_config";
+import unimportant_school_config from "../view/unimportant_school_config";
 
 export default [
   {
@@ -99,6 +100,11 @@ export default [
         path: "school_config", //学校设置
         meta: { privilegeCodes: "school_config" },
         component: school_config
+      },
+      {
+        path: "unimportant_school_config", //学校设置
+        meta: { privilegeCodes: "unimportant_school_config" },
+        component: unimportant_school_config
       }
     ]
   }

+ 1 - 1
src/modules/basic/view/clientConfig.vue

@@ -495,7 +495,7 @@ export default {
   },
   created() {
     this.ruleForm.orgId = this.user.rootOrgId;
-    this.propertyGroupId = "studentClientConfig4Edit";
+    this.propertyGroupId = "config4Edit";
     this.uploadHeaders = {
       key: this.user.key,
       token: this.user.token

+ 1 - 1
src/modules/basic/view/school_config.vue

@@ -200,7 +200,7 @@ export default {
   },
   created() {
     this.ruleForm.orgId = this.user.rootOrgId;
-    this.propertyGroupId = "studentClientConfig4Edit";
+    this.propertyGroupId = "config4Edit";
     if (this.isSuperAdmin) {
       this.$httpWithMsg.get(CORE_API + "/org/getRootOrgList").then(response => {
         this.rootOrgList = response.data;

+ 163 - 0
src/modules/basic/view/unimportant_school_config.vue

@@ -0,0 +1,163 @@
+<template>
+  <el-container>
+    <el-main class="el-main-padding">
+      <el-form
+        :model="ruleForm"
+        :rules="rules"
+        ref="ruleForm"
+        label-width="200px"
+        class="demo-ruleForm"
+        :inline-message="true"
+      >
+        <el-form-item v-if="isSuperAdmin" label="学校">
+          <el-select
+            v-model="ruleForm.orgId"
+            placeholder="请选择"
+            style="width: 180px"
+          >
+            <el-option
+              v-for="item in rootOrgList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item
+          label="服务接口默认考试ID"
+          prop="THIRD_PARTY_API_DEFAULT_EXAM_ID"
+        >
+          <el-input
+            v-model="ruleForm.THIRD_PARTY_API_DEFAULT_EXAM_ID"
+            placeholder="请输入考试ID"
+            class="input-width"
+          ></el-input>
+        </el-form-item>
+        <el-form-item>
+          <el-button
+            :disabled="btnSaveDiabled"
+            type="primary"
+            @click="submitForm('ruleForm')"
+            >保 存
+          </el-button>
+        </el-form-item>
+      </el-form>
+    </el-main>
+  </el-container>
+</template>
+<script>
+import { mapState } from "vuex";
+import { CORE_API } from "@/constants/constants.js";
+
+export default {
+  data() {
+    return {
+      rootOrgList: [],
+      propertyGroupId: "",
+      formDataChanged: false,
+      originalRuleForm: {},
+      ruleForm: {
+        relatedPropertyGroupIdList: [],
+        orgId: null,
+        THIRD_PARTY_API_DEFAULT_EXAM_ID: "",
+        properties: {
+          THIRD_PARTY_API_DEFAULT_EXAM_ID: ""
+        }
+      }
+    };
+  },
+  methods: {
+    submitForm(formName) {
+      this.$refs[formName].validate(valid => {
+        if (valid) {
+          this.ruleForm.properties.THIRD_PARTY_API_DEFAULT_EXAM_ID = this.ruleForm.THIRD_PARTY_API_DEFAULT_EXAM_ID;
+
+          this.$httpWithMsg
+            .put(CORE_API + "/org/saveOrgProperties", this.ruleForm)
+            .then(
+              () => {
+                this.$notify({
+                  message: "保存成功",
+                  type: "success"
+                });
+                this.originalRuleForm = Object.assign({}, this.ruleForm);
+                this.formDataChanged = false;
+              },
+              () => {}
+            );
+        } else {
+          return false;
+        }
+      });
+    },
+
+    initForm() {
+      this.ruleForm.relatedPropertyGroupIdList = ["studentClientConfig"];
+      var url =
+        CORE_API +
+        "/org/getOrgPropertiesByGroupWithoutCache/" +
+        this.ruleForm.orgId +
+        "/" +
+        this.propertyGroupId;
+      this.$httpWithMsg.get(url).then(response => {
+        if (response) {
+          this.ruleForm.THIRD_PARTY_API_DEFAULT_EXAM_ID =
+            response.data.THIRD_PARTY_API_DEFAULT_EXAM_ID;
+
+          this.originalRuleForm = Object.assign({}, this.ruleForm);
+        } else {
+          this.$notify({
+            message: "学校设置信息暂未初始化,请立即初始化",
+            type: "warning"
+          });
+        }
+      });
+    }
+  },
+  created() {
+    this.ruleForm.orgId = this.user.rootOrgId;
+    this.propertyGroupId = "config4Edit";
+    if (this.isSuperAdmin) {
+      this.$httpWithMsg.get(CORE_API + "/org/getRootOrgList").then(response => {
+        this.rootOrgList = response.data;
+      });
+    }
+    this.initForm();
+  },
+  watch: {
+    "ruleForm.orgId": {
+      handler: function() {
+        this.initForm();
+      }
+    },
+    ruleForm: {
+      deep: true,
+      handler: function(newForm) {
+        if (Object.keys(this.originalRuleForm).length > 0) {
+          this.formDataChanged = !(
+            newForm.THIRD_PARTY_API_DEFAULT_EXAM_ID ==
+            this.originalRuleForm.THIRD_PARTY_API_DEFAULT_EXAM_ID
+          );
+        } else {
+          this.formDataChanged = false;
+        }
+      }
+    }
+  },
+  computed: {
+    ...mapState({ user: state => state.user }),
+    btnSaveDiabled() {
+      console.log(this.formDataChanged);
+      return !this.formDataChanged;
+    },
+    isSuperAdmin() {
+      return this.user.roleList.some(role => role.roleCode == "SUPER_ADMIN");
+    }
+  }
+};
+</script>
+<style scoped>
+.input-width {
+  width: 638px;
+}
+</style>