From 346b018e9d54ddb1c4b7eac13ad66fe6088fd253 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 16 Jul 2021 09:14:04 +0800
Subject: [PATCH] 工作汇报新增
---
src/views/workreport/data.js | 230 ++++++++++++
src/views/workreport/workreport.vue | 274 +++++++++++++++
src/router/views/index.js | 101 +++--
src/api/workreport/workreport.js | 64 +++
src/views/workreport/workreply.vue | 274 +++++++++++++++
src/api/system/dept.js | 119 +++---
6 files changed, 970 insertions(+), 92 deletions(-)
diff --git a/src/api/system/dept.js b/src/api/system/dept.js
index af5c6e7..9db2511 100644
--- a/src/api/system/dept.js
+++ b/src/api/system/dept.js
@@ -1,81 +1,90 @@
import request from '@/router/axios';
export const getList = (current, size, params) => {
- return request({
- url: '/api/blade-system/dept/list',
- method: 'get',
- params: {
- ...params,
- current,
- size,
- }
- })
+ return request({
+ url: '/api/blade-system/dept/list',
+ method: 'get',
+ params: {
+ ...params,
+ current,
+ size,
+ }
+ })
}
export const getLazyList = (parentId, params) => {
- return request({
- url: '/api/blade-system/dept/lazy-list',
- method: 'get',
- params: {
- ...params,
- parentId
- }
- })
+ return request({
+ url: '/api/blade-system/dept/lazy-list',
+ method: 'get',
+ params: {
+ ...params,
+ parentId
+ }
+ })
}
export const remove = (ids) => {
- return request({
- url: '/api/blade-system/dept/remove',
- method: 'post',
- params: {
- ids,
- }
- })
+ return request({
+ url: '/api/blade-system/dept/remove',
+ method: 'post',
+ params: {
+ ids,
+ }
+ })
}
export const add = (row) => {
- return request({
- url: '/api/blade-system/dept/submit',
- method: 'post',
- data: row
- })
+ return request({
+ url: '/api/blade-system/dept/submit',
+ method: 'post',
+ data: row
+ })
}
export const update = (row) => {
- return request({
- url: '/api/blade-system/dept/submit',
- method: 'post',
- data: row
- })
+ return request({
+ url: '/api/blade-system/dept/submit',
+ method: 'post',
+ data: row
+ })
}
export const getDept = (id) => {
- return request({
- url: '/api/blade-system/dept/detail',
- method: 'get',
- params: {
- id,
- }
- })
+ return request({
+ url: '/api/blade-system/dept/detail',
+ method: 'get',
+ params: {
+ id,
+ }
+ })
}
export const getDeptTree = (tenantId) => {
- return request({
- url: '/api/blade-system/dept/tree',
- method: 'get',
- params: {
- tenantId,
- }
- })
+ return request({
+ url: '/api/blade-system/dept/tree',
+ method: 'get',
+ params: {
+ tenantId,
+ }
+ })
}
export const getDeptLazyTree = (parentId) => {
- return request({
- url: '/api/blade-system/dept/lazy-tree',
- method: 'get',
- params: {
- parentId
- }
- })
+ return request({
+ url: '/api/blade-system/dept/lazy-tree',
+ method: 'get',
+ params: {
+ parentId
+ }
+ })
}
+export const getDeptLazyTreeUser = (parentId) => {
+ return request({
+ url: '/api/blade-system/dept/lazy-tree-user',
+ method: 'get',
+ params: {
+ parentId
+ }
+ })
+}
\ No newline at end of file
diff --git a/src/api/workreport/workreport.js b/src/api/workreport/workreport.js
new file mode 100644
index 0000000..5502ab5
--- /dev/null
+++ b/src/api/workreport/workreport.js
@@ -0,0 +1,64 @@
+import request from '@/router/axios';
+
+export const getListPage = (current, size, params) => {
+ return request({
+ url: '/api/workReport/page',
+ method: 'get',
+ params: {
+ ...params,
+ current,
+ size,
+ }
+ })
+}
+
+
+export const getListPageReply = (current, size, params) => {
+ return request({
+ url: '/api/workReport/pageReply',
+ method: 'get',
+ params: {
+ ...params,
+ current,
+ size,
+ }
+ })
+}
+
+
+
+export const getDetail = (id) => {
+ return request({
+ url: '/api/workReport/detail',
+ method: 'get',
+ params: {
+ id
+ }
+ })
+}
+
+export const add = (row) => {
+ return request({
+ url: '/api/workReport/submit',
+ method: 'post',
+ data: row
+ })
+}
+
+export const update = (row) => {
+ return request({
+ url: '/api/workReport/submit',
+ method: 'post',
+ data: row
+ })
+}
+
+export const remove = (ids) => {
+ return request({
+ url: '/api/workReport/remove',
+ method: 'post',
+ params: {
+ ids,
+ }
+ })
+}
\ No newline at end of file
diff --git a/src/router/views/index.js b/src/router/views/index.js
index c4a2d63..0da4ba9 100644
--- a/src/router/views/index.js
+++ b/src/router/views/index.js
@@ -28,27 +28,27 @@
{
path: '/wel',
component: () =>
- import('@/views/home/index')
- // component: Layout,
- // redirect: '/wel/index',
- // children: [{
- // path: 'index',
- // name: '首页',
- // meta: {
- // i18n: 'dashboard'
- // },
- // component: () =>
- // import( /* webpackChunkName: "views" */ '@/views/wel/index')
- // }, {
- // path: 'dashboard',
- // name: '控制台',
- // meta: {
- // i18n: 'dashboard',
- // menu: false,
- // },
- // component: () =>
- // import( /* webpackChunkName: "views" */ '@/views/wel/dashboard')
- // }]
+ import ('@/views/home/index')
+ // component: Layout,
+ // redirect: '/wel/index',
+ // children: [{
+ // path: 'index',
+ // name: '首页',
+ // meta: {
+ // i18n: 'dashboard'
+ // },
+ // component: () =>
+ // import( /* webpackChunkName: "views" */ '@/views/wel/index')
+ // }, {
+ // path: 'dashboard',
+ // name: '控制台',
+ // meta: {
+ // i18n: 'dashboard',
+ // menu: false,
+ // },
+ // component: () =>
+ // import( /* webpackChunkName: "views" */ '@/views/wel/dashboard')
+ // }]
},
@@ -64,7 +64,7 @@
i18n: 'test'
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/util/test')
+ import ( /* webpackChunkName: "views" */ '@/views/util/test')
}]
}, {
path: '/dict-horizontal',
@@ -77,7 +77,7 @@
i18n: 'dict'
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal')
+ import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-horizontal')
}]
}, {
path: '/dict-vertical',
@@ -90,7 +90,7 @@
i18n: 'dict'
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical')
+ import ( /* webpackChunkName: "views" */ '@/views/util/demo/dict-vertical')
}]
}, {
path: '/info',
@@ -103,7 +103,7 @@
i18n: 'info'
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/system/userinfo')
+ import ( /* webpackChunkName: "views" */ '@/views/system/userinfo')
}]
}, {
path: '/work/process/leave',
@@ -116,7 +116,7 @@
i18n: 'work'
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/work/process/leave/form')
+ import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/form')
}, {
path: 'handle/:taskId/:processInstanceId/:businessId',
name: '处理请假流程',
@@ -124,7 +124,7 @@
i18n: 'work'
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/work/process/leave/handle')
+ import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/handle')
}, {
path: 'detail/:processInstanceId/:businessId',
name: '请假流程详情',
@@ -132,7 +132,7 @@
i18n: 'work'
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/work/process/leave/detail')
+ import ( /* webpackChunkName: "views" */ '@/views/work/process/leave/detail')
}]
}, {
path: '/attach',
@@ -145,7 +145,7 @@
i18n: 'index',
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/resource/attach')
+ import ( /* webpackChunkName: "views" */ '@/views/resource/attach')
}]
},
{
@@ -159,7 +159,7 @@
i18n: 'index',
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/management/register')
+ import ( /* webpackChunkName: "views" */ '@/views/management/register')
}]
},
{
@@ -173,7 +173,7 @@
i18n: 'dict'
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/desk/notice')
+ import ( /* webpackChunkName: "views" */ '@/views/desk/notice')
}]
},
{
@@ -187,7 +187,34 @@
i18n: 'index',
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/resource/uploadNotice')
+ import ( /* webpackChunkName: "views" */ '@/views/resource/uploadNotice')
+ }]
+ }, {
+ path: '/workreport',
+ component: Layout,
+ redirect: '/workreport/workreport',
+ children: [{
+ path: 'workreport',
+ name: '发起的汇报',
+ meta: {
+ i18n: 'dict'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/workreport/workreport')
+ }]
+ },
+ {
+ path: '/workreport',
+ component: Layout,
+ redirect: '/workreport/workreply',
+ children: [{
+ path: 'workreply',
+ name: '接收的汇报',
+ meta: {
+ i18n: 'dict'
+ },
+ component: () =>
+ import ( /* webpackChunkName: "views" */ '@/views/workreport/workreply')
}]
}, {
path: '/management',
@@ -200,7 +227,7 @@
i18n: 'index',
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/management/peopleDetails')
+ import ( /* webpackChunkName: "views" */ '@/views/management/peopleDetails')
}]
}, {
path: '/securityCompany',
@@ -213,12 +240,12 @@
i18n: 'index',
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/securityCompany/companyDetails')
+ import ( /* webpackChunkName: "views" */ '@/views/securityCompany/companyDetails')
}]
}, {
path: '/map',
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/mapHome/index')
+ import ( /* webpackChunkName: "views" */ '@/views/mapHome/index')
}, {
path: '/regulatoryInformation',
redirect: '/regulatoryInformation/index',
@@ -230,7 +257,7 @@
i18n: 'index',
},
component: () =>
- import( /* webpackChunkName: "views" */ '@/views/regulatoryInformation/index')
+ import ( /* webpackChunkName: "views" */ '@/views/regulatoryInformation/index')
}]
}
-]
+]
\ No newline at end of file
diff --git a/src/views/workreport/data.js b/src/views/workreport/data.js
new file mode 100644
index 0000000..eccf4d0
--- /dev/null
+++ b/src/views/workreport/data.js
@@ -0,0 +1,230 @@
+//已发送列表信息
+export var workreportColumn = [{
+ label: "汇报时间",
+ prop: "reportTime",
+ type: "datetime",
+ format: "yyyy-MM-dd HH:mm:ss",
+ valueFormat: "yyyy-MM-dd HH:mm:ss",
+ searchRange: true,
+ searchSpan: 6,
+ hide: false,
+ addDisplay: false,
+ editDisplay: false,
+ // viewDisplay: false,
+ search: false,
+ rules: [{
+ required: true,
+ message: "请输入时间",
+ trigger: "blur"
+ }]
+ }, {
+ label: "汇报类别",
+ prop: "category",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=workReportCategory",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ searchSpan: 4,
+ search: true,
+ rules: [{
+ required: true,
+ message: "请选择汇报类别",
+ trigger: "blur"
+ }]
+ }, {
+ label: "汇报类型",
+ prop: "type",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=workReportType",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ searchSpan: 4,
+ search: true,
+ rules: [{
+ required: true,
+ message: "请选择汇报类型",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "汇报人身份证号",
+ prop: "idCardNo",
+ hide: true,
+ addDisplay: false,
+ editDisplay: false,
+ viewDisplay: false,
+ },
+ {
+ label: "汇报内容",
+ prop: "content",
+ type: "textarea",
+ span: 24,
+ rules: [{
+ required: true,
+ message: "请输入汇报内容",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "接收人",
+ prop: "receivedIds",
+ span: 24,
+ type: "tree",
+ dicUrl: "/api/blade-system/dept/lazy-tree-user",
+ hide: true,
+ props: {
+ label: "title",
+ value: "id",
+ },
+ multiple: true,
+ // dataType: "number",
+ rules: [{
+ required: true,
+ message: "请选择接收人",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "接收人",
+ prop: "replyRealName",
+ addDisplay: false,
+ editDisplay: false,
+ viewDisplay: false,
+ },
+ {
+ label: "接收人单位",
+ prop: "replyDeptName",
+ addDisplay: false,
+ editDisplay: false,
+ // viewDisplay: false,
+ },
+ {
+ label: "回复内容",
+ prop: "replyContent",
+ type: "textarea",
+ span: 24,
+ addDisplay: false,
+ editDisplay: false,
+ rules: [{
+ required: true,
+ message: "请输入回复内容",
+ trigger: "blur"
+ }]
+ }
+]
+
+
+//接收人列信息
+export var workreplyColumn = [{
+ label: "汇报人",
+ prop: "realName",
+ disabled: true,
+ span: 24,
+ rules: [{
+ required: true,
+ message: "请选择接收人",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "汇报人单位",
+ prop: "deptName",
+ addDisplay: false,
+ editDisplay: false,
+ // viewDisplay: false,
+ }, {
+ label: "汇报时间",
+ prop: "reportTime",
+ type: "datetime",
+ format: "yyyy-MM-dd HH:mm:ss",
+ valueFormat: "yyyy-MM-dd HH:mm:ss",
+ searchRange: true,
+ searchSpan: 6,
+ hide: false,
+ addDisplay: false,
+ editDisplay: false,
+ // viewDisplay: false,
+ search: false,
+ rules: [{
+ required: true,
+ message: "请输入时间",
+ trigger: "blur"
+ }]
+ }, {
+ label: "汇报类别",
+ prop: "category",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=workReportCategory",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ searchSpan: 4,
+ search: true,
+ hide: true,
+ editDisplay: false,
+ rules: [{
+ required: true,
+ message: "请选择汇报类别",
+ trigger: "blur"
+ }]
+ }, {
+ label: "汇报类型",
+ prop: "type",
+ type: "select",
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=workReportType",
+ props: {
+ label: "dictValue",
+ value: "dictKey"
+ },
+ dataType: "number",
+ searchSpan: 4,
+ search: true,
+ disabled: true,
+ rules: [{
+ required: true,
+ message: "请选择汇报类型",
+ trigger: "blur"
+ }]
+ },
+ // {
+ // label: "汇报人身份证号",
+ // prop: "idCardNo",
+ // hide: true,
+ // addDisplay: false,
+ // editDisplay: false,
+ // viewDisplay: false,
+ // },
+ {
+ label: "汇报内容",
+ prop: "content",
+ type: "textarea",
+ // editDisplay: false,
+ disabled: true,
+ span: 24,
+ rules: [{
+ required: true,
+ message: "请输入汇报内容",
+ trigger: "blur"
+ }]
+ },
+ {
+ label: "回复内容",
+ prop: "replyContent",
+ type: "textarea",
+ span: 24,
+ rules: [{
+ required: true,
+ message: "请输入回复内容",
+ trigger: "blur"
+ }]
+ }
+
+]
\ No newline at end of file
diff --git a/src/views/workreport/workreply.vue b/src/views/workreport/workreply.vue
new file mode 100644
index 0000000..a2e2f51
--- /dev/null
+++ b/src/views/workreport/workreply.vue
@@ -0,0 +1,274 @@
+<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"
+ @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"
+ plain
+ @click="handleDelete"
+ >删 除
+ </el-button>
+ </template> -->
+ <!-- <template slot-scope="{ type, size, row }" slot="menu">
+ <el-button :size="size" :type="type" @click="handleUploadPage(row)"
+ >附件上传
+ </el-button>
+ </template> -->
+ </avue-crud>
+ </basic-container>
+</template>
+
+<script>
+import { workreplyColumn } from "./data";
+import {
+ getListPageReply,
+ remove,
+ update,
+ add,
+ getDetail,
+} from "@/api/workreport/workreport";
+import { getDept } from "@/api/system/dept";
+import { mapGetters } from "vuex";
+
+export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ deptCategory: "",
+ deptId: "",
+ userId: "",
+ permissionAdd: "",
+ permissionDelete: "",
+ permissionView: "",
+ permissionEdit: "",
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionList: [],
+ option: {
+ height: "auto",
+ calcHeight: 30,
+ dialogWidth: 1000,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ editBtnText: "回复",
+ updateBtnText: "提交",
+ editTitle: "回复",
+ border: false,
+ index: true,
+ stripe: true,
+ viewBtn: true,
+ selection: true,
+ excelBtn: false,
+ menuWidth: 320,
+ dialogClickModal: false,
+ column: workreplyColumn,
+ },
+ data: [],
+ };
+ },
+ computed: {
+ ...mapGetters(["permission"]),
+ permissionList() {
+ return {
+ addBtn: this.vaildData(null, false),
+ viewBtn: this.vaildData(this.permission.notice_view, false),
+ delBtn: this.vaildData(null, false),
+ editBtn: this.vaildData(this.permission.notice_edit, false),
+ };
+ },
+ ids() {
+ let ids = [];
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ },
+ },
+ mounted() {},
+ methods: {
+ rowSave(row, done, loading) {
+ row.category = 1;
+ row.deptId = this.deptId;
+ add(row).then(
+ () => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ window.console.log(error);
+ loading();
+ }
+ );
+ },
+ rowUpdate(row, index, done, loading) {
+ 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)) {
+ getDetail(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;
+
+ this.userId = JSON.parse(
+ window.localStorage.getItem("saber-userInfo")
+ ).content.user_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;
+ // if (that.deptCategory) {
+ params["deptId"] = this.deptId;
+ params["userId"] = this.userId;
+ // }
+ let values = {
+ ...params,
+ };
+ // if (releaseTimeRange) {
+ // values = {
+ // ...params,
+ // startTime: releaseTimeRange[0],
+ // endTime: releaseTimeRange[1],
+ // ...this.query,
+ // };
+ // values.releaseTimeRange = null;
+ // }
+ this.loading = true;
+ getListPageReply(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>
+</style>
diff --git a/src/views/workreport/workreport.vue b/src/views/workreport/workreport.vue
new file mode 100644
index 0000000..d1ca951
--- /dev/null
+++ b/src/views/workreport/workreport.vue
@@ -0,0 +1,274 @@
+<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"
+ @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"
+ plain
+ @click="handleDelete"
+ >删 除
+ </el-button>
+ </template>
+ <!-- <template slot-scope="{ type, size, row }" slot="menu">
+ <el-button :size="size" :type="type" @click="handleUploadPage(row)"
+ >附件上传
+ </el-button>
+ </template> -->
+ </avue-crud>
+ </basic-container>
+</template>
+
+<script>
+import { workreportColumn } from "./data";
+import {
+ getListPage,
+ remove,
+ update,
+ add,
+ getDetail,
+} from "@/api/workreport/workreport";
+import { getDept } from "@/api/system/dept";
+import { mapGetters } from "vuex";
+
+export default {
+ data() {
+ return {
+ form: {},
+ query: {},
+ loading: true,
+ deptCategory: "",
+ deptId: "",
+ userId: "",
+ permissionAdd: "",
+ permissionDelete: "",
+ permissionView: "",
+ permissionEdit: "",
+ page: {
+ pageSize: 10,
+ currentPage: 1,
+ total: 0,
+ },
+ selectionList: [],
+ option: {
+ height: "auto",
+ calcHeight: 30,
+ dialogWidth: 1000,
+ tip: false,
+ searchShow: true,
+ searchMenuSpan: 6,
+ border: false,
+ addBtnText: "发起",
+ index: true,
+ stripe: true,
+ viewBtn: true,
+ selection: true,
+ excelBtn: false,
+ menuWidth: 320,
+ dialogClickModal: false,
+ column: workreportColumn,
+ },
+ data: [],
+ };
+ },
+ computed: {
+ ...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),
+ };
+ },
+ ids() {
+ let ids = [];
+ this.selectionList.forEach((ele) => {
+ ids.push(ele.id);
+ });
+ return ids.join(",");
+ },
+ },
+ mounted() {},
+ methods: {
+ rowSave(row, done, loading) {
+ row.receivedIds = row.receivedIds.join(",");
+ row.deptId = this.deptId;
+ row.userId = this.userId;
+ add(row).then(
+ () => {
+ this.onLoad(this.page);
+ this.$message({
+ type: "success",
+ message: "操作成功!",
+ });
+ done();
+ },
+ (error) => {
+ window.console.log(error);
+ loading();
+ }
+ );
+ },
+ rowUpdate(row, index, done, loading) {
+ row.deptId = this.deptId;
+ row.userId = this.userId;
+ // row.receivedIds = row.receivedIds.join(",");
+ 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)) {
+ getDetail(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;
+
+ this.userId = JSON.parse(
+ window.localStorage.getItem("saber-userInfo")
+ ).content.user_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;
+ // if (that.deptCategory) {
+ params["deptId"] = this.deptId;
+ params["userId"] = this.userId;
+ // }
+ 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>
+
+<style>
+</style>
--
Gitblit v1.9.3