Quellcode durchsuchen

新加升级模块

Qukatie vor 1 Woche
Ursprung
Commit
a4abba8047

Datei-Diff unterdrückt, da er zu groß ist
+ 114 - 114
package-lock.json


+ 56 - 0
src/api/application/application.js

@@ -0,0 +1,56 @@
+import request from '@/router/axios';
+
+// 锁定列表查询
+export const appList = (current, size, params) => {
+  return request({
+    url: '/api/blade-user/app/list',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+export function appSave(data) {
+  return request({
+    url: '/api/blade-user/app/save',
+    method: 'post',
+    data: data
+  })
+}
+export function appUpdate(data) {
+  return request({
+    url: '/api/blade-user/app/update',
+    method: 'post',
+    data: data
+  })
+}
+export function appDetail(id) {
+  return request({
+    url: '/api/blade-user/app/detail',
+    method: 'get',
+    params: {
+      id:id
+    }
+  })
+}
+export function appRemove(id) {
+  return request({
+    url: '/api/blade-user/app/remove',
+    method: 'post',
+    params:{
+      ids:id
+    }
+  })
+}
+export function appDetailRemove(id) {
+  return request({
+    url: '/api/blade-user/appversion/remove',
+    method: 'post',
+    params:{
+      ids:id
+    }
+  })
+}
+

+ 14 - 0
src/router/views/index.js

@@ -635,5 +635,19 @@ export default [
             },
             component: () => import( /* webpackChunkName: "views" */ '@/views/imageShop/index.vue')
         }]
+    },
+    {
+        path: '/system/application/index',
+        component: Layout,
+        hidden: true,
+        children: [{
+            path: '/system/application/index',
+            name: 'APP应用',
+            meta: {
+                i18n: '/system/application/index',
+                keepAlive: true,
+            },
+            component: () => import( /* webpackChunkName: "views" */ '@/views/system/application/index.vue')
+        }]
     }
 ];

+ 94 - 0
src/views/system/application/config/detailsPage.json

