xiatian 5 năm trước cách đây
mục cha
commit
fd31c897bb
1 tập tin đã thay đổi với 41 bổ sung39 xóa
  1. 41 39
      src/modules/basic/view/resource_list.vue

+ 41 - 39
src/modules/basic/view/resource_list.vue

@@ -13,7 +13,7 @@
             <el-select
               v-model="formSearch.rootOrgId"
               placeholder="请选择"
-              style="width: 180px"
+              style="width: 180px;"
             >
               <el-option
                 v-for="item in rootOrgList"
@@ -27,7 +27,7 @@
             <el-input
               placeholder="请输入名称"
               v-model="formSearch.name"
-              style="width: 180px"
+              style="width: 180px;"
             />
           </el-form-item>
           <el-form-item>
@@ -45,7 +45,7 @@
         <div class="block-seperator"></div>
 
         <span>当前目录:{{ this.curDir }}</span>
-        <span style="float:right">
+        <span style="float: right;">
           <el-button
             size="small"
             type="primary"
@@ -86,11 +86,13 @@
           </el-table-column>
           <el-table-column width="250" label="名称">
             <span slot-scope="scope">
-              <span style="width: 30px;height: 20px;display:block;float:left">
+              <span
+                style="width: 30px; height: 20px; display: block; float: left;"
+              >
                 <img
                   v-if="scope.row.isFile == 0"
                   src="../assets/img/dir.png"
-                  style="height: 20px;width: 20px;"
+                  style="height: 20px; width: 20px;"
                 />
               </span>
               <span
@@ -197,7 +199,7 @@
                 class="pull-length"
                 v-model="fileForm.fileName"
                 :readonly="true"
-                placeholder="文件最大限制50M"
+                placeholder="文件最大限制10M"
               />
             </el-form-item>
             <el-form-item>
@@ -232,16 +234,16 @@ import { mapState } from "vuex";
 export default {
   name: "ResourceList",
   data() {
-    var validateFile = function(rule, value, callback) {
+    var validateFile = function (rule, value, callback) {
       if (value) {
         var upFileName = value.name;
-        var reg = /^[a-zA-Z\\-_0-9.]{1,50}$/;
+        var reg = /^[a-zA-Z\-_0-9\.]{1,50}$/;
         if (!upFileName.match(reg)) {
           return callback(
             new Error("文件名长度最大为50且只能包含字母,数字,'-','_','.'")
           );
-        } else if (value.size > 1024 * 1024 * 50) {
-          return callback(new Error("文件大小限制为50M"));
+        } else if (value.size > 1024 * 1024 * 10) {
+          return callback(new Error("文件大小限制为10M"));
         } else {
           callback();
         }
@@ -263,16 +265,16 @@ export default {
         parentId: -1,
         rootOrgId: null,
         code: "",
-        name: ""
+        name: "",
       },
       dirForm: {
         dirName: "",
-        loading: false
+        loading: false,
       },
       fileForm: {
         fileName: null,
         dataFile: null,
-        loading: false
+        loading: false,
       },
       loading: true,
       tableData: [],
@@ -286,9 +288,9 @@ export default {
           {
             pattern: /^[a-zA-Z\\-_0-9]{1,50}$/,
             message: "目录名称必须为1-50位字母,数字,'-','_'组合",
-            trigger: "blur"
-          }
-        ]
+            trigger: "blur",
+          },
+        ],
       },
       fileRules: {
         dataFile: [
@@ -296,22 +298,22 @@ export default {
             required: true,
             type: "object",
             message: "请选择文件",
-            trigger: "change"
+            trigger: "change",
           },
           {
             validator: validateFile,
             type: "object",
-            trigger: "change"
-          }
-        ]
-      }
+            trigger: "change",
+          },
+        ],
+      },
     };
   },
   computed: {
-    ...mapState({ user: state => state.user }),
+    ...mapState({ user: (state) => state.user }),
     isSuperAdmin() {
-      return this.user.roleList.some(role => role.roleCode == "SUPER_ADMIN");
-    }
+      return this.user.roleList.some((role) => role.roleCode == "SUPER_ADMIN");
+    },
   },
   methods: {
     handleUploadFile(file) {
@@ -339,7 +341,7 @@ export default {
         .then(() => {
           this.$notify({
             type: "success",
-            message: "上传成功!"
+            message: "上传成功!",
           });
           this.closeFileModel();
           this.searchForm();
@@ -369,12 +371,12 @@ export default {
         .post(url, {
           parentId: this.formSearch.parentId,
           rootOrgId: this.formSearch.rootOrgId,
-          name: this.dirForm.dirName
+          name: this.dirForm.dirName,
         })
         .then(() => {
           this.$notify({
             type: "success",
-            message: "新增成功!"
+            message: "新增成功!",
           });
           this.closeDirModel();
           this.searchForm();
@@ -404,13 +406,13 @@ export default {
       this.$confirm("确定删除?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
-        type: "warning"
+        type: "warning",
       }).then(() => {
         var url = CORE_API + "/resource/" + row.id;
         this.$httpWithMsg.delete(url).then(() => {
           this.$notify({
             type: "success",
-            message: "删除成功!"
+            message: "删除成功!",
           });
           this.searchForm();
         });
@@ -426,7 +428,7 @@ export default {
       if (this.formSearch.rootOrgId == null) {
         this.$notify({
           type: "warning",
-          message: "请选择学校"
+          message: "请选择学校",
         });
         return;
       }
@@ -436,7 +438,7 @@ export default {
       if (this.formSearch.rootOrgId == null) {
         this.$notify({
           type: "warning",
-          message: "请选择学校"
+          message: "请选择学校",
         });
         return;
       }
@@ -460,7 +462,7 @@ export default {
       if (this.formSearch.rootOrgId == null) {
         this.$notify({
           type: "warning",
-          message: "请选择学校"
+          message: "请选择学校",
         });
         return;
       }
@@ -477,12 +479,12 @@ export default {
         param;
       this.$httpWithMsg
         .get(url)
-        .then(response => {
+        .then((response) => {
           this.tableData = response.data.list;
           this.total = response.data.total;
           this.loading = false;
 
-          this.$nextTick(function() {
+          this.$nextTick(function () {
             this.paginationShow = true;
           });
         })
@@ -492,14 +494,14 @@ export default {
       if (this.isSuperAdmin) {
         this.$httpWithMsg
           .get(CORE_API + "/org/getRootOrgList")
-          .then(response => {
+          .then((response) => {
             this.rootOrgList = response.data;
           });
       } else {
         this.formSearch.rootOrgId = this.user.rootOrgId;
         this.searchForm();
       }
-    }
+    },
   },
   watch: {
     "formSearch.rootOrgId": {
@@ -512,13 +514,13 @@ export default {
           this.formSearch.parentId = -1;
           this.handleSearchBtn();
         }
-      }
-    }
+      },
+    },
   },
   //初始化查询
   created() {
     this.init();
-  }
+  },
 };
 </script>