Ver Fonte

超管中心接口调试时

zhangjie há 2 anos atrás
pai
commit
3b3a5afcad

+ 3 - 0
src/assets/styles/base.scss

@@ -445,6 +445,9 @@ body {
 .mr-4 {
   margin-right: 20px;
 }
+.mt-1 {
+  margin-top: 5px;
+}
 .mb-0 {
   margin-bottom: 0;
 }

+ 1 - 1
src/assets/styles/home.scss

@@ -19,7 +19,7 @@
 
 .home-body-content {
   position: relative;
-  padding: 20px 30px 50px 250px;
+  padding: 20px 20px 50px 240px;
   min-height: 100%;
 }
 

+ 10 - 6
src/modules/admin/api.js

@@ -36,7 +36,7 @@ export const offlineActivation = datas => {
   return $post("/api/admin/auth/offline/activation", datas);
 };
 export const onlineActivation = datas => {
-  return $post("/api/admin/auth/online/activation", datas);
+  return $postParam("/api/admin/auth/online/activation", datas);
 };
 export const exportDeviceInfo = () => {
   return $post(
@@ -55,14 +55,18 @@ export const schoolSync = () => {
   return $postParam("/api/admin/common/school/sync", {});
 };
 export const updateSchool = datas => {
-  return $post("/api/admin/menu/custom/save", datas);
+  let formData = new FormData();
+  Object.keys(datas).forEach(k => {
+    formData.append(k, datas[k]);
+  });
+  return $post("/api/admin/common/school/update", formData);
 };
 // school-set
 export const schoolSetCheckInfo = schoolId => {
   return $postParam("/api/admin/set/user/select", { schoolId });
 };
 export const schoolSetCheckUpdate = datas => {
-  return $postParam("/api/admin/set/user/save", datas);
+  return $post("/api/admin/set/user/save", datas);
 };
 export const sysCustomMenuList = () => {
   return $postParam("/api/admin/set/menu/custom/list", {});
@@ -84,7 +88,7 @@ export const schoolSetPaperInfo = schoolId => {
   });
 };
 export const schoolSetPaperUpdate = datas => {
-  return $postParam("/api/admin/set/paper/save", datas);
+  return $post("/api/admin/set/paper/save", datas);
 };
 export const sysCustomRoleList = () => {
   return $postParam("/api/admin/set/role/custom/list", {});
@@ -95,7 +99,7 @@ export const schoolSetRoleInfo = schoolId => {
   });
 };
 export const schoolSetRoleUpdate = datas => {
-  return $postParam("/api/admin/set/role/custom/save", datas);
+  return $post("/api/admin/set/role/custom/save", datas);
 };
 export const schoolSetSyncInfo = schoolId => {
   return $postParam("/api/admin/set/sync/select", {
@@ -103,7 +107,7 @@ export const schoolSetSyncInfo = schoolId => {
   });
 };
 export const schoolSetSyncUpdate = datas => {
-  return $postParam("/api/admin/set/sync/save", datas);
+  return $post("/api/admin/set/sync/save", datas);
 };
 export const schoolSetDataBackup = schoolId => {
   return $postParam("/api/admin/set/backup", { schoolId });

+ 4 - 9
src/modules/admin/components/ModifySchool.vue

@@ -41,7 +41,7 @@
           :disabled="isSubmit"
           @file-change="logoChange"
         />
-        <div>
+        <div class="mt-1">
           <p class="tips-info">logo会展示在登录页及内页;</p>
           <p class="tips-info">
             文件必须是 jpg 或 png 格式的图片,不超过 2M 尺寸:160*40px。
@@ -112,13 +112,6 @@ export default {
             message: "请输入学校代码",
             trigger: "change"
           }
-        ],
-        logo: [
-          {
-            required: true,
-            message: "请选择logo",
-            trigger: "change"
-          }
         ]
       }
     };
