master
271556543@qq.com 3 years ago
parent 417c41c10a
commit ca82ba207e

@ -115,3 +115,14 @@ export function param2Obj(url) {
})
return obj
}
//防抖
export function debounce(fn,delay=500){
let timer = null
return function _debounce() {
if (timer) clearTimeout(timer)
timer = setTimeout(() => {
fn()
}, delay)
}
}

@ -0,0 +1,260 @@
<template>
<div style="padding: 0 20px">
<lx-header icon="md-apps" text="预算计划" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content"></div>
<slot>
<div>
<span style="padding: 0 6px;">年份</span>
<span>
<DatePicker placeholder="选择所属年份" type="year" placement="bottom" :value="select.year" style="width: 130px;" @on-change="(e)=>select.year = e"></DatePicker>
</span>
<span style="padding: 0 6px;">
预算类型
</span>
<span>
<Select placeholder="选择预算类型" v-model="select.type" style="width:130px;" clearable>
<Option v-for="item in [{label:'部门预算',value:1},{label:'水务计划',value:2}]" :value="item.value" :key="item.value">{{ item.label }}</Option>
</Select>
</span>
<span style="padding: 0 6px;">
科室
</span>
<span>
<el-cascader
placeholder="选择科室"
size="small"
:value="select.department"
style="width: 160px;"
:options="departments"
:props="{ checkStrictly: true, label: 'name', value: 'id' }"
clearable
@change="e => select.department = e[e.length-1] || ''"/>
</span>
<Button type="primary" style="margin-left: 10px" @click="getBudgets"></Button>
<Button type="primary" style="margin-left: 10px" @click="()=>select={page:1,year:'', type:'', department:''}">重置</Button>
</div>
</slot>
</lx-header>
<xy-table :table-item="table" :list="list" :show-summary="true" :summary-method="summary">
<template v-slot:btns><div></div></template>
</xy-table>
<div style="display: flex;justify-content: flex-end;">
<Page :total="total" show-elevator @on-change="pageChange"/>
</div>
</div>
</template>
<script>
import {addBudget,getBudget,delBudget,editorBudget,detailBudget} from "@/api/budget/budget"
import {listdeptNoAuth} from "@/api/system/department"
import {Message} from "element-ui";
import {parseTime} from "@/utils"
export default {
data() {
return {
isShowAdd:false,
form:{
name:"",
type:"",
year:"",
department:"",
money:"",
content:"",
remark:""
},
rules:{
name:[
{required:true,message:"必填项"}
],
type:[
{required:true,message:"必选项"}
],
year:[
{required:true,message:"必选项"}
],
department:[
{required:true,message:"必选项"}
],
money:[
{required:true,message:"必填项"},
{pattern:/^\d+(\.\d+)?$/, message: '必须为数字'}
],
content:[
{required:true,message:"必填项"}
]
},
list:[],
totalMoney:0,
total:0,
pageIndex:1,
table:[
{
label:"项目名称",
prop:'name',
width: 200,
align:'left',
sortable:false,
fixed:'left'
},
{
label:"预算类型",
prop:'type',
width:115,
formatter:(cell,data,value)=>{
switch (value){
case 1:
return "部门预算"
break;
case 2:
return "水务计划"
break;
default:
return "未知"
}
}
},
{
label:"所属年份",
prop:'year',
width: 105
},
{
label: "相关科室",
prop:'plan_department.name',
width: 110
},
{
label:'项目金额(元)',
prop:'money',
align:'right',
width: 160
},
{
label:"创建信息",
prop:'created_at',
width: 160,
formatter:(cell,data,value)=>{
return parseTime(new Date(value),'{y}-{m}-{d}')
}
},
{
label:"描述",
minWidth:300,
prop:'content',
align:'left',
sortable:false
},
],
select:{
page:1,
year:"",
type:"",
department:""
},
departments:[],//
//
isShowEditor:false,
editorForm:{},
}
},
methods: {
//
summary(param){
const { columns, data } = param
const sums = []
columns.map((column,index) => {
if(index === 0){
sums[index] = '总计'
return
}
if(column.property === 'money'){
sums[index] = this.totalMoney
return
}
// const values = data.map(item => Number(item[column.property]));
// if (!values.every(value => isNaN(value)) && (column.property === 'money' || column.property === 'plan_price'|| column.property === 'fund_log_total')) {
//
// sums[index] = sums[index].toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,')
// } else {
// sums[index] = '';
// }
})
return sums
},
//
pageChange(e){
this.pageIndex = e
this.getBudgets()
},
//
getDepartment(){
listdeptNoAuth().then(res=>{
this.departments = res
})
},
//
getBudgets(){
getBudget({
page_size:10,
page:this.pageIndex,
year:this.select.year,
type:this.select.type,
plan_department_id:this.select.department
}).then(res=>{
this.list = res.list.data
this.total = res.list.total
this.totalMoney = res.total_money
})
},
showEditor(row){
this.getDepartment()
detailBudget({id:row.id}).then(res=>{
this.editorForm =
{
id:res.id,
name:res.name,
type:res.type,
department:res.plan_department_id,
money:res.money,
year:res.year,
content:res.content,
remark:res.remark
}
this.isShowEditor = true
console.log(this.editorForm)
})
},
},
mounted() {
this.getDepartment()
this.getBudgets()
}
}
</script>
<style scoped lang="scss">
.xy-table-item-label{
width: 140px;
}
.xy-table-item-price{
position: relative;
&::after{
z-index: 1;
position: absolute;
right: 0;
top: 0;
content:'(元)'
}
::v-deep .el-input__clear{
position: relative;
right: 30px;
z-index: 2;
}
}
</style>

