<template>
  <div class="app-container">
    <el-card>
      <div ref="height1" style="width:100%">
        <el-divider content-position="right">
          <el-button type="text" @click="searchUnInquiryPartNumber">刷新</el-button> | 待询价零件数
        </el-divider>
        <el-row>
          <el-col v-for="(machine,index) in machines1" :key="index" style="width: 200px">
            <el-card shadow="hover" class="sudoku_item" style="height:80px;width: 90%" @click.native="clickCard1(machine.项目流水号, machine.机床流水号)">
              <el-badge :value="machine.未询价零件数">
                <div style="width: 100px;height:50px;margin:0" class="sudoku_item">
                  {{ machine.机床图号 }}
                </div>
              </el-badge>
            </el-card>
          </el-col>
        </el-row>
        <!--<el-divider content-position="right"/>-->
        <!--<el-divider content-position="right">-->
        <!--<el-button type="text" @click="searchUnBuyPartNumber">刷新</el-button> | 待采购零件数-->
        <!--</el-divider>-->
        <!--<el-row>-->
        <!--<el-col v-for="(machine,index) in machines2" :key="index" style="width: 200px">-->
        <!--<el-card shadow="hover" class="sudoku_item" style="height:80px;width: 90%" @click.native="clickCard2(machine.项目流水号, machine.机床流水号)">-->
        <!--<el-badge :value="machine.未采购零件数">-->
        <!--<div style="width: 100px;height:50px;margin:0" class="sudoku_item">-->
        <!--{{ machine.机床图号 }}-->
        <!--</div>-->
        <!--</el-badge>-->
        <!--</el-card>-->
        <!--</el-col>-->
        <!--</el-row>-->
        <!--<el-divider content-position="right"/>-->
      </div>
    </el-card>
    <el-row id="PurchasingCenter/CreateInquirySheet">
      <el-col :span="24">
        <el-tabs v-model="tabName" type="border-card" @tab-click="tabClick">
          <el-tab-pane label="外购/标准件" name="外购件">
            <el-row style="margin-bottom: 10px">
              <!--<el-select v-model="projectValue" placeholder="项目名称" size="small" style="width:100px" filterable clearable @change="projectChange">-->
              <!--<el-option-->
              <!--v-for="item in project"-->
              <!--:key="item.value"-->
              <!--:label="item.label"-->
              <!--:value="item.value"/>-->
              <!--</el-select>-->
              <el-input v-model="materialName" placeholder="名称规格" size="small" style="width:120px" clearable @keyup.enter.native="searchTable11()"/>
              <el-input v-model="supplierName" placeholder="供货商" size="small" style="width:120px" clearable/>
              <el-select v-model="machineValue" placeholder="机床" size="small" clearable filterable>
                <el-option
                  v-for="item in machine"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"/>
              </el-select>
              <!--<el-select v-model="groupValue" placeholder="组号" style="width:100px" size="small" clearable filterable>-->
              <!--<el-option-->
              <!--v-for="item in group"-->
              <!--:key="item.value"-->
              <!--:label="item.label"-->
              <!--:value="item.value"/>-->
              <!--</el-select>-->
              <!--<el-cascader :options="materialStatus" :props="{ checkStrictly: true }" v-model="materialStatusValue" style="width: 100px" size="small"/>-->
              <!--<el-input v-model="materialSpec" placeholder="物料规格" size="small" style="width:120px" clearable/>-->
              <el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="searchTable11()">查询</el-button>
              <el-button type="warning" size="small" icon="el-icon-download" style="margin-left: 10px" @click="exportUninquirySheet">导出未询价单</el-button>
              <el-tooltip :open-delay="1000" effect="dark" content="开启物料变更" placement="top">
                <el-switch v-model="switchValue" active-color="#13ce66" inactive-color="#ff4949" style="margin-left: 30px"/>
              </el-tooltip>
              <el-date-picker
                v-model="startTime"
                size="small"
                type="daterange"
                align="center"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                range-separator="～"
                style="width:250px"
                start-placeholder="开始日期"
                end-placeholder="结束日期"/>
              <el-popover v-model="visible1" placement="top" width="140">
                <div style="text-align: right; margin: 0">
                  <el-select v-model="PersonValue" style="width:100px" placeholder="人员" size="small" filterable clearable>
                    <el-option
                      v-for="item in Person"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"/>
                  </el-select>
                  <el-button type="primary" size="mini" @click="visible1 = false;tiaozheng1()">确定</el-button>
                </div>
                <el-button slot="reference" type="success" size="small" plain style="float: right;margin-right: 20px">调整采购任务</el-button>
              </el-popover>
              <!--<el-popover v-model="visible" title="调整采购任务" placement="top" width="180">-->
              <!--<div style="text-align: right; margin: 0">-->
              <!--<el-select v-model="PersonValue" style="width:150px" placeholder="人员" size="small" filterable clearable>-->
              <!--<el-option-->
              <!--v-for="item in Person"-->
              <!--:key="item.value"-->
              <!--:label="item.label"-->
              <!--:value="item.value"/>-->
              <!--</el-select>-->
              <!--<el-button type="primary" size="mini" @click="visible = false;tiaozheng1()">确定</el-button>-->
              <!--</div>-->
              <!--<el-button slot="reference" type="success" size="small" plain style="float: right;margin-right: 20px">调整采购任务</el-button>-->
              <!--</el-popover>-->
            </el-row>
            <el-row>
              <el-table
                v-loading="loading"
                :data="tableData11"
                :row-class-name="tableRowClassName"
                border
                style="width: 100%;max-height: 500px;"
                height="500px"
                size="mini"
                @selection-change="handleSelectionChange1"
                @select="handleSelection">
                <el-table-column :selectable="selectable" align="center" width="50" type="selection"/>
                <el-table-column v-if="switchValue" label="操作" align="center" width="100" fixed="left">
                  <template slot-scope="scope">
                    <el-button :disabled="parseInt(scope.row.询价状态编号)!==1||parseInt(scope.row.是否确认)!==1" type="primary" size="mini" @click="materialChange(scope.row)">物料变更</el-button>
                  </template>
                </el-table-column>
                <!--<el-table-column label="状态" align="center" width="70">-->
                <!--<template slot-scope="scope">-->
                <!--<span v-if="unInquiry(scope.row)" style="color: orange">未询价</span>-->
                <!--<span v-if="inquiry(scope.row)" style="color: blue">已询价</span>-->
                <!--<span v-if="approval(scope.row)" style="color: green">审批中</span>-->
                <!--<span v-if="purchased(scope.row)">已采购</span>-->
                <!--</template>-->
                <!--</el-table-column>-->
                <el-table-column :filters="supplierFilters" :filter-method="filterHandler" label="供货商" align="center" min-width="100" prop="供货商" show-overflow-tooltip>
                  <template slot-scope="scope">
                    {{ scope.row.供货商 }}
                  </template>
                </el-table-column>
                <el-table-column :filters="remarkFilters" :filter-method="filterHandler0" label="备注" align="center" min-width="100" prop="备注" show-overflow-tooltip>
                  <template slot-scope="scope">
                    {{ scope.row.备注 }}
                  </template>
                </el-table-column>
                <el-table-column label="机床图号" align="center" width="130" prop="机床图号" show-overflow-tooltip>
                  <template slot-scope="scope">
                    {{ scope.row.机床图号 }}
                  </template>
                </el-table-column>
                <el-table-column label="组号" align="center" min-width="50">
                  <template slot-scope="scope">
                    {{ scope.row.组号 }}
                  </template>
                </el-table-column>
                <el-table-column label="名称" align="center" width="180" prop="名称">
                  <template slot-scope="scope">
                    {{ scope.row.物料名称 }}
                  </template>
                </el-table-column>
                <el-table-column label="规格" align="center" width="250" prop="物料规格" show-overflow-tooltip>
                  <template slot-scope="scope">
                    {{ scope.row.物料规格 }}
                  </template>
                </el-table-column>
                <el-table-column label="图号或型号" align="center" min-width="130" prop="物料型号">
                  <template slot-scope="scope">
                    {{ scope.row.物料型号 }}
                  </template>
                </el-table-column>
                <el-table-column label="分配数" align="center" min-width="60">
                  <template slot-scope="scope">
                    {{ scope.row.零件数量 }}
                  </template>
                </el-table-column>
                <el-table-column label="待询价数" align="center" min-width="80">
                  <template slot-scope="scope">
                    {{ Number(scope.row.零件类型) === 1 ? scope.row.待询价数量 = Number(scope.row.零件数量) - Number(scope.row.使用库存数) : scope.row.待询价数量 = Number(scope.row.零件数量) - Number(scope.row.使用滞货数量) }}
                  </template>
                </el-table-column>
                <el-table-column label="库存(BZ)" align="center" min-width="70" prop="库存">
                  <template slot-scope="scope">
                    {{ Number(scope.row.零件类型) === 1 ? scope.row.库存 = Number(scope.row.货位存量 ? scope.row.货位存量 : 0) - Number(scope.row.占用数量) : '-' }}
                  </template>
                </el-table-column>
                <el-table-column label="使用库存数量" align="center" min-width="105" prop="使用库存数">
                  <template slot-scope="scope">
                    <span v-if="Number(scope.row.零件类型) !== 1">-</span>
                    <el-input-number v-if="Number(scope.row.零件类型) === 1" v-model="scope.row.使用库存数" :min="0" :max="Number(scope.row.零件数量) > (Number(scope.row.货位存量) - Number(scope.row.占用数量)) ? (Number(scope.row.货位存量) - Number(scope.row.占用数量) + Number(scope.row.使用库存数)) : Number(scope.row.零件数量)" :disabled="(Number(scope.row.货位存量) - Number(scope.row.占用数量)) === 0 || parseInt(scope.row.采购状态编号)===3" size="mini" style="width: 90px" @change="changeNumber(scope.row)"/>
                  </template>
                </el-table-column>
                <el-table-column label="已用滞货" align="center" min-width="70">
                  <template slot-scope="scope">
                    {{ Number(scope.row.使用滞货数量) }}
                  </template>
                </el-table-column>
                <el-table-column label="使用滞货" align="center" min-width="70">
                  <template slot-scope="scope">
                    <!--<el-tooltip class="item" effect="dark" content="使用滞货" placement="top-start">-->
                    <template v-if="parseInt(scope.row.询价状态编号)!==1||parseInt(scope.row.是否确认)!==1||Number(scope.row.滞货数量)===0">
                      —
                    </template>
                    <el-button v-else :disabled="parseInt(scope.row.询价状态编号)!==1||parseInt(scope.row.是否确认)!==1||Number(scope.row.滞货数量)===0" icon="el-icon-goods" plain type="primary" size="mini" @click="useInventory(scope.row)"/>
                    <!--</el-tooltip>-->
                    <!--<el-tooltip class="item" effect="dark" content="取消使用滞货" placement="top-start">-->
                    <!--<el-button :disabled="parseInt(scope.row.询价状态编号)!==1||parseInt(scope.row.是否确认)!==1||Number(scope.row.使用滞货数量)===0" icon="el-icon-sold-out" plain type="danger" size="mini" @click="cancelUseInventory(scope.row)"/>-->
                    <!--</el-tooltip>-->
                  </template>
                </el-table-column>
                <el-table-column label="可用滞货" align="center" min-width="80">
                  <template slot-scope="scope">
                    {{ Number(scope.row.滞货数量) }}
                  </template>
                </el-table-column>
                <el-table-column label="分配时间" align="center" min-width="90">
                  <template slot-scope="scope">
                    {{ scope.row.任务分配时间.split(' ')[0] }}
                  </template>
                </el-table-column>
                <el-table-column label="设计者" align="center" min-width="60">
                  <template slot-scope="scope">
                    {{ scope.row.组件设计者 || scope.row.机床设计者 || '—' }}
                  </template>
                </el-table-column>
                <!--<el-table-column label="询价单编号" align="center" min-width="100">-->
                <!--<template slot-scope="scope">-->
                <!--<b v-if="inquiry(scope.row)">{{ scope.row.询价单编号 }}</b>-->
                <!--<b v-else>—</b>-->
                <!--</template>-->
                <!--</el-table-column>-->
                <!--<el-table-column :filters="source" :filter-method="filterSource" align="center" label="数据来源" min-width="90px" prop="零件类型">-->
                <!--<template slot-scope="scope">-->
                <!--{{ Number(scope.row.零件类型) === 1 ? 'BZ' : 'WG' }}-->
                <!--</template>-->
                <!--</el-table-column>-->
              </el-table>
              <div class="block">
                <el-pagination
                  :current-page="pageCurrent11"
                  :page-sizes="[10, 50, 100, 150]"
                  :page-size="pageSize11"
                  :total="total11"
                  style="display:inline-block;width:50px"
                  layout="total"
                  @size-change="handleSizeChange11"
                  @current-change="handleCurrentChange11"/>
                <el-tooltip :open-delay="1000" effect="dark" content="为选择的询价单添加物料" placement="top">
                  <el-button
                    type="warning"
                    size="small"
                    style="margin: 0px 20px"
                    @click="addInquirySheet">选入物料</el-button>
                </el-tooltip>
              </div>
            </el-row>
          </el-tab-pane>
          <el-tab-pane label="基本件" name="基本件">
            <el-row style="margin-bottom: 10px">
              <!--<el-select v-model="projectValue" placeholder="项目名称" size="small" style="width: 100px" filterable clearable @change="projectChange">-->
              <!--<el-option-->
              <!--v-for="item in project"-->
              <!--:key="item.value"-->
              <!--:label="item.label"-->
              <!--:value="item.value"/>-->
              <!--</el-select>-->
              <el-input v-model="partNum" placeholder="图号名称规格" size="small" clearable @keyup.enter.native="searchTable12()"/>
              <el-input v-model="supplierName" placeholder="供货商" size="small" style="width:120px" clearable/>
              <el-select v-model="machineValue" placeholder="机床" size="small" clearable filterable>
                <el-option
                  v-for="item in machine"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"/>
              </el-select>
              <!--<el-select v-model="groupValue" placeholder="组号" size="small" style="width: 100px" clearable filterable>-->
              <!--<el-option-->
              <!--v-for="item in group"-->
              <!--:key="item.value"-->
              <!--:label="item.label"-->
              <!--:value="item.value"/>-->
              <!--</el-select>-->
              <!--<el-cascader :options="materialStatus" :props="{ checkStrictly: true }" v-model="materialStatusValue" style="width: 100px" size="small"/>-->
              <el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="searchTable12()">查询</el-button>
              <el-button type="warning" size="small" icon="el-icon-download" style="margin-left: 10px" @click="exportUninquirySheet">导出未询价单</el-button>
              <el-date-picker
                v-model="endTime"
                size="small"
                type="daterange"
                align="center"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                range-separator="～"
                style="width:250px"
                start-placeholder="开始日期"
                end-placeholder="结束日期"/>
              <el-button type="success" size="small" style="float: right" @click="visible2 = false;tiaozheng2()">调整采购任务</el-button>
              <el-select v-model="PersonValue" style="width:100px;float: right" placeholder="人员" size="small" filterable clearable>
                <el-option
                  v-for="item in Person"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"/>
              </el-select>
              <!--<el-popover v-model="visible2" title="调整采购任务" placement="top" width="180">-->
              <!--<div style="text-align: right; margin: 0">-->
              <!--<el-select v-model="PersonValue" style="width:150px" placeholder="人员" size="small" filterable clearable>-->
              <!--<el-option-->
              <!--v-for="item in Person"-->
              <!--:key="item.value"-->
              <!--:label="item.label"-->
              <!--:value="item.value"/>-->
              <!--</el-select>-->
              <!--<el-button type="primary" size="mini" @click="visible2 = false;tiaozheng2()">确定</el-button>-->
              <!--</div>-->
              <!--<el-button slot="reference" type="success" size="small" plain style="float: right;margin-right: 20px">调整采购任务</el-button>-->
              <!--</el-popover>-->
              <!--<el-input v-model="partName" placeholder="零件名称" size="small" style="width: 120px" clearable/>-->
              <!--<el-input v-model="partSpec" placeholder="零件规格" size="small" style="width: 120px" clearable/>-->
            </el-row>
            <el-row style="margin-bottom: 10px">
              <el-table
                v-loading="loading"
                :data="tableData12"
                :row-class-name="tableRowClassName2"
                border
                style="width: 100%;max-height: 500px;"
                height="500px"
                size="mini"
                @selection-change="handleSelectionChange2"
                @select="handleSelection1">
                <el-table-column :selectable="selectable" align="center" width="50" type="selection"/>
                <!--<el-table-column label="操作" align="center" width="100" fixed="left">-->
                <!--<template slot-scope="scope">-->
                <!--<el-button :disabled="parseInt(scope.row.询价状态编号)!==1||parseInt(scope.row.是否确认)!==1" type="primary" size="mini" @click="partChange(scope.row)">零件变更</el-button>-->
                <!--</template>-->
                <!--</el-table-column>-->
                <!--<el-table-column label="采购状态" align="center" width="80">-->
                <!--<template slot-scope="scope">-->
                <!--<el-tag v-if="unInquiry(scope.row)" type="warning" size="small">未询价</el-tag>-->
                <!--<el-tag v-if="inquiry(scope.row)" type="success" size="small">已询价</el-tag>-->
                <!--<el-tag v-if="approval(scope.row)" type="primary" size="small">审批中</el-tag>-->
                <!--<el-tag v-if="purchased(scope.row)" type="info" size="small">已采购</el-tag>-->
                <!--</template>-->
                <!--</el-table-column>-->
                <el-table-column :filters="supplierFilters" :filter-method="filterHandler" label="供货商" align="center" min-width="100" prop="供货商">
                  <template slot-scope="scope">
                    {{ scope.row.供货商 }}
                  </template>
                </el-table-column>
                <el-table-column :filters="remarkFilters" :filter-method="filterHandler0" label="备注" align="center" min-width="100" prop="备注">
                  <template slot-scope="scope">
                    {{ scope.row.备注 }}
                  </template>
                </el-table-column>
                <el-table-column label="图号" align="center" min-width="130">
                  <template slot-scope="scope">
                    {{ scope.row.零件图号 }}
                  </template>
                </el-table-column>
                <el-table-column label="名称" align="center" min-width="60">
                  <template slot-scope="scope">
                    {{ scope.row.零件名称 }}
                  </template>
                </el-table-column>
                <el-table-column label="规格" align="center" min-width="80">
                  <template slot-scope="scope">
                    {{ scope.row.规格 }}
                  </template>
                </el-table-column>
                <!--                <el-table-column label="项目名称" align="center" min-width="100">-->
                <!--                  <template slot-scope="scope">-->
                <!--                    {{ scope.row.项目名称 }}-->
                <!--                  </template>-->
                <!--                </el-table-column>-->
                <el-table-column label="机床图号" align="center" min-width="130">
                  <template slot-scope="scope">
                    {{ scope.row.机床图号 }}
                  </template>
                </el-table-column>
                <el-table-column label="组号" align="center" min-width="50">
                  <template slot-scope="scope">
                    {{ scope.row.组号 }}
                  </template>
                </el-table-column>
                <el-table-column label="材料" align="center" min-width="80">
                  <template slot-scope="scope">
                    {{ scope.row.材料 }}
                  </template>
                </el-table-column>
                <el-table-column label="数量" align="center" min-width="60">
                  <template slot-scope="scope">
                    {{ scope.row.零件数量 }}
                  </template>
                </el-table-column>
                <el-table-column label="分配时间" align="center" min-width="100">
                  <template slot-scope="scope">
                    {{ scope.row.任务分配时间.split(' ')[0] }}
                  </template>
                </el-table-column>
                <el-table-column label="设计者" align="center" min-width="60">
                  <template slot-scope="scope">
                    {{ scope.row.组件设计者 || scope.row.机床设计者 || '—' }}
                  </template>
                </el-table-column>
                <!--<el-table-column label="询价单编号" align="center" min-width="100">-->
                <!--<template slot-scope="scope">-->
                <!--<b v-if="inquiry(scope.row)">{{ scope.row.询价单编号 }}</b>-->
                <!--<b v-else>—</b>-->
                <!--</template>-->
                <!--</el-table-column>-->
              </el-table>
            </el-row>
            <div class="block">
              <el-pagination
                :current-page="pageCurrent12"
                :page-sizes="[10, 50, 100, 150]"
                :page-size="pageSize12"
                :total="total12"
                style="display:inline-block;width:50px"
                layout="total"
                @size-change="handleSizeChange12"
                @current-change="handleCurrentChange12"/>
              <el-tooltip :open-delay="1000" effect="dark" content="为选择的询价单添加物料" placement="top">
                <el-button
                  type="warning"
                  size="small"
                  style="margin: 0px 20px"
                  @click="addInquirySheet">选入物料</el-button>
              </el-tooltip>
            </div>
          </el-tab-pane>
          <!--<el-tab-pane v-show="false" label="标准件" name="标准件">-->
          <!--<el-row style="margin-bottom: 5px">-->
          <!--<span>项目名称:</span>-->
          <!--<el-select v-model="projectValue" style="width:200px" placeholder="项目名称" size="small" filterable clearable @change="projectChange">-->
          <!--<el-option-->
          <!--v-for="item in project"-->
          <!--:key="item.value"-->
          <!--:label="item.label"-->
          <!--:value="item.value"/>-->
          <!--</el-select>-->
          <!--<span>机床图号:</span>-->
          <!--<el-select v-model="machineValue" style="width:200px" placeholder="请选择" size="small" clearable filterable @change="machineChange">-->
          <!--<el-option-->
          <!--v-for="item in machine"-->
          <!--:key="item.value"-->
          <!--:label="item.label"-->
          <!--:value="item.value"/>-->
          <!--</el-select>-->
          <!--<span>组号:</span>-->
          <!--<el-select v-model="groupValue" style="width:200px" placeholder="请选择" size="small" clearable filterable>-->
          <!--<el-option-->
          <!--v-for="item in group"-->
          <!--:key="item.value"-->
          <!--:label="item.label"-->
          <!--:value="item.value"/>-->
          <!--</el-select>-->
          <!--</el-row>-->
          <!--<el-row style="margin-bottom: 5px">-->
          <!--<span style="margin-right: -10px">物料状态:</span>-->
          <!--<el-cascader :options="materialStatus" :props="{ checkStrictly: true }" v-model="materialStatusValue" size="small" style="margin-left: 10px"/>-->
          <!--<span>零件图号:</span>-->
          <!--<el-input v-model="partNum" placeholder="零件图号" size="small" clearable/>-->
          <!--</el-row>-->
          <!--<el-row style="margin-bottom: 10px">-->
          <!--<span>零件名称:</span>-->
          <!--<el-input v-model="partName" placeholder="零件名称" size="small" clearable/>-->
          <!--<span>零件规格:</span>-->
          <!--<el-input v-model="partSpec" placeholder="零件规格" size="small" clearable/>-->
          <!--<span style="margin-left: 10px">时间段:</span>-->
          <!--<el-date-picker-->
          <!--v-model="endTime"-->
          <!--size="small"-->
          <!--type="daterange"-->
          <!--align="center"-->
          <!--value-format="yyyy-MM-dd"-->
          <!--format="yyyy-MM-dd"-->
          <!--range-separator="～"-->
          <!--style="width:250px"-->
          <!--start-placeholder="开始日期"-->
          <!--end-placeholder="结束日期"/>-->
          <!--<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent12=1;pageSize12=100;total12=0;searchTable12()">查询</el-button>-->
          <!--<el-button type="warning" size="small" icon="el-icon-download" style="margin-left: 10px" @click="exportUninquirySheet">导出未询价物料清单</el-button>-->
          <!--<el-popover v-model="visible2" title="调整采购任务" placement="top" width="180">-->
          <!--<div style="text-align: right; margin: 0">-->
          <!--<el-select v-model="PersonValue" style="width:150px" placeholder="人员" size="small" filterable clearable>-->
          <!--<el-option-->
          <!--v-for="item in Person"-->
          <!--:key="item.value"-->
          <!--:label="item.label"-->
          <!--:value="item.value"/>-->
          <!--</el-select>-->
          <!--<el-button type="primary" size="mini" @click="visible2 = false;tiaozheng2()">确定</el-button>-->
          <!--</div>-->
          <!--<el-button slot="reference" type="success" size="small" plain style="float: right;margin-right: 20px">调整采购任务</el-button>-->
          <!--</el-popover>-->
          <!--</el-row>-->
          <!--<el-row style="margin-bottom: 10px">-->
          <!--<el-table v-loading="" :data="tableData13" size="mini" style="max-height: 600px" height="500px" border stripe @selection-change="handleSelectionChange3">-->
          <!--<el-table-column :selectable="selectable" align="center" type="selection"/>-->
          <!--<el-table-column align="center" label="采购情况" prop="询价状态编号" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--<el-tag v-if="scope.row.人员编号===''" type="primary" size="small">未分配</el-tag>-->
          <!--<el-tag v-if="parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!==''" type="warning" size="small">未询价</el-tag>-->
          <!--<el-tag v-if="parseInt(scope.row.询价状态编号)===3&&parseInt(scope.row.采购状态编号)!==3" type="success" size="small">已询价</el-tag>-->
          <!--<el-tag v-if="parseInt(scope.row.采购状态编号)===3" type="info" size="small">已采购</el-tag>-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" label="项目名称" prop="项目名称" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.项目名称 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" prop="机床图号" label="机床图号" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.机床图号 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" label="组号" min-width="80px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.组号 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" prop="物料类别" label="物料类别" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.物料类别 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" prop="物料品种" label="物料品种" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.物料品种 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" prop="物料型号" label="图号或型号" min-width="110px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.物料型号 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" prop="物料名称" label="名称" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.物料名称 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" prop="物料规格" label="规格" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.物料规格 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" label="数量" min-width="80px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.零件数量 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" label="备注" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.备注 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" prop="供货商" label="供货商" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.供货商 }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" label="计划到货时间" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.物料计划到货时间.split(' ')[0] }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" label="生产分配时间" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.操作日期.split(' ')[0] }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" label="采购员" min-width="80px" prop="姓名">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.姓名 ? scope.row.姓名 : '—' }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" label="采购分配时间" min-width="100px">-->
          <!--<template slot-scope="scope">-->
          <!--{{ scope.row.任务分配时间 ? scope.row.任务分配时间.split(' ')[0] : '—' }}-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--<el-table-column align="center" label="撤回分配" min-width="100px" fixed="right">-->
          <!--<template slot-scope="scope">-->
          <!--<el-tooltip :open-delay="1200" effect="dark" content="撤回已分配的采购任务" placement="top">-->
          <!--<el-button-->
          <!--:disabled="!(parseInt(scope.row.询价状态编号)===1&&scope.row.人员编号!=='')"-->
          <!--type="primary"-->
          <!--size="mini"-->
          <!--plain-->
          <!--icon="el-icon-back"-->
          <!--@click="retract(scope.row)">撤回</el-button>-->
          <!--</el-tooltip>-->
          <!--</template>-->
          <!--</el-table-column>-->
          <!--</el-table>-->
          <!--</el-row>-->
          <!--<div class="block">-->
          <!--<el-pagination-->
          <!--:current-page="pageCurrent13"-->
          <!--:page-sizes="[10, 20, 30, 40]"-->
          <!--:page-size="pageSize13"-->
          <!--:total="total13"-->
          <!--style="display:inline-block;width:50%"-->
          <!--layout="total, sizes, prev, pager, next, jumper"-->
          <!--@size-change="handleSizeChange13"-->
          <!--@current-change="handleCurrentChange13"/>-->
          <!--</div>-->
          <!--</el-tab-pane>-->
        </el-tabs>
      </el-col>
    </el-row>

    <el-card>
      <el-card style="width: 1188px">
        <el-row>
          <el-input v-model="inquirySheetNum" placeholder="询价单号或供应商" size="small" clearable @keyup.enter.native="pageCurrent2=1;pageSize2=10000;total2=0;searchTable2()"/>
          <el-button
            type="success"
            size="mini"
            icon="el-icon-search"
            style="margin:0px 10px"
            @click="pageCurrent2=1;pageSize2=10000;total2=0;searchTable2()">查询</el-button>
          <el-button
            type="primary"
            icon="el-icon-circle-plus-outline"
            size="mini"
            style="margin-left: 10px"
            @click="createInquirySheet">创建</el-button>
          <el-button type="warning" size="mini" plain icon="el-icon-edit" style="margin-left: 10px" @click="editInquirySheet()">编辑</el-button>
          <el-button type="danger" size="mini" plain icon="el-icon-delete" style="margin-left: 10px" @click="deleteInquirySheet()">删除</el-button>
          <el-button :disabled="tableData3.length===0" type="primary" size="small" plain style="float: right" @click="printInquirySheet()">打印</el-button>
          <el-button :disabled="tableData3.length===0" type="warning" size="small" style="margin-left:10px;float: right" @click="exportInquirySheet()">导出</el-button>
        </el-row>
      </el-card>
      <el-row>
        <el-col style="width:310px">
          <el-card style="width:310px">
            <el-table v-loading="" :data="tableData2" border style="width:320px;float: left;margin-right: 20px" height="500px" size="mini" highlight-current-row @row-click="searchTable3">
              <el-table-column label="询价单编号" align="center" width="100" show-overflow-tooltip>
                <template slot-scope="scope">
                  {{ scope.row.询价单编号 }}
                </template>
              </el-table-column>
              <el-table-column label="供应商" align="center" width="180" show-overflow-tooltip>
                <template slot-scope="scope">
                  {{ scope.row.供应商名称 }}
                </template>
              </el-table-column>
            <!--        <el-table-column label="电话" align="center" min-width="100">-->
            <!--          <template slot-scope="scope">-->
            <!--            {{ scope.row.电话号码 }}-->
            <!--          </template>-->
            <!--        </el-table-column>-->
            <!--        <el-table-column label="传真" align="center" min-width="100">-->
            <!--          <template slot-scope="scope">-->
            <!--            {{ scope.row.传真 }}-->
            <!--          </template>-->
            <!--        </el-table-column>-->
            <!--        <el-table-column label="受托人" align="center" min-width="70">-->
            <!--          <template slot-scope="scope">-->
            <!--            {{ scope.row.注册资本 }}-->
            <!--          </template>-->
            <!--        </el-table-column>-->
            <!--        <el-table-column label="帐号" align="center" min-width="100" show-overflow-tooltip>-->
            <!--          <template slot-scope="scope">-->
            <!--            {{ scope.row.帐号 }}-->
            <!--          </template>-->
            <!--        </el-table-column>-->
            <!--        <el-table-column label="开户行" align="center" min-width="100" show-overflow-tooltip>-->
            <!--          <template slot-scope="scope">-->
            <!--            {{ scope.row.开户行 }}-->
            <!--          </template>-->
            <!--        </el-table-column>-->
            <!--        <el-table-column label="税号" align="center" min-width="100">-->
            <!--          <template slot-scope="scope">-->
            <!--            {{ scope.row.税号 }}-->
            <!--          </template>-->
            <!--        </el-table-column>-->
            <!--        <el-table-column label="法人" align="center" min-width="70">-->
            <!--          <template slot-scope="scope">-->
            <!--            {{ scope.row.企业性质 }}-->
            <!--          </template>-->
            <!--        </el-table-column>-->
            <!--        <el-table-column label="邮编" align="center" min-width="70">-->
            <!--          <template slot-scope="scope">-->
            <!--            {{ scope.row.货期 }}-->
            <!--          </template>-->
            <!--        </el-table-column>-->
            <!--        <el-table-column label="操作" align="center" width="200" fixed="right">-->
            <!--          <template slot-scope="scope">-->
            <!--            &lt;!&ndash;            <el-button type="warning" size="mini" plain icon="el-icon-edit" @click="editInquirySheet(scope.row)">编辑</el-button>&ndash;&gt;-->
            <!--            &lt;!&ndash;            <el-button type="danger" size="mini" plain icon="el-icon-delete" @click="deleteInquirySheet()">删除</el-button>&ndash;&gt;-->
            <!--          </template>-->
            <!--        </el-table-column>-->
            </el-table>
          </el-card>
        </el-col>
        <!--<div class="block" style="margin: 10px 0;">-->
        <!--<el-pagination-->
        <!--:current-page="pageCurrent2"-->
        <!--:page-sizes="[10, 20, 30, 40]"-->
        <!--:page-size="pageSize2"-->
        <!--:total="total2"-->
        <!--layout="total"-->
        <!--@size-change="handleSizeChange2"-->
        <!--@current-change="handleCurrentChange2"/>-->
        <!--</div>-->
        <el-col style="width:880px">
          <el-card>
            <el-table v-loading="" :data="tableData3" border style="max-height: 500px;width: 100%;float: left" height="500px" size="mini" >
              <!--            <el-table-column label="供应商" align="center" min-width="150" show-overflow-tooltip>-->
              <!--              <template slot-scope="scope">-->
              <!--                {{ scope.row.供应商名称 }}-->
              <!--              </template>-->
              <!--            </el-table-column>-->
              <el-table-column label="图号" align="center" width="120" show-overflow-tooltip>
                <template slot-scope="scope">
                  {{ scope.row.组件零件流水号 ? scope.row.物料型号 : scope.row.零件图号 }}
                </template>
              </el-table-column>
              <el-table-column label="名称" align="center" width="100" show-overflow-tooltip>
                <template slot-scope="scope">
                  {{ scope.row.组件零件流水号 ? scope.row.物料名称 : scope.row.零件名称 }}
                </template>
              </el-table-column>
              <el-table-column label="规格" align="center" show-overflow-tooltip>
                <template slot-scope="scope">
                  {{ scope.row.组件零件流水号 ? scope.row.物料规格 : scope.row.规格 }}
                </template>
              </el-table-column>
              <el-table-column label="待询数" align="center" width="60">
                <template slot-scope="scope">
                  {{ scope.row.技术下达数量 }}
                </template>
              </el-table-column>
              <el-table-column label="实询数" align="center" width="110">
                <template slot-scope="scope">
                  <el-input v-direction="{x: 0, y: scope.$index}" v-model="scope.row.数量" size="mini" style="width: 75px" @change="saveOrder(scope.row)"/>
                </template>
              </el-table-column>
              <el-table-column label="单位" align="center" width="50">
                <template slot-scope="scope">
                  {{ scope.row.计量单位 }}
                </template>
              </el-table-column>
              <el-table-column label="询价备注" align="center" width="110">
                <template slot-scope="scope">
                  <el-input v-direction="{x: 1, y: scope.$index}" v-model="scope.row.备注" size="mini" style="width: 75px" @change="saveOrder(scope.row)"/>
                </template>
              </el-table-column>
              <!--            <el-table-column label="询价单编号" align="center" min-width="100">-->
              <!--              <template slot-scope="scope">-->
              <!--                {{ scope.row.询价单编号 }}-->
              <!--              </template>-->
              <!--            </el-table-column>-->
              <el-table-column label="机床图号" align="center" width="100">
                <template slot-scope="scope">
                  {{ scope.row.机床图号 || scope.row.基本件机床图号 }}
                </template>
              </el-table-column>
              <el-table-column label="组号" align="center" width="50">
                <template slot-scope="scope">
                  {{ scope.row.组号 || scope.row.基本件组号 }}
                </template>
              </el-table-column>
              <el-table-column label="操作" align="center" width="50">
                <template slot-scope="scope">
                  <el-tooltip :open-delay="1000" effect="dark" content="将该物料从询价单中移出" placement="top">
                    <el-button type="text" size="mini" icon="el-icon-right" @click="outInquirySheet(scope.row)"/>
                  </el-tooltip>
                </template>
              </el-table-column>
            </el-table>
          </el-card>
        </el-col>
      </el-row>
    </el-card>

    <div id="inquirySheet" style="width: 800px;margin: 0 auto;display:none">
      <table class="inquirySheet" cellspacing="0px" align="center" border="1 solid black" width="100%">
        <tr>
          <th style="border: none;text-align:left;font-size: 30px;font-weight: bold" colspan="3"><div style="margin: 10px;">GAOJING</div></th>
          <th style="border: none;text-align:center;font-size: 30px;font-weight: bold" colspan="8"><div style="margin: 10px;">采购询价单</div></th>
          <th style="border: none;" colspan="3"/>
        </tr>
        <tr>
          <td style="border: none;" colspan="2">询价单编号:</td>
          <td id="inquirySheetNum" style="border: none;" colspan="4"/>
          <td style="border: none;" colspan="2">供应商名称:</td>
          <td id="supplier" style="border: none;" colspan="6"/>
        </tr>
        <tr id="tablehead">
          <td width="8.3%">序号</td>
          <td width="16.6%" colspan="2">图号</td>
          <td width="16.6%" colspan="2">名称</td>
          <td width="16.6%" colspan="2">规格</td>
          <td width="8.3%">数量</td>
          <td width="8.3%">单位</td>
          <td width="16.6%" colspan="2">单价</td>
          <td colspan="3">备注</td>
        </tr>
        <tr>
          <td colspan="2">合计</td>
          <td colspan="5"/>
          <td colspan="4"/>
          <td colspan="3"/>
        </tr>
        <tr>
          <td colspan="14">请速确认后回传合同及具体交货期限，回传：{{ form3.fax }}，联系人：{{ form3.contact }}{{ form3.phone }}，</td>
        </tr>
        <tr>
          <td colspan="14">邮箱：{{ form3.email }}；公司地址：{{ form3.companyAddress }}；公司电话：{{ form3.companyPhone }}；</td>
        </tr>
        <tr>
          <td colspan="14">税号：{{ form3.taxNumber }}；邮编：{{ form3.postCode }}；帐号：{{ form3.account }}；</td>
        </tr>
        <tr>
          <td colspan="14">开户行：{{ form3.bank }}；送货地址：{{ form3.shippingAddress }}；</td>
        </tr>
      </table>
    </div>

    <el-dialog v-el-drag-dialog :visible.sync="dialogVisible1" title="供应商选择" center style="min-height: 300px" width="700px">
      <el-form ref="form1" :model="form1" label-position="left" label-width="90px" class="searchForm">
        <el-row>
          <el-col :span="12">
            <el-form-item label="供应商名称">
              <el-input v-model="supplierName" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="法人">
              <el-input v-model="enterpriseNature" size="small"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="邮编">
              <el-input v-model="goodTime" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="受托人">
              <el-input v-model="registeredCapital" size="small"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="税号">
              <el-input v-model="taxNum" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电子邮箱">
              <el-input v-model="EMail" size="small"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="地址">
              <el-input v-model="address" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="账号">
              <el-input v-model="account" size="small"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="开户行">
              <el-input v-model="openingBank" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="电话号码">
              <el-input v-model="phone" size="small"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="传真">
              <el-input v-model="fax" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-button
              type="success"
              size="small"
              icon="el-icon-search"
              @click="searchSupplier">查询</el-button>
            <el-button
              type="primary"
              size="small"
              icon="el-icon-check"
              @click="submitSelectSupplier">确定</el-button>
            <el-button
              type="danger"
              size="small"
              icon="el-icon-delete"
              @click="emptySupplierDetail">清空</el-button>
          </el-col>
        </el-row>
        <el-table :data="tableData01" size="mini" style="width: 97%;max-height: 300px;margin-top:15px" height="200px" border @row-click="showSupplierDetail">
          <el-table-column align="center" label="供应商名称" min-width="250">
            <template slot-scope="scope">
              {{ scope.row.供应商名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="法人" min-width="100">
            <template slot-scope="scope">
              {{ scope.row.企业性质 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="受托人" min-width="100">
            <template slot-scope="scope">
              {{ scope.row.注册资本 }}
            </template>
          </el-table-column>
        </el-table>
      </el-form>
    </el-dialog>

    <el-dialog v-el-drag-dialog :visible.sync="dialogVisible2" :title="title2" center style="min-height: 300px" width="400px">
      <el-form ref="form2" :model="form2" :rules="rules2" label-position="left" label-width="90px">
        <el-form-item label="询价单号" prop="inquirySheetNum">
          <el-input v-model="form2.inquirySheetNum" size="small"/>
        </el-form-item>
        <el-form-item label="供应商" prop="supplierNameValue">
          <el-select v-model="form2.supplierNameValue" style="width:200px" placeholder="供应商" size="small" filterable>
            <el-option
              v-for="item in supplierNames"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
        </el-form-item>
        <!--<el-form-item label="供应商" prop="supplierName">-->
        <!--<el-input v-model="form2.supplierName" size="small" readonly @focus="dialogVisible1=true;enterpriseNature = '';createDate = '';registeredCapital = '';taxNum = '';EMail = '';address = '';account = '';openingBank = '';phone = '';fax = '';goodTime = ''"/>-->
        <!--</el-form-item>-->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogVisible2=false">取消</el-button>
        <el-button
          v-show="title2==='创建询价单'"
          type="primary"
          size="small"
          @click="submitCreateInquirySheet1">确定</el-button>
        <el-button
          v-show="title2==='编辑询价单'"
          type="primary"
          size="small"
          @click="submitEditInquirySheet">确定</el-button>
      </div>
    </el-dialog>

    <el-dialog v-el-drag-dialog :visible.sync="dialogVisible3" title="物料变更选择" center style="min-height: 300px;" width="780px">
      <el-row style="margin-bottom: 10px">
        <span>物料名称：</span>
        <el-input v-model="materialName0" placeholder="物料名称" size="small" clearable/>
        <span>物料规格：</span>
        <el-input v-model="materialSpec0" placeholder="物料规格" size="small" clearable/>
      </el-row>
      <el-row style="margin-bottom: 10px">
        <span>物料型号：</span>
        <el-input v-model="materialModel0" placeholder="物料型号" size="small" clearable/>
        <el-button type="success" size="small" icon="el-icon-search" style="margin-left:10px" @click="pageCurrent02=1;pageSize02=10;total02=0;searchMaterial()">查询</el-button>
      </el-row>
      <el-table :data="tableData02" size="mini" style="width: 97%;max-height: 300px;margin-top:15px" height="400px" border highlight-current-row @row-click="selectNewMaterial">
        <el-table-column align="center" label="物料名称" min-width="150">
          <template slot-scope="scope">
            {{ scope.row.物料名称 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="物料规格" min-width="150">
          <template slot-scope="scope">
            {{ scope.row.物料规格 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="物料型号" min-width="150">
          <template slot-scope="scope">
            {{ scope.row.物料型号 }}
          </template>
        </el-table-column>
      </el-table>
      <div class="block" style="margin: 10px 0;">
        <el-pagination
          :current-page="pageCurrent02"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="pageSize02"
          :total="total02"
          style="display:inline-block;width:50%"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange02"
          @current-change="handleCurrentChange02"/>
      </div>
      <span style="font-size: large;color: red">将原物料替换为: {{ materialNew }}</span>
      <!--<el-input v-model="materialNew" size="small" readonly style="margin: 10px 10px 0 10px"></el-input>-->
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogVisible3=false">取消</el-button>
        <el-button type="primary" size="small" @click="submitMaterialChange">确定</el-button>
      </div>
    </el-dialog>

    <el-dialog v-el-drag-dialog :visible.sync="dialogVisible4" title="使用滞货" center style="min-height: 300px;" width="400px">
      <span>使用滞货数量：</span>
      <el-input-number :min="0" :max="maxUseNumber" v-model="useNumber" controls-position="right"/>
      <div style="margin: 10px 0 0 10px;color: red">注意：确定后将不可取消使用滞货</div>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogVisible4=false">取消</el-button>
        <el-button :disabled="Number(useNumber)===0" type="primary" size="small" @click="submitUseInventory">确定</el-button>
      </div>
    </el-dialog>

    <el-dialog :visible.sync="dialogVisible5" title="询价单基础信息维护" center style="min-height: 300px;" width="620px">
      <el-form ref="form3" :model="form3" label-position="right" label-width="70px" class="baseInfo">
        <el-row>
          <el-col :span="12">
            <el-form-item label="联系人">
              <el-input v-model="form3.contact" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="手机">
              <el-input v-model="form3.phone" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="传真">
              <el-input v-model="form3.fax" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="邮箱">
              <el-input v-model="form3.email" size="small"/>
            </el-form-item>
          </el-col>
        </el-row>
        <hr>
        <el-row>
          <el-col :span="12">
            <el-form-item label="公司地址">
              <el-input v-model="form3.companyAddress" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="邮编">
              <el-input v-model="form3.postCode" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司电话">
              <el-input v-model="form3.companyPhone" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="税号">
              <el-input v-model="form3.taxNumber" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="送货地址">
              <el-input v-model="form3.shippingAddress" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="帐号">
              <el-input v-model="form3.account" size="small"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="开户行">
              <el-input v-model="form3.bank" size="small"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogVisible5=false">取消</el-button>
        <el-button type="primary" size="small" @click="submitBaseInfo">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { tiaozheng2, tiaozheng1, getPerson, getBillNum, searchMaterial, searchPart, searchSupplier, searchCreateInquirySheet, searchCreateInquirySheet2, searchSheetDetail, editInquirySheet,
  createInquirySheet, deleteInquirySheet, addInquirySheet1, addInquirySheet2, outInquirySheet, searchAllMaterial, materialChange, saveOrder,
  submitUseInventory, initProject, searchMachine, searchGroup, searchBaseInfo, editBaseInfo, getExport1, getExport2, searchMerge, changeNum } from '@/api/PurchasingCenter/CreateInquirySheet'
import { mapGetters } from 'vuex'
import { exportExcelMethod } from './exportExcel'
import $ from 'jquery'
import request from '@/utils/request'

export default {
  name: '', // 创建询价单
  data() {
    return {
      startTime: '',
      endTime: '',
      loading: false,
      标准件和外购件流水号: [],
      基本件流水号: [],
      visible: false,
      visible2: false,
      Person: [],
      PersonValue: '',
      supplierNames: [], // 供应商下拉框
      switchValue: false, // 物料变更列显示开关
      source: [
        {
          text: 'BZ',
          value: 1
        },
        {
          text: 'WG',
          value: 2
        }
      ],
      tabName: '外购件',
      baseInfoLoading: false,
      dialogVisible5: false,
      form3: { // 询价单基础信息表单
        contact: '',
        phone: '',
        fax: '',
        email: '',
        companyAddress: '',
        postCode: '',
        companyPhone: '',
        taxNumber: '',
        shippingAddress: '',
        account: '',
        bank: ''
      },
      projectValue: '',
      project: [],
      machineValue: '',
      machine: [],
      groupValue: '',
      group: [],
      partNum: '',
      partName: '',
      partSpec: '',
      check3: 0, // 供应商
      check4: 0, // 询价单号
      materialStatusValue: [0], // 物料状态
      materialStatus: [
        {
          value: 0,
          label: '全部'
        },
        // {
        //   value: 1,
        //   label: '未分配'
        // },
        {
          value: 2,
          label: '已分配',
          children: [{
            value: 3,
            label: '未询价'
          }, {
            value: 4,
            label: '已询价',
            children: [{
              value: 5,
              label: '未采购'
            }, {
              value: 7,
              label: '审批中'
            }, {
              value: 6,
              label: '已采购'
            }]
          }]
        }
      ], // 物料状态
      materialName: '',
      materialSpec: '',
      materialModel: '',
      tableData11: [], // 外购件列表
      total11: 0,
      pageCurrent11: 1,
      pageSize11: 1000,
      tableData12: [], // 基本件列表
      total12: 0,
      pageCurrent12: 1,
      pageSize12: 1000,
      tableData13: [], // 外购件列表
      total13: 0,
      pageCurrent13: 1,
      pageSize13: 100,
      remarkFilters: [],
      supplierFilters: [],
      tableData2: [], // 询价单列表
      total2: 0,
      pageCurrent2: 1,
      pageSize2: 10000,
      tableData3: [], // 询价单明细
      dialogVisible1: false,
      visible1: false,
      inquirySheetNum: '', // 询价单号
      inquirySheetFlowNum: '', // 询价单流水号
      form1: {},
      supplierCheck1: 0,
      supplierCheck2: 0,
      supplierCheck3: 0,
      supplierCheck4: 0,
      supplierCheck5: 0,
      supplierCheck6: 0,
      supplierCheck7: 0,
      supplierCheck8: 0,
      supplierCheck9: 0,
      supplierCheck10: 0,
      supplierCheck11: 0,
      supplierCheck12: 0,
      supplierValue: '', // 供应商流水号
      supplierName: '', // 供应商名称
      goodTime: '', // 货期
      enterpriseNature: '', // 企业性质
      createDate: '', // 创立日期
      registeredCapital: '', // 注册资本
      taxNum: '', // 税号
      EMail: '', // 电子邮箱
      address: '', // 地址
      account: '', // 账号
      openingBank: '', // 开户行
      phone: '', // 电话号码
      fax: '', // 传真
      tableData01: [], // 供应商
      dialogVisible2: false,
      form2: {
        inquirySheetNumValue: '', // 询价单流水号
        inquirySheetNum: '',
        supplierName: '',
        supplierValue: '',
        supplierNameValue: ''
      },
      rules2: { // 表单验证规则
        inquirySheetNum: [{ required: true, message: '请填写询价单号' }],
        supplierName: [{ required: true, message: '请选择供应商' }],
        supplierNameValue: [{ required: true, message: '请选择供应商', trigger: 'change' }]
      },
      groupPartNum: [], // 组件零件流水号
      groupPartBasicNum: [], // 组件零件基本件流水号
      allNum: [], // 总数量
      dialogVisible3: false,
      materialName0: '',
      materialSpec0: '',
      materialModel0: '',
      tableData02: [],
      total02: 0,
      pageCurrent02: 1,
      pageSize02: 10,
      materialNew: '', // 替换为新物料全称
      materialOldValue: '',
      materialNewValue: '',
      groupPartNumValue: '', // 组件零件流水号
      standardAndPurchaseValue: '', // 标准件和外购件流水号
      title2: '',
      orderExport: '',
      useNumber: '',
      maxUseNumber: '',
      dialogVisible4: false,
      backlogGroupPartNum: '',
      backlogMaterialNum: '',
      cancelNum: 0,
      machines1: [],
      machines2: [],
      numbers: [],
      numbers1: [],
      row1: ''
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'token',
      'id' // 人员编号
    ])
  },
  watch: {
    // 如果路由有变化，会再次执行该方法
    '$route': {
      handler(route) {
        const _this = this
        if (route.name === 'CreateInquirySheet') {
          setTimeout(() => {
            _this.Jump()
          }, 1200)
        }
      }
    }
  },
  created() {
    // this.timeSearch()
    this.getPerson()
    this.fetchData()
    this.projectChange()
    // this.searchTable11() // 查表1
    this.searchTable2() // 查表2
    this.searchUnInquiryPartNumber()
    this.searchUnBuyPartNumber()
    this.initDirection()
  },
  mounted() {
    setTimeout(() => {
      this.Jump()
    }, 500)
  },
  methods: {
    // timeSearch() {
    //   timeSearch().then(response => {
    //     this.startTime = [response.data[0].外购件开始时间, response.data[0].外购件结束时间]
    //     this.endTime = [response.data[0].基本件开始时间, response.data[0].基本件结束时间]
    //     this.searchTable11()
    //   })
    // },
    changeNumber(row) {
      changeNum(row.物料流水号, row.使用库存数, row.机床流水号, row.组件零件流水号, row.零件数量).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('使用成功')
          this.searchTable11()
        } else {
          this.$message.success('使用失败')
        }
      })
    },
    handleSelection(val, row) {
      this.tableData11.forEach((item, i) => {
        if (item.组件零件流水号 === row.组件零件流水号) {
          console.log(this.numbers.indexOf(i), 234)
          if (this.numbers.indexOf(i) === -1) {
            this.numbers.push(i)
          } else {
            this.numbers.splice(this.numbers.indexOf(i), 1)
          }
        }
      })
    },
    handleSelection1(val, row) {
      this.tableData12.forEach((item, i) => {
        if (item.组件零件基本件流水号 === row.组件零件基本件流水号) {
          console.log(this.numbers1.indexOf(i), 234)
          if (this.numbers1.indexOf(i) === -1) {
            this.numbers1.push(i)
          } else {
            this.numbers1.splice(this.numbers1.indexOf(i), 1)
          }
        }
      })
    },
    // timeChange1() {
    //   if (this.startTime) {
    //     timeChange1(this.startTime[0], this.startTime[1])
    //   }
    // },
    // timeChange2() {
    //   if (this.endTime) {
    //     timeChange2(this.endTime[0], this.endTime[1])
    //   }
    // },
    Jump() {
      window.location.hash = '#PurchasingCenter/CreateInquirySheet'
    },
    tiaozheng1() {
      if (this.标准件和外购件流水号.length !== 0) {
        if (this.PersonValue) {
          tiaozheng1(this.PersonValue, this.标准件和外购件流水号).then(response => {
            if (response.data[0].result === '1') {
              this.$message.success('调整成功')
              this.searchTable11()
            } else {
              this.$message.warning('调整失败')
            }
          })
        } else {
          this.$message.warning('请选择人员')
        }
      } else {
        this.$message.warning('请选择物料')
      }
    },
    tiaozheng2() {
      if (this.基本件流水号.length !== 0) {
        if (this.PersonValue) {
          tiaozheng2(this.PersonValue, this.基本件流水号).then(response => {
            if (response.data[0].result === '1') {
              this.$message.success('调整成功')
              this.searchTable12()
            } else {
              this.$message.warning('调整失败')
            }
          })
        } else {
          this.$message.warning('请选择人员')
        }
      } else {
        this.$message.warning('请选择物料')
      }
    },
    getPerson() {
      getPerson().then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.Person.push({
            value: response.data[i].人员编号,
            label: response.data[i].姓名
          })
        }
      })
    },
    initDirection() {
      const direction = this.$getDirection()
      direction.on('keyup', function(e, val) {
        if (e.keyCode === 39) {
          direction.next()
        }
        if (e.keyCode === 37) {
          direction.previous()
        }
        if (e.keyCode === 38) {
          direction.previousLine()
        }
        if (e.keyCode === 40) {
          direction.nextLine()
        }
      })
    },
    clickCard1(project, machine) {
      window.location.hash = '#PurchasingCenter/CreateInquirySheet'
      // var hight = this.$refs.height1.offsetHeight
      // document.documentElement.scrollTop = hight + 140
      this.projectValue = project
      this.machine = []
      this.machineValue = ''
      this.group = []
      this.groupValue = ''
      searchMachine(this.projectValue).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.machine.push({
            value: response.data[i].机床流水号,
            label: response.data[i].机床图号,
            name: response.data[i].机床名称
          })
        }
        this.machineValue = machine
        this.materialStatusValue = [2, 3]
        this.searchTable11()
        this.searchTable12()
      })
    },
    clickCard2(project, machine) {
      window.location.hash = '#PurchasingCenter/CreateInquirySheet'
      // var hight = this.$refs.height1.offsetHeight
      // document.documentElement.scrollTop = hight + 140
      this.projectValue = project
      this.machine = []
      this.machineValue = ''
      this.group = []
      this.groupValue = ''
      searchMachine(this.projectValue).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.machine.push({
            value: response.data[i].机床流水号,
            label: response.data[i].机床图号,
            name: response.data[i].机床名称
          })
        }
        this.machineValue = machine
        this.materialStatusValue = [2, 4, 5]
        this.searchTable11()
        this.searchTable12()
      })
    },
    async searchUnInquiryPartNumber() {
      this.machines1 = []
      await request({
        url: '',
        method: 'post',
        data: {
          type: '3',
          name: ` select 项目流水号,机床流水号,机床图号,sum(未询价零件数) as 未询价零件数,人员编号 from (
                  SELECT 项目流水号,机床流水号,机床图号,count(*) as 未询价零件数,人员编号
                  FROM MRP_计划订单_组件零件清单_标准件和外购件_视图
                  left join (
                  select 采购管理_采购合同_采购部.*,组件零件流水号,数量,已到货数量 from 采购管理_采购合同明细_采购部
                  inner join 采购管理_采购合同_采购部 on 采购管理_采购合同明细_采购部.采购合同流水号 = 采购管理_采购合同_采购部.采购合同流水号
                  where 采购管理_采购合同_采购部.是否未通过 = 0
                  ) as 通过的合同 on 通过的合同.组件零件流水号 = MRP_计划订单_组件零件清单_标准件和外购件_视图.组件零件流水号
                  left join 采购管理_供应商 on 通过的合同.供应商流水号 = 采购管理_供应商.供应商流水号
                  where 询价状态编号 = 1 and 采购状态编号 = 1
                  and 人员编号 = ${this.id}
                  group by 项目流水号,机床流水号,机床图号,人员编号
                  union all
                  SELECT 项目流水号,机床流水号,机床图号,count(*) as 未询价零件数,人员编号
                  FROM MRP_计划订单_组件零件清单_基本件_视图
                  left join (
                    select 采购管理_采购合同_采购部.*,组件零件基本件流水号,数量,已到货数量 from 采购管理_采购合同明细_采购部
                  inner join 采购管理_采购合同_采购部 on 采购管理_采购合同明细_采购部.采购合同流水号 = 采购管理_采购合同_采购部.采购合同流水号
                  where 采购管理_采购合同_采购部.是否未通过 = 0
                  ) as 通过的合同 on 通过的合同.组件零件基本件流水号 = MRP_计划订单_组件零件清单_基本件_视图.组件零件基本件流水号
                  left join 采购管理_供应商 on 通过的合同.供应商流水号 = 采购管理_供应商.供应商流水号
                  where 询价状态编号 = 1 and 采购状态编号 = 1
                  and 人员编号 = ${this.id}
                  group by 项目流水号,机床流水号,机床图号,人员编号
                  ) as table1
                  group by 项目流水号,机床流水号,机床图号,人员编号`
        }
      }).then(res => {
        this.machines1 = res.data
      })
    },
    async searchUnBuyPartNumber() {
      this.machines2 = []
      await request({
        url: '',
        method: 'post',
        data: {
          type: '3',
          name: ` select 项目流水号,机床流水号,机床图号,sum(未采购零件数) as 未采购零件数,人员编号 from (
                  SELECT 项目流水号,机床流水号,机床图号,count(*) as 未采购零件数,人员编号
                  FROM MRP_计划订单_组件零件清单_标准件和外购件_视图
                  left join (
                  select 采购管理_采购合同_采购部.*,组件零件流水号,数量,已到货数量 from 采购管理_采购合同明细_采购部
                  inner join 采购管理_采购合同_采购部 on 采购管理_采购合同明细_采购部.采购合同流水号 = 采购管理_采购合同_采购部.采购合同流水号
                  where 采购管理_采购合同_采购部.是否未通过 = 0
                  ) as 通过的合同 on 通过的合同.组件零件流水号 = MRP_计划订单_组件零件清单_标准件和外购件_视图.组件零件流水号
                  left join 采购管理_供应商 on 通过的合同.供应商流水号 = 采购管理_供应商.供应商流水号
                 where 询价状态编号 = 3 and 采购状态编号 = 1 and 零件类型 = 2
                  and 人员编号 = ${this.id}
                  group by 项目流水号,机床流水号,机床图号,人员编号
                  union all
                  SELECT 项目流水号,机床流水号,机床图号,count(*) as 未采购零件数,人员编号
                  FROM MRP_计划订单_组件零件清单_基本件_视图
                  left join (
                    select 采购管理_采购合同_采购部.*,组件零件基本件流水号,数量,已到货数量 from 采购管理_采购合同明细_采购部
                  inner join 采购管理_采购合同_采购部 on 采购管理_采购合同明细_采购部.采购合同流水号 = 采购管理_采购合同_采购部.采购合同流水号
                  where 采购管理_采购合同_采购部.是否未通过 = 0
                  ) as 通过的合同 on 通过的合同.组件零件基本件流水号 = MRP_计划订单_组件零件清单_基本件_视图.组件零件基本件流水号
                  left join 采购管理_供应商 on 通过的合同.供应商流水号 = 采购管理_供应商.供应商流水号
                  where 询价状态编号 = 3 and 采购状态编号 = 1
                  and 人员编号 = ${this.id}
                  group by 项目流水号,机床流水号,机床图号,人员编号
                  ) as table1
                  group by 项目流水号,机床流水号,机床图号,人员编号`
        }
      }).then(res => {
        this.machines2 = res.data
      })
    },
    unInquiry(row) {
      return parseInt(row.询价状态编号) === 1
    },
    inquiry(row) {
      return parseInt(row.询价状态编号) === 3 && parseInt(row.采购状态编号) === 1
    },
    approval(row) {
      return parseInt(row.询价状态编号) !== 1 && parseInt(row.采购状态编号) === 2
    },
    purchased(row) {
      return parseInt(row.询价状态编号) !== 1 && parseInt(row.采购状态编号) === 3
    },
    filterSource(value, row) {
      return Number(row['零件类型']) === Number(value)
    },
    tabClick(tab) {
      tab.name === '基本件' ? this.searchTable12() : this.searchTable11()
    },
    formatJson(filterVal, jsonData) {
      return jsonData.map(v => filterVal.map(j => {
        return v[j]
      }))
    },
    // 导出未询价外购件和标准件/基本件清单
    exportUninquirySheet() {
      getExport1(this.id).then(res1 => { // 标准件和外购件
        getExport2(this.id).then(res2 => { // 基本件
          res1.data.map(v => {
            v.任务分配时间 = v.任务分配时间.split(' ')[0]
            v.供货商 = v.供货商 ? v.供货商 : ''
            v.备注 = v.备注 ? v.备注 : ''
          })
          res2.data.map(v => {
            v.任务分配时间 = v.任务分配时间.split(' ')[0]
            v.供货商 = v.供货商 ? v.供货商 : ''
            v.备注 = v.备注 ? v.备注 : ''
          })
            import('./Export2Excel').then(excel => {
              const dataGroup = []
              const filterVal1 = ['任务分配时间', '项目名称', '机床图号', '组号', '物料名称', '物料型号', '物料规格', '待询价数量', '备注', '供货商'] // tableData1里的属性名
              const filterVal2 = ['任务分配时间', '项目名称', '机床图号', '组号', '零件名称', '零件图号', '规格', '材料', '待询价数量', '备注', '供货商'] // tableData2里的属性名
              const data1 = res1.data.map(v => filterVal1.map(j => v[j]))
              dataGroup.push(data1)
              const data2 = res2.data.map(v => filterVal2.map(j => v[j]))
              dataGroup.push(data2)
              const headerGroup = [['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '待询价数量', '备注', '供货商'], ['任务分配时间', '项目名称', '机床图号', '组号', '名称', '图号或型号', '规格', '材料', '待询价数量', '备注', '供货商']]
              const sheetGroup = ['外购件（未询价）', '基本件（未询价）']
              excel.export_json_to_excel({
                headerGroup: headerGroup,
                dataGroup: dataGroup,
                sheetGroup: sheetGroup,
                filename: '未询价采购件明细',
                autoWidth: true,
                bookType: 'xlsx'
              })
            })
        })
      })
    },
    // 询价单基础信息维护
    inquirySheetBaseInfoMaintain() {
      this.baseInfoLoading = true
      searchBaseInfo(this.id).then(res => {
        this.baseInfoLoading = false
        this.form3.contact = res.data[0] ? res.data[0].联系人 : ''
        this.form3.phone = res.data[0] ? res.data[0].手机 : ''
        this.form3.fax = res.data[0] ? res.data[0].传真 : ''
        this.form3.email = res.data[0] ? res.data[0].邮箱 : ''
        this.form3.companyAddress = res.data[0] ? res.data[0].公司地址 : ''
        this.form3.postCode = res.data[0] ? res.data[0].邮编 : ''
        this.form3.companyPhone = res.data[0] ? res.data[0].公司电话 : ''
        this.form3.taxNumber = res.data[0] ? res.data[0].税号 : ''
        this.form3.shippingAddress = res.data[0] ? res.data[0].送货地址 : ''
        this.form3.account = res.data[0] ? res.data[0].帐号 : ''
        this.form3.bank = res.data[0] ? res.data[0].开户行 : ''
        this.dialogVisible5 = true
      })
    },
    // 提交询价单基础信息维护
    submitBaseInfo() {
      editBaseInfo(this.id, this.form3.phone, this.form3.fax, this.form3.email, this.form3.companyAddress, this.form3.postCode, this.form3.companyPhone, this.form3.taxNumber, this.form3.shippingAddress, this.form3.account, this.form3.bank).then(res => {
        if (res.data[0].result === '1') {
          this.dialogVisible5 = false
          this.$message.success('操作成功')
        } else { this.$message.error('操作失败') }
      })
    },
    fetchData() {
      searchBaseInfo(this.id).then(res => {
        this.form3.contact = res.data[0] ? res.data[0].联系人 : ''
        this.form3.phone = res.data[0] ? res.data[0].手机 : ''
        this.form3.fax = res.data[0] ? res.data[0].传真 : ''
        this.form3.email = res.data[0] ? res.data[0].邮箱 : ''
        this.form3.companyAddress = res.data[0] ? res.data[0].公司地址 : ''
        this.form3.postCode = res.data[0] ? res.data[0].邮编 : ''
        this.form3.companyPhone = res.data[0] ? res.data[0].公司电话 : ''
        this.form3.taxNumber = res.data[0] ? res.data[0].税号 : ''
        this.form3.shippingAddress = res.data[0] ? res.data[0].送货地址 : ''
        this.form3.account = res.data[0] ? res.data[0].帐号 : ''
        this.form3.bank = res.data[0] ? res.data[0].开户行 : ''
      })
      initProject().then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.project.push({
            label: response.data[i].项目名称,
            value: response.data[i].项目流水号
          })
        }
      })
      searchSupplier(0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '', 0, '').then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.supplierNames.push({
            label: response.data[i].供应商名称,
            value: response.data[i].供应商流水号
          })
        }
      })
    },
    projectChange() {
      this.machine = []
      this.machineValue = ''
      this.group = []
      this.groupValue = ''
      searchMachine(this.projectValue).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.machine.push({
            value: response.data[i].机床流水号,
            label: response.data[i].机床图号
          })
        }
      })
    },
    machineChange() {
      this.group = []
      this.groupValue = ''
      searchGroup(this.machineValue).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.group.push({
            value: response.data[i].组件流水号,
            label: response.data[i].组号
          })
        }
      })
    },
    submitUseInventory() {
      submitUseInventory(this.backlogMaterialNum, this.useNumber, this.backlogGroupPartNum, this.id).then(response => {
        if (response.data[0].result === '1') {
          this.searchTable11()
          this.dialogVisible4 = false
          this.$message.success('操作成功')
        } else { this.$message.error('操作失败') }
      })
    },
    useInventory(row) { // 使用滞货
      this.useNumber = 0
      row.滞货数量 < row.待询价数量 ? this.maxUseNumber = Number(row.滞货数量) : this.maxUseNumber = Number(row.待询价数量)
      this.backlogMaterialNum = row.物料流水号
      this.backlogGroupPartNum = row.组件零件流水号
      this.dialogVisible4 = true
    },
    // cancelUseInventory(row) { // 取消使用滞货
    //   this.backlogMaterialNum = row.物料流水号
    //   this.backlogGroupPartNum = row.组件零件流水号
    //   this.cancelNum = row.使用滞货数量
    //   this.$confirm('确定取消使用滞货?', '提示', {
    //     confirmButtonText: '确定',
    //     cancelButtonText: '取消',
    //     type: 'warning'
    //   }).then(() => {
    //     cancelUseInventory(this.backlogMaterialNum, this.cancelNum, this.backlogGroupPartNum).then(response => {
    //       if (response.data[0].result === '1') {
    //         this.searchTable11()
    //         this.$message.success('操作成功')
    //       } else { this.$message.error('操作失败') }
    //     })
    //   }).catch(() => {
    //     this.$message.info('已取消操作')
    //   })
    // },
    saveOrder(row) { // 保存询价单
      console.log(row, 1111)
      saveOrder(row.询价单明细流水号, row.数量, row.备注).then(response => {})
    },
    selectable(row, index) { // 控制某行是否可选
      return (parseInt(row.询价状态编号) === 1 && parseInt(row.采购状态编号) < 3 && parseInt(row.是否确认) === 1) // 未询价&&未采购&&确认物料修改
    },
    filterHandler0(value, row) { // 筛选备注
      return row['备注'].trim() === value
    },
    filterHandler(value, row) { // 筛选供货商
      return row['供货商'].trim() === value
    },
    searchTable11() { // 查询外购件列表
      this.loading = true
      let check1, check2, check3, check4, check5, check6, check7, check8
      this.materialName ? check1 = 1 : check1 = 0
      this.materialSpec ? check2 = 1 : check2 = 0
      this.materialModel ? check3 = 1 : check3 = 0
      this.projectValue ? check4 = 0 : check4 = 0
      this.machineValue ? check5 = 1 : check5 = 0
      this.groupValue ? check6 = 1 : check6 = 0
      this.startTime ? check7 = 1 : (check7 = 0, this.startTime = '')
      this.supplierName ? check8 = 1 : check8 = 0
      searchMaterial(this.pageCurrent11, this.pageSize11, 3, check1, this.materialName, check2, this.materialSpec, check3, this.materialModel, this.id, check4, this.projectValue, check5, this.machineValue, check6, this.groupValue, check7, this.startTime[0], this.startTime[1], check8, this.supplierName).then(response => {
        this.tableData11 = response.data.rows
        this.total11 = response.data.total
        const remark = []
        const supplier = []
        this.remarkFilters = []
        this.supplierFilters = []
        response.data.rows.map(v => {
          if (v.备注 === null) { v.备注 = '' }
          if (v.供货商 === null) { v.供货商 = '' }
          if (!remark.includes(v.备注)) {
            remark.push(v.备注)
            this.remarkFilters.push({ text: v.备注, value: v.备注 })
          }
          if (!supplier.includes(v.供货商)) {
            supplier.push(v.供货商)
            this.supplierFilters.push({ text: v.供货商, value: v.供货商 })
          }
        })
        this.loading = false
      })
    },
    handleSizeChange11(val) { // 标准件和外购件列表分页
      this.pageSize11 = val
      this.pageCurrent11 = 1
      this.searchTable11()
    },
    handleCurrentChange11(val) { // 标准件和外购件列表分页
      this.pageCurrent11 = val
      this.searchTable11()
    },
    searchTable12() { // 查询基本件列表
      this.loading = true
      let check1, check2, check3, check4, check5, check6, check7, check8
      this.partNum ? check1 = 1 : check1 = 0
      this.partName ? check2 = 1 : check2 = 0
      this.partSpec ? check3 = 1 : check3 = 0
      this.projectValue ? check4 = 0 : check4 = 0
      this.machineValue ? check5 = 1 : check5 = 0
      this.groupValue ? check6 = 1 : check6 = 0
      this.endTime ? check7 = 1 : (check7 = 0, this.endTime = '')
      this.supplierName ? check8 = 1 : check8 = 0
      searchPart(this.pageCurrent12, this.pageSize12, 3, check1, this.partNum, check2, this.partName, check3, this.partSpec, this.id, check4, this.projectValue, check5, this.machineValue, check6, this.groupValue, check7, this.endTime[0], this.endTime[1], check8, this.supplierName).then(response => {
        this.tableData12 = response.data.rows
        this.total12 = response.data.total
        const remark = []
        const supplier = []
        this.remarkFilters = []
        this.supplierFilters = []
        response.data.rows.map(v => {
          if (!remark.includes(v.备注)) {
            remark.push(v.备注)
            supplier.push(v.供货商)
            this.remarkFilters.push({ text: v.备注, value: v.备注 })
            this.supplierFilters.push({ text: v.供货商, value: v.供货商 })
          }
        })
        this.loading = false
      })
    },
    handleSizeChange12(val) { // 基本件列表分页
      this.pageSize12 = val
      this.pageCurrent12 = 1
      this.searchTable12()
    },
    handleCurrentChange12(val) { // 基本件列表分页
      this.pageCurrent12 = val
      this.searchTable12()
    },
    searchTable13() { // 查询基本件列表
      let check1, check2, check3, check4, check5, check6, check7
      this.partNum ? check1 = 1 : check1 = 0
      this.partName ? check2 = 1 : check2 = 0
      this.partSpec ? check3 = 1 : check3 = 0
      this.projectValue ? check4 = 1 : check4 = 0
      this.machineValue ? check5 = 1 : check5 = 0
      this.groupValue ? check6 = 1 : check6 = 0
      this.endTime ? check7 = 1 : (check7 = 0, this.endTime = '')
      searchPart(this.pageCurrent12, this.pageSize12, 3, check1, this.partNum, check2, this.partName, check3, this.partSpec, this.id, check4, this.projectValue, check5, this.machineValue, check6, this.groupValue, check7, this.endTime[0], this.endTime[1]).then(response => {
        this.tableData12 = response.data.rows
        this.total12 = response.data.total
        const remark = []
        const supplier = []
        this.remarkFilters = []
        this.supplierFilters = []
        response.data.rows.map(v => {
          if (!remark.includes(v.备注)) {
            remark.push(v.备注)
            supplier.push(v.供货商)
            this.remarkFilters.push({ text: v.备注, value: v.备注 })
            this.supplierFilters.push({ text: v.供货商, value: v.供货商 })
          }
        })
      })
    },
    handleSizeChange13(val) { // 基本件列表分页
      this.pageSize13 = val
      this.pageCurrent13 = 1
      this.searchTable13()
    },
    handleCurrentChange13(val) { // 基本件列表分页
      this.pageCurrent13 = val
      this.searchTable13()
    },
    searchTable2() { // 查询询价单列表
      this.inquirySheetNum ? this.check4 = 1 : this.check4 = 0
      searchCreateInquirySheet(this.pageCurrent2, this.pageSize2, this.check4, this.inquirySheetNum, this.id).then(response => {
        this.tableData2 = response.data.rows
        this.total2 = response.data.total
      })
    },
    handleSizeChange2(val) { // 询价单列表分页
      this.pageSize2 = val
      this.searchTable2()
    },
    handleCurrentChange2(val) { // 询价单列表分页
      this.pageCurrent2 = val
      this.searchTable2()
    },
    createInquirySheet() { // 创建空单据--询价单9745
      if (this.$refs['form2'] !== undefined) {
        this.$refs['form2'].resetFields()
      }
      this.title2 = '创建询价单'
      getBillNum().then(response => { // 查询询价单号
        this.form2.inquirySheetNum = response.data[0].单号
        this.form2.supplierValue = ''
        this.form2.supplierNameValue = ''
        this.form2.supplierName = ''
        this.dialogVisible2 = true
      })
    },
    submitCreateInquirySheet() { // 提交创建询价单
      this.$refs['form2'].validate((valid) => {
        if (valid) {
          const numGroup1 = [] // 空数组，放现有的询价单号
          searchCreateInquirySheet2().then(response => { // 先查询判断是否存在
            for (let i = 0; i < response.data.length; i++) {
              numGroup1.push(response.data[i].询价单编号)
            }
          }).then(() => {
            if (numGroup1.indexOf(this.form2.inquirySheetNum) !== -1) {
              this.$message.error('该询价单号已存在')
            } else {
              createInquirySheet(this.form2.inquirySheetNum, this.id, this.form2.supplierValue, '').then(response => {
                if (response.data[0].result === '1') {
                  this.$message.success('创建成功')
                  this.inquirySheetNum = ''
                  this.supplierName = ''
                  this.supplierValue = ''
                  this.dialogVisible2 = false
                  this.searchTable2()
                } else { this.$message.error('操作失败') }
              })
            }
          })
        } else {
          console.log('表单验证未通过')
          return false
        }
      })
    },
    submitCreateInquirySheet1() { // 提交创建询价单
      this.$refs['form2'].validate((valid) => {
        if (valid) {
          createInquirySheet(this.form2.inquirySheetNum, this.id, this.form2.supplierNameValue, '').then(response => {
            if (!(response.data)) {
              this.$message.success('创建成功')
              this.form2.supplierNameValue = ''
              this.inquirySheetNum = ''
              this.supplierName = ''
              this.supplierValue = ''
              this.dialogVisible2 = false
              this.inquirySheetNum = this.form2.inquirySheetNum
              this.searchTable2(this.inquirySheetNum)
            } else { this.$message.error('操作失败！该询价单已存在，请重新输入') }
          })
        }
      })
    },
    deleteInquirySheet() { // 删除询价单
      if (this.row1 === '') {
        console.log(this.row1, 1)
        this.$message.error('请选择询价单')
      } else {
        console.log(this.row1, 2)
        this.$confirm('确定删除该询价单?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deleteInquirySheet(this.row1.询价单流水号).then(response => {
            if (response.data[0].result === '1') {
              this.row1 = ''
              this.$message.success('删除成功')
              this.inquirySheetNum = ''
              this.supplierName = ''
              this.supplierValue = ''
              this.searchTable2()
              this.tableData3 = []
              this.searchTable11()
              this.searchTable12()
            } else { this.$message.error('删除失败') }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
      }
    },
    editInquirySheet() { // 编辑询价单
      if (this.row1 === '') {
        this.$message.error('请选择询价单')
      } else {
        if (this.$refs['form2'] !== undefined) {
          this.$refs['form2'].resetFields()
        }
        this.title2 = '编辑询价单'
        this.form2.inquirySheetNumValue = this.row1.询价单流水号
        this.form2.inquirySheetNum = this.row1.询价单编号
        this.form2.supplierValue = this.row1.供应商流水号
        this.form2.supplierName = this.row1.供应商名称
        this.dialogVisible2 = true
      }
    },
    submitEditInquirySheet() { // 提交编辑询价单
      this.$refs['form2'].validate((valid) => {
        if (valid) {
          const numGroup1 = [] // 空数组，放现有的询价单号
          const numGroup2 = [] // 空数组，放现有的询价单流水号
          searchCreateInquirySheet2().then(response => { // 先查询判断是否存在
            for (let i = 0; i < response.data.length; i++) {
              numGroup1.push(response.data[i].询价单编号)
              numGroup2.push(response.data[i].询价单流水号)
            }
          }).then(() => {
            if (numGroup1.indexOf(this.form2.inquirySheetNum) !== -1 && numGroup1.indexOf(this.form2.inquirySheetNum) !== numGroup2.indexOf(parseInt(this.form2.inquirySheetNumValue))) {
              this.$message.error('该询价单号已存在')
            } else {
              editInquirySheet(this.form2.inquirySheetNumValue, this.form2.inquirySheetNum, this.form2.supplierNameValue).then(response => {
                if (response.data[0].result === '1') {
                  this.$message.success('修改成功')
                  this.inquirySheetNum = ''
                  this.supplierName = ''
                  this.supplierValue = ''
                  this.dialogVisible2 = false
                  this.searchTable2()
                } else { this.$message.error('修改失败') }
              })
            }
          })
        } else {
          console.log('表单验证未通过')
          return false
        }
      })
    },
    printInquirySheet() { // 打印询价单
      this.$confirm('确定打印该询价单?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        searchMerge(this.inquirySheetFlowNum).then(res => {
          if (res.data.length === 0) {
            this.$message.error('请选择正确的询价单导出')
          } else {
            const children = document.getElementsByClassName('tableData')
            const parent = document.getElementsByClassName('inquirySheet')[0]
            if (children.length !== 0) {
              for (let i = children.length - 1; i >= 0; i--) {
                parent.removeChild(children[i])
              }
            }
            const tr = []
            let length = 0
            res.data.length < 15 ? length = 15 : length = res.data.length
            for (let i = 0; i < length; i++) {
              tr[i] = document.createElement('tr')
              tr[i].setAttribute('class', 'tableData')
              tr[i].innerHTML = `<td width="8.3%" height="30px"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="8.3%"/><td height="30px" width="8.3%"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" colspan="3"/>`
              $('#tablehead').after(tr[i])
            }
            for (let j = 0; j < res.data.length; j++) {
              document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
              document.getElementsByClassName('tableData')[j].children[1].innerHTML = res.data[j].物料型号 || res.data[j].零件图号
              document.getElementsByClassName('tableData')[j].children[2].innerHTML = res.data[j].物料名称 || res.data[j].零件名称
              document.getElementsByClassName('tableData')[j].children[3].innerHTML = res.data[j].物料规格 || res.data[j].规格
              document.getElementsByClassName('tableData')[j].children[4].innerHTML = res.data[j].数量
              document.getElementsByClassName('tableData')[j].children[5].innerHTML = res.data[j].计量单位
              document.getElementsByClassName('tableData')[j].children[7].innerHTML = res.data[j].备注
            }
            document.getElementById('inquirySheetNum').innerHTML = this.orderExport
            document.getElementById('supplier').innerHTML = ''
          }
        }).then(() => {
          const htmlNode = $('#inquirySheet').html()
          const body = $('body').attr('style', 'padding: 20px;margin: 0 auto;display: block;width: 800px;background: #fff;')
          body.children().hide()
          const printNode = $(htmlNode)
          body.append(printNode)
          window.print()
          body.removeAttr('style')
          body.children().not('script').show()
          body.children().not('#app').hide()
          printNode.remove()
        })
      }).catch(res => {
        this.$message({
          type: 'info',
          message: '已取消操作'
        })
      })
    },
    exportInquirySheet() { // 导出询价单
      this.$confirm('确认导出询价单?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // 询价单导出结果
        searchMerge(this.inquirySheetFlowNum).then(res => {
          if (res.data.length === 0) {
            this.$message.error('请选择正确的询价单导出')
          } else {
            const children = document.getElementsByClassName('tableData')
            const parent = document.getElementsByClassName('inquirySheet')[0]
            if (children.length !== 0) {
              for (let i = children.length - 1; i >= 0; i--) {
                parent.removeChild(children[i])
              }
            }
            const tr = []
            let length = 0
            res.data.length < 15 ? length = 15 : length = res.data.length
            for (let i = 0; i < length; i++) {
              tr[i] = document.createElement('tr')
              tr[i].setAttribute('class', 'tableData')
              tr[i].innerHTML = `<td width="8.3%" height="30px"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" width="8.3%"/><td height="30px" width="8.3%"/><td height="30px" width="16.6%" colspan="2"/><td height="30px" colspan="3"/>`
              $('#tablehead').after(tr[i])
            }
            for (let j = 0; j < res.data.length; j++) {
              document.getElementsByClassName('tableData')[j].children[0].innerHTML = j + 1
              document.getElementsByClassName('tableData')[j].children[1].innerHTML = res.data[j].物料型号 || res.data[j].零件图号
              document.getElementsByClassName('tableData')[j].children[2].innerHTML = res.data[j].物料名称 || res.data[j].零件名称
              document.getElementsByClassName('tableData')[j].children[3].innerHTML = res.data[j].物料规格 || res.data[j].规格
              document.getElementsByClassName('tableData')[j].children[4].innerHTML = res.data[j].数量
              document.getElementsByClassName('tableData')[j].children[5].innerHTML = res.data[j].计量单位
              document.getElementsByClassName('tableData')[j].children[7].innerHTML = res.data[j].备注
            }
            document.getElementById('inquirySheetNum').innerHTML = this.orderExport
            document.getElementById('supplier').innerHTML = ''
            exportExcelMethod('inquirySheet', '采购询价单', '采购询价单sheet')
          }
        })
      }).catch(res => {
        this.$message({
          type: 'info',
          message: '已取消操作'
        })
      })
    },
    handleSelectionChange1(val) { // 标准件和外购件多选
      this.groupPartNum = []
      this.allNum = []
      this.标准件和外购件流水号 = []
      for (let i = 0; i < val.length; i++) {
        this.groupPartNum[i] = val[i].组件零件流水号
        this.allNum[i] = val[i].待询价数量
        this.标准件和外购件流水号[i] = val[i].标准件和外购件流水号
      }
    },
    handleSelectionChange2(val) { // 基本件多选
      this.groupPartBasicNum = []
      this.allNum = []
      this.基本件流水号 = []
      for (let i = 0; i < val.length; i++) {
        this.groupPartBasicNum[i] = val[i].组件零件基本件流水号
        this.allNum[i] = val[i].零件数量
        this.基本件流水号[i] = val[i].基本件流水号
      }
    },
    handleSelectionChange3(val) { // 基本件多选
      this.groupPartBasicNum = []
      this.allNum = []
      this.基本件流水号 = []
      for (let i = 0; i < val.length; i++) {
        this.groupPartBasicNum[i] = val[i].组件零件基本件流水号
        this.allNum[i] = val[i].零件数量
        this.基本件流水号[i] = val[i].基本件流水号
      }
    },
    addInquirySheet() { // 追加物料
      const numGroup1 = [] // 空数组，放该询价单中已有的组件零件流水号
      const numGroup2 = [] // 空数组，放该询价单中已有的组件零件基本件流水号
      if (this.inquirySheetFlowNum === '' || this.inquirySheetFlowNum === null) {
        this.$message.error('请选择一个询价单')
      } else if (this.groupPartNum.length === 0 && this.groupPartBasicNum.length === 0) {
        this.$message.error('请选择待询价物料或零件')
      } else {
        searchSheetDetail(this.inquirySheetFlowNum).then(response => {
          for (let i = 0; i < response.data.length; i++) {
            numGroup1.push(response.data[i].组件零件流水号)
            numGroup2.push(response.data[i].组件零件基本件流水号)
          }
        }).then(() => {
          let x = true // 为了只执行一次的中间变量
          if (this.groupPartBasicNum.length === 0) { // 标准件和外购件
            for (let i = 0; i < this.groupPartNum.length; i++) {
              if (numGroup1.indexOf(parseInt(this.groupPartNum[i])) !== -1) {
                if (x) {
                  this.$notify({
                    title: '注意',
                    message: '无法向该询价单中追加重复物料，已自动跳过',
                    type: 'warning'
                  })
                  x = false
                }
              } else {
                addInquirySheet1(this.inquirySheetFlowNum, this.groupPartNum[i], this.allNum[i]).then(response => {
                  if (response.data[0].result === '1') {
                    this.$message.success('操作成功')
                    this.searchTable11()
                    searchSheetDetail(this.inquirySheetFlowNum).then(response => {
                      this.tableData3 = response.data
                    })
                  } else { this.$message.error('操作失败') }
                })
              }
            }
          } else { // 基本件
            for (let i = 0; i < this.groupPartBasicNum.length; i++) {
              if (numGroup2.indexOf(parseInt(this.groupPartBasicNum[i])) !== -1) {
                if (x) {
                  this.$notify({
                    title: '注意',
                    message: '无法向该询价单中追加重复零件，已自动跳过',
                    type: 'warning'
                  })
                  x = false
                }
              } else {
                addInquirySheet2(this.inquirySheetFlowNum, this.groupPartBasicNum[i], this.allNum[i]).then(response => {
                  if (response.data[0].result === '1') {
                    this.$message.success('操作成功')
                    this.searchTable12()
                    searchSheetDetail(this.inquirySheetFlowNum).then(response => {
                      this.tableData3 = response.data
                    })
                  } else {
                    this.$message.error('操作失败')
                  }
                })
              }
            }
          }
        })
      }
    },
    outInquirySheet(row) {
      outInquirySheet(row.询价单明细流水号, row.组件零件流水号, row.组件零件基本件流水号).then(response => {
        if (response.data[0].result === '1') {
          this.searchTable11()
          this.searchTable12()
          searchSheetDetail(this.inquirySheetFlowNum).then(response => {
            this.tableData3 = response.data
          })
          this.$message.success('操作成功')
        } else { this.$message.error('操作失败') }
      })
    },
    searchSupplier() { // 查询创立日期和注册资本大于符合条件的数据
      this.supplierName ? this.supplierCheck1 = 1 : (this.supplierCheck1 = 0, this.supplierName = '')
      this.enterpriseNature ? this.supplierCheck2 = 1 : (this.supplierCheck2 = 0, this.enterpriseNature = '')
      this.createDate ? this.supplierCheck3 = 1 : (this.supplierCheck3 = 0, this.createDate = '')
      this.registeredCapital ? this.supplierCheck4 = 1 : (this.supplierCheck4 = 0, this.registeredCapital = '')
      this.taxNum ? this.supplierCheck5 = 1 : (this.supplierCheck5 = 0, this.taxNum = '')
      this.EMail ? this.supplierCheck6 = 1 : (this.supplierCheck6 = 0, this.EMail = '')
      this.address ? this.supplierCheck7 = 1 : (this.supplierCheck7 = 0, this.address = '')
      this.account ? this.supplierCheck8 = 1 : (this.supplierCheck8 = 0, this.account = '')
      this.openingBank ? this.supplierCheck9 = 1 : (this.supplierCheck9 = 0, this.openingBank = '')
      this.phone ? this.supplierCheck10 = 1 : (this.supplierCheck10 = 0, this.phone = '')
      this.fax ? this.supplierCheck11 = 1 : (this.supplierCheck11 = 0, this.fax = '')
      this.goodTime ? this.supplierCheck12 = 1 : (this.supplierCheck12 = 0, this.goodTime = '')
      searchSupplier(this.supplierCheck1, this.supplierName, this.supplierCheck2, this.enterpriseNature, this.supplierCheck3, this.createDate, this.supplierCheck4, this.registeredCapital, this.supplierCheck5, this.taxNum, this.supplierCheck6, this.EMail, this.supplierCheck7, this.address, this.supplierCheck8, this.account, this.supplierCheck9, this.openingBank, this.supplierCheck10, this.phone, this.supplierCheck11, this.fax, this.supplierCheck12, this.goodTime).then(response => {
        this.tableData01 = response.data
      })
    },
    showSupplierDetail(row) {
      this.form2.supplierValue = row.供应商流水号
      this.form2.supplierName = row.供应商名称
      this.supplierValue = row.供应商流水号
      this.supplierName = row.供应商名称
      this.enterpriseNature = row.企业性质
      this.createDate = row.创立日期
      this.registeredCapital = row.注册资本
      this.taxNum = row.税号
      this.EMail = row.电子信箱
      this.address = row.地址
      this.account = row.帐号
      this.openingBank = row.开户行
      this.phone = row.电话号码
      this.fax = row.传真
      this.goodTime = row.货期
    },
    emptySupplierDetail() {
      this.supplierValue = ''
      this.supplierName = ''
      this.enterpriseNature = ''
      this.createDate = ''
      this.registeredCapital = ''
      this.taxNum = ''
      this.EMail = ''
      this.address = ''
      this.account = ''
      this.openingBank = ''
      this.phone = ''
      this.fax = ''
      this.goodTime = ''
    },
    submitSelectSupplier() { // 确定选择供应商
      this.dialogVisible1 = false
    },
    searchTable3(row) { // 查询该询价单中的物料和零件
      this.row1 = row
      this.tableData3 = []
      this.inquirySheetFlowNum = row.询价单流水号
      this.orderExport = row.询价单编号
      searchSheetDetail(row.询价单流水号).then(response => {
        this.tableData3 = response.data
      })
    },
    materialChange(row) { // 物料变更 标准件和外购件
      this.dialogVisible3 = true
      this.groupPartNumValue = row.组件零件流水号
      this.standardAndPurchaseValue = row.标准件和外购件流水号
      this.materialOldValue = row.物料流水号
    },
    partChange(row) { // 零件变更 基本件
      this.$message('没有基本件的标准库')
    },
    searchMaterial() {
      if (this.materialName0 || this.materialSpec0 || this.materialModel0) {
        let check1, check2, check3
        this.materialName0 ? check1 = 1 : check1 = 0
        this.materialSpec0 ? check2 = 1 : check2 = 0
        this.materialModel0 ? check3 = 1 : check3 = 0
        searchAllMaterial(check1, this.materialName0, check2, this.materialSpec0, check3, this.materialModel0, this.pageCurrent02, this.pageSize02).then(response => {
          this.tableData02 = response.data.result
          this.total02 = parseInt(response.data.output[0].ItemCount)
        })
      } else {
        this.$message.warning('请至少输入一种搜索条件')
      }
    },
    handleSizeChange02(val) {
      this.pageSize02 = val
      this.searchMaterial()
    },
    handleCurrentChange02(val) {
      this.pageCurrent02 = val
      this.searchMaterial()
    },
    selectNewMaterial(row) {
      this.materialNew = ''
      this.materialNewValue = row.物料流水号
      this.materialNew += row.物料名称 + ' ' + row.物料规格 + ' ' + row.物料型号
    },
    submitMaterialChange() {
      materialChange(this.groupPartNumValue, this.standardAndPurchaseValue, this.materialOldValue, this.materialNewValue, this.id).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('提交变更申请成功')
          this.dialogVisible3 = false
          this.searchTable11()
        } else { this.$message.error('操作失败') }
      })
    },
    tableRowClassName({ row, rowIndex }) {
      let color = ''
      this.numbers.forEach((r, i) => {
        if (rowIndex === r) {
          color = 'MistyRose'
        }
      })
      return color
    },
    tableRowClassName2({ row, rowIndex }) {
      let color = ''
      this.numbers1.forEach((r, i) => {
        if (rowIndex === r) {
          color = 'MistyRose'
        }
      })
      return color
    }
  }
}
</script>

