From f5641fd76ef90a66599e8ce121f3acfd97d779e8 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 16 Jul 2021 11:44:43 +0800
Subject: [PATCH] 样式

---
 src/views/article/article.vue |  554 ++++++++++++++++++++++++++++--------------------------
 1 files changed, 286 insertions(+), 268 deletions(-)

diff --git a/src/views/article/article.vue b/src/views/article/article.vue
index 3a5d6e7..5d044f8 100644
--- a/src/views/article/article.vue
+++ b/src/views/article/article.vue
@@ -1,30 +1,34 @@
 <template>
   <basic-container>
-    <avue-crud :option="option"
-               :table-loading="loading"
-               :data="data"
-               :page.sync="page"
-               ref="crud"
-               @row-del="rowDel"
-               v-model="form"
-               :permission="permissionList"
-               @row-update="rowUpdate"
-               @row-save="rowSave"
-               :before-open="beforeOpen"
-               @search-change="searchChange"
-               @search-reset="searchReset"
-               @selection-change="selectionChange"
-               @current-change="currentChange"
-               @size-change="sizeChange"
-               @refresh-change="refreshChange"
-               @on-load="onLoad">
+    <avue-crud
+      :option="option"
+      :table-loading="loading"
+      :data="data"
+      :page.sync="page"
+      ref="crud"
+      @row-del="rowDel"
+      v-model="form"
+      :permission="permissionList"
+      @row-update="rowUpdate"
+      @row-save="rowSave"
+      :before-open="beforeOpen"
+      @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.article_delete"
-                   @click="handleDelete">删 除
+        <el-button
+          type="danger"
+          size="small"
+          icon="el-icon-delete"
+          plain
+          v-if="permission.article_delete"
+          @click="handleDelete"
+          >删 除
         </el-button>
       </template>
     </avue-crud>
@@ -32,291 +36,305 @@
 </template>
 
 <script>
-  import {getList, remove, update, add, getNotice} from "@/api/article/article";
-  import {mapGetters} from "vuex";
+import { getList, remove, update, add, getNotice } from "@/api/article/article";
+import { mapGetters } from "vuex";
 
