فهرست منبع

版本管理、安装包上传下载,更新接口

fangq 4 سال پیش
والد
کامیت
e221805358

+ 50 - 0
src/api/ship/appversion.js

@@ -0,0 +1,50 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/ship/appversion/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+export const getDetail = (id) => {
+  return request({
+    url: '/api/ship/appversion/detail',
+    method: 'get',
+    params: {
+      id
+    }
+  })
+}
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/ship/appversion/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}
+
+export const add = (row) => {
+  return request({
+    url: '/api/ship/appversion/submit',
+    method: 'post',
+    data: row
+  })
+}
+
+export const update = (row) => {
+  return request({
+    url: '/api/ship/appversion/submit',
+    method: 'post',
+    data: row
+  })
+}
+

+ 89 - 90
src/styles/normalize.scss

@@ -29,48 +29,48 @@
  summary {
      display: block;
  }
- 
+
  /**
   * Correct `inline-block` display not defined in IE 8/9.
   *
   * 修正在 IE 8/9 中未定义的 'inline-block' 元素。
   */
- 
+
  audio,
  canvas,
  video {
      display: inline-block;
  }
- 
+
  /**
   * Prevent modern browsers from displaying `audio` without controls.
   * Remove excess height in iOS 5 devices.
   *
   * 阻止现在浏览器显示未定义 control 播放控件的 'audio' 声音元素。
-  * 删除 IOS 5 设备中显示的多余的高度。
+  * 删除 IOS 5 终端中显示的多余的高度。
   */
- 
+
  audio:not([controls]) {
      display: none;
      height: 0;
  }
- 
+
  /**
   * Address styling not present in IE 8/9.
   *
   * 处理 IE 8/9 中不存在的样式。
   */
- 
+
  [hidden] {
      display: none;
  }
- 
+
  /* ==========================================================================
     Base
- 
+
     基本设置
     ========================================================================== */
- 
+
  /**
   * 1. Set default font family to sans-serif.
   * 2. Prevent iOS text size adjust after orientation change, without disabling
@@ -79,129 +79,129 @@
   * 1. 设置默认字体类型为 sans-serif.
   * 2. 当用户放大或缩小页面时不改变字体大小。
   */
- 
+
  html {
      font-family: sans-serif; /* 1 */
      -ms-text-size-adjust: 100%; /* 2 */
      -webkit-text-size-adjust: 100%; /* 2 */
  }
- 
+
  /**
   * Remove default margin.
   *
   * 删除默认边距。
   */
- 
+
  body {
      margin: 0;
  }
- 
+
  /* ==========================================================================
     Links
- 
+
     链接
     ========================================================================== */
- 
+
  /**
   * Address `outline` inconsistency between Chrome and other browsers.
   *
   * 处理 Chrome 与其它浏览器中关于 'outline' 的不一致性。
   */
- 
+
  a:focus {
      outline: thin dotted;
  }
- 
+
  /**
   * Improve readability when focused and also mouse hovered in all browsers.
   *
   * 为所有浏览器改善当激活或悬停在元素上时元素内容的可读性。
   */
- 
+
  a:active,
  a:hover {
      outline: 0;
  }
- 
+
  /* ==========================================================================
     Typography
- 
+
     排版
     ========================================================================== */
- 
+
  /**
   * Address variable `h1` font-size and margin within `section` and `article`
   * contexts in Firefox 4+, Safari 5, and Chrome.
   *
-  * 处理多变的 'h1' 字体大小及其在 Firefox 4+, Safari 5, 及 Chrome时浏览器中的 
+  * 处理多变的 'h1' 字体大小及其在 Firefox 4+, Safari 5, 及 Chrome时浏览器中的
   * 'section' 与 'article' 元素中的边距。
   */
- 
+
  h1 {
      font-size: 2em;
      margin: 0.67em 0;
  }
- 
+
  /**
   * Address styling not present in IE 8/9, Safari 5, and Chrome.
   *
   * 处理在 IE 8/9, Safari 5, 及 Chrome 没有的样式。
   */
- 
+
  abbr[title] {
      border-bottom: 1px dotted;
  }
- 
+
  /**
   * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
   *
   * 处理 Firefox 4+, Safari 5, 及 Chrome 中默认的 'bolder' 样式为 'bold'.
   */
- 
+
  b,
  strong {
      font-weight: bold;
  }
- 
+
  /**
   * Address styling not present in Safari 5 and Chrome.
   *
   * 处理在 Safari 5 和 Chrome 没有的样式。
   */
- 
+
  dfn {
      font-style: italic;
  }
