update 报表设计 表格报表

qianlishi 3 years ago
parent 6f668db07e
commit 701c96b2c2

@ -167,7 +167,7 @@ export const constantRouterMap = [
{
path: 'excelreport',
name: 'excelreport',
component: () => import('@/views/report/excelreport/index'),
component: () => import('@/views/excelreport/index'),
meta: {
title: '表格报表',
icon: 'iconliebiao',
@ -246,7 +246,7 @@ export const constantRouterMap = [
},
{
path: '/excelreport/viewer',
component: () => import('@/views/report/excelreport/viewer'),
component: () => import('@/views/excelreport/viewer'),
hidden: true,
meta: {
requireAuth: true
@ -254,7 +254,7 @@ export const constantRouterMap = [
},
{
path: '/excelreport/designer',
component: () => import('@/views/report/excelreport/designer'),
component: () => import('@/views/excelreport/designer'),
hidden: true,
meta: {
requireAuth: true

@ -0,0 +1,71 @@
<template>
<el-input
clearable
v-model="colorValue"
placeholder="请输入颜色"
size="mini"
@change="changeColor"
>
<template slot="append">
<el-color-picker
v-model="colorValue"
:predefine="predefineColors"
show-alpha
size="mini"
@change="changeColor"
/>
</template>
</el-input>
</template>
<script>
export default {
name: "ColorPicker",
model: {
prop: "value",
event: "input"
},
props: {
value: {
type: [String],
default: ""
}
},
data() {
return {
predefineColors: [
"#ff4500",
"#ff8c00",
"#ffd700",
"#90ee90",
"#00ced1",
"#1e90ff",
"#c71585"
],
colorValue: ""
};
},
watch: {
value(val) {
this.colorValue = val || "";
}
},
mounted() {
this.colorValue = this.value;
},
methods: {
changeColor(val) {
this.colorValue = val || "";
this.$emit("input", this.colorValue);
this.$emit("change", this.colorValue);
}
}
};
</script>
<style lang="scss" scoped>
/deep/.el-color-picker--mini,
/deep/.el-color-picker--mini .el-color-picker__trigger {
width: 23px;
height: 23px;
}
</style>

@ -133,7 +133,7 @@
import draggable from "vuedraggable";
import { queryAllDataSet, detail, detailByReportCode } from "@/api/GaeaReport";
import { addReportExcel, editReportExcel } from "@/api/report";
import ColorPicker from "../../bigscreen/designer/designerComponents/colorPicker.vue";
import ColorPicker from "../components/colorPicker.vue";
// import QRCode from 'qrcodejs2'
// import JsBarcode from 'jsbarcode'
export default {
@ -457,7 +457,7 @@ export default {
};
</script>
<style src="../../../../../static/luckysheet/assets/iconfont/iconfont.css" />
<style src="../../../../static/luckysheet/assets/iconfont/iconfont.css" />
<style scoped lang="scss">
.position {
position: absolute;

@ -1,4 +1,5 @@
<!--
* @Descripttion: 报表设计--表格报表
* @Author: lide1202@hotmail.com
* @Date: 2021-3-13 11:04:24
* @Last Modified by: lide1202@hotmail.com
@ -49,7 +50,7 @@
class="bg-img"
:src="
item.reportImage == null || item.reportImage == ''
? require('../../../assets/images/charts.jpg')
? require('@/assets/images/charts.jpg')
: item.reportImage
"
alt=""

@ -0,0 +1,274 @@
<!--
* @Author: lide1202@hotmail.com
* @Date: 2021-3-13 11:04:24
* @Last Modified by: lide1202@hotmail.com
* @Last Modified time: 2021-3-13 11:04:24
!-->
<template>
<div class="layout">
<div class="layout-right">
<div class="block">
<div class="download">
<a v-if="reportCode != null" download="xxx.xlsx">
<el-button type="text" @click="download('gaea_template_excel')">
<i class="iconfont iconexcel"></i>导出excel
</el-button>
</a>
<a v-if="reportCode != null" download="xxx.pdf">
<el-button type="text" @click="download('gaea_template_pdf')">
<i class="iconfont iconpdf"></i>导出pdf
</el-button>
</a>
</div>
<el-form class="">
<h2>表格查询</h2>
<div v-for="(item, num) in tableData2" :key="num + 'excel'">
<h4>{{ item.name }}</h4>
<div
v-for="(son, y) in item.children"
:key="y + 'excel2'"
class="search_input"
>
<label>{{ son.name }}</label>
<el-input v-model="son.value" />
</div>
</div>
<el-button style="width: 100%" @click="searchPreview"></el-button>
</el-form>
<!--<el-pagination :current-page="currentPage4" :page-sizes="[100, 200, 300, 400]" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="400" @size-change="handleSizeChange" @current-change="handleCurrentChange" />-->
</div>
</div>
<div class="layout-middle">
<div
id="luckysheet"
style="margin:0px;padding:0px;position:absolute;width:100%;height:95vh;left: 0px;top: 30px;bottom:0px;"
/>
</div>
</div>
</template>
<script>
import { preview, exportExcel } from "@/api/GaeaReport";
export default {
name: "Login",
components: {},
data() {
return {
options: {},
sheet: {},
reportId: null,
reportCode: null,
reportName: null,
dataSet: null,
tableData2: [],
excelData: {},
params: {
reportCode: "",
setParam: ""
}
};
},
mounted() {
this.preview();
},
created() {
this.reportCode = this.$route.query.reportCode;
},
methods: {
async searchPreview() {
const arr = this.toObject(this.tableData2);
this.params.setParam = JSON.stringify(arr);
//
this.preview();
},
async preview() {
this.excelData = {};
this.params.reportCode = this.reportCode;
const { code, data } = await preview(this.params);
if (code != 200) return;
this.reportName = JSON.parse(data.jsonStr).name;
//
this.params.setParam = JSON.parse(data.setParam);
const extendArry = [];
const extendObj = this.params.setParam;
for (const i in extendObj) {
const children = [];
for (const y in extendObj[i]) {
children.push({ name: y, value: extendObj[i][y] });
}
extendArry.push({ name: i, children: children });
}
this.tableData2 = extendArry;
this.excelData = data.jsonStr;
this.sheetData = data == null ? [{}] : JSON.parse(data.jsonStr);
// console.log(this.excelData)
// console.log(this.sheetData)
this.createSheet();
},
async download(val) {
if (val == "gaea_template_pdf") {
this.$message("暂不支持pdf");
return;
}
const result = {};
result["reportCode"] = this.reportCode;
result["setParam"] = JSON.stringify(this.params.setParam);
if (val != "") {
result["exportType"] = val;
}
const { code, message } = await exportExcel(result);
if (code != 200) return;
this.$message.success(message);
},
// json
toObject(val) {
const objfirst = {};
const objSecond = {};
val.forEach(el => {
el.name ? (objfirst[el.name] = el.children) : "";
});
for (const key in objfirst) {
const newObj = {};
objfirst[key].map(ev => {
Object.assign(newObj, { [ev.name]: ev.value });
});
objSecond[key] = newObj;
}
return objSecond;
},
//
createSheet() {
const options = {
container: "luckysheet", // DOMid
title: "Luckysheet Demo", //
lang: "zh", //
plugins: ["chart"],
data: [
{
name: "report", //
color: "", //
index: 0, //
status: 1, //
order: 0, //
hide: 0, //
row: 36, //
column: 18, //
defaultRowHeight: 19, //
defaultColWidth: 73, //
celldata: [], //使
config: {
merge: {}, //
rowlen: {}, //
columnlen: {}, //
rowhidden: {}, //
colhidden: {}, //
borderInfo: {}, //
authority: {} //
},
scrollLeft: 0, //
scrollTop: 315, //
luckysheet_select_save: [], //
calcChain: [], //
isPivotTable: false, //
pivotTable: {}, //
filter_select: {}, //
filter: null, //
luckysheet_alternateformat_save: [], //
luckysheet_alternateformat_save_modelCustom: [], //
luckysheet_conditionformat_save: {}, //
frozen: {}, //
chart: [], //
zoomRatio: 1, //
image: [], //
showGridLines: 1, //线
dataVerification: {} //
}
]
};
options.data = this.sheetData;
// console.log(this.sheetData)
$(function() {
luckysheet.create(options);
});
}
}
};
</script>
<style src="../../../../static/luckysheet/assets/iconfont/iconfont.css" />
<style scoped lang="scss">
.download {
width: 100%;
float: left;
button {
color: #444;
width: 90px;
text-align: left;
.svg-icon {
font-size: 16px;
margin-right: 10px;
}
}
}
.block {
position: relative;
z-index: 10000;
top: 0;
background: #fff;
width: 100%;
h2 {
font-size: 14px;
line-height: 30px;
}
h4 {
font-size: 12px;
}
.search_input {
font-size: 12px;
margin-bottom: 10px;
label {
line-height: 20px;
}
}
}
.layout {
display: block;
position: relative;
margin: 0;
padding: 0;
}
.layout-middle {
display: block;
position: absolute;
left: 200px;
right: 0;
width: calc(100% - 200px);
margin: 0;
padding: 0;
.excel-designer {
display: block;
position: relative;
margin: 0;
padding: 0;
}
}
.layout-right {
display: block;
position: absolute;
top: 0;
left: 0;
padding: 20px;
width: 200px;
min-height: 99.98vh;
border-left: 1px solid #dcdee2;
border-color: #e8eaec;
background: #fff;
border-radius: 4px;
font-size: 14px;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
</style>

@ -1,278 +0,0 @@
<!--
* @Author: lide1202@hotmail.com
* @Date: 2021-3-13 11:04:24
* @Last Modified by: lide1202@hotmail.com
* @Last Modified time: 2021-3-13 11:04:24
!-->
<template>
<div class="layout">
<div class="layout-right">
<div class="block">
<div class="download">
<a v-if="reportCode != null"
download="xxx.xlsx">
<el-button type="text"
@click="download('gaea_template_excel')">
<i class="iconfont iconexcel"></i>导出excel
</el-button>
</a>
<a v-if="reportCode != null"
download="xxx.pdf">
<el-button type="text"
@click="download('gaea_template_pdf')">
<i class="iconfont iconpdf"></i>导出pdf
</el-button>
</a>
</div>
<el-form class="">
<h2>表格查询</h2>
<div v-for="(item, num) in tableData2"
:key="num + 'excel'">
<h4>{{ item.name }}</h4>
<div v-for="(son, y) in item.children"
:key="y + 'excel2'"
class="search_input">
<label>{{ son.name }}</label>
<el-input v-model="son.value" />
</div>
</div>
<el-button style="width: 100%"
@click="searchPreview">查询</el-button>
</el-form>
<!--<el-pagination :current-page="currentPage4" :page-sizes="[100, 200, 300, 400]" :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="400" @size-change="handleSizeChange" @current-change="handleCurrentChange" />-->
</div>
</div>
<div class="layout-middle">
<div id="luckysheet"
style="margin:0px;padding:0px;position:absolute;width:100%;height:95vh;left: 0px;top: 30px;bottom:0px;" />
</div>
</div>
</template>
<script>
import { preview, exportExcel } from '@/api/GaeaReport'
export default {
name: 'Login',
components: {},
data () {
return {
options: {},
sheet: {},
reportId: null,
reportCode: null,
reportName: null,
dataSet: null,
tableData2: [],
excelData: {},
params: {
reportCode: '',
setParam: '',
},
}
},
mounted () {
this.preview()
},
created () {
this.reportCode = this.$route.query.reportCode
},
methods: {
async searchPreview () {
const arr = this.toObject(this.tableData2)
this.params.setParam = JSON.stringify(arr)
//
this.preview()
},
async preview () {
this.excelData = {}
this.params.reportCode = this.reportCode
const { code, data } = await preview(this.params)
if (code != 200) return
this.reportName = JSON.parse(data.jsonStr).name
//
this.params.setParam = JSON.parse(data.setParam)
const extendArry = []
const extendObj = this.params.setParam
for (const i in extendObj) {
const children = []
for (const y in extendObj[i]) {
children.push({ name: y, value: extendObj[i][y] })
}
extendArry.push({ name: i, children: children })
}
this.tableData2 = extendArry
this.excelData = data.jsonStr
this.sheetData = (data == null ? [{}] : JSON.parse(data.jsonStr))
// console.log(this.excelData)
// console.log(this.sheetData)
this.createSheet();
},
async download(val) {
if (val == 'gaea_template_pdf') {
this.$message('暂不支持pdf');
return
}
const result = {};
result['reportCode'] = this.reportCode
result['setParam'] = JSON.stringify(this.params.setParam)
if (val != '') {
result['exportType'] = val
}
const {code, message} = await exportExcel(result)
if (code != 200) return
this.$message.success(message);
},
// json
toObject (val) {
const objfirst = {}
const objSecond = {}
val.forEach((el) => {
el.name ? (objfirst[el.name] = el.children) : ''
})
for (const key in objfirst) {
const newObj = {}
objfirst[key].map((ev) => {
Object.assign(newObj, { [ev.name]: ev.value })
})
objSecond[key] = newObj
}
return objSecond
},
//
createSheet(){
const options = {
container: 'luckysheet', // DOMid
title: 'Luckysheet Demo', //
lang: 'zh', //
plugins:['chart'],
data:[
{
"name": "report", //
"color": "", //
"index": 0, //
"status": 1, //
"order": 0, //
"hide": 0,//
"row": 36, //
"column": 18, //
"defaultRowHeight": 19, //
"defaultColWidth": 73, //
"celldata": [], //使
"config": {
"merge":{}, //
"rowlen":{}, //
"columnlen":{}, //
"rowhidden":{}, //
"colhidden":{}, //
"borderInfo":{}, //
"authority":{}, //
},
"scrollLeft": 0, //
"scrollTop": 315, //
"luckysheet_select_save": [], //
"calcChain": [],//
"isPivotTable":false,//
"pivotTable":{},//
"filter_select": {},//
"filter": null,//
"luckysheet_alternateformat_save": [], //
"luckysheet_alternateformat_save_modelCustom": [], //
"luckysheet_conditionformat_save": {},//
"frozen": {}, //
"chart": [], //
"zoomRatio":1, //
"image":[], //
"showGridLines": 1, //线
"dataVerification":{} //
}
]
};
options.data = this.sheetData;
// console.log(this.sheetData)
$(function () {
luckysheet.create(options);
});
},
},
}
</script>
<style src="../../../../../static/luckysheet/assets/iconfont/iconfont.css" />
<style scoped lang="scss">
.download {
width: 100%;
float: left;
button {
color: #444;
width: 90px;
text-align: left;
.svg-icon {
font-size: 16px;
margin-right: 10px;
}
}
}
.block {
position: relative;
z-index: 10000;
top: 0;
background: #fff;
width: 100%;
h2 {
font-size: 14px;
line-height: 30px;
}
h4 {
font-size: 12px;
}
.search_input {
font-size: 12px;
margin-bottom: 10px;
label {
line-height: 20px;
}
}
}
.layout {
display: block;
position: relative;
margin: 0;
padding: 0;
}
.layout-middle {
display: block;
position: absolute;
left: 200px;
right: 0;
width: calc(100% - 200px);
margin: 0;
padding: 0;
.excel-designer {
display: block;
position: relative;
margin: 0;
padding: 0;
}
}
.layout-right {
display: block;
position: absolute;
top: 0;
left: 0;
padding: 20px;
width: 200px;
min-height: 99.98vh;
border-left: 1px solid #dcdee2;
border-color: #e8eaec;
background: #fff;
border-radius: 4px;
font-size: 14px;
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
</style>
Loading…
Cancel
Save