<template>
  <div>
    <layout>
      <layout-header >
        <div class="">
          <!--按钮部分-->
          <el-form ref="elSearchFormRef" :inline="true"  class="demo-form-inline" :rules="searchRule" @keyup.enter="onSubmit">
            <el-form-item>
              <el-input v-model="searchInfo" placeholder="搜索产品编号或产品名称" clearable style="width: 180px;"></el-input>
              <el-button type="primary" icon="search" @click="onSubmit" class="search"></el-button>
              <el-button type="primary" icon="edit" @click="onStatusClick" class="bt"><i class="el-icon-edit"></i>状态设置</el-button>
              <!--                <el-button type="primary" disabled icon="edit" @click="" style="margin-left: 10px">工艺方案复制</el-button>-->
              <el-button type="primary" icon="edit" @click="gygmClick" class="bt">工艺方案更名</el-button>
              <el-button type="primary"  icon="edit" @click="fjClick" class="bt">工艺方案附加</el-button>
              <el-button type="primary" icon="edit" @click="jsssxzClick" class="bt">计损色数修正</el-button>
              <el-button type="primary" icon="edit" @click="fjfpxsClick" class="bt">质检废品系数</el-button>
              <el-button type="primary" icon="edit" @click="pccstzClick" class="bt">排产参数调整</el-button>
              <el-button type="primary" icon="edit" @click="hscstzClick" class="bt">核算参数调整</el-button>
              <el-button type="primary" icon="edit"  @click="addcpyj_onclick"     class="bt">新增印件资料</el-button>
              <el-button type="primary" icon="edit"  disabled @click="addcpgy_onclick"     class="bt">新增工艺资料</el-button>
              <el-button type="primary" disabled icon="Download" @click="cpexportToExcel" style="margin: 5px;display: none">导出产品资料</el-button>
              <el-button type="primary" disabled icon="Download" @click="gyexportToExcel" style="margin: 5px;margin-top: 5px;display: none">导出工艺流程</el-button>
            </el-form-item>
          </el-form>

          <!--按钮弹窗部分-->

          <!--状态设置-->
          <el-dialog v-model="onstatuslist" title="状态设置" style="width: 300px; top: 20%">
            <div>
              <el-radio-group v-model="status">
                <el-radio label="在产">在产</el-radio>
                <el-radio label="停产">停产</el-radio>
              </el-radio-group>
            </div>
            <div slot="footer" class="dialog-footer" style="text-align: right;">
              <el-button @click="handleCancel">取消</el-button>
              <el-button type="primary" @click="handleConfirm">确定</el-button>
            </div>
          </el-dialog>

          <!--工艺方案更名-->
          <el-dialog v-model="gygmlist" title="工艺方案更名"  style="width: 35%;top: 15%;">
              <el-form-item label="产品代号:" prop="process" class="mab">
                <el-input v-model="gyformData['process']" disabled :clearable="true" placeholder="" style="width: 160px;"/>
              </el-form-item>
              <br>
              <el-form-item label="产品名称" prop="processName" class="mab">
                <el-input v-model="gyformData['processName']" disabled :clearable="true" placeholder="" style="width: 90%;" />
              </el-form-item>
              <br>
              <el-form-item label="工艺方案原名:" prop="originalName" class="mab">
                <el-select v-model="gyformData.originalName" placeholder="请选择" style="width: 160px;">
                  <el-option v-for="option in gyformData.originalNameOptions" :key="option" :label="option" :value="option" />
                </el-select>
              </el-form-item>
              <br>
              <el-form-item label="工艺方案新名:" prop="newName"  class="mab">
                <el-input v-model="gyformData['newName']" :clearable="true" placeholder="" style="width: 160px;"/>
              </el-form-item>

              <div class="dialog-footer" style="text-align: right ">
                <el-button @click="gygmhandleCancel">取消</el-button>
                <el-button type="primary" @click="gygmhandleConfirm">确定</el-button>
              </div>
          </el-dialog>

          <!--工艺方案附加 -->
          <el-dialog v-model="fjlist" title="工艺方案附加" style="width: 100%;height: 100%;margin: 0px">
              <el-button type="primary" @click="fjbzgx">附加标准工序</el-button>
              <el-button type="primary" @click="gxdqcpgx">更新当前产品工序</el-button>
              <!--                      :disabled="!fjformData['dqoriginalName']"  替换 disabled -->
              <el-button type="primary"  disabled @click="fjhandleConfirm">建立工艺方案</el-button>
              <el-button type="primary" @click="fjhandleCancel">放弃操作</el-button>
            <div>
              <br>
              <div style="height: 38px; display: flex; align-items: center;">
                <el-form-item label="当前产品:" prop="currentProcess" style="margin-right: 20px;padding: 0px">
                  <el-input v-model="fjformData['process']" disabled :clearable="true" placeholder="" style="width: 160px;"/>
                  <el-input v-model="fjformData['processName']" disabled :clearable="true" placeholder="" style="width: 500px;flex: 1;"/>
                </el-form-item>
                <el-form-item label="工艺方案:" prop="originalName"  style="margin-left: 20px;">
                  <el-select v-model="fjformData.originalName" placeholder="请选择" style="width: 160px;">
                    <el-option v-for="option in fjformData.originalNameOptions" @click="onoriginalNameclick" :key="option" :label="option" :value="option" />
                  </el-select>
                </el-form-item>
              </div>
              <div style="height: 38px;display: flex; align-items: center;">
                <el-form-item label="新 产 品 :" prop="currentProcess" style="margin-right: 20px;">
                  <el-input v-model="fjformData['dqprocess']"
                            @keyup.enter="getProductValue"  placeholder="输入新产品" style="width: 160px;"/>
                  <el-input v-model="fjformData['dqprocessName']"
                            :disabled="!!fjformData['dqprocessName']"
                            placeholder="点击输框获取产品名称" @click="ondqprocessNameclick"   style="width: 500px;flex: 1;"/>
                </el-form-item>

                <el-form-item label="工艺方案:" prop="originalName" style="margin-left: 20px;">
                  <el-input v-model="fjformData['dqoriginalName']"
                            :disabled="!fjformData['dqprocessName']"
                            :clearable="true" placeholder="" style="width: 160px;"/>
                </el-form-item>
              </div>
              <el-table ref="multipleTable"
                        :show-overflow-tooltip="true"
                        :row-style="{ height: '0px' }"
                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '0px' }"
                        :header-cell-style="{ padding: '0px' }"
                        style="width: 100%;height: 70vh;" border tooltip-effect="dark"
                        :data="fjtableData" row-key="ID" @selection-change="handleSelectionChange">
                <el-table-column v-slot="scope" align="left" label=方案 width="100" >
                  <el-input disabled v-model="scope.row.programme" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="印件号" width="100">
                  <el-input v-model="scope.row.Gy0_yjno" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="工序号" width="100" >
                  <el-input v-model="scope.row.Gy0_gxh" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="工序名称" width="600" >
                  <el-input disabled v-model="scope.row.Add_gxmc" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="工价系列" width="100" >
                  <el-input disabled v-model="scope.row.difficulty_coe" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="损耗系数" width="100" >
                  <el-input disabled v-model="scope.row.loss_coe" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="开数" width="100" >
                  <el-input  v-model="scope.row.Gy0_Ks" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="联数" width="100" >
                  <el-input  v-model="scope.row.Gy0_ls" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="备注" width="340" >
                  <el-input disabled v-model="scope.row.remark" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="车间" width="130" >
                  <el-input disabled v-model="scope.row.Gy0_site" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="设备编号" width="110" >
                  <el-input disabled v-model="scope.row.Gy0_sbbh" :clearable="false"/>
                </el-table-column>
              </el-table>