- 
+
  /**
   * Address differences between Firefox and other browsers.
   *
   * 处理 Firefox 与其它浏览器的差异。
   */
- 
+
  hr {
      -moz-box-sizing: content-box;
      box-sizing: content-box;
      height: 0;
  }
- 
+
  /**
   * Address styling not present in IE 8/9.
   *
   * 处理在 IE 8/9 中没有的样式。
   */
- 
+
  mark {
      background: #ff0;
      color: #000;
  }
- 
+
  /**
   * Correct font family set oddly in Safari 5 and Chrome.
   *
   * 修正确 Safari 5 和 Chrome 中古怪的默认字体。
   */
- 
+
  code,
  kbd,
  pre,
@@ -209,45 +209,45 @@
      font-family: monospace, serif;
      font-size: 1em;
  }
- 
+
  /**
   * Improve readability of pre-formatted text in all browsers.
   *
   * 为所有浏览器改善预格式化文本的可读性。
   */
- 
+
  pre {
      white-space: pre-wrap;
  }
- 
+
  /**
   * Set consistent quote types.
   *
   * 设置一致的引用格式。
   */
- 
+
  q {
      quotes: "\201C" "\201D" "\2018" "\2019";
  }
- 
+
  /**
   * Address inconsistent and variable font size in all browsers.
   *
   * 处理所有浏览器中字体大小的不一致性[译者注:原文直译为:处理所有
   * 浏览器中的不一致和多变的字体大小]。
   */
- 
+
  small {
      font-size: 80%;
  }
- 
+
  /**
   * Prevent `sub` and `sup` affecting `line-height` in all browsers.
   *
-  * 阻止所有浏览器中 'sub' 和 'sup' 元素影响 'line-height'. 
+  * 阻止所有浏览器中 'sub' 和 'sup' 元素影响 'line-height'.
   * [译者注:就是不让上标与下标影响行高。]
   */
- 
+
  sub,
  sup {
      font-size: 75%;
@@ -255,87 +255,87 @@
      position: relative;
      vertical-align: baseline;
  }
- 
+
  sup {
      top: -0.5em;
  }
- 
+
  sub {
      bottom: -0.25em;
  }
- 
+
  /* ==========================================================================
     Embedded content
- 
+
     嵌入的内容
     ========================================================================== */
- 
+
  /**
   * Remove border when inside `a` element in IE 8/9.
   *
   * 删除 IE 8/9 中当内容位于 'a' 中出现的边框。
   */
- 
+
  img {
      border: 0;
  }
- 
+
  /**
   * Correct overflow displayed oddly in IE 9.
   *
   * 修正 IE 9 中显示古怪的溢出内容。
   */
- 
+
  svg:not(:root) {
      overflow: hidden;
  }
- 
+
  /* ==========================================================================
     Figures
- 
+
     Figure 图像/图表/代码等
     ========================================================================== */
- 
+
  /**
   * Address margin not present in IE 8/9 and Safari 5.
   *
   * 处理在 IE 8/9 和 Safari 5 没有的边距。
   */
- 
+
  figure {
      margin: 0;
  }
- 
+
  /* ==========================================================================
     Forms
     ========================================================================== */
- 
+
  /**
   * Define consistent border, margin, and padding.
   *
   * 定义一致的边框、外边距及内边距。
   */
- 
+
  fieldset {
      border: 1px solid #c0c0c0;
      margin: 0 2px;
      padding: 0.35em 0.625em 0.75em;
  }
- 
+
  /**
   * 1. Correct `color` not being inherited in IE 8/9.
   * 2. Remove padding so people aren't caught out if they zero out fieldsets.
-  * 1. 修正在 IE 8/9 中没有继承的 'color'. 
+  * 1. 修正在 IE 8/9 中没有继承的 'color'.
   *
   *    [译者注:说是修正颜色嘛,可下面没有关于颜色的呀,这也行?求大神解释!]
   * 2. 去掉内边距,避免当用户清空表单组时认为出错了。
   */
- 
+
  legend {
      border: 0; /* 1 */
      padding: 0; /* 2 */
  }
- 
+
  /**
   * 1. Correct font family not being inherited in all browsers.
   * 2. Correct font size not being inherited in all browsers.
@@ -345,7 +345,7 @@
   * 2. 修正所有浏览器中未被继承的字体大小。
   * 3. 处理 Firefox 4+, Safari 5, 及 Chrome 中默认设置不同的外边距。
   */
- 
+
  button,
  input,
  select,
@@ -354,36 +354,36 @@
      font-size: 100%; /* 2 */
      margin: 0; /* 3 */
  }
