浏览代码

接口联调

zhangfu 3 年之前
父节点
当前提交
1a1e0745fd

+ 2 - 2
public/js/config.js

@@ -7,12 +7,12 @@ window.global_config = {
   // BASE_URL: 'http://172.16.0.22:10143'
   // BASE_URL: 'http://221.224.53.27:10144',
   //  BASE_URL:'http://172.16.0.14:10143',
-  // BASE_URL: 'http://172.16.0.36:10143' //吴国建
+  BASE_URL: 'http://172.16.0.135:10180' //沪上阿姨
   //  BASE_URL:'http://172.16.0.107:10143',
   // BASE_URL: 'http://172.16.0.36:10143' //吴国建
   // BASE_URL:'http://172.16.0.114:10143' //胡志豪
   // BASE_URL: 'http://172.16.100.40:10143'
-  BASE_URL:'http://221.224.53.27:20008'
+  // BASE_URL:'http://221.224.53.27:20008'
   // BASE_URL: 'http://172.16.0.245:10143'
   // BASE_URL: 'http://101.200.220.128:8081'
 }

+ 0 - 10
src/App.vue

@@ -17,16 +17,6 @@ export default {
       include: []
     }
   },
-  computed: {
-    // 是否显示顶部栏、菜单栏
-    showComponents() {
-      if (this.$route.path != '/' && this.$route.name != 'full-link') {
-        return true
-      } else {
-        return false
-      }
-    }
-  },
   watch: {
     $route(to, from) {
       if (to.meta.keepAlive) {

+ 58 - 0
src/api/api/index.js

@@ -0,0 +1,58 @@
+import request from '@/utils/request'
+
+export function REQUEST(url, method, data, headers) {
+    return request({
+        url: url,
+        method: method,
+        data: data || {},
+        headers: headers || {}
+    })
+}
+
+
+
+/*
+推荐用法:cw.GET("company-service/company/list").then()
+*/
+export function GET(url, data, headers) {
+    return request.get(url, {
+        params: data,
+        headers: headers || {}
+    })
+}
+
+// 同上
+export function POST(url, data, headers) {
+    return REQUEST(url, 'POST', data, headers)
+}
+
+// 同上
+export function PUT(url, data, headers) {
+    return REQUEST(url, 'PUT', data, headers)
+}
+
+// 同上
+export function DELETE(url, data, headers) {
+    return REQUEST(url, 'DELETE', data, headers)
+}
+
+// 同上
+export function PATCH(url, data, headers) {
+    return REQUEST(url, 'PATCH', data, headers)
+}
+/*
+文件导入接口 cw.IMPORT(url, file)
+*/
+export function IMPORT(url, files) {
+    const formData = new FormData()
+    formData.append('file', files.file)
+  
+    return request({
+      url: url,
+      method: 'POST',
+      data: formData,
+      headers: {
+        'Content-Type': 'multipart/form-data'
+      }
+    })
+  }

+ 2 - 4
src/layout/components/AppMain.vue

@@ -1,11 +1,9 @@
 <template>
-  <section class="app-main" :id="isApp_main ? 'app-main-id' : ''">
-    <transition name="fade-transform" mode="out-in">
+  <div class="app-main" :id="isApp_main ? 'app-main-id' : ''">
       <keep-alive :include="include">
         <router-view :id="isApp_main ? 'appMain-box' : ''" />
       </keep-alive>
-    </transition>
-  </section>
+  </div>
 </template>
 
 <script>

+ 1 - 1
src/layout/components/Navbar.vue

@@ -7,7 +7,7 @@
       </el-breadcrumb>
       <el-dropdown>
         <span class="el-dropdown-link">
-          <img class="userImg" src="../../../static/images/default.png" alt />
+          <img class="userImg" src="@/assets/image/lolo2.png" alt />
           <span>{{ name }}</span>
           <i class="el-icon-arrow-down el-icon--right"></i>
         </span>

+ 1 - 0
src/layout/components/Sidebar/menu.vue

@@ -29,6 +29,7 @@ export default {
     }
   },
   mounted () {
+    console.log(this.$router)
     this.setActiveMenu(this.routesData)
   },
   methods: {

+ 31 - 2
src/layout/index.vue

@@ -4,9 +4,9 @@
       <el-aside v-if="showComponents" width="200px">
         <Sidebar />
       </el-aside>
-      <el-container style="display:block">
+      <el-container style="display: block">
         <Navbar v-if="showComponents" />
-          <app-main />
+        <app-main />
       </el-container>
     </el-container>
   </div>
@@ -21,6 +21,11 @@ export default {
     AppMain,
     Sidebar
   },
+  data() {
+    return {
+      include: []
+    }
+  },
   computed: {
     // 是否显示顶部栏、菜单栏
     showComponents() {
@@ -30,6 +35,30 @@ export default {
         return false
       }
     }
+  },
+  watch: {
+    $route(to, from) {
+      if (to.meta.keepAlive) {
+        !this.include.includes(to.name) && this.include.push(to.name)
+      }
+      if (to.meta.parentNode && to.meta.parentNode.indexOf(from.name) > -1) {
+        !this.include.includes(from.name) && this.include.push(from.name)
+      } else if (
+        from.meta.parentNode &&
+        from.meta.parentNode.indexOf(to.name) > -1
+      ) {
+        console.log()
+      } else {
+        if (from.meta.parentNode) {
+          let index = this.include.indexOf(from.meta.parentNode)
+          index !== -1 && this.include.splice(index, 1)
+        }
+        if (!from.meta.parentNode) {
+          let index = this.include.indexOf(from.name)
+          index !== -1 && this.include.splice(index, 1)
+        }
+      }
+    }
   }
 }
 </script>

+ 79 - 13
src/pages/classification/edit.vue

@@ -1,23 +1,34 @@
 <template>
   <el-dialog
-    title="提示"
+    :title="classString.title"
     :visible.sync="dialogVisible"
     width="33%"
     :before-close="handleClose"
+    append-to-body
   >
-    <el-form>
+    <el-form label-width="100px" :model="form">
       <el-form-item label="分类名称:" required>
-        <el-input placeholder="请输入"></el-input>
+        <el-input placeholder="请输入" v-model="form.name"></el-input>
       </el-form-item>
-      <el-form-item  required>
-        <label solt="label" class="status"><span style="letter-spacing: 14px;">状态</span>:</label>
-        <el-radio-group v-model="radio">
-          <el-radio :label="3">启用</el-radio>
-          <el-radio :label="6">禁用</el-radio>
+      <el-form-item label required>
+        <template slot="label" class="status">
+          <span>状&#8195;&emsp;态</span>:
+        </template>
+        <el-radio-group v-model="form.status">
+          <el-radio :label="1">启用</el-radio>
+          <el-radio :label="0">禁用</el-radio>
         </el-radio-group>
       </el-form-item>
       <el-form-item label="访问权限:" required>
-        <el-input placeholder="请输入"></el-input>
+        <div
+          class="form_item_content"
+          v-for="(item, index) in openList"
+          :key="index"
+        >
+          <el-input placeholder="请输入" v-onlyInt v-model="item.value"></el-input>
+          <i class="el-icon-plus" @click="addjurisdiction"></i>
+          <i class="el-icon-minus" v-if="openList.length!=1" @click="deletjurisdiction(index)"></i>
+        </div>
       </el-form-item>
     </el-form>
     <span slot="footer" class="dialog-footer">
@@ -33,30 +44,85 @@
   </el-dialog>
 </template>
 <script>
+import * as api from '@/api/api'
 export default {
   data() {
     return {
       dialogVisible: false,
-      radio:''
+      classString: {},
+      openList: [{ value: '' }],
+      form:{
+        name:'',
+        status:''
+      }
     }
   },
   methods: {
     handleClose() {
       this.dialogVisible = false
     },
-    openClose() {
+    openClose(val) {
+      if (val) {
+        this.classString = val
+        if (!val.show) {
+          this.detailList()
+        }
+      }
+      this.title = val.title
       this.dialogVisible = true
+    },
+    /**
+     * @method 分类管理详情
+     * **/
+    detailList() {
+      let code = {
+        typeId: this.classString.typeId
+      }
+      api.POST('/doc/type/detail', code).then(data => {
+        if (data.code == 0) {
+          this.form = data.data
+        }
+      })
+    },
+    /**
+     * @method 增加访问权限
+     * **/
+    addjurisdiction() {
+      this.openList.push({ value: '' })
+    },
+    /**
+     * @method 删除访问权限
+     * **/
+    deletjurisdiction(val) {
+      this.openList.splice(val, 1)
     }
   }
 }
 </script>
 <style lang="less" scoped>
-.status{
-    padding: 0 12px 0 0;
+.status {
+  padding: 0 12px 0 0;
 }
 .status::before {
   content: '*';
   color: #f56c6c;
   margin-right: 4px;
 }
+.form_item_content {
+  display: flex;
+  align-items: center;
+  margin-bottom: 10px;
+}
+.el-icon-plus,
+.el-icon-minus {
+  border: 1px solid #f23f3a;
+  color: #f23f3a;
+  font-size: 30px;
+  margin-left: 10px;
+  border-radius: 4px;
+  cursor: pointer;
+}
+.el-icon-minus {
+  margin-right: 16px;
+}
 </style>

+ 118 - 157
src/pages/classification/index.vue

@@ -1,9 +1,22 @@
 <template>
-  <div class="classification_list">
+  <div
+    class="classification_list"
+    v-loading.fullscreen.lock="fullscreenLoading"
+  >
     <div class="classification_list_headerSelect">
-      <el-form slot="form" style="display: inline" :model="form" inline :addList="true">
+      <el-form
+        slot="form"
+        style="display: inline"
+        :model="form"
+        inline
+        :addList="true"
+      >
         <el-form-item class="header_top_form" label="分类名称:">
-          <el-input v-model.trim="form.name" size="small" placeholder="请输入"></el-input>
+          <el-input
+            v-model.trim="form.name"
+            size="small"
+            placeholder="请输入"
+          ></el-input>
         </el-form-item>
         <el-form-item class="header_top_form" label="状态:">
           <el-select v-model="form.status" size="small" placeholder="请选择">
@@ -17,12 +30,19 @@
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button size="small" style="width: 88px" type="primary"
+          <el-button
+            size="small"
+            style="width: 88px"
+            type="primary"
+            @click="search"
             >查询</el-button
           >
         </el-form-item>
       </el-form>
-      <el-button size="small" style="width: 104px; margin-right: 23px"
+      <el-button
+        size="small"
+        style="width: 104px; margin-right: 23px"
+        @click="addList"
         >新增</el-button
       >
     </div>
@@ -49,6 +69,7 @@
                 v-model="scope.row[scope.column.property]"
                 active-color="#17A8FF"
                 inactive-color="#AFAFAF"
+                @change="switchChange($event, scope.row)"
               >
               </el-switch>
             </div>
@@ -71,10 +92,10 @@
       @current-change="handleCurrentChange"
       :current-page="form.pageNum"
       :page-sizes="[100, 200, 300, 400]"
-      :page-size="10"
+      :page-size="form.pageSize"
       background
       layout="total,prev, pager, next,jumper"
-      :total="100"
+      :total="form.total"
     >
     </el-pagination>
     <edit-dialog ref="editDialogRefs" />
@@ -82,6 +103,7 @@
 </template>
 <script>
 import editDialog from './edit'
+import * as api from '@/api/api'
 export default {
   name: 'classification',
   components: {
@@ -89,12 +111,17 @@ export default {
   },
   data() {
     return {
-      form:{
-        name:'',
-        status:''
+      fullscreenLoading: false,
+      form: {
+        name: '',
+        status: '',
+        pageNum: 1,
+        pageSize: 10,
+        start: '',
+        total: 0
       },
       tableData: [],
-      options:[],
+      options: [],
       listData: [
         {
           name: '分类名称',
@@ -105,7 +132,7 @@ export default {
         },
         {
           name: '链接地址',
-          value: 'string',
+          value: 'linkUrl',
           width: '',
           minWidth: '',
           align: 'center'
@@ -119,169 +146,103 @@ export default {
         },
         {
           name: '创建人',
-          value: 'userName',
+          value: 'createUserName',
           width: '',
           minWidth: '',
           align: 'center'
         },
         {
           name: '创建时间',
-          value: 'userTime',
+          value: 'createTime',
           width: '',
           minWidth: '',
           align: 'center'
         }
-      ],
-      form: {
-        pageNum: 4
-      }
+      ]
     }
   },
   mounted() {
-    this.$nextTick(() => {
-      this.tableData = [
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        },
-        {
-          name: '1',
-          string: '1',
-          status: true,
-          userName: 'ss',
-          userTime: '2021'
-        }
-      ]
-    })
+    this.tableDataList()
   },
   methods: {
+    /**
+     * @method 搜索
+     * **/
+    search() {
+      this.form.pageNum = 1
+      this.tableDataList()
+    },
+    /**
+     * @method 列表数据
+     * **/
+    tableDataList() {
+      this.fullscreenLoading = true
+      let code = {
+        name: this.form.name,
+        page: this.form.pageNum,
+        pageSize: this.form.pageSize,
+        start: this.form.start,
+        status: this.form.status
+      }
+      api
+        .POST('/doc/type/list', code)
+        .then(res => {
+          if (res.code == 0) {
+            this.tableData = res.data.list
+            this.tableData.forEach(item => {
+              item.status == 1 ? (item.status = true) : (item.status = false)
+            })
+            this.form.pageNum = res.data.pageNum
+            this.form.pageSize = res.data.pageSize
+            this.form.total = res.data.total
+            this.fullscreenLoading = false
+          }
+        })
+        .catch(() => {
+          this.fullscreenLoading = false
+        })
+    },
     handleSizeChange() {},
     handleCurrentChange() {},
     // 编辑
-    edit() {
-      this.$refs.editDialogRefs.openClose()
+    edit(val) {
+      let code = {
+        title: '分类编辑',
+        show: false,
+        typeId: val.typeId
+      }
+      this.$refs.editDialogRefs.openClose(code)
+    },
+    /**
+     * @method 新增
+     * **/
+    addList() {
+      let code = {
+        title: '分类新增',
+        show: true
+      }
+      this.$refs.editDialogRefs.openClose(code)
+    },
+    /**
+     * @method 切换状态
+     * **/
+    switchChange(val, item) {
+      val ? (val = 1) : (val = 0)
+      let code = {
+        id: item.typeId,
+        status: val
+      }
+      api
+        .PUT('/doc/type/updateSwitch', code)
+        .then(data => {
+          if (data.code == 0) {
+            this.search()
+            this.$message.success(data.data)
+          }
+        })
+        .catch(() => {
+          this.search()
+        })
     }
   }
 }

+ 60 - 13
src/pages/fileManagement/detail.vue

@@ -12,13 +12,41 @@
         stripe
         :header-cell-style="{ background: '#F7F7F7' }"
       >
-        <el-table-column prop="date" label="文件名称" width="180">
+        <el-table-column
+          prop="name"
+          align="center"
+          show-overflow-tooltip
+          label="文件名称"
+          width="180"
+        >
         </el-table-column>
-        <el-table-column prop="name" label="链接地址" width="180">
+        <el-table-column
+          prop="name"
+          align="center"
+          show-overflow-tooltip
+          label="链接地址"
+          width="180"
+        >
+        </el-table-column>
+        <el-table-column
+          prop="createUser"
+          align="center"
+          show-overflow-tooltip
+          label="创建人"
+        >
+        </el-table-column>
+        <el-table-column
+          prop="createTime"
+          align="center"
+          show-overflow-tooltip
+          label="创建时间"
+        >
+        </el-table-column>
+        <el-table-column label="操作" align="center">
+          <template slot-scope="scope">
+            <el-button type="text" @click="download(scope.row)">下载</el-button>
+          </template>
         </el-table-column>
-        <el-table-column prop="address" label="创建人"> </el-table-column>
-        <el-table-column prop="address" label="创建时间"> </el-table-column>
-        <el-table-column prop="address" label="操作"> </el-table-column>
       </el-table>
     </template>
     <span slot="footer" class="dialog-footer">
@@ -27,25 +55,44 @@
   </el-dialog>
 </template>
 <script>
+import * as api from '@/api/api'
 export default {
   data() {
-    const item = {
-      date: '2016-05-02',
-      name: '王小虎',
-      address: '上海市普陀区金沙江路 1518 弄'
-    }
     return {
       dialogVisible: false,
-      tableData: Array(20).fill(item)
+      tableData: []
     }
   },
   methods: {
     handleClose() {
       this.dialogVisible = false
     },
-    openClose() {
+    openClose(val) {
       this.dialogVisible = true
-    }
+      this.listDataInit(val)
+    },
+    /**
+     * @method 历史版本信息
+     * **/
+    listDataInit(val) {
+      let code = {
+        id: val.id
+      }
+      api.GET('/doc/getDocHistoryList', code).then(data => {
+        if (data.code == 0) {
+          this.tableData = data.data
+        }
+      })
+    },
+    /**
+     * @method 下载
+     * **/
+    // download(val) {
+    //   let url = `/api/file/exportExcel/{type}`
+    //   let params = this.form
+    //   let fileName = '产品信息库'
+    //   this.$pubFun.exportOperation(url, params, 'get', fileName)
+    // }
   }
 }
 </script>

+ 79 - 40
src/pages/fileManagement/edit.vue

@@ -1,44 +1,44 @@
 <template>
   <el-dialog
-    title="提示"
+    :title="refList.title"
     :visible.sync="dialogVisible"
     width="33%"
     :before-close="handleClose"
   >
-    <el-form>
-      <el-form-item label="分类名称:" required="">
-        <el-input></el-input>
+    <el-form :model="form" label-width="100px">
+      <el-form-item label="分类名称:" required>
+        <el-input placeholder="请输入" v-model.trim="form.name"></el-input>
       </el-form-item>
-      <el-form-item label="文件名称:" required="">
-        <el-input></el-input>
+      <el-form-item label="文件名称:" required>
+        <el-input placeholder="请输入"></el-input>
       </el-form-item>
-      <el-form-item label="上传文件:" required="">
-        <div style="padding-left:94px">
+      <el-form-item label="上传文件:" required>
+        <div>
           <el-upload
-          class="upload-demo"
-          action="https://jsonplaceholder.typicode.com/posts/"
-          :on-preview="handlePreview"
-          :on-remove="handleRemove"
-          :before-remove="beforeRemove"
-          multiple
-          :limit="3"
-          :on-exceed="handleExceed"
-          :file-list="fileList"
-        >
-          <el-button size="small" type="primary">点击上传</el-button>
-          <div slot="tip" class="el-upload__tip">
-            仅支持pdf文件
-          </div>
-        </el-upload>
+            class="upload-demo"
+            action
+            :http-request="api_import"
+            :on-preview="handlePreview"
+            :on-remove="handleRemove"
+            :before-remove="beforeRemove"
+            multiple
+            :limit="3"
+            :on-exceed="handleExceed"
+            :file-list="fileList"
+            :before-upload="beforeAvatarUpload"
+          >
+            <el-button size="small" type="primary">点击上传</el-button>
+            <div slot="tip" class="el-upload__tip">仅支持pdf文件</div>
+          </el-upload>
         </div>
       </el-form-item>
       <el-form-item required>
-        <label solt="label" class="status"
-          ><span style="letter-spacing: 14px">状态</span>:</label
+        <template slot="label" class="status"
+          ><span>状&#8195;&emsp;态</span>:</template
         >
-        <el-radio-group v-model="radio">
-          <el-radio :label="3">启用</el-radio>
-          <el-radio :label="6">禁用</el-radio>
+        <el-radio-group v-model="form.status">
+          <el-radio :label="1">启用</el-radio>
+          <el-radio :label="0">禁用</el-radio>
         </el-radio-group>
       </el-form-item>
     </el-form>
@@ -48,37 +48,76 @@
         size="small"
         style="margin-left: 60px"
         type="primary"
-        @click="dialogVisible = false"
+        @click="addList"
         >确 定</el-button
       >
     </span>
   </el-dialog>
 </template>
 <script>
+import * as api from '@/api/api'
 export default {
   data() {
     return {
       dialogVisible: false,
-      radio:''
+      form: {
+        docUrl: '',
+        id: '',
+        linkUrl: '',
+        name: '',
+        status: '',
+        typeId: ''
+      },
+      refList: {},
+      fileList:[]
     }
   },
   methods: {
     handleClose() {
       this.dialogVisible = false
     },
-    openClose() {
+    openClose(val) {
+      if (val) {
+        this.refList = val
+      }
       this.dialogVisible = true
-    }
+    },
+    /**
+     * @method 上传
+     * **/ 
+    api_import(file){
+       const files = {
+        file: file.file
+      }
+      api.IMPORT('/api/file/local/upload',files).then(data=>{
+        console.log(data)
+      })
+    },
+    /**
+     * @method 
+     * **/ 
+    handleExceed(){},
+    handlePreview(){},
+    handleRemove(){},
+    beforeRemove(){},
+    /**
+     * @method 上传限制
+     * **/ 
+     beforeAvatarUpload(file) {
+        const ispaf = file.type === 'application/pdf';
+
+        if (!ispaf) {
+          this.$message.error('上传文件只能是 PDF 格式!');
+        }
+        return ispaf
+      },
+    /**
+     * @method 提交确定
+     * **/ 
+    addList(){}
   }
 }
 </script>
 <style lang="less" scoped>
-.status {
-  padding: 0 12px 0 0;
-}
-.status::before {
-  content: '*';
-  color: #f56c6c;
-  margin-right: 4px;
-}
+
 </style>

+ 118 - 38
src/pages/fileManagement/index.vue

@@ -1,12 +1,29 @@
 <template>
-  <div class="fileManagement_List">
+  <div
+    class="fileManagement_List"
+    v-loading.fullscreen.lock="fullscreenLoading"
+  >
     <div class="fileManagement_List_headerSelect">
-      <el-form slot="form" style="display: inline" :model="form" inline :addList="true">
+      <el-form
+        slot="form"
+        style="display: inline"
+        :model="form"
+        inline
+        :addList="true"
+      >
         <el-form-item class="header_top_form" label="分类名称:">
-          <el-input v-model.trim="form.name" placeholder="请输入" size="small"></el-input>
+          <el-input
+            v-model.trim="form.name"
+            placeholder="请输入"
+            size="small"
+          ></el-input>
         </el-form-item>
         <el-form-item class="header_top_form" label="文件名称:">
-          <el-input v-model.trim="form.fileName" placeholder="请输入" size="small"></el-input>
+          <el-input
+            v-model.trim="form.fileName"
+            placeholder="请输入"
+            size="small"
+          ></el-input>
         </el-form-item>
         <el-form-item class="header_top_form" label="状态:">
           <el-select v-model="form.status" size="small" placeholder="请选择">
@@ -20,12 +37,19 @@
           </el-select>
         </el-form-item>
         <el-form-item>
-          <el-button size="small" type="primary" style="width: 88px"
+          <el-button
+            size="small"
+            type="primary"
+            style="width: 88px"
+            @click="search"
             >查询</el-button
           >
         </el-form-item>
       </el-form>
-      <el-button size="small" style="width: 104px; margin-right: 23px"
+      <el-button
+        size="small"
+        style="width: 104px; margin-right: 23px"
+        @click="addList"
         >新增</el-button
       >
     </div>
@@ -52,6 +76,7 @@
                 v-model="scope.row.status"
                 active-color="#17A8FF"
                 inactive-color="#AFAFAF"
+                @change="statusChange($event, scope.row)"
               >
               </el-switch>
             </div>
@@ -78,10 +103,10 @@
       @current-change="handleCurrentChange"
       :current-page="form.pageNum"
       :page-sizes="[100, 200, 300, 400]"
-      :page-size="10"
+      :page-size="form.pageSize"
       background
       layout="total,prev, pager, next,jumper"
-      :total="100"
+      :total="form.total"
     >
     </el-pagination>
     <editDialog ref="editDialogRefs" />
@@ -91,6 +116,7 @@
 <script>
 import editDialog from './edit'
 import detailDialog from './detail'
+import * as api from '@/api/api'
 export default {
   name: 'fileManagement',
   components: {
@@ -99,8 +125,9 @@ export default {
   },
   data() {
     return {
+      fullscreenLoading: false,
       tableData: [],
-      options:[],
+      options: [],
       listData: [
         {
           name: '分类名称',
@@ -111,7 +138,7 @@ export default {
         },
         {
           name: '文件名称',
-          value: 'flieName',
+          value: 'typeName',
           width: '',
           minWidth: '',
           align: 'center'
@@ -132,59 +159,112 @@ export default {
         },
         {
           name: '创建人',
-          value: 'userName',
+          value: 'createUser',
           width: '',
           minWidth: '',
           align: 'center'
         },
         {
           name: '创建时间',
-          value: 'userTime',
+          value: 'createTime',
           width: '',
           minWidth: '',
           align: 'center'
         }
       ],
       form: {
-        pageNum: 4,
-        name:'',
-        fileName:'',
-        status:''
+        pageNum: 1,
+        pageSize: 10,
+        total: 0,
+        name: '',
+        start: '',
+        status: '',
+        typeId: ''
       }
     }
   },
   mounted() {
-    this.$nextTick(() => {
-      this.tableData = [
-        {
-          name: '1',
-          flieName: '2',
-          file: '3',
-          status: true,
-          userName: '4',
-          userTime: '5'
-        },
-        {
-          name: '1',
-          flieName: '2',
-          file: '3',
-          status: false,
-          userName: '4',
-          userTime: '5'
-        }
-      ]
-    })
+    this.listDataInit()
   },
   methods: {
+    /**
+     * @method 搜索
+     * **/
+    search() {
+      this.form.pageNum = 1
+      this.listDataInit()
+    },
+    /**
+     * @method 列表数据
+     * **/
+    listDataInit() {
+      this.fullscreenLoading = true
+      let code = {
+        name: this.form.name,
+        page: this.form.pageNum,
+        pageSize: this.form.pageSize,
+        start: this.form.start,
+        status: this.form.status,
+        typeId: this.form.typeId
+      }
+      api
+        .POST('/doc/getDocList', code)
+        .then(res => {
+          if (res.code == 0) {
+            this.tableData = res.data.list
+            this.tableData.forEach(item => {
+              item.status == 1 ? (item.status = true) : (item.status = false)
+            })
+            this.form.pageNum = res.data.currPage
+            this.form.pageSize = res.data.pageSize
+            this.form.total = res.data.totalCount
+            this.fullscreenLoading = false
+          }
+        })
+        .catch(() => {
+          this.fullscreenLoading = false
+        })
+    },
     handleSizeChange() {},
     handleCurrentChange() {},
+    /**
+     * @method 新增
+     * **/
+    addList() {
+      let code = {
+        title: '文件新增',
+        show: true
+      }
+      this.$refs.editDialogRefs.openClose(code)
+    },
     // 编辑
     edit() {
       this.$refs.editDialogRefs.openClose()
     },
     // 历史版本
-    history() {
-      this.$refs.detailDialogRefs.openClose()
+    history(val) {
+      const code = {
+        id: val.id
+      }
+      this.$refs.detailDialogRefs.openClose(code)
+    },
+    /**
+     * @method 状态修改
+     * **/
+    statusChange(val, item) {
+      val ? (val = 1) : (val = 0)
+      let code = {
+        id: item.id,
+        status: val
+      }
+      api.PUT('/doc/updateSwitch', code).then(data => {
+        if (data.code == 0) {
+          this.search()
+          this.$message.success(data.message)
+        }
+      }).catch(()=>{
+        this.search()
+      })
     }
   }
 }

+ 5 - 6
src/pages/login/index.vue

@@ -65,10 +65,8 @@ export default {
       },
       loginRules: {
         // account: [{ required: true, trigger: 'blur', validator: validateUser }],
-        password: [
-          { required: true, trigger: 'blur', validator: validatePass }
-        ],
-      },
+        password: [{ required: true, trigger: 'blur', validator: validatePass }]
+      }
     }
   },
   mounted() {
@@ -79,16 +77,17 @@ export default {
       clearRouter: 'permission/ClEAR_LIST'
     }),
     loginFun() {
+      // ? this.$md5(this.form.password) : ''
       let params = {
         account: this.form.account,
-        password: this.form.password ? this.$md5(this.form.password) : ''
+        password: this.form.password
       }
       login(params).then(res => {
         localStorage.setItem('Token', res.data.token)
         localStorage.setItem('userInfo', JSON.stringify(res.data))
         this.$store.commit('getLoginReturnInformation', res.data)
-        this.$router.push('/index')
         sessionStorage.setItem('currentPage', '/index')
+        this.$router.push('/index')
       })
     }
   }

+ 57 - 17
src/pages/userManagement/detail.vue

@@ -5,12 +5,15 @@
     width="33%"
     :before-close="handleClose"
   >
-    <el-form>
-      <el-form-item >
-        <label solt="label" class="status"
-          ><span>密   码</span>:</label
-        >
-        <el-input placeholder="请输入"></el-input>
+    <el-form :model="number" ref="number" :rules="rules" label-width="100px">
+      <el-form-item label prop="password">
+        <template slot="label" class="status"><span>密&#8195;&emsp;码</span>:</template>
+        <el-input
+          placeholder="请输入"
+          v-model.trim="number.password"
+          minlength="6"
+          maxlength="18"
+        ></el-input>
       </el-form-item>
     </el-form>
     <span slot="footer" class="dialog-footer">
@@ -19,36 +22,73 @@
         size="small"
         style="margin-left: 60px"
         type="primary"
-        @click="dialogVisible = false"
+        @click="submit('number')"
         >确 定</el-button
       >
     </span>
   </el-dialog>
 </template>
 <script>
+import * as api from '@/api/api'
 export default {
   data() {
+    const validatePass = (rule, value, callback) => {
+      if (value.length < 6 || value.length > 18) {
+        callback(new Error('密码不能小于6位,大于18位'))
+      } else {
+        callback()
+      }
+    }
     return {
-      dialogVisible: false
+      dialogVisible: false,
+      number: {
+        password: ''
+      },
+      id: '',
+      rules: {
+        password: [{ required: true, trigger: 'blur', validator: validatePass }]
+      }
     }
   },
   methods: {
     handleClose() {
+      this.number.password = ''
       this.dialogVisible = false
+      this.$parent.search()
     },
-    openClose() {
+    openClose(val) {
       this.dialogVisible = true
+      this.id = val.id
+    },
+    /**
+     * @method 确定提交
+     * **/
+    submit(formName) {
+      this.$refs[formName].validate(valid => {
+        if (valid) {
+          let code = {
+            id: this.id,
+            password: this.number.password
+          }
+          api.PUT('/user/resetPassword', code).then(res => {
+            if (res.code == 0) {
+              this.handleClose()
+              this.$message.success(res.data)
+            }
+          })
+        }
+      })
     }
   }
 }
 </script>
 <style lang="less" scoped>
-.status {
-  padding: 0 12px 0 0;
-}
-.status::before {
-  content: '*';
-  color: #f56c6c;
-  margin-right: 4px;
-}
+// .status {
+//   padding: 0 12px 0 0;
+// }
+// .status::before {
+//   content: '*';
+//   color: #f56c6c;
+//   margin-right: 4px;
+// }
 </style>

+ 117 - 22
src/pages/userManagement/edit.vue

@@ -1,62 +1,157 @@
 <template>
   <el-dialog
-    title="提示"
+    :title="title"
     :visible.sync="dialogVisible"
     width="33%"
     :before-close="handleClose"
   >
-    <el-form>
-      <el-form-item >
-        <label solt="label" class="status"
-          ><span >账   号</span>:</label
+    <el-form ref="form" :model="form" label-width="100px" :rules="rules">
+      <el-form-item prop="account">
+        <template slot="label" class="status"
+          ><span>账&#8195;&emsp;号</span>:</template
         >
-        <el-input></el-input>
+        <el-input placeholder="请输入" v-model.trim="form.account"></el-input>
       </el-form-item>
-      <el-form-item >
-        <label solt="label" class="status"
-          ><span >姓   名</span>:</label
+      <el-form-item prop="name">
+        <template slot="label" class="status"
+          ><span>姓&#8195;&emsp;名</span>:</template
         >
-        <el-input></el-input>
+        <el-input placeholder="请输入" v-model.trim="form.name"></el-input>
       </el-form-item>
-      <el-form-item >
-        <label solt="label" class="status"
-          ><span>密   码</span>:</label
+      <el-form-item prop="password">
+        <template slot="label" class="status"
+          ><span>密&#8195;&emsp;码</span>:</template
         >
-        <el-input></el-input>
+        <el-input placeholder="请输入" v-model.trim="form.password"></el-input>
       </el-form-item>
-      <el-form-item label="状   态:">
-        <el-radio-group v-model="radio">
-          <el-radio :label="3">启用</el-radio>
-          <el-radio :label="6">禁用</el-radio>
+      <el-form-item label>
+        <template slot="label" class="status"
+          ><span>状&#8195;&emsp;态</span>:</template
+        >
+        <el-radio-group v-model="form.status">
+          <el-radio :label="1">启用</el-radio>
+          <el-radio :label="0">禁用</el-radio>
         </el-radio-group>
       </el-form-item>
     </el-form>
     <span slot="footer" class="dialog-footer">
-      <el-button size="small" @click="dialogVisible = false">取 消</el-button>
+      <el-button size="small" @click="handleClose">取 消</el-button>
       <el-button
         size="small"
         style="margin-left: 60px"
         type="primary"
-        @click="dialogVisible = false"
+        @click="addList('form')"
         >确 定</el-button
       >
     </span>
   </el-dialog>
 </template>
 <script>
+import * as api from '@/api/api'
 export default {
   data() {
+    const validatePass = (rule, value, callback) => {
+      if (value.length < 6 || value.length > 18) {
+        callback(new Error('密码不能小于6位,大于18位'))
+      } else {
+        callback()
+      }
+    }
     return {
       dialogVisible: false,
-      radio:''
+      radio: '',
+      title: '',
+      form: {
+        account: '',
+        name: '',
+        password: '',
+        status: 0,
+        userId: ''
+      },
+      userString: {},
+      rules: {
+        account: [{ required: true, message: '请输入账号', trigger: 'blur' }],
+        name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
+        password: [{ required: true, trigger: 'blur', validator: validatePass }]
+      }
     }
   },
   methods: {
     handleClose() {
       this.dialogVisible = false
+      this.$parent.search()
+      this.form = {
+        account: '',
+        name: '',
+        password: '',
+        status: '',
+        userId: ''
+      }
     },
-    openClose() {
+    openClose(val) {
+      this.title = val.title
+      if (val) {
+        this.userString = val
+        if (val.id) {
+          this.detail()
+        }
+      }
+
       this.dialogVisible = true
+    },
+    /**
+     * @method 用户确定
+     * **/
+    addList(formName) {
+      this.$refs[formName].validate(valid => {
+        if (valid) {
+          let code = {
+            account: this.form.account,
+            name: this.form.name,
+            password: this.form.password,
+            status: this.form.status
+          }
+          this.userString.show
+            ? this.addListData(code)
+            : this.editListData(code)
+        }
+      })
+    },
+    /**
+     * @method 详情
+     * **/
+    detail() {
+      const code = {
+        id: this.userString.id
+      }
+      api.GET('/user/detail', code).then(data => {
+        if (data.code == 0) {
+          this.form = data.data
+        }
+      })
+    },
+    /**
+     * @method 新增
+     * **/
+    addListData(val) {
+      api.POST('/user/add', val).then(data => {
+        if (data.code == 0) {
+          this.handleClose()
+          this.$message.success(data.message)
+        }
+      })
+    },
+    /**
+     * @method 编辑
+     * **/
+    editListData(val) {
+      val.userId = this.form.userId
+      api.POST('/user/update', val).then(data => {
+        if (data.code == 0) {
+          this.handleClose()
+          this.$message.success(data.message)
+        }
+      })
     }
   }
 }

+ 144 - 21
src/pages/userManagement/index.vue

@@ -6,18 +6,35 @@
     <div class="userManagement_list_headerSelect">
       <el-form slot="form" style="display: inline" inline :addList="true">
         <el-form-item class="header_top_form" label="账号:">
-          <el-input placeholder="请输入" size="small"></el-input>
+          <el-input
+            placeholder="请输入"
+            size="small"
+            v-model.trim="form.account"
+            clearable
+          ></el-input>
         </el-form-item>
         <el-form-item class="header_top_form" label="姓名:">
-          <el-input placeholder="请输入" size="small"></el-input>
+          <el-input
+            placeholder="请输入"
+            size="small"
+            v-model.trim="form.name"
+            clearable
+          ></el-input>
         </el-form-item>
         <el-form-item>
-          <el-button size="small" type="primary" style="width: 88px"
+          <el-button
+            size="small"
+            type="primary"
+            style="width: 88px"
+            @click="search"
             >查询</el-button
           >
         </el-form-item>
       </el-form>
-      <el-button size="small" style="width: 104px; margin-right: 23px"
+      <el-button
+        size="small"
+        style="width: 104px; margin-right: 23px"
+        @click="addList"
         >新增</el-button
       >
     </div>
@@ -44,6 +61,7 @@
                 v-model="scope.row[scope.column.property]"
                 active-color="#17A8FF"
                 inactive-color="#AFAFAF"
+                @change="statusChange($event, scope.row)"
               >
               </el-switch>
             </div>
@@ -57,7 +75,10 @@
         <template slot-scope="scope">
           <div>
             <el-button type="text" @click="edit(scope.row)">编辑</el-button>
-            <el-button type="text" @click="resetPasswords(scope.row)" style="color:#F4453E"
+            <el-button
+              type="text"
+              @click="resetPasswords(scope.row)"
+              style="color: #f4453e"
               >重置密码</el-button
             >
           </div>
@@ -69,10 +90,10 @@
       @current-change="handleCurrentChange"
       :current-page="form.pageNum"
       :page-sizes="[100, 200, 300, 400]"
-      :page-size="10"
+      :page-size="form.pageSize"
       background
       layout="total,prev, pager, next,jumper"
-      :total="100"
+      :total="form.total"
     >
     </el-pagination>
     <editDialog ref="editDialogRefs" />
@@ -82,6 +103,7 @@
 <script>
 import editDialog from './edit'
 import detailDialog from './detail'
+import * as api from '@/api/api'
 export default {
   name: 'userManagement',
   components: {
@@ -93,43 +115,144 @@ export default {
       fullscreenLoading: false,
       tableData: [],
       listData: [
-        { name: '账号', value: '', width: '', minWidth: '', align: 'center' },
-        { name: '姓名', value: '', width: '', minWidth: '', align: 'center' },
+        {
+          name: '账号',
+          value: 'account',
+          width: '',
+          minWidth: '',
+          align: 'center'
+        },
+        {
+          name: '姓名',
+          value: 'name',
+          width: '',
+          minWidth: '',
+          align: 'center'
+        },
         {
           name: '禁用/启用',
-          value: '',
+          value: 'status',
           width: '',
           minWidth: '',
           align: 'center'
         },
         {
           name: '创建时间',
-          value: '',
+          value: 'createTime',
           width: '',
           minWidth: '',
           align: 'center'
         }
       ],
       form: {
-        pageNum: 4
+        pageNum: 1,
+        pageSize: 10,
+        account: '',
+        name: '',
+        start: '',
+        total: 0
       }
     }
   },
   mounted() {
-    this.$nextTick(() => {
-      this.tableData = [{}]
-    })
+    this.listDataInit()
   },
   methods: {
-    handleSizeChange() {},
-    handleCurrentChange() {},
+    /**
+     * @method 搜索
+     * **/
+    search() {
+      this.form.pageNum = 1
+      this.listDataInit()
+    },
+    /**
+     * @method 用户数据列表
+     * **/
+    listDataInit() {
+      this.fullscreenLoading = true
+      let code = {
+        account: this.form.account,
+        name: this.form.name,
+        page: this.form.pageNum,
+        pageSize: this.form.pageSize,
+        start: this.form.start
+      }
+      api
+        .POST('/user/list', code)
+        .then(res => {
+          if (res.code == 0) {
+            this.tableData = res.data.list
+            this.tableData.forEach(item => {
+              item.status == 1 ? (item.status = true) : (item.status = false)
+            })
+            this.form.pageNum = res.data.currPage
+            this.form.pageSize = res.data.pageSize
+            this.form.total = res.data.totalCount
+            this.fullscreenLoading = false
+          }
+        })
+        .catch(() => {
+          this.fullscreenLoading = false
+        })
+    },
+    /**
+     * @method 条数分页
+     * **/
+    handleSizeChange(val) {
+      this.form.pageSize = val
+      this.form.pageNum = 1
+      this.listDataInit()
+    },
+    /**
+     * @method 分页
+     * **/
+    handleCurrentChange(val) {
+      this.form.pageNum = val
+      this.listDataInit()
+    },
+    /**
+     * @method 新增
+     * **/
+    addList() {
+      let code = {
+        title: '新增用户',
+        show: true
+      }
+      this.$refs.editDialogRefs.openClose(code)
+    },
     // 编辑
-    edit() {
-      this.$refs.editDialogRefs.openClose()
+    edit(val) {
+      let code = {
+        title: '编辑用户',
+        show: false,
+        id: val.userId
+      }
+      this.$refs.editDialogRefs.openClose(code)
     },
     // 重置密码
-    resetPasswords() {
-      this.$refs.detailDialogRefs.openClose()
+    resetPasswords(val) {
+      let code = {
+        id: val.userId
+      }
+      this.$refs.detailDialogRefs.openClose(code)
+    },
+    /**
+     * @method 状态修改
+     * **/
+    statusChange(val, item) {
+      val ? (val = 1) : (val = 0)
+      let code = {
+        id: item.userId,
+        status: val
+      }
+      api.PUT('/user/updateSwitch', code).then(data => {
+        if (data.code == 0) {
+          this.search()
+          this.$message.success(data.message)
+        }
+      }).catch(()=>{
+        this.search()
+      })
     }
   }
 }

+ 2 - 9
src/router/index.js

@@ -31,14 +31,7 @@ router.beforeEach(async (to, from, next) => {
           let flag = ruleValidate(accessRoutes, to.path)
           if (flag) {
             next({ ...to, replace: true })
-          } else {
-            Message({
-              showClose: true,
-              message: '当前路由没有权限',
-              type: 'error'
-            })
-            next({ ...accessRoutes[0], replace: true })
-          }
+          } 
         } catch (err) {
           if (err.code != '0') {
             next({
@@ -47,7 +40,7 @@ router.beforeEach(async (to, from, next) => {
           }
         }
       } else {
-        store.dispatch('permission/FETCH_AUTHORID')
+        // store.dispatch('permission/FETCH_AUTHORID')
         next()
       }
     } else {

+ 5 - 19
src/store/permission.js

@@ -1,4 +1,4 @@
-import { getAuth } from '@/api/login'
+// import { getAuth } from '@/api/login'
 import { appRouter, loginRouter } from '../router/routes'
 const state = {
   permissionList: null,
@@ -28,29 +28,15 @@ const actions = {
   FETCH_PERMISSION({ commit }) {
     let allRoutes = clone(appRouter)
     return new Promise((resolve, reject) => {
-      getAuth()
-        .then(res => {
-          let routesData = []
-          let permissionList = res.data
-          commit('SET_AUTHORID', permissionList)
-          let authorityIds = [0, ...permissionList]
-          authorityIds.forEach(item => {
-            getNodeById(allRoutes, item, routesData)
-          })
-          getFilterNode(allRoutes)
           commit('SET_ROUTES', allRoutes)
           resolve(allRoutes)
-        })
-        .catch(err => {
-          reject(err)
-        })
     })
   },
   FETCH_AUTHORID({ commit }) {
-    getAuth().then(res => {
-      let authorIds = res.data
-      commit('SET_AUTHORID', authorIds)
-    })
+    // getAuth().then(res => {
+    //   let authorIds = res.data
+    //   commit('SET_AUTHORID', authorIds)
+    // })
   }
 }
 function clone(obj) {