|
|
|
|
@ -205,16 +205,15 @@
|
|
|
|
|
<Input style="margin-left: 6px;" search enter-button="搜 索" placeholder="搜索预算计划.." v-model="plansSelect.name" @on-search="getBudgets" />
|
|
|
|
|
</div>
|
|
|
|
|
<div class="contract-add-plan" style="min-width: 300px;">
|
|
|
|
|
<template v-if="paymentRegistrationForm.plan.length > 0">
|
|
|
|
|
<template v-for="item in paymentRegistrationForm.plan">
|
|
|
|
|
<Tag closable color="primary" @on-close="delPlan(item)">{{item.label}}</Tag>
|
|
|
|
|
</template>
|
|
|
|
|
<Tag v-for="item in originalPlan" closable type="border" color="primary" @on-close="delPidPlan(item)">【{{item.year}}】{{item.name}}</Tag>
|
|
|
|
|
<template v-for="item in planSelection">
|
|
|
|
|
<Tag closable color="primary" @on-close="delPlan(item)">【{{item.year}}】{{item.name}}</Tag>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
<xy-table :list="plans" :show-index="false" :table-item="planTable" :height="310" style="margin-top: 10px;"
|
|
|
|
|
ref="planTable" @select="selectPlan">
|
|
|
|
|
ref="planTable" @select="++selectionTag" @select-all="++selectionTag">
|
|
|
|
|
<template v-slot:btns>
|
|
|
|
|
<el-table-column label="使用金额(元)" header-align="center" width="140">
|
|
|
|
|
<el-table-column label="使用金额(元)" header-align="center" width="140" fixed="right">
|
|
|
|
|
<template slot-scope="scope">
|
|
|
|
|
<Input :value="scope.row.use_money" @input="inputMoney($event,scope.row)" />
|
|
|
|
|
</template>
|
|
|
|
|
@ -222,7 +221,7 @@
|
|
|
|
|
</template>
|
|
|
|
|
</xy-table>
|
|
|
|
|
|
|
|
|
|
<div style="display: flex;justify-content: flex-end;">
|
|
|
|
|
<div style="display: flex;justify-content: flex-end;" v-show="originalPlan.length === 0">
|
|
|
|
|
<Page :total="planTotal" show-elevator @on-change="planPageChange" />
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
@ -300,6 +299,8 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
moneyWay: [], //资金列支渠道
|
|
|
|
|
files: []
|
|
|
|
|
},
|
|
|
|
|
selectionTag: 0,
|
|
|
|
|
originalPlan: [],
|
|
|
|
|
paymentRegistrationRules: {
|
|
|
|
|
applyMoney: [{
|
|
|
|
|
required: true,
|
|
|
|
|
@ -344,10 +345,13 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
plan_department_id: "",
|
|
|
|
|
type: ""
|
|
|
|
|
},
|
|
|
|
|
planTable: [{
|
|
|
|
|
planTable: [
|
|
|
|
|
{
|
|
|
|
|
sortable: false,
|
|
|
|
|
width: 44,
|
|
|
|
|
reserveSelection: true,
|
|
|
|
|
type: 'selection',
|
|
|
|
|
fixed: "left"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
label: "年份",
|
|
|
|
|
@ -374,8 +378,9 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
{
|
|
|
|
|
label: "名称",
|
|
|
|
|
prop: 'name',
|
|
|
|
|
width: 280,
|
|
|
|
|
align: 'left'
|
|
|
|
|
width: 220,
|
|
|
|
|
align: 'left',
|
|
|
|
|
fixed: "left"
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
@ -410,12 +415,12 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
delPlan(val) {
|
|
|
|
|
this.paymentRegistrationForm.plan.map((item, index) => {
|
|
|
|
|
if (item.plan_id === val.plan_id) {
|
|
|
|
|
this.paymentRegistrationForm.plan.splice(index, 1)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
delPlan(item) {
|
|
|
|
|
this.$refs["planTable"].toggleRowSelection(item, false)
|
|
|
|
|
},
|
|
|
|
|
delPidPlan (item) {
|
|
|
|
|
let index = this.originalPlan.findIndex(i => i.id === item.id)
|
|
|
|
|
this.originalPlan.splice(index, 1)
|
|
|
|
|
},
|
|
|
|
|
//合计申请金额
|
|
|
|
|
totalApplyMoney() {
|
|
|
|
|
@ -437,7 +442,7 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
});
|
|
|
|
|
this.plansSelect[`type`]=_arr +'';
|
|
|
|
|
}
|
|
|
|
|
if (this.paymentRegistrationForm.plan.length === 0) {
|
|
|
|
|
if (this.originalPlan.length === 0) {
|
|
|
|
|
this.getBudgets()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -448,11 +453,6 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
row.use_money = e
|
|
|
|
|
this.paymentRegistrationForm.plan.forEach(item => {
|
|
|
|
|
if (item.plan_id == row.id) {
|
|
|
|
|
item.use_money = e
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
async getPlanTypes() {
|
|
|
|
|
@ -504,7 +504,8 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
this.payment.forEach(item => {
|
|
|
|
|
total += Number(item.act_money??0)
|
|
|
|
|
})
|
|
|
|
|
return ((((total / Number(this.contract?.money||0)) || 0) * 100)).toFixed(2) || 0
|
|
|
|
|
let per = total / Number(this.contract?.money||0)
|
|
|
|
|
return isFinite(per) ? (per * 100).toFixed(2) : 0;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async getRegistration(id) {
|
|
|
|
|
@ -524,10 +525,8 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
this.paymentRegistrationForm.deductionMoney = res.discount_money
|
|
|
|
|
this.paymentRegistrationForm.applyMoney = res.apply_money
|
|
|
|
|
this.paymentRegistrationForm.remark = res.remark
|
|
|
|
|
for (var m of res.plan_link) {
|
|
|
|
|
m.label = m.plan ? m.plan.name : "无计划名称";
|
|
|
|
|
}
|
|
|
|
|
this.paymentRegistrationForm.plan = res.plan_link
|
|
|
|
|
|
|
|
|
|
this.originalPlan = res.plan_link.filter(i => i.plan).map(i => i.plan)
|
|
|
|
|
|
|
|
|
|
this.paymentRegistrationForm.actMoney = res.apply_money
|
|
|
|
|
this.paymentRegistrationForm.moneyWay = res.money_way_id?.split(',')?.map(item => Number(item))
|
|
|
|
|
@ -535,7 +534,7 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
this.getContract(res.contract)
|
|
|
|
|
this.moneyWayChange(this.paymentRegistrationForm.moneyWay)
|
|
|
|
|
if (res.plan_link.length > 0) {
|
|
|
|
|
await this.getBudgets(1)
|
|
|
|
|
await this.getBudgets()
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -548,23 +547,19 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
contract_id: this.contract.id
|
|
|
|
|
})
|
|
|
|
|
this.payment = res.data
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
this.toggleSelection(this.paymentRegistrationForm.plan.map(item => {
|
|
|
|
|
return item.plan_id
|
|
|
|
|
}))
|
|
|
|
|
add (num1, num2) {
|
|
|
|
|
const num1Digits = (num1.toString().split('.')[1] || '').length;
|
|
|
|
|
const num2Digits = (num2.toString().split('.')[1] || '').length;
|
|
|
|
|
const baseNum = Math.pow(10, Math.max(num1Digits, num2Digits));
|
|
|
|
|
return (num1 * baseNum + num2 * baseNum) / baseNum;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
//确认审核
|
|
|
|
|
editor() {
|
|
|
|
|
console.log({
|
|
|
|
|
id: this.registrationId,
|
|
|
|
|
contract_id: this.contract.id,
|
|
|
|
|
act_money: this.paymentRegistrationForm.actMoney,
|
|
|
|
|
status: 1,
|
|
|
|
|
money_way_id: this.paymentRegistrationForm.moneyWay.toString(),
|
|
|
|
|
contract_plan_act_links: this.paymentRegistrationForm.plan
|
|
|
|
|
})
|
|
|
|
|
let total = this.$refs["planTable"].getSelection().reduce((pre,cur) => pre + Number(cur.use_money),0)
|
|
|
|
|
let total = this.planSelection.reduce((pre,cur) => this.add(pre, Number(cur.use_money)),0)
|
|
|
|
|
console.log(Number(this.paymentRegistrationForm.actMoney),total)
|
|
|
|
|
if (Number(this.paymentRegistrationForm.actMoney) !== total) {
|
|
|
|
|
this.$message({
|
|
|
|
|
type: 'warning',
|
|
|
|
|
@ -581,7 +576,7 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
discount_money: this.paymentRegistrationForm.deductionMoney,
|
|
|
|
|
money_way_id: this.paymentRegistrationForm.moneyWay.toString(),
|
|
|
|
|
audit_date: this.$moment().format('YYYY-MM-DD'),
|
|
|
|
|
contract_plan_act_links: this.$refs["planTable"].getSelection().map(item => ({
|
|
|
|
|
contract_plan_act_links: this.planSelection.map(item => ({
|
|
|
|
|
contract_id: this.contract.id,
|
|
|
|
|
plan_id: item.id,
|
|
|
|
|
use_money: item.use_money,
|
|
|
|
|
@ -604,75 +599,29 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
|
|
|
|
|
//计划
|
|
|
|
|
//获取预算计划
|
|
|
|
|
async getBudgets(is_tree=0) {
|
|
|
|
|
async getBudgets() {
|
|
|
|
|
let res = await getBudget({
|
|
|
|
|
top_pid: is_tree ? 0 : 1,
|
|
|
|
|
top_pid: this.originalPlan.length > 0 ? 0 : 1,
|
|
|
|
|
...this.plansSelect,
|
|
|
|
|
pid: is_tree ? this.paymentRegistrationForm.plan?.map(i => i.plan_id)?.toString() : ""
|
|
|
|
|
pid: this.originalPlan.length > 0 ? this.originalPlan.map(i => i.id)?.toString() : "",
|
|
|
|
|
page: this.originalPlan.length > 0 ? 1 : this.plansSelect.page
|
|
|
|
|
})
|
|
|
|
|
this.plans = res.list.data
|
|
|
|
|
this.planTotal = res.list.total
|
|
|
|
|
|
|
|
|
|
// this.toggleSelection(this.paymentRegistrationForm.plan.map(item => {
|
|
|
|
|
// return item.plan_id
|
|
|
|
|
// }))
|
|
|
|
|
console.log(this.planSelection)
|
|
|
|
|
this.plans.forEach(item => {
|
|
|
|
|
let findSelection = this.planSelection.find(i => i.id === item.id)
|
|
|
|
|
if (findSelection) {
|
|
|
|
|
item.use_money = findSelection.use_money
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
planPageChange(e) {
|
|
|
|
|
this.plansSelect.page = e
|
|
|
|
|
this.getBudgets()
|
|
|
|
|
},
|
|
|
|
|
selectPlan(sel, row) {
|
|
|
|
|
if (sel) {
|
|
|
|
|
let select = sel.map(item => {
|
|
|
|
|
return {
|
|
|
|
|
contract_id: this.contract.id,
|
|
|
|
|
plan_id: item.id,
|
|
|
|
|
use_money: item.use_money,
|
|
|
|
|
new_money: item.money,
|
|
|
|
|
label: item.name
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//说明被删除了
|
|
|
|
|
if (sel.filter(plan => {
|
|
|
|
|
return plan.id == row.id
|
|
|
|
|
}).length == 0) {
|
|
|
|
|
this.delPlan({
|
|
|
|
|
plan_id: row.id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
let _plan = JSON.parse(JSON.stringify(this.paymentRegistrationForm.plan));
|
|
|
|
|
|
|
|
|
|
var _select = [];
|
|
|
|
|
select.map(item => {
|
|
|
|
|
if (_plan.filter(plan => {
|
|
|
|
|
return plan.plan_id == item.plan_id
|
|
|
|
|
}).length == 0) {
|
|
|
|
|
_select.push(item)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.paymentRegistrationForm.plan = [..._plan, ..._select]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
this.paymentRegistrationForm.plan = []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//默认选择计划
|
|
|
|
|
toggleSelection(plans) {
|
|
|
|
|
if (plans) {
|
|
|
|
|
this.plans.filter(plan => {
|
|
|
|
|
if (plans.includes(plan.id)) {
|
|
|
|
|
plan.use_money = this.paymentRegistrationForm.plan[plans.indexOf(plan.id)].use_money
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}).map(row => {
|
|
|
|
|
this.$refs.planTable.toggleRowSelection(row)
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.$refs.planTable.clearSelection()
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
//获取科室
|
|
|
|
|
getDepartment() {
|
|
|
|
|
listdeptNoAuth().then((res) => {
|
|
|
|
|
@ -685,6 +634,10 @@ import { listdeptNoAuth } from '@/api/system/department'
|
|
|
|
|
return function(money) {
|
|
|
|
|
return moneyFormatter(money)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
planSelection () {
|
|
|
|
|
let temp = this.selectionTag
|
|
|
|
|
return this.$refs["planTable"]?.getSelection() || []
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
|