- 
+
  /**
   * Address Firefox 4+ setting `line-height` on `input` using `!important` in
   * the UA stylesheet.
   *
   * 处理 Firefox 4+ 中的客户端样式表里使用 '!important' 设置的 'line-height'.
   */
- 
+
  button,
  input {
      line-height: normal;
  }
- 
+
  /**
   * Address inconsistent `text-transform` inheritance for `button` and `select`.
   * All other form control elements do not inherit `text-transform` values.
   * Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
   * Correct `select` style inheritance in Firefox 4+ and Opera.
-  * 
+  *
   * 处理 'button' 和 'select' 的 'text-transform' 继承的不一致性。
   * 所有其它表单控件元素不继承 'text-transform' 的值。
   * 修正 Chrome, Safari 5+, 及 IE 8+ 中 'button' 的继承样式。
   * 修正 Firefox 4+ 和 Opera 中 'select' 的继承样式。
   */
- 
+
  button,
  select {
      text-transform: none;
  }
- 
+
  /**
   * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
   *    and `video` controls.
@@ -395,7 +395,7 @@
   * 2. 修正 iOS 中不可点击的 'input' 样式。
   * 3. 改善图片类型的 'input' 等光标样式的可用性与一致性。
   */
- 
+
  button,
  html input[type="button"], /* 1 */
  input[type="reset"],
@@ -403,18 +403,18 @@
      -webkit-appearance: button; /* 2 */
      cursor: pointer; /* 3 */
  }
- 
+
  /**
   * Re-set default cursor for disabled elements.
-  * 
+  *
   * 重置不可用元素的默认光标样式。
   */
- 
+
  button[disabled],
  html input[disabled] {
      cursor: default;
  }
- 
+
  /**
   * 1. Address box sizing set to `content-box` in IE 8/9.
   * 2. Remove excess padding in IE 8/9.
@@ -422,13 +422,13 @@
   * 1. 处理 IE 8/9 中设置为 'content-box' 的盒子模型。
   * 2. 删除 IE 8/9 中多余的内边距。
   */
- 
+
  input[type="checkbox"],
  input[type="radio"] {
      box-sizing: border-box; /* 1 */
      padding: 0; /* 2 */
  }
- 
+
  /**
   * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
   * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
@@ -438,38 +438,38 @@
   * 2. 处理 Safari 5 和 Chrome 中默认设置为 'box-sizing' 的 'border-box'
   *    (包括不会过时的 '-moz').
   */
- 
+
  input[type="search"] {
      -webkit-appearance: textfield; /* 1 */
      -moz-box-sizing: content-box;
      -webkit-box-sizing: content-box; /* 2 */
      box-sizing: content-box;
  }
- 
+
  /**
   * Remove inner padding and search cancel button in Safari 5 and Chrome
   * on OS X.
   *
   * 删除 Safari 5 和 OS X 上的 Chrome 中的输入框上的内边距和搜索取消按钮。
   */
- 
+
  input[type="search"]::-webkit-search-cancel-button,
  input[type="search"]::-webkit-search-decoration {
      -webkit-appearance: none;
  }
- 
+
  /**
   * Remove inner padding and border in Firefox 4+.
   *
   * 删除 Firefox 4+ button 与 input 上的内边距。
   */
- 
+
  button::-moz-focus-inner,
  input::-moz-focus-inner {
      border: 0;
      padding: 0;
  }
- 
+
  /**
   * 1. Remove default vertical scrollbar in IE 8/9.
   * 2. Improve readability and alignment in all browsers.
@@ -477,26 +477,25 @@
   * 1. 删除 IE8/9 中默认的垂直滚动条。
   * 2. 改善所有浏览器中的可读性并使文本垂直对齐。
   */
- 
+
  textarea {
      overflow: auto; /* 1 */
      vertical-align: top; /* 2 */
  }
- 
+
  /* ==========================================================================
     Tables
- 
+
     表格
     ========================================================================== */
- 
+
  /**
   * Remove most spacing between table cells.
   *
   * 删除表格里单元格间的间距。
   */
- 
+
  table {
      border-collapse: collapse;
      border-spacing: 0;
  }
- 

+ 334 - 0
src/views/ship/appversion.vue

