Преглед на файлове

1.增加鉴权。
2.message统一加showClose=true。

zhengqiang преди 4 години
родител
ревизия
cf5d8ff0a6
променени са 3 файла, в които са добавени 32 реда и са изтрити 3 реда
  1. 9 1
      src/api/sys/permission.js
  2. 14 1
      src/main.js
  3. 9 1
      src/views/business/workAttendance-list.vue

+ 9 - 1
src/api/sys/permission.js

@@ -53,6 +53,14 @@ function batchRemove(idList){
   });
 }
 
+function hasPermission(method,path){
+  var formData = new FormData();
+  formData.append("method", method);
+  formData.append("path", path);
+
+  return request.post(constant.serverUrl + "/sys/permission/hasPermission",formData);
+}
+
 export default {
-  pageList,create,edit,add,update,remove,batchRemove,selectAll,batchImport
+  pageList,create,edit,add,update,remove,batchRemove,selectAll,batchImport,hasPermission
 }

+ 14 - 1
src/main.js

@@ -6,7 +6,7 @@ import echarts from 'echarts'
 import './plugins/element.js'
 import AxiosPlugin from './plugins/AxiosPlugin'
 import './assets/iconfont/iconfont.css'
-
+import { Message } from 'element-ui'
 import AMap from "vue-amap"
 
 Vue.config.productionTip = false
@@ -23,6 +23,19 @@ AMap.initAMapApiLoader({
 
 Vue.prototype.$echarts = echarts
 
+
+var MY_MESSAGE_DEFAULT = {
+  showClose: true
+}
+ 
+Vue.prototype.$message = function (options) {
+  if (typeof (options) === 'object') {
+    options = Object.assign({}, MY_MESSAGE_DEFAULT, options)
+  }
+
+  Message(options)
+}
+
 new Vue({
   router,
   store,

+ 9 - 1
src/views/business/workAttendance-list.vue

@@ -120,6 +120,7 @@
         icon="el-icon-edit"
         :loading="loading"
         @click="handleBatchUpdate"
+        v-show="batchUpdateVisible"
       >重新生成考勤数据</el-button>
     </el-row>
     <el-table ref="formTable" stripe :data="tableData" :height="tableHeight" style="width: 100%" v-loading="loading">
@@ -167,6 +168,7 @@ import Constant from "@/constant";
 import workAttendanceApi from "@/api/business/workAttendance";
 import companyPositionApi from "@/api/base/companyPosition";
 import companyInfoApi from "@/api/base/companyInfo";
+import permissionApi from "@/api/sys/permission";
 import SelectTree from "@/components/SelectTree";
 
 import NProgress from "nprogress"; // progress bar
@@ -239,7 +241,8 @@ export default {
         value: "id",
         label: "name",
         children: "children"
-      }
+      },
+      batchUpdateVisible: false
     };
   },
   created() {
@@ -277,6 +280,11 @@ export default {
       }
     });
 
+    permissionApi.hasPermission("post","/business/workAttendance/batchUpdate")
+    .then(response=>{
+      this.batchUpdateVisible = response.data.result;
+    });
+
     this.getCurrentMonthFirst();
     this.loadTree();
   },