master
xy 2 years ago
parent 9a98385af3
commit c6e928a526

@ -15,7 +15,7 @@ export function getOutDetail({ tbname,out_caigou_id,out_contract_id,out_pay_id,o
}) })
} }
export function httpCurl({ s = "/Api/flowDetail",tbname,out_caigou_id,out_contract_id,out_pay_id,out_zhaobiao_id },noloading = true) { export function httpCurl(params,noloading = true,s= '/Api/flowDetail') {
return request({ return request({
method: 'post', method: 'post',
url: '/api/admin/other/http-curl', url: '/api/admin/other/http-curl',
@ -23,11 +23,7 @@ export function httpCurl({ s = "/Api/flowDetail",tbname,out_caigou_id,out_contra
url: process.env.VUE_APP_OUT_OLD, url: process.env.VUE_APP_OUT_OLD,
params: { params: {
s, s,
tbname, ...params
out_caigou_id,
out_contract_id,
out_pay_id,
out_zhaobiao_id
} }
}, },
noloading noloading

@ -273,6 +273,7 @@ export default {
prop={item.prop} prop={item.prop}
sortable={item.sortable ?? false} sortable={item.sortable ?? false}
type={item.type} type={item.type}
reserve-selection={item.reserveSelection}
selectable={item.selectable} selectable={item.selectable}
scopedSlots={item.type === 'expand' ? { scopedSlots={item.type === 'expand' ? {
default(props) { default(props) {

@ -85,12 +85,12 @@
</div> </div>
</div> </div>
</template> </template>
<template v-slot:contract_plan_links> <template v-slot:oa>
<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 style="color: red; font-weight: 600; padding-right: 4px"
>*</span >*</span
>关联预算计划 >关联审批单
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<div <div
@ -98,15 +98,15 @@
style="width: 300px" style="width: 300px"
@click="showPlan" @click="showPlan"
> >
<template v-if="form.contract_plan_links.length > 0"> <template v-if="form.oa.length > 0">
<template v-for="item in form.contract_plan_links"> <template v-for="item in form.oa">
<Tag closable color="primary" @on-close="delPlan(item)">{{ <Tag closable color="primary" @on-close="delOa(item)">{{
item.label item.title
}}</Tag> }}</Tag>
</template> </template>
</template> </template>
<template v-else> <template v-else>
<div class="contract-add-plan-no-plan">请选择关联计划</div> <div class="contract-add-plan-no-plan">请选择关联审批单</div>
</template> </template>
</div> </div>
</div> </div>
@ -118,57 +118,20 @@
<xy-dialog <xy-dialog
:is-show.sync="isShowPlan" :is-show.sync="isShowPlan"
:width="820" :width="820"
title="预算计划" title="审批单"
@on-ok="planSelect"
> >
<template> <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"
>
</el-option>
</el-select>
<Input
v-model="planSearch.name"
enter-button="搜 索"
placeholder="搜索预算计划.."
search
@on-search="(planSearch.page = 1), getBudgets()"
/>
</div>
<xy-table <xy-table
ref="planTable" ref="planTable"
:height="300" :height="300"
:list="plans" :list="plans"
row-key="id"
:show-index="false" :show-index="false"
:table-item="planTable" :table-item="planTable"
style="margin-top: 10px" style="margin-top: 10px"
@select="selectPlan" @select="selected"
> >
<template v-slot:btns> <template v-slot:btns>
<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)"
/>
</template>
</el-table-column>
</template> </template>
</xy-table> </xy-table>
@ -176,13 +139,13 @@
<Page <Page
:total="planTotal" :total="planTotal"
show-elevator show-elevator
@on-change="(planSearch.page = e), getBudgets()" @on-change="e => {planSearch.p = e; getBudgets()}"
/> />
</div> </div>
</template> </template>
<template v-slot:footerContent> <template v-slot:footerContent>
<Button type="primary" @click="planSelect"></Button> <Button type="primary" @click="isShowPlan = false"></Button>
</template> </template>
</xy-dialog> </xy-dialog>
</div> </div>
@ -195,7 +158,6 @@ import {
editorContract, editorContract,
detailContract as show, detailContract as show,
} from "@/api/contract/contract"; } from "@/api/contract/contract";
import { getBudget } from "@/api/budget/budget";
import { httpCurl } from "@/api/out" import { httpCurl } from "@/api/out"
export default { export default {
props: { props: {
@ -224,85 +186,46 @@ export default {
data() { data() {
return { return {
moneyWay: [], moneyWay: [],
plan: [],
plans: [], plans: [],
planTotal: 0, planTotal: 0,
isShowPlan: false, isShowPlan: false,
planSearch: { planSearch: {
name: "", mod_name: '出差审批',
plan_department_id: "", list_rows: 10,
top_pid: 1, p: 1
page: 1,
page_size: 10,
}, },
planTable: [ planTable: [
{ {
width: 40, width: 46,
sortable: false, sortable: false,
type: "selection", type: "selection",
fixed: "left", fixed: "left",
reserveSelection: true
}, },
{ {
label: "分类", label: '名称',
prop: "type", prop: 'title',
formatter: (cell, data, value) => { minWidth: 160,
let res = this.moneyWay?.find((item) => { fixed: 'left'
return item.id === value;
});
return res?.value || "未知";
}, },
width: 100,
fixed: "left",
},
{ {
label: "科室", label: '部门',
prop: "plan_department.name", prop: 'dept_name',
width: 100, width: 180
align: "center",
}, },
{ {
label: "年份", label: '人员',
prop: "year", prop: 'emp_name',
width: 80, width: 140
align: "center",
}, },
{ {
label: "隶属", label: '创建时间',
prop: "pid_info.name", prop: 'create_time',
width: 180, width: 180,
align: "left", formatter: (cell,data,value)=> {
}, return this.$moment(new Date(Number(value)*1000)).format('YYYY-MM-DD')
{ }
label: "名称", }
prop: "name",
width: 320,
align: "left",
},
{
label: "计划金额",
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",
width: 120,
align: "right",
},
{
label: "已用金额",
prop: "has_money_total",
width: 120,
align: "right",
},
], ],
isShow: false, isShow: false,
@ -315,7 +238,7 @@ export default {
report_type: "", report_type: "",
other_type: "", other_type: "",
money: undefined, money: undefined,
//contract_plan_links: [], oa: [],
}, },
rules: { rules: {
report_type: [ report_type: [
@ -385,25 +308,11 @@ 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) => {
return {
label: item.name,
value: {
plan_id: item.id,
use_money: res.plan_link.filter((item1) => {
return item1.plan_id === item.id;
})[0].use_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
);
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;
@ -437,6 +346,18 @@ export default {
} }
}, },
selected (rows) {
this.form.oa = rows.map(i => {
return {
id: i.id,
title: i.title
}
})
},
delOa (item) {
this.form.oa.splice(this.form.oa.indexOf(this.form.oa.find(i => item.id === i.id)),1)
},
// //
async getMoneyWay() { async getMoneyWay() {
this.moneyWay = ( this.moneyWay = (
@ -451,141 +372,17 @@ export default {
}, },
// //
async getBudgets() { async getBudgets() {
let res = await getBudget(this.planSearch); let res = await httpCurl(this.planSearch, false, '/Api/flowList');
this.plans = res.list.data; this.plans = res.list
this.planTotal = Number(res.total)
this.planTotal = res.list.total;
this.toggleSelection( this.plans.forEach(i => {
this.plan.map((item) => { if (this.form.oa.find(oa => oa.id === i.id)) {
return item.value.plan_id; this.$refs['planTable'].toggleRowSelection(i)
}),
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);
});
} else {
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.plan.forEach((item, index) => {
if (item.value.plan_id === val.value.plan_id) {
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;
}
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;
}
});
return;
}
this.$message({
type: "warning",
message: "使用金额大于剩余预算",
});
row.useMoney = 0;
}, },
//
selectPlan(sel, row) {
console.log(sel);
if (sel) {
let select = sel.map((item) => {
return {
label: item.name,
value: {
plan_id: item.id,
use_money: item.useMoney,
new_money: item.money,
},
};
});
//
if (
!sel.find((plan) => {
return plan.id == row.id;
})
) {
this.delPlan({
value: {
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);
}
});
this.plan = [..._plan, ..._select];
} else {
this.plan = [];
}
},
planSelect() {
if (this.plan.length === 0) {
this.$message({
type: "warning",
message: "选择计划不能为空",
});
return;
}
for (let item of this.plan) {
console.log(item);
if (!item.value.use_money) {
this.$message({
type: "warning",
message: "金额不能为空",
});
return;
}
}
this.form.contract_plan_links = this.plan;
this.isShowPlan = false;
},
}, },
computed: { computed: {
outcomeType() { outcomeType() {
@ -615,6 +412,7 @@ export default {
delete this.form.id; delete this.form.id;
} }
}, },
}, },
created() { created() {
this.getMoneyWay(); this.getMoneyWay();

Loading…
Cancel
Save