|
|
@ -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() { |
|
|
|
// 获取celldata并转换为list |
|
|
|
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) { |
|
|
|
// 创建B中r和c组合的键集合 |
|
|
|
const bCombinations = new Set(B.map(item => `${item.r},${item.c}`)); |
|
|
|
// 过滤A中不存在于B的组合 |
|
|
|
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 { |
|
|
@ -991,13 +1050,13 @@ export default { |
|
|
|
if((this.$store.state.user.id === this.infoObj.creatorId) || this.importType === 'template'){ |
|
|
|
this.showConditionDetailsDialog = false; |
|
|
|
let statisticalValue = luckysheet.getCellValue(row-1,column-1) |
|
|
|
if(statisticalValue&&(statisticalValue !== 0 && statisticalValue !== null)){ |
|
|
|
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 { |
|
|
|