安全费用投入

dev
wangpeng 2024-04-09 21:58:03 +08:00
parent db057467b2
commit 30c65501a6
7 changed files with 1096 additions and 0 deletions

View File

@ -0,0 +1,21 @@
import { post } from "@/request/axios.js";
export const getPlanList = (params) =>
post("/safetyinvestmentplan/list", params); // 安全投入计划列表
export const getPlanView = (params) =>
post("/safetyinvestmentplan/goEdit", params); // 安全投入计划查看
export const setPlanDelete = (params) =>
post("/safetyinvestmentplan/delete", params); // 安全投入计划删除
export const setPlanBatchDelete = (params) =>
post("/safetyinvestmentplan/deleteAll", params); // 安全投入计划批量删除
export const setPlanAdd = (params) => post("/safetyinvestmentplan/add", params); // 安全投入计划新增
export const setPlanEdit = (params) =>
post("/safetyinvestmentplan/edit", params); // 安全投入计划编辑
export const setPlanReview = (params) =>
post("/safetyinvestmentplan/editStatus", params); // 安全投入计划审核
export const getExtractionAndUseList = (params) =>
post("/safetyinvestmentuse/listAll", params); // 安全生产费用提取和使用管理列表
export const setExtractionAndUseBatchDelete = (params) =>
post("/safetyinvestmentuse/deleteAll", params); // 安全生产费用提取和使用管理批量删除
export const setExtractionAndUseAdd = (params) =>
post("/safetyinvestmentuse/add", params); // 安全生产费用提取和使用管理新增

View File

