xiatian 3 жил өмнө
parent
commit
ff8e973569

+ 6 - 0
src/constants/constants.js

@@ -112,3 +112,9 @@ export const LOGIN_SUPPORT = [
   { code: "NATIVE", name: "考生端登录" },
   { code: "BROWSER", name: "浏览器登录" },
 ];
+
+export const AUDIT_AUTHORITY = [
+  { code: "FIRST", name: "初级" },
+  { code: "SECOND", name: "中级" },
+  { code: "THIRD", name: "高级" },
+];

+ 9 - 1
src/filters/filters.js

@@ -1,6 +1,6 @@
 import "../modules/questions/filters/filters";
 import Vue from "vue";
-import { LEVEL_TYPE_SELECT } from "@/constants/constants";
+import { LEVEL_TYPE_SELECT, AUDIT_AUTHORITY } from "@/constants/constants";
 
 // 课程层次过滤器
 Vue.filter("levelTypeFilter", function (val) {
@@ -10,3 +10,11 @@ Vue.filter("levelTypeFilter", function (val) {
     }
   }
 });
+
+Vue.filter("auditAuthorityFilter", function (val) {
+  for (let e of AUDIT_AUTHORITY) {
+    if (e.code === val) {
+      return e.name;
+    }
+  }
+});

+ 70 - 20
src/modules/questions/views/data_previllege.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <LinkTitlesCustom :current-paths="['用户管理', '关联课程']" />
+    <LinkTitlesCustom :current-paths="['用户管理', '权限设置']" />
     <section class="content">
       <div v-loading.body="loading" class="box box-info">
         <!-- 正文信息 -->
@@ -12,16 +12,39 @@
             inline-message
             label-position="right"
           >
-            <div style="margin-bottom: 10px">
-              <!-- <el-button type="primary" size="small">保 存</el-button> -->
-              <el-button
-                type="primary"
-                size="small"
-                icon="el-icon-arrow-left"
-                @click="back"
-                >返 回</el-button
+            <el-row>
+              <el-col :span="18"
+                ><span>{{ userName }}</span></el-col
               >
-            </div>
+              <el-col :span="6"
+                ><div style="margin-bottom: 10px">
+                  <el-button type="primary" size="small" @click="save"
+                    >保存</el-button
+                  >
+                  <el-button
+                    type="primary"
+                    size="small"
+                    icon="el-icon-arrow-left"
+                    @click="back"
+                    >返回</el-button
+                  >
+                </div></el-col
+              >
+            </el-row>
+            <div class="block-seperator"></div>
+            <el-row>
+              <el-form-item label="审核权限">
+                <el-radio-group v-model="form.auditAuthority" class="input">
+                  <el-radio label="FIRST">初级</el-radio>
+                  <el-radio label="SECOND">中级</el-radio>
+                  <el-radio label="THIRD">高级</el-radio>
+                </el-radio-group></el-form-item
+              >
+              <el-button type="primary" size="small" @click="clear"
+                >清空</el-button
+              >
+            </el-row>
+            <div class="block-seperator"></div>
             <el-tabs v-model="activeName" type="border-card">
               <el-tab-pane label="关联课程" name="tab1">
                 <el-row class="mb-2">
@@ -102,7 +125,7 @@
     </section>
     <DataPrevillegeAddCourseDialog
       ref="addCourseDialog"
-      :user-id="userId"
+      :user-id="form.userId"
       @reload="init"
     />
   </div>
@@ -123,6 +146,7 @@ export default {
   },
   data() {
     return {
+      userName: "",
       rolePrivileges: {
         user_data_rule_setting: false,
       },
@@ -135,9 +159,10 @@ export default {
       activeName: "tab1",
       toActiveName: null,
       form: {
+        userId: "",
         defaultStatusCourse: false,
+        auditAuthority: "",
       },
-      userId: "",
       paginationShow: false,
       selectedChanged: false,
       tableDataCourse: [],
@@ -162,21 +187,49 @@ export default {
       return;
     }
 
-    this.userId = this.$route.params.userId;
+    this.form.userId = this.$route.params.userId;
     await this.init();
     this.$nextTick(function () {
       this.paginationShow = true;
     });
   },
   methods: {
+    async save() {
+      try {
+        await this.$httpWithMsg.post(
+          QUESTION_API + "/user/updateAuditAuthority",
+          {
+            auditAuthority: this.form.auditAuthority,
+            id: this.form.userId,
+          }
+        );
+
+        this.$notify({
+          type: "success",
+          message: "保存成功",
+        });
+        await this.back();
+      } catch (error) {
+        console.log(error);
+      }
+    },
+    clear() {
+      this.form.auditAuthority = null;
+    },
     async init() {
+      this.$httpWithMsg
+        .get(QUESTION_API + "/user/" + this.form.userId)
+        .then((res) => {
+          this.userName = res.data.name + "(" + res.data.roleNamesStr + ")";
+          this.form.auditAuthority = res.data.auditAuthority;
+        });
       const reqs = [];
       const defaultPrevilleges = ["COURSE"];
       for (const defP of defaultPrevilleges) {
         let url =
           QUESTION_API +
           "/user/data/rule/default/status?" +
-          `userId=${this.userId}&type=${defP}`;
+          `userId=${this.form.userId}&type=${defP}`;
         reqs.push(this.$httpWithMsg.post(url));
       }
 
@@ -189,7 +242,7 @@ export default {
         const pageSize = this.$data["pageSize" + defP];
         reqs.push(
           this.$httpWithMsg.post(url, {
-            userId: this.userId,
+            userId: this.form.userId,
             pageNo,
             pageSize,
           })
@@ -237,7 +290,7 @@ export default {
             object2QueryString({
               enabled,
               type: type.toUpperCase(),
-              userId: this.userId,
+              userId: this.form.userId,
             })
         );
         this.$notify({
@@ -255,7 +308,7 @@ export default {
         await this.$httpWithMsg.post(QUESTION_API + "/user/data/rule/delete", {
           refIds,
           type: type.toUpperCase(),
-          userId: this.userId,
+          userId: this.form.userId,
         });
 
         this.$notify({
@@ -289,9 +342,6 @@ export default {
   width: 800px;
 }
 
-.input {
-  width: 440px;
-}
 .input >>> .el-input__inner {
   -webkit-appearance: button;
 }

+ 6 - 1
src/modules/questions/views/user.vue

@@ -423,6 +423,11 @@
             >
             </span>
           </el-table-column>
+          <el-table-column width="100" label="审核权限">
+            <span slot-scope="scope">{{
+              scope.row.auditAuthority | auditAuthorityFilter
+            }}</span>
+          </el-table-column>
           <el-table-column width="120" label="关联课程">
             <span
               slot-scope="scope"
@@ -504,7 +509,7 @@
                               `./user/data_previllege/${scope.row.id}`
                             )
                         "
-                        >关联课程
+                        >权限设置
                       </el-button>
                     </el-dropdown-item>
                     <el-dropdown-item>