@@ -128,13 +121,15 @@ export default {
       if (val.id) {
         this.modalForm = this.$objAssign(initModalForm, val);
         this.imgSrc = val.logo || "";
+        this.modalForm.logo = "";
+        this.modalForm.logoMd5 = "";
       } else {
         this.imgSrc = "";
         this.modalForm = { ...initModalForm };
       }
       this.$refs.modalFormComp.clearValidate();
       this.$nextTick(() => {
-        this.$refs.UploadFetchFile.setAttachmentName(this.imgSrc);
+        this.$refs.UploadFetchFile.setAttachmentName("");
       });
     },
     visibleChange() {

+ 6 - 5
src/modules/admin/components/school/SchoolSetCheck.vue

@@ -18,7 +18,7 @@
         <el-input
           v-else
           v-model="field.value"
-          :placeholder="`请输入${fidld.name}`"
+          :placeholder="`请输入${field.name}`"
           clearable
         >
         </el-input>
@@ -61,13 +61,14 @@ export default {
       const data = await schoolSetCheckInfo(this.school.id);
       this.fields = data.result || [];
       this.fields.forEach(field => {
-        field.isBoolean = typeof field.valid === "boolean";
+        field.isBoolean =
+          typeof field.value === "boolean" ||
+          ["true", "false"].includes(field.value);
+        if (field.isBoolean && ["true", "false"].includes(field.value))
+          field.value = field.value === "true";
       });
     },
     async confirm() {
-      const valid = await this.$refs.modalFormComp.validate();
-      if (!valid) return;
-
       if (this.loading) return;
       this.loading = true;
       const datas = { param: this.fields, schoolId: this.school.id };

+ 1 - 1
src/modules/admin/components/school/SchoolSetPaper.vue

@@ -6,7 +6,7 @@
       :rules="rules"
       label-width="180px"
     >
-      <el-form-item prop="pdfSize" label="允许上传试卷规格">
+      <el-form-item prop="pdfSize" label="允许上传试卷规格">
         <el-checkbox-group v-model="modalForm.pdfSize">
           <el-checkbox v-for="item in sysPdfSize" :key="item" :label="item">{{
             item

+ 1 - 1
src/modules/admin/components/school/SchoolSetRole.vue

@@ -6,7 +6,7 @@
       :rules="rules"
       label-width="140px"
     >
-      <el-form-item prop="roleIds" label="系统角色管理">
+      <el-form-item prop="roleIds" label="系统角色管理">
         <el-checkbox-group v-model="modalForm.roleIds">
           <el-checkbox
             v-for="item in roleList"

+ 15 - 6
src/modules/admin/components/school/SchoolSetSync.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="school-set-sync">
     <el-form
+      v-if="fields.length"
       ref="modalFormComp"
       :model="modalForm"
       :rules="rules"
@@ -9,7 +10,7 @@
       <el-form-item
         v-for="field in fields"
         :key="field.code"
-        :prop="field.code"
+        :prop="field.prop"
         :label="field.name + ':'"
       >
         <el-radio-group v-model="field.enable" @change="resetVal(field)">
@@ -21,7 +22,12 @@
           >
         </el-radio-group>
         <br />
-        <el-input v-model="field.value" placeholder="请输入调用地址" clearable>
+        <el-input
+          v-if="field.enable"
+          v-model="field.value"
+          placeholder="请输入调用地址"
+          clearable
+        >
         </el-input>
       </el-form-item>
       <el-form-item>
@@ -35,6 +41,7 @@
 
 <script>
 import { schoolSetSyncInfo, schoolSetSyncUpdate } from "../../api";
+import { OPEN_STATUS } from "../../../../constants/enumerate";
 
 export default {
   name: "school-set-sync",
@@ -49,6 +56,7 @@ export default {
   data() {
     return {
       loading: false,
+      OPEN_STATUS,
       modalForm: {},
       fields: [],
       rules: {}
@@ -62,9 +70,10 @@ export default {
       const data = await schoolSetSyncInfo(this.school.id);
       this.fields = data.result || [];
       this.fields.forEach(field => {
-        this.$set(this.modalForm, field.code, fidld.value);
+        field.prop = field.code.split(".").join("_");
+        this.$set(this.modalForm, field.prop, field.value);
 
-        this.rules[field.code] = [
+        this.rules[field.prop] = [
           {
             validator: (rule, value, callback) => {
               if (!field.value && field.enable) {
@@ -82,12 +91,12 @@ export default {
       if (!field.enable) field.value = "";
     },
     async confirm() {
-      const valid = await this.$refs.modalFormComp.validate();
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
       if (!valid) return;
 
       if (this.loading) return;
       this.loading = true;
-      const datas = { param: this.field, schoolId: this.school.id };
+      const datas = { param: this.fields, schoolId: this.school.id };
       const res = await schoolSetSyncUpdate(datas).catch(() => {});
       this.loading = false;
       if (!res) return;

+ 3 - 0
src/modules/base/api.js

@@ -143,6 +143,9 @@ export const updateTemplate = datas => {
 export const ableTemplate = ({ id, enable }) => {
   return $post("/api/admin/basic/template/enable", { id, enable });
 };
+export const deleteTemplate = id => {
+  return $postParam("/api/admin/basic/template/remove", { id });
+};
 export const templateCategoryList = type => {
   return $postParam("/api/admin/basic/template/list", type);
 };

+ 1 - 1
src/modules/base/components/PrivilegeSet.vue

@@ -213,7 +213,7 @@ export default {
     changRowColumnEnable(row, enable) {
       if (!row.isPage) return;
       row.columns.forEach(column => {
-        if (column.type === "page" || column.type === "page-checkbox") return;
+        if (!column.datas || !column.datas.length) return;
 
         column.datas.forEach(item => {
           item.enable = enable;

+ 43 - 15
src/modules/base/views/PrintTemplateManage.vue

@@ -120,6 +120,13 @@
               @click="toEnable(scope.row)"
               >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
             >
+            <el-button
+              v-if="checkPrivilege('link', 'delete')"
+              class="btn-danger"
+              type="text"
+              @click="toDelete(scope.row)"
+              >删除</el-button
+            >
           </template>
         </el-table-column>
       </el-table>
@@ -147,7 +154,12 @@
 <script>
 import { ABLE_TYPE, TEMPLATE_TYPE } from "@/constants/enumerate";
 import pickerOptions from "@/constants/datePickerOptions";
-import { templateListPage, ableTemplate, templateContentView } from "../api";
+import {
+  templateListPage,
+  ableTemplate,
+  templateContentView,
+  deleteTemplate
+} from "../api";
 import ModifyPrintTemplate from "../components/ModifyPrintTemplate";
 
 export default {
@@ -217,22 +229,38 @@ export default {
 
       window.open(content);
     },
-    toEnable(row) {
+    async toEnable(row) {
       const action = row.enable ? "禁用" : "启用";
+      const result = await this.$confirm(
+        `确定要${action}模板【${row.name}】吗?`,
+        "提示",
+        {
+          type: "warning"
+        }
+      ).catch(() => {});
+      if (result !== "confirm") return;
 
-      this.$confirm(`确定要${action}模板【${row.name}】吗?`, "提示", {
-        type: "warning"
-      })
-        .then(async () => {
-          const enable = !row.enable;
-          await ableTemplate({
-            id: row.id,
-            enable
-          });
-          row.enable = enable;
-          this.$message.success("操作成功!");
-        })
-        .catch(() => {});
+      const enable = !row.enable;
+      await ableTemplate({
+        id: row.id,
+        enable
+      });
+      row.enable = enable;
+      this.$message.success("操作成功!");
+    },
+    async toDelete(row) {
+      const result = await this.$confirm(
+        `确定要删除印品【${row.name}】吗?`,
+        "提示",
+        {
+          type: "warning"
+        }
+      ).catch(() => {});
+      if (result !== "confirm") return;
+
+      await deleteTemplate(row.id);
+      this.$message.success("操作成功!");
+      this.getList();
     }
   }
 };

+ 1 - 1
src/modules/base/views/UserManage.vue

@@ -157,7 +157,7 @@
               >{{ scope.row.enable ? "禁用" : "启用" }}</el-button
             >
             <el-button
-              v-if="checkPrivilege('link', 'reset')"
+              v-if="checkPrivilege('link', 'delete')"
               class="btn-danger"
               type="text"
               @click="toDelete(scope.row)"