@@ -0,0 +1,94 @@
+{
+  "lazy": true,
+  "tip": false,
+  "simplePage": true,
+  "searchShow": true,
+  "addBtn":false,
+  "editBtn":false,
+  "addRowBtn":false,
+  "cellBtn":false,
+  "cancelBtn":false,
+  "refreshBtn": false,
+  "searchMenuSpan": 6,
+  "align": "center",
+  "delBtn":false,
+  "dialogWidth": "60%",
+  "tree": true,
+  "border": true,
+  "index": true,
+  "selection": false,
+  "menuWidth": 150,
+  "dialogClickModal": false,
+  "column": [
+    {
+      "label": "版本名称",
+      "prop": "versionName",
+      "overHidden": true,
+      "cell":true,
+      "width": 250,
+      "index": 1,
+      "rules": [
+        {
+          "required": true,
+          "message": "请输入版本名称",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "最低版本",
+      "prop": "versionCode",
+      "overHidden": true,
+      "cell":true,
+      "width": 180,
+      "index": 2,
+      "rules": [
+        {
+          "required": true,
+          "message": "请输入版本号",
+          "trigger": "blur"
+        }
+      ]
+    },
+    {
+      "label": "最新版本",
+      "prop": "lastVersionCode",
+      "overHidden": true,
+      "cell": true,
+      "width": 180,
+      "index": 4
+    },
+    {
+      "label": "下载地址",
+      "prop": "downloadUrl",
+      "overHidden": true,
+      "width": 430,
+      "index": 5
+    },
+    {
+      "label": "版本描述",
+      "prop": "versionDesc",
+      "overHidden": true,
+      "width": 360,
+      "index": 6
+    },
+    {
+      "label": "是否发布",
+      "prop": "isRelease",
+      "type": "select",
+      "dicData": [
+        {
+        "label": "是",
+        "value": 1
+      },
+        {
+          "label": "否",
+          "value": 0
+        }
+      ],
+      "overHidden": true,
+      "width": 120,
+      "index": 7
+    }
+  ]
+}

+ 66 - 0
src/views/system/application/config/mainList.json

@@ -0,0 +1,66 @@
+{
+  "searchShow": true,
+  "searchMenuSpan": 8,
+  "searchSpan": 8,
+  "border": true,
+  "index": true,
+  "viewBtn": false,
+  "editBtn": false,
+  "delBtn": false,
+  "addBtn": true,
+  "addBtnText": "新单",
+  "align": "center",
+  "menuWidth": "120",
+  "menu": true,
+  "showSummary": true,
+  "searchIcon": true,
+  "searchIndex": 2,
+  "selection": false,
+  "tip":false,
+  "expand": false,
+  "expandWidth": 38,
+  "column": [
+    {
+      "label": "app名称",
+      "prop": "appName",
+      "index": 1,
+      "overHidden": true
+    },
+    {
+      "label": "app应用描述",
+      "prop": "appDesc",
+      "index": 2,
+      "overHidden": true
+    },
+    {
+      "label": "类型",
+      "prop": "type",
+      "type": "select",
+      "search": true,
+      "overHidden": true,
+      "index": 3,
+      "width": 120,
+      "dicData": [
+        {
+          "label": "安卓",
+          "value": "0"
+        },
+        {
+          "label": "苹果",
+          "value": "1"
+        }]
+    },
+    {
+      "label": "苹果appStoreId",
+      "prop": "appStoreId",
+      "index": 4,
+      "overHidden": true
+    },
+    {
+      "label": "苹果bundleId",
+      "prop": "bundleId",
+      "index": 5,
+      "overHidden": true
+    }
+  ]
+}

+ 369 - 0
src/views/system/application/detailsPage.vue

@@ -0,0 +1,369 @@
+<template>
+  <div class="borderless">
+    <div class="customer-head">
+      <div class="customer-back">
+        <el-button
+          type="danger"
+          style="border: none; background: none; color: red"
+          icon="el-icon-arrow-left"
+          @click="backToList"
+          >返回列表
+        </el-button>
+        <div class="upper_right_button">
+          <el-button
+            class="el-button--small-yh"
+            type="primary"
+            size="small"
+            :loading="buttonLoading"
+            @click.stop="saveData"
+            >保存数据
+          </el-button>
+        </div>
+      </div>
+    </div>
+    <div class="customer-main">
+      <containerTitle title="基础信息"></containerTitle>
+      <basic-container>
+        <avue-form class="trading-form" ref="form" v-model="form" :option="option">
+          <template slot="remark">
+            <el-input type="textarea" v-model="form.remark" size="small" rows="2" autocomplete="off" placeholder="">
+            </el-input>
+          </template>
+        </avue-form>
+      </basic-container>
+      <containerTitle title="明细列表"></containerTitle>
+      <basic-container>
+        <avue-crud
+          :option="itemsOption"
+          :data="dataList"
+          ref="crud"
+          v-model="itemsForm"
+          @search-reset="searchReset"
+          @row-update="rowUpdate"
+          @selection-change="selectionChange"
+          @current-change="currentChange"
+          @size-change="sizeChange"
+          @refresh-change="refreshChange"
+        >
+          <template slot="downloadUrl" slot-scope="{ row }">
+            <el-input v-if="row.$cellEdit" v-model="row.downloadUrl" style="width: 80%" size="small"> </el-input>
+            <el-button style="width: 20%" size="small" v-if="row.$cellEdit" @click="uploadFiles(row)"> 附件 </el-button>
+            <span v-else>{{ row.downloadUrl }}</span>
+          </template>
+          <template slot="versionDesc" slot-scope="{ row }">
+            <el-input
+              type="textarea"
+              v-if="row.$cellEdit"
+              v-model="row.versionDesc"
+              size="small"
+              autosize
+              placeholder=""
+            >
+            </el-input>
+            <span v-else>{{ row.versionDesc }}</span>
+          </template>
+          <template slot="isRelease" slot-scope="{ row, index }">
+            <el-select v-if="row.$cellEdit" v-model="row.isRelease" size="small" @change="isReleaseChange(row, index)">
+              <el-option v-for="(item, index) in isReleaseList" :key="index" :label="item.label" :value="item.value">
+              </el-option>
+            </el-select>
+            <span v-else>{{ row.isRelease === 1 ? "是" : "否" }}</span>
+          </template>
+          <template slot="menuLeft">
+            <el-button type="primary" size="small" :loading="buttonLoading" @click="addDetail">录入明细 </el-button>
+          </template>
+          <template slot-scope="scope" slot="menu">
+            <el-button type="text" size="small" icon="el-icon-edit" @click.stop="rowCell(scope.row, scope.index)">
+              {{ scope.row.$cellEdit ? "修改完成" : "修改" }}
+            </el-button>
+            <el-button type="text" size="small" icon="el-icon-delete" @click.stop="rowDel(scope.row, scope.index)"
+              >删除
+            </el-button>
+          </template>
+        </avue-crud>
+      </basic-container>
+      <el-dialog title="上传附件" append-to-body :visible.sync="excelBox" width="555px" v-dialog-drag>
+        <avue-form
+          :option="excelOption"
+          v-model="excelForm"
+          table-loading="excelLoading"
+          :upload-before="uploadBefore"
+          :upload-after="uploadAfter"
+        >
+        </avue-form>
+      </el-dialog>
+    </div>
+  </div>
+</template>
+
+<script>
+import option from "./config/detailsPage.json";
+import { appSave, appDetail, appDetailRemove } from "@/api/application/application";
+
+export default {
+  name: "receiptDetailsPage",
+  props: {
+    detailData: {
+      type: Object,
+    },
+  },
+  components: {},
+  data() {
+    return {
+      buttonLoading: false,
+      form: {},
+      itemsForm: {},
+      dataList: [],
+      itemsOption: option,
+      option: {
+        menuBtn: false,
+        labelWidth: 100,
+        column: [
+          {
+            label: "app名称",
+            prop: "appName",
+            span: 8,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "应用描述",
+            prop: "appDesc",
+            span: 8,
+          },
+          {
+            label: "类型",
+            prop: "type",
+            type: "select",
+            dicData: [
+              {
+                label: "安卓",
+                value: 0,
+              },
+              {
+                label: "苹果",
+                value: 1,
+              },
+            ],
+            span: 8,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "苹果appStoreId",
+            prop: "appStoreId",
+            span: 8,
+          },
+          {
+            label: "苹果bundleId",
+            prop: "bundleId",
+            span: 8,
+          },
+          {
+            label: "包名",
+            prop: "packageName",
+            span: 8,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur",
+              },
+            ],
+          },
+        ],
+      },
+      selectRow: {},
+      isReleaseList: [
+        {
+          label: "是",
+          value: 1,
+        },
+        {
+          label: "否",
+          value: 0,
+        },
+      ],
+      excelBox: false,
+      excelLoading: false,
+      excelForm: {},
+      excelOption: {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+          {
+            label: "附件上传",
+            prop: "excelFile",
+            type: "upload",
+            drag: true,
+            dataType: "string",
+            loadText: "模板上传中,请稍等",
+            span: 24,
+            propsHttp: {
+              res: "data",
+              url: "link",
+            },
+            action: "/api/blade-resource/oss/endpoint/put-file",
+          },
+        ],
+      },
+      oldForm: {},
+      oldDataList: [],
+    };
+  },
+  created() {
+    if (this.detailData.id) {
+      this.buttonLoading = true;
+      appDetail(this.detailData.id)
+        .then((res) => {
+          this.afterEcho(res.data.data);
+        })
+        .finally(() => {
+          this.buttonLoading = false;
+        });
+    }
+  },
+  watch: {
+    "excelForm.excelFile"(val) {
+      this.selectRow.downloadUrl = val;
+    },
+  },
+  mounted() {},
+  methods: {
+    isReleaseChange(row, indexs) {
+      if (row.isRelease === 1) {
+        //如果其他版本有发布的
+        let yes;
+        this.dataList.map((item, index) => {
+          if (indexs != index && item.isRelease === 1) {
+            yes = true;
+          }
+        });
+        if (yes) {
+          this.$message.warning("已有其他版本发布!");
+          row.isRelease = 0;
+        }
+      }
+    },
+    uploadFiles(row) {
+      this.selectRow = row;
+      this.excelBox = true;
+    },
+    uploadBefore(file, done, loading) {
+      done();
+      loading = true;
+    },
+    uploadAfter(res, done, loading, column) {
+      this.excelBox = false;
+      this.$message.success("上传成功!");
+      loading = false;
+      done();
+    },
+    rowUpdate(row, index, done) {
+      done(row);
+    },
+    rowCell(row, index) {
+      this.$refs.crud.rowCell(row, index);
+    },
+    rowDel(row, index) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        if (row.id) {
+          appDetailRemove(row.id).then((res) => {
+            if (res.data.success) {
+              this.$message.success("操作成功!");
+              this.dataList.splice(index, 1);
+            }
+          });
+        } else {
+          this.dataList.splice(index, 1);
+        }
+      });
+    },
+    addDetail() {
+      this.$refs.crud.rowCellAdd();
+    },
+    searchReset() {
+      console.log("1");
+    },
+    selectionChange() {
+      console.log("1");
+    },
+    currentChange() {
+      console.log("1");
+    },
+    sizeChange() {
+      console.log("1");
+    },
+    refreshChange() {
+      console.log("1");
+    },
+    saveData(type) {
+      this.buttonLoading = true;
+      let params = {
+        ...this.form,
+        appVersionList: this.dataList,
+      };
+      appSave(params)
+        .then((res) => {
+          if (res.data.success) {
+            this.$message.success("操作成功!");
+            this.afterEcho(res.data.data);
+          }
+        })
+        .finally(() => {
+          this.buttonLoading = false;
+          if (type === true) {
+            this.$emit("goBack");
+          }
+        });
+    },
+    afterEcho(data) {
+      this.form = data;
+      this.oldForm = Object.assign({}, data);
+
+      if (data.appVersionList) {
+        this.dataList = data.appVersionList;
+        this.oldDataList = this.deepClone(data.appVersionList);
+      }
+    },
+    backToList() {
+      this.$emit("goBack"); 
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+::v-deep .el-form-item {
+  margin-bottom: 0;
+}
+
+.trading-form ::v-deep .el-form-item {
+  margin-bottom: 8px !important;
+}
+.required_fields {
+  color: #f56c6c;
+  display: inline-block;
+  width: 7%;
+}
+.upper_right_button {
+  display: flex;
+  position: fixed;
+  right: 12px;
+  top: 47px;
+}
+</style>

+ 230 - 0
src/views/system/application/index.vue

@@ -0,0 +1,230 @@
+<template>
+  <div>
+    <basic-container v-if="show">
+      <avue-crud
+        :option="option"
+        :data="dataList"
+        ref="crud"
+        v-model="form"
+        :page.sync="page"
+        :search.sync="search"
+        :table-loading="loading"
+        :before-open="beforeOpen"
+        @row-update="rowUpdate"
+        @row-save="rowSave"
+        @search-change="searchChange"
+        @search-reset="searchReset"
+        @selection-change="selectionChange"
+        @current-change="currentChange"
+        @size-change="sizeChange"
+        @refresh-change="refreshChange"
+        @on-load="onLoad"
+      >
+        <template slot-scope="{row,index}" slot="menu">
+          <el-button type="text" size="small" @click.stop="editOpen(row)">编辑 </el-button>
+          <el-button type="text" size="small" @click.stop="rowDel(row,index)">删除 </el-button>
+        </template>
+        <template slot-scope="scope" slot="type">
+          <span>{{ scope.row.type === 0 ? "安卓" : "苹果" }}</span>
+        </template>
+      </avue-crud>
+    </basic-container>
+    <detail-page ref="detail" @goBack="goBack" :detailData="detailData" v-else></detail-page>
+  </div>
+</template>
+
+<script>
+// @ts-nocheck
+import option from "./config/mainList.json";
+import detailPage from "./detailsPage.vue";
+import { appList, appSave, appUpdate, appRemove } from "@/api/application/application";
+
+export default {
+  data() {
+    return {
+      loading: false,
+      form: {},
+      search: {},
+      show: true,
+      detailData: {},
+      option: {
+        searchShow: true,
+        searchMenuSpan: 8,
+        searchSpan: 8,
+        border: true,
+        index: true,
+        viewBtn: false,
+        editBtn: false,
+        delBtn: false,
+        addBtn: true,
+        addBtnText: "新单",
+        align: "center",
+        menuWidth: "120",
+        menu: true,
+        showSummary: true,
+        searchIcon: true,
+        searchIndex: 2,
+        selection: false,
+        tip: false,
+        expand: false,
+        expandWidth: 38,
+        column: [
+          {
+            label: "app名称",
+            prop: "appName",
+            index: 1,
+            overHidden: true,
+          },
+          {
+            label: "app应用描述",
+            prop: "appDesc",
+            index: 2,
+            overHidden: true,
+          },
+          {
+            label: "类型",
+            prop: "type",
+            type: "select",
+            search: true,
+            overHidden: true,
+            index: 3,
+            width: 120,
+            dicData: [
+              {
+                label: "安卓",
+                value: "0",
+              },
+              {
+                label: "苹果",
+                value: "1",
+              },
+            ],
+          },
+          {
+            label: "苹果appStoreId",
+            prop: "appStoreId",
+            index: 4,
+            overHidden: true,
+          },
+          {
+            label: "苹果bundleId",
+            prop: "bundleId",
+            index: 5,
+            overHidden: true,
+          },
+        ],
+      },
+      parentId: 0,
+      dataList: [],
+      page: {
+        currentPage: 1,
+        total: 0,
+        pageSize: 10,
+        pageSizes: [10, 50, 100, 200, 300, 400, 500, 1000],
+      },
+      query: {},
+    };
+  },
+  components: {
+    detailPage,
+  },
+  async created() {
+    // this.option = await this.getColumnData(this.getColumnName(75), option);
+  },
+  mounted() {},
+  methods: {
+    beforeOpen() {
+      this.show = false;
+    },
+    rowSave(row, done, loading) {
+      appSave(row).then(() => {
+        this.onLoad(this.page, this.search);
+        this.$message({
+          type: "success",
+          message: "操作成功!",
+        });
+        done();
+      });
+    },
+    rowUpdate(row, index, done, loading) {
+      appUpdate(row).then(() => {
+        this.onLoad(this.page, this.search);
+        this.$message({
+          type: "success",
+          message: "操作成功!",
+        });
+        done();
+      });
+    },
+    rowDel(row, index, done) {
+      if (row.id) {
+        this.$confirm("确定将选择数据删除?", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        }).then(() => {
+          appRemove(row.id).then((res) => {
+            if (res.data.success) {
+              this.$message.success("操作成功!");
+              this.onLoad(this.page, this.search);
+            }
+          });
+        });
+      }
+    },
+    editOpen(row) {
+      this.detailData = {
+        id: row.id,
+      };
+      this.show = false;
+    },
+
+    //点击搜索按钮触发
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done();
+    },
+    searchReset() {
+      console.log("1");
+    },
+    selectionChange() {
+      console.log("1");
+    },
+    sizeChange(val) {
+      this.page.currentPage = 1;
+      this.page.pageSize = val;
+    },
+    currentChange(val) {
+      this.page.currentPage = val;
+      this.onLoad(this.page);
+    },
+    refreshChange() {
+      this.onLoad(this.page);
+    },
+    paramsAdjustment(params) {
+      params = Object.assign({}, this.search);
+      return params;
+    },
+
+    onLoad(page, params) {
+      this.loading = true;
+      params = this.paramsAdjustment(params);
+
+      appList(page.currentPage, page.pageSize, params).then((res) => {
+        this.dataList = res.data.data.records;
+        this.page.total = res.data.data.total;
+        this.loading = false;
+      });
+    },
+    goBack() {
+      this.detailData = this.$options.data().detailData;
+      this.show = true;
+      this.onLoad(this.page, this.search);
+    },
+  },
+};
+</script>
+
+<style scoped></style>

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.