<template>
  <div class="app-container">
    <el-card style="height: 850px">
      <div style="margin-top: 7px; margin-bottom: 7px">
        <!--        <el-input v-model="customerNameValue"  style="width:200px" placeholder="买方名称/订单编号" size="small" filterable clearable />-->
        <el-input v-model="contractStateValue1" style="width:200px" placeholder="产品名称/订单编号" size="small" clearable @keyup.enter.native="searchTable()"/>
        <el-select v-model="taskStateTypeValue" style="width:100px;margin-left: 10px" placeholder="任务状态" size="small" filterable clearable @change="searchTable()">
          <el-option
            v-for="item in taskStateType"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>
        <span style="font-size: 13px;color: black">装配开始</span>
        <el-date-picker
          v-model="dateRange"
          size="small"
          type="daterange"
          align="center"
          style="width: 240px;"
          value-format="yyyy-MM-dd"
          format="yyyy-MM-dd"
          range-separator="——"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          @change="searchTable"/>
        <el-button icon="el-icon-search" type="primary" plain size="small" style="margin-left: 10px" @click="pageCurrent = 1,pageSize = 100,searchTable()">查询</el-button>
        <!--        <el-button type="success" plain icon="el-icon-download" size="small" @click="exportExcel()">导出</el-button>-->
      </div>
      <div style="margin-top: 20px">
        <el-table v-loading="loading" :data="tableData" :row-class-name="tableRowClassName" highlight-current-row show-summary border size="small" style="width: 1406px" height="740px" @sort-change="sortChange">
          <el-table-column width="75px" label="任务状态" align="center">
            <template slot-scope="scope">
              {{ scope.row.任务状态 }}
            </template>
          </el-table-column>
          <el-table-column width="120px" label="产品名称" align="center" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.产品名称 }}
            </template>
          </el-table-column>
          <el-table-column width="65px" label="收货人" align="center" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.收货人 }}
            </template>
          </el-table-column>
          <el-table-column width="65px" label="装配数" align="center" show-overflow-tooltip prop="装配数量">
            <template slot-scope="scope">
              {{ scope.row.装配数量 }}
            </template>
          </el-table-column>
          <el-table-column width="65px" label="完成数" align="center" prop="完成数量">
            <template slot-scope="scope">
              {{ scope.row.完成数量 }}
            </template>
          </el-table-column>
          <el-table-column width="100px" label="装配开始" align="center" prop="装配" sortable="装配开始">
            <template slot-scope="scope">
              {{ scope.row.装配开始 }}
            </template>
          </el-table-column>
          <el-table-column width="85px" label="完成时间" align="center">
            <template slot-scope="scope">
              {{ scope.row.完成时间 }}
            </template>
          </el-table-column>
          <el-table-column width="85px" label="自检时间" align="center">
            <template slot-scope="scope">
              {{ scope.row.自检时间 }}
            </template>
          </el-table-column>
          <el-table-column width="75px" label="自检数量" align="center">
            <template slot-scope="scope">
              {{ scope.row.自检数量 }}
            </template>
          </el-table-column>
          <el-table-column width="85px" label="下单日期" align="center">
            <template slot-scope="scope">
              {{ scope.row.下单日期 }}
            </template>
          </el-table-column>
          <el-table-column width="85px" label="接收任务" align="center">
            <template slot-scope="scope">
              {{ scope.row.接收任务 }}
            </template>
          </el-table-column>
          <el-table-column width="85px" label="完工期限" align="center">
            <template slot-scope="scope">
              {{ scope.row.通用装配期限 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('订单编号')" label="订单编号" align="center" prop="订单编号" sortable="订单编号">
            <template slot-scope="scope">
              {{ scope.row.订单编号 }}
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center">
            <template slot-scope="scope">
              <el-tooltip :open-delay="700" effect="dark" content="查看暂停原因" placement="top">
                <el-button :disabled="Number(scope.row.是否存在)===0" type="text" icon="el-icon-search" size="mini" style="margin-right: 5px" @click="viewPauseReason(scope.row)">暂停原因</el-button>
              </el-tooltip>
              <el-tooltip :open-delay="700" effect="dark" content="查看图纸" placement="top">
                <el-button type="text" icon="el-icon-search" size="mini" style="margin-right: 5px" @click="getNum(scope.row)">图纸</el-button>
              </el-tooltip>
              <el-tooltip :open-delay="700" effect="dark" content="查看领料单" placement="top">
                <el-button type="text" icon="el-icon-search" size="mini" style="margin-right: 5px" @click="searchTableMaterial(scope.row)">领料</el-button>
              </el-tooltip>
              <el-tooltip :open-delay="700" effect="dark" content="撤销完成" placement="top">
                <el-button :disabled="Number(scope.row.装配进度)!==4" type="text" icon="el-icon-refresh-right" size="mini" @click="revoke(scope.row)">撤销完成</el-button>
              </el-tooltip>
              <el-tooltip :open-delay="700" effect="dark" content="自检记录" placement="top">
                <el-button type="text" icon="el-icon-search" size="mini" @click="selfInspection(scope.row)">自检记录</el-button>
              </el-tooltip>
              <!--<el-tooltip :open-delay="700" effect="dark" content="查看详细参数" placement="top">
                <el-button type="text" icon="el-icon-arrow-down" size="mini" @click="searchTableParam(scope.row)"/>
              </el-tooltip>-->
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="block" style="margin-top: 10px;">
        <el-pagination
          :current-page="pageCurrent"
          :page-sizes="[10, 20, 30, 40, 100]"
          :page-size="pageSize"
          :total="total"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChanges"
          @current-change="handleCurrentChanges"/>
      </div>
    </el-card>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" width="350px">
      <div v-for="(file, key) in hadFile" :key="key">
        <div class="wrapper">
          <div class="content">
            <div v-if="file.suffix==='pdf'" class="icon"><svg-icon icon-class="pdf" /></div>
            <div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon"><svg-icon icon-class="doc" /></div>
            <div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon"><svg-icon icon-class="excel" /></div>
            <div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon"><svg-icon icon-class="ppt" /></div>
            <div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon"><svg-icon icon-class="pic" /></div>
            <div v-else class="icon"><svg-icon icon-class="file" /></div>
            <a id="appUrl" :href="file.url" target="view_window"><div class="info">{{ file.name }}</div></a>
          </div>
        </div>
      </div>
    </el-dialog>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible1" center width="620px">
      <el-table
        :data="tableData1"
        :row-class-name="tableRowClassName"
        highlight-current-row
        border
        size="small"
        style="width: 561px"
        height="150px"
        @row-click="searchTable1">
        <el-table-column :width="setColumnWidth('领料单号')" label="领料单号" align="center" prop="领料单号" sortable="领料单号">
          <template slot-scope="scope">
            {{ scope.row.领料单号 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('领料人')" label="领料人" align="center" show-overflow-tooltip prop="领料人" sortable="领料人">
          <template slot-scope="scope">
            {{ scope.row.领料人 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('订单号')" label="订单号" align="center" show-overflow-tooltip prop="订单号" sortable="订单号">
          <template slot-scope="scope">
            {{ scope.row.订单号 }}
          </template>
        </el-table-column>
        <el-table-column label="产品/部件" align="center">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
          </template>
        </el-table-column>
      </el-table>
      <el-table :data="tableData3" :header-cell-style="{background: '#2283D4',color: 'white'}" show-summary highlight-current-row border stripe size="small" style="width: 561px" height="340px">
        <el-table-column :width="setColumnWidth('序号')" label="序号" type="index" align="center"/>
        <el-table-column width="160px" label="物料名称" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.物料名称 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('图号或型号')" label="图号/型号" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.图号或型号 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('单位')" label="单位" align="center">
          <template slot-scope="scope">
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('数量')" label="申请数" align="center" prop="申请数">
          <template slot-scope="scope">
            {{ scope.row.申请数 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('数量')" label="已领数" align="center" prop="已领数">
          <template slot-scope="scope">
            {{ scope.row.已领数 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible2" center width="495px" height="300px">
      <el-table
        :data="tableData2"
        stripe
        style="width: 441px;margin-top: 10px"
        border
        size="mini">
        <el-table-column v-if="show" :width="setColumnWidth('轴承型号')" align="center" label="轴承型号" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.轴承型号名称 }}
          </template>
        </el-table-column>
        <el-table-column v-if="show" :width="setColumnWidth('电机功率')" align="center" label="电机功率" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.电机功率名称 }}
          </template>
        </el-table-column>
        <el-table-column v-if="show" :width="setColumnWidth('电机转速')" align="center" label="电机转速" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.电机转速名称 }}
          </template>
        </el-table-column>
        <el-table-column v-if="show" :width="setColumnWidth('传动方式')" align="center" label="传动方式" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.传动方式名称 }}
          </template>
        </el-table-column>
        <el-table-column v-if="show1" :width="setColumnWidth('滑台类型')" align="center" label="滑台类型" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.滑台类型名称 }}
          </template>
        </el-table-column>
        <el-table-column v-if="show1" :width="setColumnWidth('电机联接板')" align="center" label="电机联接板" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.电机联接板名称 }}
          </template>
        </el-table-column>
        <el-table-column v-if="show1" :width="setColumnWidth('电机型号')" align="center" label="电机型号" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.电机型号名称 }}
          </template>
        </el-table-column>
        <el-table-column v-if="show1" :width="setColumnWidth('联轴器')" align="center" label="联轴器" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.联轴器名称 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible4" title="暂停原因" center width="750px" height="300px">
      <el-table
        :data="tableData4"
        stripe
        style="width: 750px;margin-top: 10px"
        border
        size="mini">
        <el-table-column width="120px" align="center" label="装配任务流水号" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.装配任务流水号 }}
          </template>
        </el-table-column>
        <el-table-column min-width="250px" align="center" label="暂停原因" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.暂停原因 }}
          </template>
        </el-table-column>
        <el-table-column width="120px" align="center" label="暂停开始时间" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.暂停开始时间 }}
          </template>
        </el-table-column>
        <el-table-column width="120px" align="center" label="暂停结束时间" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.暂停结束时间 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible5" title="滑台自检记录" center width="1260px" height="300px">
      <el-row>
        <el-col style="width: 542px">
          <el-table
            :data="tableData5"
            :header-cell-style="{background: '#2283D4',color: 'white'}"
            stripe
            style="width: 541px;"
            border
            size="mini"
            @row-click="searchItem">
            <el-table-column width="150px" align="center" label="产品名称" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.产品名称 }}
              </template>
            </el-table-column>
            <el-table-column width="150px" align="center" label="产品编号" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.产品编号 }}
              </template>
            </el-table-column>
            <el-table-column width="150px" align="center" label="时间" show-overflow-tooltip>
              <template slot-scope="scope">
                {{ scope.row.操作时间 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center">
              <template slot-scope="scope">
                <el-button type="text" icon="el-icon-delete" size="mini" @click="deleteRecord(scope.row)"/>
              </template>
            </el-table-column>
          </el-table>
        </el-col>
        <el-col style="width: 612px;margin-left: 20px;margin-top: 2px">
          <div style="width: 600px;height: 100%;">
            <table cellspacing="0px" align="center" style="table-layout:fixed;border-color: black!important;" border="1 solid black" width="100%">
              <tr style="height: 40px">
                <td colspan="4" style="text-align: center;padding: 0 10px 0 10px">产品名称</td>
                <td colspan="8" style="text-align: center;">
                  {{ productName1Value }}
                </td>
                <td colspan="4" style="text-align: center;">产品编号</td>
                <td colspan="8" style="text-align: center;">
                  {{ productIDValue }}
                </td>
              </tr>
            </table>
            <el-table
              :data="tableData12"
              :header-cell-style="{ border: '1px solid', borderColor: 'black'}"
              :row-style="{ border: '1px solid', borderColor: 'black'}"
              class="qqqqwww"
              border
              size="small"
              max-height="600px"
              style="width: 801px;">
              <el-table-column label="检测项" align="center" prop="检测项">
                <template slot-scope="scope">
                  {{ scope.row.检测项目 }}
                </template>
              </el-table-column>
              <el-table-column width="130px" label="行程" align="center" show-overflow-tooltip>
                <template slot-scope="scope">
                  {{ scope.row.行程 }}
                </template>
              </el-table-column>
              <el-table-column width="130px" label="允许值" align="center" show-overflow-tooltip>
                <template slot-scope="scope">
                  {{ scope.row.允许值 }}
                </template>
              </el-table-column>
              <el-table-column width="130px" label="实测值" align="center" show-overflow-tooltip>
                <template slot-scope="scope">
                  {{ scope.row.实测值 ? bianliang + ' ' + scope.row.实测值 : '' }}
                </template>
              </el-table-column>
            </el-table>
          </div>
        </el-col>
      </el-row>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { MESDownloadFile } from '@/utils/request'
import request from '@/utils/request'
export default {
  data() {
    return {
      bianliang: '≤',
      customerNameValue: '', // 买方名称
      customerName: [], // 买方名称数组
      dateRange: '', // 提交日期
      contractStateValue: '', // 合同状态
      contractStateValue1: '',
      taskStateTypeValue: '', // 任务状态
      taskStateType: [], // 任务状态数组
      hadFile: [],
      dialogFormVisible: false,
      dialogFormVisible1: false,
      dialogFormVisible2: false,
      dialogFormVisible4: false,
      dialogFormVisible5: false,
      productName1Value: '',
      productIDValue: '',
      taskValue: '',
      title: '',
      rules: {},
      show: false,
      show1: false,
      loading: false, // 数据加载
      total: 0, // 分页总数
      tableData: [], // 合同信息表
      tableData1: [], // 领料对话框
      tableData2: [], // 查看具体参数对话框
      tableData3: [],
      tableData4: [],
      tableData5: [],
      tableData12: [],
      pageCurrent: 1, // 分页当前页
      pageSize: 100, // 分页每页显示条数
      orderName: '', // 排序列名
      order: '', // 排序方式
      form: {
        Sort: '',
        Remarks: ''
      }
    }
  },
  computed: {
    ...mapGetters([
      'id',
      'token'
    ])
  },
  created() {
    this.searchTable()
    this.getTaskStateType()
  },
  methods: {
    deleteRecord(row) {
      this.$confirm('是否删除记录?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        var param = []
        param[0] = ['滑台自检流水号', row.滑台自检流水号]
        var Data = this.CreateData('12', '装配管理_自检记录_删除', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message.success('删除成功')
            var param = []
            param[0] = ['装配任务流水号', this.taskValue]
            var Data = this.CreateData('11', '装配管理_自检产品_查询', param)
            this.ExecDatabase(Data).then(response => {
              this.tableData5 = response.data
            })
            this.productName1Value = ''
            this.productIDValue = ''
            this.tableData12 = []
          } else {
            this.$message.error('删除失败')
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    selfInspection(row) {
      this.taskValue = row.装配任务流水号
      var param = []
      param[0] = ['装配任务流水号', row.装配任务流水号]
      var Data = this.CreateData('11', '装配管理_自检产品_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData5 = response.data
      })
      this.productName1Value = ''
      this.productIDValue = ''
      this.tableData12 = []
      this.dialogFormVisible5 = true
    },
    searchItem(row) {
      this.productName1Value = row.产品名称
      this.productIDValue = row.产品编号
      var param = []
      param[0] = ['滑台自检流水号', row.滑台自检流水号]
      var Data = this.CreateData('11', '装配管理_自检记录_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData12 = response.data
      })
    },
    getTaskStateType() {
      var param = []
      var Data = this.CreateData('11', '基础表_产品状态_查询', param)
      this.ExecDatabase(Data).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.taskStateType.push({
            label: response.data[i].任务状态,
            value: response.data[i].任务状态流水号
          })
        }
      })
    },
    searchTable() {
      let contractStateValue1_check, dateRange_check, taskStateTypeValue_check
      this.contractStateValue1 ? contractStateValue1_check = 1 : contractStateValue1_check = 0
      this.dateRange ? dateRange_check = 1 : (dateRange_check = 0, this.dateRange = '')
      if (this.taskStateTypeValue === '' || this.taskStateTypeValue === null) {
        taskStateTypeValue_check = 0
      } else {
        taskStateTypeValue_check = 1
      }
      var param = []
      param[0] = ['产品名称', this.contractStateValue1]
      param[1] = ['产品名称_check', contractStateValue1_check]
      param[2] = ['任务状态流水号', this.taskStateTypeValue]
      param[3] = ['任务状态_check', taskStateTypeValue_check]
      param[4] = ['开始时间', this.dateRange[0]]
      param[5] = ['结束时间', this.dateRange[1]]
      param[6] = ['装配开始_check', dateRange_check]
      param[7] = ['排序名称', this.orderName]
      param[8] = ['排序方式', this.order]
      var Data = this.CreateData('11', '装配管理_装配任务_滑台查询', param, this.pageSize, this.pageCurrent)
      this.ExecDatabase(Data).then(response => {
        this.tableData = response.data.rows
        this.total = response.data.total
      })
    },
    // 领料数据库
    searchTableMaterial(row) {
      this.dialogFormVisible1 = true
      this.tableData3 = []
      var param = []
      param[0] = ['订单号_check', 0]
      param[1] = ['订单流水号', '']
      param[2] = ['产品_check', 1]
      param[3] = ['组件流水号', row.组件流水号]
      param[4] = ['领料人_check', 0]
      param[5] = ['领料人', '']
      param[6] = ['排序名称', 0]
      param[7] = ['排序方式', 0]
      var Data = this.CreateData('11', '装配管理_领料单_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData1 = response.data
      })
    },
    searchTable1(row) {
      var param = []
      param[0] = ['领料单流水号', row.领料单流水号]
      var Data = this.CreateData('11', '装配管理_领料单明细_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData3 = response.data
      })
    },
    searchTableParam(row) {
      var param = []
      param[0] = ['组件流水号', row.组件流水号]
      var Data = this.CreateData('11', '订单信息_产品详细参数_查询数据', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].轴承型号 !== null) {
          this.show = true
        } else {
          this.show = false
        }
        if (response.data[0].滑台类型 !== null) {
          this.show1 = true
        } else {
          this.show1 = false
        }
        this.tableData2 = response.data
        this.dialogFormVisible2 = true
      })
    },
    selectable() {},
    tableRowClassName({ row, rowIndex }) {
      if (row.任务状态 === '未接受') {
        return 'no-accept'
      } else if (row.任务状态 === '装配中') {
        return 'assembly'
      } else if (row.任务状态 === '完成') {
        return 'complete'
      } else if (row.任务状态 === '暂停') {
        return 'suspend'
      }
      if (Number(row.是否部件) === 1) {
        return 'is-group'
      }
    },
    revoke(row) {
      this.$confirm('是否撤销完成?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        var param = []
        param[0] = ['组件流水号', row.组件流水号]
        param[1] = ['装配任务流水号', row.装配任务流水号]
        param[2] = ['订单流水号', row.订单流水号]
        var Data = this.CreateData('12', '装配执行_撤销完成', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message.success('撤销成功')
            this.searchTable()
          } else {
            this.$message.error('撤销失败')
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消撤销'
        })
      })
    },
    editProduct(row) {
      row.edit = false
      // var param = []
      // param[0] = ['组件流水号', row.组件流水号]
      // param[1] = ['产品名称', row.产品名称]
      // param[2] = ['产品详情', row.产品详情]
      // param[3] = ['单位', row.单位]
      // param[4] = ['数量', row.数量]
      // param[5] = ['单价', row.单价]
      // param[6] = ['产品流水号', this.productValue]
      // var Data = this.CreateData('12', 'PDM_组件名称_编辑数据', param)
      // this.ExecDatabase(Data).then(response => {
      //   if (response.data[0].result === '1') {
      //     this.$message.success('编辑成功')
      //     this.searchProduct()
      //   } else {
      //     this.$message.error('编辑失败')
      //   }
      // })
    },
    cancel(row) {
      row.合同备注 = row.原合同备注
      row.edit = false
    },
    viewPauseReason(row) {
      this.dialogFormVisible4 = true
      this.searchPauseReason(row.装配任务流水号)
    },
    searchPauseReason(value) {
      var param = []
      param[0] = ['装配任务流水号', value]
      var Data = this.CreateData('11', '车间装配管理_暂停装配_记录表_查询', param, this.pageSize, this.pageCurrent)
      this.ExecDatabase(Data).then(response => {
        this.tableData4 = response.data.rows
      })
    },
    sortChange(column) {
      if (column.prop === '装配') {
        this.orderName = 1
      } else if (column.prop === '买方名称') {
        this.orderName = 2
      } else if (column.prop === '订单编号') {
        this.orderName = 3
      } else {
        this.orderName = 0
      }
      if (column.order === 'ascending') {
        this.order = 1
      } else if (column.order === 'descending') { this.order = 2 } else {
        this.order = ''
      }
      this.searchTable()
    },
    handleSizeChanges(val) {
      this.pageCurrent = 1
      this.pageSize = val
      this.searchTable()
    },
    handleCurrentChanges(val) {
      this.pageCurrent = val
      this.searchTable()
    },
    handleSizeChanges1(val) {
      this.pageCurrent = 1
      this.pageSize = val
      this.searchTableParam()
    },
    handleCurrentChanges1(val) {
      this.pageCurrent = val
      this.searchTableParam()
    },
    getNum(row) {
      this.dialogFormVisible = true
      this.getFileList(row.产品名称)
    },
    async getFileList(value) {
      this.hadFile = []
      if (value) {
        await request({
          url: '',
          method: 'post',
          data: {
            type: '3',
            name: `select * from 图纸维护_产品图纸 where 是否启用 = 1 and name = '${value}'`
          }
        }).then(data => {
          this.suffix = data.data
          if (data.data.length > 0) {
            const server = `${MESDownloadFile}`.split('/')
            data.data.map(item => {
              this.hadFile.push({
                url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
                name: `${item.name}.${item.suffix}`,
                suffix: item.suffix,
                id: item.uid
              })
            })
          }
        })
      }
    }
  }
}
</script>
<style>
  .el-table .no-accept {
    background: #F2D1D6!important;
  }
  .el-table .is-group {
    background: #FFF582!important;
  }
  .el-table .assembly {
    background: #C4E1FF!important;
  }
  .el-table .complete {
    background: #c6d7b3!important;
  }
  .el-table .suspend {
    background: #FFD1A4!important;
  }
