<template>
  <div class="app-container">
    <el-card>
      <div>
        <!--<el-select v-model="entryNameValue" clearable filterable placeholder="项目名称" size="small" style="width:180px;margin: 3px 10px 0 0px;">-->
        <!--<el-option-->
        <!--v-for="item in entryName"-->
        <!--:key="item.value"-->
        <!--:label="item.label"-->
        <!--:value="item.value"/>-->
        <!--</el-select>-->
        <el-input v-model="customerName1" clearable size="small" style="width:220px;" placeholder="请输入客户名称/项目名称/合同编号"/>
        <span style="font-size: 13px;margin-left: 10px">签订日期</span>
        <el-date-picker
          v-model="dateRange"
          :picker-options="pickerOptions"
          size="small"
          type="daterange"
          align="center"
          style="width: 240px;margin: 3px 0"
          value-format="yyyy-MM-dd"
          format="yyyy-MM-dd"
          range-separator="～"
          start-placeholder="开始日期"
          end-placeholder="结束日期"/>
        <el-button type="primary" icon="el-icon-search" size="small" style="margin-left: 10px" plain @click="PageSize = 30;PageCurrent = 1;fetchTableData1()" >查询</el-button>
        <el-button type="distribution" icon="el-icon-circle-plus-outline" size="small" style="margin-left: 10px" @click="ADD()" >合同</el-button>
        <el-tooltip v-show="true" :open-delay="1000" effect="dark" content="导出营销合同" placement="top">
          <el-button type="primary" plain class="el-icon-download" size="small" style="margin: 10px 0 0 410px" @click="exportExcel">导出</el-button>
        </el-tooltip>
      </div>
    </el-card>
    <el-card>
      <el-table
        v-loading="listLoading"
        :data="tableData1"
        :row-key="getRowKeys"
        :expand-row-keys="expands"
        :header-cell-style="{fontFamily:'YouYuan',fontSize:'13px',fontWeight:200}"
        highlight-current-row
        style="margin: 3px 0px;width: 1208px"
        height="700"
        border
        stripe
        size="mini"
        @row-click="fetchExecutionProgressdata"
        @expand-change="selectMachine">
        <el-table-column type="expand" label="详情" width="50">
          <template slot-scope="scope">
            <el-table :data="tableData2" :header-cell-style="{fontFamily:'YouYuan',fontSize:'13px',fontWeight:200}" class="subTableHeader" size="mini" border style="width: 482px; text-align: center">
              <el-table-column label="机床型号" align="center" width="140">
                <template slot-scope="scope">
                  {{ scope.row.机床图号 }}
                </template>
              </el-table-column>
              <el-table-column label="机床名称" align="center" width="160" show-overflow-tooltip>
                <template slot-scope="scope">
                  {{ scope.row.机床名称 }}
                </template>
              </el-table-column>
              <el-table-column label="机床数量" align="center" width="80">
                <template slot-scope="scope">
                  {{ scope.row.机床数量 }}
                </template>
              </el-table-column>
              <el-table-column label="操作" width="100" align="center">
                <template slot-scope="scope">
                  <el-tooltip :open-delay="1000" effect="dark" content="编辑" placement="top">
                    <div style="display: inline-block">
                      <el-button
                        size="mini"
                        type="text"
                        icon="el-icon-edit-outline"
                        @click="editMachine(scope.row);flag = 2"/>
                    </div>
                  </el-tooltip>
                  <el-tooltip :open-delay="1000" effect="dark" content="删除" placement="top">
                    <div style="display: inline-block">
                      <el-button
                        size="mini"
                        type="text"
                        style="margin-left: 20px"
                        icon="el-icon-delete"
                        @click="deleteMachine(scope.row)"/>
                    </div>
                  </el-tooltip>
                </template>
              </el-table-column>
            </el-table>
          </template>
        </el-table-column>
        <el-table-column align="center" label="合同编号" prop="合同编号" width="118">
          <template slot-scope="scope">
            {{ scope.row.合同编号 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="客户名称" prop="客户名称" width="180" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.客户名称 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="项目名称" prop="项目名称" width="139" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.项目名称 }}
          </template>
        </el-table-column>
        <el-table-column align="right" label="合同金额(万元)" prop="合同总额" width="120" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ Number(scope.row.合同总金额).toFixed(2) }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="付款方式" width="80">
          <template slot-scope="scope">
            {{ scope.row.付款方式 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="签订日期" width="90">
          <template slot-scope="scope">
            {{ scope.row.合同签订日期&&scope.row.合同签订日期!=='1900/1/1' ? scope.row.合同签订日期 : '-' }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="营销经理" width="80">
          <template slot-scope="scope">
            {{ scope.row.营销经理 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="发货节点" width="80">
          <template slot-scope="scope">
            {{ scope.row.发货节点&&scope.row.发货节点!=='1900/1/1' ? scope.row.发货节点 : '-' }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="合同备注" width="120">
          <template slot-scope="scope">
            {{ scope.row.合同信息备注 }}
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="130">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-circle-plus-outline"
              @click.stop="addMachine(scope.row);flag = 1">机床</el-button>
            <el-tooltip :open-delay="1000" effect="dark" content="编辑" placement="top">
              <div style="display: inline-block">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-edit-outline"
                  style="margin-left: 10px"
                  @click.stop="handleEdit(scope.row)"/>
              </div>
            </el-tooltip>
            <el-tooltip :open-delay="1000" effect="dark" content="删除" placement="top">
              <div style="display: inline-block">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-delete"
                  style="margin-left: 10px"
                  @click.stop="handleDelete(scope.row)"/>
              </div>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
      <div class="block" >
        <el-pagination
          :current-page="PageCurrent"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="PageSize"
          :total="total"
          style="margin-bottom: 3px;"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"/>
      </div>
    </el-card>
    <el-card v-show="uploader" style="min-height: 145px;">
      <h4 style="margin: 3px;">纪要文件</h4>
      <div style="float: left;">
        <el-upload
          :action="action"
          :on-success="uploadSuccess"
          :on-error="uploadFailure"
          :show-file-list="showFileList"
          :file-list="fileList"
          class="upload-demo"
          multiple>
          <el-button size="small" type="primary" plain icon="el-icon-upload2">点击上传</el-button>
        </el-upload>
      </div>
      <div v-for="(file, key) in hadFile" :key="key">
        <div class="wrapper">
          <div class="content">
            <div class="action">
              <a class="delete" @click="deleteFileData(file.id)">删除</a>
            </div>
            <div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
            <div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
            <div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
            <div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
            <div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
            <div v-else class="icon"><svg-icon icon-class="file" /></div>
            <a :href="file.url"><div class="info">{{ file.name }}</div></a>
          </div>
        </div>
      </div>
    </el-card>
    <!--新增合同信息对话框-->
    <el-dialog v-el-drag-dialog :title="title" :visible.sync="dialogFormVisible1" center style="min-height: 300px; " width="700px">
      <el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="120px" class="demo-ruleForm">
        <el-row>
          <el-col :span="12" style="height: 2px">
            <el-form-item label="项目名称" prop="EntryName" style="">
              <el-input v-model="form.EntryName" size="small" placeholder="请输入项目名称" style="width:180px"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="投标保证金(万元)" prop="">
              <el-input v-model="form.bidding" readonly clearable size="small" style="width:180px" placeholder="若缴纳保证金请选择" @dblclick.native="openBidding()" @clear="clearBidding()"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同总额(万元)" prop="contractAmount">
              <el-input v-model="form.contractAmount" clearable size="small" style="width:180px" placeholder="请输入合同金额" @change="fun()"/>
            </el-form-item>
          </el-col>
          <el-col v-show="false" :span="12" >
            <el-form-item label="已完成进度" prop="executionProgressID">
              <el-select v-model="form.executionProgressID" :disabled="infoDisable" placeholder="请输入目前执行进度" size="small" style="width: 180px">
                <el-option
                  v-for="item in executionProgress"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"/>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="营销经理" prop="MarketingManagerValue">
              <el-input v-model="form.MarketingManagerValue" readonly clearable size="small" style="width:180px" placeholder="请双击选择营销经理" @dblclick.native="openName()" @clear="clear()"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="合同签订日期" prop="contractSigningDate">
              <el-date-picker
                v-model="form.contractSigningDate"
                value-format="yyyy-MM-dd"
                size="small"
                type="date"
                style="width: 180px"
                placeholder="合同签订日期"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="图纸会签节点" prop="drawingJointSignNode">
              <el-date-picker
                v-model="form.drawingJointSignNode"
                value-format="yyyy-MM-dd"
                size="small"
                type="date"
                style="width: 180px"
                placeholder="请选择图纸会签节点"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="设备预验节点" prop="EquipmentPreAcceptanceNode">
              <el-date-picker
                v-model="form.EquipmentPreAcceptanceNode"
                value-format="yyyy-MM-dd"
                size="small"
                type="date"
                style="width: 180px"
                placeholder="请选择设备预验收节点"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="发货节点" prop="ConsignmentNode">
              <el-date-picker
                v-model="form.ConsignmentNode"
                value-format="yyyy-MM-dd"
                size="small"
                type="date"
                style="width: 180px;"
                placeholder="请选择发货节点"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="安装调试节点" prop="installDebugNode">
              <el-date-picker
                v-model="form.installDebugNode"
                value-format="yyyy-MM-dd"
                size="small"
                type="date"
                style="width: 180px"
                placeholder="请选择安装调试节点"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="客户名称" prop="customerName">
              <el-input v-model="form.customerName" readonly size="small" placeholder="请双击选择客户" style="width:180px" clearable @dblclick.native="CustomerChange()" @clear="clear1()"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="付款方式" prop="付款方式">
              <el-select v-model="form.付款方式" placeholder="请选择付款方式" size="small" style="width: 180px">
                <el-option
                  v-for="item in money"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"/>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="备注" prop="remark">
              <el-input
                v-model="form.remark"
                style="width: 180px"
                type="textarea"
                autosize
                placeholder="请输入项目介绍"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" icon="el-icon-circle-close" @click="callOff('form')">取消</el-button>
        <el-button type="distribution" size="small" icon="el-icon-circle-check" @click="submit('form')">确 定</el-button>
      </div>
    </el-dialog>
    <!--新增机床对话框-->
    <el-dialog v-el-drag-dialog :title="title1" :visible.sync="dialogFormVisible2" center style="min-height: 280px" width="280px">
      <el-form ref="form1" :model="form1" :rules="rules1" label-width="80px">
        <el-form-item label="机床型号" prop="设备型号">
          <el-input v-model="form1.设备型号" size="small" placeholder="请输入设备型号" style="width:130px"/>
        </el-form-item>
        <el-form-item label="机床名称" prop="设备名称">
          <el-input v-model="form1.设备名称" size="small" placeholder="请输入设备名称" style="width:130px"/>
        </el-form-item>
        <el-form-item label="机床数量" prop="机床数量">
          <el-input-number :min="1" v-model="form1.机床数量" controls-position="right" style="width:130px" size="small"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" icon="el-icon-circle-close" @click="callOff2('form1')">取消</el-button>
        <el-button type="distribution" size="small" icon="el-icon-circle-check" @click="submitMachine('form1')">确认</el-button>
      </div>
    </el-dialog>

    <!--营销经理选择-->
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisiblePeople" title="营销经理" center width="300px">
      <div style="margin-top: 0px;width: 250px">
        <el-table :data="tableData4" :header-cell-style="{fontFamily:'YouYuan',fontSize:'13px',fontWeight:200}" border style="width: 120px; text-align: center;display: inline-block;vertical-align: top;" size="mini" highlight-current-row @row-click="handleChange1">
          <el-table-column label="部门" align="center" >
            <template slot-scope="scope">
              {{ scope.row.部门名称 }}
            </template>
          </el-table-column>
        </el-table>
        <el-table :data="tableData3" :header-cell-style="{fontFamily:'YouYuan',fontSize:'13px',fontWeight:200}" border stripe style="width: 120px;height:350px; text-align: center;display: inline-block;vertical-align: top;" size="mini" highlight-current-row @row-click="handleChange">
          <el-table-column label="销售经理" align="center" >
            <template slot-scope="scope">
              {{ scope.row.姓名 }}
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer" style="margin-top: 20px">
        <el-button size="small" icon="el-icon-circle-close" @click="offName()">取消</el-button>
        <el-button type="distribution" size="small" icon="el-icon-circle-check" @click="getName()">确认</el-button>
        <!--<el-button @click="offName">取消</el-button>-->
        <!--<el-button type="primary" @click="getName">确认</el-button>-->
      </div>
    </el-dialog>

    <!--投标保证金选择-->
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisibleBidding" title="请选择投标保证金" center width="1000px">
      <el-input v-model="enterprise" size="small" style="width:200px" placeholder="招标企业" clearable/>
      <el-button type="search" icon="el-icon-search" size="small" style="margin-left: 10px" @click="searchBidding">查询</el-button>
      <div style="margin-top: 15px">
        <el-table
          :data="tableDataBidding"
          :header-cell-style="{fontFamily:'YouYuan',fontSize:'13px',fontWeight:200}"
          highlight-current-row
          style="width: 100%"
          height="400"
          border
          stripei
          size="mini"
          @row-click="biddingNum">
          <el-table-column align="center" label="招标企业" width="200">
            <template slot-scope="scope">
              {{ scope.row.招标企业 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="联系人" width="64" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.联系人 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="联系电话" width="110" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.联系电话 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="保证金(万元)" width="120">
            <template slot-scope="scope">
              {{ Number(scope.row.保证金金额).toFixed(2) }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="投标人" width="64" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.投标人 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="保金类型" width="80" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.保证金类型 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="投标日期" width="85">
            <template slot-scope="scope">
              {{ scope.row.投标日期 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="备注">
            <template slot-scope="scope">
              {{ scope.row.备注 }}
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" icon="el-icon-circle-close" @click="offBidding()">取消</el-button>
        <el-button type="distribution" size="small" icon="el-icon-circle-check" @click="getBidding">确认</el-button>
      </div>
    </el-dialog>

    <!--客户选择-->
    <el-dialog v-el-drag-dialog :visible.sync="dialogCustomerFormVisible" title="客户选择" center width="400px">
      <el-input v-model="Customer" clearable size="small" style="width:200px" placeholder="请输入客户名称"/>
      <el-button type="search" icon="el-icon-search" size="small" style="margin-left: 10px" @click="PageSize1 = 30;PageCurrent1 = 1;fetchCustomerData()">查询</el-button>
      <el-table
        v-loading="loading1"
        :header-cell-style="{fontFamily:'YouYuan',fontSize:'13px',fontWeight:200}"
        :data="CustomerData"
        highlight-current-row
        height="300"
        stripe
        border
        show-overflow-tooltip
        style="height: 350px; margin-top: 10px"
        size="mini"
        @row-click="handleCustomerChange">
        <el-table-column label="客户名称" align="center" >
          <template slot-scope="scope">
            {{ scope.row.客户名称 }}
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" icon="el-icon-circle-close" @click="offCustomerChange('form')">取消</el-button>
        <el-button type="distribution" size="small" icon="el-icon-circle-check" @click="getCustomerCode('form')">确 定</el-button>
      </div>
    </el-dialog>

    <!--改变节点时间对话框-->
    <el-dialog v-el-drag-dialog :visible.sync="dialogTimeVisible" :show-close="false" :close-on-click-modal="false" title="进度完成时间" center style="min-height: 300px" width="400px">
      <el-form ref="form2" :model="form2" :rules="rules2" :disabled="disabledTime" label-width="140px">
        <el-form-item label="进度完成日期" prop="进度完成日期">
          <el-date-picker
            v-model="form2.进度完成日期"
            style="width: 200px;"
            value-format="yyyy-MM-dd"
            size="small"
            type="date"
            placeholder="请选择进度完成日期"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" icon="el-icon-circle-close" @click="callOffTime('form2')">取消</el-button>
        <el-button type="distribution" size="small" icon="el-icon-circle-check" @click="submitTime('form2')">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import elInput from 'element-ui/packages/input'
import { addMarketingManager, SelectMarketingManager1, SelectPartment, searchTimeAll, searchTime, selectBidBond, changeExecutionProgressID, initProject, searchTable1, fetchExecutionProgress, delList, addList, executionProgressID, editchar, getTree, tree, getTablePeople, fetchCustomerData, getFileData, deleteFileData, selectMachine, selectProvince, SelectMarketingManager, submitMachine, editMachine, delMachine, money } from '@/api/MarketingCenter/ContractInformationManagement'
import { upload, download } from '@/utils/request'
export default {
  components: {
    elInput
  },
  data() {
    const validateValue = (rule, value, callback) => {
      if (value === 0) {
        callback(new Error('金额不能为0'))
      } else if (value) {
        // const reg = /^\-\d\.?\d*$/
        // const boolean = reg.test(value)
        const boolean = new RegExp(/^(\+)?\d+(\.\d+)?$/).test(value)
        console.log(boolean)
        if (!boolean) {
          callback(new Error('请输入正数'))
          this.form.contractAmount = ''
        } else {
          console.log(2222)
          callback()
        }
      } else {
        callback()
      }
    }
    return {
      dateRange: '',
      check1: '',
      pickerOptions: {
        shortcuts: [{
          text: '上季度',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(end.getTime() - 3600 * 1000 * 24 * 30 * 3)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '过去半年',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(end.getTime() - 3600 * 1000 * 24 * 366 / 2)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '过去一年',
          onClick(picker) {
            const end = new Date()
            const start = new Date()
            start.setTime(end.getTime() - 3600 * 1000 * 24 * 365)
            picker.$emit('pick', [start, end])
          }
        }]
      },
      isTrue: true,
      customerName1: '',
      customerName1_check: '',
      machineDATA: '',
      name: '',
      a: 1,
      b: 1,
      c: 1,
      time1: '',
      time2: '',
      time3: '',
      time4: '',
      time5: '',
      time6: '',
      time7: '',
      time8: '',
      machine: '',
      machine_check: '',
      disabledTime: false,
      dialogTimeVisible: false,
      executionProgressIDdisabled: false,
      enterpriseInput: '', // 表单承接招标企业的中间变量
      biddingNumber: '',
      dialogFormVisibleBidding: false,
      enterprise: '', // 招标企业
      startTime: '',
      startTime_check: null,
      endTime: '',
      endTime_check: null,
      money: [],
      expands: [],
      flag: '',
      title1: '',
      dialogFormVisible2: false,
      ProvinceValue: '',
      Province: [],
      CustomerCode: '',
      loading1: false,
      CustomerData: [],
      Customer: '',
      id1: '',
      action: '',
      peoplename: '',
      peopleid_check: null,
      peopleid: '',
      dataPeople: [],
      ListPeople: [],
      fileList: [],
      hadFile: [],
      disabled: false,
      projectNum: null,
      dialogFormVisiblePeople: false,
      dialogFormVisiblePeople1: false,
      dialogCustomerFormVisible: false,
      listLoading: false,
      showFileList: true,
      entryNameValue: '', // 项目名称下拉框
      entryNameValue_check: null,
      entryName: [], // 项目名称下拉框数据
      list1: [], // 项目名称临时存储
      MarketingManagerValue: '', // 营销经理下拉框
      MarketingManager: [], // 营销经理下拉框数据
      list2: [], // 营销经理临时存储
      tableData1: [], // 合同信息表
      tableData2: [], // 机床信息表
      tableData3: [], // 营销经理表
      tableData4: [], // 部门表
      PageCurrent: 1,
      PageSize: 30,
      total: null,
      PageCurrent1: 1,
      PageSize1: 100000,
      total1: null,
      infoDisable: true,
      hetongID: '',
      ExecutionProgress: null, // 执行进度
      ExecutionProgressShow: false, // 执行进度可见性
      uploader: false, // 上传可见性
      dialogFormVisible1: false, // 新增对话框可见性
      form: {
        MarketingManagerValue: '',
        EntryName: '', // 项目名称
        contractSigningDate: '',
        drawingJointSignNode: '', // 图纸会签节点
        EquipmentPreAcceptanceNode: '', // 设备预验收节点
        ConsignmentNode: '', //  发货节点
        installDebugNode: '', // 安装调试节点
        executionProgressID: 1, // 执行进度ID
        customerName: '', // 客户名称
        remark: '',
        付款方式: 1,
        bidding: '',
        contractAmount: '' // 合同总额
      },
      tableDataBidding: [],
      executionProgressID: '',
      form1: {
        设备型号: '',
        设备名称: '',
        机床数量: 1
      },
      form2: {
        进度完成日期: ''
      },
      title: '',
      param: 0,
      executionProgress: [], // 执行进度下拉框数据
      executionProgressID1: '', // 中间变量存储执行进度ID
      ProjectTypeIDV: [],
      temp: '', // 增加或修改的标志位
      rules: { // 表单验证规则
        EntryName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
        customerName: [{ required: true, message: '请选择客户名称', trigger: 'change' }],
        MarketingManagerValue: [{ required: true, message: '请选择营销经理', trigger: 'change' }],
        executionProgressID: [{ required: true, message: '请选择已完成进度', trigger: 'change' }],
        contractSigningDate: [{ required: true, message: '请选择合同签订日期', trigger: 'change' }],
        付款方式: [{ required: true, message: '请选择付款方式', trigger: 'change' }],
        contractAmount: [
          { required: true, message: '请输入合同总额', trigger: 'change' },
          { required: true, trigger: 'blur', validator: validateValue }]
      },
      rules1: { // 表单验证规则
        设备型号: [{ required: true, message: '请输入设备型号', trigger: 'blur' }],
        设备名称: [{ required: true, message: '请输入设备名称', trigger: 'blur' }]
      },
      rules2: { // 表单验证规则
        进度完成日期: [{ required: true, message: '请选择进度完成日期', trigger: 'change' }]
      }
    }
  },
  created() {
    this.fetchData()
    this.fetchTableData1()
    this.fetchCustomerData()
  },
  methods: {
    // 2020 02 18  刘路加 增加
    fun() {
      this.form.contractAmount = Number(this.form.contractAmount).toFixed(2)
    },

    searchName() { // 模糊查询姓名
      this.tableData3 = []
      SelectMarketingManager().then(response => {
        this.tableData3 = response.data
      })
    },
    handleChange1(row) {
      this.tableData3 = []
      SelectMarketingManager1(row.考核部门编号).then(response => {
        this.tableData3 = response.data
      })
    },
    searchPartment() { // 模糊查询姓名
      SelectPartment().then(response => {
        this.tableData4 = response.data
      })
    },
    fetchData() {
      getTree().then(response => { // 获取人员信息树
        const data = response.data
        this.dataPeople = tree(data, 0)
      })
      this.getSelect(initProject, ['项目名称', '项目流水号'], 'entryName')
      this.executionProgressID = this.form.executionProgressID
      this.getSelect(executionProgressID, ['执行进度名', '执行进度ID'], 'executionProgress')
      this.getSelect(selectProvince, ['省份', '省份流水号'], 'Province')
      this.getSelect(money, ['付款方式', '付款方式代码'], 'money')
    },
    openName() {
      this.searchName()
      this.name = ''
      this.tableData3 = []
      this.dialogFormVisiblePeople = true
      this.searchPartment()
    },
    getRowKeys(row) {
      return row.项目流水号
    },
    handleNodeClick(data) { // 树节点点击
      getTablePeople(data.id).then(response => {
        this.ListPeople = response.data
      })
    },
    handleChange(row) {
      this.peopleid = row.人员编号
      this.peoplename = row.姓名
    },
    getName() {
      addMarketingManager(this.peopleid, 1).then(response => {
        console.log(response, 123)
      })
      if (this.param === 1) {
        this.dialogFormVisiblePeople = false
        this.MarketingManagerValue = this.peoplename
        this.param = 0
      } else {
        this.dialogFormVisiblePeople = false
        this.id1 = this.peopleid
        this.form.MarketingManagerValue = this.peoplename
      }
    },
    offName() {
      this.dialogFormVisiblePeople = false
      this.dialogFormVisiblePeople1 = false
      this.peopleid = ''
      this.peoplename = ''
    },
    fetchTableData1() {
      if (this.customerName1 === '' || this.customerName1 === null) { this.customerName1_check = 0 } else { this.customerName1_check = 1 }
      if (this.entryNameValue === '' || this.entryNameValue === null) { this.entryNameValue_check = 0 } else { this.entryNameValue_check = 1 }
      if (this.MarketingManagerValue === '' || this.MarketingManagerValue === null) { this.peopleid_check = 0 } else { this.peopleid_check = 1 }
      this.dateRange ? this.check1 = 1 : (this.check1 = 0, this.dateRange = '')
      if (this.startTime === '' || this.startTime === null) { this.startTime_check = 0 } else { this.startTime_check = 1 }
      if (this.endTime === '' || this.endTime === null) { this.endTime_check = 0 } else { this.endTime_check = 1 }
      if (this.machine === '' || this.machine === null) { this.machine_check = 0 } else { this.machine_check = 1 }
      this.ExecutionProgressShow = false
      this.uploader = false
      this.ExecutionProgress = null
      this.listLoading = true
      this.getTable(searchTable1, [this.PageCurrent, this.PageSize, this.entryNameValue, this.peopleid, this.entryNameValue_check, this.peopleid_check, this.check1, this.check1, this.dateRange[0], this.dateRange[1], this.machine_check, this.machine, this.customerName1_check, this.customerName1], ['tableData1', 'total', 'listLoading'])
    },
    exportExcel() {
      if (this.customerName1 === '' || this.customerName1 === null) { this.customerName1_check = 0 } else { this.customerName1_check = 1 }
      if (this.entryNameValue === '' || this.entryNameValue === null) { this.entryNameValue_check = 0 } else { this.entryNameValue_check = 1 }
      if (this.MarketingManagerValue === '' || this.MarketingManagerValue === null) { this.peopleid_check = 0 } else { this.peopleid_check = 1 }
      this.dateRange ? this.check1 = 1 : (this.check1 = 0, this.dateRange = '')
      if (this.startTime === '' || this.startTime === null) { this.startTime_check = 0 } else { this.startTime_check = 1 }
      if (this.endTime === '' || this.endTime === null) { this.endTime_check = 0 } else { this.endTime_check = 1 }
      if (this.machine === '' || this.machine === null) { this.machine_check = 0 } else { this.machine_check = 1 }
      this.ExecutionProgressShow = false
      this.uploader = false
      this.ExecutionProgress = null
      // this.listLoading = true
      var param = []
      param[0] = ['项目流水号_check', this.entryNameValue_check]
      param[1] = ['合同ID', this.entryNameValue]
      param[2] = ['客户名称_check', this.customerName1_check]
      param[3] = ['客户名称', this.customerName1]
      param[4] = ['开始日期_check', this.check1]
      param[5] = ['开始日期', this.dateRange[0]]
      param[6] = ['结束日期_check', this.check1]
      param[7] = ['结束日期', this.dateRange[1]]
      param[8] = ['营销经理流水号_check', 0]
      param[9] = ['机床型号_check', 0]
      var Data = this.CreateData('2001', '报表_营销合同查询', param)
      this.exportExcel_NPOI(Data)
    },
    fetchExecutionProgressdata(row) {
      this.projectNum = row.项目流水号
      this.ExecutionProgressShow = true
      this.uploader = true
      this.action = `${upload}?&ProjectNum=${this.projectNum}`
      this.getFileData(this.projectNum)
      fetchExecutionProgress(row.项目流水号).then(response => {
        this.ExecutionProgress = response.data[0].执行进度流水号
        this.executionProgressID = response.data[0].执行进度流水号
        this.executionProgressID1 = response.data[0].执行进度流水号
        const time = []
        for (let i = 0; i < 8; i++) {
          if (parseInt(response.data[0].执行进度流水号) === i) {
            time.push('进行中')
          } else {
            time.push('未完成')
          }
        }
        this.time1 = time[0]
        this.time2 = time[1]
        this.time3 = time[2]
        this.time4 = time[3]
        this.time5 = time[4]
        this.time6 = time[5]
        this.time7 = time[6]
        this.time8 = time[7]
        return this.projectNum
      }).then(data => {
        searchTimeAll(data).then(response => {
          if (response.data[0].合同签订日期 !== '' && response.data[0].合同签订日期 !== null) {
            this.time1 = response.data[0].合同签订日期.substring(0, response.data[0].合同签订日期.length - 8)
          }
          if (response.data[0].图纸会签日期 !== '' && response.data[0].图纸会签日期 !== null) {
            this.time2 = response.data[0].图纸会签日期.substring(0, response.data[0].图纸会签日期.length - 8)
          }
          if (response.data[0].加工制造日期 !== '' && response.data[0].加工制造日期 !== null) {
            this.time3 = response.data[0].加工制造日期.substring(0, response.data[0].加工制造日期.length - 8)
          }
          if (response.data[0].预验收日期 !== '' && response.data[0].预验收日期 !== null) {
            this.time4 = response.data[0].预验收日期.substring(0, response.data[0].预验收日期.length - 8)
          }
          if (response.data[0].设备发货日期 !== '' && response.data[0].设备发货日期 !== null) {
            this.time5 = response.data[0].设备发货日期.substring(0, response.data[0].设备发货日期.length - 8)
          }
          if (response.data[0].安装调试日期 !== '' && response.data[0].安装调试日期 !== null) {
            this.time6 = response.data[0].安装调试日期.substring(0, response.data[0].安装调试日期.length - 8)
          }
          if (response.data[0].项目验收日期 !== '' && response.data[0].项目验收日期 !== null) {
            this.time7 = response.data[0].项目验收日期.substring(0, response.data[0].项目验收日期.length - 8)
          }
          if (response.data[0].质保期日期 !== '' && response.data[0].质保期日期 !== null) {
            this.time8 = response.data[0].质保期日期.substring(0, response.data[0].质保期日期.length - 8)
          }
        })
      })
    },
    selectMachine(row) {
      console.log(row.项目流水号)
      if (this.a === 1) {
        this.expands.push(row.项目流水号)
        this.b = row.项目流水号
        this.a = 0
      } else {
        if (this.b === row.项目流水号) {
          this.expands = []
          this.a = 1
        } else {
          this.expands = []
          this.expands.push(row.项目流水号)
          this.a = 0
          this.b = row.项目流水号
        }
      }
      this.projectNum = row.项目流水号
      this.ExecutionProgressShow = true
      this.uploader = true
      this.action = `${upload}?&ProjectNum=${this.projectNum}`
      this.getFileData(this.projectNum)
      fetchExecutionProgress(row.项目流水号).then(response => {
        this.ExecutionProgress = response.data[0].执行进度流水号
        this.executionProgressID = response.data[0].执行进度流水号
        this.executionProgressID1 = response.data[0].执行进度流水号
        const time = []
        for (let i = 0; i < 8; i++) {
          if (parseInt(response.data[0].执行进度流水号) === i) {
            time.push('进行中')
          } else {
            time.push('未完成')
          }
        }
        this.time1 = time[0]
        this.time2 = time[1]
        this.time3 = time[2]
        this.time4 = time[3]
        this.time5 = time[4]
        this.time6 = time[5]
        this.time7 = time[6]
        this.time8 = time[7]
        return this.projectNum
      }).then(data => {
        searchTimeAll(data).then(response => {
          if (response.data[0].合同签订日期 !== '' && response.data[0].合同签订日期 !== null) {
            this.time1 = response.data[0].合同签订日期.substring(0, response.data[0].合同签订日期.length - 8)
          }
          if (response.data[0].图纸会签日期 !== '' && response.data[0].图纸会签日期 !== null) {
            this.time2 = response.data[0].图纸会签日期.substring(0, response.data[0].图纸会签日期.length - 8)
          }
          if (response.data[0].加工制造日期 !== '' && response.data[0].加工制造日期 !== null) {
            this.time3 = response.data[0].加工制造日期.substring(0, response.data[0].加工制造日期.length - 8)
          }
          if (response.data[0].预验收日期 !== '' && response.data[0].预验收日期 !== null) {
            this.time4 = response.data[0].预验收日期.substring(0, response.data[0].预验收日期.length - 8)
          }
          if (response.data[0].设备发货日期 !== '' && response.data[0].设备发货日期 !== null) {
            this.time5 = response.data[0].设备发货日期.substring(0, response.data[0].设备发货日期.length - 8)
          }
          if (response.data[0].安装调试日期 !== '' && response.data[0].安装调试日期 !== null) {
            this.time6 = response.data[0].安装调试日期.substring(0, response.data[0].安装调试日期.length - 8)
          }
          if (response.data[0].项目验收日期 !== '' && response.data[0].项目验收日期 !== null) {
            this.time7 = response.data[0].项目验收日期.substring(0, response.data[0].项目验收日期.length - 8)
          }
          if (response.data[0].质保期日期 !== '' && response.data[0].质保期日期 !== null) {
            this.time8 = response.data[0].质保期日期.substring(0, response.data[0].质保期日期.length - 8)
          }
        })
      })
      selectMachine(row.项目流水号).then(response => {
        console.log(response)
        this.tableData2 = response.data
      })
    },
    handleDelete(row) {
      this.deleteRow(delList, row.项目流水号, function() { this.fetchTableData1() })
    },
    handleSizeChange(val) {
      this.PageCurrent = 1
      this.PageSize = val
      this.fetchTableData1()
    },
    handleCurrentChange(val) {
      this.PageCurrent = val
      this.fetchTableData1()
    },
    handleSizeChange1(val) {
      this.PageCurrent1 = 1
      this.PageSize1 = val
      this.fetchCustomerData()
    },
    handleCurrentChange1(val) {
      this.PageCurrent1 = val
      this.fetchCustomerData()
    },
    ADD() {
      this.addForm('form')
      this.dialogFormVisible1 = true
      this.temp = 1
      this.title = '新增合同'
      this.disabled = false
      this.biddingNumber = ''
      this.tableDataBidding = []
      this.isTrue = true
    },
    addTableData1() {
      addList(this.form.EntryName, this.form.drawingJointSignNode, this.form.EquipmentPreAcceptanceNode, this.form.ConsignmentNode, this.form.installDebugNode, this.id1, this.form.executionProgressID, this.CustomerCode, this.form.remark, this.form.付款方式, this.form.contractSigningDate, this.biddingNumber, this.form.contractAmount).then(response => {
        this.dialogFormVisible1 = false
        if (response.data[0].result === '1') {
          this.$message.success('添加成功')
          this.peopleid = ''
          this.title = ''
          this.fetchTableData1()
        } else {
          this.$message.error('添加失败')
        }
      })
    },
    // 重置表单
    callOff() {
      this.dialogFormVisible1 = false
      this.dialogFormVisible2 = false
    },

    // 提交添加或者修改
    submit(formName) {
      this.$refs[formName].validate((valid) => {
        console.log(valid, 111111)
        if (valid) {
          if (this.temp === 1) {
            this.addTableData1()
            this.temp = null
          } else if (this.temp === 2) {
            this.chaEdit()
            this.temp = null
          }
        }
      })
    },
    handleEdit(row) {
      console.log(row)
      this.editForm(row, 'form')
      this.title = '编辑合同'
      this.dialogFormVisible1 = true
      this.form.contractSigningDate = row.合同签订日期
      this.form.contractNumber = row.合同编号
      this.form.EntryName = row.项目名称
      this.form.drawingJointSignNode = row.图纸会签节点
      this.form.EquipmentPreAcceptanceNode = row.设备预验收节点
      this.form.ConsignmentNode = row.发货节点
      this.form.installDebugNode = row.安装调试节点
      this.form.MarketingManagerValue = row.营销经理
      this.id1 = row.营销经理流水号
      this.form.executionProgressID = parseInt(row.执行进度流水号)
      this.form.customerName = row.客户名称
      this.hetongID = row.项目流水号
      this.form.remark = row.合同信息备注
      this.CustomerCode = row.客户流水号
      this.form.付款方式 = parseInt(row.付款方式代码)
      this.biddingNumber = row.招标保证金流水号
      this.form.bidding = Number(row.保证金金额).toFixed(2)
      this.form.contractAmount = row.合同总金额
      this.disabled = true
      this.temp = 2
      this.isTrue = false
    },
    chaEdit() {
      editchar(this.form.EntryName, this.form.drawingJointSignNode, this.form.EquipmentPreAcceptanceNode, this.form.ConsignmentNode, this.form.installDebugNode, this.id1, this.form.executionProgressID, this.CustomerCode, this.form.remark, this.hetongID, this.form.付款方式, this.form.contractSigningDate, this.biddingNumber, this.form.contractAmount).then(response => {
        this.dialogFormVisible1 = false
        if (response.data[0].result === '1') {
          this.$message.success('信息更新成功')
          this.peopleid = ''
          this.fetchTableData1()
        } else {
          this.$message.error('信息更新失败')
        }
      })
      this.getTable(searchTable1, [this.PageCurrent, this.PageSize, '', ''], ['tableData1', 'total', 'listLoading'])
      this.ExecutionProgressShow = true
      this.uploader = true
      this.action = `${upload}?&ProjectNum=${this.hetongID}`
      fetchExecutionProgress(this.hetongID).then(response => {
        this.ExecutionProgress = response.data[0].执行进度流水号
        this.executionProgressID = response.data[0].执行进度流水号
        this.executionProgressID1 = response.data[0].执行进度流水号
        const time = []
        for (let i = 0; i < 8; i++) {
          if (parseInt(response.data[0].执行进度流水号) === i) {
            time.push('进行中')
          } else {
            time.push('未完成')
          }
        }
        this.time1 = time[0]
        this.time2 = time[1]
        this.time3 = time[2]
        this.time4 = time[3]
        this.time5 = time[4]
        this.time6 = time[5]
        this.time7 = time[6]
        this.time8 = time[7]
        return this.hetongID
      }).then(data => {
        searchTimeAll(data).then(response => {
          if (response.data[0].合同签订日期 !== '' && response.data[0].合同签订日期 !== null) {
            this.time1 = response.data[0].合同签订日期.substring(0, response.data[0].合同签订日期.length - 8)
          }
          if (response.data[0].图纸会签日期 !== '' && response.data[0].图纸会签日期 !== null) {
            this.time2 = response.data[0].图纸会签日期.substring(0, response.data[0].图纸会签日期.length - 8)
          }
          if (response.data[0].加工制造日期 !== '' && response.data[0].加工制造日期 !== null) {
            this.time3 = response.data[0].加工制造日期.substring(0, response.data[0].加工制造日期.length - 8)
          }
          if (response.data[0].预验收日期 !== '' && response.data[0].预验收日期 !== null) {
            this.time4 = response.data[0].预验收日期.substring(0, response.data[0].预验收日期.length - 8)
          }
          if (response.data[0].设备发货日期 !== '' && response.data[0].设备发货日期 !== null) {
            this.time5 = response.data[0].设备发货日期.substring(0, response.data[0].设备发货日期.length - 8)
          }
          if (response.data[0].安装调试日期 !== '' && response.data[0].安装调试日期 !== null) {
            this.time6 = response.data[0].安装调试日期.substring(0, response.data[0].安装调试日期.length - 8)
          }
          if (response.data[0].项目验收日期 !== '' && response.data[0].项目验收日期 !== null) {
            this.time7 = response.data[0].项目验收日期.substring(0, response.data[0].项目验收日期.length - 8)
          }
          if (response.data[0].质保期日期 !== '' && response.data[0].质保期日期 !== null) {
            this.time8 = response.data[0].质保期日期.substring(0, response.data[0].质保期日期.length - 8)
          }
        })
      })
    },
    clear() {
      this.peopleid = ''
      this.tableData3 = []
      this.ProvinceValue = ''
    },
    clear1() {
      this.CustomerCode = ''
    },
    CustomerChange() {
      this.dialogCustomerFormVisible = true
    },
    offCustomerChange() {
      this.dialogCustomerFormVisible = false
    },
    fetchCustomerData() {
      this.loading1 = true
      this.getTable(fetchCustomerData, [this.PageCurrent1, this.PageSize1, this.Customer], ['CustomerData', 'total1', 'loading1'])
    },
    handleCustomerChange(row) {
      this.CustomerCode = row.客户流水号
      this.form.customerName = row.客户名称
    },
    getCustomerCode() {
      this.dialogCustomerFormVisible = false
    },
    async submitUpload() {
      await this.$refs.upload.submit()
    },
    uploadSuccess(res, file, fileList) {
      if (res[0].result === '1') {
        const index = fileList.indexOf(file)
        fileList.splice(index, 1)
      } else {
        this.$message.error(`${file.name}文件上传失败，请检查上传文件是否正确！`)
      }
      if (fileList.length === 0) {
        this.$message.success('文件上传成功')
        this.getFileData(this.projectNum)
      }
    },
    uploadFailure(a, file, fileList) {
      fileList.map(file => {
        this.$message.error(`${file.name}文件上传失败，请检查上传文件是否正确！`)
      })
    },
    getFileData(row) {
      this.hadFile = []
      getFileData(row).then(res => {
        if (res.data.length > 0) {
          res.data.map(item => {
            this.hadFile.push({
              url: `${download}?id=${item.文件标识}.${item.文件后缀}&name=${item.文件名称}.${item.文件后缀}`,
              name: `${item.文件名称}.${item.文件后缀}`,
              suffix: item.文件后缀,
              id: item.文件标识
            })
          })
        }
      })
    },
    deleteFileData(id) {
      this.deleteRow(deleteFileData, id, function() { this.getFileData(this.projectNum) })
    },
    changeProvince() {
      SelectMarketingManager(this.ProvinceValue).then(response => {
        this.tableData3 = response.data
      })
    },
    addMachine(row) {
      this.projectNum = row.项目流水号
      this.dialogFormVisible2 = true
      this.title1 = '新增机床'
      this.addForm('form1')
    },
    editMachine(row) {
      this.editForm(row, 'form1')
      this.dialogFormVisible2 = true
      this.title1 = '编辑机床'
      this.c = row.机床流水号
      this.form1.设备型号 = row.机床图号
      this.form1.设备名称 = row.机床名称
    },
    callOff2() {
      this.dialogFormVisible2 = false
    },
    submitMachine() {
      function a() {
        selectMachine(this.projectNum).then(response => {
          this.tableData2 = response.data
        })
        this.dialogFormVisible2 = false
      }
      if (this.flag === 1) {
        this.addTable(submitMachine, [this.projectNum, this.form1.设备型号, this.form1.设备名称, this.form1.机床数量], 'form1', a)
      } else {
        this.editTable(editMachine, [this.c, this.form1.设备型号, this.form1.设备名称, this.form1.机床数量], 'form1', a)
      }
    },
    deleteMachine(row) {
      function a() {
        selectMachine(this.projectNum).then(response => {
          this.tableData2 = response.data
        })
      }
      this.deleteRow(delMachine, row.机床流水号, a)
    },
    changeExecutionProgressID() {
      this.dialogTimeVisible = true
      if (parseInt(this.executionProgressID) === 1) {
        this.disabledTime = true
      } else {
        this.disabledTime = false
      }
      searchTime(this.projectNum, this.executionProgressID).then(response => {
        this.form2.进度完成日期 = response.data[0].进度完成日期
      })
      // changeExecutionProgressID(this.executionProgressID, this.projectNum).then(response => {
      //   if (response.data[0].result === '1') {
      //     this.$message.success('信息更新成功')
      //     fetchExecutionProgress(this.projectNum).then(response => {
      //       this.ExecutionProgress = response.data[0].执行进度流水号
      //     })
      //   } else {
      //     this.$message.error('信息更新失败')
      //   }
      // })
    },
    openBidding() {
      this.dialogFormVisibleBidding = true
      this.searchBidding()
    },
    searchBidding() {
      selectBidBond(0, '', 0, '', 1, this.enterprise, 0, '', 0, '').then(response => {
        const data = response.data
        for (let i = 0; i < data.length; i++) {
          if (data[i].投标日期 !== '' && data[i].投标日期 !== null) {
            data[i].投标日期 = data[i].投标日期.substring(0, data[i].投标日期.length - 8)
          }
        }
        this.tableDataBidding = data
      })
    },
    biddingNum(row) {
      this.biddingNumber = parseInt(row.招标保证金流水号)
      this.enterpriseInput = Number(row.保证金金额).toFixed(2)
    },
    clearBidding() {
      this.biddingNumber = ''
      this.tableDataBidding = []
    },
    getBidding() {
      this.form.bidding = this.enterpriseInput
      this.dialogFormVisibleBidding = false
    },
    offBidding() {
      this.dialogFormVisibleBidding = false
      this.biddingNumber = ''
    },
    callOffTime() {
      this.dialogTimeVisible = false
      this.executionProgressID = this.executionProgressID1
    },
    submitTime(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          changeExecutionProgressID(this.executionProgressID, this.projectNum, this.form2.进度完成日期).then(response => {
            if (response.data[0].result === '1') {
              this.$message.success('信息更新成功')
              this.dialogTimeVisible = false
              fetchExecutionProgress(this.projectNum).then(response => {
                this.ExecutionProgress = response.data[0].执行进度流水号
                this.executionProgressID = response.data[0].执行进度流水号
                this.executionProgressID1 = response.data[0].执行进度流水号
                const time = []
                for (let i = 0; i < 8; i++) {
                  if (parseInt(response.data[0].执行进度流水号) === i) {
                    time.push('进行中')
                  } else {
                    time.push('未完成')
                  }
                }
                this.time1 = time[0]
                this.time2 = time[1]
                this.time3 = time[2]
                this.time4 = time[3]
                this.time5 = time[4]
                this.time6 = time[5]
                this.time7 = time[6]
                this.time8 = time[7]
                return this.projectNum
              }).then(data => {
                searchTimeAll(data).then(response => {
                  if (response.data[0].合同签订日期 !== '' && response.data[0].合同签订日期 !== null) {
                    this.time1 = response.data[0].合同签订日期.substring(0, response.data[0].合同签订日期.length - 8)
                  }
                  if (response.data[0].图纸会签日期 !== '' && response.data[0].图纸会签日期 !== null) {
                    this.time2 = response.data[0].图纸会签日期.substring(0, response.data[0].图纸会签日期.length - 8)
                  }
                  if (response.data[0].加工制造日期 !== '' && response.data[0].加工制造日期 !== null) {
                    this.time3 = response.data[0].加工制造日期.substring(0, response.data[0].加工制造日期.length - 8)
                  }
                  if (response.data[0].预验收日期 !== '' && response.data[0].预验收日期 !== null) {
                    this.time4 = response.data[0].预验收日期.substring(0, response.data[0].预验收日期.length - 8)
                  }
                  if (response.data[0].设备发货日期 !== '' && response.data[0].设备发货日期 !== null) {
                    this.time5 = response.data[0].设备发货日期.substring(0, response.data[0].设备发货日期.length - 8)
                  }
                  if (response.data[0].安装调试日期 !== '' && response.data[0].安装调试日期 !== null) {
                    this.time6 = response.data[0].安装调试日期.substring(0, response.data[0].安装调试日期.length - 8)
                  }
                  if (response.data[0].项目验收日期 !== '' && response.data[0].项目验收日期 !== null) {
                    this.time7 = response.data[0].项目验收日期.substring(0, response.data[0].项目验收日期.length - 8)
                  }
                  if (response.data[0].质保期日期 !== '' && response.data[0].质保期日期 !== null) {
                    this.time8 = response.data[0].质保期日期.substring(0, response.data[0].质保期日期.length - 8)
                  }
                })
              })
            } else {
              this.$message.error('信息更新失败')
              this.executionProgressID = this.executionProgressID1
            }
          })
        }
      })
    }
  }
}
</script>
<style scoped>
  .el-table--scrollable-y .el-table__body-wrapper {overflow: hidden !important}
  .el-table--scrollable-x .el-table__body-wrapper {overflow: hidden !important}
.el-date-editor{
  width:200px;
}
.hide-expand .el-table__expand-column .el-icon {
  visibility: hidden;
}
.wrapper{
  width: 260px;
  height: 50px;
  overflow: hidden;
  border: 1px solid #b8c7d9;
  float: left;
  margin: 10px;
}
.content{
  position: relative;
  padding: 8px 8px 0 8px;
}
.action{
  position: absolute;
  top: 4px;
  right: 8px;
}
.delete{
  padding: 0 5px;
  border-radius: 3px;
  color: #0f84b0;
  font-size: 12px;
}
.delete:hover{
  background: -webkit-linear-gradient(top,#0ba9e3,#0099d3);
  color: #ff0511;
}
a{
  text-decoration: none;
}
.icon{
  width: 30px;
  height: 30px;
  display: inline-block;
  margin-right: 7px;
  margin-top: 2px;
  font-size: 26px;
}
.info{
  position: absolute;
  left: 44px;
  line-height: 30px;
  display: inline-block;
  color: #999;
}
  .el-form--label-left >>> .el-form-item__label {
    text-align: right;
  }
  >>>.el-dialog--center .el-dialog__body {
    text-align: initial;
    padding: 20px 30px 20px
  }
  >>>.el-dialog__header {
    padding: 20px 20px 0px;
  }
  >>>.el-dialog__footer {
    padding: 0px 20px 20px;
    /*text-align: right;*/
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
  }
  >>>.el-form-item {
    margin-bottom: 13px;
  }
  /*>>>.el-dialog, .el-pager li {*/
    /*background: red;*/
    /*opacity: 0.9;*/
    /*-webkit-box-sizing: border-box;*/
  /*}*/
/*.el-table td, .el-table th.is-leaf,*/
/*.el-radio__inner,*/
/*.el-input__inner{*/
  /*border: 1px solid black!important;*/
/*}*/

</style>
<style lang="scss">

</style>
