Browse Source

自定义报表

master
Rui_Li 4 years ago
parent
commit
3e06531534
  1. 7
      src/api/report/com_auth_single_customer_report.js
  2. 7
      src/api/report/user_customer_report.js
  3. 227
      src/views/modules/report/com_auth_single_customer_report.vue
  4. 1
      src/views/modules/report/com_run_customer_report.vue
  5. 23
      src/views/modules/report/report_manage.vue
  6. 311
      src/views/modules/report/user_customer_report.vue

7
src/api/report/com_auth_single_customer_report.js

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

7
src/api/report/user_customer_report.js

@ -0,0 +1,7 @@
import { createAPI } from '@/utils/httpRequest.js'
// 获取派工单的最新信息
export const getReportTypeList = data => createAPI('report/getReportTypeList', 'POST', data)
// 获取派工单的最新信息
export const getCurrentPageTables = data => createAPI('report/getUserCustomerReportList', 'POST', data)

227
src/views/modules/report/com_auth_single_customer_report.vue

@ -0,0 +1,227 @@
<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">
<el-form :inline="true" label-position="top" style="height: 300px;"
label-width="80px">
<el-row>
<el-form-item :label="'报表名称:'">
<el-input v-model="pageData.reportName" readonly="readonly" style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'报表分类:'">
<el-input v-model="pageData.reportType" readonly="readonly" style="width: 120px"></el-input>
</el-form-item>
</el-row>
<!-- 主材料 -->
<el-form>
<fieldset class="customer-fieldset" style="width: 360px;">
<el-table height="240"
:cell-style="customerCellStyle" :cell-class-name="customerCellClassName"
:data="authRoleList"
border
v-loading="dataListLoading"
style="width: 100%; margin-top: 0px;">
<el-table-column
v-for="(item,index) in authRoleArray" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed"
:width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<el-checkbox true-label="Y" false-label="N" v-if="item.columnProp === 'checkedFlag' && item.columnAttr === 'check'"
v-model="scope.row[item.columnProp]" style="margin-top: 5px;"></el-checkbox>
<span v-else>{{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
</fieldset>
</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="closeDialog">关闭</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
/*引入js*/
import {
getAuthRoles,
saveAuthCustomerReport,
} from '@/api/report/com_auth_single_customer_report.js';
export default {
data() {
return {
titleCon: '报表赋权',
showRunCustomerReportFlag: false,
pageData: {
site: this.$store.state.user.site,
username: this.$store.state.user.name,
reportId: '',
reportName: '',
reportType: '',
},
authRoleList: [],
authRoleArray: [
{
userId: this.$store.state.user.name,
functionId: 5307,
serialNumber: '5307CustomerRoleId',
tableId: "5307Customer",
tableName: "查询列",
columnProp: "roleId",
headerAlign: "center",
align: "center",
columnLabel: "角色ID",
columnWidth: 120,
columnHidden: false,
columnAttr: 'ori',
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: 5307,
serialNumber: '5307CustomerRoleName',
tableId: "5307Customer",
tableName: "查询列",
columnProp: "roleName",
headerAlign: "center",
align: "center",
columnLabel: "角色名称",
columnWidth: 140,
columnHidden: false,
columnAttr: 'ori',
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: 5307,
serialNumber: '5307CustomerColumnDefaultValue',
tableId: "5307Customer",
tableName: "查询列",
columnProp: "checkedFlag",
headerAlign: "center",
align: "center",
columnLabel: "授权",
columnWidth: 90,
columnHidden: false,
columnAttr: 'check',
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
],
dataListLoading: false,
}
},
methods: {
/*初始化页面参数*/
init(currentRow) {
//
this.pageData.reportId = currentRow.reportId;
this.pageData.reportName = currentRow.reportName;
this.pageData.reportType = currentRow.reportType;
//
this.refreshPageData();
},
/*关闭modal*/
closeDialog(){
this.$emit('update:visible', false);
//
this.$emit('refreshCurrentPage');
},
/*刷新当前的页面参数*/
refreshPageData(){
//
this.refreshAuthRoleTable();
},
//
refreshAuthRoleTable(){
getAuthRoles(this.pageData).then(({data}) => {
this.authRoleList = data.rows;
});
},
/*添加定制的css类*/
customerCellClassName({row, column, rowIndex, columnIndex}) {
if(column.property == 'sortNo'){
return 'customer-number-cell';
}else if(columnIndex === 2){
return 'customer-text-cell';
}
},
/*添加定制的cess样式*/
customerCellStyle({row, column, rowIndex, columnIndex}) {
if(columnIndex === 2){
return 'padding: 0px 0px;';
}
},
/*保存已经修改好的参数数据*/
saveAuthCustomerReportBun(){
let requestData = {pageData: JSON.stringify(this.pageData), authRoles: JSON.stringify(this.authRoleList)};
saveAuthCustomerReport(requestData).then(({data}) => {
if(data.code === 200){
this.$message.success(data.msg);
//
this.closeDialog();
}else{
this.$message.error(data.msg);
}
});
},
},
created() {
//
}
}
</script>
<style scoped lang="scss">
/*调节页面button和input的上下间距*/
.customer-css .customer-button{
margin-top: 25px;
}
/*调节样式*/
.customer-item{
margin-top: -10px;
}
/*fieldset下table的样式*/
.customer-fieldset /deep/ .el-table__header th.is-leaf{
line-height: 16px;
}
/deep/ .customer-tab .el-tabs__content{
padding: 0px !important;
}
</style>

1
src/views/modules/report/com_run_customer_report.vue

@ -87,7 +87,6 @@ export default {
runCustomerReport(requestData).then(({data}) => {
//
if(data.code === 200){
debugger;
this.customerReportList = data.resultMap.resultRows;
this.customerColumnlArray = data.resultMap.columnRows;
}else{

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

@ -41,13 +41,14 @@
fixed="left"
header-align="center"
align="center"
width="160"
width="220"
:label="'操作'">
<template slot-scope="scope">
<a class="customer-a" @click="editCustomerReportModal(scope.row)">编辑</a>
<a class="customer-a" @click="warnDeleteCustomerReportConfirm(scope.row)">删除</a>
<a class="customer-a" @click="editCustomerReportSearchColumnModal(scope.row)">维护</a>
<a class="customer-a" @click="editCustomerReportSearchColumnModal(scope.row)">查询参数维护</a>
<a class="customer-a" @click="showCustomerReportSearchColumnModal(scope.row)">报表查询</a>
<a class="customer-a" @click="showAuthCustomerReportModal(scope.row)">权限</a>
</template>
</el-table-column>
<el-table-column
@ -94,6 +95,13 @@
@refreshCurrentPage = "refreshCurrentPage">
</showCustomerReportSearchColumn>
<!-- 查询列展示 -->
<authSingleCustomerReport ref="authSingleCustomerReport" :close-on-click-modal="false"
:visible.sync="showAuthCustomerReportFlag"
@refreshCurrentPage = "refreshCurrentPage">
</authSingleCustomerReport>
</div>
</template>
@ -103,7 +111,7 @@
import updateCustomerReport from '@/views/modules/report/com_update_customer_report';/*新增自定义报表的功能*/
import editCustomerReportSearchColumn from '@/views/modules/report/com_edit_customer_report_search_column';/*新增自定义报表的功能*/
import showCustomerReportSearchColumn from '@/views/modules/report/com_show_customer_report_search_column';/*新增自定义报表的功能*/
import authSingleCustomerReport from '@/views/modules/report/com_auth_single_customer_report';/*单个报表赋权限*/
import {
getReportTypeList,
getCurrentPageTables,
@ -119,6 +127,7 @@ export default {
updateCustomerReportFlag: false,
editCustomerReportSearchColumnFlag: false,
showCustomerReportSearchColumnFlag: false,
showAuthCustomerReportFlag: false,
currentReportRow: {},
pageData: {
site: this.$store.state.user.site,
@ -212,6 +221,7 @@ export default {
updateCustomerReport,/*报表修改*/
editCustomerReportSearchColumn,/*查询列修改*/
showCustomerReportSearchColumn,/*显示查询列参数*/
authSingleCustomerReport,/*单个报表赋权限*/
},
mounted() {
@ -277,6 +287,13 @@ export default {
});
},
/*给单个报表赋权限*/
showAuthCustomerReportModal(currentRow){
this.$nextTick(() => {
this.showAuthCustomerReportFlag = true;
this.$refs.authSingleCustomerReport.init(currentRow);
});
},
/*设置工艺的行*/
setCurrentReportRow(row, column, event) {

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

@ -0,0 +1,311 @@
<template>
<div class="customer-css" >
<!-- 查询时间和产品 -->
<el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;" >
<el-row>
<el-form-item :label="'报表名称:'">
<el-input v-model="pageData.reportName" style="width: 120px"></el-input>
</el-form-item>
<el-form-item :label="'报表分类:'">
<el-select v-model="pageData.reportType" style="width: 130px">
<el-option
v-for="(item, index) in reportTypeList"
:key="index"
:label="item.baseData"
:value="item.baseData">
</el-option>
</el-select>
</el-form-item>
<el-form-item :label="''" style="margin-left: 50px; margin-top: 20px;">
<el-button class="customer-bun-min" type="primary" @click="refreshPageTables" style="margin-left: 10px; margin-bottom: 5px;">查询</el-button>
</el-form-item>
</el-row>
</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"
border
ref="reportTable"
highlight-current-row
@row-click="setCurrentReportRow"
v-loading="dataListLoading"
style="margin-top: -20px; width: 100%;">
<el-table-column
fixed="left"
header-align="center"
align="center"
width="220"
:label="'操作'">
<template slot-scope="scope">
<a class="customer-a" @click="showCustomerReportSearchColumnModal(scope.row)">报表查询</a>
</template>
</el-table-column>
<el-table-column
v-for="(item,index) in columnReportArray" :key="index"
:sortable="item.columnSortable"
:prop="item.columnProp"
:header-align="item.headerAlign"
:show-overflow-tooltip="item.showOverflowTooltip"
:align="item.align"
:fixed="item.fixed"
:width="item.columnWidth"
:label="item.columnLabel">
<template slot-scope="scope">
<span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
<span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
style="width: 100px; height: 80px"/></span>
</template>
</el-table-column>
</el-table>
</el-main>
<!-- 查询列展示 -->
<showCustomerReportSearchColumn ref="showCustomerReportSearchColumn" :close-on-click-modal="false"
:visible.sync="showCustomerReportSearchColumnFlag"
@refreshCurrentPage = "refreshCurrentPage">
</showCustomerReportSearchColumn>
</div>
</template>
<script>
/*组件*/
import showCustomerReportSearchColumn from '@/views/modules/report/com_show_customer_report_search_column';/*新增自定义报表的功能*/
import {
getReportTypeList,
getCurrentPageTables,
} from '@/api/report/user_customer_report.js'
export default {
data() {
return {
height: 200,
reportTypeList: [],
addCustomerReportFlag: false,
updateCustomerReportFlag: false,
editCustomerReportSearchColumnFlag: false,
showCustomerReportSearchColumnFlag: false,
showAuthCustomerReportFlag: false,
currentReportRow: {},
pageData: {
site: this.$store.state.user.site,
username: this.$store.state.user.name,
reportName: '',
reportType: '',
seqNo: 0,
status: 1,
},
reportList: [],
dataListLoading: false,
columnReportArray: [
{
userId: this.$store.state.user.name,
functionId: 5306,
serialNumber: '5306ReportReportId',
tableId: "5306Report",
tableName: "自定义报表",
columnProp: "reportId",
headerAlign: "center",
align: "center",
columnLabel: "报表ID",
columnWidth: '',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: 5306,
serialNumber: '5306ReportReportName',
tableId: "5306Report",
tableName: "自定义报表",
columnProp: "reportName",
headerAlign: "center",
align: "center",
columnLabel: "报表名称",
columnWidth: '',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
{
userId: this.$store.state.user.name,
functionId: 5306,
serialNumber: '5306ReportReportType',
tableId: "5306Report",
tableName: "自定义报表",
columnProp: "reportType",
headerAlign: "center",
align: "center",
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,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: false
},
],
}
},
/*组件*/
components: {
showCustomerReportSearchColumn,/*显示查询列参数*/
},
mounted() {
this.$nextTick(() => {
this.height = window.innerHeight - 165;
})
},
methods: {
/*刷新报工的类型*/
refreshReportType(){
let requestData = {'type': 'report_type'};
getReportTypeList(requestData).then(({data}) => {
this.reportTypeList = data.rows;
//
this.pageData.reportType = data.rows[0].baseData;
})
},
/*刷新页面table*/
refreshCurrentPage(){
this.refreshPageTables();
},
/*获取工单信息*/
refreshPageTables() {
getCurrentPageTables(this.pageData).then(({data}) => {
this.reportList = data.rows;
//
this.currentReportRow = null;
})
},
/*展示查询列*/
showCustomerReportSearchColumnModal(currentRow){
this.$nextTick(() => {
this.showCustomerReportSearchColumnFlag = true;
this.$refs.showCustomerReportSearchColumn.init(currentRow.reportId);
});
},
/*设置工艺的行*/
setCurrentReportRow(row, column, event) {
this.currentReportRow = row;
},
},
created() {
//
this.refreshReportType();
},
}
</script>
<!--当前页面的标签样式-->
<style scoped lang="scss">
/*针对el-card*/
.customer-card .el-form-item__content{
margin-top: -15px;
}
.customer-card .el-form-item{
height: 22px;
}
.customer-border .el-form-item__content{
margin-top: -30px;
}
/*全局年与日类型 宽度*/
div.el-time-width{
width: 110px !important;
}
/* 全局时间右边框*/
.customer-css input.el-input__inner{
height: 22px !important;
padding-right: 0px !important;
}
/* 控制el-card标签的数据*/
div.customer-el-card {
margin-left: 110px;
margin-top: -15px;
height: 20px;
width: 60px;
}
/* 颜色控制 */
div.customer-el-card-pink {
background: #FF00FF;
}
div.customer-el-card-orange {
background: #FFD700;
}
div.customer-el-card-blue {
background: #0000CD;
}
/*清掉样式*/
.el-radio+.el-radio {
margin-left: 0px;
}
/*当前按钮的通用样式*/
.customer-css .customer-bun-mid{
width: 60px;
text-align: center;
}
.customer-css .customer-bun-min{
width: 50px;
text-align: center;
}
.customer-css .customer-bun-max{
width: 80px;
text-align: center;
}
/*当前按钮的通用样式*/
.customer-css .el-button--medium {
padding: 5px 5px;
}
</style>
Loading…
Cancel
Save