<!--              <div class="dialog-footer" style="text-align: right;margin: 0;">-->
<!--                <el-button type="primary" @click="fjbzgx">附加标准工序</el-button>-->
<!--                <el-button type="primary" @click="gxdqcpgx">更新当前产品工序</el-button>-->
<!--                &lt;!&ndash;                      :disabled="!fjformData['dqoriginalName']"  替换 disabled &ndash;&gt;-->
<!--                <el-button type="primary"  disabled @click="fjhandleConfirm">建立工艺方案</el-button>-->
<!--                <el-button type="primary" @click="fjhandleCancel">放弃操作</el-button>-->
<!--              </div>-->

            </div>
          </el-dialog>

          <!--工艺方案附加中 附加标准工序-->
          <el-dialog v-model="cpgylcfjxx" title="产品工艺流程附加选择" width="1400px" style="height: 740px;bottom: 6%;">
            <div>
              <div style="width: 100%; height: 60px; padding: 0px; margin: 10px 0px 0px 0px; display: flex; align-items: center;">
                <el-form-item label="产品代号 :" prop="currentProcess" style="margin-right: 20px; padding: 0px">
                  <el-input v-model="cpgyformData['cpgydh']"
                            @keyup.enter="cpgygetProductValue"  placeholder="输入新产品" style="width: 160px;"/>
                  <el-input v-model="cpgyformData['cpgymc']"
                            disabled
                            placeholder="" @click="oncpgymcclick"   style="width: 500px;flex: 1;"/>
                </el-form-item>

                <el-form-item label="工艺方案:" prop="originalName"  style="margin-left: 20px;">
                  <el-select v-model="cpgyformData.cpgyfan" placeholder="请选择" style="width: 160px;">
                    <el-option v-for="option in cpgyformData.cpgyfans" @click="oncpgyfanclick" :key="option" :label="option" :value="option" />
                  </el-select>
                </el-form-item>
              </div>

              <el-table ref="multipleTable"
                        v-if="cpgyformData['cpgydh'] && cpgyformData['cpgydh'].length > 0"
                        :show-overflow-tooltip="true"
                        :row-style="{ height: '20px' }"
                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                        :header-cell-style="{ padding: '0px' }"
                        :hidden="!cpgyformData['cpgymc']"
                        style="width: 100%;height: 450px" border tooltip-effect="dark"
                        :data="cpgytableData" row-key="ID" @selection-change="handleSelectionChange">
                <el-table-column v-slot="scope" align="left" label=方案 width="100" >
                  <el-input disabled v-model="scope.row.programme" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="印件号" width="100">
                  <el-input disabled v-model="scope.row.Gy0_yjno" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="工序号" width="100" >
                  <el-input disabled v-model="scope.row.Gy0_gxh" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="工序名称" width="340" >
                  <el-input disabled v-model="scope.row.Add_gxmc" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="工价系列" width="100" >
                  <el-input disabled v-model="scope.row.difficulty_coe" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="损耗系数" width="100" >
                  <el-input disabled v-model="scope.row.loss_coe" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="开数" width="100" >
                  <el-input disabled v-model="scope.row.Gy0_Ks" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="联数" width="100" >
                  <el-input disabled   v-model="scope.row.Gy0_ls" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="备注" width="200" >
                  <el-input disabled v-model="scope.row.remark" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="车间" width="120" >
                  <el-input disabled v-model="scope.row.Gy0_site" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="设备编号" width="100" >
                  <el-input disabled v-model="scope.row.Gy0_sbbh" :clearable="false"/>
                </el-table-column>
              </el-table>
              <!--                    <div class="dialog-footer" style="margin-top: 80px; margin-left: 45%;">-->
              <!--                      <el-button type="primary" @click="onfjbzgxexecute">执 行</el-button>-->
              <!--                      <el-button type="primary" @click="onfjbzgxcancellation">放 弃</el-button>-->
              <!--                    </div>-->
            </div>
          </el-dialog>

          <!--计损色数修正-->
          <el-dialog v-model="jsssxzlist" title="计损色数修正" style="width: 100%;height: 100%;margin: 0;">
            <el-button type="" @click="jsssxzCancel">取消</el-button>
            <el-button type="primary"  @click="jsssxzConfirm">确定</el-button>
            <div style="width: 100%; height: 60px; padding: 0px; margin: 0px 0px 6px 0px; display: flex; align-items: center;">
              <el-form-item label="关键字 :" prop="currentProcess" style="margin-right: 20px; padding: 0px">
                <el-input v-model="jsssxzformData['cpdh']"
                          @keyup.enter="jsssxzgetProductValue"  placeholder="输入产品编号" style="width: 500px;"/>
              </el-form-item>
            </div>
            <el-table ref="multipleTable"
                      :show-overflow-tooltip="true"
                      :row-style="{ height: '20px' }"
                      :header-row-style="{ height: '20px' }"
                      :header-cell-style="{ padding: '0px' }"
                      style="width: 100%;height: 70vh" border tooltip-effect="dark"
                      :data="jsssxztableData" row-key="ID" @selection-change="handleSelectionChange">
              <el-table-column v-slot="scope" align="left" label=产品名称 width="320" >
                <el-input disabled v-model="scope.row.product_name" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=方案 width="70" >
                <el-input disabled v-model="scope.row.programme" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=印件 width="70" >
                <el-input disabled v-model="scope.row.Gy0_yjno" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=工序 width="70" >
                <el-input disabled v-model="scope.row.Gy0_gxh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=工艺 width="120" >
                <el-input disabled v-model="scope.row.gy0_gxmc" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="原计损色数" width="100">
                <el-input :value="scope.row.old_ms_coe" disabled :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" prop="ms_coe" label=新计损色数 width="100" >
                <el-input  v-model="scope.row.ms_coe" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" prop="Gy0_Ks" label=新开数 width="90" >
                <el-input  v-model="scope.row.Gy0_Ks" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" prop="Gy0_ls" label=新联数 width="90" >
                <el-input  v-model="scope.row.Gy0_ls" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" prop="Add_gxmc" label=工序名称 width="210" >
                <el-input  v-model="scope.row.Add_gxmc" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" prop="remark" label=工序备注说明 width="340" >
                <el-input  v-model="scope.row.remark" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=设备编号 width="100" >
                <el-input disabled v-model="scope.row.Gy0_sbbh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=客户名称 width="200" >
                <el-input disabled v-model="scope.row.custom_name" :clearable="false"/>
              </el-table-column>
            </el-table>
<!--            <div class="dialog-footer"  style="text-align: right; margin-top: 1%;">-->
<!--              <el-button type="" @click="jsssxzCancel">取消</el-button>-->
<!--              <el-button type="primary"  @click="jsssxzConfirm">确定</el-button>-->
<!--            </div>-->
          </el-dialog>

          <!--质检废品系数-->
          <el-dialog v-model="fjfpxslist" title="质检废品系数" style="width: 100%;height: 100%;margin: 0;">
            <el-button type="" @click="fjfpxsCancel">取消</el-button>
            <el-button type="primary"  @click="fjfpxsConfirm">确认</el-button>
            <div style="width: 100%; height: 60px; padding: 0px; margin: 0px 0px 6px 0px; display: flex; align-items: center;">
              <el-form-item label="关键字 :" prop="currentProcess" style="margin-right: 20px; padding: 0px">
                <el-input v-model="fjfpxsformData['cpdh']"
                          @keyup.enter="fjfpxsgetProductValue" placeholder="输入产品编号" style="width: 500px;"/>
              </el-form-item>
            </div>
            <el-table ref="multipleTable"
                      :show-overflow-tooltip="true"
                      :row-style="{ height: '20px' }"
                      :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                      :header-cell-style="{ padding: '0px' }"
                      style="width: 100%;height: 70vh" border tooltip-effect="dark"
                      :data="fjfpxstableData" row-key="ID" @selection-change="handleSelectionChange">
              <el-table-column v-slot="scope" align="left" label=产品名称 width="300" >
                <el-input disabled  v-model="scope.row.product_name" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=印件 width="70" >
                <el-input disabled v-model="scope.row.Gy0_yjno" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=工序 width="70" >
                <el-input disabled v-model="scope.row.Gy0_gxh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=工艺 width="120" >
                <el-input disabled v-model="scope.row.gy0_gxmc" :clearable="false"/>
              </el-table-column>

              <el-table-column v-slot="scope" align="left" label=原人工正品版 width="110" >
                <el-input disabled v-model="scope.row.old_artificial_zp" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=原人工次品板 width="110" >
                <el-input disabled v-model="scope.row.old_artificial_cp" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=原人工废检 width="100" >
                <el-input disabled v-model="scope.row.old_artificial_fj" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=原机检正品版 width="110" >
                <el-input disabled v-model="scope.row.old_machine_zp" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=原机检次品版 width="110" >
                <el-input disabled v-model="scope.row.old_machine_cp" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=原机检废检 width="100" >
                <el-input disabled v-model="scope.row.old_machine_fj" :clearable="false"/>
              </el-table-column>

              <el-table-column v-slot="scope" align="left" label=新人工正品版 width="110" >
                <el-input  v-model="scope.row.artificial_zp" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=新人工次品板 width="110" >
                <el-input  v-model="scope.row.artificial_cp" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=新人工废检 width="100" >
                <el-input  v-model="scope.row.artificial_fj" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=新机检正品版 width="110" >
                <el-input  v-model="scope.row.machine_zp" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=新机检次品版 width="110" >
                <el-input  v-model="scope.row.machine_cp" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=新机检废检 width="100" >
                <el-input  v-model="scope.row.machine_fj" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=设备编号 width="100" >
                <el-input disabled v-model="scope.row.Gy0_sbbh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=客户名称 width="200" >
                <el-input disabled v-model="scope.row.custom_name" :clearable="false"/>
              </el-table-column>
            </el-table>
<!--            <div class="dialog-footer" style="text-align: right; margin-top: 1%;">-->
<!--              <el-button type="" @click="fjfpxsCancel">取消</el-button>-->
<!--              <el-button type="primary" disabled @click="fjfpxsConfirm">确认</el-button>-->
<!--            </div>-->
          </el-dialog>

          <!--排产参数调整-->
          <el-dialog v-model="pccstzlist" title="排产参数调整"  style="width: 100%;height: 100%;margin: 0;">
            <el-button type="" @click="pccstzCancel">取消</el-button>
            <el-button type="primary"  @click="pccstzConfirm">确认</el-button>
            <div style="width: 100%; height: 60px; padding: 0px; margin: 0px 0px 6px 0px; display: flex; align-items: center;">
              <el-form-item label="关键是字 :" prop="currentProcess" style="margin-right: 20px; padding: 0px">
                <el-input v-model="pccstzformData['cpdh']"
                          @keyup.enter="pccstzProductValue"  placeholder="输入产品编号" style="width: 500px;"/>
              </el-form-item>
            </div>
            <el-table ref="multipleTable"
                      :show-overflow-tooltip="true"
                      :row-style="{ height: '20px' }"
                      :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                      :header-cell-style="{ padding: '0px' }"
                      style="width: 100%;height: 70vh;" border tooltip-effect="dark"
                      :data="pccstztableData" row-key="ID" @selection-change="handleSelectionChange">
              <el-table-column v-slot="scope" align="left" label=产品名称 width="230" >
                <el-input disabled  v-model="scope.row.product_name" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=方案 width="70" >
                <el-input disabled  v-model="scope.row.programme" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=印件 width="70" >
                <el-input disabled  v-model="scope.row.Gy0_yjno" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=工序 width="70" >
                <el-input disabled  v-model="scope.row.Gy0_gxh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=工序名称 width="150" >
                <el-input disabled  v-model="scope.row.gy0_gxmc" :clearable="false"/>
              </el-table-column>

              <el-table-column v-slot="scope" align="left" label=原A类产能 width="100" >
                <el-input disabled  v-model="scope.row.old_A_power" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=原损耗代号 width="170" >
                <el-input disabled  v-model="scope.row.old_Gy0_shdh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=原机组编号 width="100" >
                <el-input disabled  v-model="scope.row.old_Gy0_sbbh" :clearable="false"/>
              </el-table-column>

              <el-table-column v-slot="scope"  align="left" label=新A类产能 width="115" >
                <el-input   v-model="scope.row.A_power" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope"  align="left" label=新损耗代号 width="170" >
                <el-input   v-model="scope.row.Gy0_shdh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope"   align="left" label=新机组编号 width="115" >
                <el-input   v-model="scope.row.Gy0_sbbh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope"  align="left" label=新装版开工时 width="115" >
                <el-input   v-model="scope.row.Gy0_辅助工时" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=开数 width="70" >
                <el-input disabled  v-model="scope.row.Gy0_Ks" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=联数 width="70" >
                <el-input disabled  v-model="scope.row.Gy0_ls" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=车间 width="110" >
                <el-input disabled  v-model="scope.row.Gy0_site" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=设备编号 width="100" >
                <el-input disabled  v-model="scope.row.olds_Gy0_sbbh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=客户名称 width="300" >
                <el-input disabled  v-model="scope.row.custom_name" :clearable="false"/>
              </el-table-column>
            </el-table>