@@ -0,0 +1,334 @@
+<template>
+  <basic-container>
+    <avue-crud :option="option"
+               :table-loading="loading"
+               :data="data"
+               :page.sync="page"
+               :permission="permissionList"
+               :before-open="beforeOpen"
+               v-model="form"
+               ref="crud"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @row-del="rowDel"
+               @search-change="searchChange"
+               @search-reset="searchReset"
+               @selection-change="selectionChange"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange"
+               @on-load="onLoad">
+      <template slot="menuLeft">
+        <el-button type="danger"
+                   size="small"
+                   icon="el-icon-delete"
+                   plain
+                   v-if="permission.appversion_delete"
+                   @click="handleDelete">删 除
+        </el-button>
+      </template>
+
+      <template slot="downloadUrlForm" slot-scope="{row}">
+        <avue-form ref="form" :option="attachOption" v-model="attachForm" :upload-after="uploadAfter" :upload-error="uploadError" :upload-delete="uploadDelete" :upload-preview="uploadPreview">
+        </avue-form>
+      </template>
+
+      <template slot-scope="{row}" slot="menu">
+        <el-button type="text" icon="el-icon-download" size="small" v-if="permission.appversion_edit && row.downloadUrl" @click="handleDownload(row)">下载</el-button>
+      </template>
+    </avue-crud>
+  </basic-container>
+</template>
+
+<script>
+  import {getList, getDetail, add, update, remove} from "@/api/ship/appversion";
+  import {mapGetters} from "vuex";
+
+  export default {
+    data() {
+      return {
+
+        attachForm: {},
+        attachOption: {
+          submitBtn: false,
+          emptyBtn: false,
+          column: [
+            {
+              // label: '附件上传',
+              prop: 'attachFile',
+              type: 'upload',
+              // disabled: true,
+              drag: true,
+              loadText: '模板上传中,请稍等',
+              span: 24,
+              fileSize: 5120,
+              propsHttp: {
+                res: 'data'
+              },
+              name: "namesrc",
+              action: "/api/file/upload"
+            }
+          ]
+        },
+
+        form: {},
+        query: {},
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        selectionList: [],
+        option: {
+          height:'auto',
+          calcHeight: 30,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 6,
+          border: true,
+          index: true,
+          viewBtn: true,
+          selection: true,
+          dialogClickModal: false,
+          column: [
+            {
+              label: "版本名称",
+              prop: "versionName",
+              rules: [{
+                required: true,
+                message: "请输入版本名称",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "版本号",
+              prop: "versionNo",
+              rules: [{
+                required: true,
+                message: "请输入版本号",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "更新内容",
+              prop: "updateContent",
+              type: "textarea",
+              span: 24,
+              rules: [{
+                required: false,
+                message: "请输入更新内容",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "安装包",
+              prop: "downloadUrl",
+              formslot: true,
+              hide: true,
+              rules: [{
+                required: false,
+                message: "请输入下载地址",
+                trigger: "blur"
+              }]
+            },
+            {
+              label: "是否强制更新",
+              prop: "isForceUpdate",
+              type: "switch",
+              dicData: [
+                {label: '否',value: 0},
+                {label: '是',value: 1},
+                ],
+              rules: [{
+                required: false,
+                message: "请输入是否强制更新",
+                trigger: "blur"
+              }]
+            },
+
+          ]
+        },
+        data: []
+      };
+    },
+    computed: {
+      ...mapGetters(["permission"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.appversion_add, false),
+          viewBtn: this.vaildData(this.permission.appversion_view, false),
+          delBtn: this.vaildData(this.permission.appversion_delete, false),
+          editBtn: this.vaildData(this.permission.appversion_edit, false)
+        };
+      },
+      ids() {
+        let ids = [];
+        this.selectionList.forEach(ele => {
+          ids.push(ele.id);
+        });
+        return ids.join(",");
+      }
+    },
+    methods: {
+      handleDownload(row){
+        let arr = row.downloadUrl.split("/");
+        if (arr.length > 0) {
+          let filename = arr[arr.length - 1];
+          let linkNode = document.createElement("a");
+          linkNode.download = filename;
+          linkNode.style.display = 'none';
+          linkNode.href = row.downloadUrl;
+          document.body.appendChild(linkNode);
+          linkNode.click();
+          document.body.removeChild(linkNode);
+        }
+
+      },
+      uploadError(error,column){
+        this.$message.warning(error + ',不能大于' + column.fileSize + 'KB');
+      },
+      uploadAfter(res, done, loading, column) {
+        const file = res;
+        this.attachForm.attachFile = [file.name];
+        this.form.downloadUrl = file.link;
+        done(res);
+      },
+      uploadDelete(column,file) {
+        return this.$confirm(`是否确定移除该选项?`);
+      },
+      uploadPreview(){
+      },
+
+      rowSave(row, done, loading) {
+        debugger
+        /*add(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          window.console.log(error);
+        });*/
+      },
+      rowUpdate(row, index, done, loading) {
+        update(row).then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          });
+          done();
+        }, error => {
+          loading();
+          console.log(error);
+        });
+      },
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(row.id);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+          });
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据");
+          return;
+        }
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        })
+          .then(() => {
+            return remove(this.ids);
+          })
+          .then(() => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            });
+            this.$refs.crud.toggleSelection();
+          });
+      },
+      beforeOpen(done, type) {
+        this.attachOption.column[0].disabled = type == 'view';
+        // this.attachForm.attachFile = [file.name];
+        if (this.form.downloadUrl){
+          let arr = this.form.downloadUrl.split("/");
+          if (arr.length > 0){
+            let filename = arr[arr.length-1];
+            this.attachForm.attachFile = [
+              {label: filename, value: filename}
+            ];
+          }
+        }
+
+        /*if (["edit", "view"].includes(type)) {
+          getDetail(this.form.id).then(res => {
+            this.form = res.data.data;
+          });
+        }*/
+        done();
+      },
+      searchReset() {
+        this.query = {};
+        this.onLoad(this.page);
+      },
+      searchChange(params, done) {
+        this.query = params;
+        this.page.currentPage = 1;
+        this.onLoad(this.page, params);
+        done();
+      },
+      selectionChange(list) {
+        this.selectionList = list;
+      },
+      selectionClear() {
+        this.selectionList = [];
+        this.$refs.crud.toggleSelection();
+      },
+      currentChange(currentPage){
+        this.page.currentPage = currentPage;
+      },
+      sizeChange(pageSize){
+        this.page.pageSize = pageSize;
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query);
+      },
+      onLoad(page, params = {}) {
+        this.loading = true;
+        getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+          const data = res.data.data;
+          this.page.total = data.total;
+          this.data = data.records;
+          this.loading = false;
+          this.selectionClear();
+        });
+      }
+    }
+  };
+</script>
+
+<style scoped>
+  >>>.el-form-item__content{
+    margin-left: 10px !important;
+  }
+</style>
+