@ -0,0 +1,131 @@
<template>
<el-dialog v-model="visible" title="新增" @close="fnClose">
<div>
<el-form ref="formRef" :rules="rules" :model="form" label-width="80px">
<el-row :gutter="12">
<el-col :span="12">
<el-form-item label="时间" prop="USE_DATE">
<el-date-picker
v-model="form.USE_DATE"
format="YYYY-MM-DD"
value-format="YYYY-MM-DD"
type="date"
/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="12">
<el-col :span="12">
<el-form-item label="使用类型" prop="USE_TYPE">
<el-select v-model="form.USE_TYPE">
<el-option value="1" label="预提" />
<el-option value="2" label="支出" />
</el-select>
</el-form-item>
</el-col>
<el-col v-if="form.USE_TYPE === '1'" :span="12">
<el-form-item label="金额(元)" prop="AMOUNT">
<el-input-number
v-model="form.AMOUNT"
:min="1"
precision="2"
controls-position="right"
/>
</el-form-item>
</el-col>
<template v-if="form.USE_TYPE === '2'">
<el-col :span="12">
<el-form-item label="用途摘要" prop="PURPOSESUMMARY">
<el-input v-model="form.PURPOSESUMMARY" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="费用项目" prop="TYPE">
<el-select v-model="form.TYPE">
<el-option
v-for="(item, index) in costItems"
:key="index"
:value="item"
:label="item"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="金额(元)" prop="AMOUNT">
<el-input-number
v-model="form.AMOUNT"
:min="1"
precision="2"
controls-position="right"
/>
</el-form-item>
</el-col>
</template>
</el-row>
</el-form>
</div>
<template #footer>
<el-button @click="fnClose"></el-button>
<el-button type="primary" @click="fnSubmit"> </el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModel } from "@vueuse/core";
import { ref } from "vue";
import { debounce } from "throttle-debounce";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElMessage } from "element-plus";
import { setExtractionAndUseAdd } from "@/request/security_investment.js";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
costItems: {
type: Array,
required: true,
default: () => [],
},
});
const emits = defineEmits(["update:visible", "get-data"]);
const visible = useVModel(props, "visible", emits);
const rules = {
USE_DATE: [{ required: true, message: "请选择使用时间", trigger: "change" }],
USE_TYPE: [{ required: true, message: "请选择使用类型", trigger: "change" }],
AMOUNT: [{ required: true, message: "金额不能为空", trigger: "blur" }],
PURPOSESUMMARY: [
{ required: true, message: "用途摘要不能为空", trigger: "blur" },
],
TYPE: [{ required: true, message: "费用项目不能为空", trigger: "change" }],
};
const formRef = ref(null);
const form = ref({
USE_DATE: "",
USE_TYPE: "",
AMOUNT: "",
PURPOSESUMMARY: "",
TYPE: "",
});
const fnClose = () => {
formRef.value.resetFields();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
await setExtractionAndUseAdd({ ...form.value });
ElMessage.success("新增成功");
fnClose();
emits("get-data");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,220 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="90px"
@submit.prevent="fnGetData"
>
<el-row>
<el-col :span="6">
<el-form-item label="计划年份" prop="YEAR">
<el-select v-model="searchForm.YEAR">
<el-option
v-for="item in yearList"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnGetData">
重置
</el-button>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item class="end">
<el-button v-print="'#printContent'"> </el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
ref="tableRef"
row-key="SAFETYINVESTMENTUSE_ID"
:data="list"
:show-pagination="false"
show-summary
:summary-method="fnGetSummaries"
>
<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="预提额">
<template #default="{ row }">
<span v-if="row.USE_TYPE === '1'">{{ row.AMOUNT }}</span>
</template>
</el-table-column>
<el-table-column label="用途摘要">
<template #default="{ row }">
<span v-if="row.USE_TYPE === '2'">{{ row.PURPOSESUMMARY }}</span>
</template>
</el-table-column>
<el-table-column label="费用项目">
<el-table-column
v-for="(item, index) in costItems"
:key="index"
:label="item"
>
<template #default="{ row }">
<span v-if="row.TYPE === item">
{{ row.AMOUNT }}
</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column prop="TOTAL" label="余额" />
<template #button>
<el-button type="primary" @click="addDialogVisible = true">
新增
</el-button>
<el-button type="danger" @click="fnDelete"></el-button>
</template>
</layout-table>
<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>
</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>
</tbody>
</table>
<div v-html="PRINT_STYLE" />
</div>
</layout-card>
<add
v-model:visible="addDialogVisible"
:cost-items="costItems"
@get-data="fnGetData"
/>
</div>
</template>
<script setup>
import useListData from "@/assets/js/useListData.js";
import {
getExtractionAndUseList,
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";
const yearList = (() => {
const year = new Date().getFullYear();
const arr = [];
for (let i = 2021; i <= year + 1; i++) {
arr.push(i);
}
return arr;
})();
const costItems = [
"完善、改造和维护安全防护设备设施和器具",
"安全生产宣传、教育培训、技术研究和推广",
"安全评价、标准化建设等安全技术服务",
"安全生产风险因素辨识管控和事故隐患排查治理",
"重大危险源监控、设备设施安全性能检测检验",
"劳动防护用品配备、更换和安全生产津贴、奖金发放",
"应急管理、事故救援演练以及救援队伍建设",
"安全标志及标识",
"配备劳动防护用品",
"其它与安全生产直接相关的物品或者活动",
];
const addDialogVisible = ref(false);
const { list, searchForm, fnGetData, tableRef } = useListData(
getExtractionAndUseList,
{
usePagination: false,
defaultSearchForm: {
YEAR: new Date().getFullYear(),
},
callbackFn: (list) => {
for (let i = 0; i < list.length; i++) {
if (i === 0) {
if (list[i].USE_TYPE === "1") list[i].TOTAL = list[i].AMOUNT;
else list[i].TOTAL = 0 - list[i].AMOUNT;
} else {
if (list[i].USE_TYPE === "1")
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 sums = [];
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = "合计";
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] = "--";
}
});
return sums;
};
const fnDelete = debounce(
1000,
async () => {
const selectionData = tableRef.value.getSelectionRows();
if (selectionData.length === 0) {
ElMessage.warning("请选中要删除的项");
return;
}
await ElMessageBox.confirm("确定要删除选中的数据吗?", { type: "warning" });
const DATA_IDS = selectionData
.map((item) => item.SAFETYINVESTMENTUSE_ID)
.join(",");
await setExtractionAndUseBatchDelete({ DATA_IDS });
ElMessage.success("删除成功");
fnGetData();
},
{ atBegin: true }
);
</script>
<style scoped></style>

View File

@ -0,0 +1,227 @@
<template>
<el-dialog
v-model="visible"
:title="type === 'add' ? '新增' : '修改'"
width="1500"
@close="fnClose"
>
<el-form ref="formRef" :rules="rules" :model="form" label-width="110px">
<el-row>
<el-col :span="8">
<el-form-item label="计划名称" prop="PLAN_NAME">
<el-input v-model="form.PLAN_NAME" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划年份" prop="PLAN_YEAR">
<el-select v-model="form.PLAN_YEAR">
<el-option
v-for="item in yearList"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划周期" prop="PLAN_PERIOD">
<el-select v-model="form.PLAN_PERIOD">
<el-option
v-for="item in planPeriodList"
:key="item.ID"
:value="item.ID"
:label="item.NAME"
/>
</el-select>
</el-form-item>
</el-col>
<template
v-for="(item, index) in form.infos"
:key="item.id || item.SAFETYINVESTMENTPLANINFO_ID"
>
<el-col :span="8">
<el-form-item
:label="'费用类型' + (index + 1)"
:prop="'infos.' + index + '.TYPE'"
:rules="{ required: true, message: '请选择费用类型' }"
>
<el-select v-model="item.TYPE">
<el-option
v-for="item1 in typeList"
:key="item1"
:label="item1"
:value="item1"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
:label="'明细' + (index + 1)"
:prop="'infos.' + index + '.DESCR'"
:rules="{
required: true,
message: '请输入明细',
trigger: 'blur',
}"
>
<el-input v-model="item.DESCR" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
:label="'金额' + (index + 1)"
:prop="'infos.' + index + '.AMOUNT'"
:rules="[
{
required: true,
message: '请输入金额',
trigger: 'blur',
},
{
type: 'number',
message: '请输入数字',
trigger: 'blur',
},
]"
>
<el-input
v-model.number="item.AMOUNT"
@input="fnCalculateTotalAmount"
>
<template #append></template>
</el-input>
</el-form-item>
</el-col>
<el-col :span="2">
<el-form-item label-width="0" class="end">
<el-button v-show="index === 0" type="primary" @click="fnAddInfo">
添加使用明细
</el-button>
<el-button
v-show="index > 0"
type="danger"
@click="fnRemoveInfo(index)"
>
删除使用明细
</el-button>
</el-form-item>
</el-col>
</template>
<el-col :span="24">
<el-form-item label="总金额" prop="TOTAL_AMOUNT">
<el-input
v-model="form.TOTAL_AMOUNT"
placeholder="这里输入总金额..."
readonly
>
<template #append></template>
</el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<el-button @click="fnClose"> </el-button>
<el-button type="primary" @click="fnSubmit"> </el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModels } from "@vueuse/core";
import { ref } from "vue";
import { debounce } from "throttle-debounce";
import useFormValidate from "@/assets/js/useFormValidate.js";
import { ElMessage } from "element-plus";
import { sumBy } from "lodash-es";
import { setPlanAdd, setPlanEdit } from "@/request/security_investment.js";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
form: {
type: Object,
required: true,
default: () => ({}),
},
type: {
type: String,
required: true,
default: "add",
},
yearList: {
type: Array,
required: true,
default: () => [],
},
planPeriodList: {
type: Array,
required: true,
default: () => [],
},
});
const emits = defineEmits(["update:visible", "update:form", "get-data"]);
const { visible, form } = useVModels(props, emits);
const typeList = [
"完善、改造和维护安全防护设备设施",
"安全生产教育培训教育",
"安全评价、重大危险源监控、事故隐患评估和整改",
"设备设施安全性能检测检验",
"应急救援器材、装备的配备及应急救援演练",
"安全标志及标识",
"配备劳动防护用品",
"他与安全生产直接相关的物品或者活动",
];
const rules = {
PLAN_NAME: [
{ required: true, message: "计划名称不能为空", trigger: "change" },
],
PLAN_YEAR: [
{ required: true, message: "计划年份不能为空", trigger: "change" },
],
PLAN_PERIOD: [
{ required: true, message: "计划周期不能为空", trigger: "blur" },
],
TOTAL_AMOUNT: [
{ required: true, message: "总金额不能为空", trigger: "blur" },
],
};
const formRef = ref(null);
const fnAddInfo = () => {
form.value.infos.push({ TYPE: "", DESCR: "", AMOUNT: 0, id: Math.random() });
};
const fnRemoveInfo = (index) => {
form.value.infos.splice(index, 1);
fnCalculateTotalAmount();
};
const fnCalculateTotalAmount = () => {
form.value.TOTAL_AMOUNT = sumBy(form.value.infos, (item) => item.AMOUNT);
};
const fnClose = () => {
formRef.value.resetFields();
visible.value = false;
};
const fnSubmit = debounce(
1000,
async () => {
await useFormValidate(formRef);
const params = {
...form.value,
STATUS: 0,
info: JSON.stringify(form.value.infos),
};
props.type === "add" ? await setPlanAdd(params) : await setPlanEdit(params);
ElMessage.success("操作成功");
fnClose();
emits("get-data");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,80 @@
<template>
<el-dialog v-model="visible" title="查看" width="1500">
<el-descriptions :column="3" border>
<el-descriptions-item label="计划名称">
{{ info.PLAN_NAME }}
</el-descriptions-item>
<el-descriptions-item label="计划年份">
{{ info.PLAN_YEAR }}
</el-descriptions-item>
<el-descriptions-item label="计划周期">
{{ info.PLAN_PERIOD }}
</el-descriptions-item>
<template v-for="(item, index) in info.infos" :key="index">
<el-descriptions-item label="费用类型">
{{ item.TYPE }}
</el-descriptions-item>
<el-descriptions-item label="明细">
{{ item.DESCR }}
</el-descriptions-item>
<el-descriptions-item label="金额">
{{ item.AMOUNT }}
</el-descriptions-item>
</template>
<el-descriptions-item label="总金额">
{{ info.TOTAL_AMOUNT }}
</el-descriptions-item>
</el-descriptions>
<template #footer>
<template v-if="type === 'review'">
<el-button type="primary" @click="fnSubmit(1)"></el-button>
<el-button type="danger" @click="fnSubmit(-1)"></el-button>
</template>
<el-button @click="fnClose"></el-button>
</template>
</el-dialog>
</template>
<script setup>
import { useVModel } from "@vueuse/core";
import { setPlanReview } from "@/request/security_investment.js";
import { debounce } from "throttle-debounce";
import { ElMessage } from "element-plus";
const props = defineProps({
visible: {
type: Boolean,
required: true,
default: false,
},
info: {
type: Object,
required: true,
default: () => ({}),
},
type: {
type: String,
default: "view",
},
});
const emits = defineEmits(["update:visible", "get-data"]);
const visible = useVModel(props, "visible", emits);
const fnClose = () => {
visible.value = false;
};
const fnSubmit = debounce(
1000,
async (STATUS) => {
await setPlanReview({
SAFETYINVESTMENTPLAN_ID: props.info.SAFETYINVESTMENTPLAN_ID,
STATUS,
});
ElMessage.success(`${STATUS === 1 ? "通过" : "打回"}成功`);
fnClose();
emits("get-data");
},
{ atBegin: true }
);
</script>
<style scoped lang="scss"></style>

View File

@ -0,0 +1,262 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="90px"
@submit.prevent="fnResetPagination"
>
<el-row>
<el-col :span="5">
<el-form-item label="计划名称" prop="KEYWORDS">
<el-input v-model="searchForm.KEYWORDS" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="计划年份" prop="PLAN_YEAR">
<el-select v-model="searchForm.PLAN_YEAR">
<el-option
v-for="item in yearList"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="计划周期" prop="PLAN_PERIOD">
<el-select v-model="searchForm.PLAN_PERIOD">
<el-option
v-for="item in planPeriodList"
:key="item.ID"
:value="item.ID"
:label="item.NAME"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="状态" prop="STATUS">
<el-select v-model="searchForm.STATUS">
<el-option
v-for="item in statusList"
:key="item.ID"
:value="item.ID"
:label="item.NAME"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPagination">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
ref="tableRef"
v-model:pagination="pagination"
row-key="SAFETYINVESTMENTPLAN_ID"
:data="list"
@get-data="fnGetData"
>
<el-table-column reserve-selection type="selection" width="55" />
<el-table-column label="序号" width="60">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column prop="PLAN_NAME" label="计划名称" />
<el-table-column prop="PLAN_YEAR" label="计划年份" />
<el-table-column prop="PLAN_PERIOD" label="计划周期" />
<el-table-column prop="INFO_COUNT" label="涉及费用项数" />
<el-table-column prop="TOTAL_AMOUNT" label="总金额" />
<el-table-column prop="CREATOR" label="编制人" />
<el-table-column label="审核人">
<template #default="{ row }">
<span v-if="row.STATUS !== 0">{{ row.OPERATOR }}</span>
</template>
</el-table-column>
<el-table-column label="状态">
<template #default="{ row }">
{{ translationStatus(row.STATUS, statusList) }}
</template>
</el-table-column>
<el-table-column label="操作" width="150">
<template #default="{ row }">
<el-button
type="primary"
text
link
@click="fnView(row.SAFETYINVESTMENTPLAN_ID)"
>
查看
</el-button>
<el-button
v-if="buttonJurisdiction.del && row.STATUS < 1"
type="primary"
text
link
@click="fnDelete(row.SAFETYINVESTMENTPLAN_ID)"
>
删除
</el-button>
<el-button
v-if="buttonJurisdiction.edit && row.STATUS < 1"
type="primary"
text
link
@click="fnAddOrEdit(row.SAFETYINVESTMENTPLAN_ID, 'edit')"
>
编辑
</el-button>
</template>
</el-table-column>
<template #button>
<el-button
v-if="buttonJurisdiction.add"
type="primary"
@click="fnAddOrEdit('', 'add')"
>
新增
</el-button>
<el-button
v-if="buttonJurisdiction.del"
type="danger"
@click="fnBatchDelete"
>
批量删除
</el-button>
</template>
</layout-table>
</layout-card>
<view-info
v-model:visible="data.viewDialog.visible"
:info="data.viewDialog.info"
/>
<add
v-model:visible="data.addDialog.visible"
v-model:form="data.addDialog.form"
:type="data.addDialog.type"
:year-list="yearList"
:plan-period-list="planPeriodList"
@get-data="fnResetPagination"
/>
</div>
</template>
<script setup>
import { serialNumber, translationStatus } from "@/assets/js/utils";
import useListData from "@/assets/js/useListData.js";
import { debounce } from "throttle-debounce";
import { ElMessage, ElMessageBox } from "element-plus";
import {
getPlanList,
getPlanView,
setPlanBatchDelete,
setPlanDelete,
} from "@/request/security_investment.js";
import useButtonJurisdiction from "@/assets/js/useButtonJurisdiction.js";
import ViewInfo from "./components/view.vue";
import add from "./components/add.vue";
import { nextTick, reactive } from "vue";
const yearList = (() => {
const year = new Date().getFullYear();
const arr = [];
for (let i = 2021; i <= year + 1; i++) {
arr.push(i);
}
return arr;
})();
const planPeriodList = [
{ NAME: "季度计划1", ID: "季度计划1" },
{ NAME: "季度计划2", ID: "季度计划2" },
{ NAME: "季度计划3", ID: "季度计划3" },
{ NAME: "季度计划4", ID: "季度计划4" },
];
const statusList = [
{ NAME: "待审核", ID: 0 },
{ NAME: "已归档", ID: 1 },
{ NAME: "已打回", ID: -1 },
];
const { list, pagination, searchForm, fnGetData, fnResetPagination, tableRef } =
useListData(getPlanList);
const data = reactive({
viewDialog: {
visible: false,
info: {},
},
addDialog: {
visible: false,
type: "",
form: {
PLAN_NAME: "",
PLAN_YEAR: "",
PLAN_PERIOD: "",
TOTAL_AMOUNT: 0,
infos: [],
},
},
});
const buttonJurisdiction = await useButtonJurisdiction("safetyinvestmentplan");
const fnDelete = debounce(
1000,
async (SAFETYINVESTMENTPLAN_ID) => {
await ElMessageBox.confirm(`确定要删除吗?`, {
type: "warning",
});
await setPlanDelete({ SAFETYINVESTMENTPLAN_ID });
ElMessage.success(`删除成功`);
fnResetPagination();
},
{ atBegin: true }
);
const fnBatchDelete = debounce(
1000,
async () => {
const selectionData = tableRef.value.getSelectionRows();
if (selectionData.length === 0) {
ElMessage.warning("请选中要删除的项");
return;
}
await ElMessageBox.confirm("确定要删除选中的数据吗?", { type: "warning" });
const DATA_IDS = selectionData
.map((item) => item.SAFETYINVESTMENTPLAN_ID)
.join(",");
await setPlanBatchDelete({ DATA_IDS });
ElMessage.success("删除成功");
fnResetPagination();
},
{ atBegin: true }
);
const fnView = async (SAFETYINVESTMENTPLAN_ID) => {
const resData = await getPlanView({ SAFETYINVESTMENTPLAN_ID });
data.viewDialog.info = resData.pd;
data.viewDialog.info.infos = resData.infoList;
data.viewDialog.visible = true;
};
const fnAddOrEdit = async (SAFETYINVESTMENTPLAN_ID, type) => {
data.addDialog.visible = true;
await nextTick();
data.addDialog.type = type;
if (type === "edit") {
const resData = await getPlanView({ SAFETYINVESTMENTPLAN_ID });
data.addDialog.form = resData.pd;
data.addDialog.form.infos = resData.infoList;
} else {
data.addDialog.form.infos = [
{ TYPE: "", DESCR: "", AMOUNT: 0, id: Math.random() },
];
}
};
</script>
<style scoped></style>

View File

@ -0,0 +1,155 @@
<template>
<div>
<el-card>
<el-form
:model="searchForm"
label-width="90px"
@submit.prevent="fnResetPagination"
>
<el-row>
<el-col :span="5">
<el-form-item label="计划名称" prop="KEYWORDS">
<el-input v-model="searchForm.KEYWORDS" />
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="计划年份" prop="PLAN_YEAR">
<el-select v-model="searchForm.PLAN_YEAR">
<el-option
v-for="item in yearList"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="计划周期" prop="PLAN_PERIOD">
<el-select v-model="searchForm.PLAN_PERIOD">
<el-option
v-for="item in planPeriodList"
:key="item.ID"
:value="item.ID"
:label="item.NAME"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="5">
<el-form-item label="状态" prop="STATUS">
<el-select v-model="searchForm.STATUS">
<el-option
v-for="item in statusList"
:key="item.ID"
:value="item.ID"
:label="item.NAME"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4">
<el-form-item label-width="10px">
<el-button type="primary" native-type="submit">搜索</el-button>
<el-button native-type="reset" @click="fnResetPagination">
重置
</el-button>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-card>
<layout-card>
<layout-table
v-model:pagination="pagination"
:data="list"
@get-data="fnGetData"
>
<el-table-column label="序号" width="60">
<template #default="{ $index }">
{{ serialNumber(pagination, $index) }}
</template>
</el-table-column>
<el-table-column prop="PLAN_NAME" label="计划名称" />
<el-table-column prop="PLAN_YEAR" label="计划年份" />
<el-table-column prop="PLAN_PERIOD" label="计划周期" />
<el-table-column prop="INFO_COUNT" label="涉及费用项数" />
<el-table-column prop="TOTAL_AMOUNT" label="总金额" />
<el-table-column prop="CREATOR" label="编制人" />
<el-table-column label="审核人">
<template #default="{ row }">
<span v-if="row.STATUS !== 0">{{ row.OPERATOR }}</span>
</template>
</el-table-column>
<el-table-column label="状态">
<template #default="{ row }">
{{ translationStatus(row.STATUS, statusList) }}
</template>
</el-table-column>
<el-table-column label="操作" width="80">
<template #default="{ row }">
<el-button
v-if="row.STATUS === 0"
type="primary"
text
link
@click="fnReview(row.SAFETYINVESTMENTPLAN_ID)"
>
审核
</el-button>
</template>
</el-table-column>
</layout-table>
</layout-card>
<view-info
v-model:visible="data.reviewDialog.visible"
:info="data.reviewDialog.info"
type="review"
@get-data="fnResetPagination"
/>
</div>
</template>
<script setup>
import { serialNumber, translationStatus } from "@/assets/js/utils";
import useListData from "@/assets/js/useListData.js";
import { getPlanList, getPlanView } from "@/request/security_investment.js";
import ViewInfo from "../plan/components/view.vue";
import { reactive } from "vue";
const yearList = (() => {
const year = new Date().getFullYear();
const arr = [];
for (let i = 2021; i <= year + 1; i++) {
arr.push(i);
}
return arr;
})();
const planPeriodList = [
{ NAME: "季度计划1", ID: "季度计划1" },
{ NAME: "季度计划2", ID: "季度计划2" },
{ NAME: "季度计划3", ID: "季度计划3" },
{ NAME: "季度计划4", ID: "季度计划4" },
];
const statusList = [
{ NAME: "待审核", ID: 0 },
{ NAME: "已归档", ID: 1 },
{ NAME: "已打回", ID: -1 },
];
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
useListData(getPlanList);
const data = reactive({
reviewDialog: {
visible: false,
info: {},
},
});
const fnReview = async (SAFETYINVESTMENTPLAN_ID) => {
const resData = await getPlanView({ SAFETYINVESTMENTPLAN_ID });
data.reviewDialog.info = resData.pd;
data.reviewDialog.info.infos = resData.infoList;
data.reviewDialog.visible = true;
};
</script>
<style scoped></style>