Bläddra i källkod

版本管理模块全部完成

zhuliu 10 månader sedan
förälder
incheckning
acacd65b61
27 ändrade filer med 827 tillägg och 410 borttagningar
  1. 1 0
      src/App.vue
  2. 22 1
      src/api/version.js
  3. 14 2
      src/router/index.js
  4. 8 0
      src/store/modules/history.js
  5. 7 1
      src/utils/axios.js
  6. 2 22
      src/utils/common.js
  7. 87 0
      src/utils/encryption.js
  8. 5 4
      src/utils/index.js
  9. 1 1
      src/utils/model/upload/index.vue
  10. 90 0
      src/utils/query.js
  11. 3 208
      src/views/backStageManage/application/vip/index.vue
  12. 226 0
      src/views/backStageManage/application/vip/vipType.vue
  13. 1 1
      src/views/backStageManage/application/vision/addVersion.vue
  14. 1 1
      src/views/backStageManage/application/vision/components/dialog/addFunctionDialog.vue
  15. 8 6
      src/views/backStageManage/application/vision/components/form/function.vue
  16. 111 115
      src/views/backStageManage/application/vision/components/versionForm.vue
  17. 11 0
      src/views/backStageManage/application/vision/components/mixins/commonData.js
  18. 76 7
      src/views/backStageManage/application/vision/components/mixins/functionData.js
  19. 4 4
      src/views/backStageManage/application/vision/components/mixins/treeChecked.js
  20. 5 2
      src/views/backStageManage/application/vision/editVersion.vue
  21. 30 0
      src/views/backStageManage/application/vision/versionDetail.vue
  22. 92 16
      src/views/backStageManage/application/vision/vision.vue
  23. 1 1
      src/views/backStageManage/home/index.vue
  24. 1 1
      src/views/backStageManage/layout/components/AppMain.vue
  25. 1 1
      src/views/backStageManage/layout/components/Navbar.vue
  26. 2 1
      src/views/backStageManage/layout/components/history.vue
  27. 17 15
      src/views/home/components/downLoad/downLoad.vue

+ 1 - 0
src/App.vue

@@ -27,6 +27,7 @@ textarea {
 }
 html, body, #app {
   width: 100%;
+  min-width: 1350px;
   height: 100%;
   padding: 0;
   margin: 0;

+ 22 - 1
src/api/version.js

@@ -41,5 +41,26 @@ export default {
     //删除应用版本
     removeVersions(data){
         return axios.post('/permission/api/version/delete', data)
-    }
+    },
+
+    //编辑版本状态
+    updateVisionStatus(data){
+        return axios.post('/permission/api/version/updateStatus', data)
+    },
+
+    //编辑版本状态
+    queryPublicVersionLast(data){
+        return axios.post('/permission/api/version/queryPublicVersionLast', data)
+    },
+
+    //查询版本功能及代码
+    queryFunctionCode(data){
+        return axios.post('/permission/api/version/queryFunctionCode', data)
+    },
+
+    //查询版本功能及代码
+    addFunction(data){
+        return axios.post('/permission/api/version/addFunction', data)
+    },
+
 }

+ 14 - 2
src/router/index.js

@@ -2,6 +2,9 @@ import Vue from 'vue'
 import VueRouter from 'vue-router'
 import Store from '../store'
 import Cookies from 'js-cookie'
+
+import {stringifyQuery,parseQuery} from '@/utils/query'
+
 Vue.use(VueRouter)
 
 const originalPush = VueRouter.prototype.push
