瀏覽代碼

管理后台-代码格式化

panyong 3 年之前
父節點
當前提交
5029394b9d
共有 56 個文件被更改,包括 2348 次插入2334 次删除
  1. 5 5
      htmldev/manage/.prettierrc
  2. 7 2
      htmldev/manage/jsconfig.json
  3. 4 4
      htmldev/manage/src/App.vue
  4. 21 21
      htmldev/manage/src/assets/style/public.scss
  5. 10 9
      htmldev/manage/src/components/Breadcrumb/index.vue
  6. 4 4
      htmldev/manage/src/components/Hamburger/index.vue
  7. 7 7
      htmldev/manage/src/components/SvgIcon/index.vue
  8. 54 52
      htmldev/manage/src/components/_dialog/exampleDialog.vue
  9. 54 54
      htmldev/manage/src/components/_dialog/modPassword.vue
  10. 71 67
      htmldev/manage/src/components/upload/index.vue
  11. 8 8
      htmldev/manage/src/directive/permission/index.js
  12. 8 8
      htmldev/manage/src/directive/permission/permission.js
  13. 4 3
      htmldev/manage/src/layout/components/AppMain.vue
  14. 10 10
      htmldev/manage/src/layout/components/Navbar.vue
  15. 3 3
      htmldev/manage/src/layout/components/Sidebar/FixiOSBug.js
  16. 8 9
      htmldev/manage/src/layout/components/Sidebar/index.vue
  17. 43 41
      htmldev/manage/src/layout/index.vue
  18. 6 6
      htmldev/manage/src/layout/mixin/ResizeHandler.js
  19. 2 2
      htmldev/manage/src/main.js
  20. 52 52
      htmldev/manage/src/mixin/page.js
  21. 1 0
      htmldev/manage/src/router/import-development.js
  22. 1 0
      htmldev/manage/src/router/import-production.js
  23. 29 23
      htmldev/manage/src/router/index.js
  24. 4 3
      htmldev/manage/src/store/getters.js
  25. 3 3
      htmldev/manage/src/store/modules/app.js
  26. 36 36
      htmldev/manage/src/store/modules/common.js
  27. 53 56
      htmldev/manage/src/store/modules/permission.js
  28. 1 2
      htmldev/manage/src/store/modules/settings.js
  29. 5 5
      htmldev/manage/src/store/modules/user.js
  30. 3 3
      htmldev/manage/src/utils/auth.js
  31. 7 7
      htmldev/manage/src/utils/enum.js
  32. 2 2
      htmldev/manage/src/utils/filter.js
  33. 1 1
      htmldev/manage/src/utils/get-page-title.js
  34. 4 4
      htmldev/manage/src/utils/index.js
  35. 1 1
      htmldev/manage/src/utils/main-config.js
  36. 0 85
      htmldev/manage/src/utils/request.js
  37. 140 137
      htmldev/manage/src/utils/rules.js
  38. 1 1
      htmldev/manage/src/utils/validate.js
  39. 15 15
      htmldev/manage/src/utils/vue-bus.js
  40. 20 4
      htmldev/manage/src/views/404.vue
  41. 15 25
      htmldev/manage/src/views/dashboard/index.vue
  42. 78 75
      htmldev/manage/src/views/department/details.vue
  43. 93 90
      htmldev/manage/src/views/department/index.vue
  44. 5 5
      htmldev/manage/src/views/icons/index.vue
  45. 288 263
      htmldev/manage/src/views/login/index.vue
  46. 70 69
      htmldev/manage/src/views/project/components/filterAdd.vue
  47. 76 74
      htmldev/manage/src/views/project/details.vue
  48. 96 93
      htmldev/manage/src/views/project/filterPath.vue
  49. 142 129
      htmldev/manage/src/views/project/index.vue
  50. 125 120
      htmldev/manage/src/views/project/permissions.vue
  51. 88 87
      htmldev/manage/src/views/project/ruleDialog.vue
  52. 93 89
      htmldev/manage/src/views/roles/details.vue
  53. 105 101
      htmldev/manage/src/views/roles/index.vue
  54. 111 112
      htmldev/manage/src/views/roles/permissions.vue
  55. 139 134
      htmldev/manage/src/views/user/details.vue
  56. 116 113
      htmldev/manage/src/views/user/index.vue

+ 5 - 5
htmldev/manage/.prettierrc

@@ -1,7 +1,7 @@
 {
-    "printWidth": 160,
-    "tabWidth": 4,
-    "singleQuote": true,
-    "semi": false,
-    "arrowParens": "avoid"
+  "printWidth": 160,
+  "tabWidth": 4,
+  "singleQuote": true,
+  "semi": false,
+  "arrowParens": "avoid"
 }

+ 7 - 2
htmldev/manage/jsconfig.json

@@ -2,8 +2,13 @@
   "compilerOptions": {
     "baseUrl": "./",
     "paths": {
-        "@/*": ["src/*"]
+      "@/*": [
+        "src/*"
+      ]
     }
   },
-  "exclude": ["node_modules", "dist"]
+  "exclude": [
+    "node_modules",
+    "dist"
+  ]
 }

+ 4 - 4
htmldev/manage/src/App.vue

@@ -1,11 +1,11 @@
 <template>
-    <div id="app">
-        <router-view />
-    </div>
+  <div id="app">
+    <router-view/>
+  </div>
 </template>
 
 <script>
 export default {
-    name: 'App'
+  name: 'App'
 }
 </script>

+ 21 - 21
htmldev/manage/src/assets/style/public.scss

@@ -1,40 +1,40 @@
 // 禁止用户选中 鼠标变为手形
 %unable-select {
-    user-select: none;
-    cursor: pointer;
+  user-select: none;
+  cursor: pointer;
 }
 
 // 填满父元素
 // 组要父元素 position: relative | absolute;
 %full {
-    position: absolute;
-    top: 0;
-    right: 0;
-    left: 0;
-    bottom: 0;
+  position: absolute;
+  top: 0;
+  right: 0;
+  left: 0;
+  bottom: 0;
 }
 
 // flex 垂直水平居中
 %flex-center-row {
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    flex-direction: row;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: row;
 }
 
 %flex-center-column {
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    flex-direction: column;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  flex-direction: column;
 }
 
 // 将元素模拟成卡片外观
 %card {
-    border: 1px solid #dddee1;
-    border-color: #e9eaec;
-    background: #fff;
-    border-radius: 4px;
-    font-size: 14px;
-    position: relative;
+  border: 1px solid #dddee1;
+  border-color: #e9eaec;
+  background: #fff;
+  border-radius: 4px;
+  font-size: 14px;
+  position: relative;
 }

+ 10 - 9
htmldev/manage/src/components/Breadcrumb/index.vue

@@ -2,7 +2,8 @@
   <el-breadcrumb class="app-breadcrumb" separator="/">
     <transition-group name="breadcrumb">
       <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
-        <span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
+        <span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title
+          }}</span>
         <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
       </el-breadcrumb-item>
     </transition-group>
