From a19bf6f73b5525de094b962ac051aabc6268419f Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Wed, 30 Apr 2025 17:31:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=80=9F=E8=BF=98=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/borrow/borrow.js | 94 ++ src/components/XyTable/index.vue | 4 +- .../contract/components/borrowContract.vue | 403 ++--- src/views/contract/components/borrowList.vue | 274 ++++ src/views/contract/components/borrowPay.vue | 244 +++ .../components/paymentRegistration.vue | 1371 ++++++++--------- src/views/contract/contractList.vue | 38 +- .../contract/paymentRegistrationList.vue | 59 +- .../components/examineRegistration.vue | 105 +- src/views/finance/paymentRegistrationList.vue | 2 +- 10 files changed, 1580 insertions(+), 1014 deletions(-) create mode 100644 src/api/borrow/borrow.js create mode 100644 src/views/contract/components/borrowList.vue create mode 100644 src/views/contract/components/borrowPay.vue diff --git a/src/api/borrow/borrow.js b/src/api/borrow/borrow.js new file mode 100644 index 0000000..51188c9 --- /dev/null +++ b/src/api/borrow/borrow.js @@ -0,0 +1,94 @@ +import request from "@/utils/request"; +function customParamsSerializer(params) { + let result = ''; + for (let key in params) { + if (params.hasOwnProperty(key)) { + if (Array.isArray(params[key])) { + params[key].forEach((item,index) => { + if (item instanceof Array) { + item.forEach((item1, index1) => { + result += `${key}[${index}][${index1}]=${item1}&` + }) + } else if (typeof item === 'object') { + for (let key1 in item) { + result += `${key}[${index}][${key1}]=${item[key1]}&` + } + } + // result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`; + }); + } else { + result += `${key}=${params[key]}&`; + } + } + } + return result.slice(0, -1); +} +// 借款 +export function getBorrow(params,noloading = false){ + return request({ + method:'get', + url:'/api/ht/borrow/index', + params, + noloading, + paramsSerializer: customParamsSerializer + }) +} + +export function addBorrow(data){ + return request({ + method:"post", + url:'/api/ht/borrow/save', + data + }) +} + +export function detailBorrow(params){ + return request({ + method:'get', + url:'/api/ht/borrow/show', + params + }) +} + +export function delBorrow(params){ + return request({ + method:'get', + url:'/api/ht/borrow/destroy', + params + }) +} + +// 还款 +export function getRepayment(params,noloading = false){ + return request({ + method:'get', + url:'/api/ht/borrow-repayment/index', + params, + noloading, + paramsSerializer: customParamsSerializer + }) +} + +export function addRepayment(data){ + return request({ + method:"post", + url:'/api/ht/borrow-repayment/save', + data + }) +} + +export function detailRepayment(params){ + return request({ + method:'get', + url:'/api/ht/borrow-repayment/show', + params + }) +} + +export function delRepayment(params){ + return request({ + method:'get', + url:'/api/ht/borrow-repayment/destroy', + params + }) +} diff --git a/src/components/XyTable/index.vue b/src/components/XyTable/index.vue index fb192bc..5b57cfa 100644 --- a/src/components/XyTable/index.vue +++ b/src/components/XyTable/index.vue @@ -191,14 +191,14 @@ export default { ['expand-change']: (row, expanded) => this.$emit('expand-change', { row, expanded }) }} > - - + ):''} { tableItem.filter(i => !i.hidden).map((item, index) => { if ($scopedSlots[item.prop]) { diff --git a/src/views/contract/components/borrowContract.vue b/src/views/contract/components/borrowContract.vue index b32102d..9934181 100644 --- a/src/views/contract/components/borrowContract.vue +++ b/src/views/contract/components/borrowContract.vue @@ -1,4 +1,5 @@ + @@ -68,52 +69,41 @@ - - - 关联预算计划 - - { - planSelect.year = e - getPlan() - }"> - - - - - - - - - - - - - - - - + + *借款说明 + + + + + + *借款金额 + + + + + + 借款备注 + + + + + + + - - - - 关闭 - 确认 - + + + + 关闭 + 确认 + @@ -121,21 +111,14 @@ - - - - - - - + + + + + + + @@ -144,6 +127,9 @@ detailContract, editorContract } from "@/api/contract/contract"; + import { + addBorrow + } from "@/api/borrow/borrow"; import { Message } from "element-ui"; @@ -152,29 +138,26 @@ } from "@/utils"; import axios from "axios"; - import { - getBudget - } from "@/api/budget/budget"; + import { getToken } from "@/utils/auth"; import { deepCopy - } from "@/utils"; - import {flowStatusConfig} from "@/api/common"; + } from "@/utils"; + import { + flowStatusConfig + } from "@/api/common"; export default { props: { - departments: { - type: Array, - default: () => [] - }, + }, components: {}, data() { return { showModal: false, - codeUri: '', - isShowOaModal: false, + codeUri: '', + isShowOaModal: false, oaUrl: "", window: { width: 0, @@ -182,214 +165,86 @@ top: 0, left: 0, }, - //合同详情 id: "", detail: null, isShowDetail: false, - plans: [], - contract_plan_links: [], - custom_model_id:'', - planSelect: { - name: "", - page_size: 20, - page: 1, - is_tree: 1, - year: new Date().getFullYear().toString(), - plan_department_id: "", - type: "" - }, - planTable: [{ - fixed: 'left', - sortable: false, - width: 44, - reserveSelection: true, - type: "selection", - selectable: (row, index) => { - return row.pid > 0 - }, - }, - { - label: "科室", - prop: 'plan_department.name', - width: 160, - align: 'center' - }, - { - label: "年份", - prop: 'year', - width: 80, - align: 'center' - }, - { - label: "分类", - prop: 'type_detail.value', - }, - { - label: "名称", - prop: 'name', - align: 'left', - width: 220, - }, - { - label: "计划金额", - prop: 'money', - align: 'right', - width: 120, - }, - { - label: "实付金额", - prop: 'use_money_total', - width: 120, - align: 'right' - }, - { - label: '已用金额', - prop: 'has_money_total', - width: 120, - align: 'right' - } - ], + custom_model_id: '', + form: { + name: '', + money: '', + remark: '' + } }; }, methods: { - async getFlowConfig() { - try { - const res = await flowStatusConfig() - let arr = [] - arr = res.map(i => JSON.parse(i.value)) - arr.map(item=>{ - if(item.tag==='unit_loan'){ - this.custom_model_id = item.custom_model_id - } - }) - - } catch (err) { - this.custom_model_id = '' - } - }, - async getPlan() { - try { - let res = await getBudget(this.planSelect) - let copyPlan = deepCopy(this.detail.plan_link) - console.log("res", copyPlan, this.detail.plan_link) - this.$refs['PlanTable'].clearSelection() - // 如果前面有选关联的 计划 - if (copyPlan.length > 0) { - let arr = [] - res.list.forEach((item) => { - item._inputMoney = 0 - let temp = copyPlan.find(i => i.plan_id === item.id) - if (temp) { - item._linkId = temp.id - item._inputMoney = temp.use_money - if (item.children && item.children.length > 0) { - item.children.forEach((i => { - i._inputMoney = temp.use_money - })) - } - arr.push(item) - } - }); - this.plans = arr; - - } else { - res.list.forEach((item => { - item._inputMoney = 0 - if (item.children && item.children.length > 0) { - item.children.forEach((i => { - i._inputMoney = 0 - })) - } - })) - this.plans = res.list; - } - - - } catch (e) { + async getFlowConfig() { + try { + const res = await flowStatusConfig() + let arr = [] + arr = res.map(i => JSON.parse(i.value)) + arr.map(item => { + if (item.tag === 'unit_loan') { + this.custom_model_id = item.custom_model_id + } + }) + + } catch (err) { + this.custom_model_id = '' } }, - planPick(selection) { - console.log("selection", selection) - this.contract_plan_links = selection.map(i => ({ - plan_id: i.id, - is_pre: 1, - use_money: i._inputMoney, - new_money: i._inputMoney, - custom_model_id: this.custom_model_id - })) - }, - //预算计划金额输入 - planInput(e, row) { - if (!/^[0-9]+.?[0-9]*$/.test(e) && e) { - Message({ - type: 'warning', - message: '金额格式错误' - }) - row._inputMoney = 0 - return - } - if (e <= (Number(row.money) - Number(row.use_money_total))) { - row._inputMoney = e - return - } - Message({ - type: 'warning', - message: '使用金额大于剩余预算' - }) - row._inputMoney = 0 - }, async getDetail(id) { this.id = id; let res = await detailContract({ id: id, }); this.detail = res; - // let plans = res.plans; - // let linkPlan = res.plan_link; - // let linkPlanTable = plans.map((item) => { - // let res = linkPlan.filter((item1) => { - // return item1.plan_id === item.id; - // })[0]; - // return { - // id: item.id, - // type: item.type, - // name: item.name, - // money: item.money, - // useMoney: res.use_money, - // }; - // }); - // this.detail.plans = linkPlanTable; - await this.getPlan() + + }, + async submit() { + if (!this.form.name) { + this.$message.warning('请填写借款说明') + return + } + if (!this.form.money) { + this.$message.warning('请填写借款金额') + return + } + if (parseFloat(this.form.money) > parseFloat(this.detail.plan_price)) { + this.$message.warning('借款金额不能多于项目预算') + return + } + + // return + const res = await addBorrow({ + contract_id: this.id, + name: this.form.name, + money: this.form.money, + remark: this.form.remark + }) + this.$message.success('提交成功') + + // this.$emit('refresh') + console.log("res", res) + await this.openOa(res) + // this.isShowDetail = false + // this.$emit('update:isShow', false) }, - submit(){ - if(this.contract_plan_links.length<1){ - this.$message.warning('请选择预算计划') - return - } - console.log("123",{ - id:this.id, - has_act_links:1, - contract_plan_links:this.contract_plan_links, - }) - // return - editorContract({ - id:this.id, - has_act_links:1, - contract_plan_links:this.contract_plan_links, - }).then(_ => { - this.$message.success('提交成功') - this.$emit('update:isShowDetail', false) - this.$emit('refresh') - this.openOa() - }) - }, - openOa(){ - let url = `${process.env.VUE_APP_OUT_URL}/#/flow/create?auth_token=${window.encodeURIComponent(getToken())}&module_name=oa&isSinglePage=1&module_id=${this.custom_model_id}&out_contract_id=${this.id}&default_json={}` - this.oaUrl = url - this.isShowOaModal = true + openOa(res) { + console.log("res123", res) + let default_json = { + zhichuyongtu: res.name ? res.name : '', + fukuanjine: res.money ? res.money : '' + } + let url = + `${process.env.VUE_APP_OUT_URL}/#/flow/create?auth_token=${window.encodeURIComponent(getToken())}&module_name=oa&isSinglePage=1&module_id=${this.custom_model_id}&borrow_id=${res.id}&default_json=${window.encodeURIComponent(JSON.stringify(default_json))}` + + this.oaUrl = url + console.log("oaUrl", this.oaUrl) + this.isShowOaModal = true + console.log("this.isShowOaModal", this.isShowOaModal) }, open(e) { this.codeUri = `http://view.ali251.langye.net:8012/onlinePreview?url=${encodeURIComponent( @@ -438,31 +293,29 @@ isShowDetail(val) { if (val) { - }else{ - this.plans = [] - this.contract_plan_links = [] - this.planSelect = { - name: "", - page_size: 20, - page: 1, - is_tree: 1, - year: new Date().getFullYear().toString(), - plan_department_id: "", - type: "" - }, - this.$refs['PlanTable'].clearSelection() + } else { + this.detail = null + this.form = { + name: '', + money: '', + remark: '' + } + } + }, + isShowOaModal(newVal) { + if (newVal) { + + } else { + this.oaUrl = '' + this.isShowDetail = false + this.$emit('update:isShow', false) + this.$emit("refresh") } - }, - isShowOaModal(newVal) { - if (newVal) { - - } else { - this.oaUrl = '' - } } }, - mounted() { + mounted() { this.getFlowConfig() + // this.openOa({}) this.window.width = screen.availWidth * 0.95; this.window.height = screen.availHeight * 0.95; this.window.top = (window.screen.height - 30 - this.window.height) / 2; diff --git a/src/views/contract/components/borrowList.vue b/src/views/contract/components/borrowList.vue new file mode 100644 index 0000000..4d1bae4 --- /dev/null +++ b/src/views/contract/components/borrowList.vue @@ -0,0 +1,274 @@ + + + + + + + + + + + + + + 编辑 + + delPay(repay.row.id)" + > + 删除 + + + + + + + + + + + + + + + + + 发起借款流程 + + + + 新增还款 + + + + + + + + + 关闭 + + + + + + + + + + + + + + + + diff --git a/src/views/contract/components/borrowPay.vue b/src/views/contract/components/borrowPay.vue new file mode 100644 index 0000000..e2fc036 --- /dev/null +++ b/src/views/contract/components/borrowPay.vue @@ -0,0 +1,244 @@ + + + + + + + + 借款金额 + + {{borrow_money}} + + + + 已还款金额 + + {{repayment_total}} + + + + *还款金额 + + + + + + 备注 + + + + + + + + + 关闭 + 确认 + + + + + + + + + diff --git a/src/views/contract/components/paymentRegistration.vue b/src/views/contract/components/paymentRegistration.vue index 259e38b..c0dcc45 100644 --- a/src/views/contract/components/paymentRegistration.vue +++ b/src/views/contract/components/paymentRegistration.vue @@ -1,717 +1,658 @@ - - - - - - - 受款单位 - - {{ contract.supply }} - + + + + + + + 受款单位 + + {{ contract.supply }} + + + + {{ nameFormat($route.path.split('_')[1]) }}名称 + + {{ contract.name }} + + + + {{ nameFormat($route.path.split('_')[1]) }}金额 + + {{ priceFormat(contract.money) }} (元) + + + + + 已申请金额 + + {{ totalApplyMoney() }} (元) + + + + 已申请笔数 + + {{ payment.length }} + + + + + + 已付金额 + + {{ totalMoney() }} (元) + + + + 支付占比 + + {{ percentPay() }}% + + + + 已付笔数 + + {{ actNumsTotal() }} + + + + 点击查看列表 + + + + + + + + + + 暂无已付笔数 + + + + + - - {{ nameFormat($route.path.split('_')[1]) }}名称 - - {{ contract.name }} - - - - {{ nameFormat($route.path.split('_')[1]) }}金额 - - {{ priceFormat(contract.money) }} (元) - - - - - 已申请金额 - - {{ totalApplyMoney() }} (元) - - - - 已申请笔数 - - {{ payment.length }} - - - - - - 已付金额 - - {{ totalMoney() }} (元) - - - - 支付占比 - - {{ percentPay() }}% - - - - 已付笔数 - - {{ actNumsTotal() }} - - - - 点击查看列表 - - - - - - - - - - 暂无已付笔数 - - - - - - - - - - - *申请付款金额 - - - - - - - - - - 审计金额 - - - - - - - - - *本期扣款金额 - - - - - - - - - - 备注 - - - - - - - - - *款项类型 - - - - - - - - - - - - - *是否为最后一笔 - - - - - - - - - - - *是否为资产 - - - - - - - - - - *资产类型 - - - - - - - - - - - - 附件 : - - - - 选取文件 - 开始上传 - - 支持文件格式:.rar .zip .doc .docx .pdf .jpg .png .gif .mp4 .xls - .xlsx - 单个文件不能超过20M - - - - - - - - - - - - (scope.row.useMoney = e)" - /> - - - - - - - - - - - - - - - - diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 6b9377b..8610a17 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -412,7 +412,8 @@ > - @@ -680,8 +705,8 @@ - - + + 打印 - - 支付审批 - + + + + + 支付审批 + + + + + + 支付审批 + + + + + + import { detailContract } from "@/api/contract/contract"; import { fundlogFlow,httpCurl } from "@/api/out"; -import { getFundLog, delFundLog } from "@/api/paymentRegistration/fundLog"; +import { getFundLog, delFundLog,editorFundLog } from "@/api/paymentRegistration/fundLog"; import { parseTime } from "@/utils"; import { Message } from "element-ui"; import { show } from "@/api/away" @@ -210,7 +235,8 @@ export default { align: "left", fixed: this.$store.getters.device === 'mobile'?false:'left', customFn: row => { - return ({ row.contract_id ? row.contract.name : row.away.title }) + console.log("row",row) + return ({ row.contract_id ? (row.contract?row.contract.name:'') : row.away.title }) } }, { @@ -245,7 +271,7 @@ export default { width: 330, align: "left", customFn: (row) => { - if (row.act_plan_link.length > 0) { + if (row.act_plan_link && row.act_plan_link.length > 0) { return row.act_plan_link.map((item) => { return ( @@ -347,7 +373,16 @@ export default { } }, + saveFundLog(row){ + editorFundLog({ + ...row, + status:1 + }).then(res => { + this.getFundLogs() + }) + }, async toOutPay(row) { + let payments = []; const actNumsTotal = () => { return payments.reduce((pre,cur) => { diff --git a/src/views/finance/components/examineRegistration.vue b/src/views/finance/components/examineRegistration.vue index 2a43848..148a3bc 100644 --- a/src/views/finance/components/examineRegistration.vue +++ b/src/views/finance/components/examineRegistration.vue @@ -201,7 +201,20 @@ - + + + + + + + + + { + const findVal = (arr, id) => { + for (let i = 0;i < arr.length;i++) { + if (i.id === id) { + return arr[i].name + } else if (arr.children instanceof Array) { + findVal(arr.children, id) + } + } + } + return value ? value : findVal(this.planTypes, row.plan.type) + } + }, + { + label: "科室", + prop: 'plan_department.name', + width: 140, + align: 'center', + formatter: (row, column, value) => { + return value ? value : this.departments.find(i => i.id === row.plan.plan_department_id)?.name + } + }, + // { + // label: "隶属", + // prop: 'pid_info.name', + // width: 180, + // align: 'left' + // }, + { + label: "名称", + prop: 'plan.name', + width: 280, + align: 'left' + }, + + { + label: "计划金额", + prop: 'plan.money', + width: 136, + align: 'right', + customFn: (row) => { + let m1 = row.plan.money; + let m2 = row.plan.update_money; + return m2 == 0 ? m1 : m2; + } + }, + { + label: "借款金额", + prop: "use_money", + width: 120, + align: "right", + formatter: (v1, v2, value) => + value ? `${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : "", + }, + ], } }, methods: { @@ -590,6 +676,7 @@ import {listdeptNoAuth} from "@/api/system/department"; this.paymentRegistrationForm.deductionMoney = res.discount_money this.paymentRegistrationForm.applyMoney = res.apply_money this.paymentRegistrationForm.remark = res.remark + this.paymentRegistrationForm.plan_act_link_by_unit_loan = res.plan_act_link_by_unit_loan?res.plan_act_link_by_unit_loan:[] for (var m of res.plan_link) { m.label = m.plan ? m.plan.name : "无计划名称"; } @@ -600,7 +687,8 @@ import {listdeptNoAuth} from "@/api/system/department"; await this.getContract(res.contract,res.plan_link?.map(i => i.plan_id)?.toString()) // this.getBudgets(this.paymentRegistrationForm.plan?.map(i => i.plan_id)?.toString()) - this.getBudgets(res.plan_link?.map(i => i.plan_id)?.toString()) + // this.getBudgets(res.plan_link?.map(i => i.plan_id)?.toString()) + this.getBudgets() await this.moneyWayChange() }, @@ -634,6 +722,15 @@ import {listdeptNoAuth} from "@/api/system/department"; // return // } // return + let contract_plan_act_links = [] + if(this.paymentRegistrationForm.plan_act_link_by_unit_loan.length>0){ + this.paymentRegistrationForm.plan_act_link_by_unit_loan.map(item=>{ + item.fund_log_id = this.registrationId + }) + contract_plan_act_links = this.paymentRegistrationForm.plan_act_link_by_unit_loan + }else{ + contract_plan_act_links = this.paymentRegistrationForm.plan + } editorFundLog({ id: this.registrationId, contract_id: this.contract.id, @@ -642,7 +739,7 @@ import {listdeptNoAuth} from "@/api/system/department"; apply_money: this.paymentRegistrationForm.applyMoney, // discount_money: this.paymentRegistrationForm.deductionMoney, // money_way_id: this.paymentRegistrationForm.moneyWay.toString(), - contract_plan_act_links: this.paymentRegistrationForm.plan, + contract_plan_act_links: contract_plan_act_links, property: this.paymentRegistrationForm.property, property_type_id: this.paymentRegistrationForm.property_type_id, }).then(res => { diff --git a/src/views/finance/paymentRegistrationList.vue b/src/views/finance/paymentRegistrationList.vue index 96d6db4..c383b27 100644 --- a/src/views/finance/paymentRegistrationList.vue +++ b/src/views/finance/paymentRegistrationList.vue @@ -308,7 +308,7 @@ export default { align: "left", customFn: (row) => { { - if (row.act_plan_link.length > 0) { + if (row.act_plan_link && row.act_plan_link.length > 0) { return row.act_plan_link.map((item) => { return (