+ 2 - 1
src/views/ship/cable.vue

@@ -81,7 +81,7 @@
 
         <el-dropdown trigger="click">
           <span class="el-dropdown-link">
-            下拉菜单<i class="el-icon-arrow-down el-icon--right"></i>
+            操作<i class="el-icon-arrow-down el-icon--right"></i>
           </span>
           <el-dropdown-menu slot="dropdown">
             <el-dropdown-item>
@@ -1020,6 +1020,7 @@
         }, 100);
       },
       rowSave(row, done, loading) {
+        debugger
         add(row).then(() => {
           this.onLoad(this.page);
           this.$message({

+ 10 - 1
src/views/ship/device.vue

@@ -1,5 +1,5 @@
 <template>
-  <basic-container>
+  <basic-container id="mydiv">
     <avue-crud :option="option"
                :table-loading="loading"
                :data="data"
@@ -87,6 +87,7 @@
           border: true,
           index: true,
           viewBtn: true,
+          searchShowBtn: false,
           selection: true,
           dialogClickModal: false,
           align: "center",
@@ -131,6 +132,10 @@
                 trigger: "blur"
               }]
             },
+            {
+              label: "最后更新时间",
+              prop: "lastUpateTime",
+            },
           ]
         },
         data: []
@@ -160,6 +165,10 @@
         this.userList = data;
       });
     },
+    mounted() {
+      let mydiv = document.getElementById("mydiv");
+      debugger
+    },
     methods: {
       showSelect(row){
         this.form = row;

+ 1 - 0
src/views/ship/shipyard.vue

@@ -92,6 +92,7 @@
           height:'auto',
           calcHeight: 30,
           tip: false,
+          // searchBtn: false,
           searchShow: true,
           searchMenuSpan: 6,
           searchSpan: 12,

+ 1 - 1
src/views/wel/index.vue

@@ -61,7 +61,7 @@
           submitBtn : false,
           column: [
             {
-              label: '搜索内容',
+              label: '电缆代号',
               prop: 'search',
               type: 'search',
               span: 24,

+ 10 - 0
vue.config.js

@@ -33,6 +33,16 @@ module.exports = {
         pathRewrite: {
           '^/api': '/'
         }
+      },
+      '/file': {
+        //本地服务接口地址
+        target: 'http://localhost:9528',
+        //远程演示服务地址
+        //target: 'https://saber.bladex.vip/api',
+        ws: true,
+        pathRewrite: {
+          '^/file': '/file'
+        }
       }
     }
   }