Commit 1e8ab69f authored by tianhongyang's avatar tianhongyang

fix bug

parent 3213bd4b
...@@ -28,10 +28,14 @@ ...@@ -28,10 +28,14 @@
</div> </div>
<!-- 锁定成本 导出excel 编辑成本 --> <!-- 锁定成本 导出excel 编辑成本 -->
<div class="project-table-list-haeder-right"> <div class="project-table-list-haeder-right">
<div class="lock-cost-btn" :class="{ 'current-month-lock': currentMonthLock }" @click="!currentMonthLock ? lockCostHandler() : ''">锁定成本 <div class="lock-cost-btn" :class="{ 'current-month-lock': currentMonthLock || !hasMenuData }"
@click="!currentMonthLock && hasMenuData ? lockCostHandler() : ''">锁定成本
</div> </div>
<div class="export-excel-btn" @click="exportExcel">导出Excel表</div> <div class="export-excel-btn" :class="{'btn-is-disable' : !hasMenuData}" @click="!hasMenuData ? '' : exportExcel()">
<div class="edit-cost-btn" @click="addActualCostEditStatus ? saveCostModify() : editCost()">{{ addActualCostEditStatus ? "保存成本" : "编辑成本" }} 导出Excel表</div>
<div class="edit-cost-btn" :class="{'btn-is-disable' : !hasMenuData}"
@click="hasMenuData ? (addActualCostEditStatus ? saveCostModify() : editCost()) : ''">
{{ addActualCostEditStatus ? "保存成本" : "编辑成本" }}
</div> </div>
</div> </div>
</div> </div>
...@@ -167,8 +171,8 @@ export default { ...@@ -167,8 +171,8 @@ export default {
total: 0, total: 0,
// 列表表头 // 列表表头
formColum: [ formColum: [
{ label: '序号', prop: "number", minWidth: "80", uid: v4() }, { label: '序号', prop: "number", minWidth: "80", uid: v4(), fixed: "left" },
{ label: '名称', prop: "cbName", width: "303", uid: v4(), showOverflowTooltip: true }, { label: '名称', prop: "cbName", width: "303", uid: v4(), showOverflowTooltip: true, fixed: "left" },
{ label: '不含税成本合价', prop: "taxExclusiveTotal", width: "182", uid: v4() }, { label: '不含税成本合价', prop: "taxExclusiveTotal", width: "182", uid: v4() },
{ label: '成本税金合价', prop: "cbTaxesTotal", width: "182", uid: v4() }, { label: '成本税金合价', prop: "cbTaxesTotal", width: "182", uid: v4() },
{ label: '含税成本合价', prop: "taxInclusiveTotal", width: "182", uid: v4() }, { label: '含税成本合价', prop: "taxInclusiveTotal", width: "182", uid: v4() },
...@@ -232,6 +236,10 @@ export default { ...@@ -232,6 +236,10 @@ export default {
// 查看当前月是否是锁定状态 lock为true 不能锁定 反之可以 // 查看当前月是否是锁定状态 lock为true 不能锁定 反之可以
currentMonthLock() { currentMonthLock() {
return this.lockMonthList.includes(this.expenseDate); return this.lockMonthList.includes(this.expenseDate);
},
// 是否有科目菜单
hasMenuData() {
return this.menuTreeList.length ? true : false;
} }
}, },
//方法集 //方法集
...@@ -261,8 +269,18 @@ export default { ...@@ -261,8 +269,18 @@ export default {
this.currentCategory = category; this.currentCategory = category;
this.resetEditStatus(); this.resetEditStatus();
this.tableLoading = true; this.tableLoading = true;
this.resetTableData();
this.init(this.comProjectDetailInfo); this.init(this.comProjectDetailInfo);
}, },
resetTableData() {
this.$set(this.dataForm, "tableDataList", []);
const data = this.$options.data.call(this);
this.originTableDataList = data.originTableDataList;
this.total = 0;
this.monthList = data.monthList;
this.originMonthList = data.originMonthList;
this.disableMonths = data.disableMonths;
},
async init(detail = {}, resetDate = "", saveReset = false) { async init(detail = {}, resetDate = "", saveReset = false) {
try { try {
this.resetEditStatus(saveReset); this.resetEditStatus(saveReset);
...@@ -314,9 +332,10 @@ export default { ...@@ -314,9 +332,10 @@ export default {
if (item[targetName] == nodeValue) return item; if (item[targetName] == nodeValue) return item;
if (item.children instanceof Array) { if (item.children instanceof Array) {
const result = this.findMenuNode(item.children, nodeValue, targetName); const result = this.findMenuNode(item.children, nodeValue, targetName);
if (result) return result; return result;
} }
} }
return null;
}, },
// 创建查询条件 // 创建查询条件
createRequestConditions(resetDate = "") { createRequestConditions(resetDate = "") {
...@@ -346,7 +365,7 @@ export default { ...@@ -346,7 +365,7 @@ export default {
cbName: this.currentCategory == 1 ? "成本汇总" : "房建类成本科目", cbName: this.currentCategory == 1 ? "成本汇总" : "房建类成本科目",
children: _tempArray children: _tempArray
}; };
this.menuTreeList = [_tempMenu]; this.menuTreeList = _tempArray.length ? [_tempMenu] : [];
} }
} catch (error) { } catch (error) {
...@@ -759,8 +778,8 @@ export default { ...@@ -759,8 +778,8 @@ export default {
// 浅层级 // 浅层级
if (hasDifferent) { if (hasDifferent) {
tempArray.push({ tempArray.push({
id: item.id, id: item.actualId,
cbSummaryId: this.currentNodeValue, cbSummaryId: item.id,
taxInclusiveExpense: item.taxInclusiveExpense ? item.taxInclusiveExpense : 0, taxInclusiveExpense: item.taxInclusiveExpense ? item.taxInclusiveExpense : 0,
taxExclusiveExpense: item.taxExclusiveExpense ? item.taxExclusiveExpense : 0, taxExclusiveExpense: item.taxExclusiveExpense ? item.taxExclusiveExpense : 0,
expenseDate: this.expenseDate expenseDate: this.expenseDate
...@@ -928,7 +947,6 @@ export default { ...@@ -928,7 +947,6 @@ export default {
} }
.lock-cost-btn { .lock-cost-btn {
/* 当前月锁定 */ /* 当前月锁定 */
&.current-month-lock { &.current-month-lock {
cursor: not-allowed; cursor: not-allowed;
...@@ -939,6 +957,14 @@ export default { ...@@ -939,6 +957,14 @@ export default {
.edit-cost-btn { .edit-cost-btn {
margin-right: 0px; margin-right: 0px;
} }
.edit-cost-btn,
.export-excel-btn {
&.btn-is-disable {
cursor: not-allowed;
background: #66b3ff;
}
}
} }
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<div class="field-expenses-container"> <div class="field-expenses-container">
<div class="field-expenses-inner"> <div class="field-expenses-inner">
<div class="left-side-menu"> <div class="left-side-menu">
<project-side-menu ref="projectSideMenu" :menuTree="menuTreeList" :menuOptions="menuOptions" :unique-opened="false" <project-side-menu ref="projectSideMenu" :menuTree="menuTreeList" :menuOptions="menuOptions" :unique-opened="false" v-model="currentNodeValue"
v-model="currentNodeValue" @select="menuSelect"> @select="menuSelect">
<template slot="现场经费-1"> <template slot="现场经费-1">
<img src="@/assets/images/projectCostLedger/icon_cost_detail_6.svg" alt=""> <img src="@/assets/images/projectCostLedger/icon_cost_detail_6.svg" alt="">
<div class="project-sub-menu-title-text">现场经费</div> <div class="project-sub-menu-title-text">现场经费</div>
...@@ -174,7 +174,10 @@ export default { ...@@ -174,7 +174,10 @@ export default {
}, },
//计算集 //计算集
computed: { computed: {
// 是否是现场经费
isDefaultSumMenu() {
return this.currentNodeName == "现场经费";
}
}, },
//方法集 //方法集
methods: { methods: {
...@@ -203,12 +206,13 @@ export default { ...@@ -203,12 +206,13 @@ export default {
try { try {
await this.$nextTick(); await this.$nextTick();
const menus = this.$refs["projectSideMenu"].getResultMenuList(); const menus = this.$refs["projectSideMenu"].getResultMenuList();
const defaultCurrent = this.findMenuNode(menus, "现场经费"); const first = this.$refs["projectSideMenu"].getFirstLevelWithDeepId();
const defaultCurrent = this.findMenuNode(menus, "现场经费") ? this.findMenuNode(menus, "现场经费") : this.findMenuNode(menus, first, "nodeValue");
if (defaultCurrent) { if (defaultCurrent) {
this.currentNodeValue = defaultCurrent.nodeValue; this.currentNodeValue = defaultCurrent.nodeValue;
this.currentNodeName = defaultCurrent.nodeName; this.currentNodeName = defaultCurrent.nodeName;
const params = this.createRequestConditions(); const params = this.createRequestConditions();
await this.getFieldExpensesList(params); this.isDefaultSumMenu ? await this.getFieldExpensesList(params) : await this.getFieldExpensesOtherList(params);
} }
} catch (error) { } catch (error) {
console.log(error); console.log(error);
...@@ -223,7 +227,7 @@ export default { ...@@ -223,7 +227,7 @@ export default {
projectId, projectId,
cbStage cbStage
}; };
params["cbSubjectName"] = this.currentNodeValue; params["fileId"] = this.currentNodeValue;
// 判断当月是否存在于server返回month集合中 // 判断当月是否存在于server返回month集合中
const _now = this.getNowMonth(); const _now = this.getNowMonth();
if (this.includeNowMonth(_now)) { if (this.includeNowMonth(_now)) {
...@@ -243,6 +247,7 @@ export default { ...@@ -243,6 +247,7 @@ export default {
if (result) return result; if (result) return result;
} }
} }
return null;
}, },
async getFieldExpensesList(params = {}) { async getFieldExpensesList(params = {}) {
try { try {
...@@ -354,12 +359,8 @@ export default { ...@@ -354,12 +359,8 @@ export default {
const menuName = currentTemp.nodeName; const menuName = currentTemp.nodeName;
this.currentNodeName = menuName; this.currentNodeName = menuName;
// 请求数据列表 // 请求数据列表
const isDefault = menuName == "现场经费"; const params = this.createRequestConditions();
const params = isDefault ? this.createRequestConditions() : { if (this.isDefaultSumMenu) {
projectId: this.comProjectDetailInfo.projectId,
fileId: currentId
};
if (isDefault) {
this.getFieldExpensesList(params); this.getFieldExpensesList(params);
} else { } else {
this.getFieldExpensesOtherList(params); this.getFieldExpensesOtherList(params);
......
<template> <template>
<div class="project-side-menu-container"> <div class="project-side-menu-container">
<el-menu mode="vertical" class="project-side-menu-instance" :unique-opened="uniqueOpened" :default-active="createMenuIndex(comDefaultActive)" <transition name="fade" :appear="true" mode="out-in">
:default-openeds="comDefaultOpeneds" @select="menuSelect" @open="subMenuOpen" @close="subMenuClose" ref="customElMenu"> <el-menu v-if="tempMenuTree.length" mode="vertical" class="project-side-menu-instance" :unique-opened="uniqueOpened"
<template v-for="(item, index) of tempMenuTree"> :default-active="createMenuIndex(comDefaultActive)" :default-openeds="comDefaultOpeneds" @select="menuSelect" @open="subMenuOpen"
<project-menu-item :menuItem="item" :key="`${item.nodeValue}-${item.level}`"> @close="subMenuClose" ref="customElMenu">
<template :slot="`${item.nodeName}-${item.level}`" slot-scope="scope"> <template v-for="(item, index) of tempMenuTree">
<slot :name="`${scope.data.nodeName}-${scope.data.level}`" :data="scope.data"></slot> <project-menu-item :menuItem="item" :key="`${item.nodeValue}-${item.level}`">
</template> <template :slot="`${item.nodeName}-${item.level}`" slot-scope="scope">
</project-menu-item> <slot :name="`${scope.data.nodeName}-${scope.data.level}`" :data="scope.data"></slot>
</template> </template>
</el-menu> </project-menu-item>
</template>
</el-menu>
</transition>
</div> </div>
</template> </template>
<script> <script>
...@@ -201,6 +204,9 @@ export default { ...@@ -201,6 +204,9 @@ export default {
await this.$nextTick(); await this.$nextTick();
this.openTargetAllSubMenu(this.comDefaultOpeneds); this.openTargetAllSubMenu(this.comDefaultOpeneds);
} }
} else {
this.tempMenuTree = [];
this.tempMenuOptions = this.$options.data.call(this).tempMenuOptions;
} }
}, },
mergeMenuOptions(options) { mergeMenuOptions(options) {
...@@ -275,12 +281,14 @@ export default { ...@@ -275,12 +281,14 @@ export default {
position: relative; position: relative;
width: 100%; width: 100%;
height: 100%; height: 100%;
border-right: 1px solid #eeeeee;
background: #fff;
overflow: auto;
::v-deep .project-side-menu-instance { ::v-deep .project-side-menu-instance {
width: 100%; width: 100%;
height: 100%; border-right: unset;
border-right: 1px solid #eeeeee; background: unset;
overflow: auto;
/* 重置一级二级菜单 高度行高 */ /* 重置一级二级菜单 高度行高 */
.project-menu-item-container { .project-menu-item-container {
......
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