master
xy 3 years ago
parent 3df2c50d7d
commit 74280076b4

File diff suppressed because it is too large Load Diff

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

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

@ -113,7 +113,9 @@
</div> </div>
<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> <span>
<InputNumber <InputNumber
style="width: 110px" style="width: 110px"
@ -234,8 +236,8 @@ export default {
page_size: 10, page_size: 10,
start_created_at: "", start_created_at: "",
end_created_at: "", end_created_at: "",
start_plan_price: '', start_plan_price: "",
end_plan_price: '', end_plan_price: "",
department_id: "", department_id: "",
report_type: "", report_type: "",
other_type: "", other_type: "",

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

Loading…
Cancel
Save