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,116 +207,119 @@
</div> </div>
</div> </div>
</template> </template>
<template v-slot:extraFormBottom v-if="paymentRegistrationForm.plan.length===0"> <template v-slot:extraFormBottom>
<div class="select-container"> <div v-if="paymentRegistrationForm.plan.length===0">
<DatePicker <div class="select-container">
<DatePicker
:value="planSelect.year" :value="planSelect.year"
placeholder="选择所属年份" placeholder="选择所属年份"
placement="bottom-start" placement="bottom-start"
style="width: 180px;margin-right: 10px;" style="width: 180px;margin-right: 10px;"
type="year" type="year"
@on-change="(e) => { @on-change="(e) => {
planSelect.year = e planSelect.year = e
getBudgets(true) getBudgets(true)
}" }"
></DatePicker> ></DatePicker>
<el-select <el-select
placeholder="科室选择" placeholder="科室选择"
clearable clearable
size="small" size="small"
v-model="planSelect.plan_department_id" v-model="planSelect.plan_department_id"
style="width: 180px;margin-right: 10px;" style="width: 180px;margin-right: 10px;"
@change="getBudgets(true)" @change="getBudgets(true)"
>
<el-option
v-for="item in departments"
:label="item.name"
:value="item.id"
:key="item.id"
> >
</el-option> <el-option
</el-select> v-for="item in departments"
<el-cascader :label="item.name"
placeholder="资金类型选择" :value="item.id"
:options="planTypes" :key="item.id"
:props="{ >
checkStrictly: false, </el-option>
label: 'name', </el-select>
value: 'id', <el-cascader
placeholder="资金类型选择"
:options="planTypes"
:props="{
checkStrictly: false,
label: 'name',
value: 'id',
}"
:value="planSelect.type"
clearable
size="small"
style="width: 220px;margin-right: 10px;"
@change="(e) => {
planSelect.type = e[e.length - 1] || '';
getBudgets(true);
}" }"
:value="planSelect.type" />
clearable <Input
size="small" v-model="planSelect.name"
style="width: 220px;margin-right: 10px;" search
@change="(e) => { enter-button="搜 索"
planSelect.type = e[e.length - 1] || ''; clearable
getBudgets(true); placeholder="搜索预算计划.."
}" @on-search="getBudgets(true)"
/> />
<Input </div>
v-model="planSelect.name"
search <xy-table
enter-button="搜 索" :header-cell-class-name="cellClassName"
clearable :list="plans"
placeholder="搜索预算计划.." :show-index="false"
@on-search="getBudgets(true)" :table-item="planTable"
/> :height="300"
</div> style="margin-top: 10px"
ref="editorPlanTable"
border
@select="planPick"
key="planTable"
:tree-props="{ children: 'notchildren', hasChildren: 'hasChildren' }"
>
<template v-slot:btns>
<el-table-column
label="使用金额(元)"
:fixed="$store.getters.device === 'mobile'?false:'right'"
header-align="center"
width="144"
>
<template slot-scope="scope" v-if="scope.row.pid > 0">
<InputNumber
style="width: 120px"
:min="0"
:precision="2"
:active-change="false"
v-model="scope.row._inputMoney"
:formatter="
(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
"
:parser="(value) => value.replace(/\$\s?|(,*)/g, '')"
></InputNumber>
</template>
</el-table-column>
</template>
</xy-table>
<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">
{{findVal(planTypes,scope.row.type)}}
</template>
</el-table-column>
</template>
<template v-slot:btns>
<div></div>
</template>
</xy-table>
</div>
<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' }"
>
<template v-slot:btns>
<el-table-column
label="使用金额(元)"
:fixed="$store.getters.device === 'mobile'?false:'right'"
header-align="center"
width="144"
>
<template slot-scope="scope" v-if="scope.row.pid > 0">
<InputNumber
style="width: 120px"
:min="0"
:precision="2"
:active-change="false"
v-model="scope.row._inputMoney"
:formatter="
(value) => `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')
"
:parser="(value) => value.replace(/\$\s?|(,*)/g, '')"
></InputNumber>
</template>
</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">
<template slot-scope="scope">
<Input :value="scope.row.useMoney" @input="(e) => (scope.row.useMoney = e)" />
</template>
</el-table-column>
</template>
</xy-table>
<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;
@ -536,24 +616,24 @@
// this.planTypes = res.detail; // this.planTypes = res.detail;
// }, // },
async getPlanTypes() { async getPlanTypes() {
const res = await getparameterTree({ const res = await getparameterTree({
id: 3 id: 3
}); });
const dataHandler = (data) => { const dataHandler = (data) => {
data.forEach(i => { data.forEach(i => {
if (i.hasOwnProperty('detail')) { if (i.hasOwnProperty('detail')) {
i.children = i.detail.map(j => { i.children = i.detail.map(j => {
j.name = j.value j.name = j.value
return j; return j;
})
} else {
dataHandler(i['children'])
}
}) })
return data; } else {
dataHandler(i['children'])
} }
this.planTypes = dataHandler(res?.children) || [] })
}, return data;
}
this.planTypes = dataHandler(res?.children) || []
},
// //
pageChange(e) { pageChange(e) {
@ -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