<!--            <div class="dialog-footer" style="text-align: right; margin-top: 1%;">-->
<!--              <el-button type="" @click="pccstzCancel">取消</el-button>-->
<!--              <el-button type="primary"  @click="pccstzConfirm">确认</el-button>-->
<!--            </div>-->
          </el-dialog>

          <!--核算参数调整-->
          <el-dialog v-model="hscstzlist" title="核算参数调整"  style="width: 100%;height: 100%;margin:  0;">
            <el-button type="" @click="hscstzCancel">取消</el-button>
            <el-button type="primary"   @click="hscstzConfirm">确认</el-button>
            <div style="width: 100%; height: 60px; padding: 0px; margin: 0px 0px 6px 0px; display: flex; align-items: center;">
              <el-form-item label="关键是字 :" prop="currentProcess" style="margin-right: 20px; padding: 0px">
                <el-input v-model="hscstzformData['cpdh']"
                          @keyup.enter="hscstzProductValue"  placeholder="输入产品编号" style="width: 500px;"/>
              </el-form-item>
            </div>
            <el-table ref="multipleTable"
                      :show-overflow-tooltip="true"
                      :row-style="{ height: '20px' }"
                      :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                      :header-cell-style="{ padding: '0px' }"
                      style="width: 100%;height: 70vh;" border tooltip-effect="dark"
                      :data="hscstztableData" row-key="ID" @selection-change="handleSelectionChange">
              <el-table-column v-slot="scope" align="left" label=产品名称 width="260" >
                <el-input disabled  v-model="scope.row.product_name" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=方案 width="70" >
                <el-input disabled  v-model="scope.row.programme" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=印件 width="70" >
                <el-input disabled  v-model="scope.row.Gy0_yjno" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=工序 width="70" >
                <el-input disabled  v-model="scope.row.Gy0_gxh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=工序名称 width="150" >
                <el-input disabled  v-model="scope.row.gy0_gxmc" :clearable="false"/>
              </el-table-column>
              <!-- 原难度系数、原损耗系数、原计损色数-->
              <el-table-column v-slot="scope" align="left" label=原难度系数 width="115" >
                <el-input disabled  v-model="scope.row.hscstzold_difficulty_coe" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=原损耗系数 width="115" >
                <el-input disabled  v-model="scope.row.hscstzold_loss_coe" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=原计损色数 width="115" >
                <el-input disabled  v-model="scope.row.hscstzold_ms_coe" :clearable="false"/>
              </el-table-column>
              <!-- 新难度系数、新损耗系数、新计损色数-->
              <el-table-column v-slot="scope"  align="left" label=新难度系数 width="115" >
                <el-input   v-model="scope.row.difficulty_coe" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope"  align="left" label=新损耗系数 width="115" >
                <el-input   v-model="scope.row.loss_coe" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope"   align="left" label=新计损色数 width="115" >
                <el-input   v-model="scope.row.ms_coe" :clearable="false"/>
              </el-table-column>

              <el-table-column v-slot="scope" align="left" label=开数 width="70" >
                <el-input disabled  v-model="scope.row.Gy0_Ks" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=联数 width="70" >
                <el-input disabled  v-model="scope.row.Gy0_ls" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=车间 width="110" >
                <el-input disabled  v-model="scope.row.Gy0_site" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=设备编号 width="100" >
                <el-input disabled  v-model="scope.row.Gy0_sbbh" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label=客户名称 width="300" >
                <el-input disabled  v-model="scope.row.custom_name" :clearable="false"/>
              </el-table-column>
            </el-table>
