采购合同接口对接2
This commit is contained in:
		
							parent
							
								
									e2b2adf004
								
							
						
					
					
						commit
						c8deff366d
					
				| 
						 | 
				
			
			@ -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>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -90,6 +90,24 @@
 | 
			
		|||
                <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 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;">
 | 
			
		||||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			@ -445,6 +475,13 @@ export default {
 | 
			
		|||
                    param.contractAmount = this.baseInfo.contractAmount*100;
 | 
			
		||||
                    param.commitStatus=1
 | 
			
		||||
                    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=>{
 | 
			
		||||
| 
						 | 
				
			
			@ -551,6 +588,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) {
 | 
			
		||||
            // 格式化为 YYYY-MM-DD
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue