From a2b4882ab5fed78926ee2bd77fa6577fb7a965bf Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 30 Nov 2021 14:54:35 +0800
Subject: [PATCH] +

---
 src/views/desk/notice.vue |  898 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 453 insertions(+), 445 deletions(-)

diff --git a/src/views/desk/notice.vue b/src/views/desk/notice.vue
index 4bcf28b..ad610da 100644
--- a/src/views/desk/notice.vue
+++ b/src/views/desk/notice.vue
@@ -1,466 +1,474 @@
 <template>
-    <basic-container class="desk1">
-        <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"
-                   @filter="filterChange"
-                   @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"
-                           v-if="permission.notice_delete"
-                           plain
-                           @click="handleDelete">删 除
-                </el-button>
-                <!-- v-if="permission.notice_delete" -->
-            </template>
-            <template slot-scope="{ row }"
-                      slot="category">
-                <el-tag>{{ row.categoryName }}</el-tag>
-            </template>
-            <template slot-scope="{ type, size, row }"
-                      slot="menu">
-                <el-button :size="size"
-                           :type="type"
-                           v-if="permission.notice_upload"
-                           @click="handleUploadPage(row)">附件上传
-                </el-button>
-                <!-- <el-button
+  <basic-container class="desk1">
+    <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"
+      @filter="filterChange"
+      @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"
+          v-if="permission.notice_delete"
+          plain
+          @click="handleDelete"
+          >删 除
+        </el-button>
+        <!-- v-if="permission.notice_delete" -->
+      </template>
+      <template slot-scope="{ row }" slot="category">
+        <el-tag>{{ row.categoryName }}</el-tag>
+      </template>
+      <template slot-scope="{ type, size, row }" slot="menu">
+        <el-button
+          :size="size"
+          :type="type"
+          v-if="permission.notice_upload"
+          @click="handleUploadPage(row)"
+          >附件上传
+        </el-button>
+        <!-- <el-button
           v-if="!deptCategory"
           :size="size"
           :type="type"
           @click="handleUploadPage(row)"
           >附件查看
         </el-button> -->
-            </template>
-        </avue-crud>
-    </basic-container>
+      </template>
+    </avue-crud>
+  </basic-container>
 </template>
 
 <script>
-import { getListPage, remove, update, add, getNotice, getPeopleList } from "@/api/desk/notice";
+import {
+  getListPage,
+  remove,
+  update,
+  add,
+  getNotice,
+  getPeopleList,
+} from "@/api/desk/notice";
 import { getDept } from "@/api/system/dept";
 import { mapGetters } from "vuex";
