@@ -38,6 +38,7 @@ | |||
</div> | |||
</div> | |||
<template #right> | |||
<div @click="openLoader(item.id,0)" style="background-color: rgba(98,173,102,0.2);color: #62AD66;">附件</div> | |||
<div @click="handleDelete(item,index)" style="background-color: #ee0a24;height: 100%" v-if="item.params.planStatus !=='2'">删除</div> | |||
<router-link :to="{name:'sunVillageInfoInformationFunPlanEdit',query:{id:item.id}}" style="background-color: #07c160" v-if="item.params.planStatus !=='2'">修改</router-link> | |||
</template> | |||
@@ -45,11 +46,17 @@ | |||
</van-list> | |||
</div> | |||
<van-popup v-model="show" lock-scroll closeable position="top" :style="{ height: '30%' }" > | |||
<div style="padding: 0 13% 0 5%;"> | |||
<van-divider>附件</van-divider> | |||
<van-uploader v-model="fileList" :after-read="afterRead" @delete="deleteFile1" multiple /> | |||
</div> | |||
</van-popup> | |||
</div> | |||
</template> | |||
<script> | |||
import { listPlan , delPlan } from "@/api/sunVillage_info/fixedAssets"; | |||
import {listPlan, delPlan, attachmentList, systemAttachment, commonAttach} from "@/api/sunVillage_info/fixedAssets"; | |||
import request from '@/utils/request' | |||
export default { | |||
name: "informationFunPlan", | |||
@@ -140,6 +147,47 @@ | |||
goAdd() { | |||
this.$router.push({ path: '/sunVillage_info/informationFunPlanAdd', query: { contractionId: this.contractionId } }); | |||
}, | |||
//附件 | |||
openLoader(id,index){ | |||
this.show = true; | |||
this.projectId = id; | |||
this.projectIndex = index; | |||
this.fileList = []; | |||
let oData1= { | |||
tableId: id, | |||
tableName: "t_contraction_fund_plan", | |||
bizPath: "contraction", | |||
fileType: '', | |||
} | |||
attachmentList(oData1).then(res => { | |||
res.rows.map(r => { | |||
let baseUrl = location.protocol+"//"+location.host+request.defaults.baseURL | |||
this.fileList.push({"url":baseUrl + r.fileUrl,"file":new File([],r.fileName,{}),"id":r.id}) | |||
}) | |||
}) | |||
}, | |||
//上传 | |||
afterRead(file) { | |||
console.log(this.projectId) | |||
// 此时可以自行将文件上传至服务器 | |||
this.uploadFiles1.push(file.file); | |||
let params1 = new FormData(); | |||
params1.append("tableId", this.projectId); | |||
params1.append("tableName", "t_contraction_fund_plan"); | |||
params1.append("bizPath", "contraction"); | |||
params1.append("fileType", this.projectIndex); | |||
params1.append("file", file.file); | |||
commonAttach(params1).then((r1) => { | |||
this.$notify({ type: 'success', message: '上传成功' }); | |||
}) | |||
}, | |||
//删除附件 | |||
deleteFile1(file){ | |||
console.log(file) | |||
systemAttachment(file.id).then(res => { | |||
this.$notify({ type: 'success', message: '删除成功' }); | |||
}) | |||
}, | |||
}, | |||
} | |||
</script> | |||
@@ -24,12 +24,12 @@ | |||
@cancel="showCollectionPay = false"/> | |||
</van-popup> | |||
<van-field v-model="form.orderNum" label="结款序号" placeholder="结款序号" input-align="right" type="digit" :border="false" /> | |||
<van-field v-model="form.settlementDate" clickable label="结款日期" placeholder="请选择" @click="showSettlementDate = true" input-align="right" right-icon="arrow-down" label-width="auto" required :border="false"/> | |||
<van-field v-model="form.orderNum" label="结款序号" placeholder="结款序号" required input-align="right" type="digit" :error-message="errorMessages.orderNum" :border="false" /> | |||
<van-field v-model="form.settlementDate" clickable label="结款日期" placeholder="请选择" :error-message="errorMessages.settlementDate" @click="showSettlementDate = true" input-align="right" right-icon="arrow-down" label-width="auto" required :border="false"/> | |||
<van-popup v-model="showSettlementDate" position="bottom"> | |||
<van-datetime-picker v-model="settlementDate" type="date" title="选择年月日" @confirm="onConfirmSettlementDate" @cancel="showSettlementDate = false"/> | |||
</van-popup> | |||
<van-field v-model="form.settlementAmount" label="结款金额" type="number" required placeholder="结款金额" input-align="right" :border="false" /> | |||
<van-field v-model="form.settlementAmount" label="结款金额" type="number" required placeholder="结款金额" input-align="right" :error-message="errorMessages.settlementAmount" :border="false" /> | |||
<van-field v-model="planStatus" @click="showPlanStatus = false" label="结款状态" input-align="right" :border="false" disabled /> | |||
<van-popup v-model="showPlanStatus" position="bottom"> | |||
@@ -76,6 +76,11 @@ | |||
settlementAmount:'', | |||
remark:'', | |||
}, | |||
errorMessages: { | |||
orderNum: '', | |||
settlementDate: '', | |||
settlementAmount: '', | |||
}, | |||
queryParams:{ | |||
/* pageNum:1, | |||
pageSize:10, | |||
@@ -154,15 +159,45 @@ | |||
onSubmit(){ | |||
this.form.contractionId = this.contractionId; | |||
addPlan(this.form).then((response) => { | |||
if (response.code == 200){ | |||
this.$notify({ type: 'success', message: '新增成功' }); | |||
setTimeout(function(){ | |||
history.back(-1); | |||
},2000) | |||
} | |||
}); | |||
event.preventDefault(); // 阻止表单默认提交行为 | |||
// 清除之前的错误消息 | |||
this.errorMessages.orderNum = ''; | |||
this.errorMessages.settlementDate = ''; | |||
this.errorMessages.settlementAmount = ''; | |||
let isValid = true; | |||
// 验证结款序号 | |||
if (!this.form.orderNum) { | |||
this.errorMessages.orderNum = '结款序号不能为空'; | |||
isValid = false; | |||
} | |||
// 验证结款日期 | |||
if (!this.form.settlementDate) { | |||
this.errorMessages.settlementDate = '结款日期不能为空'; | |||
isValid = false; | |||
} | |||
// 验证结款金额 | |||
if (!this.form.settlementAmount) { | |||
this.errorMessages.settlementAmount = '结款金额不能为空'; | |||
isValid = false; | |||
} | |||
// 如果验证通过,进行提交处理 | |||
if (isValid) { | |||
this.form.contractionId = this.contractionId; | |||
addPlan(this.form).then((response) => { | |||
if (response.code == 200) { | |||
this.$notify({type: 'success', message: '新增成功'}); | |||
setTimeout(function () { | |||
history.back(-1); | |||
}, 2000) | |||
} | |||
}); | |||
} | |||
} | |||
}, | |||
} | |||