|
@@ -0,0 +1,796 @@
|
|
|
+<template>
|
|
|
+ <basic-container>
|
|
|
+ <avue-crud :option="option"
|
|
|
+ :table-loading="loading"
|
|
|
+ :data="data"
|
|
|
+ :page.sync="page"
|
|
|
+ :permission="permissionList"
|
|
|
+ :before-open="beforeOpen"
|
|
|
+ v-model="form"
|
|
|
+ ref="crud"
|
|
|
+ id="out-table"
|
|
|
+ :header-cell-class-name="headerClassName"
|
|
|
+ @resetColumn="resetColumnTwo('crud', 'option', 'optionBack', 312)"
|
|
|
+ @saveColumn="saveColumnTwo('crud', 'option', 'optionBack', 312)"
|
|
|
+ @row-update="rowUpdate"
|
|
|
+ @row-save="rowSave"
|
|
|
+ @row-del="rowDel"
|
|
|
+ @search-change="searchChange"
|
|
|
+ @search-reset="searchReset"
|
|
|
+ @selection-change="selectionChange"
|
|
|
+ @current-change="currentChange"
|
|
|
+ @size-change="sizeChange"
|
|
|
+ @refresh-change="refreshChange"
|
|
|
+ @on-load="onLoad">
|
|
|
+ <template slot-scope="{type,disabled}" slot="urlForm">
|
|
|
+ <el-button size="small" :disabled="bbDisabled" @click="reportDesignButton(form.url)">设计报表</el-button>
|
|
|
+ </template>
|
|
|
+ <template slot="menuLeft">
|
|
|
+ <el-button type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-plus"
|
|
|
+ @click="addedData(3)">新 增
|
|
|
+ </el-button>
|
|
|
+ <el-button type="danger"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ plain
|
|
|
+ v-if="permission.reports_delete"
|
|
|
+ @click="handleDelete">删 除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="{disabled,size}" slot="authorizedUsersForm">
|
|
|
+ <div>
|
|
|
+ <el-select v-model="form.authorizedUsersId" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in userList"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope" slot="menu">
|
|
|
+ <el-link type="primary" style="font-size: 12px" icon="el-icon-view" :underline="false" @click="addedData(1, scope)">查看详情 </el-link>
|
|
|
+ <el-link type="primary" style="font-size: 12px" icon="el-icon-edit" :underline="false" @click="addedData(2, scope)">编 辑 </el-link>
|
|
|
+ <el-link type="primary" style="font-size: 12px" icon="el-icon-delete" :underline="false" @click="rowDel(scope.row)">删 除</el-link>
|
|
|
+ <el-link type="primary" @click="handleReportPreview(scope.row.url)">预览报表</el-link>
|
|
|
+ </template>
|
|
|
+ </avue-crud>
|
|
|
+ <reportContainer ref="reportContainer"></reportContainer>
|
|
|
+ </basic-container>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {getList, getDetail, add, update, remove} from "@/api/iosBasicData/reports";
|
|
|
+ import {getUserApprovalList} from "@/api/approval/processConfig";
|
|
|
+ import {mapGetters} from "vuex";
|
|
|
+
|
|
|
+ import reportContainer from "@/views/iosBasicData/report-container/report-container.vue"
|
|
|
+
|
|
|
+ export default {
|
|
|
+ components: {
|
|
|
+ reportContainer
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ userList: [],
|
|
|
+ bbDisabled: false,
|
|
|
+ form: {},
|
|
|
+ formReport: {},
|
|
|
+ query: {},
|
|
|
+ loading: true,
|
|
|
+ page: {
|
|
|
+ pageSize: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ selectionList: [],
|
|
|
+ option: {},
|
|
|
+ optionBack: {
|
|
|
+ height:'auto',
|
|
|
+ calcHeight: 30,
|
|
|
+ tip: false,
|
|
|
+ searchShow: true,
|
|
|
+ searchMenuSpan: 6,
|
|
|
+ border: true,
|
|
|
+ index: true,
|
|
|
+ viewBtn: true,
|
|
|
+ selection: true,
|
|
|
+ dialogClickModal: false,
|
|
|
+ column: [
|
|
|
+ // {
|
|
|
+ // label: "主键",
|
|
|
+ // prop: "id",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入主键",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "分公司 Id",
|
|
|
+ // prop: "branchId",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入分公司 Id",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "创建人 Id",
|
|
|
+ // prop: "createUser",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入创建人 Id",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "创建人",
|
|
|
+ // prop: "createUserName",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入创建人",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "创建部门 Id",
|
|
|
+ // prop: "createDept",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入创建部门 Id",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "创建部门",
|
|
|
+ // prop: "createDeptName",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入创建部门",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "创建时间",
|
|
|
+ // prop: "createTime",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入创建时间",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "修改人 Id",
|
|
|
+ // prop: "updateUser",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入修改人 Id",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "修改人",
|
|
|
+ // prop: "updateUserName",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入修改人",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // label: "修改时间",
|
|
|
+ // prop: "updateTime",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入修改时间",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ label: "业务类型",
|
|
|
+ prop: "businessType",
|
|
|
+ type: 'select',
|
|
|
+ dicData:[{
|
|
|
+ label:'海运出口',
|
|
|
+ value:'SE'
|
|
|
+ },{
|
|
|
+ label:'海运进口',
|
|
|
+ value:'SI'
|
|
|
+ }],
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入业务类型",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "类别",
|
|
|
+ prop: "classifyCode",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入类别",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "组别",
|
|
|
+ prop: "groupCode",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入组别",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "报表编码",
|
|
|
+ prop: "code",
|
|
|
+ search:true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入报表编码",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "中文名称",
|
|
|
+ prop: "cnName",
|
|
|
+ search:true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入中文名称",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "英文名称",
|
|
|
+ prop: "enName"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "报表格式",
|
|
|
+ prop: "content",
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入报表格式",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "授权用户",
|
|
|
+ prop: "authorizedUsersId",
|
|
|
+ // hide: true,
|
|
|
+ formslot:true,
|
|
|
+ type:'tree',
|
|
|
+ dicUrl: "/api/blade-user/userList",
|
|
|
+ multiple: true,
|
|
|
+ props: {
|
|
|
+ label: "realName",
|
|
|
+ value: "id"
|
|
|
+ },
|
|
|
+ dicData:[],
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请选择授权用户",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ // {
|
|
|
+ // label: "版本",
|
|
|
+ // prop: "version",
|
|
|
+ // rules: [{
|
|
|
+ // required: true,
|
|
|
+ // message: "请输入版本",
|
|
|
+ // trigger: "blur"
|
|
|
+ // }]
|
|
|
+ // },
|
|
|
+ {
|
|
|
+ label: "状态",
|
|
|
+ prop: "status",
|
|
|
+ type: 'select',
|
|
|
+ dicData:[{
|
|
|
+ label:'正常',
|
|
|
+ value:0
|
|
|
+ },{
|
|
|
+ label:'停用',
|
|
|
+ value:1
|
|
|
+ }],
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入状态",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "设计报表",
|
|
|
+ prop: "url",
|
|
|
+ hide: true,
|
|
|
+ formslot:true,
|
|
|
+ rules: [{
|
|
|
+ required: true,
|
|
|
+ message: "请输入备注",
|
|
|
+ trigger: "blur"
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "备注",
|
|
|
+ prop: "remarks"
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ data: []
|
|
|
+ };
|
|
|
+ },
|
|
|
+ async created () {
|
|
|
+ this.option = await this.getColumnData(this.getColumnName(312), this.optionBack);
|
|
|
+ getUserApprovalList().then(res=>{
|
|
|
+ this.findObject(this.option.column, "authorizedUsersId").dicData = res.data.data
|
|
|
+ })
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapGetters(["permission"]),
|
|
|
+ permissionList() {
|
|
|
+ return {
|
|
|
+ addBtn: this.vaildData(this.permission.reports_add, false),
|
|
|
+ viewBtn: this.vaildData(this.permission.reports_view, false),
|
|
|
+ delBtn: this.vaildData(this.permission.reports_delete, false),
|
|
|
+ editBtn: this.vaildData(this.permission.reports_edit, false)
|
|
|
+ };
|
|
|
+ },
|
|
|
+ ids() {
|
|
|
+ let ids = [];
|
|
|
+ this.selectionList.forEach(ele => {
|
|
|
+ ids.push(ele.id);
|
|
|
+ });
|
|
|
+ return ids.join(",");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 设计报表
|
|
|
+ reportDesignButton(url) {
|
|
|
+ Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
|
|
|
+ // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
|
|
|
+ Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile( '/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
|
|
|
+ Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml' )
|
|
|
+
|
|
|
+ var options = new Stimulsoft.Designer.StiDesignerOptions()
|
|
|
+ options.appearance.fullScreenMode = true
|
|
|
+ options.allowChangeWindowTitle = false
|
|
|
+ options.toolbar.showSaveDialog = false
|
|
|
+
|
|
|
+ options.toolbar.showFileMenuSave = false
|
|
|
+ options.toolbar.showFileMenuAbout = false
|
|
|
+ options.toolbar.showFileMenuClose = false
|
|
|
+ options.toolbar.showFileMenuExit = false
|
|
|
+ options.toolbar.showFileMenuInfo = false
|
|
|
+ options.toolbar.showFileMenuHelp = false
|
|
|
+ options.toolbar.showFileMenuNew = false
|
|
|
+
|
|
|
+ options.appearance.showTooltips = false
|
|
|
+ options.appearance.showDialogsHelp = false
|
|
|
+
|
|
|
+ options.toolbar.showSetupToolboxButton = true
|
|
|
+ options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
|
|
|
+
|
|
|
+ let designer = new Stimulsoft.Designer.StiDesigner(
|
|
|
+ options,
|
|
|
+ 'StiDesigner',
|
|
|
+ false
|
|
|
+ )
|
|
|
+
|
|
|
+ designer.onSaveReport = (e)=>{
|
|
|
+ console.log('onSaveReport')
|
|
|
+ // let jsObject = this.jsObject
|
|
|
+
|
|
|
+ if (!e.report.isModified)
|
|
|
+ return
|
|
|
+ var jsonString = e.report.saveToJsonString()
|
|
|
+ console.log(jsonString)
|
|
|
+ this.form.url = jsonString;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ let report = new window.Stimulsoft.Report.StiReport();
|
|
|
+
|
|
|
+ report.styles.loadFile('static/Plugins/reports/css/Styles.sts')
|
|
|
+ report.applyStyles()
|
|
|
+
|
|
|
+ // 加载文件
|
|
|
+ console.log("从 url 报表");
|
|
|
+ if (url) {
|
|
|
+ report.load(url)
|
|
|
+ }
|
|
|
+ // 从模版和数据加载报表
|
|
|
+ // loadReport(report, '', {})
|
|
|
+
|
|
|
+ designer.report = report
|
|
|
+ this.designer=designer
|
|
|
+
|
|
|
+ this.$refs.reportContainer.showContainer(
|
|
|
+ ()=> {
|
|
|
+ setTimeout(() => {
|
|
|
+ designer.renderHtml('reportContainer')
|
|
|
+ this.createDesignerButtons()
|
|
|
+ }, 50)
|
|
|
+ },
|
|
|
+ ()=>{
|
|
|
+ },
|
|
|
+ )
|
|
|
+ },
|
|
|
+ // 预览报表
|
|
|
+ handleReportPreview(url){
|
|
|
+ Stimulsoft.Base.StiLicense.key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHn0s4gy0Fr5YoUZ9V00Y0igCSFQzwEqYBh/N77k4f0fWXTHW5rqeBNLkaurJDenJ9o97TyqHs9HfvINK18Uwzsc/bG01Rq+x3H3Rf+g7AY92gvWmp7VA2Uxa30Q97f61siWz2dE5kdBVcCnSFzC6awE74JzDcJMj8OuxplqB1CYcpoPcOjKy1PiATlC3UsBaLEXsok1xxtRMQ283r282tkh8XQitsxtTczAJBxijuJNfziYhci2jResWXK51ygOOEbVAxmpflujkJ8oEVHkOA/CjX6bGx05pNZ6oSIu9H8deF94MyqIwcdeirCe60GbIQByQtLimfxbIZnO35X3fs/94av0ODfELqrQEpLrpU6FNeHttvlMc5UVrT4K+8lPbqR8Hq0PFWmFrbVIYSi7tAVFMMe2D1C59NWyLu3AkrD3No7YhLVh7LV0Tttr/8FrcZ8xirBPcMZCIGrRIesrHxOsZH2V8t/t0GXCnLLAWX+TNvdNXkB8cF2y9ZXf1enI064yE5dwMs2fQ0yOUG/xornE'
|
|
|
+ // Stimulsoft.Base.StiLicense.Key = '6vJhGtLLLz2GNviWmUTrhSqnOItdDwjBylQzQcAOiHkcgIvwL0jnpsDqRpWg5FI5kt2G7A0tYIcUygBh1sPs7plofUOqPB1a4HBIXJB621mau2oiAIj+ysU7gKUXfjn/D5BocmduNB+ZMiDGPxFrAp3PoD0nYNkkWh8r7gBZ1v/JZSXGE3bQDrCQCNSy6mgby+iFAMV8/PuZ1z77U+Xz3fkpbm6MYQXYp3cQooLGLUti7k1TFWrnawT0iEEDJ2iRcU9wLqn2g9UiWesEZtKwI/UmEI2T7nv5NbgV+CHguu6QU4WWzFpIgW+3LUnKCT/vCDY+ymzgycw9A9+HFSzARiPzgOaAuQYrFDpzhXV+ZeX31AxWlnzjDWqpfluygSNPtGul5gyNt2CEoJD1Yom0VN9fvRonYsMsimkFFx2AwyVpPcs+JfVBtpPbTcZscnzUdmiIvxv8Gcin6sNSibM6in/uUKFt3bVgW/XeMYa7MLGF53kvBSwi78poUDigA2n12SmghLR0AHxyEDIgZGOTbNI33GWu7ZsPBeUdGu55R8w='
|
|
|
+ Stimulsoft.Base.Localization.StiLocalization.addLocalizationFile( '/reports/stimulsoft/Localization/zh-CHS.xml', true, 'zh-CHS')
|
|
|
+ Stimulsoft.Base.Localization.StiLocalization.setLocalizationFile('/reports/stimulsoft/Localization/zh-CHS.xml' )
|
|
|
+
|
|
|
+ // 工具栏
|
|
|
+ var options = new Stimulsoft.Viewer.StiViewerOptions()
|
|
|
+ options.height = '100%'
|
|
|
+
|
|
|
+ options.appearance.scrollbarsMode = true
|
|
|
+ options.toolbar.showDesignButton = false
|
|
|
+ options.toolbar.showAboutButton = false
|
|
|
+ options.toolbar.showResourcesButton = false
|
|
|
+ options.toolbar.showFullScreenButton = false
|
|
|
+ options.toolbar.showOpenButton = false
|
|
|
+
|
|
|
+ options.appearance.showTooltips = false
|
|
|
+ options.appearance.showDialogsHelp = false
|
|
|
+
|
|
|
+ options.exports.showExportToDocument = false
|
|
|
+ options.toolbar.showParametersButton = true
|
|
|
+ options.appearance.bookmarksPrint = true
|
|
|
+
|
|
|
+ options.toolbar.printDestination = Stimulsoft.Viewer.StiPrintDestination.Direct
|
|
|
+
|
|
|
+ options.appearance.htmlRenderMode = Stimulsoft.Report.Export.StiHtmlExportMode.Table
|
|
|
+
|
|
|
+ let viewer = new Stimulsoft.Viewer.StiViewer(options, 'StiViewer', false)
|
|
|
+
|
|
|
+ // 报表
|
|
|
+ console.log("创建一个报表实例");
|
|
|
+ let report = new window.Stimulsoft.Report.StiReport();
|
|
|
+
|
|
|
+ // 加载文件
|
|
|
+ console.log("从url加载报表");
|
|
|
+ // report.loadFile("/reports/stimulsoft/demos/SimpleList.mrt");
|
|
|
+ report.load(url)
|
|
|
+ // 从模版和数据加载报表
|
|
|
+ // loadReport(report, '', {})
|
|
|
+
|
|
|
+ viewer.report = report;
|
|
|
+
|
|
|
+ this.$refs.reportContainer.showContainer(
|
|
|
+ ()=> {
|
|
|
+ setTimeout(() => {
|
|
|
+ viewer.renderHtml('reportContainer')
|
|
|
+ this.createViewerButtons(viewer)
|
|
|
+ }, 50)
|
|
|
+ },
|
|
|
+ ()=>{
|
|
|
+ },
|
|
|
+ )
|
|
|
+
|
|
|
+ console.log("加载成功完成!");
|
|
|
+ },
|
|
|
+ loadReport(report, content, data){
|
|
|
+ var mimeString = content
|
|
|
+ .split(',')[0]
|
|
|
+ .split(':')[1]
|
|
|
+ .split(';')[0]
|
|
|
+ var byteString = atob(content.split(',')[1])
|
|
|
+
|
|
|
+ var ab = new ArrayBuffer(byteString.length)
|
|
|
+ var ia = new Uint8Array(ab)
|
|
|
+
|
|
|
+ for (var i = 0; i < byteString.length; i++) {
|
|
|
+ ia[i] = byteString.charCodeAt(i)
|
|
|
+ }
|
|
|
+
|
|
|
+ var blob = new Blob([ab])
|
|
|
+ JSZip.loadAsync(blob).then(function(unziped) {
|
|
|
+ unziped
|
|
|
+ .file('reportfile.json')
|
|
|
+ .async('string')
|
|
|
+ .then(res => {
|
|
|
+ report.load(res)
|
|
|
+
|
|
|
+ if (!!data) {
|
|
|
+ var dataSet = new Stimulsoft.System.Data.DataSet(
|
|
|
+ 'reportData'
|
|
|
+ )
|
|
|
+ dataSet.readJson(data)
|
|
|
+ report.regData('reportData', 'reportData', dataSet)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ createDesignerButtons(e) {
|
|
|
+ if (!!e) {
|
|
|
+ try {
|
|
|
+ this.designer.jsObject.options.menus.localizationMenu.addEventListener(
|
|
|
+ 'click',
|
|
|
+ this.createDesignerButtons
|
|
|
+ )
|
|
|
+ } catch (error) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ let toolBarRow = this.designer.jsObject.options.toolBar.firstChild.tr[0]
|
|
|
+
|
|
|
+ let customButton = this.designer.jsObject.StatusPanelButton(
|
|
|
+ 'exitButton',
|
|
|
+ '关闭',
|
|
|
+ 'LoginControls.Window.CloseWhite.png',
|
|
|
+ '关闭',
|
|
|
+ null,
|
|
|
+ 30,
|
|
|
+ 60
|
|
|
+ )
|
|
|
+
|
|
|
+ customButton.image.style.width = customButton.image.style.height = '16px'
|
|
|
+
|
|
|
+ let buttonCell = document.createElement('td')
|
|
|
+
|
|
|
+ buttonCell.className = 'stiDesignerToolButtonCell'
|
|
|
+
|
|
|
+ buttonCell.appendChild(customButton)
|
|
|
+
|
|
|
+ toolBarRow.appendChild(buttonCell)
|
|
|
+
|
|
|
+ let that=this
|
|
|
+ customButton.action = function(e) {
|
|
|
+ let jsObject = this.jsObject
|
|
|
+
|
|
|
+ if (jsObject.options.reportIsModified) {
|
|
|
+ var messageForm = jsObject.MessageFormForSave()
|
|
|
+ messageForm.changeVisibleState(true)
|
|
|
+ messageForm.action = function(state) {
|
|
|
+ if (state) {
|
|
|
+ jsObject.SendCommandSaveReport()
|
|
|
+ setTimeout(() => {
|
|
|
+ jsObject.SendCommandCloseReport()
|
|
|
+ jsObject.designer.invokeExit()
|
|
|
+ if (that.$refs.reportContainer)
|
|
|
+ that.$refs.reportContainer.hideContainer()
|
|
|
+ }, 250)
|
|
|
+ } else {
|
|
|
+ jsObject.SendCommandCloseReport()
|
|
|
+ jsObject.designer.invokeExit()
|
|
|
+ if (that.$refs.reportContainer)
|
|
|
+ that.$refs.reportContainer.hideContainer()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ jsObject.SendCommandCloseReport()
|
|
|
+ jsObject.designer.invokeExit()
|
|
|
+ if (that.$refs.reportContainer)
|
|
|
+ that.$refs.reportContainer.hideContainer()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ createViewerButtons (viewer){
|
|
|
+ viewer.jsObject.collections.images['myClose.png'] =
|
|
|
+ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAAA0ElEQVQ4ja3TO05CQRQG4A8iOwAbtYWETndAaecK7NwCKmETtJZsSBNLobEz8ZFIJQ0UnOGSm3DnYviTybzO/895DQXGWGCVGQuMEqkRcwcfuMOLalziCaf4TIe9UG9nyMJmFRzNGoRK1BU4xxx9G7cfwostciGk+x8MqgySwDXe4tU53hVV+MNtTmAoX84JGv9NYgrHyR6DV8wUSW7hItZLm36ZVoVQxsFJLOMsPOrH/h7dQwR2cdxOTEn8DtUbPGc4V2H7Vb4Yqfedf/GYSGt8VUmxgyfuBAAAAABJRU5ErkJggg=='
|
|
|
+ const closeBtn = viewer.jsObject.SmallButton(
|
|
|
+ 'closeBtn',
|
|
|
+ '关闭',
|
|
|
+ 'myClose.png'
|
|
|
+ )
|
|
|
+
|
|
|
+ const toolbarTable = viewer.jsObject.controls.toolbar.firstChild.firstChild
|
|
|
+ const buttonsTable = toolbarTable.rows[0].lastChild.lastChild
|
|
|
+ const userButtonCell = buttonsTable.rows[0].insertCell(0)
|
|
|
+ userButtonCell.className = 'stiJsViewerClearAllStyles'
|
|
|
+ userButtonCell.appendChild(closeBtn)
|
|
|
+
|
|
|
+ let that=this
|
|
|
+ closeBtn.action = function() {
|
|
|
+ console.log(that.$refs.ReportContainer)
|
|
|
+ if (that.$refs.reportContainer)
|
|
|
+ that.$refs.reportContainer.hideContainer()
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ addedData(type, scope) {
|
|
|
+ this.form = {};
|
|
|
+ if (type == 1) {
|
|
|
+ this.bbDisabled = true;
|
|
|
+ this.$refs.crud.rowView(scope.row, scope.$index);
|
|
|
+ } else if (type == 2) {
|
|
|
+ this.bbDisabled = true;
|
|
|
+ var userIdList = [];
|
|
|
+ userIdList = scope.row.authorizedUsersId
|
|
|
+ let userObj = JSON.parse(localStorage.getItem("saber-userInfo")).content;
|
|
|
+ for(let id of userIdList) {
|
|
|
+ if (id == userObj.user_id) {
|
|
|
+ this.bbDisabled = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (userObj.user_name == 'admin') {
|
|
|
+ this.bbDisabled = false;
|
|
|
+ }
|
|
|
+ this.$refs.crud.rowEdit(scope.row, scope.$index);
|
|
|
+ } else if (type == 3) {
|
|
|
+ this.bbDisabled = false;
|
|
|
+ this.$refs.crud.rowAdd();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ rowSave(row, done, loading) {
|
|
|
+ row.authorizedUsersId = row.authorizedUsersId.join()
|
|
|
+ add(row).then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ }, error => {
|
|
|
+ loading();
|
|
|
+ window.console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ rowUpdate(row, index, done, loading) {
|
|
|
+ // console.log(row.authorizedUsersId)
|
|
|
+ // row.authorizedUsersId = row.authorizedUsersId.join()
|
|
|
+ update(row).then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ done();
|
|
|
+ }, error => {
|
|
|
+ loading();
|
|
|
+ console.log(error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ rowDel(row) {
|
|
|
+ this.$confirm("确定将选择数据删除?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ return remove(row.id);
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.onLoad(this.page);
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ 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();
|
|
|
+ },
|
|
|
+ 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();
|
|
|
+ },
|
|
|
+ currentChange(currentPage){
|
|
|
+ this.page.currentPage = currentPage;
|
|
|
+ },
|
|
|
+ sizeChange(pageSize){
|
|
|
+ this.page.pageSize = pageSize;
|
|
|
+ },
|
|
|
+ refreshChange() {
|
|
|
+ this.onLoad(this.page, this.query);
|
|
|
+ },
|
|
|
+ onLoad(page, params = {}) {
|
|
|
+ this.loading = true;
|
|
|
+ getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
|
|
+ const data = res.data.data;
|
|
|
+ this.page.total = data.total;
|
|
|
+ this.data = data.records;
|
|
|
+ this.loading = false;
|
|
|
+ this.selectionClear();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //自定义列保存
|
|
|
+ async saveColumnTwo(ref, option, optionBack, code) {
|
|
|
+ /**
|
|
|
+ * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
|
|
|
+ * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
|
|
|
+ * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
|
|
|
+ */
|
|
|
+ const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
|
|
|
+ if (inSave) {
|
|
|
+ this.$message.success("保存成功");
|
|
|
+ //关闭窗口
|
|
|
+ this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //自定义列重置
|
|
|
+ async resetColumnTwo(ref, option, optionBack, code) {
|
|
|
+ this[option] = this[optionBack];
|
|
|
+ const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
|
|
|
+ if (inSave) {
|
|
|
+ this.$message.success("重置成功");
|
|
|
+ this.$refs[ref].$refs.dialogColumn.columnBox = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 更改表格颜色
|
|
|
+ headerClassName(tab) {
|
|
|
+ //颜色间隔
|
|
|
+ let back = ""
|
|
|
+ if (tab.columnIndex >= 0 && tab.column.level === 1) {
|
|
|
+ if (tab.columnIndex % 2 === 0) {
|
|
|
+ back = "back-one"
|
|
|
+ } else if (tab.columnIndex % 2 === 1) {
|
|
|
+ back = "back-two"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return back;
|
|
|
+ },
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+::v-deep#out-table .back-one {
|
|
|
+ background: #ecf5ff !important;
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep#out-table .back-two {
|
|
|
+ background: #ecf5ff !important;
|
|
|
+}
|
|
|
+
|
|
|
+::v-deep .el-input-group__append {
|
|
|
+ padding: 0 0px !important;
|
|
|
+}
|
|
|
+
|
|
|
+/deep/ .el-tree-node__content>.el-tree-node__expand-icon {
|
|
|
+ visibility: hidden;
|
|
|
+}
|
|
|
+
|
|
|
+/deep/ .el-col-md-8 {
|
|
|
+ width: 24.33333%;
|
|
|
+}
|
|
|
+</style>
|