<!--            <div class="dialog-footer" style="text-align: right; margin-top: 1%;">-->
<!--              <el-button type="" @click="hscstzCancel">取消</el-button>-->
<!--              <el-button type="primary"   @click="hscstzConfirm">确认</el-button>-->
<!--            </div>-->
          </el-dialog>

          <!--导出产品资料-->
          <el-dialog v-model="cpdialogexportToExcel" title="导出产品资料" width="50%">
          </el-dialog>

          <!--导出工艺流程-->
          <el-dialog v-model="gydialogexportToExcel" title="导出工艺流程" width="50%">
          </el-dialog>

        </div>
      </layout-header>


        <layout>
        <!--    左侧树侧形结构-->
        <layout-sider :resize-directions="['right']" :width="190" style="margin-right: 10px;">
          <div class="JKWTree-tree" style="height: 200px">
            <h3> 产品管理</h3>
            <el-tree :data="treeData" @node-click="handleNodeClick" @node-expand="handleNodeExpand">
              <template #default="{node,data}">{{data['客户编号']}}【{{data['客户名称']}}】</template>
            </el-tree>
          </div>
        </layout-sider>

        <!--  右侧内容区域 -->
        <layout-content >


          <!--   产品表格列表 -->
          <div class="gva-table-box">
            <el-table ref="multipleTable"
                      style="width: 100%;height: 25vh;"
                      :row-style="{ height: '15px' }"
                      :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                      :header-cell-style="{ padding: '0px' }"
                      border tooltip-effect="dark" :data="tableData" row-key="ID"
                      :row-class-name="tableRowClass" highlight-current-row="true"
                      size="small"
                      :cell-class-name="tableDataCellClass"
                      @selection-change="handleSelectionChange"
                      @row-dblclick="updateCompanyFunc"
                      @row-click="tableRowClick"
                      :show-overflow-tooltip="true">
              <el-table-column type="selection" width="30" />
              <el-table-column align="left" label="产品编号" prop="产品编号" width="115" />
              <el-table-column align="left" label="产品名称" prop="产品名称" width="340" />
              <el-table-column align="left" label="版本号" prop="版本号" width="100"/>
              <el-table-column align="left" label="成品规格" prop="成品规格" width="100" />
              <el-table-column align="left" label="单位" prop="计量单位" width="100"/>
              <el-table-column align="left" label="产品分类" prop="产品类别" width="100" />
              <el-table-column align="left" label="最近接单时间" prop="receiveDate" width="160" />
              <el-table-column align="left" label="印件数" prop="yjData" width="100" />
              <el-table-column align="left" label="工艺" prop="gyData" width="100"/>
              <el-table-column align="left" label="当前状态" prop="状态"  width="100"/>
              <el-table-column align="left" label="最后修改" prop="Sys_id" width="160" />
              <el-table-column align="left" label="建档日期" prop="Sys_rq" width="160" />
              <el-table-column sortable align="left" label="更新日期" prop="Mod_rq" width="160" />
            </el-table>
            <div class="gva-pagination">
              <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="page"
                  :page-sizes="[10, 30, 50, 100]"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="total">
              </el-pagination>
            </div>
          </div>

          <!--   印件资料、工艺资料、印版资料、技术资料附件表格 -->
          <el-tabs v-model="activeName" @tab-click="handleClick" class="ta">

            <el-tab-pane label="印件资料"  @click="showTable('印件资料')"  name="first">
              <el-table ref="multipleTable"
                        :show-overflow-tooltip="true"
                        highlight-current-row="true"
                        :row-style="{ height: '20px' }"
                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                        :header-cell-style="{ padding: '0px' }"
                        @row-dblclick="yjupdateCompanyFunc"
                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="yjtableData" row-key="ID" @selection-change="handleSelectionChange">
                <el-table-column type="selection" width="30" />
                <el-table-column align="left" label="印件号" prop="yj_yjno"  width="80"/>
                <el-table-column align="left" label="印件代号" prop="yj_yjdh" width="100" />
                <el-table-column align="left" label="印件名称" prop="yj_yjmc" width="540" />
                <el-table-column align="left" label="纸张单号" prop="yj_zzdh" width="100"/>
                <el-table-column align="left" label="纸张名称" prop="yj_zzmc" width="340"/>
                <el-table-column align="left" label="投料规格" prop="yj_tlgg" width="240"/>
                <el-table-column align="left" label="开料规格" prop="yj_klgg" width="100"/>
                <el-table-column align="left" label="开数" prop="yj_ks" width="80" />
                <el-table-column align="left" label="联数" prop="yj_ls" width="80" />
                <el-table-column align="left" label="备注" prop="yj_desc" width="200" />
                <el-table-column align="left" label="建档用户" prop="sys_id" width="130" />
                <el-table-column align="left" label="建档日期" prop="sys_rq" width="160" />
                <el-table-column align="left" label="更新日期" prop="mod_rq" width="160"/>
              </el-table>
            </el-tab-pane>

            <el-tab-pane label="工艺资料" @click="showTable('工艺资料')" name="second">
              <el-table ref="multipleTable"
                        highlight-current-row="true"
                        :show-overflow-tooltip="true"
                        :row-style="{ height: '20px' }"
                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                        :header-cell-style="{ padding: '0px' }"
                        @row-dblclick="gyupdateCompanyFunc"
                        :row-class-name="rowClassStyle"
                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="gytableData" row-key="ID" @selection-change="handleSelectionChange"
                        @row-click="clickybupdate">
                <el-table-column type="selection" width="30" />
                <el-table-column align="left" label="方案" prop="方案"  width="70"/>
                <el-table-column align="left" label="印件" prop="Gy0_yjno" width="80" />
                <el-table-column align="left" label="工序" prop="Gy0_gxh" width="70" />
                <el-table-column align="left" label="工序名称" prop="gy0_gxmc" width="120" />
                <el-table-column align="left" label="工序名称" prop="add_gxmc" width="340" />
                <el-table-column align="left" label="开数" prop="Gy0_Ks" width="70" />
                <el-table-column align="left" label="联数" prop="Gy0_ls" width="70" />
                <el-table-column align="left" label="备注" prop="备注" width="150" />
                <el-table-column align="left" label="工价系数" prop="工价系数" width="100" />
                <el-table-column align="left" label="损耗系数" prop="损耗系数" width="100" />
                <el-table-column align="left" label="计损色数" prop="Gy0_Ms" width="100" />
                <el-table-column align="left" label="人工检_正品版" prop="人工检_正品版" width="120" />
                <el-table-column align="left" label="人工检_次品版" prop="人工检_正品版" width="120" />
                <el-table-column align="left" label="人工检_废检" prop="人工检_废检" width="120"/>
                <el-table-column align="left" label="机检_正品版" prop="机检_正品版" width="120"/>
                <el-table-column align="left" label="机检_次品检" prop="机检_次品检" width="120"/>
                <el-table-column align="left" label="机检_废检" prop="机检_废检" width="120"/>
                <el-table-column align="left" label="设备编号" prop="Gy0_sbmc" width="100"/>
                <el-table-column align="left" label="最后修改" prop="最后修改" width="160"/>
                <el-table-column align="left" label="建档日期" prop="建档日期" width="160"/>
                <el-table-column align="left" label="更新日期" prop="更新日期" width="160"/>
              </el-table>
            </el-tab-pane>

            <el-tab-pane label="印版资料" @click="showTable('印版资料')" name="third">
              <el-table ref="multipleTable"
                        highlight-current-row="true"
                        :show-overflow-tooltip="true"
                        :row-style="{ height: '20px' }"
                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                        :header-cell-style="{ padding: '0px' }"
                        @row-dblclick="ybupdateCompanyFunc"
                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="ybtableData" row-key="ID" @selection-change="handleSelectionChange"
              >
                <el-table-column type="selection" width="30" />
                <el-table-column align="left" label="方案" prop="YB_方案"  width="70"/>
                <el-table-column align="left" label="印件号" prop="YB_Yjno" width="80" />
                <el-table-column align="left" label="印版类别" prop="印版类别" width="100" />
                <el-table-column align="left" label="存货编码" prop="存货编码" width="100"/>
                <el-table-column align="left" label="印版名称" prop="印版名称"  width="440"/>
                <el-table-column align="left" label="考核印数" prop="考核印数" width="100"/>
                <el-table-column align="left" label="建档用户" prop="Sys_id" width="120" />
                <el-table-column align="left" label="建档日期" prop="建档日期" width="160" />
                <el-table-column align="left" label="更新日期" prop="更新日期" width="160" />
              </el-table>
            </el-tab-pane>

            <el-tab-pane label="技术资料附件" @click="showTable('技术资料附件')" name="fourth">
              <el-table ref="multipleTable"
                        :row-style="{ height: '20px' }"
                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                        :header-cell-style="{ padding: '0px' }"
                        :show-overflow-tooltip="true"
                        highlight-current-row="true"
                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="jstableData" row-key="ID" @selection-change="handleSelectionChange">
                <!--              <el-table-column type="selection" width="55" />-->
                <el-table-column align="left" label="序号" prop="序号"  width="120"/>
                <el-table-column align="left" label="适用工序" prop="适用工序" width="120" />
                <el-table-column align="left" label="备注" prop="备注" width="120" />
                <el-table-column align="left" label="文件类型" prop="文件类型" width="120"/>
                <el-table-column align="left" label="关联产品" prop="关联产品"  width="360"/>
                <el-table-column align="left" label="建档用户" prop="建档用户" width="120"/>
                <el-table-column align="left" label="建档日期" prop="建档日期" width="160" />
                <el-table-column align="left" label="更新日期" prop="更新日期" width="160" />
              </el-table>
            </el-tab-pane>

          </el-tabs>

          <!-- 修改产品产品基本资料表格弹窗 -->
          <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="'修改产品基本资料'" height="80%" width="60%" destroy-on-close>
            <el-row>
              <el-scrollbar>
                <el-form :model="formDataTest" label-position="right" ref="elFormRef" :rules="rule" label-width="80px">
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="客户编号:" prop="address" class="mab">
                        <el-input v-model="formDataTest['客户编号']" :clearable="true" id="id1" placeholder="" @keydown="ent($event, '', 'id1', 'id2')" style="width: 150px;" />
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="客户名称:" prop="gender" class="mab">
                        <el-input v-model="formDataTest['客户名称']" :clearable="true" id="id2" placeholder="" @keydown="ent($event, 'id1', 'id2', 'id3')"  />
                      </el-form-item>
                    </el-col>
                    <el-col :span="9">
                      <el-form-item label="印品代号:" prop="address" class="mab">
                        <el-input v-model="formDataTest['产品编号']" :clearable="true" id="id3" placeholder="" @keydown="ent($event, 'id2', 'id3', '版本号')" style="width: 150px;" />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="版本号:" prop="gender" label-width="60px" class="mab">
                        <el-input v-model="formDataTest['版本号']" :clearable="true" placeholder="" id="版本号"  @keydown="ent($event, 'id3', '版本号', '客户料号')" style="width: 120px;" />
                      </el-form-item>
                    </el-col>
                    <el-col :span="9">
                      <el-form-item label="客户料号:" prop="idCard" label-width="110px" class="mab">
                        <el-input v-model="formDataTest['客户料号']" :clearable="true" placeholder=""  id="客户料号"  @keydown="ent($event, '版本号', '客户料号', '产品名称')"  style="width: 150px;" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="产品名称:" prop="department" class="mab">
                        <el-input v-model="formDataTest['产品名称']" :clearable="true" placeholder="" id="产品名称"  @keydown="ent($event, '客户料号', '产品名称', '产品类别')"  />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="9">
                      <el-form-item label="产品类别:" prop="department" class="mab">
                        <el-input v-model="formDataTest['产品类别']" :clearable="true" placeholder="" id="产品类别"  @keydown="ent($event, '产品名称', '产品类别', '计量单位')" style="width: 150px;" />
                      </el-form-item>
                    </el-col>
                    <el-col :span="15">
                      <el-form-item label="单位:" prop="department" label-width="60px" class="mab">
                        <el-input v-model="formDataTest['计量单位']" :clearable="true" placeholder="" id="计量单位"  @keydown="ent($event, '产品类别', '计量单位', '成品规格')" style="width: 120px;"  />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-col :span="24">
                    <el-form-item label="成品规格:" prop="department" class="mab">
                      <el-input v-model="formDataTest['成品规格']" :clearable="true" placeholder="" id="成品规格"  @keydown="ent($event, '计量单位', '成品规格', '产品备注')"  />
                    </el-form-item>
                  </el-col>
                  <el-col :span="24">
                    <el-form-item label="产品备注:" prop="remark" class="mab">
                      <el-input type="textarea" v-model="formDataTest['产品备注']" :rows="4" :clearable="true" placeholder="" id="产品备注"  @keydown="ent($event, '成品规格', '产品备注', 'id1')"   />
                    </el-form-item>
                  </el-col>
                </el-form>
              </el-scrollbar>
            </el-row>
            <template #footer>
              <div class="dialog-footer">
                <el-button @click="closeDialog">取 消</el-button>
                <el-button type="primary" @click="enterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>

          <!-- 修改印件资料-->
          <el-dialog v-model="yjdialogFormVisible" :before-close="yjcloseDialog" :title="'修改印件资料'" height="80%" width="50%" destroy-on-close>
            <el-row>
              <el-scrollbar >
                <el-form :model="yjformDataTest" label-position="right" ref="elFormRef" :rules="rule">
                  <el-row>
                    <el-form-item label="印件号:" prop="address" class="mab"  label-width="70px">
                      <el-input v-model="yjformDataTest['yj_yjno']" clearable placeholder="请输入印件号" style="width: 140px;"  id="印件号"  @keydown="ent($event, '', '印件号', '印件代号')" />
                    </el-form-item>
                  </el-row>
                  <el-row>
                    <el-form-item label="印件代号:" prop="address" class="mab">
                      <el-input v-model="yjformDataTest['yj_yjdh']" clearable placeholder="请输入印件代码" style="width: 140px;"  id="印件代号"  @keydown="ent($event, '印件号', '印件代号', '印件名称')" />
                    </el-form-item>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="印件名称:" prop="address" class="mab">
                        <el-input v-model="yjformDataTest['yj_yjmc']" clearable placeholder="请输入印件代码" style="width: 100%;" id="印件名称"  @keydown="ent($event, '印件代号', '印件名称', 'yj_zzdh')" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="纸张:" prop="address" class="mab" label-width="70px">
                        <el-row>
                          <el-input v-model="yjformDataTest['yj_zzdh']" clearable placeholder="" style="width: 140px;"  id="yj_zzdh"  @keydown="ent($event, '印件名称', 'yj_zzdh', 'yj_zzmc')" />
                          <el-input v-model="yjformDataTest['yj_zzmc']" clearable placeholder=""  style="width: 460px;" id="yj_zzmc"  @keydown="ent($event, 'yj_zzdh', 'yj_zzmc', 'yj_tlgg')"  />
                        </el-row>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="投料(mm*mm):" prop="address" class="mab">
                        <el-input v-model="yjformDataTest['yj_tlgg']" clearable placeholder="请输入投料规格"  style="width: 140px;"  id="yj_tlgg"  @keydown="ent($event, 'yj_zzmc', 'yj_tlgg', 'yj_klgg')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="开料(mm*mm):" prop="address" class="mab">
                        <el-input v-model="yjformDataTest['yj_klgg']" clearable placeholder="请输入开料规格" style="width: 140px;"  id="yj_klgg"  @keydown="ent($event, 'yj_tlgg', 'yj_klgg', 'yj_ks')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="开数:" prop="address" class="mab" label-width="70px">
                        <el-input v-model="yjformDataTest['yj_ks']" clearable placeholder="请输入开数" style="width: 140px;" id="yj_ks"  @keydown="ent($event, 'yj_tlgg', 'yj_ks', 'yj_ls')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="联数:" prop="address" class="mab">
                        <el-input v-model="yjformDataTest['yj_ls']" clearable placeholder="请输入联数"  style="width: 140px;" id="yj_ls"  @keydown="ent($event, 'yj_ks', 'yj_ls', 'yj_desc')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="备注说明:" prop="remark" class="mab">
                        <el-input type="textarea" v-model="yjformDataTest['yj_desc']" rows="4" clearable placeholder="请输入备注说明"  id="yj_desc"  @keydown="ent($event, 'yj_ls', 'yj_desc', '印件号')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-form>
              </el-scrollbar>
            </el-row>
            <template #footer>
              <div class="dialog-footer">
                <el-button @click="yjcloseDialog">取 消</el-button>
                <el-button type="primary" disabled @click="yjenterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>

          <!-- 新增印件资料 -->
          <el-dialog v-model="add_yjdialogFormVisible" :before-close="add_yjcloseDialog" :title="'修改印件资料'" height="80%" width="50%" destroy-on-close>
            <el-row>
              <el-scrollbar >
                <el-form :model="add_yjformDataTest" label-position="right" ref="elFormRef" :rules="rule">
                  <el-row>
                    <el-form-item label="印件号:" prop="address" class="mab"  label-width="70px">
                      <el-input  placeholder="" style="width: 140px;"  id="印件号"  @keydown="ent($event, '', '印件号', '印件代号')" />
                    </el-form-item>
                  </el-row>
                  <el-row>
                    <el-form-item label="印件代号:" prop="address" class="mab">
                      <el-input  placeholder="" style="width: 140px;"  id="印件代号"  @keydown="ent($event, '印件号', '印件代号', '印件名称')" />
                    </el-form-item>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="印件名称:" prop="address" class="mab">
                        <el-input  placeholder="" style="width: 100%;" id="印件名称"  @keydown="ent($event, '印件代号', '印件名称', 'yj_zzdh')" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="纸张:" prop="address" class="mab" label-width="70px">
                        <el-row>
                          <el-input  placeholder="" style="width: 140px;"  id="yj_zzdh"  @keydown="ent($event, '印件名称', 'yj_zzdh', 'yj_zzmc')" />
                          <el-input  placeholder=""  style="width: 460px;" id="yj_zzmc"  @keydown="ent($event, 'yj_zzdh', 'yj_zzmc', 'yj_tlgg')"  />
                        </el-row>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="投料(mm*mm):" prop="address" class="mab">
                        <el-input  placeholder=""  style="width: 140px;"  id="yj_tlgg"  @keydown="ent($event, 'yj_zzmc', 'yj_tlgg', 'yj_klgg')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="开料(mm*mm):" prop="address" class="mab">
                        <el-input placeholder="" style="width: 140px;"  id="yj_klgg"  @keydown="ent($event, 'yj_tlgg', 'yj_klgg', 'yj_ks')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="12">
                      <el-form-item label="开数:" prop="address" class="mab" label-width="70px">
                        <el-input  placeholder="" style="width: 140px;" id="yj_ks"  @keydown="ent($event, 'yj_tlgg', 'yj_ks', 'yj_ls')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="12">
                      <el-form-item label="联数:" prop="address" class="mab">
                        <el-input  placeholder=""  style="width: 140px;" id="yj_ls"  @keydown="ent($event, 'yj_ks', 'yj_ls', 'yj_desc')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="备注说明:" prop="remark" class="mab">
                        <el-input type="textarea" rows="4" clearable placeholder="请输入备注说明"  id="yj_desc"  @keydown="ent($event, 'yj_ls', 'yj_desc', '印件号')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-form>
              </el-scrollbar>
            </el-row>
            <template #footer>
              <div class="dialog-footer">
                <el-button @click="add_yjcloseDialog">取 消</el-button>
                <el-button type="primary" disabled @click="add_yjenterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>

          <!-- 修改工艺资料 弹窗 -->
          <el-dialog v-model="gydialogFormVisible" :before-close="gycloseDialog" :title="'修改工艺资料'" destroy-on-close>
            <el-row>
              <el-scrollbar height="500px">
                <el-form :model="gyformDataTest" label-position="right" ref="elFormRef" :rules="rule" label-width="100px" >
                  <el-row>
                    <el-col :span="5">
                      <el-form-item label="工序方案:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['方案']" clearable placeholder="" style="width: 90px;" id="方案"  @keydown="ent($event, '备注', '方案', 'Gy0_yjno')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="4">
                      <el-form-item label="印件编号:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['Gy0_yjno']" clearable placeholder="" style="width: 90px;" id="Gy0_yjno"  @keydown="ent($event, '方案', 'Gy0_yjno', 'Gy0_gxh')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="4">
                      <el-form-item label="工序编号:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['Gy0_gxh']" clearable placeholder="" style="width: 90px;" id="Gy0_gxh"  @keydown="ent($event, 'Gy0_yjno', 'Gy0_gxh', 'Gy0_Ks')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="4">
                      <el-form-item label="加工开数" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['Gy0_Ks']" clearable placeholder="" style="width: 90px;" id="Gy0_Ks"  @keydown="ent($event, 'Gy0_gxh', 'Gy0_Ks', 'Gy0_ls')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="4">
                      <el-form-item label="加工联数:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['Gy0_ls']" clearable placeholder="" style="width: 90px;" id="Gy0_ls"  @keydown="ent($event, 'Gy0_Ks', 'Gy0_ls', 'gy0_site')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>

                  <el-row>
                    <el-col :span="6">
                      <el-form-item label="车间名称:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['gy0_site']" clearable placeholder="" style="width: 140px;" id="gy0_site"  @keydown="ent($event, 'Gy0_ls', 'gy0_site', 'gy0_gxmc')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="工艺名称:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['gy0_gxmc']" clearable placeholder="" style="width: 140px;" id="gy0_gxmc"  @keydown="ent($event, 'gy0_site', 'gy0_gxmc', 'add_gxmc')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>

                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="工序名称:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['add_gxmc']" clearable placeholder="" style="width: 100%;" id="add_gxmc"  @keydown="ent($event, 'gy0_gxmc', 'add_gxmc', 'Gy0_sbbh')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>

                  <el-row>
                    <el-col :span="6">
                      <el-form-item label="可用设备:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['Gy0_sbbh']" clearable placeholder="" style="width: 140px;" id="Gy0_sbbh"  @keydown="ent($event, 'add_gxmc', 'Gy0_sbbh', 'Gy0_shdh')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>

                  <el-row>
                    <el-col :span="5">
                      <el-form-item label="标准损耗:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['Gy0_shdh']" clearable placeholder="" style="width: 90px;" id="Gy0_shdh"  @keydown="ent($event, 'Gy0_sbbh', 'Gy0_shdh', '基础损耗')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="5">
                      <el-form-item label="基础损耗:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['基础损耗']" clearable placeholder="" style="width: 90px;" id="基础损耗"  @keydown="ent($event, 'Gy0_shdh', '基础损耗', '损耗率')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="损耗率" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['损耗率']" clearable placeholder="" style="width: 90px;" id="损耗率"  @keydown="ent($event, '基础损耗', '损耗率', '工价系数')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="工价系数:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['工价系数']" clearable placeholder="" style="width: 90px;" id="工价系数"  @keydown="ent($event, '损耗率', '工价系数', '损耗系数')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="损耗系数:" prop="address" class="mab">
                        <el-input v-model="gyformDataTest['损耗系数']" clearable placeholder="" style="width: 90px;" id="损耗系数"  @keydown="ent($event, '工价系数', '损耗系数', '备注')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>

                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="工序备注:" prop="remark" class="mab">
                        <el-input type="textarea" v-model="gyformDataTest['备注']" rows="4" clearable placeholder="请输入备注说明"  id="备注"  @keydown="ent($event, '损耗系数', '备注', '方案')" />
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-form>
              </el-scrollbar>
            </el-row>
            <template #footer>
              <div class="dialog-footer">
                <el-button @click="gycloseDialog">取 消</el-button>
                <el-button type="primary" disabled @click="gyenterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>

          <!-- 修改印版资料 弹窗 -->
          <el-dialog v-model="ybdialogFormVisible" :before-close="ybcloseDialog" :title="'修改印版资料'" destroy-on-close>
            <el-row>
              <el-scrollbar height="500px">
                <el-form :model="ybformDataTest" label-position="right" ref="elFormRef" :rules="rule" label-width="100px" >
                  <el-row>
                    <el-col :span="8">
                      <el-form-item label="工序方案:" prop="address"  class="mab">
                        <el-input v-model="ybformDataTest['YB_方案']" clearable placeholder="" style="width: 100px;" id="YB_方案"  @keydown="ent($event, 'gy0_site', 'YB_方案', 'YB_Yjno')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="印件号:" prop="address"  class="mab">
                        <el-input v-model="ybformDataTest['YB_Yjno']" clearable placeholder="" style="width: 100px;"  id="YB_Yjno"  @keydown="ent($event, 'YB_方案', 'YB_Yjno', '工序编号')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="8">
                      <el-form-item label="工序编号:" prop="address"  class="mab">
                        <el-input v-model="ybformDataTest['']" clearable placeholder="" style="width: 100px;"  id="工序编号"  @keydown="ent($event, 'YB_Yjno', '工序编号', '工艺名称')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>

                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="工艺名称:" prop="address"  class="mab">
                        <el-input v-model="ybformDataTest['gy0_site']" clearable placeholder="" style="width: 100%;"  id="工艺名称"  @keydown="ent($event, '工序编号', '工艺名称', '工序名称')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="工序名称:" prop="address"  class="mab">
                        <el-input v-model="ybformDataTest['gy0_site']" clearable placeholder="" style="width: 100%;"  id="工序名称"  @keydown="ent($event, '工艺名称', '工序名称', '存货编码')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="10 ">
                      <el-form-item label="存货编码:" prop="address"  class="mab">
                        <el-input v-model="ybformDataTest['存货编码']" clearable placeholder="" style="width: 140px;"  id="存货编码"  @keydown="ent($event, '工序名称', '存货编码', '印版名称')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="存货名称:" prop="address"  class="mab">
                        <el-input v-model="ybformDataTest['印版名称']" clearable placeholder="" style="width: 100%;"  id="印版名称"  @keydown="ent($event, '存货编码', '印版名称', 'gy0_site')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="印版备注:" prop="address"  class="mab">
                        <el-input v-model="ybformDataTest['gy0_site']" clearable placeholder="" style="width: 100%;"  id="gy0_site"  @keydown="ent($event, '印版名称', 'gy0_site', 'YB_方案')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                </el-form>
              </el-scrollbar>
            </el-row>
            <template #footer>
              <div class="dialog-footer">
                <el-button @click="ybcloseDialog">取 消</el-button>
                <el-button type="primary" disabled @click="ybenterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>
        </layout-content>

      </layout>
    </layout>
  </div>
