<!--现货销售合同费用-->
<!--2019年5月30日 20:25:16 by jlx-->
<template>
  <div>
    <BaseHeaderLayout :leftSpan="8">
      <template slot="left">
          <el-select style='width:200px;'  filterable v-model="searchTypeText" placeholder="" class="typeselect" @change="selectcontract"
          :value="searchType">
          <el-option v-for="item in contractList" :key="item.id" :label="item.contractNo+'('+item.status+')'" :value="item.contractNo"
            style="color: #8890b1" />
        </el-select>
        <span style='padding-left:10px;'>买方：{{buger}}</span>
      </template>
      <template slot="right">
      </template>
    </BaseHeaderLayout>
    <BaseHeaderLayout :leftSpan="16">
      <template slot="left">
        <ws-button :type="type==''?'primary':''" @click="handlestatus('')">全部</ws-button>
          <ws-button :type="type=='1'?'primary':''" @click="handlestatus(1)">收入</ws-button>
          <ws-button :type="type=='2'?'primary':''" @click="handlestatus(2)">支出</ws-button>
          <span style='padding-left:10px;'>粮款：{{grain}}</span>
          <span style='padding-left:10px;'>合计收入：{{income}}</span>
          <span style='padding-left:10px;'>合计支出：{{expend}}</span>
          <span style='padding-left:10px;'>付款中：{{nograinexpend}}</span>
          
      </template>
      <template slot="right">
        <!-- <ws-button type="primary" @click="handleAdd()"
          v-hasPermission="`contractManagement.buyContract.buyContractInfo.add`">运费</ws-button> -->
          <ws-button type="primary" @click="handleAdd(2)"
          v-hasPermission="`contractManagement.nonContract.nonContractInfo.add`">请款</ws-button>
          <ws-button type="primary" @click="handleAdd(1)"
          v-hasPermission="`contractManagement.nonContract.nonContractInfo.add`">收款</ws-button>
      </template>
    </BaseHeaderLayout>
    <el-table class="wenzi" :data="costList.records" style="width: 100%; margin-top: 10px"
      height="calc(100% - 105px)">
      <el-table-column type="index" label="序号">
        <template scope="scope">
          <span v-if="scope.$index < 9">0{{ scope.$index + 1 }}</span>
          <span v-else>{{ scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="type" label="类型" width="150">
        <template slot-scope="scope">
          <span v-if='scope.row.type==1&&scope.row.costType==1'>收入（粮）</span>
          <span v-if='scope.row.type==1&&scope.row.costType!=1'>收入</span>
          <span v-if='scope.row.type==2&&scope.row.costType==1'>支出（粮）</span>
          <span v-if='scope.row.type==2&&scope.row.costType!=1'>支出</span>
        </template>
      </el-table-column>
      <el-table-column prop="costName" label="款项名称" width="80">
      </el-table-column>
      <!-- <el-table-column prop="grade" label="品级" width="80">
        <template slot-scope="scope">
          <span v-if="scope.row.grade == '一等品'" class="top-grade">{{
            scope.row.grade
          }}</span>
          <span v-if="scope.row.grade == '二等品'" class="second-class">{{
            scope.row.grade
          }}</span>
          <span v-if="scope.row.grade == '三等品'" class="third-class">{{
            scope.row.grade
          }}</span>
          <span v-if="scope.row.grade == '等外'" class="substandard">{{
            scope.row.grade
          }}</span>
        </template>
      </el-table-column> -->
      <el-table-column width='130' prop="costPrice" label="款项金额（元）">
      </el-table-column>
      <el-table-column prop="addressUrl" label="附件">
        <template slot-scope="scope">
          <img width="18" height="20" style="vertical-align: text-top; position: relative; top: -1px"
            src="../../../public/img/fujian.png" @click="fujian(scope.row)" alt="" />
          <span v-if="scope.row.addressUrlArray != null">
            {{
              scope.row.addressUrlArray.length == 0
                ? ''
                : scope.row.addressUrlArray.length
            }}
          </span>
        </template>
      </el-table-column>
      <el-table-column width='130' prop="personName" label="请款人/收款人">
      </el-table-column>
      <el-table-column width='130' prop="payee" label="回款方">
      </el-table-column>
      <el-table-column width='130' prop="payDeadline" label="支付日期">
      </el-table-column>
      <el-table-column width='130' prop="createDate" label="录入日期">
      </el-table-column>
      <el-table-column width='130' prop="status" label="状态">
         <template slot-scope="scope">
           <span v-if='scope.row.approveStatus'>{{scope.row.approveStatus}}</span><span v-else>{{scope.row.status}}</span>
           <i @click="handlerecord(scope.row)" class="el-icon-s-claim"></i>
        </template>
      </el-table-column>
      <el-table-column prop="address" label="操作" width="360">
        <template slot-scope="scope">
          <div v-if='scope.row.type==2'>
            <div style='display:inline-block;' v-if='scope.row.taskId'>
              <ws-button type="primary" @click="handleaudit(scope.row)">审核</ws-button>
            </div>
             <div style='display:inline-block;' v-if='scope.row.status=="未付款"'>
                <ws-button type="primary" @click="handlepayment(scope.row)"
            v-hasPermission="`contractManagement.nonContract.nonContractInfo.status`">付款</ws-button>
             </div>
            <div style='display:inline-block;' v-if='scope.row.personName==staffName'>
            <ws-button type="primary" @click="handleedit(scope.row)"
            v-hasPermission="`contractManagement.nonContract.nonContractInfo.edit`">编辑</ws-button>
            </div>
            <div style='display:inline-block;' v-if='scope.row.status=="已驳回"&&scope.row.personName==staffName'>
              <ws-button type="danger" @click="handleDelete(scope.row)" v-hasPermission="`contractManagement.nonContract.nonContractInfo.delete`">删除</ws-button>
            </div>
           
          </div>
          
        </template>
      </el-table-column>
    </el-table>
    <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage"
      :page-size="deptCircularPage.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="deptBudgetTotal">
    </el-pagination>

    <WinseaContentModal v-model="accessoryTFs" :title="$t('system.noticeCircular.information')">
      <div v-if='appendixIdss.length>0'>
        <img style='border:1px solid #ccc;' v-for='item in appendixIdss' :src="item" alt="">
      </div>
      
    </WinseaContentModal>
    <el-dialog width='30%' :visible.sync="dialogVisible" :title="title"  class='title_css' top="20vh">
      <el-form style='margin:0 auto;' ref="form" :model="deptBudgetList" label-width="100px">
        <el-form-item v-if='status==1||status==2||status==5' label="类型">
          <el-radio-group v-model="costType">
            <el-radio :label="1">粮款</el-radio>
            <el-radio :label="2">非粮款</el-radio>
          </el-radio-group>
        </el-form-item>
        <el-form-item v-else label="类型">
          <ws-select :disabled="disabled" v-model="costType" placeholder="" class="typeselect"
          :value="costType">
          <ws-option  key="1" label="粮款" value="1" style="color: #8890b1" />
          <ws-option  key="2" label="非粮款" value="2" style="color: #8890b1" />
        </ws-select>
        </el-form-item>
        <el-form-item label="款项名称">
          <el-input :disabled='disabled' v-model="deptBudgetList.costName" placeholder="请输入款项名称"></el-input>
        </el-form-item>
        <!-- <el-form-item label="费用名称">
          <el-input :disabled='disabled' v-model="deptBudgetList.costName"></el-input>
        </el-form-item> -->
        <el-form-item label="金额（元）">
          <el-input :disabled='disabled' v-model="deptBudgetList.costPrice" placeholder="请输入金额"></el-input>
        </el-form-item>
        <el-form-item v-if='status==1||currectcost.type==1' label="回款方">
          <el-input :disabled='disabled' v-model="deptBudgetList.payee" placeholder="请输入回款方"></el-input>
        </el-form-item>
        <el-form-item label="备注">
          <!-- <el-input :disabled='disabled' type="textarea" v-model="deptBudgetList.remark"></el-input> -->
           <el-input type="textarea" v-model="deptBudgetList.remark" placeholder="输入备注，不超过50个字" maxlength="50" :rows="4"></el-input>
        </el-form-item>
        
        <el-form-item label="附件">
          <el-upload ref='uploadfiles' :file-list='dataList' action="https://www.zthymaoyi.com/upload/admin" list-type="picture-card"
            :on-success="handlefujian" :on-remove="handleRemove" class="photo2">
            <i class="el-icon-plus"></i>
          </el-upload>
        </el-form-item>
        <el-form-item v-if='status==3' label="审核意见">
          <el-input type="textarea" v-model="auditMind"></el-input>
        </el-form-item>
        <el-form-item v-if='status==1' label="收款日期">
          <ws-date-picker v-model="deptBudgetList.payDeadline" type="date" placeholder="请选择收款日期"
              value-format="yyyy-MM-dd" />
        </el-form-item>
        <el-form-item v-if='status==4' label="付款日期">
          <ws-date-picker v-model="deptBudgetList.payDeadline" type="date" placeholder="请选择付款日期"
              value-format="yyyy-MM-dd" />
        </el-form-item>
      </el-form>
      <div style='text-align:center;' v-if='status==1||status==2||status==4||status==5'>
        <el-button @click='dialogVisible=false'>取消</el-button>
        <el-button @click='confirm' type="primary">提交</el-button>
      </div>
      <div style='text-align:center;' v-if='status==3'>
        <el-button @click='cancel'>驳回</el-button>
        <el-button @click='confirm' type="primary">通过</el-button>
      </div>
    </el-dialog>
    <el-dialog width='50%' :visible.sync="dialogVisible1" title="审核记录" >
      <div v-for="item in recordList">
        <div style='width:100%;justify-content: space-between;' class='flex'>
          <div>{{item.operateUser}}</div>
          <div>{{item.dealMsg}}</div>
          <div>{{item.createDate}}</div>
        </div>
        <div style='width:100%;text-align:center;'>{{item.verifyRemark}}</div>
      </div>
    </el-dialog>
  </div>
</template>
<script>
  import {
    contractcost,
    getcontract,
    addcontractcost,
    editcontractcost,
    delcontractcost,
    payment,
    billoperatehis
    // export1,
    // editstatus,
    // billoperatehis,
    // deletecontract,
    // editInfo,
  } from '@/model/contarct/index'
  import {
    woekflowhandle,gettaskhistories
  } from '@/model/tasksport/index'
  import {
    downloadFile
  } from '@/utils/batchDown'
  import Pagination from '@/components/Pagination'
  import WsUpload from '@/components/WsUpload'
  import {
    dayjs,
    EventBus
  } from 'base-core-lib'
  export default {
    name: 'viewSpareMoney',
    components: {
      WsUpload,
      Pagination,
    },
    watch: {
      vesselId(val) {
        this.getList()
      },
      isShow(val) {
        this.showType = val
      },
    },
    data() {
      return {
        id: '',
        // 船舶类型
        monetaryKey: null,
        // 表格显示数据
        tableDate: [],
        size: 10,
        // 是否显示
        showType: true,
        // 年
        year: '',
        title:'',
        costType:1,
        buger:'',
        deptBudgetTotal: 0,
        currentPage: 1,
        recordList:[],
        pageSize: 9999,
        searchType: 1,
        dialogVisible1:false,
        type:'',
        searchTypeText: '',
        searchKeyWord: '',
        contractType: 1,
        dataList:[],
        startDate: null,
        endDate: null,
        addressUrls: [],
        costList:{},
        currectcost:{},
        dialogVisible:false,
        contractId:0,
        status:'',
        contractNo:'',
        disabled:false,
        // 提交类型
        submitType: true,
        auditMind:'',
        grain:0,
        income:0,
        expend:0,
        nograinexpend:0,
        staffName:localStorage.getItem('ws-pf_staffName'),
        paymentScreenshot:[],
        deptCircularPage: {},
        date: {
          year: dayjs().format('YYYY'),
          month: dayjs().format('MM'),
        },
        contractList: [],
        deptBudgetList: {},
        historyList: [],
        appendixIdss: [],
        compId: localStorage.getItem('ws-pf_compId'),
        pickerBeginDateBefore: {
          disabledDate: (time) => {
            return time.getTime() > Date.now()
          },
        },
        accessoryTFs: false,
        value1: '',
        value2: '',
      }
    },
    activated() {
      //cg.viewBudget
      //cg.viewSpareMoney
      // this.getVesselData();
            this.contractId=this.$route.query.id
            this.contractNo=this.$route.query.contractNo
            this.searchTypeText=this.$route.query.contractNo+'('+this.$route.query.status+')'
            this.buger=this.$route.query.buger
      getcontract({flag:0}).toPromise()
          .then((response) => {
            this.contractList=response
            // this.contractId=response[0].id
            // this.contractNo=response[0].contractNo
            // this.searchTypeText=response[0].contractNo
            // this.seller=response[0].seller
            this.getList()
          })
      
      this.showType = this.isShow
    },
    methods: {
      handlestatus(status){
        this.type=status
        this.getList()
      },
      handleedit(row){
        if(row.type==1){
          this.title='收款'
        }else{
          this.title='请款'
        }
        this.status=5
        this.deptBudgetList=row
        this.costType=row.costType
        if(row.addressUrl){
          this.dataList=[]
          this.paymentScreenshot=row.addressUrl.split(',')
          for (let i = 0; i < this.paymentScreenshot.length; i++) {
            this.dataList.push({url:this.paymentScreenshot[i]})
            
          }
        }
        this.currectcost=row
        this.dialogVisible=true
      },
      handlerecord(row){
        gettaskhistories({ businessKey: row.id,
            workflowId: row.workflowId}).toPromise()
                .then((response) => {
                  this.recordList=response
                  this.dialogVisible1=true
                }).catch((response) => {})
        
      },
      handleaudit(row){
        console.log(row)
        this.status=3
        this.costType=row.costType
        this.deptBudgetList=row
        this.currectcost=row
        if(row.addressUrl){
          this.dataList=[]
          this.paymentScreenshot=row.addressUrl.split(',')
          for (let i = 0; i < this.paymentScreenshot.length; i++) {
            this.dataList.push({url:this.paymentScreenshot[i]})
            
          }
        }
        this.disabled=true
        this.dialogVisible=true
      },
      handlepayment(row){
        this.status=4
        this.costType=row.costType
        this.currectcost=row
        this.disabled=true
        this.deptBudgetList=row
        if(row.addressUrl){
          this.dataList=[]
          this.paymentScreenshot=row.addressUrl.split(',')
          for (let i = 0; i < this.paymentScreenshot.length; i++) {
            this.dataList.push({url:this.paymentScreenshot[i]})
            
          }
        }
        this.dialogVisible=true
      },
      handlefujian(file) {
        // console.log(file)
        this.paymentScreenshot.push(file.url)
        // this.dialogVisible = true
      },
      handleRemove(file) {
        // console.log(file)
        for (let i = 0; i < this.paymentScreenshot.length; i++) {
          if(this.paymentScreenshot[i]==response.url){
            this.paymentScreenshot.splice(i, 1)
          }
          
        }
      },
       handleSizeChange(val) {
        console.log(`每页 ${val} 条`)
        this.pageSize = val
        this.getList()
      },
      handleCurrentChange(val) {
        this.currentPage = val
        console.log(`当前页: ${val}`)
        this.getList()
      },
      selectcontract(e){
        for (let i = 0; i < this.contractList.length; i++) {
          if(this.contractList[i].contractNo==e){
            this.contractId=this.contractList[i].id
            this.contractNo=this.contractList[i].contractNo
            this.searchTypeText=this.contractList[i].contractNo
            this.buger=this.contractList[i].buger
            this.getList()
          }
          
        }
      },
      cancel(){
        woekflowhandle({taskId: this.currectcost.taskId,
                approved: false,
                auditMind: this.auditMind,
                needReapply: false,})
                .toPromise()
                .then((response) => {
                  this.$notify.success({
                    title: '成功',
                    message: '驳回成功',
                  })
                  this.dialogVisible=false
                  this.deptBudgetList={}
                  this.paymentScreenshot=[]
                  this.$refs.uploadfiles.clearFiles()
                  this.getList()
                }).catch((response) => {})
      },
      confirm(){
        // addcontractcost()
         var text = ''
        if(this.status == 2||this.status == 1){
          if(!this.deptBudgetList.costName){
            this.$message({
              message: '款项名称不能为空',
              type: 'warning',
            })
            return
          }
          if(!this.deptBudgetList.costPrice){
            this.$message({
              message: '金额不能为空',
              type: 'warning',
            })
            return
          }
          if(this.deptBudgetList.costName.length<1||this.deptBudgetList.costName.length>15){
            this.$message({
              message: '费用名称输入错误',
              type: 'warning',
            })
            return
          }
          if(this.deptBudgetList.costPrice<0.01||this.deptBudgetList.costPrice>100000000){
            this.$message({
              message: '费用名称输入错误',
              type: 'warning',
            })
            return
          }
          if(String(this.deptBudgetList.costPrice).indexOf(".")!=-1){
            if(String(this.deptBudgetList.costPrice).substring(String(this.deptBudgetList.costPrice).indexOf(".")+1,this.deptBudgetList.costPrice.length)>2){
              this.$message({
                message: '费用名称输入错误',
                type: 'warning',
              })
              return
            }
          }
          if(this.deptBudgetList.remark&&this.deptBudgetList.remark.length<0||this.deptBudgetList.remark&&this.deptBudgetList.remark.length>50){
            this.$message({
              message: '备注不超过50字',
              type: 'warning',
            })
            return
          }
        }
        if(this.status == 1){
          if(this.paymentScreenshot.length==0){
            this.$message({
              message: '附件不能为空',
              type: 'warning',
            })
            return
          }
        }
        if (this.status == 2||this.status == 5&&this.currectcost.type==2) {
          text =
            '确认提交请款信息？'
        } else if(this.status == 1) {
          text = '确认提交收款信息？'
        } else if(this.status == 3&&this.currectcost.type==2) {
          text = '确认通过请款信息？'
        }else if(this.status == 4) {
          text = '确认提交付款信息？'
        }
        this.$confirm(text, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          })
          .then(() => {
            this.deptBudgetList.contractId=this.contractId
              this.deptBudgetList.contractNo=this.contractNo
              this.deptBudgetList.contractType=this.contractType
              this.deptBudgetList.costType=this.costType
              this.deptBudgetList.compId=this.compId
              this.deptBudgetList.addressUrl=this.paymentScreenshot.toString()
              this.deptBudgetList.personName=localStorage.getItem('ws-pf_staffName')
            if(this.status==1||this.status==2){
              this.deptBudgetList.type=this.status
              // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
              addcontractcost(this.deptBudgetList)
                .toPromise()
                .then((response) => {
                  this.$notify.success({
                    title: '成功',
                    message: '提交成功',
                  })
                  this.dialogVisible=false
                  this.deptBudgetList={}
                  this.paymentScreenshot=[]
                  this.$refs.uploadfiles.clearFiles()
                  this.getList()
                }).catch((response) => {})
            }else if(this.status==5){
              this.deptBudgetList.type=this.currectcost.type
              // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
              editcontractcost(this.deptBudgetList)
                .toPromise()
                .then((response) => {
                  this.$notify.success({
                    title: '成功',
                    message: '编辑成功',
                  })
                  this.dialogVisible=false
                  this.deptBudgetList={}
                  this.paymentScreenshot=[]
                  this.$refs.uploadfiles.clearFiles()
                  this.getList()
                }).catch((response) => {})
            }else if(this.status==3){
              // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
              woekflowhandle({taskId: this.currectcost.taskId,
                approved: true,
                auditMind: this.auditMind,
                needReapply: false,})
                .toPromise()
                .then((response) => {
                  this.$notify.success({
                    title: '成功',
                    message: '通过成功',
                  })
                  this.dialogVisible=false
                  this.deptBudgetList={}
                  this.paymentScreenshot=[]
                  this.$refs.uploadfiles.clearFiles()
                  this.getList()
                }).catch((response) => {})
            }else if(this.status==4){
              // this.deptBudgetList.personName=localStorage.getItem('ws-pf_roleName')+localStorage.getItem('ws-pf_staffName')
              payment(this.deptBudgetList)
                .toPromise()
                .then((response) => {
                  this.$notify.success({
                    title: '成功',
                    message: '付款成功',
                  })
                  this.dialogVisible=false
                  this.deptBudgetList={}
                  this.paymentScreenshot=[]
                  this.$refs.uploadfiles.clearFiles()
                  this.getList()
                }).catch((response) => {})
            }
            
          })
          .catch(() => {
            return false
          })
      },
      handleAdd(status){
        this.status=status
        if(status==1){
          this.title='收款'
        }else if(status==2){
          this.title='请款'
        }
        this.dialogVisible=true
      },
      onChange() {
        this.$refs.upload
          .handleSaveBill()
          .then(async (response) => {
            this.deptBudgetList.addressUrl = response
            this.deptBudgetList.id = this.id
            this.deptBudgetList.flag = 1
            editInfo(this.deptBudgetList)
              .toPromise()
              .then((response) => {
                this.accessoryTFs = false
                this.$message.success('上传成功')
                this.getList()
              })
          })
          .catch((res) => {
            EventBus.$emit('error', (JSON.parse(res) || {}).message)
            this.$refs.upload.clearFiles()
          })
      },
      getList() {
        contractcost({
            compId: localStorage.getItem('ws-pf_compId'),
            contractType: this.contractType,
            currentPage: this.currentPage,
            pageSize: this.pageSize,
            contractId:this.contractId,
            contractNo:this.contractNo,
            searchType:this.type
          })
          .toPromise()
          .then((response) => {
            var income=0,expend=0,grainincome=0,grainexpend=0,nograinexpend=0
            this.costList=response
            for (var i = 0; i < response.records.length; i++) {
              if(response.records[i].addressUrl){
                response.records[i].addressUrlArray=response.records[i].addressUrl.split(',')
              }
              // 收入
              if(response.records[i].type==1){
                income+=response.records[i].costPrice
                if(response.records[i].costType==1){
                  grainincome+=response.records[i].costPrice
                }
              }
              // 支出
              if(response.records[i].type==2){
                expend+=response.records[i].costPrice
                if(response.records[i].costType==1&&response.records[i].status=='已付款'){
                  grainexpend+=response.records[i].costPrice
                }else{
                  nograinexpend+=response.records[i].costPrice
                }
              }
            }
            console.log(grainexpend,grainincome)
            this.income=income.toFixed(2)
            this.expend=expend.toFixed(2)
            this.grain=(grainincome-grainexpend).toFixed(2)
            this.nograinexpend=nograinexpend.toFixed(2)
            // this.deptCircularPage.currentPage = response.current
            // this.deptCircularPage.pageSize = response.size
            // this.deptBudgetTotal = response.total
            // this.contractList = response
            // for (var i = 0; i < response.records.length; i++) {
            //   var arr = new Array()
            //   this.addressUrls[i] = new Array()
            //   if (this.contractList.records[i].addressUrl != null) {
            //     arr = this.contractList.records[i].addressUrl.split(',')
            //     this.addressUrls[i] = arr
            //   }
            // }
          })
      },
    
      fujian(row) {
        this.id = row.id
        this.accessoryTFs = true
        this.appendixIdss = row.addressUrlArray
        console.log(this.appendixIdss)
      },
      handleExamine(row) {
        console.log(row)
        this.$router.push({
          name: 'purchaseContractExamine',
          query: {
            id: row.id,
            status: row.status,
          },
        })
      },
      handleEdit(row) {
        this.$router.push({
          name: 'purchaseContractEdit',
          query: {
            id: row.id,
          },
        })
      },
      // 关闭 dialog时 处理文件url 初始化upload组件
      history(row) {
        console.log(row)
        billoperatehis({
            id: row.id,
          })
          .toPromise()
          .then((response) => {
            this.historyList = response
          })
      },
      find() {
        if (this.value2) {
          this.startDate = this.dateFormat('YYYY-mm-dd', this.value2[0])
          this.endDate = this.dateFormat('YYYY-mm-dd', this.value2[1])
        } else {
          this.startDate = ''
          this.endDate = ''
        }
        this.currentPage = 1
        this.getList()
      },
      async exportlist() {
        const {
          data
        } = await export1({
          compId: localStorage.getItem('ws-pf_compId'),
          contractType: this.contractType,
          goodsType: this.goodsType,
          currentPage: this.currentPage,
          pageSize: this.pageSize,
          searchType: this.searchType,
          searchKeyWord: this.searchKeyWord,
          startDate: this.startDate,
          endDate: this.endDate,
        }, {}, {
          responseType: 'blob',
        }).toPromise()
        downloadFile({
          res: data,
          fileName: `${
          this.date.year + (this.date.month ? `-${this.date.month}` : '')
        }_采购合同`,
          type: 'xls',
        })
      },
      // deletecontract(){},
      //删除
      handleDelete(row) {
        var text = ''
        if (row.type == 1) {
          text =
            '确认删除收款信息？'
        } else {
          text = '确认删除请款信息？'
        }
        this.$confirm(text, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning',
          })
          .then(() => {
            delcontractcost({
                id: row.id,
              })
              .toPromise()
              .then((response) => {
                this.$notify.success({
                  title: '成功',
                  message: '删除成功',
                })
                this.getList()
              })
              .catch((response) => {})
          })
          .catch(() => {
            return false
          })
      },
    },
  }
</script>
<style lang="scss" scoped>
 /deep/.base_header_layout .grid-content{
   height:36px;
 }
 /deep/.title_css .el-dialog__header {
    text-align: center !important;
    border-radius: 4px;
  }
</style>
