xiaodai2022 2 years ago
parent
commit
5f800ca4b8

File diff suppressed because it is too large
+ 8 - 0
dist/static/js/0.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/1.js


File diff suppressed because it is too large
+ 11 - 11
dist/static/js/app.js


File diff suppressed because it is too large
+ 0 - 0
dist/static/js/chunk-libs.js


+ 1 - 0
package.json

@@ -60,6 +60,7 @@
     "vue-puzzle-verification": "^1.0.2",
     "vue-quill-editor": "^3.0.6",
     "vue-splitpane": "1.0.4",
+    "vue2-editor": "^2.10.3",
     "vuedraggable": "2.20.0",
     "vuex": "^3.1.0",
     "xlsx": "0.14.1"

+ 6 - 4
src/apis/service/system/updates/index.js

@@ -1,7 +1,9 @@
 // 版本日志
-import http from '@/apis/axios'
-const api = 'admin/'
+import http from "@/apis/axios";
+const api = "admin/";
 export default {
   // 分页查询
-  list: (data, params) => http(api + 'versionlist', data, 'post', params)
-}
+  list: (data, params) => http(api + "versionlist", data, "post", params),
+  // 分页查询
+  add: (data, params) => http(api + "versionAdd", data, "post", params),
+};

+ 214 - 0
src/views/system/updates/addEdit.vue

