完成关联预算计划

master
lynn 1 year ago
parent dafbd181ff
commit fbddbf82cd

@ -51,6 +51,15 @@ export function getContractCategoryTemplate(params) {
}) })
} }
// 获取合同分类模版配置参数
export function getContractCategoryTemplateConfigParams(params) {
return request({
method: 'get',
url: '/api/admin/contract-category/config',
params
})
}
// 删除合同分类模版 // 删除合同分类模版
export function deleteContractCategoryTemplate(id) { export function deleteContractCategoryTemplate(id) {
return request({ return request({

@ -231,11 +231,10 @@
<div class="checkbox-group"> <div class="checkbox-group">
<el-checkbox v-model="form.projectName"></el-checkbox> <el-checkbox v-model="form.projectName"></el-checkbox>
<el-checkbox v-model="form.projectType"></el-checkbox> <el-checkbox v-model="form.projectType"></el-checkbox>
<el-checkbox v-model="form.purchaseWay"></el-checkbox> <el-checkbox v-model="form.budgetPrice"></el-checkbox>
</div> </div>
<div class="checkbox-group"> <div class="checkbox-group">
<el-checkbox v-model="form.budgetPrice"></el-checkbox>
<el-checkbox v-model="form.fundChannel"></el-checkbox> <el-checkbox v-model="form.fundChannel"></el-checkbox>
<el-checkbox v-model="form.budgetPlan"></el-checkbox> <el-checkbox v-model="form.budgetPlan"></el-checkbox>
</div> </div>

@ -268,6 +268,8 @@
</div> </div>
</div> </div>
<!-- Step Content -->
<div class="step-content">
<!-- Step 1: Type Selection --> <!-- Step 1: Type Selection -->
<div v-show="currentStep === 1" class="step-content"> <div v-show="currentStep === 1" class="step-content">
<div class="form-group"> <div class="form-group">
@ -402,7 +404,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="关联预算计划" prop="plan" v-show="showFields.budgetPlan"> <el-form-item label="关联预算计划" prop="plan" v-show="showFields.budgetPlan" :rules="[{ required: true, message: '请选择关联预算计划', trigger: 'change' }]">
<div class="plan-selector"> <div class="plan-selector">
<el-input <el-input
v-model="form.plan_display" v-model="form.plan_display"
@ -417,7 +419,7 @@
:key="item.id" :key="item.id"
closable closable
@close="removePlan(item)"> @close="removePlan(item)">
{{ item.name }} {{ item.label }}
</el-tag> </el-tag>
</div> </div>
</div> </div>
@ -428,56 +430,27 @@
<!-- Step 3: Attachment Information --> <!-- Step 3: Attachment Information -->
<div v-show="currentStep === 3" class="step-content"> <div v-show="currentStep === 3" class="step-content">
<div class="form-group"> <!-- 事前支付表格 -->
<label class="form-label">部门</label> <div v-if="form.before_contract_template" class="form-section">
<Input v-model="form.department" placeholder="请输入部门" class="form-input" /> <div class="section-title">事前支付表格</div>
<div v-html="form.before_contract_template.template"></div>
</div> </div>
<div class="form-group"> <!-- 事后支付表格 -->
<label class="form-label">员工姓名</label> <div v-else-if="form.contract_template" class="form-section">
<Input v-model="form.employee_name" placeholder="请输入员工姓名" class="form-input" /> <div class="section-title">事后支付表格</div>
<div v-html="form.contract_template.template"></div>
</div> </div>
<div class="form-group">
<label class="form-label">就业状态</label>
<Input v-model="form.employment_status" placeholder="请输入就业状态" class="form-input" />
</div>
<div class="form-group">
<label class="form-label">家属姓名</label>
<Input v-model="form.family_name" placeholder="请输入家属姓名" class="form-input" />
</div>
<div class="form-group">
<label class="form-label">关系</label>
<Input v-model="form.relationship" placeholder="请输入关系" class="form-input" />
</div>
<div class="form-group">
<label class="form-label">费用明细</label>
<table class="expense-table">
<thead>
<tr>
<th>内容</th>
<th>金额</th>
<th>比例</th>
<th>收款人</th>
</tr>
</thead>
<tbody>
<tr v-for="(item, index) in form.expenses" :key="index">
<td><Input v-model="item.content" /></td>
<td><Input v-model="item.amount" type="number" /></td>
<td><Input v-model="item.ratio" /></td>
<td><Input v-model="item.payee" /></td>
</tr>
</tbody>
</table>
</div> </div>
</div> </div>
<!-- Navigation Buttons --> <div slot="footer">
<div class="step-actions"> <div class="modal-footer">
<Button v-if="currentStep > 1" @click="prevStep" class="action-button"></Button> <Button v-if="currentStep > 1" @click="prevStep" class="action-button"></Button>
<Button v-if="currentStep < 3" type="primary" @click="nextStep" class="action-button"></Button> <Button v-if="currentStep < 3" type="primary" @click="nextStep" class="action-button"></Button>
<Button v-if="currentStep === 3" type="primary" @click="submit" class="action-button"></Button> <Button v-if="currentStep === 3" type="primary" @click="submit" class="action-button"></Button>
<Button @click="cancel" class="action-button">取消</Button> <Button @click="cancel" class="action-button">取消</Button>
</div> </div>
</div>
</Modal> </Modal>
<!-- 搜索使用 预算计划 --> <!-- 搜索使用 预算计划 -->
@ -485,28 +458,61 @@
<template v-slot:normalContent> <template v-slot:normalContent>
<Input v-model="planSearch.name" search enter-button=" " placeholder="搜索预算计划.." <Input v-model="planSearch.name" search enter-button=" " placeholder="搜索预算计划.."
@on-search="searchBudgets"/> @on-search="searchBudgets"/>
<div style="margin: 10px 0;display: flex;justify-content: space-between; <div style="margin: 10px 0;display: flex;justify-content: space-between;align-items: center;">
align-items: center;">
<div v-if="planSource === 'search'">已选择:<span style="margin-right:10px">{{ select.plan_name }}</span></div> <div v-if="planSource === 'search'">已选择:<span style="margin-right:10px">{{ select.plan_name }}</span></div>
<div v-if="planSource === 'modal'">已选择:<span style="margin-right:10px">{{ form.plan_display }}</span></div> <div v-if="planSource === 'modal'">已选择:<span style="margin-right:10px">{{ form.plan_display }}</span></div>
<el-link type="success" @click="clearSelectForSearch"></el-link> <el-link type="success" @click="clearSelectForSearch"></el-link>
</div> </div>
<xy-table :list="plans" @rowClick="selectPlanForSearch" :show-index="false" :table-item="planTableSearch" <xy-table :list="plans" @rowClick="selectPlanForSearch" :show-index="false" :table-item="planTableSearch"
:height="310" style="margin-top: 10px;" ref="singlePlanTable"> :height="310" style="margin-top: 10px;" ref="singlePlanTable">
<template v-slot:btns> <template v-slot:btns>
<el-table-column label="使用金额" header-align="center" v-if="planSource === 'modal'">
<template slot-scope="scope">
<Input :value="scope.row.useMoney" @input="planInput($event, scope.row)" />
</template>
</el-table-column>
</template> </template>
</xy-table> </xy-table>
<div style="display: flex;justify-content: flex-end;"> <div style="display: flex;justify-content: flex-end;">
<Page :total="planTotal" show-elevator @on-change="planPageChange"/> <Page :total="planTotal" show-elevator @on-change="planPageChange"/>
</div> </div>
<el-tag type="warning">点击行进行选择</el-tag> <el-tag type="warning">点击行进行选择</el-tag>
</template> </template>
<template v-slot:footerContent>
<Button type="primary" @click="planSelectForSearch"></Button>
</template>
</xy-dialog>
<!-- 新增表 预算计划 -->
<xy-dialog :is-show.sync="isShowPlan" :width="720" title="预算计划" @on-ok="planSelect">
<template v-slot:normalContent>
<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="searchBudgets"/>
</div>
<xy-table ref="planTable" :height="300" :list="plans" :show-index="false" :table-item="planTable"
style="margin-top: 10px;" @select="selectPlan">
<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>
<div style="display: flex;justify-content: flex-end;">
<Page :total="planTotal" show-elevator @on-change="planPageChange"/>
</div>
</template>
<template v-slot:footerContent> <template v-slot:footerContent>
<Button type="primary" @click="confirmPlanForSearch"></Button> <Button type="primary" @click="isShowPlan = false"></Button>
</template> </template>
</xy-dialog> </xy-dialog>
@ -1204,6 +1210,7 @@ export default {
{ label: '工程合同', value: 'project' }, { label: '工程合同', value: 'project' },
{ label: '服务合同', value: 'service' } { label: '服务合同', value: 'service' }
], ],
plan: [], //
} }
}, },
methods: { methods: {
@ -1234,10 +1241,7 @@ export default {
row.useMoney = 0 row.useMoney = 0
return return
} }
let money = Number(row.update_money) == 0 ? Number(row.money) : Number(row.update_money); if (e <= (Number(row.money) - Number(row.use_money_total))) {
console.log(e, money, row.use_money_total)
console.log(e <= (money - Number(row.use_money_total)))
if (e <= (money - Number(row.use_money_total))) {
row.useMoney = e row.useMoney = e
this.plan.forEach(item => { this.plan.forEach(item => {
if (item.value.plan_id == row.id) { if (item.value.plan_id == row.id) {
@ -1620,31 +1624,67 @@ export default {
this.isShowPlan = true this.isShowPlan = true
await this.getBudgets() await this.getBudgets()
}, },
async showPlanForSearch(search='search') { showPlanForSearch(source) {
console.log("sdfsdfsdfsdfsfsfsd:"+search) this.planSource = source
this.planSource = search this.isShowPlan = true
this.isShowPlanForSearch = true this.getBudgets()
await this.getBudgets(); // plan
if (source === 'modal') {
this.plan = this.form.plan || []
} else {
this.plan = []
}
}, },
// selectPlanForSearch(sel, row) {
selectPlanForSearch(sel) { if (this.planSource === 'modal') {
console.log(sel)
if (this.planSource === 'search') {
if (sel) { if (sel) {
this.select.plan_id = sel.id; let select = sel.map(item => {
this.select.plan_name = sel.name; let plan = this.plans.find(p => p.id === item.id)
} else { return {
this.select.plan_id = ""; label: plan.name,
this.select.plan_name = ""; value: {
plan_id: plan.id,
use_money: plan.useMoney || 0,
new_money: plan.money
}
} }
})
this.plan = [...this.form.plan, ...select]
//
this.form.plan_display = this.plan.map(item => item.label).join(', ')
} else { } else {
if (sel) { this.plan = this.form.plan
this.form.plan_display = sel.name; //
this.form.plan_display = this.plan.map(item => item.label).join(', ')
}
} else { } else {
this.form.plan_display = ""; this.select.plan_name = row.name
this.select.plan_id = row.id
}
},
planSelectForSearch() {
if (this.plan.length === 0) {
Message({
type: 'warning',
message: '选择计划不能为空'
})
return
} }
for (let item of this.plan) {
if (!item.value.use_money) {
Message({
type: 'warning',
message: '金额不能为空'
})
return
} }
}
//
this.form.plan = this.plan
//
this.form.plan_display = this.plan.map(item => item.label).join(', ')
//
this.isShowPlan = false
}, },
// //
selectPlan(sel, row) { selectPlan(sel, row) {
@ -1660,87 +1700,49 @@ export default {
} }
} }
}) })
this.plan = [...this.form.plan, ...select]
//
if (sel.filter(plan => {
return plan.id == row.id
}).length == 0) {
this.delPlan({
value: {
plan_id: row.id
}
})
}
let _plan = JSON.parse(JSON.stringify(this.plan));
var _select = [];
select.map(item => {
if (_plan.filter(plan => {
return plan.value.plan_id == item.value.plan_id
}).length == 0) {
_select.push(item)
}
});
this.plan = [..._plan, ..._select]
} else { } else {
this.plan = [] this.plan = this.form.plan
} }
}, },
// //
planSelect() { planSelect() {
const selectedRows = this.$refs.planTable.getSelection() if (this.plan.length === 0) {
if (!selectedRows || selectedRows.length === 0) { Message({
this.$Message.warning('请选择至少一个预算计划') type: 'warning',
message: '选择计划不能为空'
})
return return
} }
for (let item of this.plan) {
// if (!item.value.use_money) {
this.form.plan = selectedRows.map(item => ({ Message({
id: item.id, type: 'warning',
name: item.name, message: '金额不能为空'
money: item.money, })
useMoney: item.useMoney || 0 return
})) }
}
// //
this.updatePlanDisplay() this.form.plan = this.plan
//
// this.form.plan_display = this.plan.map(item => item.label).join(', ')
//
this.isShowPlan = false this.isShowPlan = false
}, },
delPlan(val) { delPlan(val) {
this.form.plan.map((item, index) => { this.form.plan = this.form.plan.filter(item => item.value.plan_id !== val.value.plan_id)
if (item.value.plan_id === val.value.plan_id) {
this.form.plan.splice(index, 1)
}
})
this.plan.map((item, index) => {
if (item.value.plan_id === val.value.plan_id) {
this.plan.splice(index, 1)
}
})
},
//
planSelectForSearch() {
// if (this.select.plan_id == "") {
// Message({
// type: 'warning',
// message: ''
// })
// return
// }
this.isShowPlanForSearch = false
}, },
// //
toggleSelection(plans, type) { toggleSelection(plans) {
if (plans) { if (plans) {
this.plans.filter(plan => { this.plans.filter(plan => {
if (plans.includes(plan.id)) { if (plans.includes(plan.id)) {
plan.useMoney = this.plan[plans.indexOf(plan.id)].value.use_money let selectedPlan = this.plan.find(item => item.value.plan_id === plan.id)
if (selectedPlan) {
plan.useMoney = selectedPlan.value.use_money
}
return true return true
} }
}).map(row => { }).map(row => {
@ -1888,7 +1890,22 @@ export default {
}, },
nextStep() { nextStep() {
if (this.validateCurrentStep()) { //
if (this.currentStep === 2) {
this.$refs.basicInfoForm.validate((valid) => {
if (valid) {
//
if (this.showFields.budgetPlan && (!this.form.plan || this.form.plan.length === 0)) {
Message({
type: 'warning',
message: '请选择关联预算计划'
})
return
}
this.currentStep++
}
})
} else {
this.currentStep++ this.currentStep++
} }
}, },
@ -1961,6 +1978,14 @@ export default {
fundChannel: config.fund_channel === 1, // fundChannel: config.fund_channel === 1, //
budgetPlan: config.budget_plan === 1 // budgetPlan: config.budget_plan === 1 //
}) })
//
if (config.before_contract_template) {
this.form.before_contract_template = config.before_contract_template
}
if (config.contract_template) {
this.form.contract_template = config.contract_template
}
}, },
handleAddContract() { handleAddContract() {
@ -1972,26 +1997,16 @@ export default {
}, },
handleAddContractOk() { handleAddContractOk() {
if (this.currentStep < 2) { // nextStep submit
//
if (this.validateCurrentStep()) {
this.currentStep++;
}
} else {
//
if (this.validateCurrentStep()) {
this.submit()
}
}
}, },
handleAddContractCancel() { handleAddContractCancel() {
this.resetForm() // cancel
this.isShowAdd = false
}, },
cancel() { cancel() {
this.handleAddContractCancel() this.isShowAdd = false
this.resetForm()
}, },
resetForm() { resetForm() {
@ -2183,18 +2198,13 @@ export default {
} }
}, },
// //
removePlan(plan) { removePlan(item) {
const index = this.form.plan.findIndex(item => item.id === plan.id) // plan
if (index !== -1) { this.plan = this.plan.filter(p => p.value.plan_id !== item.value.plan_id)
this.form.plan.splice(index, 1) // form.plan
this.form.plan = this.form.plan.filter(p => p.value.plan_id !== item.value.plan_id)
// //
if (this.form.plan && this.form.plan.length > 0) { this.form.plan_display = this.plan.map(p => p.label).join(', ')
this.form.plan_display = `已选择 ${this.form.plan.length} 个预算计划`
} else {
this.form.plan_display = ''
}
}
}, },
}, },
mounted() { mounted() {
@ -2581,4 +2591,15 @@ export default {
height: 400px; height: 400px;
overflow-y: auto; overflow-y: auto;
} }
.modal-footer {
display: flex;
justify-content: flex-end;
gap: 12px;
padding: 10px 0;
.action-button {
min-width: 100px;
}
}
</style> </style>

Loading…
Cancel
Save