<style scoped>
  .baseInfo .el-form-item {
    margin: 0;
  }
  .inquirySheet td{
    height: 40px;
    text-align: center;
  }
  .el-card{
    margin-bottom: 0px;
  }
  .el-select{
    width:150px;
    margin-right: 10px;
  }
  .el-input{
    width:150px;
    margin-right: 10px;
  }
  .el-cascader{
    width:150px;
    margin: 0px 10px 0px 0px;
  }
  span{
    margin: 10px 0 10px 10px;
  }
  .searchForm .el-form-item{
    margin-bottom: 5px;
  }
  .el-tag{
    margin: 0
  }
</style>
<style>
  .el-table .green {
    background: lightgreen;
  }
  .el-table .white {
    background: whitesmoke;
  }
  .el-table .red {
    background: Tomato!important;
  }
  .el-table .MistyRose {
    background: #9BD7FC!important;
  }
  .el-table .gray {
    background: lightgray;
  }
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
  .item {
    margin-top: 10px;
    margin-right: 40px;
  }
  .sudoku_row{
    display: flex;
    align-items: center;
    width:100%;
    flex-wrap: wrap;
  }
  .sudoku_item{
    margin-bottom: 20px;
    margin-left: 20px;
    /*border: 1px solid red;*/
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    width:15%;
    height: 200px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .opacity{
    opacity: 0.4;
    background: #e5e5e5;
  }
  .sudoku_item img{
    margin-bottom: 3px;
    display: block;
  }
  .dashboard {
    &-container {
      margin: 30px;
    }
    &-text {
      font-size: 30px;
      line-height: 46px;
    }
  }
</style>
