From 7740a4d743be7b07657a45d656e81a3755a0f1e8 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Wed, 14 Jul 2021 14:22:59 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_enterprises
---
src/views/desk/notice.vue | 138 +++++++++++++++++++++++++++++++++++----------
1 files changed, 106 insertions(+), 32 deletions(-)
diff --git a/src/views/desk/notice.vue b/src/views/desk/notice.vue
index 2b0b773..bff3734 100644
--- a/src/views/desk/notice.vue
+++ b/src/views/desk/notice.vue
@@ -12,6 +12,7 @@
@row-update="rowUpdate"
@row-save="rowSave"
:before-open="beforeOpen"
+ @filter="filterChange"
@search-change="searchChange"
@search-reset="searchReset"
@selection-change="selectionChange"
@@ -26,17 +27,29 @@
size="small"
icon="el-icon-delete"
plain
- v-if="permission.notice_delete"
+ v-if="deptCategory"
@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" @click="handleUploadPage(row)"
+ <el-button
+ v-if="deptCategory"
+ :size="size"
+ :type="type"
+ @click="handleUploadPage(row)"
>附件上传
+ </el-button>
+ <el-button
+ v-if="!deptCategory"
+ :size="size"
+ :type="type"
+ @click="handleUploadPage(row)"
+ >附件查看
</el-button>
</template>
</avue-crud>
@@ -45,6 +58,7 @@
<script>
import { getListPage, remove, update, add, getNotice } from "@/api/desk/notice";
+import { getDept } from "@/api/system/dept";
import { mapGetters } from "vuex";
export default {
@@ -53,7 +67,12 @@
form: {},
query: {},
loading: true,
+ deptCategory: "",
deptId: "",
+ permissionAdd: "",
+ permissionDelete: "",
+ permissionView: "",
+ permissionEdit: "",
page: {
pageSize: 10,
currentPage: 1,
@@ -62,6 +81,7 @@
selectionList: [],
option: {
height: "auto",
+ filterBtn: true,
calcHeight: 30,
dialogWidth: 950,
tip: false,
@@ -100,6 +120,9 @@
},
dataType: "number",
slot: true,
+ addDisplay: false,
+ editDisplay: false,
+ defaultValue: "1",
prop: "category",
search: true,
rules: [
@@ -119,6 +142,8 @@
label: "title",
value: "id",
},
+ addDisplay: false,
+ editDisplay: false,
rules: [
{
required: true,
@@ -185,10 +210,10 @@
...mapGetters(["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),
+ addBtn: this.vaildData(this.permissionAdd, false),
+ viewBtn: this.vaildData(this.permissionView, false),
+ delBtn: this.vaildData(this.permissionDelete, false),
+ editBtn: this.vaildData(this.permissionEdit, false),
};
},
ids() {
@@ -199,13 +224,25 @@
return ids.join(",");
},
},
- mounted() {
- //获取deptId
- this.deptId = JSON.parse(
- window.localStorage.getItem("saber-userInfo")
- ).content.dept_id;
- },
+ mounted() {},
methods: {
+ //获取当前用户部门信息
+ getDeptInfo(deptId) {
+ var that = this;
+ getDept(deptId).then((res) => {
+ var deptCategory = res.data.data.deptCategory;
+ deptCategory == 1
+ ? (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({
@@ -216,6 +253,8 @@
});
},
rowSave(row, done, loading) {
+ row.category = 1;
+ row.deptId = this.deptId;
add(row).then(
() => {
this.onLoad(this.page);
@@ -232,6 +271,8 @@
);
},
rowUpdate(row, index, done, loading) {
+ row.category = 1;
+ row.deptId = this.deptId;
update(row).then(
() => {
this.onLoad(this.page);
@@ -321,28 +362,61 @@
this.onLoad(this.page, this.query);
},
onLoad(page, params = {}) {
- const { releaseTimeRange } = this.query;
- let values = {
- ...params,
- ...this.deptId,
- };
- if (releaseTimeRange) {
- values = {
+ 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);
+
+ 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;
+ }
+ let values = {
...params,
- ...this.deptId,
- 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();
+ 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.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