| | |
| | | @row-update="rowUpdate" |
| | | @row-save="rowSave" |
| | | :before-open="beforeOpen" |
| | | @filter="filterChange" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | |
| | | 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> |
| | |
| | | |
| | | <script> |
| | | import { getListPage, remove, update, add, getNotice } from "@/api/desk/notice"; |
| | | import { getDept } from "@/api/system/dept"; |
| | | import { mapGetters } from "vuex"; |
| | | |
| | | export default { |
| | |
| | | form: {}, |
| | | query: {}, |
| | | loading: true, |
| | | deptCategory: "", |
| | | deptId: "", |
| | | permissionAdd: "", |
| | | permissionDelete: "", |
| | | permissionView: "", |
| | | permissionEdit: "", |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | |
| | | selectionList: [], |
| | | option: { |
| | | height: "auto", |
| | | filterBtn: true, |
| | | calcHeight: 30, |
| | | dialogWidth: 950, |
| | | tip: false, |
| | |
| | | }, |
| | | dataType: "number", |
| | | slot: true, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | defaultValue: "1", |
| | | prop: "category", |
| | | search: true, |
| | | rules: [ |
| | |
| | | label: "title", |
| | | value: "id", |
| | | }, |
| | | addDisplay: false, |
| | | editDisplay: false, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | ...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() { |
| | |
| | | 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({ |
| | |
| | | }); |
| | | }, |
| | | rowSave(row, done, loading) { |
| | | row.category = 1; |
| | | row.deptId = this.deptId; |
| | | add(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | |
| | | ); |
| | | }, |
| | | rowUpdate(row, index, done, loading) { |
| | | row.category = 1; |
| | | row.deptId = this.deptId; |
| | | update(row).then( |
| | | () => { |
| | | this.onLoad(this.page); |
| | |
| | | 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(); |
| | | }); |
| | | }); |
| | | }, |
| | | }, |