Commit 0ee095ac authored by tianhongyang's avatar tianhongyang

merge

parent fea76448
<template> <template>
<div class="table-list-com-ins" :class="{'is-empty-table' : !tableDataTotal}"> <div class="table-list-com-ins" :class="{'is-empty-table' : !tableDataTotal,'no-pagination' : !hasQueryParams}">
<div class="table-item"> <div class="table-item">
<el-table v-if="tableDataTotal>0" class="fixed-table" :class="headerFixed ? 'headerFixed':''" v-loading="tableLoading" :data="tableData" <el-table v-if="tableDataTotal>0" class="fixed-table" :class="headerFixed ? 'headerFixed':''" v-loading="tableLoading" :data="tableData"
element-loading-text="Loading" ref="tableRef" border fit highlight-current-row :default-sort="defaultSort?defaultSort:{}" element-loading-text="Loading" ref="tableRef" border fit highlight-current-row :default-sort="defaultSort?defaultSort:{}"
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
:fixed="needSelection.fixed" :align="needSelection.align" :show-overflow-tooltip="needSelection.showOverflowTooltip"> :fixed="needSelection.fixed" :align="needSelection.align" :show-overflow-tooltip="needSelection.showOverflowTooltip">
</el-table-column> </el-table-column>
<el-table-column type="index" v-if="isIndex" label="序号" :width="flexWidth(tableData)" align="left" :fixed="indexFixed" :resizable="false"> <el-table-column type="index" v-if="isIndex" label="序号" :width="flexWidth(tableData)" align="left" :fixed="indexFixed" :resizable="false">
<template slot-scope="scope">{{ queryParams.pageNum * queryParams.pageSize - queryParams.pageSize + scope.$index + 1 }}</template> <template slot-scope="scope">{{pagingHandler(hasQueryParams,queryParams,scope)}}</template>
</el-table-column> </el-table-column>
<template v-for="(item,index) in formColum"> <template v-for="(item,index) in formColum">
<template v-if="item.use !== false"> <template v-if="item.use !== false">
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
</el-table-column> </el-table-column>
<!-- 序号列 --> <!-- 序号列 -->
<el-table-column v-else-if="item.type == 'index'" type="index" :key="item.uid ? item.uid : index" :label="item.label ? item.label : '序号'" <el-table-column v-else-if="item.type == 'index'" type="index" :key="item.uid ? item.uid : index" :label="item.label ? item.label : '序号'"
:width="flexWidth(tableData)" :align="item.align?item.align:'left'" :fixed="item.fixed" :resizable="false"> :width="flexWidth(tableData,item.width)" :min-width="item.minWidth" :align="item.align?item.align:'left'" :fixed="item.fixed"
<template slot-scope="scope">{{ queryParams.pageNum * queryParams.pageSize - queryParams.pageSize + scope.$index + 1 }}</template> :resizable="false">
<template slot-scope="scope">{{pagingHandler(hasQueryParams,queryParams,scope)}}</template>
</el-table-column> </el-table-column>
<!-- 普通列 --> <!-- 普通列 -->
<el-table-column v-else :key="item.uid ? item.uid : index" :label="item.label" :prop="item.prop" :width="item.width" <el-table-column v-else :key="item.uid ? item.uid : index" :label="item.label" :prop="item.prop" :width="item.width"
...@@ -63,7 +64,7 @@ ...@@ -63,7 +64,7 @@
</div> </div>
</div> </div>
<div class="pagination-box" v-if="show_page && tableDataTotal>queryParams.pageSize"> <div class="pagination-box" v-if="show_page && hasQueryParams && tableDataTotal>queryParams.pageSize">
<el-pagination background :current-page="current_page" :page-size="queryParams.pageSize" :total="tableDataTotal" <el-pagination background :current-page="current_page" :page-size="queryParams.pageSize" :total="tableDataTotal"
layout="prev, pager, next, jumper" @current-change="handleCurrentChange" @size-change="handleSizeChange" /> layout="prev, pager, next, jumper" @current-change="handleCurrentChange" @size-change="handleSizeChange" />
</div> </div>
...@@ -169,12 +170,26 @@ export default { ...@@ -169,12 +170,26 @@ export default {
return { return {
current_page: this.queryParams.pageNum, current_page: this.queryParams.pageNum,
show_page: this.paging, show_page: this.paging,
comMaxHeight: null comMaxHeight: null,
hasQueryParams: false
}; };
}, },
watch: { watch: {
'queryParams.pageNum'(newVal, oldVal) { 'queryParams.pageNum'(newVal, oldVal) {
this.current_page = newVal; this.current_page = newVal;
},
queryParams: {
handler(newValue) {
const _temp = newValue ? newValue : {};
const keys = Object.keys(_temp);
if (keys.length) {
this.hasQueryParams = true;
} else {
this.hasQueryParams = false;
}
},
immediate: true,
deep: true
} }
}, },
created() { created() {
...@@ -196,6 +211,14 @@ export default { ...@@ -196,6 +211,14 @@ export default {
} }
}, },
pagingHandler(hasQueryParams, queryParams, scope) {
// 有分页参数
if (hasQueryParams) {
return queryParams.pageNum * queryParams.pageSize - queryParams.pageSize + scope.$index + 1;
}
// 不分页
return scope.$index + 1;
},
handleCurrentChange(e) { handleCurrentChange(e) {
if (this.MaxPage < e) { if (this.MaxPage < e) {
this.show_page = false; this.show_page = false;
...@@ -217,12 +240,12 @@ export default { ...@@ -217,12 +240,12 @@ export default {
selectionChange(selectionArray) { selectionChange(selectionArray) {
this.$emit("selectionChange", selectionArray); this.$emit("selectionChange", selectionArray);
}, },
flexWidth(tableData) { flexWidth(tableData, width = 50) {
let currentMax = this.queryParams.pageNum * this.queryParams.pageSize - this.queryParams.pageSize + tableData.length, wdth = 50; let currentMax = this.queryParams.pageNum * this.queryParams.pageSize - this.queryParams.pageSize + tableData.length;
if (currentMax.toString().length > 3) { if (currentMax.toString().length > 3) {
wdth = wdth + (currentMax.toString().length - 3) * 10; width = width + (currentMax.toString().length - 3) * 10;
} }
return wdth + 'px'; return width + 'px';
} }
} }
} }
...@@ -236,6 +259,12 @@ export default { ...@@ -236,6 +259,12 @@ export default {
height: 100%; height: 100%;
} }
} }
&.no-pagination {
::v-deep .table-item {
max-height: 100%;
}
}
::v-deep .table-item { ::v-deep .table-item {
width: 100%; width: 100%;
max-height: calc(100% - 40px); max-height: calc(100% - 40px);
......
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
<!-- 数据列表部分 --> <!-- 数据列表部分 -->
<div class="project-feedsummary-list-container"> <div class="project-feedsummary-list-container">
<dsk-skeleton v-if="tableLoading"></dsk-skeleton> <dsk-skeleton v-if="tableLoading"></dsk-skeleton>
<table-list-com :tableData="tableDataList" v-else-if="!tableLoading" :tableDataTotal="total" :paging="false"></table-list-com> <table-list-com :tableData="tableDataList" :formColum="formColum" v-else-if="!tableLoading" :maxHeight="true" :tableDataTotal="total"
:paging="false"></table-list-com>
</div> </div>
</div> </div>
</div> </div>
...@@ -100,7 +101,15 @@ export default { ...@@ -100,7 +101,15 @@ export default {
total: 0, total: 0,
// 列表表头 // 列表表头
formColum: [ formColum: [
{ label: '序号', prop: "staticSerialNumber", type: "index", lock: true, fixed: false, uid: v4() }, { label: '序号', prop: "staticSerialNumber", type: "index", lock: true, width: "52", fixed: false, uid: v4() },
{ label: '成本科目', prop: "cbSubjectName", width: "137", uid: v4() },
{ label: '公司编码', prop: "companyNo", width: "137", uid: v4() },
{ label: '集团编码', prop: "orgNo", width: "137", uid: v4() },
{ label: '名称', prop: "cbName", width: "232", uid: v4() },
{ label: '工作内容', prop: "jobContent", width: "341", uid: v4() },
{ label: '计算规则', prop: "calculationRule", width: "137", uid: v4() },
{ label: '单位', prop: "unit", width: "57", uid: v4() },
{ label: '甲供材料说明', prop: "materialDescription", width: "137", uid: v4() },
], ],
// 已记录月份集合 // 已记录月份集合
monthList: [], monthList: [],
...@@ -386,6 +395,11 @@ export default { ...@@ -386,6 +395,11 @@ export default {
.project-feedsummary-list-container { .project-feedsummary-list-container {
width: 100%; width: 100%;
height: calc(100% - 48px); height: calc(100% - 48px);
/* overflow: auto; */
.table-list-com-ins {
height: 100%;
}
} }
} }
} }
......
...@@ -164,7 +164,11 @@ export default { ...@@ -164,7 +164,11 @@ export default {
try { try {
this.tabsDisabled = true; this.tabsDisabled = true;
const { query } = this.$route; const { query } = this.$route;
// if (!query.projectId) return this.$message.error("缺少项目id"); // if (!query.projectId) {
// this.$message.error("缺少项目id");
// this.tabsDisabled = true;
// return;
// };
this.projectId = query.projectId; this.projectId = query.projectId;
// 获取详情 保证详情获取完毕 再执行tab命中 进行生命周期 // 获取详情 保证详情获取完毕 再执行tab命中 进行生命周期
await this.getProjectDetail(query.projectId); await this.getProjectDetail(query.projectId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment