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({
method: 'post',
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,
params: {
s,
tbname,
out_caigou_id,
out_contract_id,
out_pay_id,
out_zhaobiao_id
...params
}
},
noloading

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

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

Loading…
Cancel
Save