forked from integrated_whb/integrated_whb_vue
安全生产费用提取和使用管理合计
parent
9a445bc29b
commit
c9e9f71e54
|
@ -47,14 +47,16 @@
|
|||
<el-table-column reserve-selection type="selection" width="55" />
|
||||
<el-table-column label="序号" width="60" type="index" />
|
||||
<el-table-column prop="USE_DATE" label="日期" />
|
||||
<el-table-column label="预提额">
|
||||
<el-table-column prop="AMOUNT" label="预提额">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.USE_TYPE === '1'">{{ row.AMOUNT }}</span>
|
||||
<span v-else></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="用途摘要">
|
||||
<el-table-column prop="PURPOSESUMMARY" label="用途摘要">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.USE_TYPE === '2'">{{ row.PURPOSESUMMARY }}</span>
|
||||
<span v-else></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="费用项目">
|
||||
|
@ -62,11 +64,13 @@
|
|||
v-for="(item, index) in costItems"
|
||||
:key="index"
|
||||
:label="item"
|
||||
prop="AMOUNT"
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.TYPE === item">
|
||||
{{ row.AMOUNT }}
|
||||
</span>
|
||||
<span v-else></span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column>
|
||||
|
@ -81,29 +85,29 @@
|
|||
<div id="printContent">
|
||||
<table class="print_use">
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2" style="width: 55px">日期</th>
|
||||
<th rowspan="2" style="width: 70px">预提额</th>
|
||||
<th rowspan="2" style="width: 85px">用途摘要</th>
|
||||
<th colspan="10" class="tc">费用项目</th>
|
||||
<th rowspan="2" style="width: 55px">余额</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th v-for="(item, index) in costItems" :key="index">
|
||||
{{ item }}
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th rowspan="2" style="width: 55px">日期</th>
|
||||
<th rowspan="2" style="width: 70px">预提额</th>
|
||||
<th rowspan="2" style="width: 85px">用途摘要</th>
|
||||
<th colspan="10" class="tc">费用项目</th>
|
||||
<th rowspan="2" style="width: 55px">余额</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th v-for="(item, index) in costItems" :key="index">
|
||||
{{ item }}
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in list" :key="index">
|
||||
<td>{{ item.USE_DATE }}</td>
|
||||
<td>{{ item.USE_TYPE === "1" ? item.AMOUNT : "" }}</td>
|
||||
<td>{{ item.USE_TYPE === "2" ? item.PURPOSESUMMARY : "" }}</td>
|
||||
<td v-for="(item1, index1) in costItems" :key="index1">
|
||||
{{ item.TYPE === item1 ? item.AMOUNT : "" }}
|
||||
</td>
|
||||
<td>{{ item.TOTAL }}</td>
|
||||
</tr>
|
||||
<tr v-for="(item, index) in list" :key="index">
|
||||
<td>{{ item.USE_DATE }}</td>
|
||||
<td>{{ item.USE_TYPE === "1" ? item.AMOUNT : "" }}</td>
|
||||
<td>{{ item.USE_TYPE === "2" ? item.PURPOSESUMMARY : "" }}</td>
|
||||
<td v-for="(item1, index1) in costItems" :key="index1">
|
||||
{{ item.TYPE === item1 ? item.AMOUNT : "" }}
|
||||
</td>
|
||||
<td>{{ item.TOTAL }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div v-html="PRINT_STYLE" />
|
||||
|
@ -121,13 +125,14 @@
|
|||
import useListData from "@/assets/js/useListData.js";
|
||||
import {
|
||||
getExtractionAndUseList,
|
||||
setExtractionAndUseBatchDelete
|
||||
setExtractionAndUseBatchDelete,
|
||||
} from "@/request/security_investment.js";
|
||||
import { debounce } from "throttle-debounce";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { ref } from "vue";
|
||||
import Add from "./components/add.vue";
|
||||
import { PRINT_STYLE } from "@/assets/js/constant.js";
|
||||
import { sumBy } from "lodash-es";
|
||||
|
||||
const yearList = (() => {
|
||||
const year = new Date().getFullYear();
|
||||
|
@ -147,17 +152,15 @@ const costItems = [
|
|||
"应急管理、事故救援演练以及救援队伍建设",
|
||||
"安全标志及标识",
|
||||
"配备劳动防护用品",
|
||||
"其它与安全生产直接相关的物品或者活动"
|
||||
"其它与安全生产直接相关的物品或者活动",
|
||||
];
|
||||
const total = await getExtractionAndUseList();
|
||||
console.log(total);
|
||||
const addDialogVisible = ref(false);
|
||||
const { list, searchForm, fnGetData, tableRef } = useListData(
|
||||
getExtractionAndUseList,
|
||||
{
|
||||
usePagination: false,
|
||||
defaultSearchForm: {
|
||||
YEAR: new Date().getFullYear()
|
||||
YEAR: new Date().getFullYear(),
|
||||
},
|
||||
callbackFn: (list) => {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
|
@ -170,7 +173,7 @@ const { list, searchForm, fnGetData, tableRef } = useListData(
|
|||
else list[i].TOTAL = list[i - 1].TOTAL - list[i].AMOUNT;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
);
|
||||
const fnGetSummaries = ({ columns, data }) => {
|
||||
|
@ -180,29 +183,20 @@ const fnGetSummaries = ({ columns, data }) => {
|
|||
sums[index] = "合计";
|
||||
return;
|
||||
}
|
||||
|
||||
// var arr = ref([5, 6, 7, 8, 9, 10, 11, 12, 13, 14])
|
||||
// if (arr.includes(index)) {
|
||||
// sums[index] = total.allOutlayTotalList[index - 5].total;
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (index !== columns.length - 1) {
|
||||
sums[index] = "--";
|
||||
return;
|
||||
}
|
||||
const values = data.map((item) => Number(item[column.property]));
|
||||
if (!values.every((value) => isNaN(value))) {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr;
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, 0);
|
||||
sums[index] = "--";
|
||||
}
|
||||
if (!data.every((value) => isNaN(value[column.property]))) {
|
||||
sums[index] =
|
||||
sumBy(data, (item) => {
|
||||
if (index === 3 && item.USE_TYPE === "1")
|
||||
return item[column.property];
|
||||
else if (
|
||||
index > 4 &&
|
||||
index < columns.length - 1 &&
|
||||
column.label === item.TYPE
|
||||
)
|
||||
return item[column.property];
|
||||
else if (index === columns.length - 1) return item[column.property];
|
||||
}) || "--";
|
||||
} else sums[index] = "--";
|
||||
});
|
||||
return sums;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue