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

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

Loading…
Cancel
Save