采购合同接口对接2
This commit is contained in:
		
							parent
							
								
									e2b2adf004
								
							
						
					
					
						commit
						c8deff366d
					
				| 
						 | 
					@ -40,7 +40,9 @@
 | 
				
			||||||
              </el-descriptions-item>
 | 
					              </el-descriptions-item>
 | 
				
			||||||
              <el-descriptions-item>
 | 
					              <el-descriptions-item>
 | 
				
			||||||
                  <template slot="label">合同附件</template>
 | 
					                  <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-item>  
 | 
				
			||||||
          </el-descriptions>
 | 
					          </el-descriptions>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,7 +89,25 @@
 | 
				
			||||||
                </el-form-item>
 | 
					                </el-form-item>
 | 
				
			||||||
                <el-form-item label="合同总金额" prop="contractAmount">
 | 
					                <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-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>
 | 
					            </el-form>
 | 
				
			||||||
        </div> 
 | 
					        </div> 
 | 
				
			||||||
        <div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;">
 | 
					        <div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;">
 | 
				
			||||||
| 
						 | 
					@ -136,7 +154,7 @@
 | 
				
			||||||
                        <template slot-scope="scope">
 | 
					                        <template slot-scope="scope">
 | 
				
			||||||
                            <el-input  v-model="scope.row.remark" placeholder="请输入" maxlength="20" clearable/>
 | 
					                            <el-input  v-model="scope.row.remark" placeholder="请输入" maxlength="20" clearable/>
 | 
				
			||||||
                        </template>
 | 
					                        </template>
 | 
				
			||||||
                    </el-table-column>
 | 
					                    </el-table-column> 
 | 
				
			||||||
                </el-table>
 | 
					                </el-table>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        </div>
 | 
					        </div>
 | 
				
			||||||
| 
						 | 
					@ -213,6 +231,7 @@
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
 | 
					import { imgUpLoadTwo } from '@/api/system/upload'
 | 
				
			||||||
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; 
 | 
					import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; 
 | 
				
			||||||
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage"; 
 | 
					import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage"; 
 | 
				
			||||||
import { getPurchaseContractInfoApi,addPurchaseContractApi,editPurchaseContractApi,delPurchaseContractApi } 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是否包括当天
 | 
					                return v.getTime() < (new Date().getTime() - 86400000);//  - 86400000是否包括当天
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        attachmentList:[],
 | 
				
			||||||
        contractMaterialList:[],//货品信息-表格数据
 | 
					        contractMaterialList:[],//货品信息-表格数据
 | 
				
			||||||
        batchIds:[],//货品信息-表格数据-多选
 | 
					        batchIds:[],//货品信息-表格数据-多选
 | 
				
			||||||
        openDialog:false,
 | 
					        openDialog:false,
 | 
				
			||||||
