采购合同接口对接2

This commit is contained in:
zzyuan 2025-07-02 16:43:34 +08:00
parent e2b2adf004
commit c8deff366d
3 changed files with 100 additions and 12 deletions

View File

@ -40,7 +40,9 @@
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">合同附件</template>
<!-- {{ baseInfo.deptName }} -->
<div v-for="(item,index) in baseInfo.contractAttachmentList" :key="index">
<a :href="item" download="demo">{{ item }}</a>
</div>
</el-descriptions-item>
</el-descriptions>

View File

@ -89,7 +89,25 @@
</el-form-item>
<el-form-item label="合同总金额" prop="contractAmount">
<el-input v-model="baseInfo.contractAmount" placeholder="请输入合同总金额" maxlength="20" clearable style="width: 240px" @input="(v)=>(baseInfo.contractAmount=v.replace(/[^\d.]/g,''))"/>
</el-form-item>
</el-form-item>
<el-form-item label="合同附件" prop="contractAttachmentList">
<el-upload
ref="upload"
:http-request="fileUpLoad"
action="#" :limit="5"
accept=".xlsx, .xls, .png, .jpg, .jpeg, .docx, .doc"
:show-file-list="true"
:file-list="attachmentList"
:on-remove="handleRemoveFile"
>
<el-button
:disabled="attachmentList.length==5"
type="primary"
size="mini"
>上传附件
</el-button>
</el-upload>
</el-form-item>
</el-form>
</div>
<div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;">
@ -136,7 +154,7 @@
<template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="请输入" maxlength="20" clearable/>
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
</div>
@ -213,6 +231,7 @@
</template>
<script>
import { imgUpLoadTwo } from '@/api/system/upload'
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage";
import { getPurchaseContractInfoApi,addPurchaseContractApi,editPurchaseContractApi,delPurchaseContractApi } from "@/api/foodManage/purchaseManage";
@ -261,6 +280,7 @@ export default {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
}
},
attachmentList:[],
contractMaterialList:[],//-
batchIds:[],//--
openDialog:false,
@ -273,11 +293,13 @@ export default {
tableListData: [],//-
batchChosenMaterial:[],//--
noMaterial:false,
};
},
created() {
this.getAreaTreeData()
this.getMaterialTree()
this.attachmentList=[]
if(this.$route.query.pageJson){
this.pageJson = JSON.parse(this.$route.query.pageJson)
this.getContractInfo()
@ -300,7 +322,15 @@ export default {
this.baseInfo = response.data;
this.$set(this.baseInfo,'dateRange',[this.baseInfo.contractStartTime,this.baseInfo.contractEndTime])
this.contractMaterialList = this.baseInfo.purchaseContractDetailList;
this.$set(this.baseInfo,"contractAmount",this.baseInfo.contractAmount/100)
this.contractMaterialList.forEach(item=>{
this.$set(item,"singlePrice",Number(item.singlePrice)/100)
})
if(this.baseInfo.contractAttachmentList.length>0){
this.baseInfo.contractAttachmentList.forEach(item=>{
this.attachmentList.push({name:item,url:item})
})
}
this.$set(this.baseInfo,"contractAmount",Number(this.baseInfo.contractAmount)/100)
getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => {
this.canteenOptions=response.rows||[];
this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId)
@ -308,7 +338,7 @@ export default {
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
this.supplierOptions = response.rows||[];
this.$set(this.baseInfo,'supplierId',this.baseInfo.supplierId)
});
});
});
},
//
@ -444,7 +474,14 @@ export default {
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
param.contractAmount = this.baseInfo.contractAmount*100;
param.commitStatus=1
param.purchaseContractDetailList = []
param.purchaseContractDetailList = []
param.contractAttachment = ""
if(this.attachmentList.length>0){
console.log(this.attachmentList)
let arr = this.attachmentList.map(item=>item.url)
param.contractAttachment = arr.join(',')
console.log(param)
}
this.noMaterial = false;
if(this.contractMaterialList.length>0){
this.contractMaterialList.forEach(item=>{
@ -550,6 +587,30 @@ export default {
}
}
});
},
//
fileUpLoad(param){
param.type = 'canteen'
imgUpLoadTwo(param).then((res) => {
if (res.code == 200) {
this.attachmentList.push(res.data)
} else {
this.$modal.msgError(res.msg);
}
}).catch((error) => {
this.$modal.msgError(error)
})
},
handleRemoveFile(file, fileList){
console.log(this.attachmentList)
let sum = 0
this.attachmentList.forEach((item, index) => {
if (item.url == file.url) {
sum = index
}
})
this.attachmentList.splice(sum, 1)
},
//
formatDate(date) {

View File

@ -116,6 +116,12 @@
icon="el-icon-edit" v-if="scope.row.commitStatus==2"
@click="handleView(scope.row)"
>详情</el-button>
<!-- <el-button
size="mini" v-if="scope.row.commitStatus==1"
type="text" :disabled="loadingBtn"
icon="el-icon-top"
@click="confirmSubmit(scope.row)"
>提交</el-button> -->
<el-button
size="mini"
type="text"
@ -162,6 +168,7 @@ export default {
return {
//
loading: true,
loadingBtn: false,
//
ids: [],
//
@ -322,13 +329,31 @@ export default {
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
//
//
confirmSubmit(row){
let param = Object.assign({},row);
this.loadingBtn=true
param.commitStatus=2
editPurchaseContractApi(param).then((response) => {
this.$modal.msgSuccess("提交成功");
this.getList()
this.loadingBtn=false
}).catch(() => {
this.loadingBtn=false
});
},
//
formatDate(date) {
// YYYY-MM-DD
date = new Date(date)
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 0
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
},
//
formatDateTime(date) {
// YYYY-MM-DD
date = new Date(date)
const year = date.getFullYear();