部门执行预算分月度季度统计、进展率85%才能保存

master
xy 2 years ago
parent c47e0bf28a
commit c7b5940d38

@ -16,11 +16,12 @@ export function readNotice(params){
})
}
export function statistic(params){
export function statistic(params,noloading=false){
return request({
method:'get',
url:'/api/admin/notice/statistic',
params
params,
noloading
})
}

@ -54,10 +54,14 @@
<script>
import { paidSave, paidIndex, paidStore, paidDestroy } from "@/api/budget/budget"
import { statistic } from "@/api/dashboard/notice";
export default {
props: {},
data() {
return {
rowType: "",
typeList: [],
plan_department_id: "",
isShow: false,
id: "",
type: "",
@ -256,6 +260,33 @@ export default {
})
return
}
let month = this.formList[i]?.paid_plan_date.split('-')[1];
if (month == 11 || month == 12) {
const data = this.typeList.find(i => i.type === this.rowType)
if (data) {
let department = data.departments?.find(i => i.department_id === this.plan_department_id)
let m2 = department.money_total_2;
let m1 = department.money_total_1;
let m3 = department.use_money_total;
let per = 0;
if (m2 != 0) {
per = ((m3 / m2) * 100).toFixed(2);
} else if (m1 != 0) {
per = ((m3 / m1) * 100).toFixed(2);
}
console.log(per,'per')
if (per < 85) {
this.$message({
type: "warning",
message: `责任科室执行率未达到85%,当前计划${data.type_text}进展率为${per}%`,
duration: 3000
})
return
}
}
}
}
let editIds = Array.from(new Set(this.editId))
let promiseAll = [];
@ -278,10 +309,42 @@ export default {
})
}
},
getPer(row) {
let m2 = row.money_total_2;
let m1 = row.money_total_1;
let m3 = row.use_money_total;
let per = 0;
if (m2 != 0) {
per = ((m3 / m2) * 100).toFixed(2);
} else if (m1 != 0) {
per = ((m3 / m1) * 100).toFixed(2);
}
return per;
},
async getStatistic() {
const res = await statistic({
year: this.$parent.select.year
},true);
if (res.typeList) {
let arr = [];
for (let i = 0; i < res.typeList.length; i++) {
if (res.typeList[i]) {
res.typeList[i].per = this.getPer(res.typeList[i]);
arr.push(res.typeList[i])
}
}
this.typeList = arr;
}
//this.split = Array.from({ length: Math.ceil(this.typeList/2) },() => 0.5)
console.log(123, this.typeList);
},
},
watch: {
isShow(val) {
if (val) {
this.getStatistic()
this.getDetail();
} else {
this.id = "";
@ -296,6 +359,8 @@ export default {
},
},
created() {},
mounted() {
}
};
</script>

@ -43,7 +43,7 @@
<template v-slot:btns>
<el-table-column header-align="center" align="left" :width="130" label="操作" >
<template #default="{ row }">
<Button size="small" type="primary" @click="$refs['payPlan'].rowName = row.name,$refs['payPlan'].setId(row.id),$refs['payPlan'].show();">付款计划</Button>
<Button size="small" type="primary" @click="$refs['payPlan'].rowType = row.type,$refs['payPlan'].plan_department_id = row.plan_department_id,$refs['payPlan'].rowName = row.name,$refs['payPlan'].setId(row.id),$refs['payPlan'].show()">付款计划</Button>
</template>
</el-table-column>
</template>

@ -7,6 +7,9 @@
>
<div slot="content"></div>
<slot>
<span>
<el-switch v-model="type" :active-value="1" :inactive-value="2" active-text="季度" inactive-text="月度"></el-switch>
</span>
<span style="padding: 0 6px;word-break: keep-all;">年份</span>
<span>
<DatePicker :value="select.year" placeholder="请选择年份" type="year" placement="bottom-start" style="width: 160px"
@ -29,7 +32,7 @@
</slot>
</lx-header>
<xy-table :list="list" :table-item="table">
<xy-table ref="xyTable" :list="list" :table-item="table">
<template #btns> </template>
</xy-table>
@ -54,7 +57,9 @@ import { departmentMoney } from "@/api/static";
export default {
data() {
return {
type: 1,
select: {
type: 1,//12
page: 1,
page_size: 10,
keyword: "",
@ -62,7 +67,27 @@ export default {
year:""
},
list: [],
table: [
};
},
methods: { //
percent (a,b) {
if (b == 0) {
return 0
}
return (parseInt(a) / parseInt(b) * 100).toFixed(2)
},
async getList() {
this.select.type = this.type;
const res = await departmentMoney(this.select);
this.list = res;
this.$refs['xyTable'].doLayout()
},
},
computed: {
table () {
const type = this.select.type;
return [
{
label: '项目',
fixed: 'left',
@ -79,7 +104,7 @@ export default {
row.plan?.map((i,index) => {
return (
<el-tooltip class="item" effect="dark" content={i.name} placement="top">
<p class="split" style={{"background":index%2===0?'#ff000015':''}}>{i.name}</p>
<p class="split" style={{"background":index%2===0?'#ff000012':''}}>{i.name}</p>
</el-tooltip>
)
})
@ -100,7 +125,7 @@ export default {
customFn: row => {
return (
<div style="display: flex;flex-direction: column;">
<p class="split split__department" style="text-align: right;">{
<p class="split split__department" style="text-align: right;padding-right: 5px;">{
row.plan?.reduce((a, b) => {
return parseInt(a) + parseInt(b.money)
},0)
@ -108,7 +133,7 @@ export default {
{
row.plan?.map((i,index) => {
return (
<p class="split" style={{"text-align": "right","background":index%2===0?'#ff000015':''}}>{ i.money }</p>
<p class="split" style={{"text-align": "right","background":index%2===0?'#ff000012':''}}>{ i.money }</p>
)
})
}
@ -119,18 +144,17 @@ export default {
]
},
...(() => {
let labels = new Map([
let quarterLabels = new Map([
[0, '第一季度'],
[1, '第二季度'],
[2, '第三季度'],
[3, '10月'],
[4, '11月'],
[5, '12月']
[3, '第四季度']
])
let monthLabels = new Map(Array.from({length: 12},(_,index)=>([index,`${index+1}`])))
let arr = []
for (let z = 0;z < 6;z ++) {
for (let z = 0;z < (type === 1 ? 4 : 12);z ++) {
arr.push({
label: labels.get(z),
label: type === 1 ? quarterLabels.get(z) : monthLabels.get(z),
Fprop: '',
multiHd: [
{
@ -140,7 +164,7 @@ export default {
customFn: row => {
return (
<div style="display: flex;flex-direction: column;">
<p class="split split__department" style="text-align: right;">{
<p class="split split__department" style="text-align: right;padding-right: 5px;">{
row.plan?.reduce((a, b) => {
return parseInt(a) + parseInt(b.detail[z].plan_total)
},0)
@ -148,7 +172,7 @@ export default {
{
row.plan?.map((i,index) => {
return (
<p class="split" style={{"text-align": "right","background":index%2===0?'#ff000015':''}}>{ i.detail[z].plan_total }</p>
<p class="split" style={{"text-align": "right","background":index%2===0?'#ff000012':''}}>{ i.detail[z].plan_total }</p>
)
})
}
@ -163,7 +187,7 @@ export default {
customFn: row => {
return (
<div style="display: flex;flex-direction: column;">
<p class="split split__department" style="text-align: right;">{
<p class="split split__department" style="text-align: right;padding-right: 5px;">{
row.plan?.reduce((a, b) => {
return parseInt(a) + parseInt(b.detail[z].act_total)
},0)
@ -186,7 +210,7 @@ export default {
customFn: row => {
return (
<div style="display: flex;flex-direction: column;">
<p class="split split__department" style="text-align: right;">{
<p class="split split__department" style="text-align: right;padding-right: 5px;">{
this.percent(row.plan?.reduce((a, b) => {
return parseInt(a) + parseInt(b.detail[z].act_total)
},0),row.plan?.reduce((a, b) => {
@ -196,7 +220,7 @@ export default {
{
row.plan?.map((i,index) => {
return (
<p class="split" style={{"text-align": "right","background":index%2===0?'#ff000015':''}}>{ this.percent(i.detail[z].act_total,i.detail[z].plan_total) }%</p>
<p class="split" style={{"text-align": "right","background":index%2===0?'#ff000012':''}}>{ this.percent(i.detail[z].act_total,i.detail[z].plan_total) }%</p>
)
})
}
@ -221,7 +245,7 @@ export default {
{
row.plan?.map((i,index) => {
return (
<p class="split" style={{"text-align": "right","background":index%2===0?'#ff000015':''}}>{
<p class="split" style={{"text-align": "right","background":index%2===0?'#ff000012':''}}>{
i.detail?.reduce((a,b) => {
return a + parseInt(b.plan_total)
},0)
@ -233,26 +257,12 @@ export default {
)
}
}
],
};
},
methods: { //
percent (a,b) {
if (b == 0) {
return 0
}
return (parseInt(a) / parseInt(b) * 100).toFixed(2)
},
async getList() {
const res = await departmentMoney(this.select);
this.list = res;
},
]
}
},
computed: {},
created() {
this.select.year = this.$moment().format('YYYY');
this.getList();
this.getList();
},
};
</script>

Loading…
Cancel
Save