master
xy 2 years ago
parent 3df2c50d7d
commit 74280076b4

File diff suppressed because it is too large Load Diff

@ -11,11 +11,13 @@
>
<template v-slot:name>
<div class="xy-table-item">
<div class="xy-table-item-label">
{{typeText}}事项
</div>
<div class="xy-table-item-label">{{ typeText }}事项 </div>
<div class="xy-table-item-content">
<el-input v-model="form.name" style="width: 300px;" :placeholder="'请填写'+typeText+'事项'"></el-input>
<el-input
v-model="form.name"
style="width: 300px"
:placeholder="'请填写' + typeText + '事项'"
></el-input>
</div>
</div>
</template>
@ -71,7 +73,7 @@
</template>
<template v-slot:money>
<div class="xy-table-item">
<div class="xy-table-item-label">{{typeText}}金额 </div>
<div class="xy-table-item-label">{{ typeText }}金额 </div>
<div class="xy-table-item-content">
<el-input-number
v-model="form.money"
@ -86,13 +88,21 @@
<template v-slot:contract_plan_links>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>关联预算计划
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>关联预算计划
</div>
<div class="xy-table-item-content">
<div class="contract-add-plan" style="width: 300px;" @click="showPlan">
<div
class="contract-add-plan"
style="width: 300px"
@click="showPlan"
>
<template v-if="form.contract_plan_links.length > 0">
<template v-for="item in form.contract_plan_links">
<Tag closable color="primary" @on-close="delPlan(item)">{{ item.label }}</Tag>
<Tag closable color="primary" @on-close="delPlan(item)">{{
item.label
}}</Tag>
</template>
</template>
<template v-else>
@ -104,32 +114,70 @@
</template>
</xy-dialog>
<!-- 新增表 预算计划 -->
<xy-dialog :is-show.sync="isShowPlan" :width="820" title="预算计划" @on-ok="planSelect">
<xy-dialog
:is-show.sync="isShowPlan"
:width="820"
title="预算计划"
@on-ok="planSelect"
>
<template>
<div style="display: flex;">
<el-select placeholder="科室选择" clearable size="small" v-model="planSearch.plan_department_id"
style="width: 160px;">
<el-option v-for="item in departments" :label="item.name" :value="item.id" :key="item.id">
<div style="display: flex">
<el-select
placeholder="科室选择"
clearable
size="small"
v-model="planSearch.plan_department_id"
style="width: 160px"
>
<el-option
v-for="item in departments"
:label="item.name"
:value="item.id"
:key="item.id"
>
</el-option>
</el-select>
<Input v-model="planSearch.name" enter-button=" " placeholder="搜索预算计划.." search
@on-search="planSearch.page=1,getBudgets()"/>
<Input
v-model="planSearch.name"
enter-button="搜 索"
placeholder="搜索预算计划.."
search
@on-search="(planSearch.page = 1), getBudgets()"
/>
</div>
<xy-table ref="planTable" :height="300" :list="plans" :show-index="false" :table-item="planTable"
style="margin-top: 10px;" @select="selectPlan">
<xy-table
ref="planTable"
:height="300"
:list="plans"
:show-index="false"
:table-item="planTable"
style="margin-top: 10px"
@select="selectPlan"
>
<template v-slot:btns>
<el-table-column header-align="center" label="使用金额" fixed="right" width="140">
<el-table-column
header-align="center"
label="使用金额"
fixed="right"
width="140"
>
<template slot-scope="scope">
<Input :value="scope.row.useMoney" @input="planInput($event,scope.row)"/>
<Input
:value="scope.row.useMoney"
@input="planInput($event, scope.row)"
/>
</template>
</el-table-column>
</template>
</xy-table>
<div style="display: flex;justify-content: flex-end;">
<Page :total="planTotal" show-elevator @on-change="planSearch.page = e,getBudgets()"/>
<div style="display: flex; justify-content: flex-end">
<Page
:total="planTotal"
show-elevator
@on-change="(planSearch.page = e), getBudgets()"
/>
</div>
</template>
@ -141,22 +189,26 @@
</template>
<script>
import { getparameter } from '@/api/system/dictionary'
import { addContrant,editorContract,detailContract as show } from "@/api/contract/contract";
import { getBudget } from '@/api/budget/budget'
import { getparameter } from "@/api/system/dictionary";
import {
addContrant,
editorContract,
detailContract as show,
} from "@/api/contract/contract";
import { getBudget } from "@/api/budget/budget";
export default {
props: {
report_types: {
type: Array,
default: () => [
{
value: '医药报销支出',
id: 1
value: "医药报销支出",
id: 1,
},
{
value: '出差报销支出',
id: 2
}
value: "出差报销支出",
id: 2,
},
],
},
other_types: {
@ -166,7 +218,7 @@ export default {
departments: {
type: Array,
default: () => [],
}
},
},
data() {
return {
@ -180,78 +232,78 @@ export default {
plan_department_id: "",
top_pid: 1,
page: 1,
page_size: 10
},
planTable: [{
width: 40,
sortable: false,
type: 'selection',
fixed: "left"
page_size: 10,
},
planTable: [
{
width: 40,
sortable: false,
type: "selection",
fixed: "left",
},
{
label: "分类",
prop: 'type',
prop: "type",
formatter: (cell, data, value) => {
let res = this.moneyWay?.find(item => {
return item.id === value
})
return res?.value || '未知'
let res = this.moneyWay?.find((item) => {
return item.id === value;
});
return res?.value || "未知";
},
width: 100,
fixed: "left"
fixed: "left",
},
{
label: "科室",
prop: 'plan_department.name',
prop: "plan_department.name",
width: 100,
align: 'center'
align: "center",
},
{
label: "年份",
prop: 'year',
prop: "year",
width: 80,
align: 'center'
align: "center",
},
{
label: "隶属",
prop: 'pid_info.name',
prop: "pid_info.name",
width: 180,
align: 'left'
align: "left",
},
{
label: "名称",
prop: 'name',
prop: "name",
width: 320,
align: 'left'
align: "left",
},
{
label: "计划金额",
prop: 'money',
align: 'right',
prop: "money",
align: "right",
width: 120,
customFn: (row) => {
let m1 = row.money;
let m2 = row.update_money;
return m2 == 0 ? m1 : m2;
}
},
},
{
label: "实付金额",
prop: 'use_money_total',
prop: "use_money_total",
width: 120,
align: 'right'
align: "right",
},
{
label: '已用金额',
prop: 'has_money_total',
label: "已用金额",
prop: "has_money_total",
width: 120,
align: 'right'
}
align: "right",
},
],
isShow: false,
id: "",
type: "",
@ -332,23 +384,25 @@ export default {
async getDetail() {
const res = await show({ id: this.id });
this.$integrateData(this.form, res);
this.form.contract_plan_links = res.plans?.map(item => {
this.form.contract_plan_links = res.plans?.map((item) => {
return {
label: item.name,
value: {
plan_id: item.id,
use_money: res.plan_link.filter(item1 => {
return item1.plan_id === item.id
use_money: res.plan_link.filter((item1) => {
return item1.plan_id === item.id;
})[0].use_money,
new_money: item.money
}
}
})
new_money: item.money,
},
};
});
},
submit() {
this.form.outcome_type = this.outcomeType
this.form.contract_plan_links = this.form.contract_plan_links.map(i => i?.value)
this.form.outcome_type = this.outcomeType;
this.form.contract_plan_links = this.form.contract_plan_links.map(
(i) => i?.value
);
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
@ -382,158 +436,169 @@ export default {
}
},
//
async getMoneyWay() {
this.moneyWay = (await getparameter({
number: 'money_way'
})).detail
this.moneyWay = (
await getparameter({
number: "money_way",
})
).detail;
},
async showPlan() {
await this.getBudgets()
this.isShowPlan = true
await this.getBudgets();
this.isShowPlan = true;
},
//
async getBudgets() {
let res = await getBudget(this.planSearch)
this.plans = res.list.data
let res = await getBudget(this.planSearch);
this.plans = res.list.data;
this.planTotal = res.list.total;
this.toggleSelection(this.plan.map(item => {
return item.value.plan_id
}), 1)
this.toggleSelection(
this.plan.map((item) => {
return item.value.plan_id;
}),
1
);
},
//
toggleSelection(plans, type) {
if (plans) {
this.plans.filter(plan => {
if (plans.includes(plan.id)) {
plan.useMoney = this.plan[plans.indexOf(plan.id)].value.use_money
return true
}
}).map(row => {
this.$refs.planTable.toggleRowSelection(row)
})
this.plans
.filter((plan) => {
if (plans.includes(plan.id)) {
plan.useMoney = this.plan[plans.indexOf(plan.id)].value.use_money;
return true;
}
})
.map((row) => {
this.$refs.planTable.toggleRowSelection(row);
});
} else {
this.$refs.planTable.clearSelection()
this.$refs.planTable.clearSelection();
}
},
delPlan(val) {
this.form.contract_plan_links.forEach((item, index) => {
if (item.value.plan_id === val.value.plan_id) {
this.form.contract_plan_links.splice(index, 1)
this.form.contract_plan_links.splice(index, 1);
}
})
});
this.plan.forEach((item, index) => {
if (item.value.plan_id === val.value.plan_id) {
this.plan.splice(index, 1)
this.plan.splice(index, 1);
}
})
});
},
//
planInput(e, row) {
if (!/^[0-9]+.?[0-9]*$/.test(e) && e) {
this.$message({
type: 'warning',
message: '金额格式错误'
})
row.useMoney = 0
return
type: "warning",
message: "金额格式错误",
});
row.useMoney = 0;
return;
}
let money = Number(row.update_money) == 0 ? Number(row.money) : Number(row.update_money);
if (e <= (money - Number(row.use_money_total))) {
row.useMoney = e
this.plan.forEach(item => {
let money =
Number(row.update_money) == 0
? Number(row.money)
: Number(row.update_money);
if (e <= money - Number(row.use_money_total)) {
row.useMoney = e;
this.plan.forEach((item) => {
if (item.value.plan_id == row.id) {
item.value.use_money = e
item.value.use_money = e;
}
})
return
});
return;
}
this.$message({
type: 'warning',
message: '使用金额大于剩余预算'
})
row.useMoney = 0
type: "warning",
message: "使用金额大于剩余预算",
});
row.useMoney = 0;
},
//
selectPlan(sel, row) {
console.log(sel)
console.log(sel);
if (sel) {
let select = sel.map(item => {
let select = sel.map((item) => {
return {
label: item.name,
value: {
plan_id: item.id,
use_money: item.useMoney,
new_money: item.money
}
}
})
new_money: item.money,
},
};
});
//
if (!sel.find(plan => {
return plan.id == row.id
})) {
if (
!sel.find((plan) => {
return plan.id == row.id;
})
) {
this.delPlan({
value: {
plan_id: row.id
}
})
plan_id: row.id,
},
});
}
let _plan = JSON.parse(JSON.stringify(this.plan));
var _select = [];
select.map(item => {
if (!_plan.find(plan => {
return plan.value.plan_id == item.value.plan_id
})) {
_select.push(item)
select.map((item) => {
if (
!_plan.find((plan) => {
return plan.value.plan_id == item.value.plan_id;
})
) {
_select.push(item);
}
});
this.plan = [..._plan, ..._select]
this.plan = [..._plan, ..._select];
} else {
this.plan = []
this.plan = [];
}
},
planSelect() {
if (this.plan.length === 0) {
this.$message({
type: 'warning',
message: '选择计划不能为空'
})
return
type: "warning",
message: "选择计划不能为空",
});
return;
}
for (let item of this.plan) {
console.log(item)
console.log(item);
if (!item.value.use_money) {
this.$message({
type: 'warning',
message: '金额不能为空'
})
return
type: "warning",
message: "金额不能为空",
});
return;
}
}
this.form.contract_plan_links = this.plan
this.isShowPlan = false
this.form.contract_plan_links = this.plan;
this.isShowPlan = false;
},
},
computed: {
outcomeType () {
return this.$route.path.split('_')[1]
outcomeType() {
return this.$route.path.split("_")[1];
},
typeText () {
let type = this.$route.path.split('_')[1]
typeText() {
let type = this.$route.path.split("_")[1];
if (type == 2) {
return '报销'
return "报销";
}
if (type == 3) {
return '其他支出'
return "其他支出";
}
}
},
},
watch: {
isShow(val) {
@ -551,8 +616,8 @@ export default {
},
},
created() {
this.getMoneyWay()
}
this.getMoneyWay();
},
};
</script>
@ -577,11 +642,10 @@ export default {
&-no-plan {
height: 30px;
line-height: 30px;
color: #CDD0D5;
color: #cdd0d5;
}
}
.slot-btns {
display: flex;
flex-wrap: wrap;

@ -9,12 +9,16 @@
<div class="base-info-item">
<div class="base-info-item-title">收入类型</div>
<div class="base-info-item-content">{{ detail.type ? detail.type.value : '' }}</div>
<div class="base-info-item-content">
{{ detail.type ? detail.type.value : "" }}
</div>
</div>
<div class="base-info-item">
<div class="base-info-item-title">收入方式</div>
<div class="base-info-item-content">{{ detail.way ? detail.way.value : '' }}</div>
<div class="base-info-item-content">
{{ detail.way ? detail.way.value : "" }}
</div>
</div>
<div class="base-info-item">
@ -35,7 +39,9 @@
<div class="base-info-item">
<div class="base-info-item-title">附件</div>
<div class="base-info-item-content">
<a v-for="item in detail.files" :href="item.url">{{ item.original_name }}</a>
<a v-for="item in detail.files" :href="item.url">{{
item.original_name
}}</a>
</div>
</div>
</div>
@ -44,45 +50,43 @@
</template>
<script>
import { show } from '@/api/income'
import { show } from "@/api/income";
export default {
data() {
return {
id: '',
id: "",
isShow: false,
detail: {}
}
detail: {},
};
},
methods: {
show () {
this.isShow = true
show() {
this.isShow = true;
},
hide () {
this.isShow = false
hide() {
this.isShow = false;
},
setId (id) {
this.id = id
setId(id) {
this.id = id;
},
async getDetail () {
async getDetail() {
const res = await show({
id:this.id
})
this.detail = res
}
},
computed: {
id: this.id,
});
this.detail = res;
},
},
computed: {},
watch: {
isShow (newVal) {
isShow(newVal) {
if (newVal) {
this.getDetail()
this.getDetail();
} else {
this.id = ''
this.id = "";
}
}
}
}
},
},
};
</script>
<style scoped lang="scss">

@ -106,14 +106,16 @@
v-for="item in otherType"
:key="item.id"
:value="item.id"
>{{ item.value }}</Option
>{{ item.value }}</Option
>
</Select>
</span>
</div>
<div>
<span style="padding: 0 6px"> {{ $route.path.split('_')[1] == 2 ? '报销金额' : '其他支出金额' }} </span>
<span style="padding: 0 6px">
{{ $route.path.split("_")[1] == 2 ? "报销金额" : "其他支出金额" }}
</span>
<span>
<InputNumber
style="width: 110px"
@ -234,8 +236,8 @@ export default {
page_size: 10,
start_created_at: "",
end_created_at: "",
start_plan_price: '',
end_plan_price: '',
start_plan_price: "",
end_plan_price: "",
department_id: "",
report_type: "",
other_type: "",

@ -263,8 +263,8 @@ export default {
page_size: 10,
type_id: '',
way_id: '',
start_money: '',
end_money: ''
start_money: undefined,
end_money: undefined
},
types: [],
departments: [],

Loading…
Cancel
Save