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 @@ - + @@ -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 @@ + + + + + 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 @@ + + + + + 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 @@ -