<template>
  <div class="app-container">
    <el-card style="">
      <el-row>
        <span>日期:</span>
        <el-date-picker
          v-model="dateTime"
          :clearable="false"
          size="small"
          type="daterange"
          align="center"
          style="width: 240px;"
          value-format="yyyy-MM-dd"
          format="yyyy-MM-dd"
          range-separator="～"
          start-placeholder="开始日期"
          end-placeholder="结束日期"/>
        <el-button type="success" icon="el-icon-search" size="small" style="margin-left: 20px;margin-top: 15px" @click="fetchData">查询</el-button>
      </el-row>
      <el-col :span="14">
        <el-table
          :data="tableData"
          border
          element-loading-text="数据加载中"
          highlight-current-row
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.2)"
          style="width: 100%"
          height= "590px"
          size="small"
          @row-click="CheckOrder_rowClick"
        >
          <el-table-column label="序号" type="index" align="center"/>
          <el-table-column label="产品编号" width="150" align="center">
            <template slot-scope="scope">
              {{ scope.row.产品编号 }}
            </template>
          </el-table-column>
          <el-table-column label="质检单名称" min-width="100" align="center">
            <template slot-scope="scope">
              {{ scope.row.质检单名称 }}
            </template>
          </el-table-column>
          <el-table-column label="质检日期" width="100" align="center">
            <template slot-scope="scope">
              {{ scope.row.质检日期 }}
            </template>
          </el-table-column>
          <el-table-column label="检验员" width="100" align="center">
            <template slot-scope="scope">
              {{ scope.row.质检员姓名 }}
            </template>
          </el-table-column>
          <el-table-column label="状态" width="100" align="center">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.状态 === 1" size="small" type="danger">未下发</el-tag>
              <el-tag v-if="scope.row.状态 === 2" size="small" type="warning">未执行</el-tag>
              <el-tag v-if="scope.row.状态 === 3" size="small" type="primary">质检中</el-tag>
              <el-tag v-if="scope.row.状态 === 4" size="small" type="success">已完成</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="检验数量" width="100" align="center">
            <template slot-scope="scope">
              {{ scope.row.质检数量 }}
            </template>
          </el-table-column>
        </el-table>
        <div class="block">
          <el-pagination
            :current-page="currentPage"
            :page-sizes="[10, 20, 30, 40]"
            :page-size="10"
            :total="totalNum"
            layout="total, sizes, prev, pager, next, jumper"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"/>
        </div>
      </el-col>
      <el-col :span="10">
        <el-table
          :data="tableData_content"
          border
          element-loading-text="数据加载中"
          highlight-current-row
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.2)"
          style="width: 100%;margin-left: 10px"
          height= "590px"
          size="small"
          @row-click="editCheckOrder_content"
        >
          <el-table-column label="序号" type="index" align="center"/>
          <el-table-column label="状态" width="80" align="center">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.状态 === 0" size="small" type="warning">未检</el-tag>
              <el-tag v-if="scope.row.状态 === 1" size="small" type="success">已检</el-tag>
            </template>
          </el-table-column>
          <el-table-column label="质检工位" width="80" align="center">
            <template slot-scope="scope">
              {{ scope.row.工位号 }}
            </template>
          </el-table-column>
          <el-table-column label="质检项目" width="100" align="center">
            <template slot-scope="scope">
              {{ scope.row.检查项目 }}
            </template>
          </el-table-column>
          <el-table-column label="质检内容" width="120" align="center" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.检查内容 }}
            </template>
          </el-table-column>
          <el-table-column label="检测值" width="80" align="center" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.检验值 }}
            </template>
          </el-table-column>
          <el-table-column label="质检时间" width="140" align="center">
            <template slot-scope="scope">
              {{ scope.row.检查时间 }}
            </template>
          </el-table-column>
          <el-table-column label="备注" width="140" align="center" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.检查后备注 }}
            </template>
          </el-table-column>
          <el-table-column label="质检工具" width="100" align="center">
            <template slot-scope="scope">
              {{ scope.row.检查工具名称 }}
            </template>
          </el-table-column>
          <el-table-column label="质检方法" width="100" align="center">
            <template slot-scope="scope">
              {{ scope.row.检查方法名称 }}
            </template>
          </el-table-column>
        </el-table>
      </el-col>
    </el-card>
    <el-dialog :visible.sync="dialogFormVisible_editCheckOrder_content" title="质检录入" center style="min-height: 200px;" width="650px">
      <div style="display: flex;width: 580px;flex-wrap: wrap;margin-left: 20px">
        质检进度：
        <div v-for="(item, index) in tableData_content" :key="index" style="display: flex;align-items: center;margin-bottom: 3px">
          <div v-if="item['状态'] === 1" style="width: 25px;line-height: 25px;height: 25px;border-radius: 25px;border: 1px solid #00893d;color:#fff;background-color: #00893d;text-align: center">{{ index + 1 }}</div>
          <div v-else-if="item['状态'] === 0 && currentSelectCheckOrderContent['index'] === index" style="width: 25px;line-height: 25px;height: 25px;border-radius: 25px;border: 1px solid #ffcc00;color:#fff;background-color: #ffcc00;text-align: center">{{ index + 1 }}</div>
          <div v-else style="width: 25px;line-height: 25px;height: 25px;border-radius: 25px;border: 1px solid #aeaeae;color:#fff;background-color: #aeaeae;text-align: center">{{ index + 1 }}</div>
          <span v-if="index !== tableData_content.length - 1" class="el-icon-right" />
        </div>
      </div>
      <el-form ref="form_editCheckOrder_content" :model="form_editCheckOrder_content" :rules="rules_editCheckOrder_content" label-position="right" label-width="110px">
        <!--        <el-row>-->
        <!--          <el-col :span="12">-->
        <!--            <el-form-item label="检查单名称" prop="checkOrderName" style="display: inline-block">-->
        <!--              <el-input-->
        <!--                v-model="form_editCheckOrder_content.checkOrderName"-->
        <!--                readonly-->
        <!--                size="small"-->
        <!--                style="width: 200px"-->
        <!--                placeholder=""/>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="12">-->
        <!--            <el-form-item label="检查单号" prop="checkOrderCode" style="display: inline-block">-->
        <!--              <el-input-->
        <!--                v-model="form_editCheckOrder_content.checkOrderCode"-->
        <!--                readonly-->
        <!--                style="width: 200px"-->
        <!--                size="small"-->
        <!--                placeholder=""/>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--        </el-row>-->
        <!--        <el-row>-->
        <!--          <el-col :span="12">-->
        <!--            <el-form-item label="工位号" prop="stationNumberValue" style="display: inline-block">-->
        <!--              <el-input-->
        <!--                v-model="form_editCheckOrder_content.stationNumberValue"-->
        <!--                readonly-->
        <!--                style="width: 200px"-->
        <!--                size="small"-->
        <!--                placeholder=""/>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="12">-->
        <!--            <el-form-item label="检查项目" prop="checkOrderContentId" style="display: inline-block">-->
        <!--              <el-input-->
        <!--                v-model="form_editCheckOrder_content.checkOrderContent"-->
        <!--                readonly-->
        <!--                style="width: 200px"-->
        <!--                size="small"-->
        <!--                placeholder=""/>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--        </el-row>-->
        <!--        <el-row>-->
        <!--          <el-form-item label="检查内容" prop="checkOrderContent" style="display: inline-block">-->
        <!--            <el-input v-model="form_editCheckOrder_content.checkOrderContent1" :rows="2" type="textarea" placeholder="检查内容" size="small" readonly style="width:500px"/>-->
        <!--          </el-form-item>-->
        <!--        </el-row>-->
        <!--        <el-row>-->
        <!--          <el-col :span="12">-->
        <!--            <el-form-item label="检查工具" prop="checkOrderToolId" style="display: inline-block">-->
        <!--              <el-input-->
        <!--                v-model="form_editCheckOrder_content.checkOrderTool"-->
        <!--                readonly-->
        <!--                style="width: 200px"-->
        <!--                size="small"-->
        <!--                placeholder=""/>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--          <el-col :span="12">-->
        <!--            <el-form-item label="检查方法" prop="checkOrderMethodId" style="display: inline-block">-->
        <!--              <el-input-->
        <!--                v-model="form_editCheckOrder_content.checkOrderMethod"-->
        <!--                readonly-->
        <!--                style="width: 200px"-->
        <!--                size="small"-->
        <!--                placeholder=""/>-->
        <!--            </el-form-item>-->
        <!--          </el-col>-->
        <!--        </el-row>-->
        <!--        <el-row>-->
        <!--          <el-form-item label="备注" prop="checkOrderRemarks" style="display: inline-block">-->
        <!--            <div style="width: 500px">-->
        <!--              <el-input-->
        <!--                v-model="form_editCheckOrder_content.checkOrderRemarks"-->
        <!--                :rows="2"-->
        <!--                type="textarea"-->
        <!--                size="small"-->
        <!--                placeholder="请输入备注"/>-->
        <!--            </div>-->
        <!--          </el-form-item>-->
        <!--        </el-row>-->
        <div style="margin-left: 20px">
          <el-row>
            <el-col :span="4">
              <span class="check-Content-Name">质检单名：</span>
            </el-col>
            <el-col :span="8">
              <span class="check-Content-Value">{{ form_editCheckOrder_content.checkOrderName }}</span>
            </el-col>
            <el-col :span="4">
              <span class="check-Content-Name">质检单号：</span>
            </el-col>
            <el-col :span="8">
              <span class="check-Content-Value">{{ form_editCheckOrder_content.checkOrderCode }}</span>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <span class="check-Content-Name">质检工位：</span>
            </el-col>
            <el-col :span="8">
              <span class="check-Content-Value">{{ form_editCheckOrder_content.stationNumberValue }}</span>
            </el-col>
            <el-col :span="4">
              <span class="check-Content-Name">质检项目：</span>
            </el-col>
            <el-col :span="8">
              <span class="check-Content-Value">{{ form_editCheckOrder_content.checkOrderContent }}</span>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <span class="check-Content-Name">质检内容：</span>
            </el-col>
            <el-col :span="20">
              <span class="check-Content-Value">{{ form_editCheckOrder_content.checkOrderContent1 }}</span>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <span class="check-Content-Name">质检工具：</span>
            </el-col>
            <el-col :span="8">
              <span class="check-Content-Value">{{ form_editCheckOrder_content.checkOrderTool }}</span>
            </el-col>
            <el-col :span="4">
              <span class="check-Content-Name">质检方法：</span>
            </el-col>
            <el-col :span="8">
              <span class="check-Content-Value">{{ form_editCheckOrder_content.checkOrderMethod }}</span>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="4">
              <span class="check-Content-Name">质检备注：</span>
            </el-col>
            <el-col :span="20">
              <span class="check-Content-Value">{{ form_editCheckOrder_content.checkOrderRemarks }}</span>
            </el-col>
          </el-row>
        </div>
        <el-divider content-position="center">检查结果录入</el-divider>
        <el-row>
          <el-col :span="12">
            <el-form-item label="测量值" prop="checkOrderToolId" style="display: inline-block">
              <el-input
                v-model="form_editCheckOrder_content.checkOrderValue"
                style="width: 200px"
                size="small"
                placeholder="请输入测量值"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="检查结果" prop="checkOrderMethodId" style="display: inline-block">
              <el-radio-group v-model="form_editCheckOrder_content.checkOrderIsOk">
                <el-radio :label="1" style="color: #00893d">OK</el-radio>
                <el-radio :label="2" style="color: #ff0000">NG</el-radio>
              </el-radio-group>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-form-item label="检查备注" prop="checkOrderRemarks" style="display: inline-block">
            <div style="width: 500px">
              <el-input
                v-model="form_editCheckOrder_content.checkOrderAfterRemarks"
                :rows="2"
                type="textarea"
                size="small"
                placeholder="请输入备注"/>
            </div>
          </el-form-item>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <div style="height:30px;">
          <el-col :span="4">
            <el-button :disabled="tableData_content_Pre_disabled" size="small" type="warning" el-icon="el-icon-back" @click="editCheckOrder_content_pre()">上一项</el-button>
          </el-col>
          <el-col :span="16">
            <el-button size="small" @click="editCheckOrder_content_cancel('form_editCheckOrder_content')">取消</el-button>
            <el-button :disabled="form_editCheckOrder_content.checkOrderStatus === 4" type="primary" size="small" @click="editCheckOrder_content_sure('form_editCheckOrder_content')">确定</el-button>
            <el-button :disabled="form_editCheckOrder_content.checkOrderStatus === 4" type="success" size="small" @click="editCheckOrder_Finish()">结束工单</el-button>
          </el-col>
          <el-col :span="4">
            <el-button :disabled="tableData_content_Next_disabled" size="small" type="warning" el-icon="el-icon-right" @click="editCheckOrder_content_Next()">下一项</el-button>
          </el-col>
        </div>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="dialogFormVisible_editCheckOrder" title="质检单完成确认" center style="min-height: 200px;" width="400px">
      <el-form ref="form_editCheckOrder" :model="form_editCheckOrder" label-position="right" label-width="110px">
        <el-form-item label="检查单名称" prop="checkOrderCode" style="display: inline-block">
          <el-input
            v-model="form_editCheckOrder.checkOrderCode"
            style="width: 200px"
            readonly
            size="small"/>
        </el-form-item>
        <el-form-item label="检查单号" prop="checkOrderName" style="display: inline-block">
          <el-input
            v-model="form_editCheckOrder.checkOrderName"
            style="width: 200px"
            size="small"
            readonly/>
        </el-form-item>
        <el-form-item label="备注" prop="checkOrderRemarks" style="display: inline-block">
          <el-input
            v-model="form_editCheckOrder.checkOrderRemarks"
            :rows="2"
            type="textarea"
            size="small"
            style="width: 200px"
            placeholder="请输入备注"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="editCheckOrder_Finish_cancel('form_editCheckOrder')">取消</el-button>
        <el-button type="primary" size="small" @click="editCheckOrder_Finish_sure('form_editCheckOrder')">确定</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>