@@ -115,7 +118,7 @@ export const backStageManageRouterItem = [
         path: 'vision',
         name: 'Administrator_vision',
         component: () => import('@/views/backStageManage/application/vision/index.vue'),
-        meta: { title: '应用版本清单', icon: '版本' }
+        meta: { title: '应用版本管理', icon: '版本' }
       },
       {
         path: 'addVersion',
@@ -128,7 +131,14 @@ export const backStageManageRouterItem = [
         path: 'editVersion',
         name: 'Administrator_editVersion',
         component: () => import('@/views/backStageManage/application/vision/editVersion.vue'),
-        meta: {title: '编辑应用版本', icon: 'editVision'},
+        meta: {title: '编辑应用版本', icon: 'editVision',keepAlive:true},
+        hidden:true
+      },
+      {
+        path: 'versionDetail',
+        name: 'Administrator_versionDetail',
+        component: () => import('@/views/backStageManage/application/vision/versionDetail.vue'),
+        meta: {title: '应用版本详情', icon: 'editVision'},
         hidden:true
       },
       {
@@ -200,6 +210,8 @@ export const backStageManage = [
 const router = new VueRouter({
   mode: 'history',
   base: '/',
+  stringifyQuery: stringifyQuery, // 序列化query参数
+  parseQuery: parseQuery, // 反序列化query参数
   routes: process.env.NODE_ENV !== 'production' ? [...routes, ...backStageManage] : routes
 })
 

+ 8 - 0
src/store/modules/history.js

@@ -1,3 +1,4 @@
+import router from "@/router";
 export default {
   state: {
     history:[],
@@ -34,6 +35,13 @@ export default {
         state.history=state.history.filter(item=>{
             return item.path!=path;
         })
+        if(state.history.length == 0){
+          router.push(
+            {
+              path:'/administrator/home',
+            }
+          )
+        }
     },
     removeHistoryPath(state,path){
         state.historyPath=state.historyPath.filter(item=>{

+ 7 - 1
src/utils/axios.js

@@ -91,8 +91,14 @@ _axios.interceptors.response.use(
       })
       return Promise.reject(response.data)
     } else{
+      // isRefreshing = false
+      // return response.data 
+      Notification.error({
+        title: '系统错误',
+        message: error.response.data.message
+      })
       isRefreshing = false
-      return response.data 
+      return Promise.reject(response.data)
     }
     // Do something with response data
     // return response;

+ 2 - 22
src/utils/common.js

@@ -64,11 +64,11 @@ export default {
     ]
   },
   //查看文件
-  getFile(guid) {
+  checkViewer(guid) {
     if(!guid){
       return ''
     }
-    return `/fileManager/downloadFile?fileId=${guid}`
+    return `/api/fileManager/downloadFile?fileId=${guid}`
   },
    //校验文件是否全部上传
    validFile(data,arr) {
@@ -99,24 +99,4 @@ export default {
 
     return arr
   },
-
-  //导出
-  downLoad(guid){
-    const href = this.getFile(guid)
-    const anchor = document.createElement('a');
-    const fileName = 'download';
-    if ('download' in anchor) {
-      anchor.href = href;
-      anchor.setAttribute("download", fileName);
-      anchor.className = "download-js-link";
-      anchor.innerHTML = "downloading...";
-      anchor.style.display = "none";
-      document.body.appendChild(anchor);
-      setTimeout(function () {
-        anchor.click();
-        document.body.removeChild(anchor);
-      }, 66);
-      return true;
-    }
-  },
 }

+ 87 - 0
src/utils/encryption.js

@@ -0,0 +1,87 @@
+ 
+import CryptoJS from 'crypto-js'
+import CryptoJSCore from 'crypto-js/core'
+import AES from 'crypto-js/aes'
+import ZeroPadding from 'crypto-js/pad-zeropadding'
+import Utf8, { parse } from 'crypto-js/enc-utf8'
+import Base64 from 'crypto-js/enc-base64'
+ 
+/*
+ * 加密 解密
+ */
+const keyHex = parse('1111111111111111') // 十六位数作为密钥,自行修改
+const ivHex = CryptoJS.lib.WordArray.random(128 / 8) // 十六位数作为密钥偏移量 随机生成
+ 
+/**
+ * 加密
+ * @param {String} key
+ * @returns {string}
+ */
+// 加密后的结果通常是一个CipherParams对象,其中包含了加密后的密文数据,而密文数据本身是一个WordArray对象。同样,在解密过程中,解密后的结果也是一个WordArray对象。
+export const getEncrypt = (key) => {
+  try {
+    key = JSON.stringify(key)
+  } catch (e) {
+    console.warn(e)
+  }
+  //   key需要是WordArray类型
+  return JSON.stringify({
+    encrypt: AES.encrypt(key, keyHex, {
+      mode: CryptoJSCore.mode.CBC,
+      padding: ZeroPadding,
+      iv: ivHex,
+    }).toString(),
+    iv: ivHex,
+  })
+}
+ 
+/**
+ * 加密后转base64
+ * @param {String}} key
+ */
+export const getEncryptToBase64 = (key) => {
+  const encryptStr = getEncrypt(key)
+  const wordArray = Utf8.parse(encryptStr) //转为WordArray对象
+  return Base64.stringify(wordArray)
+}
+ 
+/**
+ * 解密
+ * @param data
+ * @returns {string}
+ */
+export const getDecrypt = (data) => {
+  let { encrypt, iv } = JSON.parse(data)
+  let decrypted = AES.decrypt(
+    {
+      ciphertext: Base64.parse(encrypt),
+    },
+    keyHex,
+    {
+      mode: CryptoJSCore.mode.CBC,
+      padding: ZeroPadding,
+      iv: iv,
+    }
+  ).toString(Utf8) //转换为指定编码的字符串
+ 
+  try {
+    decrypted = JSON.parse(decrypted)
+  } catch (e) {
+    console.warn(e)
+  }
+  return decrypted
+}
+ 
+/**
+ * 对base64数据解密  先解析base64,在做解密
+ * @param {String} data
+ * @returns {string}
+ */
+export const getDecryptByBase64 = (data) => {
+  // 将Base64字符串转换为WordArray
+  const parsedWordArray = Base64.parse(data)
+  //   WordArray对象转换成一个UTF-8编码的字符串
+  const decryptStr = Utf8.stringify(parsedWordArray)
+ 
+  return getDecrypt(decryptStr)
+}

+ 5 - 4
src/utils/index.js

@@ -1,6 +1,7 @@
 import moment from 'moment'
 import _ from 'lodash'
 import constants from '@/utils/constants'
+import commonJS from './common'
 
 export const formatDate = (date, format = 'YYYY-MM-DD') => {
   return moment(date).format(format)
@@ -51,10 +52,10 @@ export const downLoadBase64 = (content, fileName) => {
   aLink.click();
 }
 
-export const downLoad2 = (url) => {
-  const href = `/api/v2/common/download?url=${encodeURIComponent(url)}`
+export const downLoad2 = (guid,fileName="download") => {
+  const href = commonJS.checkViewer(guid)
   const anchor = document.createElement('a');
-  const fileName = 'download';
+  // const fileName = 'download';
   if ('download' in anchor) {
     anchor.href = href;
     anchor.setAttribute("download", fileName);
@@ -199,4 +200,4 @@ export const renderSize = (value) => {
 
 export const getPatentCountry = (patentNo) => {
   return patentNo.substr(0, 2)
-}
+}

+ 1 - 1
src/utils/model/upload/index.vue

@@ -221,7 +221,7 @@ export default {
     onChange(file, fileList) {
       if(this.limit){
         if(this.fileList.length>=this.limit){
-          this.$message.warning(`只能上传${this.$limit}个文件`)
+          this.$message.warning(`只能上传${this.limit}个文件`)
           return false
         }
       }

+ 90 - 0
src/utils/query.js

@@ -0,0 +1,90 @@
+import {
+    getEncryptToBase64 as encrypt,
+    getDecryptByBase64 as decrypt,
+  } from './encryption'
+const encodeReserveRE = /[!'()*]/g
+const encodeReserveReplacer = (c) => '%' + c.charCodeAt(0).toString(16)
+const commaRE = /&2c/g
+
+const encode = (str)=>{
+    return encodeURIComponent(str)
+        .replace(encodeReserveRE,encodeReserveReplacer)
+        .replace(commaRE,',')
+}
+
+const decode = decodeURIComponent
+
+function isBase64(str){
+    if(!str || str.trim() === ''){
+        return false
+    }
+
+    const base64Pattern = /^[A-Za-z0-9+/]*={0,2}$/
+
+    if(!base64Pattern.test(str)){
+        return false
+    }
+
+    try{
+        return btoa(atob(str)) === str
+    }catch(err){
+        return false
+    }
+}
+
+export const stringifyQuery = (obj)=>{
+    const res = obj
+        ? Object.keys(obj).map((key)=>{
+            const val = obj[key]
+            if(val === null || val === undefined){
+                return encode(key)
+            }
+
+            if(Array.isArray(val)){
+                const result = []
+                val.forEach((val2)=>{
+                    if(val === null || val === undefined){
+                        result.push(encode(key))
+                    }else{
+                        result.push(encode(key) + '=' + encode(val2))
+                    }
+                })
+                return result.join('&')
+            }
+            return encode(key) + '=' + encode(val)
+        }).join('&')
+        : null
+    return res ? `?${encrypt(res)}` : ''
+}
+
+
+export const parseQuery = (query) =>{
+    const res = {}
+
+    query = query.trim().replace(/^(\?|#|&)/,'')
+
+    if(!query){
+        return res
+    }
+
+    query = isBase64(query) ? decrypt(query) : query
+    // try{
+    //     query = decrypt(query)
+    // }catch(err){
+    //     query = query
+    // }
+
+    query.split('&').forEach((param)=>{
+        const parts = param.split('=')
+        const key = decode(parts.shift())
+        const val = parts.length>0 ? decode(parts.join('')) : null
+        if(res[key] === undefined){
+            res[key] = val
+        }else if(Array.isArray(res[key])){
+            res[key].push(val)
+        }else{
+            res[key] = [res[key],val]
+        }
+    })
+    return res
+}

+ 3 - 208
src/views/backStageManage/application/vip/index.vue

@@ -1,226 +1,21 @@
 <template>
-  <div class="container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
-      <el-form-item label="会员类型名称" prop="tenantVipName">
-        <el-input
-          v-model="queryParams.tenantVipName"
-          placeholder="请输入会员类型名称"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item>
-        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
-        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
-      </el-form-item>
-    </el-form>
-    
-    <el-row :gutter="10" class="mb8">
-      <el-col :span="1.5">
-        <el-button type="primary" icon="el-icon-plus" size="small" @click="handleAdd">新增</el-button>
-      </el-col>
-    </el-row>
-
-    <el-table 
-        :data="tableData"
-        row-key="id"
-        style="width: 100%"
-        :maxHeight="tableHeight - 40"
-        v-loading="loading"
-        @selection-change="handleSelectionChange"
-        @sort-change="sortChange"
-    >
-        <el-table-column type="selection" width="55" :reserve-selection="true" v-if="!choose"></el-table-column>
-
-        <el-table-column  v-if="choose" align="center">
-          <template slot-scope="scope">
-              <div>
-                  <el-checkbox-group v-model="checkList1">
-                      <el-checkbox :label="scope.row.id">{{(scope.$index + 1) + ((queryParams.current - 1) * queryParams.size)}}</el-checkbox>
-                  </el-checkbox-group>
-              </div>
-          </template>
-        </el-table-column>
-
-        <el-table-column prop="tenantVipName" label="会员类型名称"></el-table-column>
-        <el-table-column prop="lastTime" label="持续时长"></el-table-column>
-        <el-table-column prop="createPersonName" label="创建人"></el-table-column>
-        <el-table-column prop="createTime" label="创建时间"></el-table-column>
-        <el-table-column prop="remark" label="备注"></el-table-column>
-
-        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-          <template slot-scope="scope">
-            <el-button
-              size="mini"
-              type="text"
-              icon="el-icon-edit"
-              @click="handleEdit(scope.row)"
-            >修改</el-button>
-            <el-button
-              v-if="scope.row.id != 0"
-              size="mini"
-              type="text"
-              icon="el-icon-delete"
-              @click="handleDelete(scope.row)"
-            >删除</el-button>
-          </template>
-        </el-table-column>
-    </el-table>
-    <div>
-      <el-pagination background layout="total, sizes, prev, pager, next, jumper"
-        :current-page.sync="queryParams.current" :page-size.sync="queryParams.size"
-        @current-change="handleCurrentChange" @size-change="changeSize" :total="total">
-      </el-pagination>
-    </div>
-  </div>
+  <div></div>
 </template>
 
 <script>
-
 export default {
-
   components: {},
   props: {},
   data() {
     return {
-      // 遮罩层
-      loading: false,
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 显示搜索条件
-      showSearch: true,
-      // 表单参数
-      form: {},
-      tableData: [],
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        tenantVipName: undefined
-      },
-      rules: {
-        tenantVipName: [
-          { required: true, message: "会员类型名称不能为空", trigger: "blur" }
-        ]
-      }
     };
   },
   watch: {},
   computed: {},
   created() {},
-  mounted() {
-    this.getList()
-  },
-  methods: {
-    /** 查询vip列表 */
-    getList() {
-      this.loading = true;
-      this.$api.getVipList(this.queryParams).then(response=>{
-        if(response.code == 200){
-            this.tableData = response.data.records
-            this.total = response.data.total
-            this.loading = false
-        }
-      }).catch(error=>{
-          this.tableData = []
-          this.total = 0
-          this.loading = false
-      })
-    },
-    /** 新增按钮操作 */
-    handleAdd(row) {
-      this.$router.push('/administrator/addVip');
-    },
-    /** 提交按钮 */
-    submitForm: function() {
-      this.open = false;
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-    },
-    handleEdit(row) {
-      this.$router.push({ 
-        path: '/administrator/editVip', 
-        query: {
-            id: row.id
-        }
-      });
-    },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
-      this.getList();
-    },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.handleQuery();
-    },
-    handleDelete(row) {
-      this.removeVip([row.id]);
-    },
-    removeVip(ids,type){
-          this.$confirm('确认删除本条数据吗?', '提示', {
-              confirmButtonText: '确定',
-              cancelButtonText: '取消',
-              type: 'warning'
-          }).then(() => {
-            var params = {
-                ids:ids,
-            }
-              this.$api.deleteVip(params).then(response=>{
-                  if(response.code == 200){
-                      this.$message.success('删除成功')
-                      this.getList()
-                      if(type){
-                          this.multipleSelection = []
-                          this.$refs.table.clearSelection();
-                      }else{
-                          var id = response.data.data[0]
-                          var index = this.multipleSelection.findIndex(item=>{
-                              return item.id == id
-                          })
-                          if(index!=-1){
-                              this.multipleSelection.splice(index,1)
-                          }
-                      }
-                      
-                  }
-              }).catch(error=>{
-                  this.$message.error('删除失败')
-              })
-          })
-      },
-  },
+  mounted() {},
+  methods: {},
 };
 </script>
 <style lang="scss" scoped>
-.container{
-  width: 100%;
-}
-.padding_20{
-  padding: 20px
-}
-::v-deep .el-table,
-.el-table__expanded-cell {
-  background-color: transparent;
-}
-
-::v-deep .el-table tr {
-  background-color: transparent !important;
-}
-::v-deep .el-table__body td,::v-deep .el-table__header th,
-.el-table .cell {
-  background-color: transparent;
-}
-::v-deep .el-table::before {
-  //去除底部白线
-  left: 0;
-  bottom: 0;
-  width: 100%;
-  height: 0px;
-}
-
 </style>

+ 226 - 0
src/views/backStageManage/application/vip/vipType.vue

@@ -0,0 +1,226 @@
+<template>
+  <div class="container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="100px">
+      <el-form-item label="会员类型名称" prop="tenantVipName">
+        <el-input
+          v-model="queryParams.tenantVipName"
+          placeholder="请输入会员类型名称"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+    
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button type="primary" icon="el-icon-plus" size="small" @click="handleAdd">新增</el-button>
+      </el-col>
+    </el-row>
+
+    <el-table 
+        :data="tableData"
+        row-key="id"
+        style="width: 100%"
+        :maxHeight="tableHeight - 40"
+        v-loading="loading"
+        @selection-change="handleSelectionChange"
+        @sort-change="sortChange"
+    >
+        <el-table-column type="selection" width="55" :reserve-selection="true" v-if="!choose"></el-table-column>
+
+        <el-table-column  v-if="choose" align="center">
+          <template slot-scope="scope">
+              <div>
+                  <el-checkbox-group v-model="checkList1">
+                      <el-checkbox :label="scope.row.id">{{(scope.$index + 1) + ((queryParams.current - 1) * queryParams.size)}}</el-checkbox>
+                  </el-checkbox-group>
+              </div>
+          </template>
+        </el-table-column>
+
+        <el-table-column prop="tenantVipName" label="会员类型名称"></el-table-column>
+        <el-table-column prop="lastTime" label="持续时长"></el-table-column>
+        <el-table-column prop="createPersonName" label="创建人"></el-table-column>
+        <el-table-column prop="createTime" label="创建时间"></el-table-column>
+        <el-table-column prop="remark" label="备注"></el-table-column>
+
+        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+          <template slot-scope="scope">
+            <el-button
+              size="mini"
+              type="text"
+              icon="el-icon-edit"
+              @click="handleEdit(scope.row)"
+            >修改</el-button>
+            <el-button
+              v-if="scope.row.id != 0"
+              size="mini"
+              type="text"
+              icon="el-icon-delete"
+              @click="handleDelete(scope.row)"
+            >删除</el-button>
+          </template>
+        </el-table-column>
+    </el-table>
+    <div>
+      <el-pagination background layout="total, sizes, prev, pager, next, jumper"
+        :current-page.sync="queryParams.current" :page-size.sync="queryParams.size"
+        @current-change="handleCurrentChange" @size-change="changeSize" :total="total">
+      </el-pagination>
+    </div>
+  </div>
+</template>
+
+<script>
+
+export default {
+
+  components: {},
+  props: {},
+  data() {
+    return {
+      // 遮罩层
+      loading: false,
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 显示搜索条件
+      showSearch: true,
+      // 表单参数
+      form: {},
+      tableData: [],
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        tenantVipName: undefined
+      },
+      rules: {
+        tenantVipName: [
+          { required: true, message: "会员类型名称不能为空", trigger: "blur" }
+        ]
+      }
+    };
+  },
+  watch: {},
+  computed: {},
+  created() {},
+  mounted() {
+    this.getList()
+  },
+  methods: {
+    /** 查询vip列表 */
+    getList() {
+      this.loading = true;
+      this.$api.getVipList(this.queryParams).then(response=>{
+        if(response.code == 200){
+            this.tableData = response.data.records
+            this.total = response.data.total
+            this.loading = false
+        }
+      }).catch(error=>{
+          this.tableData = []
+          this.total = 0
+          this.loading = false
+      })
+    },
+    /** 新增按钮操作 */
+    handleAdd(row) {
+      this.$router.push('/administrator/addVip');
+    },
+    /** 提交按钮 */
+    submitForm: function() {
+      this.open = false;
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+    },
+    handleEdit(row) {
+      this.$router.push({ 
+        path: '/administrator/editVip', 
+        query: {
+            id: row.id
+        }
+      });
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.handleQuery();
+    },
+    handleDelete(row) {
+      this.removeVip([row.id]);
+    },
+    removeVip(ids,type){
+          this.$confirm('确认删除本条数据吗?', '提示', {
+              confirmButtonText: '确定',
+              cancelButtonText: '取消',
+              type: 'warning'
+          }).then(() => {
+            var params = {
+                ids:ids,
+            }
+              this.$api.deleteVip(params).then(response=>{
+                  if(response.code == 200){
+                      this.$message.success('删除成功')
+                      this.getList()
+                      if(type){
+                          this.multipleSelection = []
+                          this.$refs.table.clearSelection();
+                      }else{
+                          var id = response.data.data[0]
+                          var index = this.multipleSelection.findIndex(item=>{
+                              return item.id == id
+                          })
+                          if(index!=-1){
+                              this.multipleSelection.splice(index,1)
+                          }
+                      }
+                      
+                  }
+              }).catch(error=>{
+                  this.$message.error('删除失败')
+              })
+          })
+      },
+  },
+};
+</script>
+<style lang="scss" scoped>
+.container{
+  width: 100%;
+}
+.padding_20{
+  padding: 20px
+}
+::v-deep .el-table,
+.el-table__expanded-cell {
+  background-color: transparent;
+}
+
+::v-deep .el-table tr {
+  background-color: transparent !important;
+}
+::v-deep .el-table__body td,::v-deep .el-table__header th,
+.el-table .cell {
+  background-color: transparent;
+}
+::v-deep .el-table::before {
+  //去除底部白线
+  left: 0;
+  bottom: 0;
+  width: 100%;
+  height: 0px;
+}
+
+</style>

+ 1 - 1
src/views/backStageManage/application/vision/addVersion.vue

@@ -5,7 +5,7 @@
 </template>
 
 <script>
-import VersionForm from './components/versionForm.vue';
+import VersionForm from './components/form/versionForm.vue';
 export default {
     components: {
         'version-form': VersionForm

+ 1 - 1
src/views/backStageManage/application/vision/components/dialog/addFunctionDialog.vue

@@ -1,7 +1,7 @@
 <template>
   <div>
     <el-dialog title="添加功能" :visible.sync="visible" width="500px" :before-close="close">
-        <addFunctionForm ref="addFunctionForm" :form="form"></addFunctionForm>
+        <addFunctionForm ref="addFunctionForm" v-if="visible" :form="form"></addFunctionForm>
       <div slot="footer" class="dialog-footer">
         <el-button @click="close">取 消</el-button>
         <el-button type="primary" @click="submit" :loading="btnLoading">确 定</el-button>

+ 8 - 6
src/views/backStageManage/application/vision/components/form/function.vue

@@ -4,21 +4,21 @@
       <el-form-item label="所属功能" prop="function" v-if="ruleForm.function">
         <el-input v-model="ruleForm.last" placeholder="所属功能" :disabled="true"></el-input>
       </el-form-item>
-      <el-form-item label="所属应用" prop="apply">
+      <!-- <el-form-item label="所属应用" prop="apply">
         <el-input v-model="ruleForm.applyName" placeholder="所属应用" :disabled="true"></el-input>
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item label="功能名称" prop="name">
         <el-input v-model="ruleForm.name" placeholder="请输入功能名称"></el-input>
       </el-form-item>
       <el-form-item label="功能标识" prop="sign">
         <el-input type="textarea" v-model="ruleForm.sign" placeholder="请输入功能标识"></el-input>
       </el-form-item>
-      <el-form-item label="是否可选" prop="ismore">
+      <!-- <el-form-item label="是否可选" prop="ismore">
          <el-radio-group v-model="ruleForm.functionType">
             <el-radio :label="1">是</el-radio>
             <el-radio :label="0">否</el-radio>
         </el-radio-group>
-      </el-form-item>
+      </el-form-item> -->
       <el-form-item label="功能描述" prop="describe">
         <el-input v-model="ruleForm.describe" placeholder="请输入" type="textarea" maxlength="100" show-word-limit></el-input>
       </el-form-item>
@@ -57,14 +57,16 @@ export default {
   mounted() {},
   methods: {
     async validate(){
+        var sign = false
         await this.$refs.ruleForm.validate((valid) => {
             if (valid) {
-                return true
+                sign = true
             }
             else {
-                return false;
+                sign = false;
             }
         })
+        return sign
     },
   },
 };

+ 111 - 115
src/views/backStageManage/application/vision/components/versionForm.vue

@@ -1,96 +1,104 @@
 <template>
-    <div class="form_center">
-        <el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="120px">
-            <el-form-item label="版本名称:" prop="versionName">
-                <el-input v-model="form.versionName" placeholder="请输入版本名称" maxlength="20" />
-            </el-form-item>
-
-            <el-form-item label="版本号:" prop="versionNum">
-                <el-input v-model="form.versionNum" placeholder="请输入版本号" maxlength="11" />
-            </el-form-item>
+    <div>
+        <div class="button-container" v-if="model != 'detail'">
+                <el-button type="primary" size="small" :loading="btnLoading" @click="submitForm">提 交</el-button>
+                <el-button size="small"  @click="init">重 置</el-button>
+        </div>
+        <div class="form_center">
+            <el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="120px">
+                <el-form-item label="版本名称:" prop="versionName">
+                    <el-input v-model="form.versionName" placeholder="请输入版本名称" maxlength="20" />
+                </el-form-item>
 
-            <el-form-item label="版本状态:" prop="versionNum">
-                <el-select v-model="form.status" placeholder="请选择版本状态">
-                    <el-option :label="'已保存'" :value="1"></el-option>
-                    <el-option :label="'调试'" :value="2"></el-option>
-                    <el-option :label="'已发布'" :value="3"></el-option>
-                </el-select>
-            </el-form-item>
-        
-            <el-form-item label="备注:" prop="remark">
-                <el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" />
-            </el-form-item>
+                <el-form-item label="版本号:" prop="versionNum">
+                    <el-input v-model="form.versionNum" placeholder="请输入版本号" maxlength="11" />
+                </el-form-item>
 
-            <el-form-item label="上传文件:" class="margin-bottom_0">
-                <myUpload :file-list="form.systemFileList" @on-change="onchangeFile" @on-remove="onRemove" :multiple="false" :limit="1"
-                    style="height: 185px;" :autoUpload="true">
-                </myUpload>
-            </el-form-item>
+                <el-form-item label="版本状态:" prop="status">
+                    <el-radio-group v-model="form.status">
+                        <el-radio v-for="(item, key) in status" :key="key" :label="parseInt(key)">{{item}}</el-radio>
+                    </el-radio-group>
+                </el-form-item>
             
-        </el-form>
-        <div style="border:1px solid white;padding:10px;margin:10px 0;border-radius:8px;">
-            <div style="height: 500px;" >
-                <p style="display:flex;align-items:center;justify-content:space-between">
-                    选择功能:
-                    <el-button type="primary" size="small" @click="addFunction(1,form)">添加功能</el-button>
-                </p>
-                <funTable ref="functionTable" :tableData="tableData" :loading="loading" :reload="reload" :defaultChecked="true">
-                    <template slot="column">
-                        <el-table-column label="授权代码" align="center">
-                            <template slot-scope="scope">
-                                <value-input v-if="!scope.row.children || scope.row.children == 0" type="textarea" :value="getCode(scope.row,2)" @change="(val)=>setCodeList_code(scope.row,val,2)"></value-input>
-                            </template>
-                        </el-table-column>
-                        <el-table-column label="代码" align="center">
-                            <template slot-scope="scope">
-                                <value-input v-if="!scope.row.children || scope.row.children == 0" type="textarea" :value="getCode(scope.row,1)" @change="(val)=>setCodeList_code(scope.row,val,1)"></value-input>
-                            </template>
-                        </el-table-column>
-                        <el-table-column label="操作" align="center" width="100px">
-                            <template slot-scope="scope">
-                                <div>
-                                    <el-button type="text" size="small" @click="addFunction(2,scope.row)">新增子功能</el-button>
-                                </div>
-                            </template>
-                        </el-table-column>
-                    </template>
-                </funTable>
+                <el-form-item label="备注:" prop="remark">
+                    <el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" />
+                </el-form-item>
+
+                <el-form-item label="上传文件:" class="margin-bottom_0">
+                    <myUpload :file-list="(form.systemFile && form.systemFile.guid)?[form.systemFile]:[]" @on-change="onchangeFile" @on-remove="onRemove" :multiple="false" :limit="1"
+                        style="height: 185px;" :autoUpload="true">
+                    </myUpload>
+                </el-form-item>
+                
+            </el-form>
+            <div style="border:1px solid white;padding:10px;margin:10px 0;border-radius:8px;">
+                <div style="height: 500px;" >
+                    <p style="display:flex;align-items:center;justify-content:space-between">
+                        选择功能:
+                        <el-button v-if="model != 'detail'" type="primary" size="small" @click="addFunction(1,form)">添加功能</el-button>
+                    </p>
+                    <funTable ref="functionTable" :tableData="tableData" :loading="loading" :reload="reload" :defaultChecked="true">
+                        <template slot="column">
+                            <el-table-column label="授权代码" align="center">
+                                <template slot-scope="scope" v-if="!scope.row.children || scope.row.children == 0">
+                                    <span v-if="model == 'detail'">
+                                        {{ getCode(scope.row,2) }}
+                                    </span>
+                                    <value-input v-else type="textarea" :value="getCode(scope.row,2)" @change="(val)=>setCodeList_code(scope.row,val,2)"></value-input>
+                                </template>
+                            </el-table-column>
+                            <el-table-column label="未授权代码" align="center">
+                                <template slot-scope="scope" v-if="!scope.row.children || scope.row.children == 0">
+                                    <span v-if="model == 'detail'">
+                                        {{ getCode(scope.row,1) }}
+                                    </span>
+                                    <value-input v-else type="textarea" :value="getCode(scope.row,1)" @change="(val)=>setCodeList_code(scope.row,val,1)"></value-input>
+                                </template>
+                            </el-table-column>
+                            <el-table-column label="操作" align="center" width="120px" v-if="model != 'detail'">
+                                <template slot-scope="scope">
+                                    <div>
+                                        <el-button type="text" size="small" @click="addFunction(2,scope.row)">新增子功能</el-button>
+                                        <el-button type="text" size="small" @click="remove(scope.row)">移除</el-button>
+                                    </div>
+                                </template>
+                            </el-table-column>
+                        </template>
+                    </funTable>
+                </div>
             </div>
         </div>
-        
-        <div class="button-container">
-            <el-button type="primary" size="small" :loading="btnLoading" @click="submitForm">提 交</el-button>
-            <el-button size="small"  @click="resetForm">重 置</el-button>
-        </div>
-
         <addFunctionDialog ref="addFunctionDialog" @getNewFunction="getNewFunction"></addFunctionDialog>
     </div>
 </template>
 
 <script>
-import funTable from './functionTable.vue';
-import functionData from './mixins/functionData';
+import funTable from '../functionTable.vue';
+import functionData from '../mixins/functionData';
+import commonData from '../mixins/commonData';
 const currentForm = {
     id:null,
     versionName:null,
     versionNum:null,
-    status: null,
+    fileGuid:null,
+    status: 1,
     applicationCode:'4e95e3d926a2a4befa5d913acc0aa9f5',
     applyId:14,
     remark:null,
-    systemFileList:[]
+    systemFile:null,
+    assoFunctionCodeDTOS:[]
 }
 export default {
     components: {
         funTable
     },
-    mixins:[functionData],
+    mixins:[functionData,commonData],
     props: {
         versionId:"",
         model:{
             type:String,
             default:"add"
-        }
+        },
     },
     data() {
         return {
@@ -106,22 +114,20 @@ export default {
                     { required: true, message: "版本号不能为空", trigger: "blur" }
                 ]
             },
-            checkFunctions:[],
-            checkFunctions_back_up:[],
-            codeList:[],
+            // checkFunctions:[],
+            // checkFunctions_back_up:[],
+            // codeList:[],
             tableData:{},
-            queryParams:{
-                name:'',
-                current:1,
-                size:10000,
-            },
-            total:0,
             loading:false,
             reload:true,
+            
         };
     },
     watch: {
         versionId(){
+            if(this.$route.path != '/administrator/editVersion'){
+                return
+            }
             this.init()
         },
     },
@@ -135,9 +141,16 @@ export default {
         async init(){
             if(this.model == 'add'){
                 this.resetForm()
-            }else if(this.model == 'edit'){
+            }else if(this.model == 'edit' || this.model == 'detail'){
+                if( this.model == 'detail'){
+                    this.reload = false
+                }
                 this.getById()
             }
+            this.reload = false
+            this.$nextTick(()=>{
+                this.reload = true
+            })
             await this.getList()
         },
         //查询数据并校验
@@ -147,11 +160,14 @@ export default {
                 return
             }
             var params = {
-                id: this.versionId,
+                ids: [this.versionId],
             };
-            this.$api.getVersionById(params).then(response=>{
+            this.$api.getVersionList(params).then(response=>{
                 if(response.code == 200){
-                    this.form = response.data.records
+                    var data = response.data.records
+                    if(data && data.length>0){
+                        this.form = data[0]
+                    }
                 }
             }).catch(error=>{
                 this.resetForm()
@@ -161,10 +177,6 @@ export default {
         resetForm(){
             this.form = Object.assign({}, currentForm)
             this.$refs['form'].resetFields();
-            this.reload = false
-            this.$nextTick(()=>{
-                this.reload = true
-            })
         },
         //获取所有的功能及代码
         getAllFunCode(data,funCode){
@@ -187,14 +199,14 @@ export default {
         submitForm: function() {
             this.$refs['form'].validate((valid) => {
                 if (valid) {
-                    var fileGuids = this.$commonJS.checkUploadFile(this.form.systemFileList)
+                    var fileGuids = this.$commonJS.checkUploadFile([this.form.systemFile])
                     if(!fileGuids){
                         return
                     }
                     this.form.fileGuid = fileGuids.length>0?fileGuids[0]:''
                     var assoFunctionCodeDTO = []
                     this.getAllFunCode(this.tableData.children,assoFunctionCodeDTO)
-                    this.form.assoFunctionCodeDTO = assoFunctionCodeDTO
+                    this.form.assoFunctionCodeDTOS = assoFunctionCodeDTO
                     this.btnLoading = true
                     var a = '添加'
                     var api = 'addVersion'
@@ -233,45 +245,26 @@ export default {
         //文件切换
         onchangeFile(file){
             if(file.guid){
-                let a = this.form.systemFileList.findIndex(item => {
-                    return item.uid == file.uid
-                })
-                if (a != -1) {
-                    this.form.systemFileList.splice(a,1,file)
-                }
-            }else{
-                this.form.systemFileList.push(file)
+               this.$set(this.form,'systemFile',file) 
             }
         },
         //删除文件
         onRemove(file){
-            if (file.guid) {
-                let a = this.form.systemFileList.findIndex(item => {
-                    return item.guid == file.guid
-                })
-                if(a != -1){
-                    this.form.systemFileList.splice(a, 1)  
-                }
-            } else {
-                let a = this.form.systemFileList.findIndex(item => {
-                    return item.uid == file.uid
-                })
-                this.form.systemFileList.splice(a, 1)
-            }
+            this.$set(this.form,'systemFile',null)
         },
         //查询功能列表
         async getList() {
-            if(!this.form.applyId){
-                return false
-            }
-            this.queryParams.apply = this.form.applyId
-            if(this.model == 'edit'){
-                this.queryParams.versonId = 1
+            var params = {}
+            if(this.model != 'add'){
+                params.versionId = this.versionId
             }
             this.loading = true
-            await this.$api.queryFunctionList(this.queryParams).then(response => {
-                this.tableData = response.data
-                var a = response.data.children
+            await this.$api.queryFunctionCode(params).then(response => {
+                this.tableData = {
+                    applyId:this.form.applyId,
+                    children:response.data
+                }
+                var a = response.data
                 for(var j = 0;j<a.length;j++){
                     function l(data){
                         if(data.hasOwnProperty('children')){
@@ -288,7 +281,6 @@ export default {
                     }
                     l(a[j])
                 }
-                this.total=response.pageColumn.total
                 this.loading = false
             }).catch(error => {
                 this.loading = true
@@ -364,7 +356,11 @@ export default {
 }
 
 .button-container {
+    max-width: 1200px;
     display: flex;
     justify-content:flex-end;
+    margin: 10px auto;
+    position:sticky;
+    top:10px,
 }
 </style>

+ 11 - 0
src/views/backStageManage/application/vision/components/mixins/commonData.js

@@ -0,0 +1,11 @@
+export default{
+    data() {
+        return {
+            status:{
+                1:"已保存",
+                2:"调试",
+                3:"已发布"
+            },
+        }
+    },
+}

+ 76 - 7
src/views/backStageManage/application/vision/components/mixins/functionData.js

@@ -7,7 +7,7 @@ export default{
     },
     data() {
         return {
-            addType:'',
+            addType:null,
             originFunction:null,
         }
     },
@@ -16,20 +16,87 @@ export default{
     mounted() {
     },
     methods: {
-        addFunction(type,form={}){
+        remove(row){
+            var data = this.tableData.children
+            if(row.function == 0){
+                var index = data.findIndex(item=>{
+                    return item.id == row.id
+                })
+                if(index !=-1){
+                    data.splice(index,1)
+                }
+                return
+            }
+            var path = row.path
+            path = path.split(',')
+            path = path.filter(item=>{
+                return item != 0
+            })
+            
+            for(var i = 0;i<path.length;i++){
+                var obj = data.find(item=>{
+                    return item.id == path[i]
+                })
+                if(!obj){
+                    return
+                }
+                data = obj.children
+            }
+            var index = data.findIndex(item=>{
+                return item.id == row.id
+            })
+            if(index !=-1){
+                data.splice(index,1)
+            }
+        },
+        async addFunction(type,form={}){
+            if(type == 2){
+                var data = form.functionCodes
+                if(data && data.length > 0){
+                    var arr = data.filter(item=>{
+                        return item.code
+                    })
+                    if(arr && arr.length){
+                        var sign = false
+                        await this.$confirm('该功能已存在功能代码,如果添加子功能则会将该功能代码删掉, 是否继续?', '提示', {
+                            confirmButtonText: '确定',
+                            cancelButtonText: '取消',
+                            type: 'warning'
+                        }).then(() => {
+                            sign = true
+                        }).catch(() => {
+                            sign = false         
+                        });
+                        if(!sign){
+                            return
+                        }
+                        this.$set(form,'functionCodes',[])
+                    }
+                }
+            }
             this.addType = type
             this.originFunction = form
             var ruleForm = {
-                apply:form.apply,
-                applyName:this.tableData.applyName,
+                // apply:form.apply,
+                // applyName:this.tableData.applyName,
                 sign:form.sign,
-                function: form.id || 0,
+                function: type == 2?form.id : 0,
                 functionType:1,
                 last:form.path?(form.last+'/'+form.name):form.name
             }
             this.$refs.addFunctionDialog.open(ruleForm)
         },
-        getNewFunction(value){},
+        getNewFunction(value){
+            let functionObj = value
+            functionObj.operateType = 1
+            if(this.addType == 1){//新增根功能
+                this.tableData.children.push(functionObj)
+            }else if(this.addType == 2){//新增子功能
+                this.originFunction.children.push(functionObj)
+            }
+            this.addType = null
+            this.originFunction = null
+        },
          //获取代码
          getCode(row,type){
             var data = row.functionCodes
@@ -53,7 +120,9 @@ export default{
         },
         //改变代码
         setCodeList_code(row,value,type){
-            row.operateType = this.model == 'edit'?3:1
+            if(!row.operateType){
+                row.operateType = this.model == 'edit'?3:1
+            }
             var data = row.functionCodes
             var obj = data.find(item=>{
                 return item.authType == type

+ 4 - 4
src/views/backStageManage/application/vision/components/mixins/treeChecked.js

@@ -43,7 +43,7 @@ export default{
             function getLevelStatus(row) {
                 //如果当前节点的parantId =0 并且有子节点,则为1
                 //如果当前节点的parantId !=0 并且子节点没有子节点 则为3
-                if (row.parentId == 0) {
+                if (row.function == 0) {
                     if (row.children && row.children.length) {
                         return 1;
                     }else{
@@ -70,12 +70,12 @@ export default{
                         getExplicitNode(item.children,parentId);
                     }
                 }
-                return {}
+                return result
             }
             function operateLastLeve(row) {
                 //操作的是子节点  1、获取父节点  2、判断子节点选中个数,如果全部选中则父节点设为选中状态,如果都不选中,则为不选中状态,如果部分选择,则设为不明确状态
                 let selectStatuaArr = [];
-                let item = getExplicitNode(that.tableData.children,row.parentId);
+                let item = getExplicitNode(that.tableData.children,row.function);
                 selectStatuaArr = getSelectStatus(selectStatuaArr, item.children);
                 if (
                     selectStatuaArr.every((selectItem) => {
@@ -107,7 +107,7 @@ export default{
                     // }
                 }
                 //则还有父级
-                if(item.parentId!=0) {
+                if(item.function!=0) {
                     operateLastLeve(item)
                 }
             }

+ 5 - 2
src/views/backStageManage/application/vision/editVersion.vue

@@ -5,7 +5,7 @@
 </template>
 
 <script>
-import VersionForm from './components/versionForm.vue';
+import VersionForm from './components/form/versionForm.vue';
 export default {
     components: {
         'version-form': VersionForm
@@ -17,7 +17,10 @@ export default {
     watch: {},
     computed: {
         versionId() {
-            return this.$route.query.id;
+            if(this.$route.path == '/administrator/editVersion'){
+                return this.$route.query.id;
+            }
+            
         },
     },
     created() {},

+ 30 - 0
src/views/backStageManage/application/vision/versionDetail.vue

@@ -0,0 +1,30 @@
+<template>
+    <div>
+        <version-form :versionId="versionId" model="detail"></version-form>
+    </div>
+</template>
+
+<script>
+import VersionForm from './components/form/versionForm.vue';
+export default {
+    components: {
+        'version-form': VersionForm
+    },
+    props: {},
+    data() {
+        return {};
+    },
+    watch: {},
+    computed: {
+        versionId() {
+            return this.$route.query.id;
+        },
+    },
+    created() {},
+    mounted() {},
+    methods: {},
+};
+</script>
+<style lang="scss" scoped>
+
+</style>

+ 92 - 16
src/views/backStageManage/application/vision/vision.vue

@@ -12,9 +12,7 @@
             </el-form-item>
             <el-form-item label="版本状态" prop="status">
               <el-select v-model="queryParams.status" placeholder="请选择版本状态">
-                <el-option :label="'已保存'" :value="1"></el-option>
-                <el-option :label="'调试'" :value="2"></el-option>
-                <el-option :label="'已发布'" :value="3"></el-option>
+                <el-option v-for="(item, key) in status" :key="key" :label="item" :value="key"></el-option>
               </el-select>
             </el-form-item>
             <el-form-item>
@@ -33,6 +31,7 @@
       <el-main class="padding_10">
         <el-table
             ref="table"
+            border
             :data="tableData"
             row-key="id"
             style="width: 100%"
@@ -40,7 +39,7 @@
             v-loading="loading"
             @sort-change="sortChange"
         >
-            <el-table-column type="index" align="center" width="120px">
+            <el-table-column type="index" label="序号" align="center" width="100px">
                 <template slot-scope="scope">
                     <div>
                         <el-checkbox-group v-model="checkList">
@@ -48,28 +47,51 @@
                         </el-checkbox-group>
                     </div>
                 </template>
-                
             </el-table-column>
 
-            <el-table-column prop="versionName" label="版本名称"></el-table-column>
-            <el-table-column prop="versionNum" label="版本号"></el-table-column>
-            <el-table-column prop="versionFile" label="版本文件"></el-table-column>
-            <el-table-column prop="status" label="版本状态"></el-table-column>
+            <el-table-column prop="versionName" label="版本名称">
+              <template slot-scope="scope">
+                <div>
+                  <el-link type="primary" @click="handleDetail(scope.row)">{{ scope.row.versionName }}</el-link>
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column prop="versionNum" label="版本号" width="100px"></el-table-column>
+            <el-table-column prop="versionFile" label="版本文件">
+              <template slot-scope="scope">
+                <div v-if="scope.row.systemFile && scope.row.systemFile.originalName">
+                  {{ scope.row.systemFile.originalName }}
+                </div>
+              </template>
+            </el-table-column>
+            <el-table-column prop="status" label="版本状态" width="100px">
+              <template slot-scope="scope">
+                <div>
+                  {{ status[scope.row.status] }}
+                </div>
+              </template>
+            </el-table-column>
             <el-table-column prop="remark" label="备注"></el-table-column>
+            <el-table-column prop="createTime" label="创建时间"></el-table-column>
 
-            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
+            <el-table-column label="操作" align="center" width="170px">
               <template slot-scope="scope">
-                <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">修改</el-button>
+                <template v-if="scope.row.status != 3">
+                  <el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(scope.row)">修改</el-button>
+                  <el-button size="mini" type="text" icon="el-icon-position" @click="release(scope.row)">发布</el-button>
+                </template>
+                <el-button size="mini" type="text" icon="el-icon-download" @click="downLoad(scope.row)">下载</el-button>
                 <el-button v-if="scope.row.id != 0" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除</el-button>
               </template>
             </el-table-column>
         </el-table>
       </el-main>
       <el-footer class="pagination">
-        <div>
+        <div class="foot">
             <div v-if="checkList.length>0">
               <el-button size="small" type="danger" @click="dels">删除{{ checkList.length }}条</el-button>
             </div>
+            <div v-else></div>
             <el-pagination background layout="total, sizes, prev, pager, next, jumper"
             :current-page.sync="queryParams.current" :page-size.sync="queryParams.size"
             @current-change="handleCurrentChange" @size-change="changeSize" :total="total">
@@ -82,12 +104,15 @@
 </template>
 
 <script>
+import { downLoad2 } from '@/utils';
+import commonData from './components/mixins/commonData';
 const searchForm = {
   versionName:'',
-  versionNum:''
+  versionNum:'',
+  status:'',
 }
 export default {
-
+  mixins:[commonData],
   components: {},
   props: {
   },
@@ -104,7 +129,6 @@ export default {
         current: 1,
         size: 10,
         ...searchForm,
-        status: ''
       },
     };
   },
@@ -170,7 +194,54 @@ export default {
         }
       });
     },
-
+    handleDetail(row){
+      this.$router.push({ 
+        path: '/administrator/versionDetail', 
+        query: {
+            id: row.id
+        }
+      });
+    },
+    //下载
+    downLoad(row){
+      if(!row.systemFile || !row.systemFile.guid){
+        this.$message.warning('该版本没有文件')
+        return
+      }
+      downLoad2(row.systemFile.guid,row.systemFile.originalName)
+    },
+    //发布
+    release(row){
+      var params = {
+        id:row.id,
+        status:3
+      }
+      var message = this.$message({
+        type:'warning',
+        message: '正在发布...',
+        duration: 0 // 设置为0表示不自动关闭
+      })
+      this.$api.updateVisionStatus(params).then(response=>{
+        if(response.code == 200){
+          message.close()
+          this.$message(
+            {
+              type:'success',
+              message:'发布成功'
+            }
+          )
+          this.$set(row,'status',3)
+        }
+      }).catch(error=>{
+        message.close()
+        this.$message(
+          {
+            type:'error',
+            message:'发布失败'
+          }
+        )
+      })
+    },
     //删除
     handleDelete(row){
       this.removeVersions([row.id])
@@ -219,4 +290,9 @@ export default {
   align-items: center;
   justify-content: space-between;
 }
+.foot{
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+}
 </style>

+ 1 - 1
src/views/backStageManage/home/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>12</div>
+  <div></div>
 </template>
 
 <script>

+ 1 - 1
src/views/backStageManage/layout/components/AppMain.vue

@@ -2,7 +2,7 @@
   <section class="app-main">
     <transition name="fade" mode="out-in">
       <keep-alive>
-          <router-view v-if="$route.meta.keepAlive"></router-view>
+          <router-view :key="$route.fullPath" v-if="$route.meta.keepAlive"></router-view>
       </keep-alive>
     </transition>
       <transition name="fade" mode="out-in">

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

@@ -7,7 +7,7 @@
     </div> -->
       <el-dropdown class="avatar-container" trigger="click">
         <div class="avatar-wrapper">
-          <img class="user-avatar" :src="$commonJS.getFile(avatar)">
+          <img class="user-avatar" :src="$commonJS.checkViewer(avatar)">
           <i class="el-icon-caret-bottom"></i>
         </div>
         <el-dropdown-menu class="user-dropdown" slot="dropdown">

+ 2 - 1
src/views/backStageManage/layout/components/history.vue

@@ -38,9 +38,10 @@ export default {
       }
     },
     tabRemove(path){
+      var sign = this.currentPath == path
       this.$store.commit('removeHistoryPath',path);
       this.$store.commit('removeHistory',path);
-      if(this.currentPath == path){
+      if(sign){
         this.tabClick(this.history[this.history.length-1])
       }
       

+ 17 - 15
src/views/home/components/downLoad/downLoad.vue

@@ -4,7 +4,7 @@
         <div>欢迎使用</div>
         <div>窍笔撰写辅助工具</div>
         <div class="downLoad">
-            <el-button round style="width:100%;color:black;font-size:16px;height:50px;font-weight:bold;" @click="submit">点击下载</el-button>
+            <el-button round style="width:100%;color:black;font-size:16px;height:50px;font-weight:bold;" @click="downLoad">点击下载</el-button>
         </div>
     </div>
     
@@ -12,11 +12,13 @@
 </template>
 
 <script>
+import { downLoad2 } from '@/utils';
 export default {
   components: {},
   props: {},
   data() {
     return {
+      btnLoading:false,
     };
   },
   watch: {},
@@ -24,21 +26,21 @@ export default {
   created() {},
   mounted() {},
   methods: {
-    submit(){
-        const anchor = document.createElement('a');
-        if ('download' in anchor) {
-            anchor.href = this.$c.downLoadURL;
-            anchor.setAttribute("download", '窍笔');
-            anchor.className = "download-js-link";
-            anchor.innerHTML = "downloading...";
-            anchor.style.display = "none";
-            document.body.appendChild(anchor);
-            setTimeout(function () {
-                anchor.click();
-                document.body.removeChild(anchor);
-            }, 66);
-            return true;
+    downLoad(){
+      var params = {
+      }
+      this.btnLoading = true
+      this.$api.queryPublicVersionLast(params).then(response=>{
+        if(response.code == 200){
+            var data = response.data
+            if(data.systemFile && data.systemFile.guid){
+              downLoad2(data.systemFile.guid,'窍笔')
+            }
+            this.btnLoading = false
         }
+      }).catch(error=>{
+          this.btnLoading = false
+      })
     },
   },
 };