Browse Source

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

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

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

@ -4,11 +4,11 @@
<div class="top_btn flex flex-end"> <div class="top_btn flex flex-end">
<div> <div>
<el-button type="text" round @click="handelClickBack" icon="el-icon-back">返回</el-button> <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>
<el-button type="success" @click="onClickUplond" v-if="pageType !== 'info'"> 数据列表导出</el-button> <el-button type="success" @click="onClickUplond" v-if="pageType !== 'info'"> 数据列表导出</el-button>
<el-button type="success" @click="onClickShowCondition" <el-button type="success" @click="onClickShowCondition" v-if="pageType === 'info' && this.infoObj.reportType === 0"> 数据统计条件</el-button>
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>
<div> <div>
<el-button type="primary" @click="handleClickExport()"> 导出</el-button> <el-button type="primary" @click="handleClickExport()"> 导出</el-button>
@ -30,23 +30,27 @@
:close-on-click-modal="false"> :close-on-click-modal="false">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" :label-width="'120px'"> <el-form :model="dataForm" :rules="dataRule" ref="dataForm" :label-width="'120px'">
<el-form-item label="报表名称" prop="reportName"> <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>
<el-form-item label="上传模板"> <el-form-item label="上传模板" prop="moduleUrl">
<el-upload :headers="$getElUploadHeaders()" ref="upload" class="upload-btn" :action="uploadUlr" <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"> :auto-upload="true" :on-success="handleExcelSuccess" :before-upload="beforeExcelUpload">
<template #trigger> <template #trigger>
<el-button type="primary" v-loading.fullscreen.lock="fullscreenLoading">上传报表模板</el-button> <el-button type="primary" v-loading.fullscreen.lock="fullscreenLoading">上传报表模板</el-button>
</template> </template>
</el-upload> </el-upload>
<section v-else class="upload"> <section v-else >
<img :src="require(`@/assets/images/index/Excel.png`)" alt=""> <img :src="require(`@/assets/images/index/Excel.png`)" class="upload-img" alt="">
<span>{{ fileName }}</span> <span>{{ fileName }}</span>
<el-button type="text" @click="removeFile(file)" style="margin-left: 16px;"> 删除</el-button> <el-button type="text" @click="removeFile(file)" style="margin-left: 16px;"> 删除</el-button>
</section> </section>
</el-form-item> </el-form-item>
</el-form> </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-dialog>
<el-drawer title="单元格统计条件设置" :size="'50%'" :visible.sync="drawer" :direction="direction" :before-close="handleClose" <el-drawer title="单元格统计条件设置" :size="'50%'" :visible.sync="drawer" :direction="direction" :before-close="handleClose"
v-loading="statisticsLoading" v-if="drawer"> v-loading="statisticsLoading" v-if="drawer">
@ -404,10 +408,13 @@ export default {
workbookId: '', workbookId: '',
formCode: "", formCode: "",
columnsJson: [], columnsJson: [],
searchForm: {} searchForm: {},
moduleUrl:''
}, },
dataRule: { 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: { tagRule: {
tagName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }] tagName: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }]
@ -457,7 +464,7 @@ export default {
showConditionDetailsDialog:false, showConditionDetailsDialog:false,
luckysheetLoading:false, luckysheetLoading:false,
reportId:'', reportId:'',
moduleUrl:'' fileName:''
}; };
}, },
props: { props: {
@ -536,6 +543,47 @@ export default {
}) })
}, },
methods: { 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){ async handelRemoveTag(row){
const url = `/governance/resiSearchTag/deleteResiSearchTag/${row.tagId}`; const url = `/governance/resiSearchTag/deleteResiSearchTag/${row.tagId}`;
let { code, msg } = await requestPost(url); let { code, msg } = await requestPost(url);
@ -570,11 +618,11 @@ export default {
}, },
async initForm(type, row) { async initForm(type, row) {
this.tagForm.tagName = row.tagName; if (type == "view") {
if (type == "info") {
await this.getFormEdit(row.tagId); await this.getFormEdit(row.tagId);
} else if (type == "edit") { } else if (type == "edit") {
await this.getFormEdit(row.tagId); await this.getFormEdit(row.tagId);
this.tagForm.tagName = row.tagName;
} }
this.tagForm.tagId = row.tagId; this.tagForm.tagId = row.tagId;
for (let i in this.tableData) { for (let i in this.tableData) {
@ -593,7 +641,7 @@ export default {
} }
}, },
handelClickTag(item) { handelClickTag(item) {
this.initForm("edit", item); this.initForm("view", item);
}, },
async fetchData(url, params) { async fetchData(url, params) {
try { try {
@ -704,7 +752,7 @@ export default {
} }
}, },
// //
async getConditions4Cell() { async getConditions4Cell(type) {
let url = '/actual/base/intellgentizeReport/getConditions4Cell'; let url = '/actual/base/intellgentizeReport/getConditions4Cell';
let parm = { let parm = {
axis: this.selectedCell, axis: this.selectedCell,
@ -712,7 +760,7 @@ export default {
} }
const { data, code, msg } = await requestGet(url, parm) const { data, code, msg } = await requestGet(url, parm)
if (code === 0) { if (code === 0) {
this.initForm('info',data) this.initForm(type,data)
} }
}, },
@ -926,16 +974,27 @@ export default {
}, },
handleExcelSuccess(e) { handleExcelSuccess(e) {
if (e.code === 0) { if (e.code === 0) {
this.moduleUrl = e.data.url; this.dataForm.moduleUrl = e.data.url;
const newUrl = e.data.url.replace( 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/, /^https:\/\/elink-esua-epdc\.oss-cn-qingdao\.aliyuncs\.com/,
`${location.origin}` `${location.origin}`
); );
this.urlToFile(newUrl)
this.showTemplate = false;
// this.urlToFile('http://localhost:9001/epmet-work-pc/test1.xlsx') // 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') { async urlToFile(url, fileName = 'file') {
try { try {
@ -991,13 +1050,13 @@ export default {
if((this.$store.state.user.id === this.infoObj.creatorId) || this.importType === 'template'){ if((this.$store.state.user.id === this.infoObj.creatorId) || this.importType === 'template'){
this.showConditionDetailsDialog = false; this.showConditionDetailsDialog = false;
let statisticalValue = luckysheet.getCellValue(row-1,column-1) let statisticalValue = luckysheet.getCellValue(row-1,column-1)
if(statisticalValue&&(statisticalValue !== 0 && statisticalValue !== null)){ if(statisticalValue && (statisticalValue !== 0 && statisticalValue !== null)){
this.activeName = 'history'; this.activeName = 'history';
this.getConditions4Cell(); this.getConditions4Cell('edit');
} }
}else{ }else{
this.showConditionDetailsDialog = true; this.showConditionDetailsDialog = true;
this.getConditions4Cell() this.getConditions4Cell('view')
} }
} }
}, },
@ -1055,7 +1114,7 @@ export default {
} }
}, },
// //
async handleClickInspect() { async handleClickUploadTemplate() {
this.showTemplate = true; this.showTemplate = true;
this.importType = 'template' this.importType = 'template'
}, },
@ -1083,6 +1142,9 @@ export default {
range: `A2:${bottomRightCorner}${listData.length}`, range: `A2:${bottomRightCorner}${listData.length}`,
}) })
this.reportId = val.id; this.reportId = val.id;
this.infoObj.reportType = 0;
this.pageType = 'info';
this.getSheetList();
this.luckysheetLoading = false; this.luckysheetLoading = false;
}, },
async saveLuckysheetHead(head) { async saveLuckysheetHead(head) {
@ -1175,7 +1237,7 @@ export default {
padding: 0px; padding: 0px;
z-index: 2; z-index: 2;
width: calc(100vw - 400px); width: calc(100vw - 400px);
height: calc(100vh - 250px); height: calc(100vh - 220px);
} }
.luckysheet-wrap-all { .luckysheet-wrap-all {
@ -1183,7 +1245,7 @@ export default {
padding: 0px; padding: 0px;
z-index: 2; z-index: 2;
width: calc(100vw - 100px); width: calc(100vw - 100px);
height: calc(100vh - 250px); height: calc(100vh - 200px);
} }
#luckysheet-export { #luckysheet-export {
@ -1199,10 +1261,10 @@ export default {
width: 100%; width: 100%;
} }
.upload-demo { .upload-img{
position: absolute; width: 30px;
z-index: 999999; height: 30px;
margin: 20px 0 0 22px; margin-right: 10px;
} }
.right-slider { .right-slider {

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

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

Loading…
Cancel
Save