Browse Source

定制报表开发

master
Rui_Li 4 years ago
parent
commit
cea09bfcd9
  1. 4
      src/api/report/com_auth_customer_report.js
  2. 112
      src/views/modules/report/com_auth_customer_report.vue
  3. 6
      src/views/modules/report/report_manage.vue
  4. 6
      src/views/modules/report/user_customer_report.vue
  5. 24
      src/views/modules/sys/role.vue

4
src/api/report/com_auth_customer_report.js

@ -1,7 +1,7 @@
import { createAPI } from '@/utils/httpRequest.js'
// 获取查询列
export const getAuthRoles = data => createAPI('report/getAuthRoles', 'POST', data)
export const getCustomerReportAuths = data => createAPI('report/getCustomerReportAuths', 'POST', data)
// 赋值权限
export const saveAuthCustomerReport = data => createAPI('report/saveAuthSingleCustomerReport', 'POST', data)
export const saveCustomerReportAuths = data => createAPI('report/saveCustomerReportAuths', 'POST', data)

112
src/views/modules/report/com_auth_customer_report.vue

@ -1,7 +1,7 @@
<template>
<div class="customer-css">
<el-dialog :title="titleCon" v-drag v-bind="$attrs" v-on="$listeners"
width="380px" style="height: 490px;" class="customer-dialog">
width="520px" style="height: 490px;" class="customer-dialog">
<el-form :inline="true" label-position="top" style="height: 300px;"
label-width="80px">
<el-row>
@ -16,8 +16,8 @@
<el-form>
<el-table height="240"
:cell-style="customerCellStyle" :cell-class-name="customerCellClassName"
:data="authRoleList"
border
:data="customerReportList"
border ref="customerReportTable"
v-loading="dataListLoading"
style="width: 100%; margin-top: 0px;">
<el-table-column
@ -25,7 +25,7 @@
width="55">
</el-table-column>
<el-table-column
v-for="(item,index) in authRoleArray" :key="index"
v-for="(item,index) in columnReportArray" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
@ -47,7 +47,7 @@
</el-form>
</el-form>
<span slot="footer" class="dialog-footer" style="margin-top: 0px;">
<el-button type="primary" @click="saveAuthCustomerReportBun">保存</el-button>
<el-button type="primary" @click="saveCustomerReportAuthsBun">保存</el-button>
<el-button type="primary" @click="closeDialog">关闭</el-button>
</span>
</el-dialog>
@ -58,9 +58,9 @@
<script>
/*引入js*/
import {
getAuthRoles,
saveAuthCustomerReport,
} from '@/api/report/com_auth_single_customer_report.js';
getCustomerReportAuths,
saveCustomerReportAuths,
} from '@/api/report/com_auth_customer_report.js';
export default {
data() {
return {
@ -72,20 +72,19 @@ export default {
roleName: '',
},
customerReportList: [],
customerReportArray: [
columnReportArray: [
{
userId: this.$store.state.user.name,
functionId: 5307,
serialNumber: '5307CustomerReportId',
tableId: "5307Customer",
tableName: "查询列",
functionId: 5306,
serialNumber: '5306ReportReportId',
tableId: "5306Report",
tableName: "自定义报表",
columnProp: "reportId",
headerAlign: "center",
align: "center",
columnLabel: "报表ID",
columnWidth: 120,
columnWidth: '',
columnHidden: false,
columnAttr: 'ori',
columnImage: false,
columnSortable: false,
sortLv: 0,
@ -94,17 +93,16 @@ export default {
},
{
userId: this.$store.state.user.name,
functionId: 5307,
serialNumber: '5307CustomerRoleName',
tableId: "5307Customer",
tableName: "查询列",
columnProp: "roleName",
functionId: 5306,
serialNumber: '5306ReportReportName',
tableId: "5306Report",
tableName: "自定义报表",
columnProp: "reportName",
headerAlign: "center",
align: "center",
columnLabel: "角色名称",
columnWidth: 140,
columnLabel: "报表名称",
columnWidth: '',
columnHidden: false,
columnAttr: 'ori',
columnImage: false,
columnSortable: false,
sortLv: 0,
@ -113,17 +111,34 @@ export default {
},
{
userId: this.$store.state.user.name,
functionId: 5307,
serialNumber: '5307CustomerColumnDefaultValue',
tableId: "5307Customer",
tableName: "查询列",
columnProp: "checkedFlag",
functionId: 5306,
serialNumber: '5306ReportReportType',
tableId: "5306Report",
tableName: "自定义报表",
columnProp: "reportType",
headerAlign: "center",
align: "center",
columnLabel: "授权",
columnWidth: 90,
columnLabel: "报表分类",
columnWidth: '',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: 5306,
serialNumber: '5306ReportReportRemark',
tableId: "5306Report",
tableName: "自定义报表",
columnProp: "reportRemark",
headerAlign: "center",
align: "center",
columnLabel: "备注",
columnWidth: '',
columnHidden: false,
columnAttr: 'check',
columnImage: false,
columnSortable: false,
sortLv: 0,
@ -138,8 +153,9 @@ export default {
methods: {
/*初始化页面参数*/
init(currentRow) {
//
this.customerReportList = [];
//
debugger;
this.pageData.roleId = currentRow.roleId;
this.pageData.roleName = currentRow.roleName;
//
@ -156,13 +172,23 @@ export default {
/*刷新当前的页面参数*/
refreshPageData(){
//
this.refreshAuthRoleTable();
this.refreshCustomerReportAuthTable();
},
//
refreshAuthRoleTable(){
getAuthRoles(this.pageData).then(({data}) => {
this.authRoleList = data.rows;
//
refreshCustomerReportAuthTable(){
getCustomerReportAuths(this.pageData).then(({data}) => {
this.customerReportList = data.rows;
//
//1
setTimeout(() => {
this.customerReportList.forEach(row => {
let authedFlag = row.authedFlag;
if(authedFlag === 'Y'){
this.$refs.customerReportTable.toggleRowSelection(row);
}
});
}, 300)
});
},
@ -183,9 +209,15 @@ export default {
},
/*保存已经修改好的参数数据*/
saveAuthCustomerReportBun(){
let requestData = {pageData: JSON.stringify(this.pageData), authRoles: JSON.stringify(this.authRoleList)};
saveAuthCustomerReport(requestData).then(({data}) => {
saveCustomerReportAuthsBun(){
let checkedList = this.$refs.customerReportTable.selection;
//
if(checkedList.length === 0){
this.$message.error('请选择赋权限的报表!')
return false;
}
let requestData = {pageData: JSON.stringify(this.pageData), customerReports: JSON.stringify(checkedList)};
saveCustomerReportAuths(requestData).then(({data}) => {
if(data.code === 200){
this.$message.success(data.msg);
//

6
src/views/modules/report/report_manage.vue

@ -24,10 +24,6 @@
</el-form>
<!-- 工单主表信息 -->
<el-main style="margin-top: 5px; padding: 0px; width: 100%;">
<el-form :inline="true" label-position="top" label-width="100px">
<el-form-item :label="'主记录'">
</el-form-item>
</el-form>
<el-table
:height="height"
:data="reportList"
@ -36,7 +32,7 @@
highlight-current-row
@row-click="setCurrentReportRow"
v-loading="dataListLoading"
style="margin-top: -20px; width: 100%;">
style="margin-top: 0px; width: 100%;">
<el-table-column
fixed="left"
header-align="center"

6
src/views/modules/report/user_customer_report.vue

@ -23,10 +23,6 @@
</el-form>
<!-- 工单主表信息 -->
<el-main style="margin-top: 5px; padding: 0px; width: 100%;">
<el-form :inline="true" label-position="top" label-width="100px">
<el-form-item :label="'主记录'">
</el-form-item>
</el-form>
<el-table
:height="height"
:data="reportList"
@ -35,7 +31,7 @@
highlight-current-row
@row-click="setCurrentReportRow"
v-loading="dataListLoading"
style="margin-top: -20px; width: 100%;">
style="margin-top: 0px; width: 100%;">
<el-table-column
fixed="left"
header-align="center"

24
src/views/modules/sys/role.vue

@ -44,6 +44,7 @@
<template slot-scope="scope">
<a v-if="isAuth('sys:role:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.roleId)">修改</a>
<a v-if="isAuth('sys:role:delete')" type="text" size="small" @click="deleteHandle(scope.row.roleId)">删除</a>
<a type="text" size="small" @click="showAuthCustomerReportModal(scope.row)">报表赋权</a>
</template>
</el-table-column>
</el-table>
@ -58,14 +59,23 @@
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
<!--报表赋权限-->
<authCustomerReport ref="authCustomerReport" :close-on-click-modal="false"
:visible.sync="showAuthCustomerReportFlag" @refreshDataList="getDataList">
</authCustomerReport>
</div>
</template>
<script>
import AddOrUpdate from './role-add-or-update'
import authCustomerReport from '../report/com_auth_customer_report' /**/
export default {
data () {
return {
showAuthCustomerReportFlag: false,
dataForm: {
roleName: ''
},
@ -79,7 +89,8 @@
}
},
components: {
AddOrUpdate
AddOrUpdate,
authCustomerReport,/*报表赋权限*/
},
activated () {
this.getDataList()
@ -152,7 +163,16 @@
}
})
}).catch(() => {})
}
},
/*给角色报表赋权限*/
showAuthCustomerReportModal(currentRow){
this.$nextTick(() => {
this.showAuthCustomerReportFlag = true;
this.$refs.authCustomerReport.init(currentRow);
});
},
}
}
</script>
Loading…
Cancel
Save