-  export default {
-    data() {
-      return {
-        form: {},
-        query: {},
-        loading: true,
-        page: {
-          pageSize: 10,
-          currentPage: 1,
-          total: 0
-        },
-        datetime:"",
-        selectionList: [],
-        option: {
-          height: 'auto',
-          calcHeight: 54,
-          dialogWidth: 950,
-          tip: false,
-          searchShow: true,
-          searchMenuSpan: 6,
-          border: false,
-          stripe:true,
-          index: true,
-          viewBtn: true,
-          selection: true,
-          excelBtn: true,
-          dialogClickModal: false,
-          column: [
-            {
-              label: "资讯标题",
-              prop: "title",
-              span: 24,
-              row: true,
-              searchSpan:5,
-              search: true,
-              rules: [{
+export default {
+  data() {
+    return {
+      form: {},
+      query: {},
+      loading: true,
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+      },
+      datetime: "",
+      selectionList: [],
+      option: {
+        height: "auto",
+        calcHeight: 54,
+        dialogWidth: 950,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: false,
+        //stripe:true,
+        index: true,
+        viewBtn: true,
+        selection: true,
+        excelBtn: true,
+        dialogClickModal: false,
+        column: [
+          {
+            label: "资讯标题",
+            prop: "title",
+            span: 24,
+            row: true,
+            searchSpan: 5,
+            search: true,
+            rules: [
+              {
                 required: true,
                 message: "请输入资讯标题",
-                trigger: "blur"
-              }]
-            },
-            {
+                trigger: "blur",
+              },
+            ],
+          },
+          {
             label: "资讯封面",
             prop: "url",
             // align:'center',
-            width:80,
-            type: 'upload',
-            listType: 'picture-img',
-            action: '/api/blade-resource/oss/endpoint/put-file',
+            width: 80,
+            type: "upload",
+            listType: "picture-img",
+            action: "/api/blade-resource/oss/endpoint/put-file",
             propsHttp: {
-              res: 'data',
-              url: 'link',
+              res: "data",
+              url: "link",
             },
             // hide: true,
             span: 24,
           },
-            {
-              label: "资讯来源",
-              prop: "sourceName",
-              search: true,
-              searchSpan:4,
-              span: 24,
-              rules: [{
+          {
+            label: "资讯来源",
+            prop: "sourceName",
+            search: true,
+            searchSpan: 4,
+            span: 24,
+            rules: [
+              {
                 required: true,
                 message: "请输入资讯类型",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "资讯类型",
-              prop: "articleType",
-              addDisplay: true,
-              editDisplay: true,
-              viewDisplay: true,
-              searchSpan: 3,
-              dicUrl: "/api/blade-system/dict-biz/dictionary?code=articleType",
-              props: {
-                label: "dictValue",
-                value: "dictKey"
+                trigger: "blur",
               },
-              search:true,
-              type:"select",
-              rules: [{
+            ],
+          },
+          {
+            label: "资讯类型",
+            prop: "articleType",
+            addDisplay: true,
+            editDisplay: true,
+            viewDisplay: true,
+            searchSpan: 3,
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=articleType",
+            props: {
+              label: "dictValue",
+              value: "dictKey",
+            },
+            search: true,
+            type: "select",
+            rules: [
+              {
                 required: true,
                 message: "请选择资讯类型",
-                trigger: "blur"
-              }],
-            },
-            {
-              label: "发布时间",
-              prop: "dateTime",
-              type: "datetime",
-              format: "yyyy-MM-dd HH:mm:ss",
-              valueFormat: "yyyy-MM-dd HH:mm:ss",
-              searchRange:true,
-              hide: true,
-              addDisplay: false,
-              editDisplay: false,
-              viewDisplay: false,
-              search: true,
-              rules: [{
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "发布时间",
+            prop: "dateTime",
+            type: "datetime",
+            format: "yyyy-MM-dd HH:mm:ss",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+            searchRange: true,
+            hide: true,
+            addDisplay: false,
+            editDisplay: false,
+            viewDisplay: false,
+            search: true,
+            rules: [
+              {
                 required: true,
                 message: "请选择发布时间",
-                trigger: "blur"
-              }]
-            },
-            {
-              label: "发布时间",
-              prop: "createTime",
-              addDisplay: false,
-              editDisplay: false,
-              viewDisplay: false,
-              type: "date",
-              format: "yyyy-MM-dd HH:mm:ss",
-              valueFormat: "yyyy-MM-dd HH:mm:ss"
-            },
-            {
-              label: "资讯内容",
-              prop: "content",
-              component: 'AvueUeditor',
-              options: {
-                action: '/api/blade-resource/oss/endpoint/put-file',
-                // customConfig: {
-                //   lineHeights: ['1', '1.15', '1.6', '2', '2.5', '3']
-                // },//wangEditor编辑的配置
-                props: {
-                  res: "data",
-                  url: "link",
-                }
+                trigger: "blur",
               },
-              hide: true,
-              minRows: 6,
-              span: 24,
-            }
-          ]
-        },
-        data: []
+            ],
+          },
+          {
+            label: "发布时间",
+            prop: "createTime",
+            addDisplay: false,
+            editDisplay: false,
+            viewDisplay: false,
+            type: "date",
+            format: "yyyy-MM-dd HH:mm:ss",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+          },
+          {
+            label: "资讯内容",
+            prop: "content",
+            component: "AvueUeditor",
+            options: {
+              action: "/api/blade-resource/oss/endpoint/put-file",
+              // customConfig: {
+              //   lineHeights: ['1', '1.15', '1.6', '2', '2.5', '3']
+              // },//wangEditor编辑的配置
+              props: {
+                res: "data",
+                url: "link",
+              },
+            },
+            hide: true,
+            minRows: 6,
+            span: 24,
+          },
+        ],
+      },
+      data: [],
+    };
+  },
+  computed: {
+    ...mapGetters(["permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.article_add, true),
+        viewBtn: this.vaildData(this.permission.article_view, true),
+        delBtn: this.vaildData(this.permission.article_delete, true),
+        editBtn: this.vaildData(this.permission.article_edit, true),
       };
     },
-    computed: {
-      ...mapGetters(["permission"]),
-      permissionList() {
-        return {
-          addBtn: this.vaildData(this.permission.article_add, true),
-          viewBtn: this.vaildData(this.permission.article_view, true),
-          delBtn: this.vaildData(this.permission.article_delete, true),
-          editBtn: this.vaildData(this.permission.article_edit, true)
-        };
-      },
-      ids() {
-        let ids = [];
-        this.selectionList.forEach(ele => {
-          ids.push(ele.id);
-        });
-        return ids.join(",");
-      }
+    ids() {
+      let ids = [];
+      this.selectionList.forEach((ele) => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
     },
-    methods: {
-      rowSave(row, done, loading) {
-        add(row).then(() => {
+  },
+  methods: {
+    rowSave(row, done, loading) {
+      add(row).then(
+        () => {
           this.onLoad(this.page);
           this.$message({
             type: "success",
-            message: "操作成功!"
+            message: "操作成功!",
           });
           done();
-        }, error => {
+        },
+        (error) => {
           window.console.log(error);
           loading();
-        });
-      },
-      rowUpdate(row, index, done, loading) {
-        update(row).then(() => {
+        }
+      );
+    },
+    rowUpdate(row, index, done, loading) {
+      update(row).then(
+        () => {
           this.onLoad(this.page);
           this.$message({
             type: "success",
-            message: "操作成功!"
+            message: "操作成功!",
           });
           done();
-        }, error => {
+        },
+        (error) => {
           window.console.log(error);
           loading();
+        }
+      );
+    },
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
         });
-      },
-      rowDel(row) {
-        this.$confirm("确定将选择数据删除?", {
-          confirmButtonText: "确定",
-          cancelButtonText: "取消",
-          type: "warning"
+    },
+    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();
+    },
+    handleDelete() {
+      if (this.selectionList.length === 0) {
+        this.$message.warning("请选择至少一条数据");
+        return;
+      }
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(this.ids);
         })
-          .then(() => {
-            return remove(row.id);
-          })
-          .then(() => {
-            this.onLoad(this.page);
-            this.$message({
-              type: "success",
-              message: "操作成功!"
-            });
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
           });
-      },
-      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();
-      },
-      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) {
-        if (["edit", "view"].includes(type)) {
-          getNotice(this.form.id).then(res => {
-            this.form = res.data.data;
-          });
-        }
-        done();
-      },
-      currentChange(currentPage) {
-        this.page.currentPage = currentPage;
-      },
-      sizeChange(pageSize) {
-        this.page.pageSize = pageSize;
-      },
-      refreshChange() {
-        this.onLoad(this.page, this.query);
-      },
-      onLoad(page, params = {}) {
-        const {dateTime} = this.query;
-        let values = {
-          ...params,
-        };
-        if (dateTime) {
-          values = {
-            ...params,
-            startTime: dateTime[0],
-            endTime: dateTime[1],
-            ...this.query
-          };
-          values.datetime = null;
-        }
-        this.loading = true;
-        getList(page.currentPage, page.pageSize, values).then(res => {
-          const data = res.data.data;
-          this.page.total = data.total;
-          this.data = data.records;
-          this.loading = false;
-          this.selectionClear();
+          this.$refs.crud.toggleSelection();
+        });
+    },
+    beforeOpen(done, type) {
+      if (["edit", "view"].includes(type)) {
+        getNotice(this.form.id).then((res) => {
+          this.form = res.data.data;
         });
       }
-    }
-  };
+      done();
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    onLoad(page, params = {}) {
+      const { dateTime } = this.query;
+      let values = {
+        ...params,
+      };
+      if (dateTime) {
+        values = {
+          ...params,
+          startTime: dateTime[0],
+          endTime: dateTime[1],
+          ...this.query,
+        };
+        values.datetime = null;
+      }
+      this.loading = true;
+      getList(page.currentPage, page.pageSize, values).then((res) => {
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.data = data.records;
+        this.loading = false;
+        this.selectionClear();
+      });
+    },
+  },
+};
 </script>
 
 <style>

--
Gitblit v1.9.3