import { getBeforeOrAfterTime, getNowTime2 } from '../../../utils/tool'
import { mapGetters } from 'vuex'

export default {
  data() {
    return {
      statusNumberValue: 0,
      statusNumber: [
        {
          value: 0,
          label: '全部'
        },
        {
          value: 1,
          label: '未下发'
        },
        {
          value: 2,
          label: '已下发'
        },
        {
          value: 3,
          label: '质检中'
        },
        {
          value: 4,
          label: '已完成'
        }
      ],
      dateTime: [],
      tableData: [],
      tableData_content: [],
      tableData_content_Next_disabled: true,
      tableData_content_Pre_disabled: true,
      currentSelectCheckOrder: {},
      currentSelectCheckOrderContent: {},
      dialogFormVisible_editCheckOrder: false,
      dialogFormVisible_editCheckOrder_content: false,
      form_editCheckOrder: {
        checkOrderCode: '',
        checkOrderName: '',
        checkOrderRemarks: '',
        ID: ''
      },
      form_editCheckOrder_content: {
        index: 0,
        ID: '',
        checkOrderStatus: '',
        checkOrderID: '',
        checkOrderRemarks: '',
        checkOrderName: '',
        checkOrderCode: '',
        stationNumberValue: '',
        checkOrderContentId: '',
        checkOrderContent: '',
        checkOrderContent1: '',
        checkOrderToolId: '',
        checkOrderTool: '',
        checkOrderMethodId: '',
        checkOrderMethod: '',
        checkOrderValue: '',
        checkOrderIsOk: 1,
        checkOrderAfterRemarks: ''
      },
      rules_editCheckOrder_content: {
        checkOrderValue: [{ required: true, message: '请输入检查结果' }]
      },
      currentPage: 1,
      pageSize: 10,
      pageCurrent: 1,
      totalNum: null
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'departmentId',
      'id'
    ])
  },
  watch: {
  },
  created() {
    this.dateTime = [getBeforeOrAfterTime(-7), getNowTime2()]
    this.fetchData()
  },
  methods: {
    fetchData() {
      this.listLoading = true
      var param = []
      param[0] = ['开始日期', this.dateTime[0]]
      param[1] = ['结束日期', this.dateTime[1]]
      param[2] = ['部门id', this.departmentId]
      param[3] = ['PageCurrent', this.pageCurrent]
      param[4] = ['PageSize', this.pageSize]
      param[5] = ['PageCount', 1000, 'int', '1']
      param[6] = ['ItemCount', 1000, 'int', '1']
      var Data = this.CreateData('11', '质检_工单_未完成_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData = response.data.result
        this.totalNum = parseInt(response.data.output[0].ItemCount)
        this.listLoading = false
      }).catch(er => {
        this.listLoading = false
        this.$message.error('错误')
      })
    },
    CheckOrder_rowClick(row) {
      this.currentSelectCheckOrder = row
      this.fetchData_content(row)
    },
    fetchData_content(row) {
      var param = []
      param[0] = ['质检单号', row.质检单号]
      var Data = this.CreateData('11', '质检_工单检查内容_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData_content = response.data
        for (let i = 0; i < this.tableData_content.length; i++) {
          this.tableData_content[i]['index'] = i
        }
      }).catch(er => {
        this.$message.error('错误')
      })
    },
    editCheckOrder_content(row) {
      this.currentSelectCheckOrderContent = row
      this.form_editCheckOrder_content.checkOrderRemarks = row.原始备注
      this.form_editCheckOrder_content.checkOrderName = this.currentSelectCheckOrder['质检单名称']
      this.form_editCheckOrder_content.checkOrderCode = this.currentSelectCheckOrder['质检单号']
      this.form_editCheckOrder_content.checkOrderID = this.currentSelectCheckOrder['ID']
      this.form_editCheckOrder_content.checkOrderStatus = this.currentSelectCheckOrder['状态']
      this.form_editCheckOrder_content.stationNumberValue = row.工位号
      this.form_editCheckOrder_content.checkOrderContentId = row.检查项id
      this.form_editCheckOrder_content.checkOrderContent = row.检查项目
      this.form_editCheckOrder_content.checkOrderContent1 = row.检查内容
      this.form_editCheckOrder_content.checkOrderToolId = row.检查工具id
      this.form_editCheckOrder_content.checkOrderTool = row.检查工具名称
      this.form_editCheckOrder_content.checkOrderMethodId = row.检查方法id
      this.form_editCheckOrder_content.checkOrderMethod = row.检查方法名称
      this.form_editCheckOrder_content.checkOrderValue = row.检验值
      this.form_editCheckOrder_content.checkOrderIsOk = row.是否合格
      this.form_editCheckOrder_content.checkOrderAfterRemarks = row.检查后备注
      this.form_editCheckOrder_content.ID = row.ID
      this.form_editCheckOrder_content.checkOrderIsOk = 1
      this.form_editCheckOrder_content.index = row.index
      this.dialogFormVisible_editCheckOrder_content = true
      this.editCheckOrder_content_preOrNextBtu(row.index)
    },
    editCheckOrder_content_Next() {
      const index = this.currentSelectCheckOrderContent.index
      if (index < this.tableData_content.length) {
        const row = this.tableData_content[index + 1]
        this.currentSelectCheckOrderContent = row
        this.form_editCheckOrder_content.checkOrderRemarks = row.原始备注
        this.form_editCheckOrder_content.checkOrderName = this.currentSelectCheckOrder['质检单名称']
        this.form_editCheckOrder_content.checkOrderCode = this.currentSelectCheckOrder['质检单号']
        this.form_editCheckOrder_content.checkOrderID = this.currentSelectCheckOrder['ID']
        this.form_editCheckOrder_content.checkOrderStatus = this.currentSelectCheckOrder['状态']
        this.form_editCheckOrder_content.stationNumberValue = row.工位号
        this.form_editCheckOrder_content.checkOrderContentId = row.检查项id
        this.form_editCheckOrder_content.checkOrderContent = row.检查项目
        this.form_editCheckOrder_content.checkOrderContent1 = row.检查内容
        this.form_editCheckOrder_content.checkOrderToolId = row.检查工具id
        this.form_editCheckOrder_content.checkOrderTool = row.检查工具名称
        this.form_editCheckOrder_content.checkOrderMethodId = row.检查方法id
        this.form_editCheckOrder_content.checkOrderMethod = row.检查方法名称
        this.form_editCheckOrder_content.checkOrderValue = row.检验值
        this.form_editCheckOrder_content.checkOrderIsOk = row.是否合格
        this.form_editCheckOrder_content.checkOrderAfterRemarks = row.检查后备注
        this.form_editCheckOrder_content.ID = row.ID
        this.form_editCheckOrder_content.checkOrderIsOk = 1
        this.form_editCheckOrder_content.index = row.index
        this.editCheckOrder_content_preOrNextBtu(row.index)
      }
    },
    editCheckOrder_content_pre() {
      const index = this.currentSelectCheckOrderContent.index
      if (index !== 0) {
        const row = this.tableData_content[index - 1]
        this.currentSelectCheckOrderContent = row
        this.form_editCheckOrder_content.checkOrderRemarks = row.原始备注
        this.form_editCheckOrder_content.checkOrderName = this.currentSelectCheckOrder['质检单名称']
        this.form_editCheckOrder_content.checkOrderCode = this.currentSelectCheckOrder['质检单号']
        this.form_editCheckOrder_content.checkOrderID = this.currentSelectCheckOrder['ID']
        this.form_editCheckOrder_content.checkOrderStatus = this.currentSelectCheckOrder['状态']
        this.form_editCheckOrder_content.stationNumberValue = row.工位号
        this.form_editCheckOrder_content.checkOrderContentId = row.检查项id
        this.form_editCheckOrder_content.checkOrderContent = row.检查项目
        this.form_editCheckOrder_content.checkOrderContent1 = row.检查内容
        this.form_editCheckOrder_content.checkOrderToolId = row.检查工具id
        this.form_editCheckOrder_content.checkOrderTool = row.检查工具名称
        this.form_editCheckOrder_content.checkOrderMethodId = row.检查方法id
        this.form_editCheckOrder_content.checkOrderMethod = row.检查方法名称
        this.form_editCheckOrder_content.checkOrderValue = row.检验值
        this.form_editCheckOrder_content.checkOrderIsOk = row.是否合格
        this.form_editCheckOrder_content.checkOrderAfterRemarks = row.检查后备注
        this.form_editCheckOrder_content.ID = row.ID
        this.form_editCheckOrder_content.checkOrderIsOk = 1
        this.form_editCheckOrder_content.index = row.index
        this.editCheckOrder_content_preOrNextBtu(row.index)
      }
    },
    editCheckOrder_content_preOrNextBtu(index) {
      if (this.tableData_content.length === 1) {
        this.tableData_content_Pre_disabled = true
        this.tableData_content_Next_disabled = true
      } else {
        if (index === 0) {
          this.tableData_content_Pre_disabled = true
          this.tableData_content_Next_disabled = false
        } else {
          if (index === this.tableData_content.length - 1) {
            this.tableData_content_Pre_disabled = false
            this.tableData_content_Next_disabled = true
          } else {
            this.tableData_content_Pre_disabled = false
            this.tableData_content_Next_disabled = false
          }
        }
      }
    },
    editCheckOrder_content_sure(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          var param = []
          param[0] = ['检验值', this.form_editCheckOrder_content.checkOrderValue]
          param[1] = ['检查后备注', this.form_editCheckOrder_content.checkOrderAfterRemarks]
          param[2] = ['是否合格', this.form_editCheckOrder_content.checkOrderIsOk]
          param[3] = ['ID', this.form_editCheckOrder_content.ID]
          param[4] = ['质检单ID', this.form_editCheckOrder_content.checkOrderID]
          var Data = this.CreateData('12', '质检_工单检查内容_录入编辑', param)
          this.ExecDatabase(Data).then(response => {
            if (response.data[0].result === '1') {
              this.$message({
                message: '提交成功！',
                type: 'success'
              })
              this.fetchData_content(this.currentSelectCheckOrder)
              this.fetchData()
            } else {
              this.$message.error('提交失败！')
            }
          })
        } else {
          return false
        }
      })
    },
    editCheckOrder_content_cancel(formName) {
      this.dialogFormVisible_editCheckOrder_content = false
      this.$refs[formName].resetFields()
    },
    editCheckOrder_Finish() {
      this.dialogFormVisible_editCheckOrder = true
      this.form_editCheckOrder.checkOrderCode = this.form_editCheckOrder_content.checkOrderCode
      this.form_editCheckOrder.checkOrderName = this.form_editCheckOrder_content.checkOrderName
      this.form_editCheckOrder.checkOrderRemarks = ''
      this.form_editCheckOrder.ID = this.form_editCheckOrder_content.checkOrderID
    },
    editCheckOrder_Finish_sure(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          var param = []
          param[0] = ['备注', this.form_editCheckOrder.checkOrderRemarks]
          param[1] = ['ID', this.form_editCheckOrder.ID]
          var Data = this.CreateData('12', '质检_工单_结束工单', param)
          this.ExecDatabase(Data).then(response => {
            if (response.data[0].result === '1') {
              this.$message({
                message: '提交成功！',
                type: 'success'
              })
              this.fetchData_content(this.currentSelectCheckOrder)
              this.fetchData()
              this.dialogFormVisible_editCheckOrder_content = false
              this.dialogFormVisible_editCheckOrder = false
            } else {
              this.$message.error('提交失败！')
            }
          })
        } else {
          return false
        }
      })
    },
    editCheckOrder_Finish_cancel(formName) {
      this.dialogFormVisible_editCheckOrder = false
      this.$refs[formName].resetFields()
    },
    handleSizeChange(val) {
      this.pageSize = val
      this.fetchData()
    },
    // 分页功能改变当前页
    handleCurrentChange(val) {
      this.pageCurrent = val
      this.fetchData()
    }
  }
}
</script>

<style scoped>
.check-Content-Name {
  font-size: 14px;
  line-height: 30px;
}
.check-Content-Value {
  font-size: 14px;
  font-weight: bolder;
  line-height: 30px;
}
</style>