</style>
<style scoped>
  .wrapper{
    width: 90%;
    height: 50px;
    overflow: hidden;
    border: 1px solid #b8c7d9;
    /*float: left;*/
    margin: 10px;
  }
  .content{
    position: relative;
    padding: 8px 8px 0 8px;
  }
  .action{
    position: absolute;
    top: 2px;
    right: 8px;
  }
  .delete{
    padding: 0 5px;
    border-radius: 3px;
    color: #0f84b0;
    font-size: 12px;
  }
  .delete:hover{
    background: -webkit-linear-gradient(top,#0ba9e3,#0099d3);
    color: #fff;
  }
  a{
    text-decoration: none;
  }
  .icon{
    width: 30px;
    height: 30px;
    display: inline-block;
    margin-right: 7px;
    margin-top: 2px;
    font-size: 26px;
  }
  .info{
    width: 160px;
    height: 50px;
    position: absolute;
    left: 44px;
    line-height: 30px;
    display: inline-block;
    color: #999;
  }
  /deep/ .qqqqwww{
    border-right: 2px solid black!important;
    border-bottom: 2px solid black!important;
    border-top: 0px!important;
    border-left: 1px solid black!important;
  }
  /deep/ .qqqqwww td{
    border: 1px solid black!important;
    /*border-left: 0px!important;*/
  }
  /deep/ .qqqqwww th.is-leaf{
    border: 1px solid black!important;
    border-top: 0px!important;
  }

  /deep/ .qqqqwww1{
    border-right: 2px solid black!important;
    border-bottom: 0px!important;
    border-top: 0px!important;
    border-left: 1px solid black!important;
  }
  /deep/ .qqqqwww1 td{
    border: 1px solid black!important;
    /*border-left: 0px!important;*/
  }
  /deep/ .qqqqwww1 th.is-leaf{
    border: 1px solid black!important;
    border-top: 0px!important;
  }
  /*/deep/ .el-table .cell{*/
  /*  padding: 0px!important;*/
  /*}*/
  /*/deep/ .el-table .cell, .el-table--border td:first-child .cell, .el-table--border th:first-child .cell{*/
  /*  padding: 0px!important;*/
  /*}*/
  /deep/ .el-checkbox__input.is-disabled+span.el-checkbox__label{
    color: #858689 !important;
  }

  /deep/ .el-checkbox__input.is-disabled .el-checkbox__inner{
    border-color: black!important;
    background-color: white;
  }

  /deep/ .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after{
    border-color: black!important;
  }
</style>