</template>
<script>
//点击按钮显示下方表格
export default {
  data() {
    return {
      currentTable: '',
      activeName: 'first',
      currentGy0_yjno: null
    };
  },
  methods: {
    tableRowClass({row,rowIndex}){
      if(row.状态==="停产"){
        return "warning-row"
      }
    },
    rowClassStyle({row,rowIndex}){
      // debugger
      // console.log(row.Gy0_yjno, this.currentGy0_yjno)
      if(row.Gy0_yjno==this.currentGy0_yjno){
        return "warning-row"
      }
    },
    clickybupdate(row,column,event){
      this.currentGy0_yjno = row.Gy0_yjno
    },
    showTable(tableName) {
      // console.log(tableName)
      // 根据点击的按钮设置当前展示的表格
      // this.currentTable = tableName;
    },
    showTableChange() {
      // 处理表格选中事件
    },
    // 其他方法...
  }
};
</script>
<script setup>
// 全量引入格式化工具 请按需保留
import { ElMessage, ElMessageBox } from 'element-plus'
//拖拽 import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
import { ref, reactive } from 'vue'
import {
  DataList,editGyName, editGyNo, editProduct,
  getCustom,getDepartment,getProduct,editGy,getProductData,
  getProductGy,editGyWaste,editGyMs,getStaffList,setProductStatus} from "@/api/yunyin/yunying";
defineOptions({   name: 'Company'})

// =========== 导出Excel表格 ===========
// //导出产品
// const cpdialogexportToExcel = ref(false)
// const cpexportToExcel = () => {
//   console.log('点击了导出产品按钮')
//   cpdialogexportToExcel.value = true;
// }
//
// //导出工艺
// const gydialogexportToExcel = ref(false)
// const gyexportToExcel = () => {
//   console.log('点击了导出工艺流程按钮')
//   gydialogexportToExcel.value = true;
// }

// =========== 状态设置 ===========
const onstatuslist = ref(false);
const status = ref('在产'); // 默认选择在产
const _stacode = ref(null);
//点击【状态设置】按钮
const onStatusClick = () => {
  if(_product_code.value == null){
    onstatuslist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择树形后，再操作此功能'
    })
  }else{
    _stacode.value = _product_code.value;
    onstatuslist.value = true;
  }
};
// 状态设置放弃按钮
const handleCancel = () => {
  onstatuslist.value = false;
};
// 状态设置执行按钮
const handleConfirm = async () => {
  onstatuslist.value = false;
  let statusCode;
  let code = _stacode.value;
  if (status.value === '在产') {
    statusCode = 1;
  } else if (status.value === '停产') {
    statusCode = 2;
  }
  const data = await setProductStatus({ code: code, status: statusCode });
  if (data.code === 0) {
    ElMessage({
      type: 'success',
      message: '更新成功'
    })
  } else {
    ElMessage({
      type: 'error',
      message: '更新成功'
    })
  }
};
handleCancel(_stacode);

// =========== 工艺方案附加 ===========
const fjlist = ref(false);
const fjformData = reactive({
  //当前产品
  process: '',
  //产品名称
  processName: '',
  //工艺方案
  processfa: [],
  // 工艺方案默认选择的值
  originalName: '',
  //↓新产品数据
  dqprocess: '',
  dqprocessName: '',
  dqoriginalName: ''
});
const fjtableData = ref([]);
const _originalNamev = ref(null);

//1.点击【工艺方案附加】按钮
const fjClick = () => {
  if(_product_code.value == null){
    fjlist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择分类项目，再操作此功能'
    })
  }else{
    fjlist.value = true;
    if (gytableData.length === 0) {
      fjlist.value = false;
      ElMessage({
        type: 'warning',
        message: '没有工艺资料'
      })
    } else {
      //将值赋值给当前产品
      fjformData.process = _product_code.value;
      fjformData.processName = _kehu_code.value;
      //默认新产品为空
      fjformData.dqprocess = ''
      fjformData.dqprocessName = ''
      fjformData.dqoriginalName = ''
      //获取方案
      const uniqueSchemeSet = new Set();
      gytableData.forEach(item => {
        uniqueSchemeSet.add(item['方案']);
      });
      const uniqueSchemeArray = Array.from(uniqueSchemeSet);
      fjformData.originalNameOptions = [];// 清空原有数据
      fjformData.originalNameOptions = fjformData.originalNameOptions.concat(uniqueSchemeArray);
      // 设置默认选择第一个选项
      if (fjformData.originalNameOptions.length > 0) {
        fjformData.originalName = fjformData.originalNameOptions[0];
      }
    }
    const product_code = fjformData.process
    const plan = fjformData.originalName
    getProductGys(product_code,plan)
  }
};

//2.输入新产品点击后面input获取新产品的值
const ondqprocessNameclick = () => {
  _originalNamev.value = fjformData['dqprocess'];
  _ongetProductclick();
}

//2.新产品输入框回车事件
const getProductValue = () => {
  if(fjformData['dqprocessName'] === ''){
    fjformData['dqprocessName'] = '';
  }
  _originalNamev.value = fjformData['dqprocess'];
  _ongetProductclick();
}

//封装获取单个产品基础数据方法[用来获取新产品名称]
const _ongetProductclick = async ()=>{
  let params = {}
  params.search = _originalNamev.value;
  params.limit = 999;
  params.page = 1;
  try {
    const WorkListdata = await getProduct(params);
    fjformData['dqprocessName'] = WorkListdata.data.data[0]['产品名称'];
  } catch (error) {
    console.error(error);
  }
}

//3.获取选择下拉框当前方案的值
const onoriginalNameclick = () => {
  //获取方案
  const uniqueSchemeSet = new Set();
  gytableData.forEach(item => {
    uniqueSchemeSet.add(item['方案']);
  });
  const uniqueSchemeArray = Array.from(uniqueSchemeSet);
  fjformData.originalNameOptions = [];// 清空原有数据
  fjformData.originalNameOptions = fjformData.originalNameOptions.concat(uniqueSchemeArray);
  const product_code = fjformData.process
  const plan = fjformData.originalName
  getProductGys(product_code,plan)
}

//当前产品号通过接口查询工艺数据,用来展示表格
const getProductGys = async (product_code,plan) => {
  const getProductGydata = await getProductGy({product_code:product_code,plan:plan});
  fjtableData.value = getProductGydata.data;
};

//==========点击【附加标准工序】按钮=====弹出新页面==========
const cpgylcfjxx = ref(false);
//产品代号
const _cpgyoriginalNamev = ref(null);
const cpgyformData = reactive({
  //当前产品代号
  cpgydh: '',
  //当前产品名称
  cpgymc: '',
  //当前产品工艺方案
  cpgyfan: [],
  // 当前工艺方案默认选择的值
  cpgyfans: '',
});

//点击【附加标准工序按钮】打开页面清空输入框数据
const fjbzgx = async () => {
  cpgyformData['cpgydh'] = '';
  cpgyformData['cpgymc'] = '';
  cpgyformData['cpgyfan'] = '';
  cpgylcfjxx.value = true;
}
//输入新产品点击后面input获取新产品的值
const oncpgymcclick = () => {
  _cpgyoriginalNamev.value = cpgyformData['cpgydh'];
  _cpgyongetProductclick();
  _ongetProductclicks();
}
//新产品输入框回车事件
const cpgygetProductValue = () => {
  if(cpgyformData['cpgydh'] == ''){
    cpgyformData['cpgymc'] = '';
  }
  _cpgyoriginalNamev.value = cpgyformData['cpgydh'];
  _cpgyongetProductclick();
  _ongetProductclicks();
}

//3.点击工艺方案下拉框获取输入框的值
const oncpgyfanclick = () => {
  // 产品代号
  const product_code = cpgyformData.cpgydh;
  // 选中的工艺方案
  const plan = cpgyformData.cpgyfan;
  getProductGyss(product_code,plan)
}

const yincangtableData = ref([]);
const _cpgyongetProductclick = async ()=>{
  const product_code = _cpgyoriginalNamev.value;//产品号
  const getProductDatadata = await getProductData({product_code:product_code});
  // 从数据中提取方案
  const schemes = getProductDatadata.data.gyData.map(item => item.方案);
  // 使用 Set 进行去重
  const uniqueSchemes = Array.from(new Set(schemes));
  // 更新工艺方案数组
  cpgyformData.cpgyfans = uniqueSchemes;
  // 设置默认选择第一个选项
  if (cpgyformData.cpgyfans.length > 0) {
    cpgyformData.cpgyfan = [cpgyformData.cpgyfans[0]];
  }
  const plan = cpgyformData.cpgyfan[0]
  getProductGyss(product_code,plan)
}
//当前产品号通过接口查询工艺数据,用来展示表格
const cpgytableData = ref([]);
const getProductGyss = async (product_code,plan) => {
  const getProductGydata = await getProductGy({product_code:product_code,plan:plan});
  cpgytableData.value = getProductGydata.data;
};
const _ongetProductclicks = async ()=>{
  let params = {}
  params.search = _cpgyoriginalNamev.value;
  params.limit = 999;
  params.page = 1;
  try {
    const getProductdata = await getProduct(params);
    cpgyformData['cpgymc'] = getProductdata.data.data[0]['产品名称'];
  } catch (error) {
    console.error(error);
  }
}

//点击【附加标准工序执行】按钮
const onfjbzgxexecute = async () => {
  cpgylcfjxx.value = false;
}

//点击【附加标准工序放弃】按钮
const onfjbzgxcancellation = async () => {cpgylcfjxx.value = false;}

//点击【更新当前产品工序】按钮，更新的是表格数据
const gxdqcpgx = async () => {
  const rawValueArray = fjtableData._rawValue;
  const formattedData = rawValueArray.map(item => {
    return {
      UniqID: item.UniqID,
      Gy0_yjno: item.Gy0_yjno,
      Gy0_gxh: item.Gy0_gxh,
      Gy0_Ks: item.Gy0_Ks,
      Gy0_ls: item.Gy0_ls
    };
  });
  const editGyNamedata = await editGyNo(formattedData);
  if (editGyNamedata.code === 0) {
    ElMessage({
      type: 'success',
      message: '更新成功'
    })
  } else {
    ElMessage({
      type: 'error',
      message: '更新失败'
    })
  }
  fjlist.value = false;
};

//点击【建立工艺方案】按钮，当前的方案建立到新产品方案中
const fjhandleConfirm = async () => {
  fjlist.value = false;
};

//点击【工艺方案附加放弃操作】按钮
const fjhandleCancel = () => {
  fjlist.value = false;
};

// =========== 工艺方案更名 ===========
const gygmlist = ref(false);
const _gygmstacode = ref(null);
const gyformData = reactive({
  process: '',
  processName: '',
  originalNameOptions: [],
  newName: '',
  originalName: '', // 工艺方案默认选择的值
});
//点击【工艺方案更名】按钮
const gygmClick = () => {
  if(_product_code.value == null){
    gygmlist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择分类项目，再操作此功能'
    })
  }else{
    gygmlist.value = true;
    gyformData.process = _product_code.value;
    gyformData.processName = _kehu_code.value;
    if (gytableData.length === 0) {
      gygmlist.value = false;
      ElMessage({
        type: 'warning',
        message: '没有工艺资料'
      })
    } else {
      const uniqueSchemeSet = new Set();
      gytableData.forEach(item => {
        uniqueSchemeSet.add(item['方案']);
      });
      const uniqueSchemeArray = Array.from(uniqueSchemeSet);
      gyformData.originalNameOptions = []; // 清空原有数据
      gyformData.originalNameOptions = gyformData.originalNameOptions.concat(uniqueSchemeArray);
      // 设置默认选择第一个选项
      if (gyformData.originalNameOptions.length > 0) {
        gyformData.originalName = gyformData.originalNameOptions[0];
      }
    }
  }
};
// 工艺方案更名放弃按钮
const gygmhandleCancel = () => {gygmlist.value = false;};