| 
						 | 
					@ -273,11 +293,13 @@ export default {
 | 
				
			||||||
        tableListData: [],//货品弹窗-货品表格数据
 | 
					        tableListData: [],//货品弹窗-货品表格数据
 | 
				
			||||||
        batchChosenMaterial:[],//货品弹窗-货品表格-选中的货品数组
 | 
					        batchChosenMaterial:[],//货品弹窗-货品表格-选中的货品数组
 | 
				
			||||||
        noMaterial:false, 
 | 
					        noMaterial:false, 
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
      };
 | 
					      };
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    created() {
 | 
					    created() {
 | 
				
			||||||
        this.getAreaTreeData()  
 | 
					        this.getAreaTreeData()  
 | 
				
			||||||
        this.getMaterialTree()  
 | 
					        this.getMaterialTree()  
 | 
				
			||||||
 | 
					        this.attachmentList=[]
 | 
				
			||||||
        if(this.$route.query.pageJson){ 
 | 
					        if(this.$route.query.pageJson){ 
 | 
				
			||||||
            this.pageJson = JSON.parse(this.$route.query.pageJson)
 | 
					            this.pageJson = JSON.parse(this.$route.query.pageJson)
 | 
				
			||||||
            this.getContractInfo()
 | 
					            this.getContractInfo()
 | 
				
			||||||
| 
						 | 
					@ -300,7 +322,15 @@ export default {
 | 
				
			||||||
                this.baseInfo = response.data;
 | 
					                this.baseInfo = response.data;
 | 
				
			||||||
                this.$set(this.baseInfo,'dateRange',[this.baseInfo.contractStartTime,this.baseInfo.contractEndTime]) 
 | 
					                this.$set(this.baseInfo,'dateRange',[this.baseInfo.contractStartTime,this.baseInfo.contractEndTime]) 
 | 
				
			||||||
                this.contractMaterialList = this.baseInfo.purchaseContractDetailList; 
 | 
					                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) => {
 | 
					                getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => {
 | 
				
			||||||
                    this.canteenOptions=response.rows||[];
 | 
					                    this.canteenOptions=response.rows||[];
 | 
				
			||||||
                    this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId)
 | 
					                    this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId)
 | 
				
			||||||
| 
						 | 
					@ -308,7 +338,7 @@ export default {
 | 
				
			||||||
                supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
 | 
					                supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
 | 
				
			||||||
                    this.supplierOptions = response.rows||[];
 | 
					                    this.supplierOptions = response.rows||[];
 | 
				
			||||||
                    this.$set(this.baseInfo,'supplierId',this.baseInfo.supplierId) 
 | 
					                    this.$set(this.baseInfo,'supplierId',this.baseInfo.supplierId) 
 | 
				
			||||||
                });   
 | 
					                });  
 | 
				
			||||||
            }); 
 | 
					            }); 
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        //区域树
 | 
					        //区域树
 | 
				
			||||||
| 
						 | 
					@ -444,7 +474,14 @@ export default {
 | 
				
			||||||
                    param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)  
 | 
					                    param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)  
 | 
				
			||||||
                    param.contractAmount = this.baseInfo.contractAmount*100;
 | 
					                    param.contractAmount = this.baseInfo.contractAmount*100;
 | 
				
			||||||
                    param.commitStatus=1
 | 
					                    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;
 | 
					                    this.noMaterial = false;
 | 
				
			||||||
                    if(this.contractMaterialList.length>0){ 
 | 
					                    if(this.contractMaterialList.length>0){ 
 | 
				
			||||||
                        this.contractMaterialList.forEach(item=>{
 | 
					                        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) {
 | 
					        formatDate(date) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -116,6 +116,12 @@
 | 
				
			||||||
                icon="el-icon-edit" v-if="scope.row.commitStatus==2"
 | 
					                icon="el-icon-edit" v-if="scope.row.commitStatus==2"
 | 
				
			||||||
                @click="handleView(scope.row)" 
 | 
					                @click="handleView(scope.row)" 
 | 
				
			||||||
            >详情</el-button>
 | 
					            >详情</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
 | 
					            <el-button
 | 
				
			||||||
                size="mini"
 | 
					                size="mini"
 | 
				
			||||||
                type="text"
 | 
					                type="text"
 | 
				
			||||||
| 
						 | 
					@ -162,6 +168,7 @@ export default {
 | 
				
			||||||
        return {
 | 
					        return {
 | 
				
			||||||
            // 遮罩层
 | 
					            // 遮罩层
 | 
				
			||||||
            loading: true,
 | 
					            loading: true,
 | 
				
			||||||
 | 
					            loadingBtn: false,
 | 
				
			||||||
            // 选中数组
 | 
					            // 选中数组
 | 
				
			||||||
            ids: [],
 | 
					            ids: [],
 | 
				
			||||||
            // 非单个禁用
 | 
					            // 非单个禁用
 | 
				
			||||||
| 
						 | 
					@ -322,13 +329,31 @@ export default {
 | 
				
			||||||
                this.$modal.msgSuccess("删除成功");
 | 
					                this.$modal.msgSuccess("删除成功");
 | 
				
			||||||
            }).catch(() => {});
 | 
					            }).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) {
 | 
					        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
 | 
					            // 格式化为 YYYY-MM-DD
 | 
				
			||||||
            date = new Date(date)
 | 
					            date = new Date(date)
 | 
				
			||||||
            const year = date.getFullYear();
 | 
					            const year = date.getFullYear();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue