master
lion 4 months ago
parent fa4959acc2
commit b056f0885f

@ -11,6 +11,7 @@
<el-button size="small" type="primary" @click="select.page=1,getOaLink()"></el-button>
</div>
<div class="xytable">
<xy-table
:header-cell-class-name="cellClassName"
ref="oaTable" :list="oaList" row-key="id" :table-item="table" :height="300"
@ -91,13 +92,14 @@
custom_model_id: this.row.flow_mod_id,
page: this.select.page,
page_size: this.select.page_size,
keyword: this.select.keyword
keyword: this.select.keyword,
type:0
})
this.oaList = res.flows.data
this.total = res.flows.total
if (!this.oaList.length && this.select.page == 1) {
this.saveNewOa(this.row)
}
// if (!this.oaList.length && this.select.page == 1) {
// this.saveNewOa(this.row)
// }
},
pageChange(e) {
this.select.page = e
@ -107,21 +109,43 @@
this.$emit('createOa', row,this.flow)
this.isShowOaLinkModal = false
},
joinIds(id, outContractId) {
// 1. id
const idStr = String(id);
// 2. out_contract_id
let outStr = '';
if (outContractId !== null && outContractId !== undefined && outContractId !== '') {
outStr = String(outContractId); // out_contract_id
}
// 3.
const parts = [];
if (idStr) parts.push(idStr); // id
if (outStr) parts.push(outStr); // out_contract_id
// 4.
return parts.join(',');
},
confirmOa() {
console.log("this.$refs['oaTable'].getSelection()", this.$refs['oaTable'].getSelection());
let flowsList = this.$refs['oaTable'].getSelection();
if(flowsList.length==0){
this.$message.warning('请选择一条流程关联')
this.$message.warning('请至少选择一条流程关联')
return
}
if(flowsList.length>1){
this.$message.warning('只能选择一条流程关联')
return
}
let foreign_ids = this.joinIds(this.row.id,flowsList[0].out_contract_id)
console.log("flowsList",foreign_ids)
// return
oaSave({
foreign_field:'out_contract_id',
foreign_id:this.row.id,
foreign_id:foreign_ids,
flow_id:flowsList[0].id
}).then(res=>{
this.$message.success('关联成功')
@ -148,6 +172,8 @@
this.$refs.oaTable.clearSelection();
this.$refs.oaTable.toggleRowSelection(selectedRows[selectedRows.length - 1]);
}
// this.$refs.oaTable.clearSelection();
// this.$refs.oaTable.toggleRowSelection(selectedRows);
}
}
}

@ -72,6 +72,10 @@
</Poptip>
</div>
</div>
</div>
<!-- 预算计划 -->
<div>
</div>
<!-- 是否有借款 -->
<div v-if="contract.borrows && contract.borrows.length>0">
@ -90,7 +94,7 @@
</div>
</div>
</div>
<!-- 是否关联 -->
<!-- 是否-->
</template>
@ -203,10 +207,10 @@
</div>
</div>
</template>
<template v-slot:extraFormBottom v-if="paymentRegistrationForm.plan.length===0">
<template v-slot:extraFormBottom>
<div v-if="paymentRegistrationForm.plan.length===0">
<div class="select-container">
<DatePicker
:value="planSelect.year"
placeholder="选择所属年份"
placement="bottom-start"
@ -262,18 +266,16 @@
<xy-table
:header-cell-class-name="cellClassName"
:list="plans"
:show-index="false"
:table-item="planTable"
:height="300"
style="margin-top: 10px"
ref="editorPlanTable"
row-key="id"
border
default-expand-all
@select="planPick"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
key="planTable"
:tree-props="{ children: 'notchildren', hasChildren: 'hasChildren' }"
>
<template v-slot:btns>
<el-table-column
@ -298,21 +300,26 @@
</el-table-column>
</template>
</xy-table>
<!-- <Input search enter-button=" " placeholder="搜索预算计划.." v-model="searchContent" @on-search="getBudgets" />
<xy-table :list="plans" :show-index="false" :table-item="planTable" :height="310" style="margin-top: 10px"
ref="planTable" @select="selectPlan">
<template v-slot:btns>
<el-table-column label="使用金额(元)" header-align="center">
<div style="display: flex; justify-content: flex-end">
<Page :total="planTotal" show-elevator @on-change="pageChange" />
</div>
</div>
<div v-else>
<xy-table :list="showPlanList" key="showPlanTable" :show-index="false" :table-item="showPlanTable" :height="200" style="margin-top: 10px"
ref="editorPlanTable1">
<template v-slot:type>
<el-table-column label="分类" width="120" header-align="center">
<template slot-scope="scope">
<Input :value="scope.row.useMoney" @input="(e) => (scope.row.useMoney = e)" />
{{findVal(planTypes,scope.row.type)}}
</template>
</el-table-column>
</template>
<template v-slot:btns>
<div></div>
</template>
</xy-table>
</div>
<div style="display: flex; justify-content: flex-end">
<Page :total="planTotal" show-elevator @on-change="pageChange" />
</div> -->
</template>
</xy-dialog>
</div>
@ -367,10 +374,11 @@
name: "",
page_size: 20,
page: 1,
is_tree: 1,
// is_tree: 1,
year: new Date().getFullYear().toString(),
plan_department_id: "",
type: ""
type: "",
top_pid: 1,
},
plans: [],
planTypes: [],
@ -442,7 +450,8 @@
}, ],
},
departments:[],
planTable: [{
planTable: [
{
sortable: false,
width: 44,
type: "selection",
@ -506,11 +515,82 @@
align: "right",
formatter: (v1, v2, value) =>
value ? `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : "",
}],
showPlanList:[],
showPlanTable: [
{
label: "科室",
prop: "plan_department_id",
width: 120,
align: "center",
formatter: (row, column, value) => {
return this.departments.find(i => i.id === row.plan_department_id)?.name
}
],
},
{
label: "年份",
prop: "year",
width: 80,
align: "center",
},
{
label: "分类",
prop: "type",
width: 120,
},
{
label: "名称",
prop: "name",
minWidth: 180,
align: "left",
},
{
label: "内容",
prop: "content",
minWidth: 240,
align: "left",
showOverflowTooltip: true
},
{
label: "计划金额",
prop: "money",
align: "right",
width: 120,
formatter: (v1, v2, value) => {
return `${(value && parseFloat(value) !== 0) ? value : v1.update_money }`.replace(/\B(?=(\d{3})+(?!\d))/g, ",")
}
},
{
label: "使用金额",
prop: "use_money",
width: 120,
align: "right",
formatter: (v1, v2, value) =>
value ? `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : "",
}]
};
},
methods: {
findVal(arr, id) {
for (let i = 0; i < arr.length; i++) {
// 1. name
if (arr[i].id == id) {
console.log("arr[i].name", arr[i].name);
return arr[i].name;
}
// 2. children
else if (arr[i].children instanceof Array) {
//
const childResult = this.findVal(arr[i].children, id);
//
if (childResult) {
return childResult;
}
}
}
// 3. null
return null;
},
//
successHandle(response, file, fileList) {
this.fileList = fileList;
@ -594,6 +674,22 @@
},
//
mergePlanData(plans, planLink) {
// plans plan_id use_money
const planMap = new Map(
plans.map(plan => [plan.plan_id, plan.use_money])
);
// planLink use_money
return planLink.map(item => {
// plan_id use_money null
const useMoney = planMap.get(item.id) || null;
return {
...item,
use_money: useMoney
};
});
},
async getContract(info) {
this.contract = await detailContract({
@ -601,7 +697,11 @@
});
this.paymentRegistrationForm.plan = this.contract.plan_link
console.log("this.paymentRegistrationForm.plan",this.contract.plan_link)
if(this.contract.plan_link,length>0){
this.showPlanList = this.mergePlanData(this.contract.plan_link,this.contract.plans)
}
console.log("this.paymentRegistrationForm.plan",this.contract.plan_link,this.showPlanList)
if(this.contract.plan_link.legnth===0){
Message({
type: 'warning',
@ -735,13 +835,13 @@
},
async getBudgets(refresh) {
let res = await getBudget(this.planSelect);
this.initInputMoney(res.list)
this.plans = res.list;
this.initInputMoney(res.list.data)
this.plans = res.list.data;
if(refresh){
this.$refs.editorPlanTable.clearSelection()
}
// this.planTotal = res.list.total;
this.planTotal = res.list.total;
// this.toggleSelection(this.paymentRegistrationForm.plan.map(item => {
// return item.plan_id

Loading…
Cancel
Save