|
@@ -11,8 +11,7 @@
|
|
|
<div class="main-left left" id="left" v-show="!isSlideLeft">
|
|
|
<div class="datasheet_top">
|
|
|
|
|
|
- <el-button
|
|
|
- v-permission="permissionBtn.etaTablePermission.etaTable_excel"
|
|
|
+ <el-button
|
|
|
type="primary"
|
|
|
style="margin-right:20px"
|
|
|
:loading="isUploadLoading"
|
|
@@ -20,9 +19,7 @@
|
|
|
>上传文件</el-button>
|
|
|
<input type="file" @change="fileSelected" id="file" style="display: none;">
|
|
|
|
|
|
- <el-button>
|
|
|
- <el-checkbox v-model="isShowMe" @change="() => { getTreeData();getPublicList() }">只看我的</el-checkbox>
|
|
|
- </el-button>
|
|
|
+ <el-checkbox v-model="isShowMe" @change="() => { getTreeData();getPublicList() }">只看我的</el-checkbox>
|
|
|
</div>
|
|
|
<div class="search-cont">
|
|
|
<el-select
|
|
@@ -142,7 +139,7 @@
|
|
|
:style="isSlideLeft ? 'width:100%' : 'width:80%'"
|
|
|
>
|
|
|
<!-- 表格详情 -->
|
|
|
- <div class="sheet-detail-wrapper" v-if="select_id">
|
|
|
+ <div class="sheet-detail-wrapper" v-if="select_id" >
|
|
|
<div class="detail-top">
|
|
|
<span class="author"
|
|
|
>作者:{{ sheetDetailInfo.SysUserRealName }}</span
|
|
@@ -162,51 +159,24 @@
|
|
|
v-else
|
|
|
>
|
|
|
{{ sheetDetailInfo.ExcelName }}
|
|
|
- <i class="el-icon-edit" v-if="sheetDetailInfo.Source === 1" />
|
|
|
+ <i class="el-icon-edit"/>
|
|
|
</span>
|
|
|
<ul class="action-ul">
|
|
|
- <li
|
|
|
- class="editsty"
|
|
|
- v-if="
|
|
|
- sheetDetailInfo.Button.OpButton&&permissionBtn.checkPermissionBtn(permissionBtn.etaTablePermission.etaTable_excel_save)
|
|
|
- "
|
|
|
- >
|
|
|
- 生成指标
|
|
|
- </li>
|
|
|
- <li
|
|
|
- class="editsty"
|
|
|
- v-if="
|
|
|
- sheetDetailInfo.Button.OpButton&&permissionBtn.checkPermissionBtn(permissionBtn.etaTablePermission.etaTable_excel_save)
|
|
|
- "
|
|
|
- >
|
|
|
- 更新文件
|
|
|
- </li>
|
|
|
- <li
|
|
|
- class="editsty"
|
|
|
- @click="saveHandle"
|
|
|
- v-if="
|
|
|
- sheetDetailInfo.Button.OpButton&&permissionBtn.checkPermissionBtn(permissionBtn.etaTablePermission.etaTable_excel_save)
|
|
|
- "
|
|
|
- >
|
|
|
- 保存
|
|
|
- </li>
|
|
|
+ <li class="editsty" @click="HandleToPath">生成指标</li>
|
|
|
+ <li class="editsty" @click="refreshSheet">刷新</li>
|
|
|
+ <li class="editsty" @click="saveHandle">保存</li>
|
|
|
<li
|
|
|
class="editsty"
|
|
|
@click="saveOtherHandle"
|
|
|
- v-if="sheetDetailInfo.Button.CopyButton&&permissionBtn.checkPermissionBtn(permissionBtn.etaTablePermission.etaTable_customize_otherSave)"
|
|
|
>
|
|
|
另存为
|
|
|
</li>
|
|
|
- <li v-if="isDownLoadShow(sheetDetailInfo)"
|
|
|
- class="editsty" @click="downloadExcel(sheetDetailInfo)">
|
|
|
+ <li class="editsty" @click="downloadExcel
|
|
|
+ (sheetDetailInfo)">
|
|
|
下载
|
|
|
</li>
|
|
|
<li
|
|
|
class="deletesty"
|
|
|
- v-if="
|
|
|
- sheetDetailInfo.Button && sheetDetailInfo.Button.DeleteButton
|
|
|
- &&isDeleteShow(sheetDetailInfo)
|
|
|
- "
|
|
|
@click="delSheetHandle({cell:sheetDetailInfo, type:'del'})"
|
|
|
>
|
|
|
删除
|
|
@@ -214,17 +184,14 @@
|
|
|
</ul>
|
|
|
</div>
|
|
|
|
|
|
+ <dataLoading :loading="isSheetLoading"/>
|
|
|
+
|
|
|
<!-- 表格 -->
|
|
|
<div class="sheet-wrap">
|
|
|
<Sheet
|
|
|
ref="sheetRef"
|
|
|
- :option="{
|
|
|
- data: [{
|
|
|
- ...JSON.parse(sheetDetailInfo.Content),
|
|
|
- scrollTop: 0,
|
|
|
- scrollLeft: 0
|
|
|
- }]
|
|
|
- }"
|
|
|
+ v-if="sheetConfigOpt.data"
|
|
|
+ :option="sheetConfigOpt"
|
|
|
:sheetInfo="{
|
|
|
ExcelInfoId: sheetDetailInfo.ExcelInfoId,
|
|
|
ExcelName: sheetDetailInfo.ExcelName,
|
|
@@ -366,6 +333,14 @@ export default {
|
|
|
select_id: "", //选中的表格id
|
|
|
sheetDetailInfo: {},
|
|
|
sheet_title: "", //表格标题 双击标题修改时来存储最新值
|
|
|
+ sheetConfigOpt: {
|
|
|
+ showsheetbar: true,
|
|
|
+ data: null
|
|
|
+ },
|
|
|
+ sheetDataPage: 2,
|
|
|
+ sheetAllcellData:[],//全部单元格数据 分页push
|
|
|
+ dataToalPage: 0,
|
|
|
+ isSheetLoading: false,
|
|
|
|
|
|
/* 表格列表 */
|
|
|
publicHaveMove: true, //是否还有列表数据
|
|
@@ -389,7 +364,11 @@ export default {
|
|
|
],
|
|
|
},
|
|
|
|
|
|
- isShowMe: false
|
|
|
+ isShowMe: false,
|
|
|
+
|
|
|
+ sourceMap: {
|
|
|
+ '/sheetAnalysisList': 4,
|
|
|
+ },
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
@@ -402,6 +381,10 @@ export default {
|
|
|
},
|
|
|
/* 表格id */
|
|
|
select_id(newval) {
|
|
|
+ this.sheetDataPage = 2,
|
|
|
+ this.sheetAllcellData = [],//全部单元格数据 分页push
|
|
|
+ this.dataToalPage = 0;
|
|
|
+ this.sheetConfigOpt.data = null;
|
|
|
newval && this.getDetailHandle();
|
|
|
},
|
|
|
|
|
@@ -436,7 +419,7 @@ export default {
|
|
|
|
|
|
/* 获取表格分类 */
|
|
|
getTreeData(params = null) {
|
|
|
- sheetInterface.classifyList().then((res) => {
|
|
|
+ sheetInterface.classifyList({Source: this.sourceMap[this.$route.path],IsShowMe: this.isShowMe}).then((res) => {
|
|
|
const { Ret, Data } = res;
|
|
|
if (Ret !== 200) return;
|
|
|
|
|
@@ -458,6 +441,7 @@ export default {
|
|
|
Keyword: query,
|
|
|
CurrentIndex: 1,
|
|
|
PageSize: 10000,
|
|
|
+ Source: this.sourceMap[this.$route.path]
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.Ret !== 200) return;
|
|
@@ -533,6 +517,7 @@ export default {
|
|
|
.classifyDel({
|
|
|
ExcelClassifyId,
|
|
|
ExcelInfoId,
|
|
|
+ Source: this.sourceMap[this.$route.path]
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.Ret !== 200) return;
|
|
@@ -584,22 +569,8 @@ export default {
|
|
|
|
|
|
/* 下载数据 */
|
|
|
downloadExcel(cell) {
|
|
|
- const { Source, FileUrl, ExcelInfoId, ExcelName } = cell;
|
|
|
- let value = "";
|
|
|
- if (Source === 1) {
|
|
|
- value = FileUrl;
|
|
|
- this.downLoad(value, ExcelName);
|
|
|
- } else if ([2, 3].includes(Source)) {
|
|
|
- value = `${this.downExcelFileUrl}&ExcelInfoId=${ExcelInfoId}`;
|
|
|
-
|
|
|
- const a = document.createElement("a");
|
|
|
- a.href = value;
|
|
|
- a.target = "_blank";
|
|
|
- a.download = ExcelName;
|
|
|
- a.style.display = "none";
|
|
|
- document.body.append(a);
|
|
|
- a.click();
|
|
|
- }
|
|
|
+ const { FileUrl, ExcelName } = cell;
|
|
|
+ this.downLoad(FileUrl, ExcelName);
|
|
|
},
|
|
|
|
|
|
downLoad(url, filename) {
|
|
@@ -622,8 +593,7 @@ export default {
|
|
|
/* 保存表格 */
|
|
|
saveHandle: _.debounce(async function () {
|
|
|
luckysheet.exitEditMode();
|
|
|
- let data = luckysheet.getAllSheets()[0];
|
|
|
- if (!data.celldata.length) return this.$message.warning("请输入表格内容");
|
|
|
+ let data = luckysheet.getAllSheets();
|
|
|
|
|
|
this.loading = this.$loading({
|
|
|
target: ".dataSheet-container",
|
|
@@ -633,14 +603,14 @@ export default {
|
|
|
background: "rgba(255, 255, 255, 0.6)",
|
|
|
});
|
|
|
|
|
|
- let img = getSheetImage(data);
|
|
|
+ let img = getSheetImage(data[0]);
|
|
|
const form = new FormData();
|
|
|
form.append("Image", img);
|
|
|
const { Data } = await sheetInterface.uploadImg(form);
|
|
|
|
|
|
data.luckysheet_select_save = [];
|
|
|
const { ExcelInfoId, ExcelName, ExcelClassifyId } = this.sheetDetailInfo;
|
|
|
- const res = await sheetInterface.sheetEdit({
|
|
|
+ const res = await sheetInterface.sheetAnalysisInterface.sheetEdit({
|
|
|
ExcelInfoId,
|
|
|
ExcelName,
|
|
|
ExcelClassifyId,
|
|
@@ -652,7 +622,7 @@ export default {
|
|
|
this.$message.success("保存成功");
|
|
|
this.getTreeData();
|
|
|
|
|
|
- this.getDetailHandle();
|
|
|
+ // this.getDetailHandle();
|
|
|
}, 300),
|
|
|
|
|
|
/* 获取表格列表 */
|
|
@@ -662,6 +632,8 @@ export default {
|
|
|
CurrentIndex: this.sheet_page,
|
|
|
PageSize: this.sheet_pages_size,
|
|
|
ExcelClassifyId: this.select_classify || 0,
|
|
|
+ Source: this.sourceMap[this.$route.path],
|
|
|
+ IsShowMe: this.isShowMe
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res.Ret !== 200) return;
|
|
@@ -694,25 +666,58 @@ export default {
|
|
|
|
|
|
/* 获取表格详情 */
|
|
|
getDetailHandle() {
|
|
|
- sheetInterface
|
|
|
- .sheetDetail({
|
|
|
- ExcelInfoId: this.select_id,
|
|
|
- })
|
|
|
- .then((res) => {
|
|
|
- if (res.Ret !== 200) return;
|
|
|
+ this.isSheetLoading = true;
|
|
|
+ sheetInterface.sheetAnalysisInterface.getExcelDetail({
|
|
|
+ UniqueCode: this.select_node,
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.Ret !== 200) return;
|
|
|
|
|
|
- this.sheetDetailInfo = res.Data;
|
|
|
+ this.sheetDetailInfo = res.Data.ExcelInfo;
|
|
|
+ this.dataToalPage = Math.max(...res.Data.SheetList.map(_ => _.PageNum));
|
|
|
+ this.sheetAllcellData = res.Data.SheetList.map(_ => JSON.parse(_.Data.Data));
|
|
|
|
|
|
- this.$nextTick(() => {
|
|
|
- this.sheetDetailInfo.Source === 1 && this.$refs.sheetRef.init();
|
|
|
+ this.getCellData(res.Data.SheetList)
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- this.sheetDetailInfo.Source === 2 &&
|
|
|
- this.$refs.customTableRef.initSheetData(res.Data.TableData);
|
|
|
+ //分页获取表格数据
|
|
|
+ async getCellData(sheets) {
|
|
|
|
|
|
- this.sheetDetailInfo.Source === 3 &&
|
|
|
- this.$refs.mixedTableRef.initData(res.Data.TableData);
|
|
|
- });
|
|
|
- });
|
|
|
+ let res = await sheetInterface.sheetAnalysisInterface.getExcelDataByPage({
|
|
|
+ UniqueCode: this.select_node,
|
|
|
+ Page: this.sheetDataPage
|
|
|
+ })
|
|
|
+
|
|
|
+ if(res.Ret !== 200) return
|
|
|
+ console.log(this.sheetAllcellData)
|
|
|
+
|
|
|
+ for(let i = 0;i<this.sheetAllcellData.length;i++) {
|
|
|
+ if(res.Data[i].Data) {
|
|
|
+ this.sheetAllcellData[i] = [...this.sheetAllcellData[i],...JSON.parse(res.Data[i].Data.Data)]
|
|
|
+ }
|
|
|
+
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
+ //数据继续加载或渲染表格
|
|
|
+ if(this.sheetDataPage < this.dataToalPage) {
|
|
|
+ this.sheetDataPage++;
|
|
|
+ this.getCellData(sheets)
|
|
|
+ }else {
|
|
|
+ console.log(this.sheetAllcellData)
|
|
|
+ this.sheetConfigOpt.data = sheets.map((_,index) => ({
|
|
|
+ // index: _.Sort, //工作表索引
|
|
|
+ order: _.Sort, //工作表的下标
|
|
|
+ name: _.SheetName,
|
|
|
+ calcChain: JSON.parse(_.CalcChain),
|
|
|
+ config: JSON.parse(_.Config),
|
|
|
+ celldata: this.sheetAllcellData[index],
|
|
|
+ }))
|
|
|
+
|
|
|
+ console.log(this.sheetConfigOpt)
|
|
|
+
|
|
|
+ this.isSheetLoading = false;
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
/* 删除表格 */
|
|
@@ -729,29 +734,6 @@ export default {
|
|
|
.catch(() => {});
|
|
|
},
|
|
|
|
|
|
- /* 编辑 */
|
|
|
- goEditHandle() {
|
|
|
- let path = {
|
|
|
- 2: "/addCustomSheet",
|
|
|
- 3: "addMixedSheet",
|
|
|
- };
|
|
|
- this.$router.push({
|
|
|
- path: path[this.sheetDetailInfo.Source],
|
|
|
- query: { id: this.sheetDetailInfo.ExcelInfoId },
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- /* 刷新表格 */
|
|
|
- refreshSheet: _.debounce(async function () {
|
|
|
- const res = await sheetInterface.refreshCustomSheet({
|
|
|
- ExcelInfoId: this.sheetDetailInfo.ExcelInfoId,
|
|
|
- });
|
|
|
-
|
|
|
- if (res.Ret !== 200) return;
|
|
|
- this.$message.success("刷新成功");
|
|
|
- this.getDetailHandle();
|
|
|
- }, 300),
|
|
|
-
|
|
|
/* 表格另存为 */
|
|
|
saveOtherHandle() {
|
|
|
this.saveOtherForm.name = this.sheetDetailInfo.ExcelName + "(1)";
|
|
@@ -775,7 +757,7 @@ export default {
|
|
|
const res = await sheetInterface.copyExcel({
|
|
|
ExcelInfoId: this.sheetDetailInfo.ExcelInfoId,
|
|
|
ExcelName: name,
|
|
|
- ExcelClassifyId: classify,
|
|
|
+ ExcelClassifyId: classify
|
|
|
});
|
|
|
|
|
|
if (res.Ret !== 200) return;
|
|
@@ -785,6 +767,11 @@ export default {
|
|
|
this.getTreeData();
|
|
|
},
|
|
|
|
|
|
+ /* 刷新表格 */
|
|
|
+ refreshSheet() {
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
/* 重绘右侧区域宽度 */
|
|
|
reloadRightWid() {
|
|
|
let total_wid = $(".data-sheet-main")[0].offsetWidth;
|
|
@@ -824,11 +811,16 @@ export default {
|
|
|
|
|
|
this.$store.commit('sheet/SET_UPLOADFIlES',[file])
|
|
|
this.$router.push({ path: '/addAnalysisSheet' });
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ //跳转生成指标
|
|
|
+ HandleToPath() {
|
|
|
+ this.$router.push({ path: '/createTaregtBySheet',query: {
|
|
|
+ code: this.sheetDetailInfo.UniqueCode
|
|
|
+ }});
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
mounted() {
|
|
|
if (this.$route.query.code) {
|
|
@@ -950,6 +942,7 @@ $normal-font: 14px;
|
|
|
|
|
|
.main-right {
|
|
|
width: 80%;
|
|
|
+ position: relative;
|
|
|
.sheet-detail-wrapper {
|
|
|
height: 100%;
|
|
|
border: 1px solid #ececec;
|