From 3e1dad04a848392522ec38ccdd3458acb6fb0b62 Mon Sep 17 00:00:00 2001 From: xy <271556543@qq.com> Date: Mon, 25 Dec 2023 17:38:53 +0800 Subject: [PATCH] 2023-12-25 --- .../contract/components/addContractLedger.vue | 58 +++++- src/views/contract/contractList.vue | 23 +++ .../inOut/component/addExpenseAccount.vue | 179 +++++++++++++++++- 3 files changed, 248 insertions(+), 12 deletions(-) diff --git a/src/views/contract/components/addContractLedger.vue b/src/views/contract/components/addContractLedger.vue index a2fa531..fee0a21 100644 --- a/src/views/contract/components/addContractLedger.vue +++ b/src/views/contract/components/addContractLedger.vue @@ -148,6 +148,46 @@ + @@ -185,8 +225,10 @@ export default { is_framework: "", purchase_status: 3, join_status: 3, - invite_status: 3 + invite_status: 3, + files: [] }, + fileLists: [], rules: { name: [ { @@ -277,11 +319,11 @@ export default { }, //上传 - successHandle(response, file, fileList, key) { - this[key] = fileList; + successHandle(response, file, fileList) { + this.fileLists = fileList; }, - removeHande(file, fileList, key) { - this[key] = fileList; + removeHande(file, fileList) { + this.fileLists = fileList; }, uploadBefore(file) { console.log(file); @@ -298,6 +340,11 @@ export default { const res = await show({ id: this.id }); this.$integrateData(this.form, res); if (this.form.start_date && this.form.end_date) this.time = [this.form.start_date,this.form.end_date] + this.fileLists = res.files_detail.map(i => ({ + name: i.original_name, + url: i.url, + response: i + })) }, submit() { @@ -314,6 +361,7 @@ export default { this.$emit("refresh"); }) } + this.form.files = this.fileLists.map(i => i.response?.id) if (this.type === "editor") { Object.defineProperty(this.form, "id", { value: this.id, diff --git a/src/views/contract/contractList.vue b/src/views/contract/contractList.vue index 3472384..96aba13 100644 --- a/src/views/contract/contractList.vue +++ b/src/views/contract/contractList.vue @@ -1440,6 +1440,20 @@ export default { return parseTime(new Date(value), "{y}-{m}-{d}"); }, }, + { + label: "附件", + width: 200, + prop: "files", + customFn: row => { + return ( +
+ { + row.files_detail.map(i => ({i.original_name})) + } +
+ ) + } + } ], table: [ { @@ -1448,6 +1462,15 @@ export default { prop: "name", fixed: "left", align: "left", + customFn:row => { + if (row.type === 1 && row.end_date && (this.$moment().valueOf() - this.$moment(row.end_date).valueOf()) > 0) { + return (【已到期】{row.name}) + } else { + return ( + {row.name} + ) + } + } }, { label: "采购形式", diff --git a/src/views/inOut/component/addExpenseAccount.vue b/src/views/inOut/component/addExpenseAccount.vue index 9529ca3..242046b 100644 --- a/src/views/inOut/component/addExpenseAccount.vue +++ b/src/views/inOut/component/addExpenseAccount.vue @@ -126,7 +126,7 @@ >
支持文件格式:.rar .zip .doc .docx .pdf -
单个文件不能超过500kb +
单个文件不能超过20Mb
@@ -159,6 +159,32 @@ + @@ -174,7 +200,7 @@ :list="plans" row-key="id" :show-index="false" - :table-item="planTable" + :table-item="planOutTable" style="margin-top: 10px" @select="selected" > @@ -186,7 +212,7 @@ @@ -207,6 +233,7 @@ import { detailContract as show, } from "@/api/contract/contract"; import { httpCurl } from "@/api/out" +import { getBudget } from '@/api/budget/budget' export default { props: { report_types: { @@ -242,7 +269,7 @@ export default { list_rows: 10, p: 1 }, - planTable: [ + planOutTable: [ { width: 46, sortable: false, @@ -291,6 +318,7 @@ export default { files: [], remark: "", oa: [], + plan_link: [] }, rules: { report_type: [ @@ -306,6 +334,59 @@ export default { }, ], }, + planTable: [{ + sortable: false, + width: 44, + type: 'selection' + }, + { + label: "年份", + prop: 'year', + align: 'center', + width: 96, + }, + { + label: "分类", + width: 136, + prop: 'type_detail.value', + }, + { + label: "科室", + prop: 'plan_department.name', + width: 100, + align: 'center' + }, { + label: "隶属", + prop: 'pid_info.name', + width: 180, + align: 'left' + }, + { + label: "名称", + prop: 'name', + width: 280, + align: 'left' + }, + + { + label: "计划金额", + prop: 'money', + width: 136, + align: 'right', + customFn: (row) => { + let m1 = row.money; + let m2 = row.update_money; + + return m2 == 0 ? m1 : m2; + } + }, + { + label: "已经使用", + prop: 'use_money_total', + width: 136, + align: 'right', + } + ], }; }, methods: { @@ -319,7 +400,7 @@ export default { }, uploadBefore(file) { console.log(file); - if (file.size / 1000 > 500) { + if (file.size / 1000 > 20 * 1024) { this.$message({ type: "warning", message: "上传文件大小超过500kb!", @@ -376,6 +457,60 @@ export default { } }, + + delPlan(val) { + this.form.plan_link.map((item, index) => { + if (item.plan_id === val.plan_id) { + this.form.plan_link.splice(index, 1) + } + }) + }, + selectPlan(sel, row) { + if (sel) { + let select = sel.map(item => { + return { + contract_id: this.id, + plan_id: item.id, + use_money: item.use_money, + new_money: item.money, + label: item.name + } + }); + //说明被删除了 + if (!sel.find(plan => { + return plan.id == row.id + })) { + this.delPlan({ + plan_id: row.id + }) + } + let _plan = JSON.parse(JSON.stringify(this.form.plan_link)); + + var _select = []; + select.map(item => { + if (!_plan.find(plan => { + return plan.plan_id == item.plan_id + })) { + _select.push(item) + } + }); + this.form.plan_link = [..._plan, ..._select] + + } else { + this.form.plan_link = [] + } + + }, + + inputMoney(e, row) { + row.use_money = e + this.form.plan_link.forEach(item => { + if (item.plan_id == row.id) { + item.use_money = e + } + }) + }, + async getDetail() { const res = await show({ id: this.id }); this.$integrateData(this.form, res); @@ -386,11 +521,14 @@ export default { response: i } }) + this.form.other_type = res.other_type?.id; + await this.getBudgets(); }, submit() { this.form.outcome_type = this.outcomeType; this.form.files = this.fileList.map(i => i.response?.id); + this.form.contract_plan_act_links = this.form.plan_link; if (this.type === "add") { if (this.form.hasOwnProperty("id")) { delete this.form.id; @@ -444,11 +582,38 @@ export default { ).detail; }, async showPlan() { - await this.getBudgets(); + await this.getOutBudgets(); this.isShowPlan = true; }, - //获取预算计划 async getBudgets() { + let res = await getBudget({ + top_pid: 1, + ...this.plansSelect + }) + this.plans = res.list.data + this.planTotal = res.list.total + + this.toggleSelection(this.form.plan_link.map(item => { + return item.plan_id + })) + }, + //默认选择计划 + toggleSelection(plans) { + if (plans) { + this.plans.filter(plan => { + if (plans.includes(plan.id)) { + plan.use_money = this.form.plan_link[plans.indexOf(plan.id)].use_money + return true + } + }).map(row => { + this.$refs.planTable.toggleRowSelection(row) + }) + } else { + this.$refs.planTable.clearSelection() + } + }, + //获取预算计划 + async getOutBudgets() { let res = await httpCurl(this.planSearch, false, '/Api/flowList'); this.plans = res.list this.planTotal = Number(res.total)