1、优化
This commit is contained in:
@@ -78,7 +78,7 @@ function otherLightModels(data) {
|
|||||||
engine.engine?.setModelColor(
|
engine.engine?.setModelColor(
|
||||||
i.codeData,
|
i.codeData,
|
||||||
i.color,
|
i.color,
|
||||||
0.6
|
0.2
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,12 +122,12 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<!-- <th>序号</th><th>全名称</th><th>清单编号</th><th>清单名称</th><th>单位</th><th>合同数量</th><th>合同金额</th><th>填报日期</th><th>完成数量</th><th>完成金额</th><th>累计完成数量</th>-->
|
<!-- <th>序号</th><th>全名称</th><th>清单编号</th><th>清单名称</th><th>单位</th><th>合同数量</th><th>合同金额</th><th>填报日期</th><th>完成数量</th><th>完成金额</th><th>累计完成数量</th>-->
|
||||||
<th>序号</th><th>全名称</th><th>清单编号</th><th>清单名称</th><th>单位</th><th>合同数量</th><th>合同金额</th><th>合同金额不含税</th><th>累计完成数量</th><th>进度</th>
|
<th>序号</th><th>全名称</th><th>清单编号</th><th>清单名称</th><th>单位</th><th>合同数量</th><th>合同金额</th><th>合同金额不含税</th><th>累计完成数量</th><th>累计完成金额</th><th>累计完成金额不含税</th><th>进度</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr v-for="r in progressRows" :key="r.no">
|
<tr v-for="r in progressRows" :key="r.no">
|
||||||
<td>{{ r.no }}</td><td>{{ r.fullName }}</td><td>{{ r.workCode }}</td><td>{{ r.name }}</td><td>{{ r.workUnit }}</td><td>{{ formatNumber(r.meteringNum,2) }}</td><td>{{ formatMoney(r.meteringAmt) }}</td><td>{{ formatMoney(r.meteringNotaxAmt) }}</td><td>{{ r.totalNum }}</td><td>{{ proportion(r.meteringNum,r.totalNum) }}</td>
|
<td>{{ r.no }}</td><td>{{ r.fullName }}</td><td>{{ r.workCode }}</td><td>{{ r.name }}</td><td>{{ r.workUnit }}</td><td>{{ formatNumber(r.meteringNum,2) }}</td><td>{{ formatMoney(r.meteringAmt) }}</td><td>{{ formatMoney(r.meteringNotaxAmt) }}</td><td>{{ r.totalNum }}</td><td>{{formatMoney(r.totalAmt) }}</td><td>{{ formatMoney(r.totalNotaxAmt) }}</td><td>{{ proportion(r.meteringAmt,r.totalAmt) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -240,12 +240,13 @@ const baselineDate = ref(todayISODate());
|
|||||||
const baselineOverallPercent = ref(0);
|
const baselineOverallPercent = ref(0);
|
||||||
const cutoffDate = ref(todayISODate());
|
const cutoffDate = ref(todayISODate());
|
||||||
const cutoffDateDraft = ref(cutoffDate.value);
|
const cutoffDateDraft = ref(cutoffDate.value);
|
||||||
|
const selectedPeriod = computed(() => cutoffDateDraft.value || cutoffDate.value || todayISODate());
|
||||||
|
|
||||||
const percentFilters = reactive({ all: false, p0: false, p0_50: false, p50_100: false, p100: false });
|
const percentFilters = reactive({ all: false, p0: false, p0_50: false, p50_100: false, p100: false });
|
||||||
const filteredProgressCodeData = ref([]);
|
const filteredProgressCodeData = ref([]);
|
||||||
const filteredProgressColorParams = ref([]);
|
const filteredProgressColorParams = ref([]);
|
||||||
const percentColorMap = {
|
const percentColorMap = {
|
||||||
p0: "#6E7D96",
|
p0: "#B0B8C4",
|
||||||
p0_50: "#D9363E",
|
p0_50: "#D9363E",
|
||||||
p50_100: "#156CFF",
|
p50_100: "#156CFF",
|
||||||
p100: "#2F8F2F",
|
p100: "#2F8F2F",
|
||||||
@@ -256,7 +257,7 @@ const visibleTreeRows = computed(() => {
|
|||||||
const walk = (node, level) => {
|
const walk = (node, level) => {
|
||||||
const leaf = node.isLeaf === true;
|
const leaf = node.isLeaf === true;
|
||||||
const open = expanded.value.has(node.id);
|
const open = expanded.value.has(node.id);
|
||||||
rows.push({ id: node.id, name: node.name, level, leaf, open, createDate: node.createDate, projectId: node.projectId });
|
rows.push({ id: node.id, name: node.name, level, leaf, open, createDate: selectedPeriod.value, projectId: node.projectId });
|
||||||
if (!leaf && open && node.children) {
|
if (!leaf && open && node.children) {
|
||||||
node.children.forEach((c) => walk(c, level + 1));
|
node.children.forEach((c) => walk(c, level + 1));
|
||||||
}
|
}
|
||||||
@@ -299,9 +300,10 @@ const progressRows = computed(() => {
|
|||||||
meteringNotaxAmt: item.meteringNotaxAmt || 0,
|
meteringNotaxAmt: item.meteringNotaxAmt || 0,
|
||||||
meteringNum: item.meteringNum || 0,
|
meteringNum: item.meteringNum || 0,
|
||||||
totalNum: item.totalNum || '',
|
totalNum: item.totalNum || '',
|
||||||
doneQty: item.doneQty || 0,
|
totalAmt: item.totalAmt ?? item.actAmt ?? 0,
|
||||||
doneAmt: item.doneAmt || 0,
|
totalNotaxAmt: item.totalNotaxAmt ?? item.actNotaxAmt ?? 0,
|
||||||
cumDoneQty: item.cumDoneQty || 0,
|
thisNum: item.thisNum || 0,
|
||||||
|
thisAmt: item.thisAmt || 0,
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -368,8 +370,9 @@ function findNode(nodes, id) {
|
|||||||
onMounted(async() => {
|
onMounted(async() => {
|
||||||
await loadWbsTree();
|
await loadWbsTree();
|
||||||
window.addEventListener("click", closeContextMenu);
|
window.addEventListener("click", closeContextMenu);
|
||||||
const result = await progressApi.calculateProgress();
|
const result = await progressApi.calculateProgress(selectedPeriod.value);
|
||||||
taskId.value = result.taskId
|
console.log(888888,result)
|
||||||
|
// taskId.value = result.taskId
|
||||||
});
|
});
|
||||||
|
|
||||||
function todayISODate() {
|
function todayISODate() {
|
||||||
@@ -461,14 +464,16 @@ function buildModelCodeData(list) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function refreshFilteredProgressCodeData() {
|
async function refreshFilteredProgressCodeData() {
|
||||||
if (!taskId.value) {
|
// if (!taskId.value) {
|
||||||
filteredProgressCodeData.value = [];
|
// filteredProgressCodeData.value = [];
|
||||||
filteredProgressColorParams.value = [];
|
// filteredProgressColorParams.value = [];
|
||||||
modelRef.value?.cancelLightModels();
|
// modelRef.value?.cancelLightModels();
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
try {
|
try {
|
||||||
const response = await progressApi.getProgress(taskId.value);
|
// const response = await progressApi.getProgress(taskId.value);
|
||||||
|
const response = await progressApi.getProgress(selectedPeriod.value);
|
||||||
|
console.log(77777,response)
|
||||||
const items = extractProgressItems(response);
|
const items = extractProgressItems(response);
|
||||||
const enabledKeys = ["p0", "p0_50", "p50_100", "p100"].filter((k) => percentFilters[k]);
|
const enabledKeys = ["p0", "p0_50", "p50_100", "p100"].filter((k) => percentFilters[k]);
|
||||||
const activeKeys = percentFilters.all ? ["p0", "p0_50", "p50_100", "p100"] : enabledKeys;
|
const activeKeys = percentFilters.all ? ["p0", "p0_50", "p50_100", "p100"] : enabledKeys;
|
||||||
@@ -512,19 +517,22 @@ async function refreshFilteredProgressCodeData() {
|
|||||||
|
|
||||||
function applyCutoffDate() {
|
function applyCutoffDate() {
|
||||||
cutoffDate.value = cutoffDateDraft.value || cutoffDate.value || todayISODate();
|
cutoffDate.value = cutoffDateDraft.value || cutoffDate.value || todayISODate();
|
||||||
|
const result = progressApi.calculateProgress(selectedPeriod.value);
|
||||||
|
console.log(2121,result)
|
||||||
}
|
}
|
||||||
// 计算比例:count / allCount,并显示百分比
|
// 计算比例:count / allCount,并显示百分比
|
||||||
function proportion(count, allCount) {
|
function proportion(allCount, count) {
|
||||||
if (count==="" || allCount==="")
|
if (count==="" || allCount==="")
|
||||||
return ""
|
return ""
|
||||||
// 防止除以 0 报错
|
// 防止除以 0 报错
|
||||||
if (!allCount || allCount === 0) return `0 / 0 (0%)`
|
if (!allCount || allCount === 0) return `0%`
|
||||||
|
|
||||||
// 计算百分比(保留2位小数)
|
// 计算百分比(保留2位小数)
|
||||||
let percent = ((count / allCount) * 100).toFixed(2)
|
let percent = ((count / allCount) * 100).toFixed(2)
|
||||||
|
|
||||||
// 返回格式:5 / 10 (50.00%)
|
// 返回格式:5 / 10 (50.00%)
|
||||||
return `${count} / ${allCount} (${percent}%)`
|
// return `${count} / ${allCount} (${percent}%)`
|
||||||
|
return `${percent}%`
|
||||||
}
|
}
|
||||||
|
|
||||||
async function applyAllExclusive(key, checked) {
|
async function applyAllExclusive(key, checked) {
|
||||||
@@ -605,11 +613,11 @@ async function onTreeRowClick(row) {
|
|||||||
}
|
}
|
||||||
if (row.leaf) {
|
if (row.leaf) {
|
||||||
selectedStructureId.value = row.id;
|
selectedStructureId.value = row.id;
|
||||||
await loadProgressData(row.id, row.createDate);
|
await loadProgressData(row.id, selectedPeriod.value);
|
||||||
} else {
|
} else {
|
||||||
toggleTreeExpand(row);
|
toggleTreeExpand(row);
|
||||||
progressData.value = []
|
progressData.value = []
|
||||||
progressData.value = await progressApi.findActAmtByPositionId(row.projectId, row.id, row.createDate);
|
progressData.value = await progressApi.findActAmtByPositionId(row.projectId, row.id, selectedPeriod.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -636,7 +644,7 @@ function addPartToBindingList(row) {
|
|||||||
if (!row?.id) return;
|
if (!row?.id) return;
|
||||||
const exists = partList.value.some((item) => item.id === row.id);
|
const exists = partList.value.some((item) => item.id === row.id);
|
||||||
if (exists) return;
|
if (exists) return;
|
||||||
partList.value.push({ id: row.id, createDate: row.createDate });
|
partList.value.push({ id: row.id, createDate: selectedPeriod.value });
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAddComponent() {
|
function onAddComponent() {
|
||||||
@@ -664,7 +672,7 @@ async function onViewComponent() {
|
|||||||
function applyViewModalData(row, data) {
|
function applyViewModalData(row, data) {
|
||||||
const partId = row?.id;
|
const partId = row?.id;
|
||||||
if (!partId) return;
|
if (!partId) return;
|
||||||
viewPartList.value = [{ id: partId, createDate: row?.createDate }];
|
viewPartList.value = [{ id: partId, createDate: selectedPeriod.value }];
|
||||||
const mapped = (data || [])
|
const mapped = (data || [])
|
||||||
.map((item) => toBindingCodeItem(item))
|
.map((item) => toBindingCodeItem(item))
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ export const progressApi = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
calculateProgress() {
|
calculateProgress(date) {
|
||||||
return get("/api/bim/progressData", {}).then((res) => res);
|
return get("/api/bim/progressData", { date }).then((res) => res);
|
||||||
},
|
},
|
||||||
|
|
||||||
getProgress(taskId) {
|
getProgress(date) {
|
||||||
return get(`/api/bim/progressData/${taskId}`).then((res) => res);
|
return get("/api/bim/progressData/result",{ date }).then((res) => res);
|
||||||
},
|
},
|
||||||
|
|
||||||
getCodeWbsMappings() {
|
getCodeWbsMappings() {
|
||||||
@@ -71,4 +71,3 @@ export const progressApi = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user