From c4e67a8942e514b65ab41bb19781d50576c15725 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 24 Sep 2021 19:56:52 +0800
Subject: [PATCH] 用户

---
 src/views/desk/notice.vue |   90 +++++++++++++++++++++-----------------------
 1 files changed, 43 insertions(+), 47 deletions(-)

diff --git a/src/views/desk/notice.vue b/src/views/desk/notice.vue
index 403e836..fa52ade 100644
--- a/src/views/desk/notice.vue
+++ b/src/views/desk/notice.vue
@@ -26,6 +26,7 @@
           type="danger"
           size="small"
           icon="el-icon-delete"
+          v-if="permission.notice_delete"
           plain
           @click="handleDelete"
           >删 除
@@ -36,10 +37,11 @@
         <el-tag>{{ row.categoryName }}</el-tag>
       </template>
       <template slot-scope="{ type, size, row }" slot="menu">
-        <el-button
-          :size="size"
-          :type="type"
-          @click="handleUploadPage(row)"
+        <el-button 
+        :size="size" 
+        :type="type" 
+        v-if="permission.notice_upload"
+        @click="handleUploadPage(row)"
           >附件上传
         </el-button>
         <!-- <el-button
@@ -58,6 +60,7 @@
 import { getListPage, remove, update, add, getNotice } from "@/api/desk/notice";
 import { getDept } from "@/api/system/dept";
 import { mapGetters } from "vuex";
+import { mapState } from 'vuex';
 
 export default {
   data() {
@@ -85,12 +88,15 @@
         tip: false,
         searchShow: true,
         searchMenuSpan: 6,
-        border: false,
+        border: true,
         index: true,
         stripe: true,
         viewBtn: true,
         selection: true,
         excelBtn: false,
+        addBtnText: "发布",
+        addTitle: "发布",
+        saveBtnText: "发布",
         menuWidth: 320,
         dialogClickModal: false,
         column: [
@@ -98,6 +104,7 @@
             label: "通知标题",
             prop: "title",
             span: 24,
+            searchSpan: 4,
             row: true,
             search: true,
             rules: [
@@ -123,7 +130,7 @@
             defaultValue: "1",
             prop: "category",
             search: true,
-            searchSpan:5,
+            searchSpan: 4,
             rules: [
               {
                 required: true,
@@ -155,14 +162,15 @@
             label: "通知时间",
             prop: "releaseTimeRange",
             type: "datetime",
-            format: "yyyy-MM-dd hh:mm:ss",
-            valueFormat: "yyyy-MM-dd hh:mm:ss",
+            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,
@@ -206,13 +214,13 @@
     };
   },
   computed: {
-    ...mapGetters(["permission"]),
+    ...mapGetters(["userInfo", "permission"]),
     permissionList() {
       return {
-        addBtn: this.vaildData(this.permissionAdd, true),
-        viewBtn: this.vaildData(this.permissionView, true),
-        delBtn: this.vaildData(this.permissionDelete, true),
-        editBtn: this.vaildData(this.permissionEdit, true),
+        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() {
@@ -222,8 +230,13 @@
       });
       return ids.join(",");
     },
+    ...mapState({
+        userInfo: state => state.user.userInfo
+    })
   },
-  mounted() {},
+  mounted() {
+    this.getDeptInfo(this.userInfo.dept_id);
+  },
   methods: {
     //获取当前用户部门信息
     getDeptInfo(deptId) {
@@ -234,25 +247,25 @@
           ? (that.deptCategory = true)
           : (that.deptCategory = false);
 
-        // if (that.deptCategory) {
-          that.permissionAdd = this.permission.notice_add;
-          that.permissionView = this.permission.notice_view;
-          that.permissionDelete = this.permission.notice_delete;
-          that.permissionEdit = this.permission.notice_edit;
-        // }
       });
     },
-    //跳转到附近列表页面
+    //跳转到附件列表页面
     handleUploadPage(row) {
       this.$router.push({
-        path: `/resource/attach`,
+        path: `/resource/uploadNotice`,
         query: {
           deptId: row.deptId,
+          noticeId: row.id,
         },
       });
     },
     rowSave(row, done, loading) {
-      row.category = 1;
+      if (this.deptCategory) {
+        row.category = 1;
+      }else{
+        row.category = 2;
+      }
+      row['type'] = 1;
       row.deptId = this.deptId;
       add(row).then(
         () => {
@@ -270,7 +283,11 @@
       );
     },
     rowUpdate(row, index, done, loading) {
-      row.category = 1;
+      // if (this.deptCategory) {
+      //   row.category = 1;
+      // }else{
+      //   row.category = 2;
+      // }
       row.deptId = this.deptId;
       update(row).then(
         () => {
@@ -373,18 +390,9 @@
           ? (that.deptCategory = true)
           : (that.deptCategory = false);
 
-        // if (that.deptCategory) {
-          that.permissionAdd = this.permission.notice_add;
-          that.permissionView = this.permission.notice_view;
-          that.permissionDelete = this.permission.notice_delete;
-          that.permissionEdit = this.permission.notice_edit;
-        // }
-
         const { releaseTimeRange } = this.query;
-        // if (that.deptCategory) {
-          params["deptId"] = this.deptId;
-          params["jurisdiction"] = this.jurisdiction;
-        // }
+        params["jurisdiction"] = this.jurisdiction;
+        params["type"] = 1;
         let values = {
           ...params,
         };
@@ -402,18 +410,6 @@
           const data = res.data.data;
           this.page.total = data.total;
           this.data = data.records;
-          // this.data.forEach((item) => {
-          //   if (item.category == 2) {
-          //     that.option.addBtn = false;
-          //     that.option.editBtn = false;
-          //     that.option.delBtn = false;
-          //   }
-          //   if (item.category == 1) {
-          //     that.option.addBtn = true;
-          //     that.option.editBtn = true;
-          //     that.option.delBtn = true;
-          //   }
-          // });
           this.loading = false;
           this.selectionClear();
         });

--
Gitblit v1.9.3