@ -1,7 +1,7 @@
<template>
<div>
<div v-if="detail">
<!-- 合同详情-->
<xy-dialog :is-show.sync="isShowDetail" type="normal" title="详情" class="contract-detail" v-if="detail">
<xy-dialog :is-show.sync="isShowDetail" type="normal" title="详情" class="contract-detail">
<template v-slot:normalContent>
<div class="base-info">
<div class="base-info-title">项目基本信息</div>
@ -30,7 +30,7 @@
</div>
<div class="base-info-item">
<div class="base-info-item-title">资金渠道</div>
<div class="base-info-item-content">{{detail.money_way.value}}</div>
<div class="base-info-item-content">{{moneyWayFormatter(detail.money_way_detail)}}</div>
</div>
</div>
<div class="link-budget-plan">
@ -325,6 +325,14 @@ export default {
return "未知"
}
}
},
moneyWayFormatter(){
return function (arr){
let res = arr.map(item => {
return item.value
})
return res.toString()
}
}
},
mounted() {

@ -84,7 +84,7 @@
<template v-slot:btns>
<el-table-column label="使用金额" header-align="center">
<template slot-scope="scope">
<Input :value="scope.row.use_money" @input="(e)=>scope.row.use_money = e"/>
<Input :value="scope.row.use_money" @input="planInput($event,scope.row)"/>
</template>
</el-table-column>
</template>
@ -167,6 +167,18 @@ export default {
}
},
methods: {
//
planInput(e,row){
if(e <= (Number(row.money) - Number(row.use_money_total))){
row.useMoney = e
}else{
Message({
type:'warning',
message:'使用金额大于剩余预算'
})
row.useMoney = 0
}
},
async getFundLog(id){
this.id = id
const res = await detailFundLog({id})
@ -175,8 +187,8 @@ export default {
},
async getBudgets(){
let res = await getBudget({name:this.searchContent,page_size:10,page:this.plansPageIndex})
this.plans = res.data
this.planTotal = res.total
this.plans = res.list.data
this.planTotal = res.list.total
},
planPageChange(e){

@ -110,7 +110,7 @@
<template v-slot:btns>
<el-table-column label="使用金额" header-align="center">
<template slot-scope="scope">
<Input :value="scope.row.useMoney" @input="(e)=>scope.row.useMoney = e"/>
<Input :value="scope.row.useMoney" @input="planInput($event,scope.row)"/>
</template>
</el-table-column>
</template>
@ -220,7 +220,18 @@ export default {
}
},
methods: {
//
planInput(e,row){
if(e <= (Number(row.money) - Number(row.use_money_total))){
row.useMoney = e
}else{
Message({
type:'warning',
message:'使用金额大于剩余预算'
})
row.useMoney = 0
}
},
//
selectPlan(sel,row){
if(sel){
@ -248,8 +259,8 @@ export default {
//
async getBudgets(){
let res = await getBudget({name:this.planSearch,page_size:10,page:this.plansPageIndex})
this.plans = res.data
this.planTotal = res.total
this.plans = res.list.data
this.planTotal = res.list.total
this.toggleSelection(this.detail.plan.map(item => {
return item.value.plan_id
@ -263,7 +274,10 @@ export default {
toggleSelection(plans) {
if (plans) {
this.plans.filter(plan => {
return plans.includes(plan.id)
if(plans.includes(plan.id)){
plan.useMoney = this.detail.plan[plans.indexOf(plan.id)].value.use_money
return true
}
}).map(row => {
this.$refs.editorPlanTable.toggleRowSelection(row)
})
@ -287,7 +301,9 @@ export default {
label:item.name,
value:{
plan_id:item.id,
use_money:item.useMoney,
use_money:res.plan_link.filter(item1 => {
return item1.plan_id === item.id
})[0].use_money,
new_money:item.money
}
}

@ -299,8 +299,8 @@ export default {
//
async getBudgets(){
let res = await getBudget({name:this.searchContent,page_size:10,page:this.pageIndex})
this.plans = res.data
this.planTotal = res.total
this.plans = res.list.data
this.planTotal = res.list.total
this.toggleSelection(this.paymentRegistrationForm.plan.map(item => {
return item.plan_id

@ -274,8 +274,8 @@ export default {
//
async getBudgets(){
let res = await getBudget({name:this.searchContent,page_size:10,page:this.pageIndex})
this.plans = res.data
this.planTotal = res.total
this.plans = res.list.data
this.planTotal = res.list.total
this.toggleSelection(this.paymentRegistrationForm.plan.map(item => {
return item.plan_id

@ -138,7 +138,7 @@
ghost>删除</i-button>
</Poptip>
</template>
<Button class="slot-btns-item" type="primary" size="small" @click="$refs['detailContract'].isShowDetail = true,$refs['detailContract'].getDetail(scope.row.id)">查看</Button>
<Button class="slot-btns-item" type="primary" size="small" @click="$refs['detailContract'].getDetail(scope.row.id),$refs['detailContract'].isShowDetail = true">查看</Button>
<template v-if="scope.row.status != 2">
<Button class="slot-btns-item" type="primary" size="small" @click="$refs['editor'].isShowEditor = true,$refs['editor'].getDetail(scope.row.id)">编辑</Button>
</template>
@ -264,7 +264,7 @@
<template v-slot:btns>
<el-table-column label="使用金额" header-align="center">
<template slot-scope="scope">
<Input :value="scope.row.useMoney" @input="(e)=>scope.row.useMoney = e"/>
<Input :value="scope.row.useMoney" @input="planInput($event,scope.row)"/>
</template>
</el-table-column>
</template>
@ -665,6 +665,18 @@ export default {
}
},
methods: {
//
planInput(e,row){
if(e <= (Number(row.money) - Number(row.use_money_total))){
row.useMoney = e
}else{
Message({
type:'warning',
message:'使用金额大于剩余预算'
})
row.useMoney = 0
}
},
//
summary(param){
const { columns, data } = param
@ -851,8 +863,8 @@ export default {
//
async getBudgets(){
let res = await getBudget({name:this.planSearch,page_size:10,page:this.plansPageIndex})
this.plans = res.data
this.planTotal = res.total
this.plans = res.list.data
this.planTotal = res.list.total
},
//
async getMoneyWay(){

@ -299,8 +299,8 @@ export default {
//
async getBudgets(){
let res = await getBudget({name:this.searchContent,page_size:10,page:this.pageIndex})
this.plans = res.data
this.planTotal = res.total
this.plans = res.list.data
this.planTotal = res.list.total
if(!this.paymentRegistrationForm.is_end) return

Loading…
Cancel
Save