@@ -13,45 +14,45 @@
 import pathToRegexp from 'path-to-regexp'
 
 export default {
-  data() {
+  data () {
     return {
       levelList: null
     }
   },
   watch: {
-    $route() {
+    $route () {
       this.getBreadcrumb()
     }
   },
-  created() {
+  created () {
     this.getBreadcrumb()
   },
   methods: {
-    getBreadcrumb() {
+    getBreadcrumb () {
       // only show routes with meta.title
       let matched = this.$route.matched.filter(item => item.meta && item.meta.title)
       const first = matched[0]
 
       if (!this.isDashboard(first)) {
-        matched = [{ path: '/dashboard', meta: { title: '工作台' }}].concat(matched)
+        matched = [{ path: '/dashboard', meta: { title: '工作台' } }].concat(matched)
       }
 
       this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
     },
-    isDashboard(route) {
+    isDashboard (route) {
       const name = route && route.name
       if (!name) {
         return false
       }
       return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase()
     },
-    pathCompile(path) {
+    pathCompile (path) {
       // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
       const { params } = this.$route
       var toPath = pathToRegexp.compile(path)
       return toPath(params)
     },
-    handleLink(item) {
+    handleLink (item) {
       const { redirect, path } = item
       if (redirect) {
         this.$router.push(redirect)

+ 4 - 4
htmldev/manage/src/components/Hamburger/index.vue

@@ -6,9 +6,9 @@
       viewBox="0 0 1024 1024"
       xmlns="http://www.w3.org/2000/svg"
       width="64"
-      height="64"
-    >
-      <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z" />
+      height="64">
+      <path
+        d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM142.4 642.1L298.7 519a8.84 8.84 0 0 0 0-13.9L142.4 381.9c-5.8-4.6-14.4-.5-14.4 6.9v246.3a8.9 8.9 0 0 0 14.4 7z"/>
     </svg>
   </div>
 </template>
@@ -23,7 +23,7 @@ export default {
     }
   },
   methods: {
-    toggleClick() {
+    toggleClick () {
       this.$emit('toggleClick')
     }
   }

+ 7 - 7
htmldev/manage/src/components/SvgIcon/index.vue

@@ -1,7 +1,7 @@
 <template>
-  <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners" />
+  <div v-if="isExternal" :style="styleExternalIcon" class="svg-external-icon svg-icon" v-on="$listeners"/>
   <svg v-else :class="svgClass" aria-hidden="true" v-on="$listeners">
-    <use :xlink:href="iconName" />
+    <use :xlink:href="iconName"/>
   </svg>
 </template>
 
@@ -22,20 +22,20 @@ export default {
     }
   },
   computed: {
-    isExternal() {
+    isExternal () {
       return isExternal(this.iconClass)
     },
-    iconName() {
+    iconName () {
       return `#icon-${this.iconClass}`
     },
-    svgClass() {
+    svgClass () {
       if (this.className) {
         return 'svg-icon ' + this.className
       } else {
         return 'svg-icon'
       }
     },
-    styleExternalIcon() {
+    styleExternalIcon () {
       return {
         mask: `url(${this.iconClass}) no-repeat 50% 50%`,
         '-webkit-mask': `url(${this.iconClass}) no-repeat 50% 50%`
@@ -56,7 +56,7 @@ export default {
 
 .svg-external-icon {
   background-color: currentColor;
-  mask-size: cover!important;
+  mask-size: cover !important;
   display: inline-block;
 }
 </style>

+ 54 - 52
htmldev/manage/src/components/_dialog/exampleDialog.vue

@@ -1,65 +1,67 @@
 <template>
-    <div>
-        <el-dialog title="test" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
-            <p class="top-tip fc-theme">这是个例子</p>
-            <el-form ref="form" :model="form" label-width="80px" class="bind-phone">
-                <el-form-item label="充值金额:" label-width="150px" >
-                    <el-input v-model="form.amount" placeholder="请输入充值金额"> </el-input>
-                </el-form-item>
-                <el-form-item label="充值订单号:" label-width="150px">
-                    <el-input placeholder="请输入订单号" @keyup.enter.native="handleSubmit" v-model="form.trade_sn"></el-input>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-    </div>
+  <div>
+    <el-dialog title="test" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
+      <p class="top-tip fc-theme">这是个例子</p>
+      <el-form ref="form" :model="form" label-width="80px" class="bind-phone">
+        <el-form-item label="充值金额:" label-width="150px">
+          <el-input v-model="form.amount" placeholder="请输入充值金额"></el-input>
+        </el-form-item>
+        <el-form-item label="充值订单号:" label-width="150px">
+          <el-input placeholder="请输入订单号" @keyup.enter.native="handleSubmit" v-model="form.trade_sn"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exampleData: {
-            type: Object,
-            default: {}
-        }
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    data() {
-        return {
-            dialog: !!this.value,
-            form: {
-                amount: '',
-                trade_sn: ''
-            }
-        }
-    },
-    methods: {
-        async handleSubmit() {
-            const data = await this.$fetch('/recharge_query', {...this.form})
-            if (data.code === 200) {
-                this.$message.success('提交成功')
-                this.$emit('success')
-                this.dialog = false
-            }
-        }
-    },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
-        }
+    exampleData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      form: {
+        amount: '',
+        trade_sn: ''
+      }
+    }
+  },
+  methods: {
+    async handleSubmit () {
+      const data = await this.$fetch('/recharge_query', { ...this.form })
+      if (data.code === 200) {
+        this.$message.success('提交成功')
+        this.$emit('success')
+        this.dialog = false
+      }
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
-</style>
+</style>

+ 54 - 54
htmldev/manage/src/components/_dialog/modPassword.vue

@@ -1,67 +1,67 @@
 <template>
-    <div>
-        <el-dialog title="修改密码" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
-            <el-form ref="form" :model="form" :rules="formRules" label-width="80px" class="bind-phone">
-                <el-form-item label="旧密码:" label-width="150px" prop="old_password" :rules="formRules.password">
-                    <el-input v-model="form.old_password" placeholder="请输入旧密码"> </el-input>
-                </el-form-item>
-                <el-form-item label="新密码:" label-width="150px" prop="new_password" :rules="formRules.password">
-                    <el-input placeholder="请输入新密码" @keyup.enter.native="handleSubmit" v-model="form.new_password"></el-input>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-    </div>
+  <div>
+    <el-dialog title="修改密码" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
+      <el-form ref="form" :model="form" :rules="formRules" label-width="80px" class="bind-phone">
+        <el-form-item label="旧密码:" label-width="150px" prop="old_password" :rules="formRules.password">
+          <el-input v-model="form.old_password" placeholder="请输入旧密码"></el-input>
+        </el-form-item>
+        <el-form-item label="新密码:" label-width="150px" prop="new_password" :rules="formRules.password">
+          <el-input placeholder="请输入新密码" @keyup.enter.native="handleSubmit" v-model="form.new_password"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        }
-    },
-    data() {
-        return {
-            dialog: !!this.value,
-            form: {
-                old_password: '',
-                new_password: ''
-            }
-        }
-    },
-    methods: {
-        async handleSubmit() {
-            this.$refs.form.validate(async valid => {
-                if (valid) {
-                    const data = await this.$fetch('/user/set_me_password', this.form)
-                    if (data.code == 200) {
-                        await this.$store.dispatch('user/logout')
-                        this.$router.push(`/login`)
-                    }
-                } else {
-                    console.log('error submit!!')
-                    return false
-                }
-            })
-            
-        }
-    },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
+  props: {
+    value: {
+      type: Boolean,
+      default: true
+    }
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      form: {
+        old_password: '',
+        new_password: ''
+      }
+    }
+  },
+  methods: {
+    async handleSubmit () {
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          const data = await this.$fetch('/user/set_me_password', this.form)
+          if (data.code == 200) {
+            await this.$store.dispatch('user/logout')
+            this.$router.push(`/login`)
+          }
+        } else {
+          console.log('error submit!!')
+          return false
         }
+      })
+
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
-</style>
+</style>

+ 71 - 67
htmldev/manage/src/components/upload/index.vue

@@ -1,88 +1,92 @@
 <template>
-    <div class="upload-wrapper">
-        <el-upload
-            class="avatar-uploader"
-            action="/api/uploadFile"
-            accept="image/*"
-            :show-file-list="false"
-            :headers="header"
-            name="imgFile"
-            :on-success="handleAvatarSuccess"
-            :before-upload="beforeAvatarUpload">
-            <img v-if="imageUrl" :src="imageUrl" class="avatar">
-            <i v-else class="el-icon-plus avatar-uploader-icon"></i>
-        </el-upload>
-    </div>
+  <div class="upload-wrapper">
+    <el-upload
+      class="avatar-uploader"
+      action="/api/uploadFile"
+      accept="image/*"
+      :show-file-list="false"
+      :headers="header"
+      name="imgFile"
+      :on-success="handleAvatarSuccess"
+      :before-upload="beforeAvatarUpload">
+      <img v-if="imageUrl" :src="imageUrl" class="avatar">
+      <i v-else class="el-icon-plus avatar-uploader-icon"></i>
+    </el-upload>
+  </div>
 </template>
 
 <script>
-import {getToken} from '@/utils/auth'
+import { getToken } from '@/utils/auth'
+
 export default {
-    props: {
-        type: {
-            type: String,
-            default: 'qrcode'
-        },
-        value: {
-            type: String,
-            default: ''
-        },
+  props: {
+    type: {
+      type: String,
+      default: 'qrcode'
+    },
+    value: {
+      type: String,
+      default: ''
     },
-    data() {
-        return {
-            imageUrl: this.value,
-            header: {
-                'token': getToken(),
-            },
-        }
+  },
+  data () {
+    return {
+      imageUrl: this.value,
+      header: {
+        'token': getToken(),
+      },
+    }
+  },
+  methods: {
+    handleAvatarSuccess (res, file) {
+      console.log(res)
+      if (res.code == 200) {
+        this.$emit('input', res.data.path)
+      }
+      // this.imageUrl = URL.createObjectURL(file.raw);
     },
-    methods: {
-        handleAvatarSuccess(res, file) {
-            console.log(res);
-            if (res.code == 200) {
-                this.$emit('input', res.data.path)
-            }
-            // this.imageUrl = URL.createObjectURL(file.raw);
-        },
-        beforeAvatarUpload(file) {
-            const isLt2M = file.size / 1024 / 1024 < 5;
-            if (!isLt2M) {
-            this.$message.error('上传头像图片大小不能超过 5MB!');
-            }
-            return isLt2M;
-        },
+    beforeAvatarUpload (file) {
+      const isLt2M = file.size / 1024 / 1024 < 5
+      if (!isLt2M) {
+        this.$message.error('上传头像图片大小不能超过 5MB!')
+      }
+      return isLt2M
     },
-    watch: {
-        value(n, o) {
-            // this.imageUrl = n ? ('http://' + this.configData.static_url + '/' + n) : ''
-            this.imageUrl = n
-        }
+  },
+  watch: {
+    value (n, o) {
+      // this.imageUrl = n ? ('http://' + this.configData.static_url + '/' + n) : ''
+      this.imageUrl = n
     }
+  }
 }
 </script>
 
 <style lang="scss">
 .avatar-uploader .el-upload {
-    border: 1px dashed #d9d9d9;
-    border-radius: 6px;
-    cursor: pointer;
-    position: relative;
-    overflow: hidden;
+  border: 1px dashed #d9d9d9;
+  border-radius: 6px;
+  cursor: pointer;
+  position: relative;
+  overflow: hidden;
 }
+
 .avatar-uploader .el-upload:hover {
-    border-color: #409eff;
+  border-color: #409eff;
 }
+
 .avatar-uploader-icon {
-    font-size: 28px;
-    color: #8c939d;
-    width: 178px;
-    height: 178px;
-    line-height: 178px;
-    text-align: center;
+  font-size: 28px;
+  color: #8c939d;
+  width: 178px;
+  height: 178px;
+  line-height: 178px;
+  text-align: center;
 }
+
 .avatar {
-    width: 178px;
-    height: 178px;
-    display: block;
+  width: 178px;
+  height: 178px;
+  display: block;
 }
-</style>
+</style>

+ 8 - 8
htmldev/manage/src/directive/permission/index.js

@@ -1,13 +1,13 @@
-import permission from './permission';
+import permission from './permission'
 // eslint-disable-next-line func-names
-const install = function(Vue) {
-  Vue.directive('permission', permission);
-};
+const install = function (Vue) {
+  Vue.directive('permission', permission)
+}
 
 if (window.Vue) {
-  window.permission = permission;
-  Vue.use(install); // eslint-disable-line
+  window.permission = permission
+  Vue.use(install) // eslint-disable-line
 }
 
-permission.install = install;
-export default permission;
+permission.install = install
+export default permission

+ 8 - 8
htmldev/manage/src/directive/permission/permission.js

@@ -1,21 +1,21 @@
-import store from "@/store"
+import store from '@/store'
 
 export default {
-  inserted(el, binding, vnode) {
-    const { value } = binding;
+  inserted (el, binding, vnode) {
+    const { value } = binding
     const permissions = store.getters.pageRoleArray || []
     // console.log('permissionList---', permissions)
     const hasPermission = permissions.includes(value)
     if (!hasPermission) {
       // eslint-disable-next-line no-unused-expressions
       if (el.parentNode) {
-        console.log(el);
-        el.parentNode.removeChild(el);
+        console.log(el)
+        el.parentNode.removeChild(el)
       } else {
-        el.innerHTML = "";
+        el.innerHTML = ''
       }
     } else {
-      el && el.setAttribute("code", value);
+      el && el.setAttribute('code', value)
     }
   },
-};
+}

+ 4 - 3
htmldev/manage/src/layout/components/AppMain.vue

@@ -1,7 +1,7 @@
 <template>
   <section class="app-main">
     <transition name="fade-transform" mode="out-in">
-      <router-view :key="key" />
+      <router-view :key="key"/>
     </transition>
   </section>
 </template>
@@ -10,7 +10,7 @@
 export default {
   name: 'AppMain',
   computed: {
-    key() {
+    key () {
       return this.$route.path
     }
   }
@@ -25,7 +25,8 @@ export default {
   position: relative;
   overflow: hidden;
 }
-.fixed-header+.app-main {
+
+.fixed-header + .app-main {
   padding-top: 50px;
 }
 </style>

+ 10 - 10
htmldev/manage/src/layout/components/Navbar.vue

@@ -1,14 +1,14 @@
 <template>
   <div class="navbar">
-    <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" />
+    <hamburger :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar"/>
 
-    <breadcrumb class="breadcrumb-container" />
+    <breadcrumb class="breadcrumb-container"/>
 
     <div class="right-menu">
       <el-dropdown class="avatar-container" trigger="click">
         <div class="avatar-wrapper">
           <img src="https://pic.rmb.bdstatic.com/bjh/840702eef7eb4f6196853a99323c87cb.png" class="user-avatar">
-          <i class="el-icon-caret-bottom" />
+          <i class="el-icon-caret-bottom"/>
         </div>
         <el-dropdown-menu slot="dropdown" class="user-dropdown">
           <router-link to="/">
@@ -33,7 +33,7 @@
 import { mapGetters } from 'vuex'
 import Breadcrumb from '@/components/Breadcrumb'
 import Hamburger from '@/components/Hamburger'
-import modPassword from '@/components/_dialog/modPassword';
+import modPassword from '@/components/_dialog/modPassword'
 
 export default {
   components: {
@@ -47,7 +47,7 @@ export default {
       'avatar'
     ])
   },
-  data() {
+  data () {
     return {
       modPasswordDialog: {
         show: false,
@@ -55,13 +55,13 @@ export default {
     }
   },
   methods: {
-    modPassword() {
+    modPassword () {
       this.modPasswordDialog.show = true
     },
-    toggleSideBar() {
+    toggleSideBar () {
       this.$store.dispatch('app/toggleSideBar')
     },
-    async logout() {
+    async logout () {
       await this.$store.dispatch('user/logout')
       this.$router.push(`/login`)
     }
@@ -75,7 +75,7 @@ export default {
   overflow: hidden;
   position: relative;
   background: #fff;
-  box-shadow: 0 1px 4px rgba(0,21,41,.08);
+  box-shadow: 0 1px 4px rgba(0, 21, 41, .08);
 
   .hamburger-container {
     line-height: 46px;
@@ -83,7 +83,7 @@ export default {
     float: left;
     cursor: pointer;
     transition: background .3s;
-    -webkit-tap-highlight-color:transparent;
+    -webkit-tap-highlight-color: transparent;
 
     &:hover {
       background: rgba(0, 0, 0, .025)

+ 3 - 3
htmldev/manage/src/layout/components/Sidebar/FixiOSBug.js

@@ -1,16 +1,16 @@
 export default {
   computed: {
-    device() {
+    device () {
       return this.$store.state.app.device
     }
   },
-  mounted() {
+  mounted () {
     // In order to fix the click on menu on the ios device will trigger the mouseleave bug
     // https://github.com/PanJiaChen/vue-element-admin/issues/1135
     this.fixBugIniOS()
   },
   methods: {
-    fixBugIniOS() {
+    fixBugIniOS () {
       const $subMenu = this.$refs.subMenu
       if ($subMenu) {
         const handleMouseleave = $subMenu.handleMouseleave

+ 8 - 9
htmldev/manage/src/layout/components/Sidebar/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div :class="{'has-logo':showLogo}">
-    <logo v-if="showLogo" :collapse="isCollapse" />
+    <logo v-if="showLogo" :collapse="isCollapse"/>
     <el-scrollbar wrap-class="scrollbar-wrapper">
       <el-menu
         :default-active="activeMenu"
@@ -10,9 +10,8 @@
         :unique-opened="false"
         :active-text-color="variables.menuActiveText"
         :collapse-transition="false"
-        mode="vertical"
-      >
-        <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path" />
+        mode="vertical">
+        <sidebar-item v-for="route in permission_routes" :key="route.path" :item="route" :base-path="route.path"/>
       </el-menu>
     </el-scrollbar>
   </div>
@@ -31,10 +30,10 @@ export default {
       'sidebar',
       'permission_routes'
     ]),
-    routes() {
+    routes () {
       return this.$router.options.routes
     },
-    activeMenu() {
+    activeMenu () {
       const route = this.$route
       const { meta, path } = route
       // if set path, the sidebar will highlight the path you set
@@ -43,13 +42,13 @@ export default {
       }
       return path
     },
-    showLogo() {
+    showLogo () {
       return this.$store.state.settings.sidebarLogo
     },
-    variables() {
+    variables () {
       return variables
     },
-    isCollapse() {
+    isCollapse () {
       return !this.sidebar.opened
     }
   }

+ 43 - 41
htmldev/manage/src/layout/index.vue

@@ -1,12 +1,12 @@
 <template>
   <div :class="classObj" class="app-wrapper">
-    <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside" />
-    <sidebar class="sidebar-container" />
+    <div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
+    <sidebar class="sidebar-container"/>
     <div class="main-container">
       <div :class="{'fixed-header':fixedHeader}">
-        <navbar />
+        <navbar/>
       </div>
-      <app-main />
+      <app-main/>
     </div>
   </div>
 </template>
@@ -24,16 +24,16 @@ export default {
   },
   mixins: [ResizeMixin],
   computed: {
-    sidebar() {
+    sidebar () {
       return this.$store.state.app.sidebar
     },
-    device() {
+    device () {
       return this.$store.state.app.device
     },
-    fixedHeader() {
+    fixedHeader () {
       return this.$store.state.settings.fixedHeader
     },
-    classObj() {
+    classObj () {
       return {
         hideSidebar: !this.sidebar.opened,
         openSidebar: this.sidebar.opened,
@@ -43,7 +43,7 @@ export default {
     }
   },
   methods: {
-    handleClickOutside() {
+    handleClickOutside () {
       this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
     }
   }
@@ -51,43 +51,45 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-  @import "~@/styles/mixin.scss";
-  @import "~@/styles/variables.scss";
+@import "~@/styles/mixin.scss";
+@import "~@/styles/variables.scss";
 
-  .app-wrapper {
-    @include clearfix;
-    position: relative;
-    height: 100%;
-    width: 100%;
-    &.mobile.openSidebar{
-      position: fixed;
-      top: 0;
-    }
-  }
-  .drawer-bg {
-    background: #000;
-    opacity: 0.3;
-    width: 100%;
-    top: 0;
-    height: 100%;
-    position: absolute;
-    z-index: 999;
-  }
+.app-wrapper {
+  @include clearfix;
+  position: relative;
+  height: 100%;
+  width: 100%;
 
-  .fixed-header {
+  &.mobile.openSidebar {
     position: fixed;
     top: 0;
-    right: 0;
-    z-index: 9;
-    width: calc(100% - #{$sideBarWidth});
-    transition: width 0.28s;
   }
+}
 
-  .hideSidebar .fixed-header {
-    width: calc(100% - 54px)
-  }
+.drawer-bg {
+  background: #000;
+  opacity: 0.3;
+  width: 100%;
+  top: 0;
+  height: 100%;
+  position: absolute;
+  z-index: 999;
+}
 
-  .mobile .fixed-header {
-    width: 100%;
-  }
+.fixed-header {
+  position: fixed;
+  top: 0;
+  right: 0;
+  z-index: 9;
+  width: calc(100% - #{$sideBarWidth});
+  transition: width 0.28s;
+}
+
+.hideSidebar .fixed-header {
+  width: calc(100% - 54px)
+}
+
+.mobile .fixed-header {
+  width: 100%;
+}
 </style>

+ 6 - 6
htmldev/manage/src/layout/mixin/ResizeHandler.js

@@ -5,19 +5,19 @@ const WIDTH = 992 // refer to Bootstrap's responsive design
 
 export default {
   watch: {
-    $route(route) {
+    $route (route) {
       if (this.device === 'mobile' && this.sidebar.opened) {
         store.dispatch('app/closeSideBar', { withoutAnimation: false })
       }
     }
   },
-  beforeMount() {
+  beforeMount () {
     window.addEventListener('resize', this.$_resizeHandler)
   },
-  beforeDestroy() {
+  beforeDestroy () {
     window.removeEventListener('resize', this.$_resizeHandler)
   },
-  mounted() {
+  mounted () {
     const isMobile = this.$_isMobile()
     if (isMobile) {
       store.dispatch('app/toggleDevice', 'mobile')
@@ -27,11 +27,11 @@ export default {
   methods: {
     // use $_ for mixins properties
     // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
-    $_isMobile() {
+    $_isMobile () {
       const rect = body.getBoundingClientRect()
       return rect.width - 1 < WIDTH
     },
-    $_resizeHandler() {
+    $_resizeHandler () {
       if (!document.hidden) {
         const isMobile = this.$_isMobile()
         store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop')

+ 2 - 2
htmldev/manage/src/main.js

@@ -23,8 +23,8 @@ import VueBus from './utils/vue-bus'
 
 import './utils/main-config'
 
-import permission from '@/directive/permission/index.js';  // 自定义指令
-Vue.use(permission);
+import permission from '@/directive/permission/index.js'  // 自定义指令
+Vue.use(permission)
 
 /**
  * If you don't want to use mock-server

+ 52 - 52
htmldev/manage/src/mixin/page.js

@@ -1,57 +1,57 @@
 export default {
-    data() {
-        return {
-            tableLoading: true,
-            totalCount: 0,
-            page: 1,
-            page_size: 10
+  data () {
+    return {
+      tableLoading: true,
+      totalCount: 0,
+      page: 1,
+      page_size: 10
+    }
+  },
+  computed: {
+    vheight () {
+      return document.body.clientHeight - 280
+    }
+  },
+  methods: {
+    async init () {
+      Object.keys(this.searchForm).map(key => {
+        if (this.searchForm[key] === '') {
+          this.searchForm[key] = undefined
         }
+      })
+      this.tableLoading = true
+      const { code, data } = await this.$fetch(this.tableUrl, {
+        page: this.page,
+        page_size: this.page_size,
+        ...this.searchForm
+      }, 'get')
+      this.tableLoading = false
+      if (this.tableData && data.data && code === 200) {
+        this.tableData = data.data
+        this.totalCount = Number(data.total)
+      }
     },
-    computed: {
-        vheight() {
-            return document.body.clientHeight - 280 
-        }
+    handleCurrentChange (page) {
+      this.page = page
+      this.init()
     },
-    methods: {
-        async init() {
-            Object.keys(this.searchForm).map(key => {
-                if (this.searchForm[key] === '') {
-                    this.searchForm[key] = undefined
-                }
-            })
-            this.tableLoading = true
-            const { code, data } = await this.$fetch(this.tableUrl, {
-                page: this.page,
-                page_size: this.page_size,
-                ...this.searchForm
-            }, 'get')
-            this.tableLoading = false
-            if (this.tableData && data.data && code === 200) {
-                this.tableData = data.data
-                this.totalCount = Number(data.total)
-            }
-        },
-        handleCurrentChange(page) {
-            this.page = page
-            this.init()
-        },
-        handleSizeChange(page_size) {
-            this.page_size = page_size
-            this.handleCurrentChange(1)
-            //this.searchSubmit()
-        },
-        async searchSubmit() {
-            this.page = 1
-            await this.init()
-        },
-        searchReset(obj = {}) {
-            Object.keys(this.searchForm).forEach(item => {
-                this.searchForm[item] = undefined
-            })
-            Object.keys(obj).forEach(item => {
-                this.searchForm[item] = obj[item]
-            })
-            this.searchSubmit()
-        }
+    handleSizeChange (page_size) {
+      this.page_size = page_size
+      this.handleCurrentChange(1)
+      //this.searchSubmit()
+    },
+    async searchSubmit () {
+      this.page = 1
+      await this.init()
+    },
+    searchReset (obj = {}) {
+      Object.keys(this.searchForm).forEach(item => {
+        this.searchForm[item] = undefined
+      })
+      Object.keys(obj).forEach(item => {
+        this.searchForm[item] = obj[item]
+      })
+      this.searchSubmit()
     }
-}
+  }
+}

+ 1 - 0
htmldev/manage/src/router/import-development.js

@@ -0,0 +1 @@
+module.exports = file => require('@/' + file + '.vue').default

+ 1 - 0
htmldev/manage/src/router/import-production.js

@@ -0,0 +1 @@
+module.exports = file => () => import('@/' + file + '.vue')

+ 29 - 23
htmldev/manage/src/router/index.js

@@ -24,7 +24,7 @@ import Layout from '@/layout'
     activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
   }
  */
-
+const _import = require('./import-' + process.env.NODE_ENV)
 /**
  * constantRoutes
  * a base page that does not have permission requirements
@@ -33,17 +33,15 @@ import Layout from '@/layout'
 export const constantRoutes = [
   {
     path: '/login',
-    component: () => import('@/views/login/index'),
+    component: _import('views/login/index'),
     hidden: true
   },
 
   {
     path: '/404',
-    component: () => import('@/views/404'),
+    component: _import('views/404'),
     hidden: true
-  },
-
-
+  }
 ]
 
 export const asyncRoutes = [
@@ -54,24 +52,22 @@ export const asyncRoutes = [
     children: [{
       path: 'dashboard',
       name: 'Dashboard',
-      component: () => import('@/views/dashboard/index'),
+      component: _import('views/dashboard/index'),
       meta: { title: '工作台', icon: 'dashboard' }
     }]
   },
-
   {
     path: '/project',
     component: Layout,
     redirect: '/project/list',
-    meta: { title: '项目管理', icon: 'table', roleValue: 'project_list_show'},
+    meta: { title: '项目管理', icon: 'table', roleValue: 'project_list_show' },
     children: [{
       path: 'list',
       name: 'project',
-      component: () => import('@/views/project/index'),
+      component: _import('views/project/index'),
       meta: { title: '项目列表', roleValue: 'project_list_show' }
     }]
   },
-
   {
     path: '/department',
     component: Layout,
@@ -80,11 +76,10 @@ export const asyncRoutes = [
     children: [{
       path: 'list',
       name: 'department',
-      component: () => import('@/views/department/index'),
+      component: _import('views/department/index'),
       meta: { title: '部门列表', roleValue: 'department_list_show' }
     }]
   },
-
   {
     path: '/roles',
     component: Layout,
@@ -93,11 +88,10 @@ export const asyncRoutes = [
     children: [{
       path: 'list',
       name: 'roles',
-      component: () => import('@/views/roles/index'),
+      component: _import('views/roles/index'),
       meta: { title: '角色列表', roleValue: 'roles_list_show' }
     }]
   },
-
   {
     path: '/user',
     component: Layout,
@@ -106,11 +100,10 @@ export const asyncRoutes = [
     children: [{
       path: 'list',
       name: 'user',
-      component: () => import('@/views/user/index'),
+      component: _import('views/user/index'),
       meta: { title: '用户列表', roleValue: 'user_list_show' }
     }]
   },
-
   {
     path: '/icon',
     component: Layout,
@@ -119,26 +112,39 @@ export const asyncRoutes = [
     children: [{
       path: 'list',
       name: 'icon',
-      component: () => import('@/views/icons/index'),
+      component: _import('views/icons/index'),
       meta: { title: 'icon', icon: 'el-icon-s-grid' }
     }]
   },
-
-
   { path: '*', redirect: '/404', hidden: true }
 ]
 
 const createRouter = () => new Router({
-  // mode: 'history', // require service support
   mode: 'history',
-  scrollBehavior: () => ({ y: 0 }),
+  scrollBehavior (to, from, savedPosition) {
+    if (to.hash) {
+      return {
+        selector: to.hash
+      }
+    }
+    // keep-alive 返回缓存页面后记录浏览位置
+    if (savedPosition && to.meta.keepAlive) {
+      return savedPosition
+    }
+    // 异步滚动操作
+    return new Promise((resolve) => {
+      setTimeout(() => {
+        resolve({ x: 0, y: 1 })
+      }, 0)
+    })
+  },
   routes: constantRoutes
 })
 
 const router = createRouter()
 
 // Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
-export function resetRouter() {
+export function resetRouter () {
   const newRouter = createRouter()
   router.matcher = newRouter.matcher // reset router
 }

+ 4 - 3
htmldev/manage/src/store/getters.js

@@ -1,4 +1,5 @@
 import store from './index'
+
 const getters = {
   sidebar: state => state.app.sidebar,
   permission_routes: state => state.permission.routes,
@@ -12,7 +13,7 @@ const getters = {
     if (state.common.projectArr.length == 0) {
       store.dispatch('common/setProjectArr')
     }
-    return state.common.projectArr 
+    return state.common.projectArr
   },
   departmentArr: state => state.common.departmentArr,
   roleArr: state => state.common.roleArr,
@@ -20,13 +21,13 @@ const getters = {
   //   if (state.common.departmentArr.length == 0) {
   //     store.dispatch('common/setDepartmentArr')
   //   }
-  //   return state.common.departmentArr 
+  //   return state.common.departmentArr
   // },
   // roleArr: state => {
   //   if (state.common.roleArr.length == 0) {
   //     store.dispatch('common/setRoleArr')
   //   }
-  //   return state.common.roleArr 
+  //   return state.common.roleArr
   // }
 }
 export default getters

+ 3 - 3
htmldev/manage/src/store/modules/app.js

@@ -29,13 +29,13 @@ const mutations = {
 }
 
 const actions = {
-  toggleSideBar({ commit }) {
+  toggleSideBar ({ commit }) {
     commit('TOGGLE_SIDEBAR')
   },
-  closeSideBar({ commit }, { withoutAnimation }) {
+  closeSideBar ({ commit }, { withoutAnimation }) {
     commit('CLOSE_SIDEBAR', withoutAnimation)
   },
-  toggleDevice({ commit }, device) {
+  toggleDevice ({ commit }, device) {
     commit('TOGGLE_DEVICE', device)
   }
 }

+ 36 - 36
htmldev/manage/src/store/modules/common.js

@@ -1,49 +1,49 @@
-import {fetch} from '@/api/index'
+import { fetch } from '@/api/index'
 import { getToken } from '@/utils/auth'
+
 const state = {
-    projectArr: [],   // 项目
-    departmentArr: [],    // 部门
-    roleArr: []   // 角色
+  projectArr: [],   // 项目
+  departmentArr: [],    // 部门
+  roleArr: []   // 角色
 }
 
 const mutations = {
-
-    SET_PROJECTARR: (state, arr) => {
-        state.projectArr = arr
-    },
-    SET_DEPARTMENTARR: (state, arr) => {
-        state.departmentArr = arr
-    },
-    SET_ROLEARR: (state, arr) => {
-        state.roleArr = arr
-    },
+  SET_PROJECTARR: (state, arr) => {
+    state.projectArr = arr
+  },
+  SET_DEPARTMENTARR: (state, arr) => {
+    state.departmentArr = arr
+  },
+  SET_ROLEARR: (state, arr) => {
+    state.roleArr = arr
+  }
 }
 
 const actions = {
-    async setProjectArr({ commit }) {
-        if (!getToken()) return
-        const data = await fetch('/project/get_list', {}, 'get')
-        if (data.code == 200) {
-            commit('SET_PROJECTARR', data.data)
-        }
-    },
-    async setDepartmentArr({ commit }) {
-        const data = await fetch('/department/get_department_list', {}, 'get')
-        if (data.code == 200) {
-            commit('SET_DEPARTMENTARR', data.data)
-        }
-    },
-    async setRoleArr({ commit }) {
-        const data = await fetch('/role/get_role_list', {}, 'get')
-        if (data.code == 200) {
-            commit('SET_ROLEARR', data.data)
-        }
+  async setProjectArr ({ commit }) {
+    if (!getToken()) return
+    const data = await fetch('/project/get_list', {}, 'get')
+    if (data.code == 200) {
+      commit('SET_PROJECTARR', data.data)
+    }
+  },
+  async setDepartmentArr ({ commit }) {
+    const data = await fetch('/department/get_department_list', {}, 'get')
+    if (data.code == 200) {
+      commit('SET_DEPARTMENTARR', data.data)
+    }
+  },
+  async setRoleArr ({ commit }) {
+    const data = await fetch('/role/get_role_list', {}, 'get')
+    if (data.code == 200) {
+      commit('SET_ROLEARR', data.data)
     }
+  }
 }
 
 export default {
-    namespaced: true,
-    state,
-    mutations,
-    actions
+  namespaced: true,
+  state,
+  mutations,
+  actions
 }

+ 53 - 56
htmldev/manage/src/store/modules/permission.js

@@ -1,6 +1,5 @@
 import { constantRoutes, asyncRoutes } from '@/router'
 
-
 // function hetAllRoleChecked(roles) {
 //     let res = []
 //     roles.forEach(role => {
@@ -14,19 +13,18 @@ import { constantRoutes, asyncRoutes } from '@/router'
 //     return res
 // }
 
-
 /**
  * Use meta.role to determine if the current user has permission
  * @param roles
  * @param route
  */
-function hasPermission(roles, route) {
-    if (route.meta && route.meta.roleValue) {
-        // return roles.some(role => route.meta.roleValue.includes(role))
-        return roles.includes(route.meta.roleValue)
-    } else {
-        return true
-    }
+function hasPermission (roles, route) {
+  if (route.meta && route.meta.roleValue) {
+    // return roles.some(role => route.meta.roleValue.includes(role))
+    return roles.includes(route.meta.roleValue)
+  } else {
+    return true
+  }
 }
 
 /**
@@ -34,64 +32,63 @@ function hasPermission(roles, route) {
  * @param routes asyncRoutes
  * @param roles
  */
-export function filterAsyncRoutes(routes, roles) {
-    const res = []
-    // let roleIds = hetAllRoleChecked(roles)
-    let roleIds = roles
-    routes.forEach(route => {
-        const tmp = { ...route }
-        if (hasPermission(roleIds, tmp)) {
-            if (tmp.children) {
-                tmp.children = filterAsyncRoutes(tmp.children, roles)
-            }
-            res.push(tmp)
-        }
-    })
-    return res
+export function filterAsyncRoutes (routes, roles) {
+  const res = []
+  // let roleIds = hetAllRoleChecked(roles)
+  let roleIds = roles
+  routes.forEach(route => {
+    const tmp = { ...route }
+    if (hasPermission(roleIds, tmp)) {
+      if (tmp.children) {
+        tmp.children = filterAsyncRoutes(tmp.children, roles)
+      }
+      res.push(tmp)
+    }
+  })
+  return res
 }
 
 const state = {
-    routes: constantRoutes,
-    pageRoleArray: [],
-    addRoutes: []
+  routes: constantRoutes,
+  pageRoleArray: [],
+  addRoutes: []
 }
 const mutations = {
-    SET_ROUTES: (state, routes) => {
-        state.addRoutes = routes
-        state.routes = constantRoutes.concat(routes)
-    },
-    SET_PAGE_ROLE_ARRAY: (state, arr) => {
-        state.pageRoleArray = arr
-    }
+  SET_ROUTES: (state, routes) => {
+    state.addRoutes = routes
+    state.routes = constantRoutes.concat(routes)
+  },
+  SET_PAGE_ROLE_ARRAY: (state, arr) => {
+    state.pageRoleArray = arr
+  }
 }
 
 const actions = {
-    async generateRoutes({ commit }, roles) {
-        return new Promise(resolve => {
-            let accessedRoutes
-            // accessedRoutes = asyncRoutes
-            accessedRoutes = filterAsyncRoutes(asyncRoutes, roles.user_rules)
-            // accessedRoutes = [...accessedRoutes, {
-            //     path: '/',
-            //     redirect: accessedRoutes[0].path
-            // }]
-            console.log({accessedRoutes});
-            commit('SET_ROUTES', accessedRoutes)
-
-            // 把所有roleId放在一个数组里
-            // let pageRoleArray = hetAllRoleChecked(roles.user_rules)
-            let pageRoleArray = roles.user_rules
-            commit('SET_PAGE_ROLE_ARRAY', pageRoleArray)
+  async generateRoutes ({ commit }, roles) {
+    return new Promise(resolve => {
+      let accessedRoutes
+      // accessedRoutes = asyncRoutes
+      accessedRoutes = filterAsyncRoutes(asyncRoutes, roles.user_rules)
+      // accessedRoutes = [...accessedRoutes, {
+      //     path: '/',
+      //     redirect: accessedRoutes[0].path
+      // }]
+      console.log({ accessedRoutes })
+      commit('SET_ROUTES', accessedRoutes)
 
+      // 把所有roleId放在一个数组里
+      // let pageRoleArray = hetAllRoleChecked(roles.user_rules)
+      let pageRoleArray = roles.user_rules
+      commit('SET_PAGE_ROLE_ARRAY', pageRoleArray)
 
-            resolve(accessedRoutes)
-        })
-    }
+      resolve(accessedRoutes)
+    })
+  }
 }
 
 export default {
-    namespaced: true,
-    state,
-    mutations,
-    actions
+  namespaced: true,
+  state,
+  mutations,
+  actions
 }

+ 1 - 2
htmldev/manage/src/store/modules/settings.js

@@ -18,7 +18,7 @@ const mutations = {
 }
 
 const actions = {
-  changeSetting({ commit }, data) {
+  changeSetting ({ commit }, data) {
     commit('CHANGE_SETTING', data)
   }
 }
@@ -29,4 +29,3 @@ export default {
   mutations,
   actions
 }
-

+ 5 - 5
htmldev/manage/src/store/modules/user.js

@@ -1,4 +1,4 @@
-import { fetch } from '@/api/index';
+import { fetch } from '@/api/index'
 import { getToken, setToken, removeToken } from '@/utils/auth'
 import { resetRouter } from '@/router'
 
@@ -30,9 +30,9 @@ const mutations = {
 const actions = {
 
   // get user info
-  getInfo({ commit, state }) {
+  getInfo ({ commit, state }) {
     return new Promise(async (resolve, reject) => {
-      const data = await fetch('/userGetInfo', {token: getToken()}, 'get')
+      const data = await fetch('/userGetInfo', { token: getToken() }, 'get')
       // const data = {code: 0, data: {username: 'admin'}}
       if (data.code == 200) {
         commit('SET_NAME', data.data.user_name)
@@ -45,7 +45,7 @@ const actions = {
   },
 
   // user logout
-  logout({ commit, state }) {
+  logout ({ commit, state }) {
     return new Promise((resolve, reject) => {
       removeToken() // must remove  token  first
       resetRouter()
@@ -63,7 +63,7 @@ const actions = {
   },
 
   // remove token
-  resetToken({ commit }) {
+  resetToken ({ commit }) {
     return new Promise(resolve => {
       removeToken() // must remove  token  first
       commit('RESET_STATE')

+ 3 - 3
htmldev/manage/src/utils/auth.js

@@ -2,14 +2,14 @@ import Cookies from 'js-cookie'
 
 const TokenKey = 'accessManage_token'
 
-export function getToken() {
+export function getToken () {
   return Cookies.get(TokenKey)
 }
 
-export function setToken(token) {
+export function setToken (token) {
   return Cookies.set(TokenKey, token)
 }
 
-export function removeToken() {
+export function removeToken () {
   return Cookies.remove(TokenKey)
 }

+ 7 - 7
htmldev/manage/src/utils/enum.js

@@ -1,12 +1,12 @@
 export const user_agent = {
-    1: '主站用户',
-    2: '开通分站',
-    3: '开通api',
-    4: '分站用户'
+  1: '主站用户',
+  2: '开通分站',
+  3: '开通api',
+  4: '分站用户'
 
 }
 
 export const budget_type = {
-    1: 'ceshi1',
-    2: 'ceshi2'
-}
+  1: 'ceshi1',
+  2: 'ceshi2'
+}

+ 2 - 2
htmldev/manage/src/utils/filter.js

@@ -3,10 +3,10 @@ import * as utils from './index'
 import Vue from 'vue'
 
 Object.keys(utils).forEach(key => {
-    Vue.filter(key, utils[key])
+  Vue.filter(key, utils[key])
 })
 
 Object.keys(utils).forEach(key => {
-    Vue.prototype[key] = utils[key]
+  Vue.prototype[key] = utils[key]
 })
 

+ 1 - 1
htmldev/manage/src/utils/get-page-title.js

@@ -2,7 +2,7 @@ import defaultSettings from '@/settings'
 
 const title = defaultSettings.title || '管理后台'
 
-export default function getPageTitle(pageTitle) {
+export default function getPageTitle (pageTitle) {
   if (pageTitle) {
     return `${pageTitle} - ${title}`
   }

+ 4 - 4
htmldev/manage/src/utils/index.js

@@ -8,7 +8,7 @@
  * @param {string} cFormat
  * @returns {string | null}
  */
-export function parseTime(time, cFormat) {
+export function parseTime (time, cFormat) {
   if (arguments.length === 0 || !time) {
     return null
   }
@@ -45,7 +45,7 @@ export function parseTime(time, cFormat) {
   const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
     const value = formatObj[key]
     // Note: getDay() returns 0 on Sunday
-    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
+    if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
     return value.toString().padStart(2, '0')
   })
   return time_str
@@ -56,7 +56,7 @@ export function parseTime(time, cFormat) {
  * @param {string} option
  * @returns {string}
  */
-export function formatTime(time, option) {
+export function formatTime (time, option) {
   if (('' + time).length === 10) {
     time = parseInt(time) * 1000
   } else {
@@ -98,7 +98,7 @@ export function formatTime(time, option) {
  * @param {string} url
  * @returns {Object}
  */
-export function param2Obj(url) {
+export function param2Obj (url) {
   const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
   if (!search) {
     return {}

+ 1 - 1
htmldev/manage/src/utils/main-config.js

@@ -7,5 +7,5 @@ import './rules'
 import * as enums from './enum'
 
 Object.keys(enums).forEach(key => {
-    Vue.prototype[key] = enums[key]
+  Vue.prototype[key] = enums[key]
 })

+ 0 - 85
htmldev/manage/src/utils/request.js

@@ -1,85 +0,0 @@
-import axios from 'axios'
-import { MessageBox, Message } from 'element-ui'
-import store from '@/store'
-import { getToken } from '@/utils/auth'
-
-// create an axios instance
-const service = axios.create({
-  baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
-  // withCredentials: true, // send cookies when cross-domain requests
-  timeout: 5000 // request timeout
-})
-
-// request interceptor
-service.interceptors.request.use(
-  config => {
-    // do something before request is sent
-
-    if (store.getters.token) {
-      // let each request carry token
-      // ['X-Token'] is a custom headers key
-      // please modify it according to the actual situation
-      config.headers['X-Token'] = getToken()
-    }
-    return config
-  },
-  error => {
-    // do something with request error
-    console.log(error) // for debug
-    return Promise.reject(error)
-  }
-)
-
-// response interceptor
-service.interceptors.response.use(
-  /**
-   * If you want to get http information such as headers or status
-   * Please return  response => response
-  */
-
-  /**
-   * Determine the request status by custom code
-   * Here is just an example
-   * You can also judge the status by HTTP Status Code
-   */
-  response => {
-    const res = response.data
-
-    // if the custom code is not 20000, it is judged as an error.
-    if (res.code !== 20000) {
-      Message({
-        message: res.message || 'Error',
-        type: 'error',
-        duration: 5 * 1000
-      })
-
-      // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired;
-      if (res.code === 50008 || res.code === 50012 || res.code === 50014) {
-        // to re-login
-        // MessageBox.confirm('You have been logged out, you can cancel to stay on this page, or log in again', 'Confirm logout', {
-        //   confirmButtonText: 'Re-Login',
-        //   cancelButtonText: 'Cancel',
-        //   type: 'warning'
-        // }).then(() => {
-        //   store.dispatch('user/resetToken').then(() => {
-        //     location.reload()
-        //   })
-        // })
-      }
-      return Promise.reject(new Error(res.message || 'Error'))
-    } else {
-      return res
-    }
-  },
-  error => {
-    console.log('err' + error) // for debug
-    Message({
-      message: error.message,
-      type: 'error',
-      duration: 5 * 1000
-    })
-    return Promise.reject(error)
-  }
-)
-
-export default service

+ 140 - 137
htmldev/manage/src/utils/rules.js

@@ -1,180 +1,183 @@
-
 import Vue from 'vue'
 
 // 手机号验证
 var mobile = (rule, value, callback) => {
-    let regFormat = /^[1][3456789][0-9]{9}$/; //正确手机号
-    if (!value) {
-        return callback(new Error('不能为空'));
-    }
-    if (!(regFormat.test(value))) {
-        callback(new Error('请输入正确手机号'));
-    } else {
-        callback();
-    }
-};
+  let regFormat = /^[1][3456789][0-9]{9}$/ //正确手机号
+  if (!value) {
+    return callback(new Error('不能为空'))
+  }
+  if (!(regFormat.test(value))) {
+    callback(new Error('请输入正确手机号'))
+  } else {
+    callback()
+  }
+}
 //数字验证
 var number = (rule, value, callback) => {
-    if (!value) {
-        return callback(new Error('不能为空'));
-    }
-    if (!Number.isInteger(value)) {
-        callback(new Error('请输入数字值'));
-    } else {
-        if (value < 18) {
-            callback(new Error('必须大于18岁'));
-        } else if (value > 55) {
-            callback(new Error('必须小于55岁'));
-        } else {
-            callback();
-        }
-    }
-};
+  if (!value) {
+    return callback(new Error('不能为空'))
+  }
+  if (!Number.isInteger(value)) {
+    callback(new Error('请输入数字值'))
+  } else {
+    if (value < 18) {
+      callback(new Error('必须大于18岁'))
+    } else if (value > 55) {
+      callback(new Error('必须小于55岁'))
+    } else {
+      callback()
+    }
+  }
+}
 //text不能为空
 var text = (rule, value, callback) => {
-    if (!value) {
-        return callback(new Error('不能为空'));
-    } else {
-        callback();
-    }
-};
+  if (!value) {
+    return callback(new Error('不能为空'))
+  } else {
+    callback()
+  }
+}
 //desc不能为空
 var desc = (rule, value, callback) => {
-    if (!value) {
-        return callback(new Error('不能为空'));
-    } else {
-        callback();
-    }
-};
+  if (!value) {
+    return callback(new Error('不能为空'))
+  } else {
+    callback()
+  }
+}
 //邮箱
 var email = (rule, value, callback) => {
-    let mal = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
-    if (!value) {
-        return callback(new Error('不能为空'));
-    }
-    if (!(mal.test(value))) {
-        callback(new Error('请输入正确邮箱'));
-    } else {
-        callback();
-    }
-};
+  let mal = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
+  if (!value) {
+    return callback(new Error('不能为空'))
+  }
+  if (!(mal.test(value))) {
+    callback(new Error('请输入正确邮箱'))
+  } else {
+    callback()
+  }
+}
 //开始时间
 var startTime = (rule, value, callback) => {
-    if (!value) {
-        return callback(new Error('请选择开始日期'));
-    } else {
-        callback();
-    }
-};
+  if (!value) {
+    return callback(new Error('请选择开始日期'))
+  } else {
+    callback()
+  }
+}
 //开始时间
 var endTime = (rule, value, callback) => {
-    if (!value) {
-        return callback(new Error('请选择结束日期'));
-    } else {
-        callback();
-    }
-};
+  if (!value) {
+    return callback(new Error('请选择结束日期'))
+  } else {
+    callback()
+  }
+}
 //时间
 var time = (rule, value, callback) => {
-    if (!value) {
-        return callback(new Error('请选择日期'));
-    } else {
-        callback();
-    }
-};
+  if (!value) {
+    return callback(new Error('请选择日期'))
+  } else {
+    callback()
+  }
+}
 //多选框
 var checkbox = (rule, value, callback) => {
-    if (value.length < 1) {
-        return callback(new Error('请选择一个'));
-    } else {
-        callback();
-    }
-};
+  if (value.length < 1) {
+    return callback(new Error('请选择一个'))
+  } else {
+    callback()
+  }
+}
 //单选框
 var radio = (rule, value, callback) => {
-    if (value.length < 1) {
-        return callback(new Error('请选择一个'));
-    } else {
-        callback();
-    }
-};
+  if (value.length < 1) {
+    return callback(new Error('请选择一个'))
+  } else {
+    callback()
+  }
+}
 //下拉框
 var select = (rule, value, callback) => {
-    if (value.length < 1) {
-        return callback(new Error('请选择一个'));
-    } else {
-        callback();
-    }
-};
+  if (value.length < 1) {
+    return callback(new Error('请选择一个'))
+  } else {
+    callback()
+  }
+}
 //QQ号码验证
 var QQV = (rule, value, callback) => {
-    if (value === '') {
-        callback(new Error('输入QQ号'))
-    } else if (/^[1-9][0-9]{4,10}$/.test(value)) {
-        callback()
-    } else {
-        callback(new Error('输入正确的QQ号'))
-    }
+  if (value === '') {
+    callback(new Error('输入QQ号'))
+  } else if (/^[1-9][0-9]{4,10}$/.test(value)) {
+    callback()
+  } else {
+    callback(new Error('输入正确的QQ号'))
+  }
 }
 
 // 类似金钱,首位不为0,最多2位小数
-function checkNumPot2(rule, value, callback) {
-    const reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
-    if (!value) {
-        return callback(new Error('请填写数字'))
-    } else if (!reg.test(value)) {
-        return callback(new Error('请填写数字,最多2位小数'))
-    } else {
-        callback()
-    }
+function checkNumPot2 (rule, value, callback) {
+  const reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
+  if (!value) {
+    return callback(new Error('请填写数字'))
+  } else if (!reg.test(value)) {
+    return callback(new Error('请填写数字,最多2位小数'))
+  } else {
+    callback()
+  }
 }
 
 // 身份证
-function checkIdNum(rule, value, callback) {
-    const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
-    if (!value) {
-        return callback(new Error('证件号码不能为空'))
-    } else if (!reg.test(value)) {
-        return callback(new Error('证件号码不正确'))
-    } else {
-        callback()
-    }
+function checkIdNum (rule, value, callback) {
+  const reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
+  if (!value) {
+    return callback(new Error('证件号码不能为空'))
+  } else if (!reg.test(value)) {
+    return callback(new Error('证件号码不正确'))
+  } else {
+    callback()
+  }
 }
 
 // 整数
-function checkInterNum(rule, value, callback) {
-    const reg = /^[0-9]*[1-9][0-9]*$/
-    if (!value) {
-        return callback(new Error('请填写整数'))
-    } else if (!reg.test(value)) {
-        return callback(new Error('请输入整数'))
-    } else {
-        callback()
-    }
+function checkInterNum (rule, value, callback) {
+  const reg = /^[0-9]*[1-9][0-9]*$/
+  if (!value) {
+    return callback(new Error('请填写整数'))
+  } else if (!reg.test(value)) {
+    return callback(new Error('请输入整数'))
+  } else {
+    callback()
+  }
 }
 
 const confirmPasswordValidator = (rule, value, callback, password) => {
-    if (password !== value) {
-        callback(new Error('两次密码输入不一致'))
-    } else {
-        callback()
-    }
+  if (password !== value) {
+    callback(new Error('两次密码输入不一致'))
+  } else {
+    callback()
+  }
 }
 
 const formRules = {
-    QQ: [{ required: true, validator: QQV, trigger: 'blur' }],
-    mobile: [{ required: true, pattern: /^1[23456789]\d{9}$/, message: '目前只支持中国大陆的手机号码', trigger: 'blur' }],
-    password: [{ required: true, min: 6, max: 18, message: '长度必须大于6位长度在 6 到 18 个字符之间', trigger: 'blur' }],
-    confirmPassword: (form) => {
-        return [
-            { required: true, min: 6, max: 18, message: '长度必须大于6位长度在 6 到 18 个字符之间', trigger: 'blur' },
-            { required: true, validator: (rule, value, callback) => confirmPasswordValidator(rule, value, callback, form.password), trigger: 'blur' }
-        ]
-    },
-    required: [{ required: true, min: 1, message: '必填', trigger: 'blur' }],
-    numPot2: [{ required: true, validator: checkNumPot2, trigger: 'blur' }],
-    InterNum: [{ required: true, validator: checkInterNum, trigger: 'blur' }],
-    coins: [{ required: true, validator: checkInterNum, trigger: 'blur' }]
+  QQ: [{ required: true, validator: QQV, trigger: 'blur' }],
+  mobile: [{ required: true, pattern: /^1[23456789]\d{9}$/, message: '目前只支持中国大陆的手机号码', trigger: 'blur' }],
+  password: [{ required: true, min: 6, max: 18, message: '长度必须大于6位长度在 6 到 18 个字符之间', trigger: 'blur' }],
+  confirmPassword: (form) => {
+    return [
+      { required: true, min: 6, max: 18, message: '长度必须大于6位长度在 6 到 18 个字符之间', trigger: 'blur' },
+      {
+        required: true,
+        validator: (rule, value, callback) => confirmPasswordValidator(rule, value, callback, form.password),
+        trigger: 'blur'
+      }
+    ]
+  },
+  required: [{ required: true, min: 1, message: '必填', trigger: 'blur' }],
+  numPot2: [{ required: true, validator: checkNumPot2, trigger: 'blur' }],
+  InterNum: [{ required: true, validator: checkInterNum, trigger: 'blur' }],
+  coins: [{ required: true, validator: checkInterNum, trigger: 'blur' }]
 }
 
-Vue.prototype.formRules = formRules
+Vue.prototype.formRules = formRules

+ 1 - 1
htmldev/manage/src/utils/validate.js

@@ -6,6 +6,6 @@
  * @param {string} path
  * @returns {Boolean}
  */
-export function isExternal(path) {
+export function isExternal (path) {
   return /^(https?:|mailto:|tel:)/.test(path)
 }

+ 15 - 15
htmldev/manage/src/utils/vue-bus.js

@@ -1,17 +1,17 @@
-const install = function(Vue) {
-    const Bus = new Vue({
-        methods: {
-            emit(event, ...args) {
-                this.$emit(event, ...args)
-            },
-            on(event, callback) {
-                this.$on(event, callback)
-            },
-            off(event, callback) {
-                this.$off(event, callback)
-            }
-        }
-    })
-    Vue.prototype.$bus = Bus //由于放在原型上
+const install = function (Vue) {
+  const Bus = new Vue({
+    methods: {
+      emit (event, ...args) {
+        this.$emit(event, ...args)
+      },
+      on (event, callback) {
+        this.$on(event, callback)
+      },
+      off (event, callback) {
+        this.$off(event, callback)
+      }
+    }
+  })
+  Vue.prototype.$bus = Bus //由于放在原型上
 }
 export default install

+ 20 - 4
htmldev/manage/src/views/404.vue

@@ -13,7 +13,9 @@
           <a style="color:#20a0ff" href="https://wallstreetcn.com" target="_blank">wallstreetcn</a>
         </div>
         <div class="bullshit__headline">{{ message }}</div>
-        <div class="bullshit__info">Please check that the URL you entered is correct, or click the button below to return to the homepage.</div>
+        <div class="bullshit__info">Please check that the URL you entered is correct, or click the button below to
+          return to the homepage.
+        </div>
         <a href="" class="bullshit__return-home">Back to home</a>
       </div>
     </div>
@@ -25,7 +27,7 @@
 export default {
   name: 'Page404',
   computed: {
-    message() {
+    message () {
       return 'The webmaster said that you can not enter this page...'
     }
   }
@@ -33,27 +35,32 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.wscn-http404-container{
-  transform: translate(-50%,-50%);
+.wscn-http404-container {
+  transform: translate(-50%, -50%);
   position: absolute;
   top: 40%;
   left: 50%;
 }
+
 .wscn-http404 {
   position: relative;
   width: 1200px;
   padding: 0 50px;
   overflow: hidden;
+
   .pic-404 {
     position: relative;
     float: left;
     width: 600px;
     overflow: hidden;
+
     &__parent {
       width: 100%;
     }
+
     &__child {
       position: absolute;
+
       &.left {
         width: 80px;
         top: 17px;
@@ -65,6 +72,7 @@ export default {
         animation-fill-mode: forwards;
         animation-delay: 1s;
       }
+
       &.mid {
         width: 46px;
         top: 10px;
@@ -76,6 +84,7 @@ export default {
         animation-fill-mode: forwards;
         animation-delay: 1.2s;
       }
+
       &.right {
         width: 62px;
         top: 100px;
@@ -87,6 +96,7 @@ export default {
         animation-fill-mode: forwards;
         animation-delay: 1s;
       }
+
       @keyframes cloudLeft {
         0% {
           top: 17px;
@@ -155,12 +165,14 @@ export default {
       }
     }
   }
+
   .bullshit {
     position: relative;
     float: left;
     width: 300px;
     padding: 30px 0;
     overflow: hidden;
+
     &__oops {
       font-size: 32px;
       font-weight: bold;
@@ -172,6 +184,7 @@ export default {
       animation-duration: 0.5s;
       animation-fill-mode: forwards;
     }
+
     &__headline {
       font-size: 20px;
       line-height: 24px;
@@ -184,6 +197,7 @@ export default {
       animation-delay: 0.1s;
       animation-fill-mode: forwards;
     }
+
     &__info {
       font-size: 13px;
       line-height: 21px;
@@ -195,6 +209,7 @@ export default {
       animation-delay: 0.2s;
       animation-fill-mode: forwards;
     }
+
     &__return-home {
       display: block;
       float: left;
@@ -213,6 +228,7 @@ export default {
       animation-delay: 0.3s;
       animation-fill-mode: forwards;
     }
+
     @keyframes slideUp {
       0% {
         transform: translateY(60px);

+ 15 - 25
htmldev/manage/src/views/dashboard/index.vue

@@ -1,37 +1,27 @@
 <template>
-    <div class="dashboard-container padding-20">
-        欢迎来到权限系统管理
-    </div>
+  <div class="dashboard-container padding-20">
+    欢迎!
+  </div>
 </template>
 
 <script>
-import {getToken} from '@/utils/auth'
 export default {
-    name: 'Dashboard',
-    data() {
-        return {
-            step: 0
-        }
-    },
-    methods: {
-        async getUserInfo() {
-            const data = await this.$fetch('/userGetInfo', {token: getToken()}, 'get')
-        }
-    },
-    mounted () {
-        // this.getUserInfo()
-    },
+  name: 'Dashboard',
+  data () {
+    return {}
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .dashboard {
-    &-container {
-        margin: 30px;
-    }
-    &-text {
-        font-size: 30px;
-        line-height: 46px;
-    }
+  &-container {
+    margin: 30px;
+  }
+
+  &-text {
+    font-size: 30px;
+    line-height: 46px;
+  }
 }
 </style>

+ 78 - 75
htmldev/manage/src/views/department/details.vue

@@ -1,89 +1,92 @@
 <template>
-    <div>
-        <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
-            <el-form ref="form" :model="form" label-width="100px" class="bind-phone">
-                <el-form-item v-if="!exData.id" label="项目选择:" >
-                    <el-select v-model="form.department_project_id">
-                        <el-option v-for="(item, index) in projectArr" :key="index" :label="item.project_name" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item label="部门名称:" >
-                    <el-input v-model="form.department_name" placeholder="请输入部门名称"> </el-input>
-                </el-form-item>
-                <el-form-item label="部门描述:" >
-                    <el-input v-model="form.department_desc" placeholder="请输入部门描述"> </el-input>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-    </div>
+  <div>
+    <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false"
+               top="50px">
+      <el-form ref="form" :model="form" label-width="100px" class="bind-phone">
+        <el-form-item v-if="!exData.id" label="项目选择:">
+          <el-select v-model="form.department_project_id">
+            <el-option v-for="(item, index) in projectArr" :key="index" :label="item.project_name"
+                       :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="部门名称:">
+          <el-input v-model="form.department_name" placeholder="请输入部门名称"></el-input>
+        </el-form-item>
+        <el-form-item label="部门描述:">
+          <el-input v-model="form.department_desc" placeholder="请输入部门描述"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-import {mapGetters} from 'vuex'
+import { mapGetters } from 'vuex'
+
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exData: {
-            type: Object,
-            default: function (){
-              return {}
-            }
-        }
-    },
-    computed: {
-        ...mapGetters([
-            'projectArr'
-        ])
-    },
-    data() {
-        return {
-            dialog: !!this.value,
-            form: {
-                department_project_id: undefined,
-                department_name: '',
-                department_desc: ''
-            }
-        }
-    },
-    methods: {
-        async handleSubmit() {
-            let url = this.exData.id ? '/department/edit' : '/department/add'
-            const data = await this.$fetch(url, {...this.form})
-            if (data.code === 200) {
-                this.$message.success('提交成功')
-                this.$emit('success')
-                this.dialog = false
-            }
-        }
-    },
-    mounted () {
-        if (this.projectArr.length == 0) {
-            this.$store.dispatch('common/setProjectArr')
-        }
-        if (this.exData.id) {
-            this.form.id = this.exData.id
-            this.form.department_name = this.exData.department_name
-            this.form.department_desc = this.exData.department_desc
-        }
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
-        }
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  computed: {
+    ...mapGetters([
+      'projectArr'
+    ])
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      form: {
+        department_project_id: undefined,
+        department_name: '',
+        department_desc: ''
+      }
+    }
+  },
+  methods: {
+    async handleSubmit () {
+      let url = this.exData.id ? '/department/edit' : '/department/add'
+      const data = await this.$fetch(url, { ...this.form })
+      if (data.code === 200) {
+        this.$message.success('提交成功')
+        this.$emit('success')
+        this.dialog = false
+      }
+    }
+  },
+  mounted () {
+    if (this.projectArr.length == 0) {
+      this.$store.dispatch('common/setProjectArr')
+    }
+    if (this.exData.id) {
+      this.form.id = this.exData.id
+      this.form.department_name = this.exData.department_name
+      this.form.department_desc = this.exData.department_desc
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
 </style>

+ 93 - 90
htmldev/manage/src/views/department/index.vue

@@ -1,105 +1,108 @@
 <template>
-    <div class="padding-20">
-        <div class="search-box">
-            <el-form ref="form" :inline="true" :model="searchForm" clearable label-width="100px" class="mt-10">
-                <el-form-item label="创建时间:">
-                    <el-date-picker
-                        :editable="false"
-                        v-model="time"
-                        @change="timearr => {timearr ? (searchForm.start_time = timearr[0] + ' 00:00:00', searchForm.end_time = timearr[1] + ' 23:59:59') : searchForm.start_time = searchForm.end_time = undefined}"
-                        type="daterange"
-                        value-format="yyyy-MM-dd"
-                        start-placeholder="开始时间"
-                        end-placeholder="结束时间"
-                    ></el-date-picker>
-                </el-form-item>
-                <el-form-item label="部门名称:">
-                    <el-input v-model="searchForm.department_name" placeholder="请输入部门名称" clearable></el-input>
-                </el-form-item>
-                <el-form-item class="ml-10">
-                    <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
-                </el-form-item>
-                <el-form-item class="ml-10">
-                    <el-button icon="el-icon-plus" type="primary" @click="add" v-permission="'department_list_add'">新增</el-button>
-                </el-form-item>
-            </el-form>
-        </div>
-        <el-table :data="tableData" stripe v-loading="tableLoading" fit class="marginT-10 order-table" border :max-height="vheight">
-            <el-table-column label="部门ID" prop="id"></el-table-column>
-            <el-table-column label="创建时间" prop="created_at"></el-table-column>
-            <el-table-column label="部门名称" prop="department_name"></el-table-column>
-            <el-table-column label="部门介绍" prop="department_desc"></el-table-column>
-            <el-table-column label="所属项目" prop="department_project_name"></el-table-column>
-            <el-table-column label="操作">
-                <template slot-scope="scope">
-                    <el-button type="text" @click="edit(scope.row)" v-permission="'department_list_edit'">编辑</el-button>
-                    <el-button type="text" @click="del(scope.row)" v-permission="'department_list_del'">删除</el-button>
-                </template>
-            </el-table-column>
-        </el-table>
-        <el-pagination 
-            class="marginT-20"
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :hide-on-single-page="true"
-            :current-page="page"
-            :page-size="page_size"
-            :page-sizes="[10, 20, 100, 200, 300, 400]"
-            background
-            layout="total, sizes, prev, pager, next, jumper"
-            :total="totalCount" />
-        <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData" @success="init"></detail>
+  <div class="padding-20">
+    <div class="search-box">
+      <el-form ref="form" :inline="true" :model="searchForm" clearable label-width="100px" class="mt-10">
+        <el-form-item label="创建时间:">
+          <el-date-picker
+            :editable="false"
+            v-model="time"
+            @change="timearr => {timearr ? (searchForm.start_time = timearr[0] + ' 00:00:00', searchForm.end_time = timearr[1] + ' 23:59:59') : searchForm.start_time = searchForm.end_time = undefined}"
+            type="daterange"
+            value-format="yyyy-MM-dd"
+            start-placeholder="开始时间"
+            end-placeholder="结束时间"
+          ></el-date-picker>
+        </el-form-item>
+        <el-form-item label="部门名称:">
+          <el-input v-model="searchForm.department_name" placeholder="请输入部门名称" clearable></el-input>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-plus" type="primary" @click="add" v-permission="'department_list_add'">新增</el-button>
+        </el-form-item>
+      </el-form>
     </div>
+    <el-table :data="tableData" stripe v-loading="tableLoading" fit class="marginT-10 order-table" border
+              :max-height="vheight">
+      <el-table-column label="部门ID" prop="id"></el-table-column>
+      <el-table-column label="创建时间" prop="created_at"></el-table-column>
+      <el-table-column label="部门名称" prop="department_name"></el-table-column>
+      <el-table-column label="部门介绍" prop="department_desc"></el-table-column>
+      <el-table-column label="所属项目" prop="department_project_name"></el-table-column>
+      <el-table-column label="操作">
+        <template slot-scope="scope">
+          <el-button type="text" @click="edit(scope.row)" v-permission="'department_list_edit'">编辑</el-button>
+          <el-button type="text" @click="del(scope.row)" v-permission="'department_list_del'">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      class="marginT-20"
+      @size-change="handleSizeChange"
+      @current-change="handleCurrentChange"
+      :hide-on-single-page="true"
+      :current-page="page"
+      :page-size="page_size"
+      :page-sizes="[10, 20, 100, 200, 300, 400]"
+      background
+      layout="total, sizes, prev, pager, next, jumper"
+      :total="totalCount"/>
+    <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData"
+            @success="init"></detail>
+  </div>
 </template>
 
 <script>
 import page from '@/mixin/page'
 import detail from './details'
+
 export default {
-    mixins: [page],
-    components: {
-        detail,
+  mixins: [page],
+  components: {
+    detail,
+  },
+  data () {
+    return {
+      detailsDialog: {
+        show: false,
+        exData: {}
+      },
+      time: [],
+      searchForm: {},
+      tableData: [],
+      tableUrl: '/department/list'
+    }
+  },
+  methods: {
+    add () {
+      this.detailsDialog.exData = {}
+      this.detailsDialog.show = true
     },
-    data() {
-        return {
-            detailsDialog: {
-                show: false,
-                exData: {}
-            },
-            time: [],
-            searchForm: {},
-            tableData: [],
-            tableUrl: '/department/list'
-        }
+    edit (row) {
+      this.detailsDialog.exData = row
+      this.detailsDialog.show = true
     },
-    methods: {
-        add() {
-            this.detailsDialog.exData = {}
-            this.detailsDialog.show = true
-        },
-        edit(row) {
-            this.detailsDialog.exData = row
-            this.detailsDialog.show = true
-        },
-        del(row) {
-            this.$confirm('确定要删除吗', '确认', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(async () => {
-                const data = await this.$fetch('/department/del', {id: row.id})
-                if (data.code == 200) {
-                    this.$message.success('删除成功')
-                    this.init()
-                }
-            }).catch(() => {})
+    del (row) {
+      this.$confirm('确定要删除吗', '确认', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const data = await this.$fetch('/department/del', { id: row.id })
+        if (data.code == 200) {
+          this.$message.success('删除成功')
+          this.init()
         }
-    },
-    mounted () {
-        this.init()
-    },
+      }).catch(() => {})
+    }
+  },
+  mounted () {
+    this.init()
+  },
 }
 </script>
 
 <style lang="scss" scoped>
-</style>
+</style>

+ 5 - 5
htmldev/manage/src/views/icons/index.vue

@@ -9,7 +9,7 @@
                 {{ generateIconCode(item) }}
               </div>
               <div class="icon-item">
-                <svg-icon :icon-class="item" class-name="disabled" />
+                <svg-icon :icon-class="item" class-name="disabled"/>
                 <span>{{ item }}</span>
               </div>
             </el-tooltip>
@@ -24,7 +24,7 @@
                 {{ generateElementIconCode(item) }}
               </div>
               <div class="icon-item">
-                <i :class="'el-icon-' + item" />
+                <i :class="'el-icon-' + item"/>
                 <span>{{ item }}</span>
               </div>
             </el-tooltip>
@@ -41,17 +41,17 @@ import elementIcons from './element-icons'
 
 export default {
   name: 'Icons',
-  data() {
+  data () {
     return {
       svgIcons,
       elementIcons
     }
   },
   methods: {
-    generateIconCode(symbol) {
+    generateIconCode (symbol) {
       return `<svg-icon icon-class="${symbol}" />`
     },
-    generateElementIconCode(symbol) {
+    generateElementIconCode (symbol) {
       return `<i class="el-icon-${symbol}" />`
     }
   }

+ 288 - 263
htmldev/manage/src/views/login/index.vue

@@ -1,39 +1,41 @@
 <template>
-	<div class="page-login">
-		<div class="page-login--layer page-login--layer-area">
-			<ul class="circles">
-				<li v-for="n in 10" :key="n"></li>
-			</ul>
-		</div>
-		<div class="page-login--layer page-login--layer-time">{{time}}</div>
-		<div class="page-login--wrapper">
-			<div class="page-login--content">
-				<div class="page-login--logo-title">
-					<p>管理系统</p>
-				</div>
-				<el-card shadow="never" class="login-form">
-					<el-form :model="loginForm" :rules="formRules" ref="loginForm" label-position="top">
-						<el-form-item prop="user_name" :rules="formRules.required">
-							<el-input placeholder="用户名" v-model="loginForm.user_name" size="default">
-								<i slot="prepend" class="el-icon-user-solid"></i>
-                            </el-input>
-                        </el-form-item>
-                        <el-form-item prop="user_password" :rules="formRules.password">
-                            <el-input show-password placeholder="密码" v-model="loginForm.user_password" size="default" @keydown.enter.native="handleSubmit">
-                                <i slot="prepend" class="el-icon-lock"></i>
-                            </el-input>
-                        </el-form-item>
-                        <el-button
-                            @click="handleSubmit"
-                            type="primary"
-                            class="button-login"
-                            size="default"
-                        >提交</el-button>
-                    </el-form>
-                </el-card>
-            </div>
+  <div class="page-login">
+    <div class="page-login--layer page-login--layer-area">
+      <ul class="circles">
+        <li v-for="n in 10" :key="n"></li>
+      </ul>
+    </div>
+    <div class="page-login--layer page-login--layer-time">{{time}}</div>
+    <div class="page-login--wrapper">
+      <div class="page-login--content">
+        <div class="page-login--logo-title">
+          <p>管理系统</p>
         </div>
+        <el-card shadow="never" class="login-form">
+          <el-form :model="loginForm" :rules="formRules" ref="loginForm" label-position="top">
+            <el-form-item prop="user_name" :rules="formRules.required">
+              <el-input placeholder="用户名" v-model="loginForm.user_name" size="default">
+                <i slot="prepend" class="el-icon-user-solid"></i>
+              </el-input>
+            </el-form-item>
+            <el-form-item prop="user_password" :rules="formRules.password">
+              <el-input show-password placeholder="密码" v-model="loginForm.user_password" size="default"
+                        @keydown.enter.native="handleSubmit">
+                <i slot="prepend" class="el-icon-lock"></i>
+              </el-input>
+            </el-form-item>
+            <el-button
+              @click="handleSubmit"
+              type="primary"
+              class="button-login"
+              size="default"
+            >提交
+            </el-button>
+          </el-form>
+        </el-card>
+      </div>
     </div>
+  </div>
 </template>
 
 <script>
@@ -41,256 +43,279 @@ import dayjs from 'dayjs'
 import { getToken, setToken, removeToken } from '@/utils/auth'
 
 export default {
-    name: 'Login',
-    data() {
-        return {
-            timeInterval: null,
-            time: dayjs().format('HH:mm:ss'),
-            loginForm: {
-                user_project_id: '1',
-                // user_name: 'admin',
-                // user_password: '123456'
-                user_name: '',
-                user_password: ''
-            },
-            loading: false,
-            passwordType: 'password',
-            redirect: undefined
-        }
-    },
-    watch: {
-        $route: {
-            handler: function(route) {
-                this.redirect = route.query && route.query.redirect
-            },
-            immediate: true
-        }
+  name: 'Login',
+  data () {
+    return {
+      timeInterval: null,
+      time: dayjs().format('HH:mm:ss'),
+      loginForm: {
+        user_project_id: '1',
+        // user_name: 'admin',
+        // user_password: '123456'
+        user_name: '',
+        user_password: ''
+      },
+      loading: false,
+      passwordType: 'password',
+      redirect: undefined
+    }
+  },
+  watch: {
+    $route: {
+      handler: function (route) {
+        this.redirect = route.query && route.query.redirect
+      },
+      immediate: true
+    }
+  },
+  methods: {
+    showPwd () {
+      if (this.passwordType === 'password') {
+        this.passwordType = ''
+      } else {
+        this.passwordType = 'password'
+      }
+      this.$nextTick(() => {
+        this.$refs.password.focus()
+      })
     },
-    methods: {
-        showPwd() {
-            if (this.passwordType === 'password') {
-                this.passwordType = ''
-            } else {
-                this.passwordType = 'password'
-            }
-            this.$nextTick(() => {
-                this.$refs.password.focus()
-            })
-        },
-        handleSubmit() {
-            this.$refs.loginForm.validate(async valid => {
-                if (valid) {
-                    this.loading = true
+    handleSubmit () {
+      this.$refs.loginForm.validate(async valid => {
+        if (valid) {
+          this.loading = true
 
-                    const data = await this.$fetch('/user/login', this.loginForm)
-                    
-                    if (data.code == 200) {
-                        this.$store.commit('user/SET_TOKEN', data.data.token)
-                        setToken(data.data.token)
-                        this.$router.push({ path: this.redirect || '/' })
-                    }
-                    // const data = {data: {token: 123}}
+          const data = await this.$fetch('/user/login', this.loginForm)
 
-                    this.loading = false
-                    
-                } else {
-                    console.log('error submit!!')
-                    return false
-                }
-            })
-        },
-        refreshTime() {
-            this.time = dayjs().format('HH:mm:ss')
+          if (data.code == 200) {
+            this.$store.commit('user/SET_TOKEN', data.data.token)
+            setToken(data.data.token)
+            this.$router.push({ path: this.redirect || '/' })
+          }
+          // const data = {data: {token: 123}}
+
+          this.loading = false
+
+        } else {
+          console.log('error submit!!')
+          return false
         }
+      })
     },
-    mounted() {
-        this.timeInterval = setInterval(() => {
-            this.refreshTime()
-        }, 1000)
-    },
-    beforeDestroy() {
-        clearInterval(this.timeInterval)
+    refreshTime () {
+      this.time = dayjs().format('HH:mm:ss')
     }
+  },
+  mounted () {
+    this.timeInterval = setInterval(() => {
+      this.refreshTime()
+    }, 1000)
+  },
+  beforeDestroy () {
+    clearInterval(this.timeInterval)
+  }
 }
 </script>
 <style lang="scss" scoped>
 .page-login {
-    user-select: none;
-    cursor: pointer;
-    $backgroundColor: #f0f2f5;
-    // ---
-    background-color: $backgroundColor;
-    height: 100%;
-    position: relative;
-    .page-login--layer {
+  user-select: none;
+  cursor: pointer;
+  $backgroundColor: #f0f2f5;
+  // ---
+  background-color: $backgroundColor;
+  height: 100%;
+  position: relative;
+
+  .page-login--layer {
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 0;
+    bottom: 0;
+    overflow: auto;
+
+    &-area {
+      overflow: hidden;
+    }
+
+    .circles {
+      padding: 0;
+      margin: 0;
+      position: absolute;
+      top: 0;
+      left: 0;
+      width: 100%;
+      height: 100%;
+      overflow: hidden;
+
+      li {
         position: absolute;
-        top: 0;
-        right: 0;
-        left: 0;
-        bottom: 0;
-        overflow: auto;
-        &-area {
-            overflow: hidden;
+        display: block;
+        list-style: none;
+        width: 20px;
+        height: 20px;
+        background: #ffffff;
+        bottom: -200px;
+        animation: animate 25s linear infinite;
+        @keyframes animate {
+          0% {
+            transform: translateY(0) rotate(0);
+            opacity: 1;
+            border-radius: 0;
+          }
+          100% {
+            transform: translateY(-1000px) rotate(720deg);
+            opacity: 0;
+            border-radius: 50%;
+          }
+        }
+
+        &:nth-child(1) {
+          left: 15%;
+          width: 80px;
+          height: 80px;
+          animation-delay: 0s;
+        }
+
+        &:nth-child(2) {
+          left: 5%;
+          width: 20px;
+          height: 20px;
+          animation-delay: 2s;
+          animation-duration: 12s;
         }
-        .circles {
-            padding: 0;
-            margin: 0;
-            position: absolute;
-            top: 0;
-            left: 0;
-            width: 100%;
-            height: 100%;
-            overflow: hidden;
-            li {
-                position: absolute;
-                display: block;
-                list-style: none;
-                width: 20px;
-                height: 20px;
-                background: #ffffff;
-                bottom: -200px;
-                animation: animate 25s linear infinite;
-                @keyframes animate {
-                    0% {
-                        transform: translateY(0) rotate(0);
-                        opacity: 1;
-                        border-radius: 0;
-                    }
-                    100% {
-                        transform: translateY(-1000px) rotate(720deg);
-                        opacity: 0;
-                        border-radius: 50%;
-                    }
-                }
-                &:nth-child(1) {
-                    left: 15%;
-                    width: 80px;
-                    height: 80px;
-                    animation-delay: 0s;
-                }
-                &:nth-child(2) {
-                    left: 5%;
-                    width: 20px;
-                    height: 20px;
-                    animation-delay: 2s;
-                    animation-duration: 12s;
-                }
-                &:nth-child(3) {
-                    left: 70%;
-                    width: 20px;
-                    height: 20px;
-                    animation-delay: 4s;
-                }
-                &:nth-child(4) {
-                    left: 40%;
-                    width: 60px;
-                    height: 60px;
-                    animation-delay: 0s;
-                    animation-duration: 18s;
-                }
-                &:nth-child(5) {
-                    left: 65%;
-                    width: 20px;
-                    height: 20px;
-                    animation-delay: 0s;
-                }
-                &:nth-child(6) {
-                    left: 75%;
-                    width: 150px;
-                    height: 150px;
-                    animation-delay: 3s;
-                }
-                &:nth-child(7) {
-                    left: 35%;
-                    width: 200px;
-                    height: 200px;
-                    animation-delay: 7s;
-                }
-                &:nth-child(8) {
-                    left: 50%;
-                    width: 25px;
-                    height: 25px;
-                    animation-delay: 15s;
-                    animation-duration: 45s;
-                }
-                &:nth-child(9) {
-                    left: 20%;
-                    width: 15px;
-                    height: 15px;
-                    animation-delay: 2s;
-                    animation-duration: 35s;
-                }
-                &:nth-child(10) {
-                    left: 85%;
-                    width: 150px;
-                    height: 150px;
-                    animation-delay: 0s;
-                    animation-duration: 11s;
-                }
-            }
+
+        &:nth-child(3) {
+          left: 70%;
+          width: 20px;
+          height: 20px;
+          animation-delay: 4s;
+        }
+
+        &:nth-child(4) {
+          left: 40%;
+          width: 60px;
+          height: 60px;
+          animation-delay: 0s;
+          animation-duration: 18s;
         }
-        &-time {
-            align-items: baseline;
-            padding-top: 0.5em;
-            font-size: 11em;
-            font-weight: bold;
-            color: rgba(0, 0, 0, 0.03);
-            overflow: hidden;
-            font-family: 'Arial';
-            display: flex;
-            justify-content: center;
-            /* align-items: center; */
-            flex-direction: row;
+
+        &:nth-child(5) {
+          left: 65%;
+          width: 20px;
+          height: 20px;
+          animation-delay: 0s;
+        }
+
+        &:nth-child(6) {
+          left: 75%;
+          width: 150px;
+          height: 150px;
+          animation-delay: 3s;
         }
+
+        &:nth-child(7) {
+          left: 35%;
+          width: 200px;
+          height: 200px;
+          animation-delay: 7s;
+        }
+
+        &:nth-child(8) {
+          left: 50%;
+          width: 25px;
+          height: 25px;
+          animation-delay: 15s;
+          animation-duration: 45s;
+        }
+
+        &:nth-child(9) {
+          left: 20%;
+          width: 15px;
+          height: 15px;
+          animation-delay: 2s;
+          animation-duration: 35s;
+        }
+
+        &:nth-child(10) {
+          left: 85%;
+          width: 150px;
+          height: 150px;
+          animation-delay: 0s;
+          animation-duration: 11s;
+        }
+      }
+    }
+
+    &-time {
+      align-items: baseline;
+      padding-top: 0.5em;
+      font-size: 11em;
+      font-weight: bold;
+      color: rgba(0, 0, 0, 0.03);
+      overflow: hidden;
+      font-family: 'Arial';
+      display: flex;
+      justify-content: center;
+      /* align-items: center; */
+      flex-direction: row;
     }
-    .page-login--wrapper {
+  }
+
+  .page-login--wrapper {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    flex-direction: row;
+    position: absolute;
+    top: 0;
+    right: 0;
+    left: 0;
+    bottom: 0;
+
+    .page-login--content {
+      width: 300px;
+
+      ::v-deep .el-card {
+        margin-bottom: 15px;
+        opacity: 0.9;
+
+        .el-card__body {
+          padding: 30px 20px;
+        }
+
+        .button-login {
+          width: 100%;
+        }
+
+        // 输入框左边的图表区域缩窄
+        .el-input-group__prepend {
+          padding: 0px 14px;
+        }
+
+        .login-code {
+          height: 32px - 2px;
+          display: block;
+          margin: 0px -20px;
+          border-top-right-radius: 2px;
+          border-bottom-right-radius: 2px;
+          // cursor: pointer;
+        }
+      }
+
+      .page-login--logo-title {
         display: flex;
         justify-content: center;
         align-items: center;
         flex-direction: row;
-        position: absolute;
-        top: 0;
-        right: 0;
-        left: 0;
-        bottom: 0;
-        .page-login--content {
-            width: 300px;
-            ::v-deep .el-card {
-                margin-bottom: 15px;
-                opacity: 0.9;
-                .el-card__body {
-                    padding: 30px 20px;
-                }
-                .button-login {
-                    width: 100%;
-                }
-                // 输入框左边的图表区域缩窄
-                .el-input-group__prepend {
-                    padding: 0px 14px;
-                }
+        font-size: 36px;
+        margin-bottom: 10px;
 
-                .login-code {
-                    height: 32px - 2px;
-                    display: block;
-                    margin: 0px -20px;
-                    border-top-right-radius: 2px;
-                    border-bottom-right-radius: 2px;
-                    // cursor: pointer;
-                }
-            }
-            .page-login--logo-title {
-                display: flex;
-                justify-content: center;
-                align-items: center;
-                flex-direction: row;
-                font-size: 36px;
-                margin-bottom: 10px;
-                img {
-                    width: 40px;
-                    margin-right: 10px;
-                }
-            }
+        img {
+          width: 40px;
+          margin-right: 10px;
         }
+      }
     }
+  }
 }
-</style>
+</style>

+ 70 - 69
htmldev/manage/src/views/project/components/filterAdd.vue

@@ -1,86 +1,87 @@
 <template>
-    <div>
-        <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
-            <el-form ref="form" :model="form" :rules="formRules" label-width="100px" class="bind-phone">
+  <div>
+    <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false"
+               top="50px">
+      <el-form ref="form" :model="form" :rules="formRules" label-width="100px" class="bind-phone">
 
-                <el-form-item label="方法路径:" prop="method_path" :rules="formRules.required">
-                    <el-input v-model="form.method_path" placeholder="请输入方法路径"> </el-input>
-                </el-form-item>
-                <el-form-item label="方法描述:" prop="method_desc" :rules="formRules.required">
-                    <el-input v-model="form.method_desc" placeholder="请输入方法描述"> </el-input>
-                </el-form-item>
+        <el-form-item label="方法路径:" prop="method_path" :rules="formRules.required">
+          <el-input v-model="form.method_path" placeholder="请输入方法路径"></el-input>
+        </el-form-item>
+        <el-form-item label="方法描述:" prop="method_desc" :rules="formRules.required">
+          <el-input v-model="form.method_desc" placeholder="请输入方法描述"></el-input>
+        </el-form-item>
 
-            </el-form>
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-    </div>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exData: {
-            type: Object,
-            default: function (){
-              return {}
-            }
-        }
-    },
-    components: {
-        // upload,
-    },
-    data() {
-        return {
-            dialog: !!this.value,
-            form: {
-                method_path: '',
-                method_desc: ''
-            }
-        }
-    },
-    methods: {
-        async handleSubmit() {
-            this.$refs.form.validate(async valid => {
-                if (valid) {
-                    let url = this.exData.id ? '/method/edit' : '/method/add'
-                    const data = await this.$fetch(url, {...this.form})
-                    if (data.code === 200) {
-                        this.$message.success('提交成功')
-                        this.$emit('success')
-                        this.dialog = false
-                    }
-                }
-            })
-        }
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    mounted () {
-        if (this.exData.id) {
-            this.form.id = this.exData.id
-            for (const key in this.form) {
-                this.form[key] = this.exData[key]
-            }
-        } else {
-            this.form.method_project_id = this.exData.method_project_id
-        }
-    },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  components: {
+    // upload,
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      form: {
+        method_path: '',
+        method_desc: ''
+      }
+    }
+  },
+  methods: {
+    async handleSubmit () {
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          let url = this.exData.id ? '/method/edit' : '/method/add'
+          const data = await this.$fetch(url, { ...this.form })
+          if (data.code === 200) {
+            this.$message.success('提交成功')
+            this.$emit('success')
+            this.dialog = false
+          }
         }
+      })
+    }
+  },
+  mounted () {
+    if (this.exData.id) {
+      this.form.id = this.exData.id
+      for (const key in this.form) {
+        this.form[key] = this.exData[key]
+      }
+    } else {
+      this.form.method_project_id = this.exData.method_project_id
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
 </style>

+ 76 - 74
htmldev/manage/src/views/project/details.vue

@@ -1,88 +1,90 @@
 <template>
-    <div>
-        <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
-            <el-form ref="form" :model="form" label-width="100px" class="bind-phone">
-                <el-form-item label="项目名称:" >
-                    <el-input v-model="form.project_name" placeholder="请输入项目名称"> </el-input>
-                </el-form-item>
-                <el-form-item label="LOGO:" >
-                    <upload class="marginT-20" type="qrcode" v-model="form.project_logo"></upload>
-                </el-form-item>
-                <el-form-item label="项目描述:" >
-                    <el-input v-model="form.project_desc" placeholder="请输入项目描述"> </el-input>
-                </el-form-item>
-                <el-form-item label="项目域名:" >
-                    <el-input v-model="form.project_host" placeholder="请输入项目域名"> </el-input>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-    </div>
+  <div>
+    <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false"
+               top="50px">
+      <el-form ref="form" :model="form" label-width="100px" class="bind-phone">
+        <el-form-item label="项目名称:">
+          <el-input v-model="form.project_name" placeholder="请输入项目名称"></el-input>
+        </el-form-item>
+        <el-form-item label="LOGO:">
+          <upload class="marginT-20" type="qrcode" v-model="form.project_logo"></upload>
+        </el-form-item>
+        <el-form-item label="项目描述:">
+          <el-input v-model="form.project_desc" placeholder="请输入项目描述"></el-input>
+        </el-form-item>
+        <el-form-item label="项目域名:">
+          <el-input v-model="form.project_host" placeholder="请输入项目域名"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-import upload from '@/components/upload';
+import upload from '@/components/upload'
+
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exData: {
-            type: Object,
-            default: function (){
-              return {}
-            }
-        }
-    },
-    components: {
-        upload,
-    },
-    data() {
-        return {
-            dialog: !!this.value,
-            form: {
-                project_name: '',
-                project_logo: '',
-                project_desc: '',
-                project_host: '',
-            }
-        }
-    },
-    methods: {
-        async handleSubmit() {
-            let url = this.exData.id ? '/project/edit' : '/project/add'
-            const data = await this.$fetch(url, {...this.form})
-            if (data.code === 200) {
-                this.$message.success('提交成功')
-                this.$emit('success')
-                this.$store.dispatch('common/setProjectArr')
-                this.dialog = false
-            }
-        }
-    },
-    mounted () {
-        if (this.exData.id) {
-            this.form.id = this.exData.id
-            for (const key in this.form) {
-                this.form[key] = this.exData[key]
-            }
-        }
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
-        }
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  components: {
+    upload,
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      form: {
+        project_name: '',
+        project_logo: '',
+        project_desc: '',
+        project_host: '',
+      }
+    }
+  },
+  methods: {
+    async handleSubmit () {
+      let url = this.exData.id ? '/project/edit' : '/project/add'
+      const data = await this.$fetch(url, { ...this.form })
+      if (data.code === 200) {
+        this.$message.success('提交成功')
+        this.$emit('success')
+        this.$store.dispatch('common/setProjectArr')
+        this.dialog = false
+      }
+    }
+  },
+  mounted () {
+    if (this.exData.id) {
+      this.form.id = this.exData.id
+      for (const key in this.form) {
+        this.form[key] = this.exData[key]
+      }
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
 </style>

+ 96 - 93
htmldev/manage/src/views/project/filterPath.vue

@@ -1,112 +1,115 @@
 <template>
-    <div>
-        <el-dialog title="公共方法配置" :visible.sync="dialog" width="950px" :close-on-click-modal="false" top="50px">
-            <p class="top-tip fc-theme">公共方法列表
-                <el-button type="primary" v-permission="'method_list_add'" @click="add">添加</el-button>
-            </p>
-            <el-table :data="tableData" stripe v-loading="tableLoading" fit class="marginT-10 order-table" border :max-height="vheight">
-                <el-table-column label="方法ID" prop="id"></el-table-column>
-                <el-table-column label="方法路径" prop="method_path"></el-table-column>
-                <el-table-column label="方法描述" prop="method_desc"></el-table-column>
-                <el-table-column label="操作" width="180">
-                    <template slot-scope="scope">
-                        <el-button type="text" @click="edit(scope.row)" v-permission="'method_list_edit'">编辑</el-button>
-                        <el-button type="text" @click="del(scope.row)" v-permission="'method_list_del'">删除</el-button>
-                    </template>
-                </el-table-column>
-            </el-table>
-            <el-pagination
-                class="marginT-20"
-                @size-change="handleSizeChange"
-                @current-change="handleCurrentChange"
-                :hide-on-single-page="true"
-                :current-page="page"
-                :page-size="page_size"
-                :page-sizes="[10, 20, 100, 200, 300, 400]"
-                background
-                layout="total, sizes, prev, pager, next, jumper"
-                :total="totalCount" />
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="dialog = false">确 定</el-button>
-            </div>
-        </el-dialog>
-        <filterAdd v-if="filterAddDialog.show" v-model="filterAddDialog.show" :exData="filterAddDialog.exData" @success="init"></filterAdd>
-    </div>
+  <div>
+    <el-dialog title="公共方法配置" :visible.sync="dialog" width="950px" :close-on-click-modal="false" top="50px">
+      <p class="top-tip fc-theme">公共方法列表
+        <el-button type="primary" v-permission="'method_list_add'" @click="add">添加</el-button>
+      </p>
+      <el-table :data="tableData" stripe v-loading="tableLoading" fit class="marginT-10 order-table" border
+                :max-height="vheight">
+        <el-table-column label="方法ID" prop="id"></el-table-column>
+        <el-table-column label="方法路径" prop="method_path"></el-table-column>
+        <el-table-column label="方法描述" prop="method_desc"></el-table-column>
+        <el-table-column label="操作" width="180">
+          <template slot-scope="scope">
+            <el-button type="text" @click="edit(scope.row)" v-permission="'method_list_edit'">编辑</el-button>
+            <el-button type="text" @click="del(scope.row)" v-permission="'method_list_del'">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-pagination
+        class="marginT-20"
+        @size-change="handleSizeChange"
+        @current-change="handleCurrentChange"
+        :hide-on-single-page="true"
+        :current-page="page"
+        :page-size="page_size"
+        :page-sizes="[10, 20, 100, 200, 300, 400]"
+        background
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="totalCount"/>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="dialog = false">确 定</el-button>
+      </div>
+    </el-dialog>
+    <filterAdd v-if="filterAddDialog.show" v-model="filterAddDialog.show" :exData="filterAddDialog.exData"
+               @success="init"></filterAdd>
+  </div>
 </template>
 
 <script>
 import page from '@/mixin/page'
-import filterAdd from './components/filterAdd';
+import filterAdd from './components/filterAdd'
+
 export default {
-    mixins: [page],
-    components: {
-        filterAdd,
-    },
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exData: {
-            type: Object,
-            default: function (){
-              return {}
-            }
-        }
+  mixins: [page],
+  components: {
+    filterAdd,
+  },
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    data() {
-        return {
-            filterAddDialog: {
-                show: false,
-                exData: {}
-            },
-            searchForm: {},
-            tableData: [],
-            tableUrl: '/method/list',
-            dialog: !!this.value,
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      filterAddDialog: {
+        show: false,
+        exData: {}
+      },
+      searchForm: {},
+      tableData: [],
+      tableUrl: '/method/list',
+      dialog: !!this.value,
 
-        }
-    },
-    methods: {
-        add() {
-            this.filterAddDialog.exData = {
-                method_project_id: this.exData.id
-            }
-            this.filterAddDialog.show = true
-        },
-        edit(row) {
-            this.filterAddDialog.exData = row
-            this.filterAddDialog.show = true
-        },
-        del(row) {
-            this.$confirm('确定要删除吗', '确认', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(async () => {
-                const data = await this.$fetch('/method/del', {id: row.id})
-                if (data.code == 200) {
-                    this.$message.success('删除成功')
-                    this.init()
-                }
-            }).catch(() => {})
-        }
+    }
+  },
+  methods: {
+    add () {
+      this.filterAddDialog.exData = {
+        method_project_id: this.exData.id
+      }
+      this.filterAddDialog.show = true
     },
-    mounted () {
-        this.init()
+    edit (row) {
+      this.filterAddDialog.exData = row
+      this.filterAddDialog.show = true
     },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
+    del (row) {
+      this.$confirm('确定要删除吗', '确认', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const data = await this.$fetch('/method/del', { id: row.id })
+        if (data.code == 200) {
+          this.$message.success('删除成功')
+          this.init()
         }
+      }).catch(() => {})
+    }
+  },
+  mounted () {
+    this.init()
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
 </style>

+ 142 - 129
htmldev/manage/src/views/project/index.vue

@@ -1,160 +1,173 @@
 <template>
-    <div class="padding-20">
-        <div class="flex flex-wrap">
-            <div v-for="(item, index) in projectList" :key="index" class="box">
-                <el-card class="box-card">
-                    <div>项目ID:{{item.id}}</div>
-                    <div>项目名称:{{item.project_name}}</div>
-                    <div class="flex">
-                        <div>LOGO:</div>
-                        <div><img style="max-height: 60px; max-width: 196px;" :src="item.project_logo" /></div>
-                    </div>
-                    <div>项目描述:{{item.project_desc}}</div>
-                    <div>项目域名:{{item.project_host}}</div>
-                    <div>项目状态:{{item.project_status}}</div>
-                </el-card>
-                <div class="bottom-btn marginT-10">
-                    <el-button v-permission="'project_list_edit'" size="mini" type="primary" @click="edit(item)">编辑</el-button>
-                    <el-button v-permission="'project_list_status'" size="mini" :type="item.project_status == '启用' ? 'danger' : 'success'" @click="status(item)">{{item.project_status == '启用' ? '停用' : '启用'}}</el-button>
-                    <el-button v-permission="'method_list_show'" size="mini" type="warning" @click="setFilterPath(item)">公共方法</el-button>
-                    <el-button v-permission="'project_list_roleConfig'" size="mini" type="warning" @click="setPermissions(item)">权限编辑</el-button>
-                </div>
-            </div>
-            <div class="box">
-                <div @click="add" class="box-add" v-permission="'project_list_add'">
-                    <el-card class="box-card point">
-                        <div>
-                            <div class="text-center" >
-                                新建项目
-                            </div>
-                            <div class="text-center">
-                                <i class="el-icon-plus"></i>
-                            </div>
-                        </div>
-                    </el-card>
-                </div>
+  <div class="padding-20">
+    <div class="flex flex-wrap">
+      <div v-for="(item, index) in projectList" :key="index" class="box">
+        <el-card class="box-card">
+          <div>项目ID:{{item.id}}</div>
+          <div>项目名称:{{item.project_name}}</div>
+          <div class="flex">
+            <div>LOGO:</div>
+            <div><img style="max-height: 60px; max-width: 196px;" :src="item.project_logo"/></div>
+          </div>
+          <div>项目描述:{{item.project_desc}}</div>
+          <div>项目域名:{{item.project_host}}</div>
+          <div>项目状态:{{item.project_status}}</div>
+        </el-card>
+        <div class="bottom-btn marginT-10">
+          <el-button v-permission="'project_list_edit'" size="mini" type="primary" @click="edit(item)">编辑</el-button>
+          <el-button v-permission="'project_list_status'" size="mini"
+                     :type="item.project_status == '启用' ? 'danger' : 'success'" @click="status(item)">
+            {{item.project_status == '启用' ? '停用' : '启用'}}
+          </el-button>
+          <el-button v-permission="'method_list_show'" size="mini" type="warning" @click="setFilterPath(item)">公共方法
+          </el-button>
+          <el-button v-permission="'project_list_roleConfig'" size="mini" type="warning" @click="setPermissions(item)">
+            权限编辑
+          </el-button>
+        </div>
+      </div>
+      <div class="box">
+        <div @click="add" class="box-add" v-permission="'project_list_add'">
+          <el-card class="box-card point">
+            <div>
+              <div class="text-center">
+                新建项目
+              </div>
+              <div class="text-center">
+                <i class="el-icon-plus"></i>
+              </div>
             </div>
-            
-            
+          </el-card>
         </div>
-        
-        <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData" @success="getList"></detail>
-        <permissions v-if="permissionsDialog.show" v-model="permissionsDialog.show" :exData="permissionsDialog.exData" @success="getList"></permissions>
-        <filterPath v-if="filterDialog.show" v-model="filterDialog.show" :exData="filterDialog.exData"></filterPath>
+      </div>
+
+
     </div>
+
+    <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData"
+            @success="getList"></detail>
+    <permissions v-if="permissionsDialog.show" v-model="permissionsDialog.show" :exData="permissionsDialog.exData"
+                 @success="getList"></permissions>
+    <filterPath v-if="filterDialog.show" v-model="filterDialog.show" :exData="filterDialog.exData"></filterPath>
+  </div>
 </template>
 
 <script>
 import detail from './details'
 import permissions from './permissions'
 import filterPath from './filterPath'
+
 export default {
-    components: {
-        detail,
-        permissions,
-        filterPath
+  components: {
+    detail,
+    permissions,
+    filterPath
+  },
+  data () {
+    return {
+      detailsDialog: {
+        show: false,
+        exData: {}
+      },
+      permissionsDialog: {
+        show: false,
+        exData: {}
+      },
+      filterDialog: {
+        show: false,
+        exData: {}
+      },
+      projectList: [],
+      tableUrl: '/project/list'
+    }
+  },
+  methods: {
+    add () {
+      this.detailsDialog.exData = {}
+      this.detailsDialog.show = true
     },
-    data() {
-        return {
-            detailsDialog: {
-                show: false,
-                exData: {}
-            },
-            permissionsDialog: {
-                show: false,
-                exData: {}
-            },
-            filterDialog: {
-                show: false,
-                exData: {}
-            },
-            projectList: [],
-            tableUrl: '/project/list'
+    edit (row) {
+      this.detailsDialog.exData = row
+      this.detailsDialog.show = true
+    },
+    async status (row) {
+      this.$confirm(`确定${row.project_status == '启用' ? '停用' : '启用'}当前项目吗`, '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const data = await this.$fetch('/project/set_status', { id: row.id })
+        if (data.code == 200) {
+          this.getList()
         }
+      }).catch(() => {})
+
     },
-    methods: {
-        add() {
-            this.detailsDialog.exData = {}
-            this.detailsDialog.show = true
-        },
-        edit(row) {
-            this.detailsDialog.exData = row
-            this.detailsDialog.show = true
-        },
-        async status(row) {
-            this.$confirm(`确定${row.project_status == '启用' ? '停用' : '启用'}当前项目吗`, '提示', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(async () => {
-                const data = await this.$fetch('/project/set_status', {id: row.id})
-                if (data.code == 200) {
-                    this.getList()
-                }
-            }).catch(() => {});
-            
-        },
-        del(row) {
-            this.$confirm('确定要删除吗', '确认', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(async () => {
-                const data = await this.$fetch('/project/del', {id: row.id})
-                if (data.code == 200) {
-                    this.$message.success('删除成功')
-                    this.init()
-                    this.$store.dispatch('common/setProjectArr')
-                }
-            }).catch(() => {})
-        },
-        async getList() {
-            const data = await this.$fetch('/project/list', {}, 'get')
-            if (data.code == 200) {
-                this.projectList = data.data
-            }
-        },
-        setPermissions(row) {
-            this.permissionsDialog.exData = row
-            this.permissionsDialog.show = true
-        },
-        setFilterPath(row) {
-            this.filterDialog.exData = row
-            this.filterDialog.show = true
+    del (row) {
+      this.$confirm('确定要删除吗', '确认', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const data = await this.$fetch('/project/del', { id: row.id })
+        if (data.code == 200) {
+          this.$message.success('删除成功')
+          this.init()
+          this.$store.dispatch('common/setProjectArr')
         }
+      }).catch(() => {})
     },
-    mounted () {
-        // this.init()
-        this.getList()
-        
+    async getList () {
+      const data = await this.$fetch('/project/list', {}, 'get')
+      if (data.code == 200) {
+        this.projectList = data.data
+      }
     },
+    setPermissions (row) {
+      this.permissionsDialog.exData = row
+      this.permissionsDialog.show = true
+    },
+    setFilterPath (row) {
+      this.filterDialog.exData = row
+      this.filterDialog.show = true
+    }
+  },
+  mounted () {
+    // this.init()
+    this.getList()
+
+  },
 }
 </script>
 
 <style lang="scss" scoped>
 .box {
-    margin: 20px;
-    margin-bottom: 40px;
-    flex-basis: 300px;
-    height: 230px;
-    max-height: 230px;
+  margin: 20px;
+  margin-bottom: 40px;
+  flex-basis: 300px;
+  height: 230px;
+  max-height: 230px;
 }
+
 .box-add {
-    height: 100%;
+  height: 100%;
 }
+
 .box-card {
-    width: 100%;
-    height: 100%;
-    color: #fff;
-    background: rgb(72 112 189);
+  width: 100%;
+  height: 100%;
+  color: #fff;
+  background: rgb(72 112 189);
 }
+
 .el-icon-plus {
-    font-size: 60px;
-    margin-top: 30px;
+  font-size: 60px;
+  margin-top: 30px;
 }
+
 .bottom-btn {
-    button {
-        padding: 7px 10px;
-    }
+  button {
+    padding: 7px 10px;
+  }
 }
-</style>
+</style>

+ 125 - 120
htmldev/manage/src/views/project/permissions.vue

@@ -1,161 +1,166 @@
 <template>
-    <div>
-        <el-dialog title="项目权限列表" :visible.sync="dialog" width="950px" :close-on-click-modal="false" top="50px">
-            <el-tree
-                v-loading="loading"
-                :data="treeData"
-                ref="tree"
-                node-key="id"
-                :auto-expand-parent="false"
-                @node-expand="openTreeNode"
-                @node-collapse="closeTreeNode"
-                :default-expanded-keys="openTreeNodeArr"
-                :props="defaultProps">
+  <div>
+    <el-dialog title="项目权限列表" :visible.sync="dialog" width="950px" :close-on-click-modal="false" top="50px">
+      <el-tree
+        v-loading="loading"
+        :data="treeData"
+        ref="tree"
+        node-key="id"
+        :auto-expand-parent="false"
+        @node-expand="openTreeNode"
+        @node-collapse="closeTreeNode"
+        :default-expanded-keys="openTreeNodeArr"
+        :props="defaultProps">
                 <span class="custom-tree-node" slot-scope="{ node, data }">
                     <span v-if="node.label">
                         <span class="marginR-10">{{ node.label }}</span>
                         <span>
                             <el-button
-                                type="text"
-                                size="mini"
-                                v-permission="'rule_list_edit'"
-                                @click.stop="() => mod(data)">
+                              type="text"
+                              size="mini"
+                              v-permission="'rule_list_edit'"
+                              @click.stop="() => mod(data)">
                                 修改
                             </el-button>
                             <el-button
-                                type="text"
-                                size="mini"
-                                v-permission="'rule_list_add'"
-                                @click.stop="() => append(data)">
+                              type="text"
+                              size="mini"
+                              v-permission="'rule_list_add'"
+                              @click.stop="() => append(data)">
                                 添加子节点
                             </el-button>
                             <el-button
-                                type="text"
-                                size="mini"
-                                v-permission="'rule_list_del'"
-                                @click.stop="() => remove(node, data)">
+                              type="text"
+                              size="mini"
+                              v-permission="'rule_list_del'"
+                              @click.stop="() => remove(node, data)">
                                 删除
                             </el-button>
                         </span>
                     </span>
                     <span v-else>
                         <div>
-                            <el-button type="text" @click="append('new')" v-permission="'rule_list_add'">添加权限</el-button>
+                            <el-button type="text" @click="append('new')"
+                                       v-permission="'rule_list_add'">添加权限</el-button>
                         </div>
                     </span>
                 </span>
-            </el-tree>
+      </el-tree>
 
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-        <ruleDialog v-if="ruleDialogData.show" v-model="ruleDialogData.show" :exData="ruleDialogData.exData" @success="getPermissionsTree"></ruleDialog>
-    </div>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+    <ruleDialog v-if="ruleDialogData.show" v-model="ruleDialogData.show" :exData="ruleDialogData.exData"
+                @success="getPermissionsTree"></ruleDialog>
+  </div>
 </template>
 
 <script>
-import {mapGetters} from 'vuex'
-import ruleDialog from './ruleDialog';
+import { mapGetters } from 'vuex'
+import ruleDialog from './ruleDialog'
+
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exData: {
-            type: Object,
-            default: function (){
-              return {}
-            }
-        }
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    computed: {
-
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  computed: {},
+  components: {
+    ruleDialog,
+  },
+  data () {
+    return {
+      ruleDialogData: {
+        show: false,
+        exData: {}
+      },
+      loading: true,
+      defaultProps: {
+        children: 'son',
+        label: 'rule_title',
+      },
+      treeData: [],
+      dialog: !!this.value,
+      openTreeNodeArr: [],
+    }
+  },
+  methods: {
+    openTreeNode (obj, node) {
+      console.log({ node1: node })
+      this.openTreeNodeArr.push(node.key)
+    },
+    closeTreeNode (obj, node) {
+      console.log({ node })
+      this.openTreeNodeArr = this.openTreeNodeArr.filter(item => item != node.key)
     },
-    components: {
-        ruleDialog,
+    mod (data) {
+      this.ruleDialogData.exData = { ...data, rule_project_id: this.exData.id }
+      this.ruleDialogData.show = true
     },
-    data() {
-        return {
-            ruleDialogData: {
-                show: false,
-                exData: {}
-            },
-            loading: true,
-            defaultProps: {
-                children: 'son',
-                label: 'rule_title',
-            },
-            treeData: [],
-            dialog: !!this.value,
-            openTreeNodeArr: [],
-        }
+    append (data) {
+      this.ruleDialogData.exData = {
+        rule_project_id: this.exData.id,
+        rule_project_name: this.exData.project_name,
+        rule_pid: data == 'new' ? 0 : data.id
+      }
+      this.ruleDialogData.show = true
     },
-    methods: {
-        openTreeNode(obj, node) {
-            console.log({node1: node})
-            this.openTreeNodeArr.push(node.key)
-        },
-        closeTreeNode(obj, node) {
-            console.log({node});
-            this.openTreeNodeArr = this.openTreeNodeArr.filter(item => item != node.key)
-        },
-        mod(data) {
-            this.ruleDialogData.exData = {...data, rule_project_id: this.exData.id}
-            this.ruleDialogData.show = true
-        },
-        append(data) {
-            this.ruleDialogData.exData = {rule_project_id: this.exData.id, rule_project_name: this.exData.project_name, rule_pid: data == 'new' ? 0 :data.id}
-            this.ruleDialogData.show = true
-        },
 
-        async remove(node, data) {
-            this.$confirm('确定删除此条权限控制吗,前端须更改,不然无权限', '确定', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(async () => {
-                this.delNode(data.id)
-            }).catch(() => {})
-        },
-        async handleSubmit() {
-            this.dialog = false
-        },
-        async delNode(id) {
-            const data = await this.$fetch('/rule/del', {id})
-            if (data.code == 200) {
-                this.getPermissionsTree()
-            }
-        },
-        async getPermissionsTree() {
-            this.loading = true
-            const data = await this.$fetch('/rule/list', {project_id: this.exData.id}, 'get')
-            if (data.code == 200) {
-                this.treeData = [...data.data, {append: 'new'}]
-            }
-            this.loading = false
-        }
+    async remove (node, data) {
+      this.$confirm('确定删除此条权限控制吗,前端须更改,不然无权限', '确定', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        this.delNode(data.id)
+      }).catch(() => {})
     },
-    mounted () {
+    async handleSubmit () {
+      this.dialog = false
+    },
+    async delNode (id) {
+      const data = await this.$fetch('/rule/del', { id })
+      if (data.code == 200) {
         this.getPermissionsTree()
+      }
     },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
-        }
+    async getPermissionsTree () {
+      this.loading = true
+      const data = await this.$fetch('/rule/list', { project_id: this.exData.id }, 'get')
+      if (data.code == 200) {
+        this.treeData = [...data.data, { append: 'new' }]
+      }
+      this.loading = false
+    }
+  },
+  mounted () {
+    this.getPermissionsTree()
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .custom-tree-node {
-    flex: 1;
-    display: flex;
-    align-items: center;
-    /* justify-content: space-between; */
-    font-size: 14px;
-    padding-right: 8px;
-  }
+  flex: 1;
+  display: flex;
+  align-items: center;
+  /* justify-content: space-between; */
+  font-size: 14px;
+  padding-right: 8px;
+}
 </style>

+ 88 - 87
htmldev/manage/src/views/project/ruleDialog.vue

@@ -1,103 +1,104 @@
 <template>
-    <div>
-        <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
-            <el-form ref="form" :model="form" :rules="formRules" label-width="100px" class="bind-phone">
-                <el-form-item label="项目名称:" >
-                    {{exData.rule_project_name}}
-                </el-form-item>
-                <el-form-item label="权限类型:" >
-                    <el-select v-model="form.rule_type" placeholder="">
-                      <el-option label="菜单类型" :value="0"></el-option>
-                      <el-option label="权限类型" :value="1"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item label="权限标识:" prop="rule_code" :rules="formRules.required">
-                    <el-input v-model="form.rule_code" placeholder="请输入权限标识"> </el-input>
-                </el-form-item>
-                <el-form-item label="权限名称:" prop="rule_title" :rules="formRules.required">
-                    <el-input v-model="form.rule_title" placeholder="请输入权限名称"> </el-input>
-                </el-form-item>
-                <el-form-item label="权限路径:" prop="rule_url" :rules="formRules.required">
-                    <el-input v-model="form.rule_url" placeholder="请输入权限路径,没有填入#"> </el-input>
-                </el-form-item>
+  <div>
+    <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false"
+               top="50px">
+      <el-form ref="form" :model="form" :rules="formRules" label-width="100px" class="bind-phone">
+        <el-form-item label="项目名称:">
+          {{exData.rule_project_name}}
+        </el-form-item>
+        <el-form-item label="权限类型:">
+          <el-select v-model="form.rule_type" placeholder="">
+            <el-option label="菜单类型" :value="0"></el-option>
+            <el-option label="权限类型" :value="1"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="权限标识:" prop="rule_code" :rules="formRules.required">
+          <el-input v-model="form.rule_code" placeholder="请输入权限标识"></el-input>
+        </el-form-item>
+        <el-form-item label="权限名称:" prop="rule_title" :rules="formRules.required">
+          <el-input v-model="form.rule_title" placeholder="请输入权限名称"></el-input>
+        </el-form-item>
+        <el-form-item label="权限路径:" prop="rule_url" :rules="formRules.required">
+          <el-input v-model="form.rule_url" placeholder="请输入权限路径,没有填入#"></el-input>
+        </el-form-item>
 
-            </el-form>
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-    </div>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exData: {
-            type: Object,
-            default: function (){
-              return {}
-            }
-        }
-    },
-    components: {
-        // upload,
-    },
-    data() {
-        return {
-            dialog: !!this.value,
-            form: {
-                // id: undefined,
-                rule_project_id: '',
-                rule_type: 0,
-                rule_code: '',
-                rule_title: '',
-                rule_url: '#',
-                rule_pid: 0
-            }
-        }
-    },
-    methods: {
-        async handleSubmit() {
-            this.$refs.form.validate(async valid => {
-                if (valid) {
-                    let url = this.exData.id ? '/rule/edit' : '/rule/add'
-                    const data = await this.$fetch(url, {...this.form})
-                    if (data.code === 200) {
-                        this.$message.success('提交成功')
-                        this.$emit('success')
-                        this.dialog = false
-                    }
-                }
-            })
-        }
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    mounted () {
-        if (this.exData.id) {
-            this.form.id = this.exData.id
-            for (const key in this.form) {
-                this.form[key] = this.exData[key]
-            }
-        } else {
-            this.form.rule_project_id = this.exData.rule_project_id
-            this.form.rule_pid = this.exData.rule_pid
-        }
-    },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  components: {
+    // upload,
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      form: {
+        // id: undefined,
+        rule_project_id: '',
+        rule_type: 0,
+        rule_code: '',
+        rule_title: '',
+        rule_url: '#',
+        rule_pid: 0
+      }
+    }
+  },
+  methods: {
+    async handleSubmit () {
+      this.$refs.form.validate(async valid => {
+        if (valid) {
+          let url = this.exData.id ? '/rule/edit' : '/rule/add'
+          const data = await this.$fetch(url, { ...this.form })
+          if (data.code === 200) {
+            this.$message.success('提交成功')
+            this.$emit('success')
+            this.dialog = false
+          }
         }
+      })
+    }
+  },
+  mounted () {
+    if (this.exData.id) {
+      this.form.id = this.exData.id
+      for (const key in this.form) {
+        this.form[key] = this.exData[key]
+      }
+    } else {
+      this.form.rule_project_id = this.exData.rule_project_id
+      this.form.rule_pid = this.exData.rule_pid
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
 </style>

+ 93 - 89
htmldev/manage/src/views/roles/details.vue

@@ -1,105 +1,109 @@
 <template>
-    <div>
-        <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
-            <el-form ref="form" :model="form" label-width="100px" class="bind-phone">
-                <el-form-item v-if="!exData.id" label="项目选择:" >
-                    <el-select v-model="form.role_project_id">
-                        <el-option v-for="(item, index) in projectArr" :key="index" :label="item.project_name" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item v-if="form.role_project_id" label="部门选择:" >
-                    <el-select v-model="form.role_department_id">
-                        <el-option v-for="(item, index) in departmentArr" :key="index" :label="item.department_name" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item label="角色名称:" >
-                    <el-input v-model="form.role_name" placeholder="请输入角色名称"> </el-input>
-                </el-form-item>
-                <el-form-item label="角色描述:" >
-                    <el-input v-model="form.role_desc" placeholder="请输入角色描述"> </el-input>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-    </div>
+  <div>
+    <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false"
+               top="50px">
+      <el-form ref="form" :model="form" label-width="100px" class="bind-phone">
+        <el-form-item v-if="!exData.id" label="项目选择:">
+          <el-select v-model="form.role_project_id">
+            <el-option v-for="(item, index) in projectArr" :key="index" :label="item.project_name"
+                       :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item v-if="form.role_project_id" label="部门选择:">
+          <el-select v-model="form.role_department_id">
+            <el-option v-for="(item, index) in departmentArr" :key="index" :label="item.department_name"
+                       :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="角色名称:">
+          <el-input v-model="form.role_name" placeholder="请输入角色名称"></el-input>
+        </el-form-item>
+        <el-form-item label="角色描述:">
+          <el-input v-model="form.role_desc" placeholder="请输入角色描述"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-import {mapGetters} from 'vuex'
+import { mapGetters } from 'vuex'
+
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exData: {
-            type: Object,
-            default: function (){
-              return {}
-            }
-        }
-    },
-    computed: {
-        ...mapGetters([
-            'projectArr'
-        ])
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    data() {
-        return {
-            dialog: !!this.value,
-            departmentArr: [],
-            form: {
-                role_project_id: undefined,
-                role_department_id: undefined,
-                role_name: '',
-                role_desc: ''
-            }
-        }
-    },
-    methods: {
-        async handleSubmit() {
-            let url = this.exData.id ? '/role/set_role_info' : '/role/add'
-            const data = await this.$fetch(url, {...this.form})
-            if (data.code === 200) {
-                this.$message.success('提交成功')
-                this.$emit('success')
-                this.dialog = false
-            }
-        },
-        async getDepartmentArr(project_id) {
-            const data = await this.$fetch('/department/get_department_list', {project_id}, 'get')
-            if (data.code == 200) {
-                this.departmentArr = data.data
-            }
-        }
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  computed: {
+    ...mapGetters([
+      'projectArr'
+    ])
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      departmentArr: [],
+      form: {
+        role_project_id: undefined,
+        role_department_id: undefined,
+        role_name: '',
+        role_desc: ''
+      }
+    }
+  },
+  methods: {
+    async handleSubmit () {
+      let url = this.exData.id ? '/role/set_role_info' : '/role/add'
+      const data = await this.$fetch(url, { ...this.form })
+      if (data.code === 200) {
+        this.$message.success('提交成功')
+        this.$emit('success')
+        this.dialog = false
+      }
     },
-    mounted () {
-        if (this.projectArr.length == 0) {
-            this.$store.dispatch('common/setProjectArr')
-        }
-        if (this.exData.id) {
-            this.form.id = this.exData.id
-            this.form.role_name = this.exData.role_name
-            this.form.role_desc = this.exData.role_desc
-        }
+    async getDepartmentArr (project_id) {
+      const data = await this.$fetch('/department/get_department_list', { project_id }, 'get')
+      if (data.code == 200) {
+        this.departmentArr = data.data
+      }
+    }
+  },
+  mounted () {
+    if (this.projectArr.length == 0) {
+      this.$store.dispatch('common/setProjectArr')
+    }
+    if (this.exData.id) {
+      this.form.id = this.exData.id
+      this.form.role_name = this.exData.role_name
+      this.form.role_desc = this.exData.role_desc
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
-        },
-        'form.role_project_id'(newValue, oldValue) {
-            this.getDepartmentArr(newValue)
-        }
+    'form.role_project_id' (newValue, oldValue) {
+      this.getDepartmentArr(newValue)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
 </style>

+ 105 - 101
htmldev/manage/src/views/roles/index.vue

@@ -1,118 +1,122 @@
 <template>
-    <div class="padding-20">
-        <div class="search-box">
-            <el-form ref="form" :inline="true" :model="searchForm" clearable label-width="100px" class="mt-10">
-                <el-form-item label="创建时间:">
-                    <el-date-picker
-                        :editable="false"
-                        v-model="time"
-                        @change="timearr => {timearr ? (searchForm.start_time = timearr[0] + ' 00:00:00', searchForm.end_time = timearr[1] + ' 23:59:59') : searchForm.start_time = searchForm.end_time = undefined}"
-                        type="daterange"
-                        value-format="yyyy-MM-dd"
-                        start-placeholder="开始时间"
-                        end-placeholder="结束时间"
-                    ></el-date-picker>
-                </el-form-item>
-                <el-form-item label="角色名称:">
-                    <el-input v-model="searchForm.role_name" placeholder="请输入角色名称" clearable></el-input>
-                </el-form-item>
-                <el-form-item class="ml-10">
-                    <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
-                </el-form-item>
-                <el-form-item class="ml-10">
-                    <el-button icon="el-icon-plus" type="primary" @click="add" v-permission="'roles_list_add'">新增</el-button>
-                </el-form-item>
-            </el-form>
-        </div>
-        <el-table :data="tableData" stripe v-loading="tableLoading" fit class="marginT-10 order-table" border :max-height="vheight">
-            <el-table-column label="角色ID" prop="id"></el-table-column>
-            <el-table-column label="创建时间" prop="created_at"></el-table-column>
-            <el-table-column label="角色名称" prop="role_name"></el-table-column>
-            <el-table-column label="角色介绍" prop="role_desc"></el-table-column>
-            <el-table-column label="所属项目" prop="role_project_name"></el-table-column>
-            <el-table-column label="所属部门" prop="role_department_name"></el-table-column>
-            <el-table-column label="操作" width="180">
-                <template slot-scope="scope">
-                    <el-button type="text" @click="edit(scope.row)" v-permission="'roles_list_edit'">编辑</el-button>
-                    <el-button type="text" @click="del(scope.row)" v-permission="'roles_list_del'">删除</el-button>
-                    <el-button type="text" @click="setPermissions(scope.row)" v-permission="'roles_list_setRole'">权限设置</el-button>
-                </template>
-            </el-table-column>
-        </el-table>
-        <el-pagination 
-            class="marginT-20"
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :hide-on-single-page="true"
-            :current-page="page"
-            :page-size="page_size"
-            :page-sizes="[10, 20, 100, 200, 300, 400]"
-            background
-            layout="total, sizes, prev, pager, next, jumper"
-            :total="totalCount" />
-        <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData" @success="init"></detail>
-        <permissions v-if="permissionsDialog.show" v-model="permissionsDialog.show" :exData="permissionsDialog.exData" @success="init"></permissions>
+  <div class="padding-20">
+    <div class="search-box">
+      <el-form ref="form" :inline="true" :model="searchForm" clearable label-width="100px" class="mt-10">
+        <el-form-item label="创建时间:">
+          <el-date-picker
+            :editable="false"
+            v-model="time"
+            @change="timearr => {timearr ? (searchForm.start_time = timearr[0] + ' 00:00:00', searchForm.end_time = timearr[1] + ' 23:59:59') : searchForm.start_time = searchForm.end_time = undefined}"
+            type="daterange"
+            value-format="yyyy-MM-dd"
+            start-placeholder="开始时间"
+            end-placeholder="结束时间"
+          ></el-date-picker>
+        </el-form-item>
+        <el-form-item label="角色名称:">
+          <el-input v-model="searchForm.role_name" placeholder="请输入角色名称" clearable></el-input>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-plus" type="primary" @click="add" v-permission="'roles_list_add'">新增</el-button>
+        </el-form-item>
+      </el-form>
     </div>
+    <el-table :data="tableData" stripe v-loading="tableLoading" fit class="marginT-10 order-table" border
+              :max-height="vheight">
+      <el-table-column label="角色ID" prop="id"></el-table-column>
+      <el-table-column label="创建时间" prop="created_at"></el-table-column>
+      <el-table-column label="角色名称" prop="role_name"></el-table-column>
+      <el-table-column label="角色介绍" prop="role_desc"></el-table-column>
+      <el-table-column label="所属项目" prop="role_project_name"></el-table-column>
+      <el-table-column label="所属部门" prop="role_department_name"></el-table-column>
+      <el-table-column label="操作" width="180">
+        <template slot-scope="scope">
+          <el-button type="text" @click="edit(scope.row)" v-permission="'roles_list_edit'">编辑</el-button>
+          <el-button type="text" @click="del(scope.row)" v-permission="'roles_list_del'">删除</el-button>
+          <el-button type="text" @click="setPermissions(scope.row)" v-permission="'roles_list_setRole'">权限设置</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      class="marginT-20"
+      @size-change="handleSizeChange"
+      @current-change="handleCurrentChange"
+      :hide-on-single-page="true"
+      :current-page="page"
+      :page-size="page_size"
+      :page-sizes="[10, 20, 100, 200, 300, 400]"
+      background
+      layout="total, sizes, prev, pager, next, jumper"
+      :total="totalCount"/>
+    <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData"
+            @success="init"></detail>
+    <permissions v-if="permissionsDialog.show" v-model="permissionsDialog.show" :exData="permissionsDialog.exData"
+                 @success="init"></permissions>
+  </div>
 </template>
 
 <script>
 import page from '@/mixin/page'
 import detail from './details'
 import permissions from './permissions'
+
 export default {
-    mixins: [page],
-    components: {
-        detail,
-        permissions,
+  mixins: [page],
+  components: {
+    detail,
+    permissions,
+  },
+  data () {
+    return {
+      detailsDialog: {
+        show: false,
+        exData: {}
+      },
+      permissionsDialog: {
+        show: false,
+        exData: {}
+      },
+      time: [],
+      searchForm: {},
+      tableData: [],
+      tableUrl: '/role/list'
+    }
+  },
+  methods: {
+    add () {
+      this.detailsDialog.exData = {}
+      this.detailsDialog.show = true
     },
-    data() {
-        return {
-            detailsDialog: {
-                show: false,
-                exData: {}
-            },
-            permissionsDialog: {
-                show: false,
-                exData: {}
-            },
-            time: [],
-            searchForm: {},
-            tableData: [],
-            tableUrl: '/role/list'
-        }
+    edit (row) {
+      this.detailsDialog.exData = row
+      this.detailsDialog.show = true
     },
-    methods: {
-        add() {
-            this.detailsDialog.exData = {}
-            this.detailsDialog.show = true
-        },
-        edit(row) {
-            this.detailsDialog.exData = row
-            this.detailsDialog.show = true
-        },
-        del(row) {
-            this.$confirm('确定要删除吗', '确认', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(async () => {
-                const data = await this.$fetch('/role/del', {id: row.id})
-                if (data.code == 200) {
-                    this.$message.success('删除成功')
-                    this.init()
-                }
-            }).catch(() => {})
-        },
-        setPermissions(row) {
-            this.permissionsDialog.exData = row
-            this.permissionsDialog.show = true
+    del (row) {
+      this.$confirm('确定要删除吗', '确认', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const data = await this.$fetch('/role/del', { id: row.id })
+        if (data.code == 200) {
+          this.$message.success('删除成功')
+          this.init()
         }
+      }).catch(() => {})
     },
-    mounted () {
-        this.init()
-    },
+    setPermissions (row) {
+      this.permissionsDialog.exData = row
+      this.permissionsDialog.show = true
+    }
+  },
+  mounted () {
+    this.init()
+  },
 }
 </script>
 
 <style lang="scss" scoped>
-</style>
+</style>

+ 111 - 112
htmldev/manage/src/views/roles/permissions.vue

@@ -1,145 +1,144 @@
 <template>
-    <div>
-        <el-dialog title="设置角色权限" :visible.sync="dialog" width="950px" :close-on-click-modal="false" top="50px">
-            <el-tree
-                v-loading="loading"
-                :data="treeData"
-                ref="tree"
-                show-checkbox
-                :expand-on-click-node="false"
-                :check-on-click-node="true"
-                :check-strictly="true"
-                node-key="id"
-                :default-expand-all="true"
-                :props="defaultProps">
+  <div>
+    <el-dialog title="设置角色权限" :visible.sync="dialog" width="950px" :close-on-click-modal="false" top="50px">
+      <el-tree
+        v-loading="loading"
+        :data="treeData"
+        ref="tree"
+        show-checkbox
+        :expand-on-click-node="false"
+        :check-on-click-node="true"
+        :check-strictly="true"
+        node-key="id"
+        :default-expand-all="true"
+        :props="defaultProps">
                 <span class="custom-tree-node" slot-scope="{ node, data }">
                     <span>
                         <span class="marginR-10">{{ node.label }}</span>
                         <span v-if="node.level == 1">
                             <el-button
-                                type="text"
-                                size="mini"
-                                @click.stop="() => selectChildren(node, data)">
+                              type="text"
+                              size="mini"
+                              @click.stop="() => selectChildren(node, data)">
                                 全选
                             </el-button>
                             <el-button
-                                type="text"
-                                size="mini"
-                                @click.stop="() => clear(node, data)">
+                              type="text"
+                              size="mini"
+                              @click.stop="() => clear(node, data)">
                                 清空
                             </el-button>
                         </span>
                     </span>
                 </span>
-            </el-tree>
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-    </div>
+      </el-tree>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-import {mapGetters} from 'vuex'
+import { mapGetters } from 'vuex'
+
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exData: {
-            type: Object,
-            default: function (){
-              return {}
-            }
-        }
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    computed: {
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  computed: {},
+  data () {
+    return {
+      loading: true,
+      defaultProps: {
+        children: 'son',
+        label: 'rule_title',
+      },
+      treeData: [],
+      defaultChecked: [],
+      dialog: !!this.value,
 
+    }
+  },
+  methods: {
+    selectChildren (node, data) {
+      let keys = this.getAllkeys(node)
+      // 获取已选的
+      let selectedKeys = this.$refs.tree.getCheckedKeys()
+      // 合并
+      keys = [...selectedKeys, ...keys]
+      // 去重
+      // keys = [...new Set(keys)]
+      console.log({ keys })
+      this.$refs.tree.setCheckedKeys(keys)
     },
-    data() {
-        return {
-            loading: true,
-            defaultProps: {
-                children: 'son',
-                label: 'rule_title',
-            },
-            treeData: [],
-            defaultChecked: [],
-            dialog: !!this.value,
-
-        }
+    clear (node, data) {
+      let keys = this.getAllkeys(node)
+      let selectedKeys = this.$refs.tree.getCheckedKeys()
+      selectedKeys = selectedKeys.filter(item => !keys.includes(item))
+      this.$refs.tree.setCheckedKeys(selectedKeys)
     },
-    methods: {
-        selectChildren(node, data) {
-            let keys = this.getAllkeys(node)
-            // 获取已选的
-            let selectedKeys = this.$refs.tree.getCheckedKeys()
-            // 合并
-            keys = [...selectedKeys, ...keys]
-            // 去重
-            // keys = [...new Set(keys)]
-            console.log({keys});
-            this.$refs.tree.setCheckedKeys(keys)
-        },
-        clear(node, data) {
-            let keys = this.getAllkeys(node)
-            let selectedKeys = this.$refs.tree.getCheckedKeys()
-            selectedKeys = selectedKeys.filter(item => !keys.includes(item))
-            this.$refs.tree.setCheckedKeys(selectedKeys)
-        },
-        // 根据node 获取所有包含子节点ID的数组
-        getAllkeys(node) {
-            let keys = []
-            const getMyKeys = (node) => {
-                keys.push(node.key)
-                if (node.childNodes && node.childNodes.length > 0) {
-                    for (const key in node.childNodes) {
-                        getMyKeys(node.childNodes[key])
-                    }
-                }
-            }
-            getMyKeys(node)
-            return keys
-        },
-        async handleSubmit() {
-            let rule_id = this.$refs.tree.getCheckedKeys()
-            const data = await this.$fetch('/role/set_role_rule', {id: this.exData.id,rule_id})
-            if (data.code == 200) {
-                this.$message.success('修改成功')
-                this.$emit('success')
-                this.dialog = false
-            }
-        },
-        async getPermissionsTree() {
-            const data = await this.$fetch('/role/get_role_rule', {id: this.exData.id}, 'get')
-            if (data.code == 200) {
-                this.treeData = data.data.setting_rule
-                // this.treeData.flatMap( x => [x, ...x.son]).forEach(item => {
-                //     if (item.status) {
-                //         this.defaultChecked.push(item.id)
-                //     }
-                // })
-                this.$refs.tree.setCheckedKeys(data.data.checked)
-                this.loading = false
-            }
+    // 根据node 获取所有包含子节点ID的数组
+    getAllkeys (node) {
+      let keys = []
+      const getMyKeys = (node) => {
+        keys.push(node.key)
+        if (node.childNodes && node.childNodes.length > 0) {
+          for (const key in node.childNodes) {
+            getMyKeys(node.childNodes[key])
+          }
         }
+      }
+      getMyKeys(node)
+      return keys
     },
-    mounted () {
-        this.getPermissionsTree()
+    async handleSubmit () {
+      let rule_id = this.$refs.tree.getCheckedKeys()
+      const data = await this.$fetch('/role/set_role_rule', { id: this.exData.id, rule_id })
+      if (data.code == 200) {
+        this.$message.success('修改成功')
+        this.$emit('success')
+        this.dialog = false
+      }
     },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
-        }
+    async getPermissionsTree () {
+      const data = await this.$fetch('/role/get_role_rule', { id: this.exData.id }, 'get')
+      if (data.code == 200) {
+        this.treeData = data.data.setting_rule
+        // this.treeData.flatMap( x => [x, ...x.son]).forEach(item => {
+        //     if (item.status) {
+        //         this.defaultChecked.push(item.id)
+        //     }
+        // })
+        this.$refs.tree.setCheckedKeys(data.data.checked)
+        this.loading = false
+      }
+    }
+  },
+  mounted () {
+    this.getPermissionsTree()
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
 </style>

+ 139 - 134
htmldev/manage/src/views/user/details.vue

@@ -1,152 +1,157 @@
 <template>
-    <div>
-        <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false" top="50px">
-            <el-form ref="form" :model="form" label-width="100px" class="bind-phone">
-                <el-form-item v-if="!exData.id" label="项目选择:" >
-                    <el-select v-model="form.user_project_id">
-                        <el-option v-for="(item, index) in projectArr" :key="index" :label="item.project_name" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item v-if="form.user_project_id" label="部门选择:" >
-                    <el-select v-model="form.user_department_id">
-                        <el-option v-for="(item, index) in departmentArr" :key="index" :label="item.department_name" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item v-if="form.user_department_id" label="角色选择:" >
-                    <el-select v-model="form.user_role_id">
-                        <el-option v-for="(item, index) in roleArr" :key="index" :label="item.role_name" :value="item.id"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item label="账号:" >
-                    <el-input v-model="form.user_name" placeholder="请输入账号"> </el-input>
-                </el-form-item>
-                <el-form-item label="姓名:" >
-                    <el-input v-model="form.user_full_name" placeholder="请输入姓名"> </el-input>
-                </el-form-item>
-                <el-form-item v-if="!exData.id" label="是否管理员:" >
-                    <el-select v-model="form.is_admin">
-                        <el-option label="是" :value="1"></el-option>
-                        <el-option label="否" :value="0"></el-option>
-                    </el-select>
-                </el-form-item>
-                <el-form-item label="手机号:" >
-                    <el-input v-model="form.user_phone" placeholder="请输入手机号"> </el-input>
-                </el-form-item>
-                <el-form-item label="邮箱:" >
-                    <el-input v-model="form.user_email" placeholder="请输入邮箱"> </el-input>
-                </el-form-item>
-                <el-form-item v-if="!exData.id" label="密码:" >
-                    <el-input v-model="form.user_password" placeholder="请输入密码" type="password"> </el-input>
-                </el-form-item>
-            </el-form>
-            <div slot="footer" class="dialog-footer text-center">
-                <el-button @click="dialog = false">取 消</el-button>
-                <el-button type="danger" @click="handleSubmit">确 定</el-button>
-            </div>
-        </el-dialog>
-    </div>
+  <div>
+    <el-dialog :title="exData.id ? '编辑': '新增'" :visible.sync="dialog" width="450px" :close-on-click-modal="false"
+               top="50px">
+      <el-form ref="form" :model="form" label-width="100px" class="bind-phone">
+        <el-form-item v-if="!exData.id" label="项目选择:">
+          <el-select v-model="form.user_project_id">
+            <el-option v-for="(item, index) in projectArr" :key="index" :label="item.project_name"
+                       :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item v-if="form.user_project_id" label="部门选择:">
+          <el-select v-model="form.user_department_id">
+            <el-option v-for="(item, index) in departmentArr" :key="index" :label="item.department_name"
+                       :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item v-if="form.user_department_id" label="角色选择:">
+          <el-select v-model="form.user_role_id">
+            <el-option v-for="(item, index) in roleArr" :key="index" :label="item.role_name"
+                       :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="账号:">
+          <el-input v-model="form.user_name" placeholder="请输入账号"></el-input>
+        </el-form-item>
+        <el-form-item label="姓名:">
+          <el-input v-model="form.user_full_name" placeholder="请输入姓名"></el-input>
+        </el-form-item>
+        <el-form-item v-if="!exData.id" label="是否管理员:">
+          <el-select v-model="form.is_admin">
+            <el-option label="是" :value="1"></el-option>
+            <el-option label="否" :value="0"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="手机号:">
+          <el-input v-model="form.user_phone" placeholder="请输入手机号"></el-input>
+        </el-form-item>
+        <el-form-item label="邮箱:">
+          <el-input v-model="form.user_email" placeholder="请输入邮箱"></el-input>
+        </el-form-item>
+        <el-form-item v-if="!exData.id" label="密码:">
+          <el-input v-model="form.user_password" placeholder="请输入密码" type="password"></el-input>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer text-center">
+        <el-button @click="dialog = false">取 消</el-button>
+        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+      </div>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
-import {mapGetters} from 'vuex'
+import { mapGetters } from 'vuex'
+
 export default {
-    props: {
-        value: {
-            type: Boolean,
-            default: true
-        },
-        exData: {
-            type: Object,
-            default: function (){
-              return {}
-            }
-        }
+  props: {
+    value: {
+      type: Boolean,
+      default: true
     },
-    computed: {
-        ...mapGetters([
-            'projectArr'
-        ])
+    exData: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  computed: {
+    ...mapGetters([
+      'projectArr'
+    ])
+  },
+  data () {
+    return {
+      dialog: !!this.value,
+      form: {
+        is_admin: 0,
+        user_project_id: undefined,
+        user_department_id: undefined,
+        user_role_id: undefined,
+        user_name: '',
+        user_full_name: '',
+        user_phone: '',
+        user_email: '',
+        user_password: '',
+      },
+      departmentArr: [],
+      roleArr: [],
+    }
+  },
+  methods: {
+    async handleSubmit () {
+      let url = this.exData.id ? '/user/edit' : '/user/add'
+      this.form.user_phone = this.form.user_phone.replace(/ /g, '')
+      const data = await this.$fetch(url, { ...this.form })
+      if (data.code === 200) {
+        this.$message.success('提交成功')
+        this.$emit('success')
+        this.dialog = false
+      }
     },
-    data() {
-        return {
-            dialog: !!this.value,
-            form: {
-                is_admin: 0,
-                user_project_id: undefined,
-                user_department_id: undefined,
-                user_role_id: undefined,
-                user_name: '',
-                user_full_name: '',
-                user_phone: '',
-                user_email: '',
-                user_password: '',
-            },
-            departmentArr: [],
-            roleArr: [],
-        }
+    async getDepartmentArr (project_id) {
+      const data = await this.$fetch('/department/get_department_list', { project_id }, 'get')
+      if (data.code == 200) {
+        this.departmentArr = data.data
+      }
     },
-    methods: {
-        async handleSubmit() {
-            let url = this.exData.id ? '/user/edit' : '/user/add'
-            this.form.user_phone = this.form.user_phone.replace(/ /g, '')
-            const data = await this.$fetch(url, {...this.form})
-            if (data.code === 200) {
-                this.$message.success('提交成功')
-                this.$emit('success')
-                this.dialog = false
-            }
-        },
-        async getDepartmentArr(project_id) {
-            const data = await this.$fetch('/department/get_department_list', {project_id}, 'get')
-            if (data.code == 200) {
-                this.departmentArr = data.data
-            }
-        },
-        async getRoleArr(department_id) {
-            const data = await this.$fetch('/role/get_role_list', {department_id}, 'get')
-            if (data.code == 200) {
-                this.roleArr = data.data
-            }
-        }
+    async getRoleArr (department_id) {
+      const data = await this.$fetch('/role/get_role_list', { department_id }, 'get')
+      if (data.code == 200) {
+        this.roleArr = data.data
+      }
+    }
+  },
+  async mounted () {
+    if (this.exData.id) {
+      // await this.getDepartmentArr()
+      // await this.getRoleArr()
+      // delete this.form.user_project_id
+      // delete this.form.user_department_id
+      // delete this.form.user_role_id
+      this.form.id = this.exData.id
+      for (const key in this.form) {
+        this.form[key] = this.exData[key]
+      }
+      delete this.form.is_admin
+    }
+  },
+  watch: {
+    dialog (val) {
+      if (!val) this.$emit('input', val)
     },
-    async mounted () {
-        if (this.exData.id) {
-            // await this.getDepartmentArr()
-            // await this.getRoleArr()
-            // delete this.form.user_project_id
-            // delete this.form.user_department_id
-            // delete this.form.user_role_id
-            this.form.id = this.exData.id
-            for (const key in this.form) {
-                this.form[key] = this.exData[key]
-            }
-            delete this.form.is_admin
-        }
+    'form.user_project_id' (newValue, oldValue) {
+      this.getDepartmentArr(newValue)
+      if (oldValue != undefined) {
+        this.form.user_department_id = undefined
+        this.form.user_role_id = undefined
+      }
     },
-    watch: {
-        dialog(val) {
-            if (!val) this.$emit('input', val)
-        },
-        'form.user_project_id'(newValue, oldValue) {
-            this.getDepartmentArr(newValue)
-            if (oldValue != undefined) {
-                this.form.user_department_id = undefined
-                this.form.user_role_id = undefined
-            }
-        },
-        'form.user_department_id'(newValue, oldValue) {
-            this.getRoleArr(newValue)
-            if (oldValue != undefined) {
-                this.form.user_role_id = undefined
-            }
-        }
+    'form.user_department_id' (newValue, oldValue) {
+      this.getRoleArr(newValue)
+      if (oldValue != undefined) {
+        this.form.user_role_id = undefined
+      }
     }
+  }
 }
 </script>
 
 <style lang="scss" scoped>
 .top-tip {
-    margin-top: -20px;
-    margin-bottom: 20px;
+  margin-top: -20px;
+  margin-bottom: 20px;
 }
 </style>

+ 116 - 113
htmldev/manage/src/views/user/index.vue

@@ -1,130 +1,133 @@
 <template>
-    <div class="padding-20">
-        <div class="search-box">
-            <el-form ref="form" :inline="true" :model="searchForm" clearable label-width="100px" class="mt-10">
-                <el-form-item label="创建时间:">
-                    <el-date-picker
-                        :editable="false"
-                        v-model="time"
-                        @change="timearr => {timearr ? (searchForm.start_time = timearr[0] + ' 00:00:00', searchForm.end_time = timearr[1] + ' 23:59:59') : searchForm.start_time = searchForm.end_time = undefined}"
-                        type="daterange"
-                        value-format="yyyy-MM-dd"
-                        start-placeholder="开始时间"
-                        end-placeholder="结束时间"
-                    ></el-date-picker>
-                </el-form-item>
-                <el-form-item label="用户姓名:">
-                    <el-input v-model="searchForm.user_full_name" placeholder="请输入用户姓名" clearable></el-input>
-                </el-form-item>
-                <el-form-item class="ml-10">
-                    <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
-                </el-form-item>
-                <el-form-item class="ml-10">
-                    <el-button icon="el-icon-plus" type="primary" @click="add" v-permission="'user_list_add'">新增</el-button>
-                </el-form-item>
-            </el-form>
-        </div>
-        <el-table :data="tableData" stripe v-loading="tableLoading" fit class="marginT-10 order-table" border>
-            <el-table-column label="工号" prop="id" width="60"></el-table-column>
-            <el-table-column label="账号" prop="user_name"></el-table-column>
-            <el-table-column label="姓名" prop="user_full_name"></el-table-column>
-            <el-table-column label="是否管理员" prop="is_admin" :formatter="row => row.is_admin == 1 ? '管理员' : '普通账号'"></el-table-column>
-            <el-table-column label="创建时间" prop="created_at" width="160"></el-table-column>
-            <el-table-column label="所属项目" prop="user_project_name"></el-table-column>
-            <el-table-column label="所属部门" prop="user_department_name"></el-table-column>
-            <el-table-column label="所属角色" prop="user_role_name"></el-table-column>
-            <el-table-column label="手机号" prop="user_phone" width="110"></el-table-column>
-            <el-table-column label="邮箱" prop="user_email"></el-table-column>
-            <el-table-column label="操作" width="160">
-                <template slot-scope="scope">
-                    <el-button type="text" @click="edit(scope.row)" v-permission="'user_list_edit'">编辑</el-button>
-                    <el-button type="text" @click="modPassword(scope.row)" v-permission="'user_list_del'">修改密码</el-button>
-                    <el-button type="text" @click="del(scope.row)" v-permission="'user_list_del'">删除</el-button>
-                </template>
-            </el-table-column>
-        </el-table>
-        <el-pagination 
-            class="marginT-20"
-            @size-change="handleSizeChange"
-            @current-change="handleCurrentChange"
-            :hide-on-single-page="true"
-            :current-page="page"
-            :page-size="page_size"
-            :page-sizes="[10, 20, 100, 200, 300, 400]"
-            background
-            layout="total, sizes, prev, pager, next, jumper"
-            :total="totalCount" />
-        <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData" @success="init"></detail>
+  <div class="padding-20">
+    <div class="search-box">
+      <el-form ref="form" :inline="true" :model="searchForm" clearable label-width="100px" class="mt-10">
+        <el-form-item label="创建时间:">
+          <el-date-picker
+            :editable="false"
+            v-model="time"
+            @change="timearr => {timearr ? (searchForm.start_time = timearr[0] + ' 00:00:00', searchForm.end_time = timearr[1] + ' 23:59:59') : searchForm.start_time = searchForm.end_time = undefined}"
+            type="daterange"
+            value-format="yyyy-MM-dd"
+            start-placeholder="开始时间"
+            end-placeholder="结束时间"
+          ></el-date-picker>
+        </el-form-item>
+        <el-form-item label="用户姓名:">
+          <el-input v-model="searchForm.user_full_name" placeholder="请输入用户姓名" clearable></el-input>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-search" type="primary" @click="searchSubmit">查询</el-button>
+        </el-form-item>
+        <el-form-item class="ml-10">
+          <el-button icon="el-icon-plus" type="primary" @click="add" v-permission="'user_list_add'">新增</el-button>
+        </el-form-item>
+      </el-form>
     </div>
+    <el-table :data="tableData" stripe v-loading="tableLoading" fit class="marginT-10 order-table" border>
+      <el-table-column label="工号" prop="id" width="60"></el-table-column>
+      <el-table-column label="账号" prop="user_name"></el-table-column>
+      <el-table-column label="姓名" prop="user_full_name"></el-table-column>
+      <el-table-column label="是否管理员" prop="is_admin"
+                       :formatter="row => row.is_admin == 1 ? '管理员' : '普通账号'"></el-table-column>
+      <el-table-column label="创建时间" prop="created_at" width="160"></el-table-column>
+      <el-table-column label="所属项目" prop="user_project_name"></el-table-column>
+      <el-table-column label="所属部门" prop="user_department_name"></el-table-column>
+      <el-table-column label="所属角色" prop="user_role_name"></el-table-column>
+      <el-table-column label="手机号" prop="user_phone" width="110"></el-table-column>
+      <el-table-column label="邮箱" prop="user_email"></el-table-column>
+      <el-table-column label="操作" width="160">
+        <template slot-scope="scope">
+          <el-button type="text" @click="edit(scope.row)" v-permission="'user_list_edit'">编辑</el-button>
+          <el-button type="text" @click="modPassword(scope.row)" v-permission="'user_list_del'">修改密码</el-button>
+          <el-button type="text" @click="del(scope.row)" v-permission="'user_list_del'">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      class="marginT-20"
+      @size-change="handleSizeChange"
+      @current-change="handleCurrentChange"
+      :hide-on-single-page="true"
+      :current-page="page"
+      :page-size="page_size"
+      :page-sizes="[10, 20, 100, 200, 300, 400]"
+      background
+      layout="total, sizes, prev, pager, next, jumper"
+      :total="totalCount"/>
+    <detail v-if="detailsDialog.show" v-model="detailsDialog.show" :exData="detailsDialog.exData"
+            @success="init"></detail>
+  </div>
 </template>
 
 <script>
 import page from '@/mixin/page'
 import detail from './details'
+
 export default {
-    mixins: [page],
-    components: {
-        detail,
+  mixins: [page],
+  components: {
+    detail,
+  },
+  data () {
+    return {
+      detailsDialog: {
+        show: false,
+        exData: {}
+      },
+      time: [],
+      searchForm: {},
+      tableData: [],
+      tableUrl: '/user/list'
+    }
+  },
+  methods: {
+    add () {
+      this.detailsDialog.exData = {}
+      this.detailsDialog.show = true
     },
-    data() {
-        return {
-            detailsDialog: {
-                show: false,
-                exData: {}
-            },
-            time: [],
-            searchForm: {},
-            tableData: [],
-            tableUrl: '/user/list'
-        }
+    edit (row) {
+      this.detailsDialog.exData = row
+      this.detailsDialog.show = true
     },
-    methods: {
-        add() {
-            this.detailsDialog.exData = {}
-            this.detailsDialog.show = true
-        },
-        edit(row) {
-            this.detailsDialog.exData = row
-            this.detailsDialog.show = true
+    modPassword (row) {
+      this.$prompt('请输入新密码', '修改密码', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        inputValidator: (value) => {
+          if (value.replace(/ /g, '').length < 6) {
+            return false
+          } else {
+            return true
+          }
         },
-        modPassword(row) {
-            this.$prompt('请输入新密码', '修改密码', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                inputValidator: (value) => {
-                    if (value.replace(/ /g, '').length < 6 ) {
-                        return false
-                    } else {
-                        return true
-                    }
-                },
-                inputErrorMessage: '至少输入6位'
-            }).then(async({ value }) => {
-                const data = await this.$fetch('/user/set_user_password', {user_password: value, id: row.id})
-                if(data.code == 200) {
-                    this.$message.success('修改成功')
-                }
-            }).catch(() => {});
-        },
-        del(row) {
-            this.$confirm('确定要删除吗', '确认', {
-                confirmButtonText: '确定',
-                cancelButtonText: '取消',
-                type: 'warning'
-            }).then(async () => {
-                const data = await this.$fetch('/user/del', {id: row.id})
-                if (data.code == 200) {
-                    this.$message.success('删除成功')
-                    this.init()
-                }
-            }).catch(() => {})
+        inputErrorMessage: '至少输入6位'
+      }).then(async ({ value }) => {
+        const data = await this.$fetch('/user/set_user_password', { user_password: value, id: row.id })
+        if (data.code == 200) {
+          this.$message.success('修改成功')
         }
+      }).catch(() => {})
     },
-    mounted () {
-        this.init()
-    },
+    del (row) {
+      this.$confirm('确定要删除吗', '确认', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async () => {
+        const data = await this.$fetch('/user/del', { id: row.id })
+        if (data.code == 200) {
+          this.$message.success('删除成功')
+          this.init()
+        }
+      }).catch(() => {})
+    }
+  },
+  mounted () {
+    this.init()
+  },
 }
 </script>
 
 <style lang="scss" scoped>
-</style>
+</style>