master
xy 2 years ago
parent 90b059bc6e
commit 3e1dad04a8

@ -148,6 +148,46 @@
</div> </div>
</div> </div>
</template> </template>
<template v-slot:files>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>文件
</div>
<div class="xy-table-item-content">
<el-upload
style="width: 300px"
ref="upload"
multiple
:on-success="successHandle"
:before-upload="uploadBefore"
accept=".rar,.zip,.doc,.docx,.pdf,.jpg,.png,.gif,.xls,.xlsx"
:action="action"
:file-list="fileLists"
:auto-upload="false"
:on-remove="removeHande"
:limit="100"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件</el-button
>
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="$refs['upload'].submit()"
>开始上传</el-button
>
<div slot="tip" class="el-upload__tip">
支持文件格式.rar .zip .doc .docx .pdf .jpg .png .gif .xls
.xlsx
<br />单个文件不能超过20M
</div>
</el-upload>
</div>
</div>
</template>
</xy-dialog> </xy-dialog>
</div> </div>
</template> </template>
@ -185,8 +225,10 @@ export default {
is_framework: "", is_framework: "",
purchase_status: 3, purchase_status: 3,
join_status: 3, join_status: 3,
invite_status: 3 invite_status: 3,
files: []
}, },
fileLists: [],
rules: { rules: {
name: [ name: [
{ {
@ -277,11 +319,11 @@ export default {
}, },
// //
successHandle(response, file, fileList, key) { successHandle(response, file, fileList) {
this[key] = fileList; this.fileLists = fileList;
}, },
removeHande(file, fileList, key) { removeHande(file, fileList) {
this[key] = fileList; this.fileLists = fileList;
}, },
uploadBefore(file) { uploadBefore(file) {
console.log(file); console.log(file);
@ -298,6 +340,11 @@ export default {
const res = await show({ id: this.id }); const res = await show({ id: this.id });
this.$integrateData(this.form, res); this.$integrateData(this.form, res);
if (this.form.start_date && this.form.end_date) this.time = [this.form.start_date,this.form.end_date] 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() { submit() {
@ -314,6 +361,7 @@ export default {
this.$emit("refresh"); this.$emit("refresh");
}) })
} }
this.form.files = this.fileLists.map(i => i.response?.id)
if (this.type === "editor") { if (this.type === "editor") {
Object.defineProperty(this.form, "id", { Object.defineProperty(this.form, "id", {
value: this.id, value: this.id,

@ -1440,6 +1440,20 @@ export default {
return parseTime(new Date(value), "{y}-{m}-{d}"); return parseTime(new Date(value), "{y}-{m}-{d}");
}, },
}, },
{
label: "附件",
width: 200,
prop: "files",
customFn: row => {
return (
<div>
{
row.files_detail.map(i => (<a style="color: red;" href={i.url} download={i.original_name} target="_blank">{i.original_name}</a>))
}
</div>
)
}
}
], ],
table: [ table: [
{ {
@ -1448,6 +1462,15 @@ export default {
prop: "name", prop: "name",
fixed: "left", fixed: "left",
align: "left", align: "left",
customFn:row => {
if (row.type === 1 && row.end_date && (this.$moment().valueOf() - this.$moment(row.end_date).valueOf()) > 0) {
return (<span style="color: red;"><span>已到期</span><span>{row.name}</span></span>)
} else {
return (
<span>{row.name}</span>
)
}
}
}, },
{ {
label: "采购形式", label: "采购形式",

@ -126,7 +126,7 @@
> >
<div slot="tip" class="el-upload__tip"> <div slot="tip" class="el-upload__tip">
支持文件格式.rar .zip .doc .docx .pdf 支持文件格式.rar .zip .doc .docx .pdf
<br />单个文件不能超过500kb <br />单个文件不能超过20Mb
</div> </div>
</el-upload> </el-upload>
</div> </div>
@ -159,6 +159,32 @@
</div> </div>
</div> </div>
</template> </template>
<template v-slot:extraFormBottom>
<Input search enter-button=" " placeholder="搜索预算计划.." @on-search="getBudgets" />
<div style="min-width: 300px;">
<template v-if="form.plan_link.length > 0">
<template v-for="item in form.plan_link">
<Tag closable color="primary" @on-close="delPlan(item)">{{item.label}}</Tag>
</template>
</template>
</div>
<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" width="140">
<template slot-scope="scope">
<Input :value="scope.row.use_money" @input="inputMoney($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="e => {
p
}" />
</div>
</template>
</xy-dialog> </xy-dialog>
<!-- 新增表 预算计划 --> <!-- 新增表 预算计划 -->
@ -174,7 +200,7 @@
:list="plans" :list="plans"
row-key="id" row-key="id"
:show-index="false" :show-index="false"
:table-item="planTable" :table-item="planOutTable"
style="margin-top: 10px" style="margin-top: 10px"
@select="selected" @select="selected"
> >
@ -186,7 +212,7 @@
<Page <Page
:total="planTotal" :total="planTotal"
show-elevator show-elevator
@on-change="e => {planSearch.p = e; getBudgets()}" @on-change="e => {planSearch.p = e; getOutBudgets()}"
/> />
</div> </div>
</template> </template>
@ -207,6 +233,7 @@ import {
detailContract as show, detailContract as show,
} from "@/api/contract/contract"; } from "@/api/contract/contract";
import { httpCurl } from "@/api/out" import { httpCurl } from "@/api/out"
import { getBudget } from '@/api/budget/budget'
export default { export default {
props: { props: {
report_types: { report_types: {
@ -242,7 +269,7 @@ export default {
list_rows: 10, list_rows: 10,
p: 1 p: 1
}, },
planTable: [ planOutTable: [
{ {
width: 46, width: 46,
sortable: false, sortable: false,
@ -291,6 +318,7 @@ export default {
files: [], files: [],
remark: "", remark: "",
oa: [], oa: [],
plan_link: []
}, },
rules: { rules: {
report_type: [ 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: { methods: {
@ -319,7 +400,7 @@ export default {
}, },
uploadBefore(file) { uploadBefore(file) {
console.log(file); console.log(file);
if (file.size / 1000 > 500) { if (file.size / 1000 > 20 * 1024) {
this.$message({ this.$message({
type: "warning", type: "warning",
message: "上传文件大小超过500kb", 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() { async getDetail() {
const res = await show({ id: this.id }); const res = await show({ id: this.id });
this.$integrateData(this.form, res); this.$integrateData(this.form, res);
@ -386,11 +521,14 @@ export default {
response: i response: i
} }
}) })
this.form.other_type = res.other_type?.id;
await this.getBudgets();
}, },
submit() { submit() {
this.form.outcome_type = this.outcomeType; this.form.outcome_type = this.outcomeType;
this.form.files = this.fileList.map(i => i.response?.id); 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.type === "add") {
if (this.form.hasOwnProperty("id")) { if (this.form.hasOwnProperty("id")) {
delete this.form.id; delete this.form.id;
@ -444,11 +582,38 @@ export default {
).detail; ).detail;
}, },
async showPlan() { async showPlan() {
await this.getBudgets(); await this.getOutBudgets();
this.isShowPlan = true; this.isShowPlan = true;
}, },
//
async getBudgets() { 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'); let res = await httpCurl(this.planSearch, false, '/Api/flowList');
this.plans = res.list this.plans = res.list
this.planTotal = Number(res.total) this.planTotal = Number(res.total)

Loading…
Cancel
Save