diff --git a/pages/workbench/cost/components/Bar.vue b/pages/workbench/cost/components/Bar.vue
index 077277d..814b1f3 100644
--- a/pages/workbench/cost/components/Bar.vue
+++ b/pages/workbench/cost/components/Bar.vue
@@ -1,8 +1,8 @@
-
@@ -16,7 +16,7 @@ export default {
chartData: {
type: Object,
default: {
- categories: [], // 日期(1日-当前日或当月总天数)
+ categories: [],
series: [] // 库存趋势数据
}
}
@@ -25,9 +25,18 @@ export default {
return {
// 图表配置
chartOpts: {
- title: { text:'月度收支', left:'center' },
- tooltip:{ trigger:'axis' },
- legend:{ data:['支出','收入(CNY)','收入(USD)'], bottom:0 },
+ legend: true, // 显示图例
+ dataLabel: false, // 不显示数据标签
+ xAxis: {
+ fontColor: "#666",
+ fontSize: 12
+ },
+ yAxis: {
+ fontColor: "#666",
+ fontSize: 12,
+ gridColor: "#eee"
+ },
+ color: ["#007aff", "#ff9500", '#22bbff']
}
};
},
diff --git a/pages/workbench/cost/components/Detail.vue b/pages/workbench/cost/components/Detail.vue
new file mode 100644
index 0000000..1db4f7d
--- /dev/null
+++ b/pages/workbench/cost/components/Detail.vue
@@ -0,0 +1,241 @@
+
+
+
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+
+
+
+
+ 出账名称:
+ {{ item.detailTitle || '-' }}
+
+
+
+ 金额:
+ -¥{{ item.price || 0 }}元
+
+
+
+ 经手人:
+ {{ item.financeParties || '-' }}
+
+
+
+
+
+
+
+ 暂无物料花费数据
+
+
+
+
+
+
+
+
+ 人员名称:
+ {{ item.nickName || '-' }}
+
+
+
+ 人员成本:
+ {{ item.laborCost || 0 }}元
+
+
+
+ 人天计算:
+ {{ item.attendanceNum || '-' }}
+
+
+
+
+
+ 暂无人力成本数据
+
+
+
+
+
+
+
+
+
diff --git a/pages/workbench/cost/components/Line.vue b/pages/workbench/cost/components/Line.vue
index 9d5ea1a..a27eb24 100644
--- a/pages/workbench/cost/components/Line.vue
+++ b/pages/workbench/cost/components/Line.vue
@@ -1,102 +1,60 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/pages/workbench/cost/components/Pie.vue b/pages/workbench/cost/components/Pie.vue
index 0c5c490..2471d6a 100644
--- a/pages/workbench/cost/components/Pie.vue
+++ b/pages/workbench/cost/components/Pie.vue
@@ -14,10 +14,16 @@
},
data() {
return {
- chartData: {},
+ chartData: {
+ series: []
+ },
chartOpts: {
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", "#ea7ccc"],
padding: [5, 5, 5, 5],
+ legend: {
+ show: false
+ },
+ dataLabel: false, // 不显示数据标签
enableScroll: false,
extra: {
pie: {
@@ -37,20 +43,29 @@
projectList: {
handler(newVal) {
const pieData = this.projectList
- // .filter(p => p.totalPrice > 0)
+ .filter(p => {
+ // 过滤 totalPrice 非数字/小于等于0的项
+ const price = Number(p.totalPrice);
+ return !isNaN(price) && price > 0;
+ })
.map(p => ({
name: p.projectName,
- value: p.totalPrice,
+ value: parseInt(p.totalPrice)
}));
- this.chartData = {
+ // this.chartData = {
+ // series: [{
+ // data: pieData
+ // }]
+ // }
+ let res = {
series: [{
data: pieData
}]
- }
+ };
+ this.chartData = JSON.parse(JSON.stringify(res));
},
immediate: true,
},
-
}
}
diff --git a/pages/workbench/cost/components/SummaryCards.vue b/pages/workbench/cost/components/SummaryCards.vue
index e19e0a6..7dcb982 100644
--- a/pages/workbench/cost/components/SummaryCards.vue
+++ b/pages/workbench/cost/components/SummaryCards.vue
@@ -12,11 +12,11 @@
:key="index"
>
{{ card.title }}
- 人民币:{{ card.valueCNY }}
- 美元:{{ card.valueUSD }}
+ 人民币:{{ formatNumber(card.valueCNY) }}
+ 美元:{{ formatNumber(card.valueUSD) }}
-
+
@@ -37,9 +37,9 @@ export default {
}
},
methods: {
- // 格式化数字,添加千位分隔符
formatNumber(num) {
- return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
+ if (isNaN(num)) return '0'; // 兜底处理
+ return num.toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ','); // 保留2位小数+千位分隔符
}
}
};
diff --git a/pages/workbench/cost/components/RecentRecords.vue b/pages/workbench/cost/components/Table.vue
similarity index 59%
rename from pages/workbench/cost/components/RecentRecords.vue
rename to pages/workbench/cost/components/Table.vue
index 112fb0a..3f9f031 100644
--- a/pages/workbench/cost/components/RecentRecords.vue
+++ b/pages/workbench/cost/components/Table.vue
@@ -1,9 +1,5 @@
-
-
@@ -26,20 +22,16 @@
v-for="(item, index) in tableData"
:key="index"
:class="{ 'odd-row': index % 2 === 1 }"
+ @click="rowClick(item)"
>
- {{ item.name }}
- {{ item.model }}
- {{ item.inventory }}
- {{ item.threshold }}
- {{ item.taskInventory }}
-
-
- {{ calcInventoryStatus(item.inventory, item.taskInventory, item.threshold).status }}
-
-
+ {{ item.projectName }}
+ {{ item.userCost }}
+ {{ item.peopleDay }}
+ {{ item.materialCost }}
+ {{ item.totalCost }}
+
+ {{ item.funds }}
+
@@ -62,21 +54,30 @@ export default {
default: () => []
}
},
+ computed: {
+ renderData() {
+ return this.tableData.map(item => {
+ return {
+ projectName: item.projectName,
+ userCost: this.formatNumberToWan(item.userCost),
+ peopleDay: item.peopleDay,
+ materialCost: this.formatNumberToWan(item.materialCost),
+ totalCost: this.formatNumberToWan(item.materialCost + item.userCost + item.claimCost),
+ funds: this.formatNumberToWan(item.funds)
+ }
+ })
+ }
+ },
methods: {
- // 计算库存状态
- calcInventoryStatus(inventory, inTransit, threshold) {
- const total = inventory + inTransit;
-
- if (total > threshold + 10) {
- return { status: '库存积压', type: 'warning' };
- } else if (total > threshold) {
- return { status: '正常', type: 'success' };
- } else if (total <= threshold && total > threshold - 2) {
- return { status: '库存预警', type: 'danger' };
- } else {
- return { status: '库存不足', type: 'info' };
- }
- }
+ formatNumberToWan(num) {
+ if (num === 0) return 0;
+ const wanNum = num / 10000;
+ // 保留两位小数,四舍五入
+ return Math.round(wanNum * 100) / 100;
+ },
+ rowClick(item) {
+ this.$emit('row', item);
+ }
}
};
@@ -87,7 +88,9 @@ export default {
background-color: #ffffff;
border-radius: 12rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
- overflow: hidden;
+ overflow-y: scroll;
+ max-height: 800rpx;
+ overflow-x: hidden;
}
.table-header {
diff --git a/pages/workbench/cost/cost.vue b/pages/workbench/cost/cost.vue
index 768178a..4eb7a83 100644
--- a/pages/workbench/cost/cost.vue
+++ b/pages/workbench/cost/cost.vue
@@ -12,37 +12,67 @@
- {{ formattedDate }}
+ {{ formattedDate }}
-
-
+
+
-
+
+
+
+
+
+
+
-
+
-
+
+
+
+
+
+