// 点击工艺方案更名【执行】按钮
const gygmhandleConfirm = async () => {
  gygmlist.value = false;
  let params = {}
  params.code = gyformData.process;
  params.old_name = gyformData.originalName;
  params.new_name = gyformData.newName;
  //确定后清空 工艺方案原名 输入框
  gyformData.originalName = ''
  //确定后清空 工艺方案新名 输入框
  gyformData.newName = ''
  try {
    const WorkListdata = await editGyName(params);
    if (WorkListdata.code === 0) {
      ElMessage({type: 'success',message: '更新成功'})
    } else {
      ElMessage({type: 'error',message: '更新失败'})
    }
  } catch (error) {
    console.error(error);
  }
};

gygmhandleCancel(_gygmstacode);

// =========== 计损色数修正 ===========
const jsssxzlist = ref(false);
const jsssxztableData = ref([]);
const jsssxzformData = reactive({cpdh: '',});
//点击【计损色数修正】按钮
const jsssxzClick = () => {
  if(_product_code.value == null){
    jsssxzlist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择分类项目，再操作此功能'
    })
  }else{
    _jsssxzgetProductGy();
    jsssxzformData['cpdh'] = _product_code.value;
    jsssxzlist.value = true;
  }
}
//计损色数修正【回车】
const jsssxzgetProductValue = async () => {
  _product_code.value = '';
  _jsssxzgetProductGy();
};
//计损色数修正获取工艺表格数据
const _jsssxzgetProductGy = async ()=>{
  let product_code = _product_code.value || jsssxzformData['cpdh'];
  try {
    const getProductGydata = await getProductGy({product_code:product_code});
    jsssxztableData.value = getProductGydata.data;
    const formattedData = getProductGydata.data.map(item=>{
      item.old_ms_coe = item.ms_coe
      return item
    });
  } catch (error) {
    console.error(error);
  }
}
//计损色数修正更新按钮
const jsssxzConfirm = async () => {
  const rawValueArray = jsssxztableData._rawValue;
  const formattedData = rawValueArray.map(item => {
    return {
      UniqID: item.UniqID,
      Gy0_Ms: item.ms_coe,
      Gy0_gxh: item.Gy0_gxh,
      Gy0_Ks: item.Gy0_Ks,
      Add_gxmc: item.Add_gxmc,
      remark: item.remark
    };
  });
  const editeditGyMs = await editGyMs(formattedData);
  if (editeditGyMs.code === 0) {
    ElMessage({type: 'success',message: '更新成功'})
  } else {
    ElMessage({type: 'error',message: '更新失败'})
  }
  jsssxzlist.value = false;

};
//计损色数修正放弃按钮
const jsssxzCancel = () => {jsssxzlist.value = false;};

// =========== 质检废品系数 ===========
const fjfpxslist = ref(false);
const fjfpxstableData = ref([]);
const fjfpxsformData = reactive({cpdh: '',});
//点击【质检废品系数】按钮
const fjfpxsClick = () => {
  if(_product_code.value == null){
    gygmlist.value = false;
    ElMessage({type: 'warning',message: '请选择分类项目，再操作此功能'})
  }else{
    fjfpxsformData['cpdh'] = _product_code.value;
    _fjfpxsgetProductGy();
    fjfpxslist.value = true;
  }
}
//质检废品系数回车
const fjfpxsgetProductValue = async () => {
  _product_code.value = '';
  _fjfpxsgetProductGy();
};
//质检废品系数获取工艺表格数据
const _fjfpxsgetProductGy = async ()=>{
  let product_code = _product_code.value || fjfpxsformData['cpdh'];
  try {
    const getProductGydata = await getProductGy({product_code:product_code});
    fjfpxstableData.value = getProductGydata.data;
    const formattedData = getProductGydata.data.map(item=>{
      item.old_artificial_zp = item.artificial_zp;
      item.old_artificial_cp = item.artificial_cp;
      item.old_artificial_fj = item.artificial_fj;
      item.old_machine_zp = item.machine_zp;
      item.old_machine_cp = item.machine_cp;
      item.old_machine_fj = item.machine_fj;
      return item
    });
  } catch (error) {
    console.error(error);
  }
}
//质检废品系数更新按钮
const fjfpxsConfirm = async () => {
  const rawValueArray = fjfpxstableData._rawValue;
  const formattedData = rawValueArray.map(item => {
    return {
      UniqID: item.UniqID,
      artificial_zp: parseFloat(item.artificial_zp) || item.artificial_zp === 0 ? parseFloat(item.artificial_zp).toFixed(3) : "0.000",
      artificial_cp: parseFloat(item.artificial_cp) || item.artificial_cp === 0 ? parseFloat(item.artificial_cp).toFixed(3) : "0.000",
      artificial_fj: parseFloat(item.artificial_fj) || item.artificial_fj === 0 ? parseFloat(item.artificial_fj).toFixed(3) : "0.000",
      machine_zp: parseFloat(item.machine_zp) || item.machine_zp === 0 ? parseFloat(item.machine_zp).toFixed(3) : "0.000",
      machine_cp: parseFloat(item.machine_cp) || item.machine_cp === 0 ? parseFloat(item.machine_cp).toFixed(3) : "0.000",
      machine_fj: parseFloat(item.machine_fj) || item.machine_fj === 0 ? parseFloat(item.machine_fj).toFixed(3) : "0.000"
    };
  });
  const editGyWastes = await editGyWaste(formattedData);
  if (editGyWastes.code === 0) {
    ElMessage({type: 'success',message: '更新成功'})
  } else {
    ElMessage({type: 'error',message: '更新失败'})
  }
  fjfpxslist.value = false;
};
//质检废品系数放弃按钮
const fjfpxsCancel = () => {fjfpxslist.value = false;};

// =========== 排产参数调整 ===========
const pccstzlist = ref(false);
const pccstztableData = ref([]);
const pccstzformData = reactive({cpdh: '',});
//点击【排产参数调整】按钮
const pccstzClick = () => {
  if(_product_code.value == null){
    pccstzlist.value = false;
    ElMessage({type: 'warning',message: '请选择分类项目，再操作此功能'})
  }else{
    pccstzformData['cpdh'] = _product_code.value;
    _pccstzgetProductGy();
    pccstzlist.value = true;
  }
}
//排产参数调整 回车
const pccstzProductValue = async () => {
  _product_code.value = '';
  _pccstzgetProductGy();
};
//排产参数调整 获取单个工艺数据（排产参数调整）
const _pccstzgetProductGy = async ()=>{
  let product_code = _product_code.value || pccstzformData['cpdh'];
  try {
    const getProductGydata = await getProductGy({product_code:product_code});
    pccstztableData.value = getProductGydata.data;
    const formattedData = getProductGydata.data.map(item=>{
      //原A类产能
      item.old_A_power = item.A_power;
      //原损耗代号
      item.old_Gy0_shdh = item.Gy0_shdh;
      // 原机组编号
      item.old_Gy0_sbbh = item.Gy0_sbbh;
      //设备编号
      item.olds_Gy0_sbbh = item.Gy0_sbbh;
      return item
    });
  } catch (error) {
    console.error(error);
  }
}
//排产参数调整 【执行更新按钮】
const pccstzConfirm = async () => {
  const rawValueArray = pccstztableData._rawValue;
  const formattedData = rawValueArray.map(item => {
    return {
      UniqID: item.UniqID,
      A_power: item.A_power,
      shdh: item.Gy0_shdh,
      machine: item.Gy0_sbbh,
      time: item.Gy0_辅助工时,
    };
  });
  const editGy_edit = await editGy(formattedData);
  if (editGy_edit.code === 0) {
    ElMessage({type: 'success',message: '更新成功'})
  } else {
    ElMessage({type: 'error',message: '更新失败'})
  }
  pccstzlist.value = false;
};
//排产参数调整 放弃
const pccstzCancel = () => {pccstzlist.value = false;};

// =========== 核算参数调整 ===========
const hscstzlist = ref(false);
const hscstztableData = ref([]);
const hscstzformData = reactive({cpdh: '',});
//点击【核算参数调整】按钮
const hscstzClick = () => {
  if(_product_code.value == null){
    hscstzlist.value = false;
    ElMessage({type: 'warning',message: '请选择分类项目，再操作此功能'})
  }else{
    hscstzformData['cpdh'] = _product_code.value;
    _hscstzgetProductGy();
    hscstzlist.value = true;
  }
}
//排产参数调整 回车
const hscstzProductValue = async () => {
  _product_code.value = '';
  _hscstzgetProductGy();
};
//核算参数调整 获取单个工艺数据（排产参数调整）
const _hscstzgetProductGy = async ()=>{
  let product_code = _product_code.value || hscstzformData['cpdh'];
  try {
    const hscstz_getProductGy = await getProductGy({product_code:product_code});
    hscstztableData.value = hscstz_getProductGy.data;
    const formattedData = hscstz_getProductGy.data.map(item=>{
      //原难度系数
      item.hscstzold_difficulty_coe = item.difficulty_coe;
      //原损耗系数
      item.hscstzold_loss_coe = item.loss_coe;
      //原计损色数
      item.hscstzold_ms_coe = item.ms_coe;
      return item
    });
  } catch (error) {
    console.error(error);
  }
}
//核算参数调整 【执行按钮】
const hscstzConfirm = async () => {
  const rawValueArray = hscstztableData._rawValue;
  const formattedData = rawValueArray.map(item => {
    return {
      UniqID: item.UniqID,
      difficulty_coe: item.difficulty_coe,
      loss_coe: item.loss_coe,
      ms_coe: item.ms_coe,
    };
  });
  const hscstz_edit = await editGy(formattedData);
  if (hscstz_edit.code === 0) {
    ElMessage({type: 'success',message: '更新成功'})
  } else {
    ElMessage({type: 'error',message: '更新失败'})
  }
  hscstzlist.value = false;
};
//核算参数调整 放弃
const hscstzCancel = () => {hscstzlist.value = false;};


// =========== 左侧树侧形结构 ===========
const treeData = ref({})
const getCustomdata = async () => {
  try {
    const data  = await getCustom()
    treeData.value = data.data;
  } catch (error) {
    console.error('Error fetching custom data:', error);
  }
}
getCustomdata()

//点击左侧树形获取列表
const tableData = reactive([])
const _custom_code = ref(null)
const handleNodeClick = async (node) => {
  _custom_code.value = node.客户编号;
  //清空搜索框
  searchInfo.value = '';
  _getProduct()
};
//印件资料
const yjtableData = reactive([])
//工艺资料
const gytableData = reactive([])
//印版资料
const ybtableData = reactive([])
//技术资料附件【暂时为空】
const jstableData = reactive([])
//全局调用产品编号
const _product_code = ref(null)
//全局调用产品名称
const _kehu_code = ref(null)
//点击表格行 下方表格获取数据
const tableRowClick = async (row) => {
  _product_code.value = row.产品编号;
  _kehu_code.value = row.产品名称;
  const res = await getProductData({product_code:_product_code.value});
  yjtableData.splice(0, yjtableData.length, ...res.data.yjData);
  gytableData.splice(0, gytableData.length, ...res.data.gyData);
  ybtableData.splice(0, ybtableData.length, ...res.data.ybData);
};