-import { mapState } from 'vuex';
+import { mapState } from "vuex";
 
 export default {
-    data () {
-        return {
-            form: {},
-            query: {},
-            loading: true,
-            deptCategory: "",
-            deptId: "",
-            permissionAdd: "",
-            permissionDelete: "",
-            permissionView: "",
-            permissionEdit: "",
-            page: {
-                pageSize: 10,
-                currentPage: 1,
-                total: 0,
+  data() {
+    return {
+      form: {},
+      query: {},
+      loading: true,
+      deptCategory: "",
+      deptId: "",
+      permissionAdd: "",
+      permissionDelete: "",
+      permissionView: "",
+      permissionEdit: "",
+      page: {
+        pageSize: 10,
+        currentPage: 1,
+        total: 0,
+      },
+      selectionList: [],
+      option: {
+        height: "auto",
+        filterBtn: true,
+        calcHeight: 30,
+        dialogWidth: 950,
+        tip: false,
+        searchShow: true,
+        searchMenuSpan: 6,
+        border: true,
+        index: true,
+        stripe: true,
+        viewBtn: true,
+        selection: true,
+        excelBtn: false,
+        addBtnText: "发布",
+        addTitle: "发布",
+        saveBtnText: "发布",
+        menuWidth: 320,
+        dialogClickModal: false,
+        column: [
+          {
+            label: "通知标题",
+            prop: "title",
+            span: 24,
+            searchSpan: 4,
+            row: true,
+            search: true,
+            rules: [
+              {
+                required: true,
+                message: "请输入通知标题",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "通知类型",
+            type: "select",
+            dicUrl: "/api/blade-system/dict/dictionary?code=notice",
+            props: {
+              label: "dictValue",
+              value: "dictKey",
             },
-            selectionList: [],
-            option: {
-                height: "auto",
-                filterBtn: true,
-                calcHeight: 30,
-                dialogWidth: 950,
-                tip: false,
-                searchShow: true,
-                searchMenuSpan: 6,
-                border: true,
-                index: true,
-                stripe: true,
-                viewBtn: true,
-                selection: true,
-                excelBtn: false,
-                addBtnText: "发布",
-                addTitle: "发布",
-                saveBtnText: "发布",
-                menuWidth: 320,
-                dialogClickModal: false,
-                column: [
-                    {
-                        label: "通知标题",
-                        prop: "title",
-                        span: 24,
-                        searchSpan: 4,
-                        row: true,
-                        search: true,
-                        rules: [
-                            {
-                                required: true,
-                                message: "请输入通知标题",
-                                trigger: "blur",
-                            },
-                        ],
-                    },
-                    {
-                        label: "通知类型",
-                        type: "select",
-                        dicUrl: "/api/blade-system/dict/dictionary?code=notice",
-                        props: {
-                            label: "dictValue",
-                            value: "dictKey",
-                        },
-                        dataType: "number",
-                        slot: true,
-                        addDisplay: false,
-                        editDisplay: false,
-                        defaultValue: "1",
-                        prop: "category",
-                        search: true,
-                        searchSpan: 4,
-                        rules: [
-                            {
-                                required: true,
-                                message: "请输入通知类型",
-                                trigger: "blur",
-                            },
-                        ],
-                    },
-                    {
-                        label: "接收人",
-                        prop: "receivedIds",
-                        span: 24,
-                        type: "tree",
-                        // lazy: true,
-                        // dicUrl: "/api/blade-system/dept/lazy-tree-user-app?type={{key}}",
-                        hide: true,
-                        leafOnly: true,
-                        props: {
-                            label: "title",
-                            value: "id",
-                        },
-                        multiple: true,
-                        // dataType: "number",
-                        rules: [{
-                            required: true,
-                            message: "请选择接收人",
-                            trigger: "blur"
-                        }]
-                    },
-                    {
-                        label: "接收人",
-                        prop: "receivedName",
-                        addDisplay: false,
-                        editDisplay: false,
-                        viewDisplay: false,
-                    },
-                    {
-                        label: "发布单位",
-                        prop: "deptId",
-                        type: "tree",
-                        dicUrl: "/api/blade-system/dept/lazy-tree",
-                        props: {
-                            label: "title",
-                            value: "id",
-                        },
-                        addDisplay: false,
-                        editDisplay: false,
-                        rules: [
-                            {
-                                required: true,
-                                message: "所属组织机构",
-                                trigger: "click",
-                            },
-                        ],
-                    },
-                    {
-                        label: "通知时间",
-                        prop: "releaseTimeRange",
-                        type: "datetime",
-                        format: "yyyy-MM-dd",
-                        valueFormat: "yyyy-MM-dd",
-                        searchRange: true,
-                        hide: true,
-                        addDisplay: false,
-                        editDisplay: false,
-                        viewDisplay: false,
-                        search: true,
-                        searchSpan: 6,
-                        rules: [
-                            {
-                                required: true,
-                                message: "请输入通知时间",
-                                trigger: "blur",
-                            },
-                        ],
-                    },
-                    {
-                        label: "通知日期",
-                        prop: "releaseTime",
-                        type: "date",
-                        format: "yyyy-MM-dd hh:mm:ss",
-                        valueFormat: "yyyy-MM-dd hh:mm:ss",
-                        rules: [
-                            {
-                                required: true,
-                                message: "请输入通知日期",
-                                trigger: "click",
-                            },
-                        ],
-                    },
-                    {
-                        label: "通知内容",
-                        prop: "content",
-                        component: "AvueUeditor",
-                        // options: {
-                        //     action: "/api/blade-resource/oss/endpoint/put-file",
-                        //     props: {
-                        //         res: "data",
-                        //         url: "link",
-                        //     },
-                        // },
-                        hide: false,
-                        minRows: 6,
-                        span: 24,
-                    },
-                ],
+            dataType: "number",
+            slot: true,
+            // addDisplay: false,
+            // editDisplay: false,
+            defaultValue: "1",
+            prop: "category",
+            search: true,
+            searchSpan: 4,
+            rules: [
+              {
+                required: true,
+                message: "请输入通知类型",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "接收人",
+            prop: "receivedIds",
+            span: 24,
+            type: "tree",
+            // lazy: true,
+            // dicUrl: "/api/blade-system/dept/lazy-tree-user-app?type={{key}}",
+            hide: true,
+            leafOnly: true,
+            props: {
+              label: "title",
+              value: "id",
             },
-            data: [],
+            multiple: true,
+            // dataType: "number",
+            rules: [
+              {
+                required: true,
+                message: "请选择接收人",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "接收人",
+            prop: "receivedName",
+            addDisplay: false,
+            editDisplay: false,
+            viewDisplay: false,
+          },
+          {
+            label: "发布单位",
+            prop: "deptId",
+            type: "tree",
+            dicUrl: "/api/blade-system/dept/lazy-tree",
+            props: {
+              label: "title",
+              value: "id",
+            },
+            addDisplay: false,
+            editDisplay: false,
+            rules: [
+              {
+                required: true,
+                message: "所属组织机构",
+                trigger: "click",
+              },
+            ],
+          },
+          {
+            label: "通知时间",
+            prop: "releaseTimeRange",
+            type: "datetime",
+            format: "yyyy-MM-dd",
+            valueFormat: "yyyy-MM-dd",
+            searchRange: true,
+            hide: true,
+            addDisplay: false,
+            editDisplay: false,
+            viewDisplay: false,
+            search: true,
+            searchSpan: 6,
+            rules: [
+              {
+                required: true,
+                message: "请输入通知时间",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "通知日期",
+            prop: "releaseTime",
+            type: "date",
+            format: "yyyy-MM-dd hh:mm:ss",
+            valueFormat: "yyyy-MM-dd hh:mm:ss",
+            rules: [
+              {
+                required: true,
+                message: "请输入通知日期",
+                trigger: "click",
+              },
+            ],
+          },
+          {
+            label: "通知内容",
+            prop: "content",
+            component: "AvueUeditor",
+            // options: {
+            //     action: "/api/blade-resource/oss/endpoint/put-file",
+            //     props: {
+            //         res: "data",
+            //         url: "link",
+            //     },
+            // },
+            hide: false,
+            minRows: 6,
+            span: 24,
+          },
+        ],
+      },
+      data: [],
+    };
+  },
+  computed: {
+    ...mapGetters(["userInfo", "permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.notice_add, false),
+        viewBtn: this.vaildData(this.permission.notice_view, false),
+        delBtn: this.vaildData(this.permission.notice_delete, false),
+        editBtn: this.vaildData(this.permission.notice_edit, false),
+      };
+    },
+    ids() {
+      let ids = [];
+      this.selectionList.forEach((ele) => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
+    },
+    ...mapState({
+      userInfo: (state) => state.user.userInfo,
+    }),
+  },
+  mounted() {
+    // this.getDeptInfo(this.userInfo.dept_id);
+
+    getPeopleList({ deptId: this.userInfo.dept_id }).then((res) => {
+      const columnReceivedIds = this.findObject(
+        this.option.column,
+        "receivedIds"
+      );
+
+      console.log(columnReceivedIds, res.data.data, 6456);
+      columnReceivedIds.dicData = res.data.data;
+    });
+  },
+  methods: {
+    //获取当前用户部门信息
+    getDeptInfo(deptId) {
+      var that = this;
+      getDept(deptId).then((res) => {
+        var deptCategory = res.data.data.deptCategory;
+        deptCategory == 1
+          ? (that.deptCategory = true)
+          : (that.deptCategory = false);
+      });
+    },
+    //跳转到附件列表页面
+    handleUploadPage(row) {
+      this.$router.push({
+        path: `/resource/uploadNotice`,
+        query: {
+          deptId: row.deptId,
+          noticeId: row.id,
+        },
+      });
+    },
+    rowSave(row, done, loading) {
+      //   if (this.deptCategory) {
+      //     row.category = 1;
+      //   } else {
+      //     row.category = 2;
+      //   }
+      row["type"] = 1;
+      row.deptId = this.deptId;
+
+      row.receivedIds = row.receivedIds.toString();
+
+      add(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          window.console.log(error);
+          loading();
+        }
+      );
+    },
+    rowUpdate(row, index, done, loading) {
+      // if (this.deptCategory) {
+      //   row.category = 1;
+      // }else{
+      //   row.category = 2;
+      // }
+      row.deptId = this.deptId;
+
+      row.receivedIds = row.receivedIds.toString();
+
+      update(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (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: "操作成功!",
+          });
+        });
+    },
+    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 = {}) {
+      this.deptId = JSON.parse(
+        window.localStorage.getItem("saber-userInfo")
+      ).content.dept_id;
+
+      //获取当前用户部门信息,判断是否为公安,如果是公安,则只能查看公告信息
+      var that = this;
+      getDept(this.deptId).then((res) => {
+        var deptCategory = res.data.data.deptCategory;
+        deptCategory == 1
+          ? (that.deptCategory = true)
+          : (that.deptCategory = false);
+
+        const { releaseTimeRange } = this.query;
+        params["jurisdiction"] = this.jurisdiction;
+        params["type"] = 1;
+
+        let values = {
+          ...params,
         };
+        if (releaseTimeRange) {
+          values = {
+            ...params,
+            startTime: releaseTimeRange[0],
+            endTime: releaseTimeRange[1],
+            ...this.query,
+          };
+          values.releaseTimeRange = null;
+        }
+        this.loading = true;
+        getListPage(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();
+        });
+      });
     },
-    computed: {
-        ...mapGetters(["userInfo", "permission"]),
-        permissionList () {
-            return {
-                addBtn: this.vaildData(this.permission.notice_add, false),
-                viewBtn: this.vaildData(this.permission.notice_view, false),
-                delBtn: this.vaildData(this.permission.notice_delete, false),
-                editBtn: this.vaildData(this.permission.notice_edit, false),
-            };
-        },
-        ids () {
-            let ids = [];
-            this.selectionList.forEach((ele) => {
-                ids.push(ele.id);
-            });
-            return ids.join(",");
-        },
-        ...mapState({
-            userInfo: state => state.user.userInfo
-        })
-    },
-    mounted () {
-        this.getDeptInfo(this.userInfo.dept_id);
-
-        getPeopleList({ deptId: this.userInfo.dept_id }).then(res => {
-
-            const columnReceivedIds = this.findObject(
-                this.option.column,
-                "receivedIds"
-            );
-
-            console.log(columnReceivedIds, res.data.data, 6456)
-            columnReceivedIds.dicData = res.data.data
-        })
-
-
-    },
-    methods: {
-        //获取当前用户部门信息
-        getDeptInfo (deptId) {
-            var that = this;
-            getDept(deptId).then((res) => {
-                var deptCategory = res.data.data.deptCategory;
-                deptCategory == 1
-                    ? (that.deptCategory = true)
-                    : (that.deptCategory = false);
-
-            });
-        },
-        //跳转到附件列表页面
-        handleUploadPage (row) {
-            this.$router.push({
-                path: `/resource/uploadNotice`,
-                query: {
-                    deptId: row.deptId,
-                    noticeId: row.id,
-                },
-            });
-        },
-        rowSave (row, done, loading) {
-            if (this.deptCategory) {
-                row.category = 1;
-            } else {
-                row.category = 2;
-            }
-            row['type'] = 1;
-            row.deptId = this.deptId;
-
-            row.receivedIds = row.receivedIds.toString()
-
-            add(row).then(
-                () => {
-                    this.onLoad(this.page);
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!",
-                    });
-                    done();
-                },
-                (error) => {
-                    window.console.log(error);
-                    loading();
-                }
-            );
-        },
-        rowUpdate (row, index, done, loading) {
-            // if (this.deptCategory) {
-            //   row.category = 1;
-            // }else{
-            //   row.category = 2;
-            // }
-            row.deptId = this.deptId;
-
-            row.receivedIds = row.receivedIds.toString()
-
-            update(row).then(
-                () => {
-                    this.onLoad(this.page);
-                    this.$message({
-                        type: "success",
-                        message: "操作成功!",
-                    });
-                    done();
-                },
-                (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: "操作成功!",
-                    });
-                });
-        },
-        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 = {}) {
-            this.deptId = JSON.parse(
-                window.localStorage.getItem("saber-userInfo")
-            ).content.dept_id;
-
-            //获取当前用户部门信息,判断是否为公安,如果是公安,则只能查看公告信息
-            var that = this;
-            getDept(this.deptId).then((res) => {
-                var deptCategory = res.data.data.deptCategory;
-                deptCategory == 1
-                    ? (that.deptCategory = true)
-                    : (that.deptCategory = false);
-
-                const { releaseTimeRange } = this.query;
-                params["jurisdiction"] = this.jurisdiction;
-                params["type"] = 1;
-
-                
-                let values = {
-                    ...params,
-                };
-                if (releaseTimeRange) {
-                    values = {
-                        ...params,
-                        startTime: releaseTimeRange[0],
-                        endTime: releaseTimeRange[1],
-                        ...this.query,
-                    };
-                    values.releaseTimeRange = null;
-                }
-                this.loading = true;
-                getListPage(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>
 

--
Gitblit v1.9.3