@@ -0,0 +1,214 @@
+<template>
+  <el-dialog
+    v-loading="loading"
+    :title="title"
+    :center="true"
+    align="left"
+    top="8vh"
+    width="1040px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    @close="showModelThis = false"
+  >
+    <el-card style="margin: -20px 0 0 0">
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-form
+            ref="ruleForm"
+            :model="ruleForm"
+            status-icon
+            :rules="rulesThis"
+            label-width="80px"
+            class="demo-ruleForm"
+          >
+            <el-row>
+              <el-col :span="12">
+                <el-form-item label="类型" prop="sys_type">
+                  <el-select
+                    v-model="ruleForm.sys_type"
+                    style="width: 100%"
+                    :disabled="id == '007'"
+                    placeholder="请选择类型"
+                  >
+                    <el-option
+                      v-for="item in options"
+                      :key="item.value"
+                      :label="item.label"
+                      :value="item.value"
+                    >
+                    </el-option>
+                  </el-select> </el-form-item
+              ></el-col>
+              <el-col :span="12">
+                <el-form-item label="版本号" prop="version">
+                  <el-input
+                    v-model="ruleForm.version"
+                    :disabled="id == '007'"
+                    placeholder="版本号"
+                    style="width: 100%"
+                    maxlength="50"
+                  /> </el-form-item
+              ></el-col>
+              <el-col :span="12">
+                <el-form-item label="标题" prop="module">
+                  <el-input
+                    v-model="ruleForm.module"
+                    :disabled="id == '007'"
+                    placeholder="标题"
+                    style="width: 100%"
+                    maxlength="50"
+                  /> </el-form-item
+              ></el-col>
+              <el-col :span="12">
+                <el-form-item label="时间" prop="addtime">
+                  <el-date-picker
+                    v-model="ruleForm.addtime"
+                    type="datetime"
+                    style="width: 100%"
+                    value-format="yyyy-MM-dd HH:mm:ss"
+                    placeholder="选择日期时间"
+                    :picker-options="pickerOptions"
+                  >
+                  </el-date-picker> </el-form-item
+              ></el-col>
+              <el-col :span="24">
+                <el-form-item label="内容" prop="system">
+                  <vue-editor v-model="ruleForm.system"></vue-editor>
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+        <el-col :span="24" style="text-align: right">
+          <el-button v-if="id !== '007'" type="primary" @click="submitForm"
+            >保 存
+          </el-button>
+          <el-button @click="showModelThis = false">{{
+            id == "007" ? "关 闭" : "取 消"
+          }}</el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import asyncRequest from "@/apis/service/system/updates";
+import resToken from "@/mixins/resToken";
+
+import { VueEditor } from "vue2-editor";
+export default {
+  name: "terrace",
+  props: ["showModel"],
+  mixins: [resToken],
+  components: {
+    VueEditor,
+  },
+  data() {
+    return {
+      loading: false,
+      title: "添加版本信息",
+      showModelThis: this.showModel,
+      pickerOptions: {
+        disabledDate: (time) => {
+          return time.getTime() < new Date().valueOf();
+        },
+      },
+      options: [
+        { value: "VER", label: "版本信息" },
+        { value: "MSG", label: "维护通知" },
+      ],
+
+      ruleForm: {
+        sys_type: "VER",
+        version: "",
+        module: "",
+        system: "",
+        addtime: "",
+      },
+      rulesThis: this.rules,
+      rules: {
+        sys_type: [{ required: true, message: "请选择类型", trigger: "change" }],
+        version: [{ required: true, message: "版本号不能为空", trigger: "blur" }],
+        module: [{ required: true, message: "标题不能为空", trigger: "blur" }],
+        system: [{ required: true, message: "内容不能为空", trigger: "blur" }],
+        addtime: [{ required: true, message: "请选择时间", trigger: "change" }],
+      },
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  methods: {
+    async initForm() {
+      this.loading = true;
+      this.rulesThis = this.rules;
+      await this.resetForm();
+      this.loading = false;
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          this.ruleForm = {
+            sys_type: "VER",
+            version: "",
+            module: "",
+            system: "",
+            addtime: "",
+          };
+        }
+      });
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        if (valid) {
+          if (this.loading) {
+            return;
+          }
+          this.loading = true;
+          const model = JSON.parse(JSON.stringify(this.ruleForm));
+          const { code, data, message } = await asyncRequest.add(model);
+
+          if (code === 0) {
+            this.$notify.success({
+              title: "添加成功!",
+              message: "",
+            });
+            this.showModelThis = false;
+            // 刷新
+            this.$emit("refresh");
+          } else if (code >= 100 && code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(message);
+          }
+          this.loading = false;
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+.terrace {
+}
+</style>

+ 48 - 45
src/views/system/updates/index.vue

@@ -1,8 +1,29 @@
 <template>
   <div class="updates pagePadding" style="padding-top: 25px">
-    <div
-      v-if=" powers.some((i) => i == '001')"
-    >
+    <div v-if="powers.some((i) => i == '001')">
+      <el-row style="padding: 0 0 10px 0">
+        <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
+          <el-button type="primary" :size="searchSize" @click="searchList">
+            刷新
+          </el-button>
+        </el-col>
+        <el-col
+          :span="3"
+          class="fr"
+          style="width: 66px; padding: 0 0 0 10px"
+          v-if="powers.some((i) => i == '003')"
+        >
+          <el-button
+            :size="searchSize"
+            type="success"
+            style="float: right"
+            @click="showModel = true"
+          >
+            添加
+          </el-button>
+        </el-col>
+      </el-row>
+
       <el-table
         :data="tableData"
         v-loading="loading"
@@ -13,12 +34,7 @@
       >
         <el-table-column type="expand">
           <template slot-scope="props">
-            <el-form
-              :size="size"
-              label-position="top"
-              inline
-              class="demo-table-expand"
-            >
+            <el-form :size="size" label-position="top" inline class="demo-table-expand">
               <el-form-item label="更新内容">
                 <p v-html="props.row.system"></p>
               </el-form-item>
@@ -47,24 +63,27 @@
       </div>
     </div>
     <no-auth v-else></no-auth>
+    <!-- 弹窗 新增/修改 -->
+    <add-edit :show-model="showModel" @refresh="searchList" @cancel="showModel = false" />
   </div>
 </template>
 <script>
 import asyncRequest from "@/apis/service/system/updates";
-import mixinPage from "@/mixins/elPaginationHandle";
 import { mapGetters } from "vuex";
 import resToken from "@/mixins/resToken";
+import addEdit from "./addEdit";
 export default {
   name: "updates",
-  mixins: [mixinPage, resToken],
+  components: {
+    addEdit,
+  },
+  mixins: [resToken],
   computed: {
     //组件SIZE设置
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
       const tran =
-        this.$store.getters.btnList.find(
-          (item) => item.menu_route == "updates"
-        ) || {};
+        this.$store.getters.btnList.find((item) => item.menu_route == "updates") || {};
       const { action } = tran ?? {};
       return action ?? [];
     },
@@ -73,10 +92,7 @@ export default {
     return {
       loading: true,
       showModel: false,
-      isDetail: false,
-      modelId: 0,
       parmValue: {
-        type: "VER",
         page: 1, // 页码
         size: 15, // 每页显示条数
       },
@@ -90,30 +106,24 @@ export default {
     this.searchList();
   },
   methods: {
-    restSearch() {
-        // 表格 - 分页
-      this.pageInfo = {
-        size: 15,
-        curr: 1,
-        total: 0,
-      };
-      this.parmValue = {
-        type: "VER",
-        page: 1, // 页码
-        size: 15, // 每页显示条数
-      };
-      this.count = 0;
-      this.searchList();
+    async handlePageChange(e) {
+      this.parmValue.page = e;
+      await this.searchList();
+    },
+    async handleSizeChange(e) {
+      this.parmValue.size = e;
+      this.parmValue.page = 1;
+      await this.searchList();
     },
-
     // 刷新表格
     async searchList() {
       this.loading = true;
-      const res = await asyncRequest.list(this.parmValue);
-      if (res && res.code === 0 && res.data) {
-        this.tableData = res.data.list;
-        this.count = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
+      const { code, data } = await asyncRequest.list(this.parmValue);
+      if (code === 0) {
+        const { list, count } = data;
+        this.tableData = list;
+        this.count = Number(count);
+      } else if (code >= 100 && code <= 104) {
         await this.logout();
       } else {
         this.tableData = [];
@@ -125,11 +135,4 @@ export default {
 };
 </script>
 
-<style lang="scss" scoped>
-</style>
-
-
-
-
-
-
+<style lang="scss" scoped></style>

Some files were not shown because too many files changed in this diff