//搜索查询
const searchInfo = ref('')
//点击【查询】按钮
const onSubmit = () => {
  _custom_code.value = '';
  _getProduct();
};

//封装获取单个产品基础数据方法
const _getProduct = async ()=>{
  let params = {}
  params.search = searchInfo.value;
  params.custom_code = _custom_code.value;
  params.limit = pageSize.value;
  params.page = page.value;
  try {
    const WorkListdata = await getProduct(params);
    console.log(WorkListdata.data.data)
    if(WorkListdata.data.data === []){
      ElMessage({type: 'warning',message: '未查询到搜索条件'})
    }else{
      tableData.splice(0, tableData.length, ...WorkListdata.data.data);//表格
      console.log(WorkListdata)
      total.value = WorkListdata.data.total;//共多少条
    }
  } catch (error) {
    console.error(error);
  }
}

// 分页
const page = ref(1)
const total = ref(0)
const pageSize = ref(50)
const handleCurrentChange = (val) => {
  page.value = val;
  _WorkList_page();
};

// 修改页面容量 点击多少条/页
const handleSizeChange = (val) => {
  page.value = 1;
  pageSize.value = val;
  _WorkList_page();
};

//=========修改产品基本资料产品表格弹窗========
let formDataTest = reactive({})
//弹窗
const dialogFormVisible = ref(false)
//双击修改弹窗
const dbclickId = ref()
const updateCompanyFunc = async (row, cols) => {
  dbclickId.value = row.UniqID
  formDataTest = Object.assign(formDataTest,row);
  dialogFormVisible.value = true;
};
//关闭修改弹窗
const closeDialog = () => {
  dialogFormVisible.value = false
}
//点击确定修改表格
const enterDialog = async () => {
  const formattedData = {
    '客户编号': formDataTest['客户编号'],
    '客户名称': formDataTest['客户名称'],
    '印品代号': formDataTest['产品编号'],
    '版本号': formDataTest['版本号'],
    '客户料号': formDataTest['客户料号'],
    '产品名称': formDataTest['产品名称'],
    '产品类别': formDataTest['产品类别'],
    '计量单位': formDataTest['计量单位'],
    '成品规格': formDataTest['成品规格'],
    '产品备注': formDataTest['产品备注'],
  };
  const editProductedit = await editProduct(formattedData);
  if (editProductedit.code === 0) {
    const row = tableData.find(item => item.UniqID === dbclickId.value)
    Object.keys(formDataTest).map( key => {
      row[key] = formDataTest[key]
    })
    ElMessage({type: 'success',message: '更新成功'})
  } else {
    ElMessage({ type: 'error',message: '更新失败'})
  }
  dialogFormVisible.value = false;
}

//=========修改印件资料========
let yjformDataTest = reactive({})
//双击修改
const yjupdateCompanyFunc = async (row) => {
  Object.assign(yjformDataTest,row);
  // yjformDataTest = row;
  yjdialogFormVisible.value = true;
};
// 弹窗
const yjdialogFormVisible = ref(false)
//关闭修改弹窗
const yjcloseDialog = () => {
  yjdialogFormVisible.value = false
}
//点击确定修改表格
const yjenterDialog = async () => {
  console.log(yjformDataTest)
  const formattedData = {
    '印件号': yjformDataTest['yj_yjno'],
    '印件代号': yjformDataTest['yj_yjdh'],
    '印件名称': yjformDataTest['yj_yjmc'],
    '纸张单号': yjformDataTest['yj_zzdh'],
    '纸张名称': yjformDataTest['yj_zzmc'],
    '投料': yjformDataTest['yj_tlgg'],
    '开料': yjformDataTest['yj_klgg'],
    '开数': yjformDataTest['yj_ks'],
    '联数': yjformDataTest['yj_ls'],
    '备注说明': yjformDataTest['yj_desc'],
  };
  console.log(formattedData)
  // const editdata = await 修改印件接口函数(formattedData);
  // if (editdata.code === 0) {
  //   ElMessage({type: 'success',message: '更新成功'})
  // } else {
  //   ElMessage({ type: 'error',message: '更新失败'})
  // }
  // yjdialogFormVisible.value = false;
}

//=========新增印件资料========
//默认弹窗关闭
const add_yjdialogFormVisible = ref(false)
//新增弹窗
const addcpyj_onclick = () => {
  add_yjdialogFormVisible.value = true
}
//印件新增确定
const add_yjcloseDialog = () => {
  add_yjdialogFormVisible.value = true
}
//印件新增取消
const add_yjenterDialog = () => {
  add_yjdialogFormVisible.value = true
}




//=========修改工艺资料========
let gyformDataTest = reactive({})
//双击修改
const gyupdateCompanyFunc = async (row) => {
  Object.assign(gyformDataTest,row);
  // gyformDataTest = row;
  gydialogFormVisible.value = true;
};
//弹窗
const gydialogFormVisible = ref(false)
//打开修改弹窗
const gyenterDialog = () => {
  console.log(gyformDataTest)
  const formattedData = {
    '工序方案': gyformDataTest['方案'],
    '印件编号': gyformDataTest['Gy0_yjno'],
    '工序编号': gyformDataTest['Gy0_gxh'],
    '加工开数': gyformDataTest['Gy0_Ks'],
    '加工联数': gyformDataTest['Gy0_ls'],
    '车间名称': gyformDataTest['gy0_site'],
    '工艺名称': gyformDataTest['gy0_gxmc'],
    '工序名称': gyformDataTest['add_gxmc'],
    '可用设备': gyformDataTest['Gy0_sbbh'],
    '标准损耗': gyformDataTest['Gy0_shdh'],
    '基础损耗': gyformDataTest['基础损耗'],
    '损耗率': gyformDataTest['损耗率'],
    '工价系数': gyformDataTest['工价系数'],
    '损耗系数': gyformDataTest['损耗系数'],
    '工序备注': gyformDataTest['备注'],
  };
  console.log(formattedData)
  // const editdata = await 修改工艺接口函数(formattedData);
  // if (editdata.code === 0) {
  //   ElMessage({type: 'success',message: '更新成功'})
  // } else {
  //   ElMessage({ type: 'error',message: '更新失败'})
  // }
  // gydialogFormVisible.value = true
}
//关闭修改弹窗
const gycloseDialog = () => {
  gydialogFormVisible.value = false
}

//=========印版修改========
let ybformDataTest = reactive({})
//双击修改
const ybupdateCompanyFunc = async (row) => {
  Object.assign(ybformDataTest,row);
  // ybformDataTest = row;
  ybdialogFormVisible.value = true;
};
// 弹窗
const ybdialogFormVisible = ref(false)
// 打开修改弹窗
const ybenterDialog = () => {
  console.log(ybformDataTest)
  const formattedData = {
    '工序方案': ybformDataTest['YB_方案'],
    '印件号': ybformDataTest['YB_Yjno'],
    '存货编码': ybformDataTest['存货编码'],
    '印版名称': ybformDataTest['印版名称'],
  };
  console.log(formattedData)
  // const editdata = await 修改印版接口函数(formattedData);
  // if (editdata.code === 0) {
  //   ElMessage({type: 'success',message: '更新成功'})
  // } else {
  //   ElMessage({ type: 'error',message: '更新失败'})
  // }
  // ybdialogFormVisible.value = true
}
// 关闭弹窗
const ybcloseDialog = () => {
  ybdialogFormVisible.value = false
}

//===========改变按钮中表格修改背景颜色=========
//计损色数修正表格修改颜色  :cell-style="setInputCellStyle"
const setInputCellStyle = (data) => {
  const jiSun = ['ms_coe', 'Gy0_Ks', 'Gy0_ls', 'Add_gxmc', 'remark']
  let style = { padding: 0 }
  if (data.column?.property && jiSun.includes(data.column?.property)) {
    Object.assign(style, { backgroundColor: '#42b983'})
  }
  return style
}

//键盘 input框跳转
const ent = (event,id1,id2,id3) => {

  if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
    if(id3!=''){
      document.getElementById(id3).focus()
    }
  } else if (event.keyCode === 38) { // 向上箭头
    if(id1!=''){
      document.getElementById(id1).focus()
    }
  }else if (event.keyCode === 8) { // 删除箭头
    if(id1!='' && document.getElementById(id2).value==''){
      document.getElementById(id1).focus()
    }
    console.log(document.getElementById(id2).value)
  }else if (event.keyCode === 37) { // 向左箭头
    if(id1!='' && document.getElementById(id2).selectionStart==0){
      document.getElementById(id1).focus()
    }
  }else if (event.keyCode === 39) { // 向右箭头
    if(id3!='' && document.getElementById(id2).selectionStart == document.getElementById(id2).value.length){
      document.getElementById(id3).focus()
    }
  }
}


//表格文字变色
const tableDataCellClass = ({row, column, rowIndex, columnIndex}) =>{
  if (column.property === 'gyData' || column.property === 'yjData') {
    return 'plan-usage-low';
  }
}
</script>
<style scoped>
:deep(.plan-usage-low div) {
  color: red !important;
}
.JKWTree-container {
  display: flex;
}
.JKWTree-tree {
  width: 300px;
  background-color: #fff;
  /*background-color: rgba(241, 224, 224, 0.99);*/
  padding: 10px;
  margin-right: 20px;
}
.JKWTree-tree h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 10px 0;
}
.JKWTree-content {
  flex: 1;
}
:deep(.el-table__body .warning-row) {
  background: #FFFF80 !important;
}
/* 选中某行时的背景色 */
:deep(.el-table__body tr.current-row) > td {
  background: #ff80ff !important;
}


</style>
<style scoped>
:deep(.el-table td .cell) {
  line-height: 20px !important;
}
:deep(.el-tabs__header){
  margin-bottom: 0;
}
.search{
  margin-left: 0px !important;
  margin-right: 10px !important;
}
.bt{
  margin-left: 2px !important;
  padding: 3px !important;
  font-size: 12px;
}
.el-tabs__header{
  margin: 0px !important;
}
.gva-table-box{
  padding: 0px !important;
}
.mab{
  margin-bottom: 5px;
}
</style>
