安全生产费用提取和使用管理合计

dev
LiuJiaNan 2024-04-26 11:03:06 +08:00
parent 9a445bc29b
commit c9e9f71e54
1 changed files with 46 additions and 52 deletions

View File

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