Browse Source

bug#1938智能报表上传统计类报表

bug#1940使用已有标签把标签名称取消掉
luckysheet_xiaowang
mk 5 months ago
parent
commit
e006ca8aac
  1. 124
      src/views/modules/base/smartExcel/cpts/export-view.vue
  2. 2
      src/views/modules/base/smartExcel/report.vue

124
src/views/modules/base/smartExcel/cpts/export-view.vue

@ -4,11 +4,11 @@
<div class="top_btn flex flex-end">
<div>
<el-button type="text" round @click="handelClickBack" icon="el-icon-back">返回</el-button>
<el-button type="warning" @click="handleClickInspect" v-if="pageType !== 'info'">上传统计模板
<el-button type="warning" @click="handleClickUploadTemplate" v-if="pageType !== 'info'">上传统计模板
</el-button>
<el-button type="success" @click="onClickUplond" v-if="pageType !== 'info'"> 数据列表导出</el-button>
<el-button type="success" @click="onClickShowCondition"
v-if="pageType === 'info' && this.infoObj.reportType === 0"> 数据统计条件</el-button>
<el-button type="success" @click="onClickShowCondition" v-if="pageType === 'info' && this.infoObj.reportType === 0"> 数据统计条件</el-button>
<el-button type="warning" v-if="pageType === 'info' && this.infoObj.reportType === 0" @click="handleClickInspect"> 自动检查</el-button>
</div>
<div>
<el-button type="primary" @click="handleClickExport()"> 导出</el-button>
@ -30,23 +30,27 @@
:close-on-click-modal="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" :label-width="'120px'">
<el-form-item label="报表名称" prop="reportName">
<el-input v-model.trim="dataForm.reportName" placeholder="报表名称"></el-input>
<el-input v-model.trim="dataForm.reportName" placeholder="请输入报表名称,5-30个字符"></el-input>
</el-form-item>
<el-form-item label="上传模板">
<el-form-item label="上传模板" prop="moduleUrl">
<el-upload :headers="$getElUploadHeaders()" ref="upload" class="upload-btn" :action="uploadUlr"
v-if="!moduleUrl" :limit="1" :accept="'.xlsx'" :with-credentials="true" :show-file-list="false"
v-if="!dataForm.moduleUrl" :limit="1" :accept="'.xlsx'" :with-credentials="true" :show-file-list="false"
:auto-upload="true" :on-success="handleExcelSuccess" :before-upload="beforeExcelUpload">
<template #trigger>
<el-button type="primary" v-loading.fullscreen.lock="fullscreenLoading">上传报表模板</el-button>
</template>
</el-upload>
<section v-else class="upload">
<img :src="require(`@/assets/images/index/Excel.png`)" alt="">
<section v-else >
<img :src="require(`@/assets/images/index/Excel.png`)" class="upload-img" alt="">
<span>{{ fileName }}</span>
<el-button type="text" @click="removeFile(file)" style="margin-left: 16px;"> 删除</el-button>
</section>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="handleCloseTemplate"> </el-button>
<el-button type="primary" @click="handleSaveTemplate"> </el-button>
</div>
</el-dialog>
<el-drawer title="单元格统计条件设置" :size="'50%'" :visible.sync="drawer" :direction="direction" :before-close="handleClose"
v-loading="statisticsLoading" v-if="drawer">
@ -404,10 +408,13 @@ export default {
workbookId: '',
formCode: "",
columnsJson: [],
searchForm: {}
searchForm: {},
moduleUrl:''
},
dataRule: {
reportName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
reportName: [{ required: true, message: '报表名称长度5-10个字符', trigger: 'blur',max:30,min:5 }],
moduleUrl:[{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
},
tagRule: {
tagName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
@ -457,7 +464,7 @@ export default {
showConditionDetailsDialog:false,
luckysheetLoading:false,
reportId:'',
moduleUrl:''
fileName:''
};
},
props: {
@ -536,6 +543,47 @@ export default {
})
},
methods: {
removeFile() {
this.dataForm.moduleUrl = '';
this.fileName = '';
},
async handleClickInspect() {
// celldatalist
const list = luckysheet.getAllSheets()[0].celldata.map(item => ({
r: item.r,
c: item.c,
v: item.v.v || ''
}));
//
let { data, code, msg } = await requestPost('/actual/base/intelligentImportData/checkData', list);
if (code === 0) {
if (data && data.length > 0) {
for (const { r, c } of data) {
luckysheet.setCellFormat(r, c, 'bg', '#f5504a');
}
const findArr = this.findUniqueElements(luckysheet.getAllSheets()[0].celldata, data);
findArr.forEach(({ r, c, v }) => {
if (v.bg === "#f5504a") {
luckysheet.setCellFormat(r, c, 'bg', '#ffffff');
}
});
} else {
console.log(luckysheet.getAllSheets()[0].celldata);
luckysheet.getAllSheets()[0].celldata.forEach(item=>{
if(item.v.bg==="#f5504a"){
luckysheet.setCellFormat(item.r, item.c, 'bg', '#ffffff');
}
})
this.$message.success('没有找到异常');
}
}
},
findUniqueElements(A, B) {
// Brc
const bCombinations = new Set(B.map(item => `${item.r},${item.c}`));
// AB
return A.filter(item => !bCombinations.has(`${item.r},${item.c}`));
},
async handelRemoveTag(row){
const url = `/governance/resiSearchTag/deleteResiSearchTag/${row.tagId}`;
let { code, msg } = await requestPost(url);
@ -570,11 +618,11 @@ export default {
},
async initForm(type, row) {
this.tagForm.tagName = row.tagName;
if (type == "info") {
if (type == "view") {
await this.getFormEdit(row.tagId);
} else if (type == "edit") {
await this.getFormEdit(row.tagId);
this.tagForm.tagName = row.tagName;
}
this.tagForm.tagId = row.tagId;
for (let i in this.tableData) {
@ -593,7 +641,7 @@ export default {
}
},
handelClickTag(item) {
this.initForm("edit", item);
this.initForm("view", item);
},
async fetchData(url, params) {
try {
@ -704,7 +752,7 @@ export default {
}
},
//
async getConditions4Cell() {
async getConditions4Cell(type) {
let url = '/actual/base/intellgentizeReport/getConditions4Cell';
let parm = {
axis: this.selectedCell,
@ -712,7 +760,7 @@ export default {
}
const { data, code, msg } = await requestGet(url, parm)
if (code === 0) {
this.initForm('info',data)
this.initForm(type,data)
}
},
@ -926,16 +974,27 @@ export default {
},
handleExcelSuccess(e) {
if (e.code === 0) {
this.moduleUrl = e.data.url;
const newUrl = e.data.url.replace(
this.dataForm.moduleUrl = e.data.url;
this.fullscreenLoading = false;
}
},
handleSaveTemplate(){
this.$refs['dataForm'].validate(valid=>{
if (!valid) {
return false
}
const newUrl = this.dataForm.moduleUrl.replace(
/^https:\/\/elink-esua-epdc\.oss-cn-qingdao\.aliyuncs\.com/,
`${location.origin}`
);
this.urlToFile(newUrl)
this.showTemplate = false;
// this.urlToFile('http://localhost:9001/epmet-work-pc/test1.xlsx')
this.fullscreenLoading = false;
}
this.urlToFile(`${process.env.NODE_ENV === "development" ?'http://localhost:9001/epmet-work-pc/test1.xlsx':newUrl}`)
this.showTemplate = false;
})
},
handleCloseTemplate(){
this.$refs['dataForm'].resetFields();
this.showTemplate = false;
},
async urlToFile(url, fileName = 'file') {
try {
@ -993,11 +1052,11 @@ export default {
let statisticalValue = luckysheet.getCellValue(row-1,column-1)
if(statisticalValue && (statisticalValue !== 0 && statisticalValue !== null)){
this.activeName = 'history';
this.getConditions4Cell();
this.getConditions4Cell('edit');
}
}else{
this.showConditionDetailsDialog = true;
this.getConditions4Cell()
this.getConditions4Cell('view')
}
}
},
@ -1055,7 +1114,7 @@ export default {
}
},
//
async handleClickInspect() {
async handleClickUploadTemplate() {
this.showTemplate = true;
this.importType = 'template'
},
@ -1083,6 +1142,9 @@ export default {
range: `A2:${bottomRightCorner}${listData.length}`,
})
this.reportId = val.id;
this.infoObj.reportType = 0;
this.pageType = 'info';
this.getSheetList();
this.luckysheetLoading = false;
},
async saveLuckysheetHead(head) {
@ -1175,7 +1237,7 @@ export default {
padding: 0px;
z-index: 2;
width: calc(100vw - 400px);
height: calc(100vh - 250px);
height: calc(100vh - 220px);
}
.luckysheet-wrap-all {
@ -1183,7 +1245,7 @@ export default {
padding: 0px;
z-index: 2;
width: calc(100vw - 100px);
height: calc(100vh - 250px);
height: calc(100vh - 200px);
}
#luckysheet-export {
@ -1199,10 +1261,10 @@ export default {
width: 100%;
}
.upload-demo {
position: absolute;
z-index: 999999;
margin: 20px 0 0 22px;
.upload-img{
width: 30px;
height: 30px;
margin-right: 10px;
}
.right-slider {

2
src/views/modules/base/smartExcel/report.vue

@ -155,7 +155,7 @@ export default {
computed: {
maxTableHeight() {
const h = this.clientHeight - this.searchH - 275;
const _h = this.clientHeight - 275 - this.searchH;
const _h = this.clientHeight - 220 - this.searchH;
return this.$store.state.inIframe ? h : _h;
},
...mapGetters(["clientHeight"]),

Loading…
Cancel
Save