<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="搜索产品编号或产品名称"  style="width: 180px;"></el-input>
              <el-button type="primary" icon="search" @click="onSubmit" class="search"></el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="onStatusClick">状态设置</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="jsfjClick">技术附件</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="cpgyfzclick">产品工艺复制</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="gygmClick" >工艺方案更名</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="fjClick" >工艺方案附加</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="jsssxzClick" >计损色数修正</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="fjfpxsClick" >质检废品系数</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="pccstzClick" >排产参数调整</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="hscstzClick" >核算参数调整</el-button>
			  <el-button type="primary" class="bt" icon="edit"  @click="addcp_onclick" >新增产品资料</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="addcpyj_onclick" v-if="addyj=== true">新增印件资料</el-button>
              <el-button type="primary" class="bt" icon="edit"  @click="addcpgy_onclick" v-if="addgy=== true">新增工艺资料</el-button>
<!--              <el-button type="primary" class="bt" icon="edit"  @click="addyb_onclick" v-if="addyb=== true">新增印版资料</el-button>-->
			  <el-button type="primary" icon="edit"   @click="delgd_delclick" v-if="delall=== true" :disabled="yjSelection === '' && gySelection === ''"  class="bt" title="选择批量删除（印件资料或工艺资料）"  >删除</el-button>

<!--              <el-button type="primary" class="bt" icon="Download" @click="cpexportToExcel" disabled>导出产品资料</el-button>-->
<!--              <el-button type="primary" class="bt" icon="Download" @click="gyexportToExcel" disabled>导出工艺流程</el-button>-->
            </el-form-item>
          </el-form>

          <!--按钮弹窗部分-->
          <!--mes同步-->
          <el-dialog v-model="messtatuslist" title="mes同步" style="width: 300px; top: 20%">
            <div>
              <el-form-item label="工单编号:" prop="process" class="mab">
                <el-input  v-model="mesformDataTest['gdbh']" id="process"  style="width: 160px;"/>
              </el-form-item>
            </div>
            <br>
            <div slot="footer" class="dialog-footer" style="text-align: right;">
              <el-button @click="meshandleCancel">取消</el-button>
              <el-button type="primary" @click="meshandleConfirm">确定</el-button>
            </div>
          </el-dialog>

          <!--状态设置-->
          <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="cpgyfzlist" title="产品工艺复制"  style="width: 35%;top: 15%;">
              <el-form-item label="参照产品代号:" prop="process" class="mab">
                <el-input disabled v-model="cpgyfzformData['process']" id="process" @keydown="add_cpgyfzent($event, 'fzybzl', 'process', 'processName')"   style="width: 160px;"/>
                <el-input disabled v-model="cpgyfzformData['processName']" id="processName" @keydown="add_cpgyfzent($event, 'process', 'processName', 'gongyifa')"  style="width: 360px;"/>
              </el-form-item>

            <el-form-item label="参照工艺方案:" prop="originalName" class="mab">
              <el-select v-model="cpgyfzformData.gongyifa" placeholder="请选择" id="gongyifa" @keydown="add_cpgyfzent($event, 'processName', 'gongyifa', 'mubprocess')" style="width: 160px;">
                <el-option v-for="option in cpgyfzformData.gongyifaNameOptions" :key="option" :label="option" style="width: 160px;" :value="option" />
              </el-select>
            </el-form-item>

            <el-form-item label="目标产品代号:" prop="process" class="mab">
              <el-input v-model="cpgyfzformData['mubprocess']" id="mubprocess" @keydown="add_cpgyfzent($event, 'gongyifa', 'mubprocess', 'mubprocessName')"   style="width: 160px;"/>
              <el-input disabled v-model="cpgyfzformData['mubprocessName']" id="mubprocessName" @keydown="add_cpgyfzent($event, 'mubprocess', 'mubprocessName', 'fzgyzl')"  style="width: 360px;"/>
            </el-form-item>
<!--            cpgyfzformData.fzgyzl === true-->
            <el-form-item label="" class="mab" >
              <el-checkbox  v-model="cpgyfzformData['fzgyzl']" id="fzgyzl" @keydown="add_cpgyfzent($event, 'mubprocessName', 'fzgyzl', 'fzybzl')"  >复制工艺资料</el-checkbox>
              <el-input v-model="cpgyfzformData['to_pro']" id="to_pro" v-if="cpgyfzformData['fzgyzl'] !== false" placeholder="目标工艺方案" style="width: 160px;margin-left: 20px"/>
            </el-form-item>
            <el-form-item label="" class="mab" >
              <el-checkbox  v-model="cpgyfzformData['fzybzl']"  id="fzybzl" @keydown="add_cpgyfzent($event, 'fzgyzl', 'fzybzl', 'process')" >复制印版资料</el-checkbox>
            </el-form-item>
              <div class="dialog-footer" style="text-align: right ">
                <el-button @click="cpgyfzhandleCancel">取消</el-button>
                <el-button type="primary" @click="cpgyfzhandleConfirm">确定</el-button>
              </div>
          </el-dialog>

          <!-- 产品工艺复制 目标产品代号弹窗-->
          <el-dialog v-model="cpgyfzdisplay" :before-close="() => cpgyfzdisplay = false">
            <el-form>
              <div>
                <el-form-item label="关键字:"  class="mab" prop="keyOrder">
                  <el-space>
                    <el-input v-model="cpgyfz_keyword" @keyup.enter="cpgyfz_ProductValue" style="width: 100%;"/>
                    <el-button @click="cpgyfzSearchHandle(cpgyfz_keyword, '产品代号')">刷新</el-button>
                  </el-space>
                </el-form-item>
                <div style="border:1px solid #eee; width:100%; height: 400px; overflow-y: auto">
                  <el-tree :data="cpgyfzLists" :props="{children: 'children',label: 'name', value: '产品编号'}" @node-click="cpgyfzselectGongDanNode($event, '产品代号')" />
                </div>
              </div>
            </el-form>
          </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   style="width: 160px;"/>
              </el-form-item>
              <br>
              <el-form-item label="产品名称" prop="processName" class="mab">
                <el-input v-model="gyformData['processName']" disabled   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']"   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   style="width: 160px;"/>
                  <el-input v-model="fjformData['processName']" disabled   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']"
                              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
                             @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>
          </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>-->
              <el-tree :data="treeData" class="treecolor" node-key="label" @node-click="handleNodeClick">
                <template #default="{  node, data  }">
                  <div :style="{ color: node.label === selectedLabel ? 'red' : '' }">
                    {{ node.label }}
                  </div>
                </template>
              </el-tree>
<!--              <el-tree :data="treeData"  class="treecolor" node-key="label"  @node-click="handleNodeClick" @node-expand="handleNodeExpand">-->
<!--                <template #default="{ node, data }">-->
<!--                  {{ node.label }}-->
<!--                </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  sortable align="left" label="产品编号" prop="产品编号" width="115" />
              <el-table-column  sortable align="left" label="产品名称" prop="产品名称" width="340" />
              <el-table-column  sortable align="left" label="版本号" prop="版本号" width="100"/>
              <el-table-column  sortable align="left" label="成品规格" prop="成品规格" width="100" />
              <el-table-column  sortable align="left" label="单位" prop="计量单位" width="100"/>
              <el-table-column  sortable align="left" label="产品分类" prop="产品类别" width="100" />
              <el-table-column  sortable align="left" label="最近接单时间" prop="receiveDate" width="160" />
              <el-table-column  sortable align="left" label="印件数" prop="yjData" width="100" />
              <el-table-column  sortable align="left" label="工艺" prop="gyData" width="100"/>
              <el-table-column  sortable align="left" label="当前状态" prop="状态"  width="100"/>
              <el-table-column  sortable align="left" label="最后修改" prop="Sys_id" width="160" />
              <el-table-column  sortable 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]"-->
<!--                  :page-size="pageSize"-->
<!--                  layout="total, sizes, prev, pager, next, jumper"-->
<!--                  :total="total">-->
<!--              </el-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="selectionChange($event, '印件资料')">
                <el-table-column  type="selection" width="30" />
                <el-table-column  align="left" sortable label="印件号" prop="yj_yjno"  width="100"/>
                <el-table-column  align="left" sortable label="印件代号" prop="yj_yjdh" width="110" />
                <el-table-column  align="left" sortable label="印件名称" prop="yj_yjmc" width="540" />
                <el-table-column  align="left" sortable label="纸张单号" prop="yj_zzdh" width="110"/>
                <el-table-column  align="left" sortable label="纸张名称" prop="yj_zzmc" width="340"/>
                <el-table-column  align="left" sortable label="投料规格" prop="yj_tlgg" width="240"/>
                <el-table-column  align="left" sortable label="开料规格" prop="yj_klgg" width="110"/>
                <el-table-column  align="left" sortable label="开数" prop="yj_ks" width="100" />
                <el-table-column  align="left" sortable label="联数" prop="yj_ls" width="100" />
                <el-table-column  align="left" sortable label="备注" prop="yj_desc" width="200" />
                <el-table-column  align="left" sortable label="建档用户" prop="sys_id" width="130" />
                <el-table-column  align="left" sortable label="建档日期" prop="sys_rq" width="160" />
                <el-table-column  align="left" sortable 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="selectionChange($event, '工艺资料')"
                        @row-click="clickybupdate">
                <el-table-column type="selection" width="30" />
                <el-table-column align="left" sortable   label="方案" prop="方案"  width="110"/>
                <el-table-column align="left" sortable   label="印件-工序" prop="combinedProp" width="110" />
                <!-- <el-table-column align="left" sortable   label="工序" prop="Gy0_gxh" width="110" /> -->
                <el-table-column align="left" sortable   label="工序名称" prop="combinedProp2" width="120" />
                <!-- <el-table-column align="left" sortable   label="工序名称" prop="add_gxmc" width="340" /> -->
                <el-table-column align="left" sortable   label="开数*联数" prop="combinedProp3" width="130" />
                <!-- <el-table-column align="left" sortable   label="联数" prop="Gy0_ls" width="110" /> -->
                <el-table-column align="left" sortable   label="备注" prop="备注" width="150" />
                <el-table-column align="left" sortable   label="难度系数" prop="工价系数" width="110" />
                <el-table-column align="left" sortable   label="损耗系数" prop="损耗系数" width="110" />
				<el-table-column align="left" sortable   label="基础损耗" prop="基础损耗" width="110" />
				<el-table-column align="left" sortable   label="损耗率" prop="损耗率" width="110" />
                <el-table-column align="left" sortable   label="计损色数" prop="Gy0_Ms" width="110" />
                <el-table-column align="left" sortable   label="人工检_正品板" prop="人工检_正品板" width="150" />
                <el-table-column align="left" sortable   label="人工检_次品板" prop="人工检_次品板" width="150" />
                <el-table-column align="left" sortable   label="人工检_废检" prop="人工检_废检" width="140"/>
                <el-table-column align="left" sortable   label="机检_正品版" prop="机检_正品板" width="140"/>
                <el-table-column align="left" sortable   label="机检_次品检" prop="机检_次品板" width="140"/>
                <el-table-column align="left" sortable   label="机检_废检" prop="机检_废检" width="140"/>
                <el-table-column align="left" sortable   label="设备编号" prop="Gy0_sbmc" width="110"/>
                <el-table-column align="left" sortable   label="最后修改" prop="Sys_id" width="160"/>
                <el-table-column align="left" sortable   label="建档日期" prop="Sys_rq" width="160"/>
                <el-table-column align="left" sortable   label="更新日期" prop="Mod_rq" 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"
						@row-click="ybClick"
                        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" sortable  label="方案" prop="YB_方案"  width="100"/>
                <el-table-column align="left" sortable  label="印件号" prop="YB_Yjno" width="100" />
                <el-table-column align="left" sortable  label="印版类别" prop="印版类别" width="110" />
                <el-table-column align="left" sortable  label="存货编码" prop="存货编码" width="110"/>
                <el-table-column align="left" sortable  label="印版名称" prop="印版名称"  width="440"/>
                <el-table-column align="left" sortable  label="考核印数" prop="考核印数" width="110"/>
                <el-table-column align="left" sortable  label="建档用户" prop="Sys_id" width="120" />
                <el-table-column align="left" sortable  label="建档日期" prop="建档日期" width="160" />
                <el-table-column align="left" sortable  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"
						@row-dblclick="ExcelShow"
						@selection-change="handleSelectionChange">
                <!--              <el-table-column type="selection" width="55" />-->
                <el-table-column align="left" sortable   label="序号" prop="序号"  width="120"/>
                <el-table-column align="left" sortable  label="适用工序" prop="适用工序" width="120" />
                <el-table-column align="left" sortable  label="备注" prop="附件备注" width="120" />
                <el-table-column align="left" sortable  label="文件类型" prop="附件类型" width="120"/>
                <el-table-column align="left" sortable  label="关联产品" prop="关联产品"  width="360"/>
                <el-table-column align="left" sortable  label="建档用户" prop="sys_id" width="120"/>
                <el-table-column align="left" sortable  label="建档日期" prop="sys_rq" width="160" />
                <el-table-column align="left" sortable  label="更新日期" prop="mod_rq" width="160" />
				<el-table-column fixed="right" label="操作" width="100">
				    <template v-slot="{ row }">
				      <button @click="jsfj_del(row)">删除</button>
				    </template>
				  </el-table-column>
              </el-table>
            </el-tab-pane>
          </el-tabs>


		  <el-dialog
		    v-model="huanxingVisible"
		    title="选择客户代号"
		    destroy-on-close
		    width="80vh"
		    style="height: 50vh;"
		    :before-close="closehuanxingVisible"
		  >
		    <div style="display: flex;">
		      <div style="flex: 0.1;">
		        <el-aside width="70vh" style="margin: 0;">
		          <div class="JKWTree-tree" style="width:70vh;height: 35vh; border-right: 1px solid #ebeef5;">
		            <el-tree :data="treeData" node-key="label" @node-click="treeDataClick" @node-expand="handleNodeExpand">
		              <template #default="{ node, data }">
		                {{ node.label }}
		              </template>
		            </el-tree>
		          </div>
		        </el-aside>
		      </div>
		    </div>
		  </el-dialog>

          <!-- 修改产品产品基本资料表格弹窗 -->
          <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type === 'create' ? '新增产品资料' : '修改产品资料'" 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['客户编号']"  id="id1"   @blur="getCustominfo()"  @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['客户名称']"  id="id2"  @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['产品编号']"  id="id3"  @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['版本号']"   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['客户料号']"    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['产品名称']"   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['产品类别']"   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['计量单位']"   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['成品规格']"   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="3"  resize="none"  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="'修改印件资料'" style="margin-top: 40px"  height="500px" width="800px" 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="105px">
                      <el-input v-model="yjformDataTest['yj_yjno']"   style="width: 140px;"  id="印件号"  @keydown="yj_ent($event, '', '印件号', '印件代号')" />
                    </el-form-item>
                  </el-row>
                  <el-row>
                    <el-form-item label="印件代号:" prop="address" class="mab" label-width="105px">
                      <el-input v-model="yjformDataTest['yj_yjdh']"   style="width: 140px;"  id="印件代号"   @keydown="add_yinjian_ent($event, 'yj_desc', '印件号', '印件代号')" />
                    </el-form-item>
                  </el-row>
                  <el-row>
                    <el-col :span="22">
                      <el-form-item label="印件名称:" prop="address" class="mab" label-width="105px">
                        <el-input v-model="yjformDataTest['yj_yjmc']" disabled  id="印件名称"  @keydown="yj_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="105px">
                        <el-row>
                          <el-input v-model="yjformDataTest['yj_zzdh']"   style="width: 140px;"  id="zzdh"  @keydown="add_gdzlyjent($event, '印件名称', 'zzdh', 'zzmc',0)" />
                          <el-input v-model="yjformDataTest['yj_zzmc']"    style="width: 460px;" id="zzmc"  @keydown="add_gdzlyjent($event, 'zzdh', 'zzmc', 'zzdh1')"  />
                        </el-row>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="备用纸张1:" prop="address" class="mab"  label-width="105px">
                        <el-row>
                          <el-input v-model="yjformDataTest['yj_zzdh1']"   style="width: 140px;"  id="zzdh1" @keydown="add_gdzlyjent($event, 'zzmc', 'zzdh1', 'zzmc1',1)" />
                          <el-input v-model="yjformDataTest['yj_zzmc1']"    style="width: 460px;"  id="zzmc1"  @keydown="add_gdzlyjent($event, 'zzdh1', 'zzmc1', 'zzdh2')"   />
                        </el-row>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="备用纸张2:" prop="address" class="mab"  label-width="105px">
                        <el-row>
                          <el-input v-model="yjformDataTest['yj_zzdh2']"   style="width: 140px;"  id="zzdh2"  @keydown="add_gdzlyjent($event, 'zzmc1', 'zzdh2', 'zzmc2',2)" />
                          <el-input v-model="yjformDataTest['yj_zzmc2']"    style="width: 460px;" id="zzmc2"  @keydown="add_gdzlyjent($event, 'zzdh2', 'zzmc2', 'zzdh3')"  />
                        </el-row>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="备用纸张3:" prop="address" class="mab"  label-width="105px">
                        <el-row>
                          <el-input v-model="yjformDataTest['yj_zzdh3']"   style="width: 140px;"  id="zzdh3"  @keydown="add_gdzlyjent($event, 'zzmc2', 'zzdh3', 'zzmc3',3)"  />
                          <el-input v-model="yjformDataTest['yj_zzmc3']"    style="width: 460px;" id="zzmc3"  @keydown="add_gdzlyjent($event, 'zzdh3', 'zzmc3', 'zzdh4')"  />
                        </el-row>
                      </el-form-item>
                    </el-col>
                    <el-col :span="24">
                      <el-form-item label="备用纸张4:" prop="address" class="mab"  label-width="105px">
                        <el-row>
                          <el-input v-model="yjformDataTest['yj_zzdh4']"   style="width: 140px;"  id="zzdh4" @keydown="add_gdzlyjent($event, 'zzmc3', 'zzdh4', 'zzmc4',4)" />
                          <el-input v-model="yjformDataTest['yj_zzmc4']"    style="width: 460px;" id="zzmc4"  @keydown="add_gdzlyjent($event, 'zzdh4', 'zzmc4', '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']"    style="width: 140px;"  id="yj_tlgg"  @keydown="yj_ent($event, 'yj_zzmc4', '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']"   style="width: 140px;"  id="yj_klgg"  @keydown="yj_ent($event, 'yj_tlgg', 'yj_klgg', 'yj_ks')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>
                  <el-row>
                    <el-col :span="6">
                      <el-form-item label="开数:" prop="address" class="mab"  label-width="105px">
                        <el-input v-model="yjformDataTest['yj_ks']"   style="width: 100px;" id="yj_ks"  @keydown="yj_ent($event, 'yj_tlgg', 'yj_ks', 'yj_ls')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="联数:" prop="address" class="mab"  >
                        <el-input v-model="yjformDataTest['yj_ls']"    style="width: 100px;" id="yj_ls"  @keydown="yj_ent($event, 'yj_ks', 'yj_ls', '换算系数')"/>
                      </el-form-item>
                    </el-col>
                    <el-col :span="10">
                      <el-form-item label="换算系数（公斤到万张）:" prop="address" class="mab">
                        <el-input v-model="yjformDataTest['KgToPages']"    style="width: 170px;" id="换算系数"  @keydown="yj_ent($event, '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" label-width="105px">
                        <el-input type="textarea" v-model="yjformDataTest['yj_desc']" rows="3"   resize="none" id="yj_desc"  @keydown="yj_ent($event, '换算系数', '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"  @click="yjenterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>

          <!-- 新增印件资料 -->
          <el-dialog v-model="add_gdyjdialogFormVisible" :before-close="add_gdyjcloseDialog" :title="'新增印件资料'" style="margin-top: 40px" height="500px" width="800px" destroy-on-close>
                      <el-row>
                        <el-scrollbar >
                          <el-form :model="add_yjzlformdata" label-position="right" ref="elFormRef" :rules="rule">
                            <el-row>
                              <el-form-item label="印件号:" prop="address" class="mab" label-width="100px">
                                <el-input v-model="add_yjzlformdata.yjno"  style="width: 140px;"  id="印件号"  @keydown="add_yinjian_ent($event, 'yj_desc', '印件号', '印件代号')" />
                              </el-form-item>
                            </el-row>
                            <el-row>
                              <el-form-item label="印件代号:" prop="address" class="mab" label-width="100px">
                                <el-input v-model="add_yjzlformdata.yjdh"  style="width: 140px;"  id="印件代号" @keydown="add_yinjian_ent($event, '印件号', '印件代号', 'yj_zzdh')"  />
                              </el-form-item>
                            </el-row>
                            <el-row>
                              <el-col :span="22">
                                <el-form-item label="印件名称:" prop="address" class="mab" label-width="100px">
                                  <el-input disabled v-model="add_yjzlformdata.yjmc"  style="width: 100%;" id="印件名称"/>
                                </el-form-item>
                              </el-col>
                            </el-row>
                            <el-row>
                              <el-col :span="24">
                                <el-form-item label="纸张:" prop="address" class="mab" label-width="100px">
                                  <el-row>
                                   <el-input v-model="add_yjzlformdata.zzdh"  class="zhi" id="zzdh" @keydown="add_gdzlyjent($event, '印件名称', 'zzdh', 'zzmc',0)"   style="width: 140px;"/>
                                   <el-input v-model="add_yjzlformdata.zzmc"  id="zzmc" @keydown="add_gdzlyjent($event, 'zzdh', 'zzmc', 'zzdh1')" style="width: 460px;"/>
                                  </el-row>
                                </el-form-item>
                              </el-col>
                              <el-col :span="24">
                                <el-form-item label="备用纸张1:" prop="address" class="mab" label-width="100px">
                                  <el-row>
                                    <el-input v-model="add_yjzlformdata.zzdh1"   style="width: 140px;"  id="zzdh1" @keydown="add_gdzlyjent($event, 'zzmc', 'zzdh1', 'zzmc1',1)"  />
                                    <el-input v-model="add_yjzlformdata.zzmc1"   style="width: 460px;" id="zzmc1"  @keydown="add_gdzlyjent($event, 'zzdh1', 'zzmc1', 'zzdh2')" />
                                  </el-row>
                                </el-form-item>
                              </el-col>
                              <el-col :span="24">
                                <el-form-item label="备用纸张2:" prop="address" class="mab" label-width="100px">
                                  <el-row>
                                    <el-input v-model="add_yjzlformdata.zzdh2"  style="width: 140px;"  id="zzdh2"  @keydown="add_gdzlyjent($event, 'zzmc1', 'zzdh2', 'zzmc2',2)" />
                                    <el-input v-model="add_yjzlformdata.zzmc2"   style="width: 460px;" id="zzmc2"  @keydown="add_gdzlyjent($event, 'zzdh2', 'zzmc2', 'zzdh3')"  />
                                  </el-row>
                                </el-form-item>
                              </el-col>
                              <el-col :span="24">
                                <el-form-item label="备用纸张3:" prop="address" class="mab" label-width="100px">
                                  <el-row>
                                    <el-input  v-model="add_yjzlformdata.zzdh3"  style="width: 140px;"  id="zzdh3"  @keydown="add_gdzlyjent($event, 'zzmc2', 'zzdh3', 'zzmc3',3)"  />
                                    <el-input v-model="add_yjzlformdata.zzmc3"   style="width: 460px;" id="zzmc3"  @keydown="add_gdzlyjent($event, 'zzdh3', 'zzmc3', 'zzdh4')"  />
                                  </el-row>
                                </el-form-item>
                              </el-col>
                              <el-col :span="24">
                                <el-form-item label="备用纸张4:" prop="address" class="mab" label-width="100px">
                                  <el-row>
                                    <el-input v-model="add_yjzlformdata.zzdh4"   style="width: 140px;"  id="zzdh4" @keydown="add_gdzlyjent($event, 'zzmc3', 'zzdh4', 'zzmc4',4)" />
                                    <el-input v-model="add_yjzlformdata.zzmc4"   style="width: 460px;" id="zzmc4"  @keydown="add_gdzlyjent($event, 'zzdh4', 'zzmc4', 'yj_tlgg')"  />
                                  </el-row>
                                </el-form-item>
                              </el-col>

                            </el-row>
                            <el-row>
                              <el-col :span="8">
                                <el-form-item label="投料(mm*mm):" prop="address" class="mab">
                                  <el-input v-model="add_yjzlformdata.tl"   style="width: 140px;"  id="yj_tlgg"  @keydown="ent($event, 'yj_zzmc4', 'yj_tlgg', 'yj_klgg')"/>
                                </el-form-item>
                              </el-col>
                              <el-col :span="8">
                                <el-form-item label="开料(mm*mm):" prop="address" class="mab">
                                  <el-input v-model="add_yjzlformdata.kl"  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="6">
                                <el-form-item label="开数:" prop="address" class="mab" label-width="100px">
                                  <el-input v-model="add_yjzlformdata.ks"  style="width: 140px;" id="yj_ks"  @keydown="ent($event, 'yj_tlgg', 'yj_ks', 'yj_ls')"/>
                                </el-form-item>
                              </el-col>
                              <el-col :span="6">
                                <el-form-item label="联数:" prop="address" class="mab">
                                  <el-input v-model="add_yjzlformdata.ls"   style="width: 140px;" id="yj_ls"  @keydown="ent($event, 'yj_ks', 'yj_ls', 'KgToPages')"/>
                                </el-form-item>
                              </el-col>
                              <el-col :span="10">
                                <el-form-item label="换算系数(公斤到万张):" prop="address" class="mab">
                                  <el-input v-model="add_yjzlformdata.KgToPages"   style="width: 140px;" id="KgToPages"  @keydown="ent($event, 'yj_ls', 'KgToPages', '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 v-model="add_yjzlformdata['备注说明']" type="textarea" rows="3" resize="none" clearable placeholder="请输入备注说明"  id="yj_desc"  @keydown="ent($event, 'KgToPages', '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_dyjcloseDialog">取 消</el-button>
                          <el-button type="primary"  @click="add_gdyjenterDialog">确 定</el-button>
                        </div>
                      </template>
                    </el-dialog>

          <!-- 新增查询印件代码 -->
          <el-dialog v-model="searchModel" :before-close="() => searchModel = false">
            <el-form>
              <div>
                <el-form-item label="关键字:"  class="mab" prop="keyOrder">
                  <el-space>
                    <el-input v-model="cpyjdh_keyword" style="width: 100%;"/>
                    <el-button @click="cpsearchHandle(cpyjdh_keyword)">刷新</el-button>
                  </el-space>
                </el-form-item>
                <div style="border:1px solid #eee; width:100%; height: 400px; overflow-y: auto">
                  <el-tree :data="getProductYjListdata" :props="{children: 'children',label: 'label', value: '物料代码'}" @node-click="selectNode" />
                </div>
              </div>
            </el-form>
          </el-dialog>

          <!-- 新增查询印件纸张 -->
          <el-dialog v-model="searchZhiModel" :before-close="() => searchZhiModel = false">
            <el-form>
              <div>
                <el-form-item label="关键字:"  class="mab" prop="keyOrder">
                  <el-space>
                    <el-input v-model="zhi_keyword" style="width: 100%;"/>
                    <el-button @click="searchZhiHandle(zhi_keyword)">刷新</el-button>
                  </el-space>
                </el-form-item>
                <div style="border:1px solid #eee; width:100%; height: 400px; overflow-y: auto">
                  <el-tree :data="getProductZhiListdata" :props="{children: 'children',label: 'label', value: '物料代码'}" @node-click="selectZhiNode" />
                </div>
              </div>
            </el-form>
          </el-dialog>

          <!-- 新增工艺资料 弹窗 -->
          <el-dialog v-model="addgydialogFormVisible" :before-close="addgycloseDialog" :title="typeGy === 'create' ? '新增工艺资料' : '修改工艺资料'" height="300px" width="900px" destroy-on-close>
            <el-row>
              <el-scrollbar>
                <el-form :model="gyformDataTest" label-position="right" ref="elFormRef" :rules="rule"  >
                  <el-row>
                      <el-form-item label="工序方案:" prop="address" class="mab" >
                        <el-input v-model="add_gyformData.Gy0_方案"   style="width: 90px;" id="方案"  @keydown="ent($event, '备注', '方案', 'Gy0_yjno')"/>
                      </el-form-item>
                      <el-form-item label="印件编号:" prop="address" class="mab"  label-width="90">
                        <el-input v-model="add_gyformData.Gy0_yjno"    style="width: 90px;" id="Gy0_yjno" @blur="getKlKs" @keydown="ent($event, '方案', 'Gy0_yjno', 'Gy0_gxh')"/>
                      </el-form-item>
                      <el-form-item label="工序编号:" prop="address" class="mab" >
                        <el-input v-model="add_gyformData.Gy0_gxh"    style="width: 90px;" id="Gy0_gxh" @keydown="ent($event, 'Gy0_yjno', 'Gy0_gxh', '加工开数')"/>
                      </el-form-item>
                      <el-form-item label="加工开数" prop="address" class="mab">
                        <el-input v-model="add_gyformData.Gy0_Ks"   style="width: 90px;" id="加工开数"  @keydown="ent($event, 'Gy0_gxh', '加工开数', 'Gy0_ls')"/>
                      </el-form-item>
                      <el-form-item label="加工联数:" prop="address" class="mab" >
                        <el-input v-model="add_gyformData.Gy0_ls"   style="width: 90px;" id="Gy0_ls"  @keydown="ent($event, '加工开数', 'Gy0_ls', '车间名称')"/>
                      </el-form-item>
                  </el-row>

                  <el-row>
                    <el-col :span="6">
                      <el-form-item label="车间名称:" prop="address" class="mab">
                        <el-input v-model="add_gyformData.Gy0_site" id="车间名称" @keydown="ent($event, 'Gy0_ls', '车间名称', 'gy0_gxmc')" style="width: 140px;"  />
                      </el-form-item>
                    </el-col>
                    <el-col :span="6">
                      <el-form-item label="工艺名称:" prop="address" class="mab"  label-width="100">
                        <el-input v-model="add_gyformData.gy0_gxmc"   style="width: 140px;" id="gy0_gxmc"  @keydown="ent($event, '车间名称', '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="add_gyformData.Add_gxmc"   style="width: 100%;" id="add_gxmc"  @keydown="ent($event, 'gy0_gxmc', 'add_gxmc', 'Gy0_Ms')"/>
                      </el-form-item>
                    </el-col>
                  </el-row>

                  <el-row>
                      <el-form-item label="计损色数:" prop="address" class="mab">
                        <el-input v-model="add_gyformData.Gy0_Ms"   style="width: 140px;" id="Gy0_Ms"  @keydown="ent($event, 'add_gxmc', 'Gy0_Ms', 'Gy0_sbbh')"/>
                      </el-form-item>
                    <el-form-item label="可用设备:" prop="address" class="mab"  label-width="100">
                        <el-input v-model="add_gyformData.Gy0_sbbh"    id="Gy0_sbbh" style="" @keydown="ent($event, 'add_gxmc', 'Gy0_sbbh', '难度系数')" />
                      </el-form-item>
                    <el-form-item label="难度系数:" prop="address" class="mab" label-width="237">
                        <el-input v-model="add_gyformData.难度系数"    style="width: 90px;" id="难度系数" @keydown="ent($event, 'Gy0_sbbh', '难度系数', 'Gy0_shdh')"/>
                      </el-form-item>
                  </el-row>

                  <el-row>
                      <el-form-item label="标准损耗:" prop="address" class="mab">
                        <el-input v-model="add_gyformData.Gy0_shdh"  @keyup.enter="getSH()"   style="width: 150px;" id="Gy0_shdh" />
                        <el-input v-model="add_gyformData.sys_mc"   style="width: 160px;" id="sys_mc"  @keydown="ent($event, 'Gy0_shdh', 'sys_mc', '基础损耗')"/>
                      </el-form-item>
                      <el-form-item label="基础损耗:" prop="address" class="mab">
                        <el-input v-model="add_gyformData.sys_rate0"   style="width: 70px;" id="基础损耗"  @keydown="ent($event, 'sys_mc', '基础损耗', '损耗率')"/>
                      </el-form-item>
                      <el-form-item label="损耗率" prop="address" class="mab" >
                        <el-input v-model="add_gyformData.sys_rate1"   style="width: 90px;" id="损耗率"  @keydown="ent($event, '基础损耗', '损耗率', '损耗系数')"/>
                      </el-form-item>
                      <el-form-item label="损耗系数:" prop="address" class="mab" >
                        <el-input v-model="add_gyformData.损耗系数"    style="width: 90px;" id="损耗系数" @keydown="ent($event, '损耗率', '损耗系数', '工序备注')"/>
                      </el-form-item>
                  </el-row>

                  <el-row>
                    <el-col :span="24">
                      <el-form-item label="工序备注:" prop="remark" class="mab">
                        <el-input type="textarea" v-model="add_gyformData.工序备注" rows="2" resize="none"   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="add_gyformData.质量要求" rows="2" resize="none"   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="add_gyformData.质量隐患" rows="2" resize="none"   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="addgycloseDialog">取 消</el-button>
                <el-button type="primary"   @click="addgyenterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>

          <!-- 新增查询车间名称 -->
          <el-dialog v-model="searchCJModel" :before-close="() => searchCJModel = false">
            <el-form>
              <div>
                <!-- <el-form-item label="关键字:"  class="mab" prop="keyOrder">
                  <el-space>
                    <el-input v-model="gymc_keyword" style="width: 100%;"/>
                    <el-button @click="searchHandle(gymc_keyword)">刷新</el-button>
                  </el-space>
                </el-form-item> -->
                <div style="border:1px solid #eee; width:100%; height: 400px; overflow-y: auto">
                  <el-tree :data="getCJListdata" :props="defaultProps" @node-click="selectCJNode" />
                </div>

              </div>
            </el-form>
          </el-dialog>

          <!-- 新增查询标准损耗 -->
          <el-dialog v-model="searchSHModel" :before-close="() => searchSHModel = false">
            <el-form>
              <div>
                <!-- <el-form-item label="关键字:"  class="mab" prop="keyOrder">
                  <el-space>
                    <el-input v-model="gymc_keyword" style="width: 100%;"/>
                    <el-button @click="searchHandle(gymc_keyword)">刷新</el-button>
                  </el-space>
                </el-form-item> -->
                <div style="border:1px solid #eee; width:100%; height: 400px; overflow-y: auto">
                  <el-tree :data="getSHListdata" :props="defaultProps" @node-click="selectSHNode" />
                </div>
              </div>
            </el-form>
          </el-dialog>

          <!-- 修改印版资料 弹窗 -->
          <el-dialog v-model="ybdialogFormVisible" :before-close="ybcloseDialog" :title="'修改印版资料'" destroy-on-close>
            <el-row>
              <el-scrollbar >
                <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  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  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  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  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  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  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  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  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>

          <!-- 新增印版资料 弹窗 -->
          <el-dialog v-model="addybdialogFormVisible" :before-close="addybcloseDialog" :title="'新增印版资料'" height="300px" width="600px" destroy-on-close>
            <el-row>
              <el-scrollbar>
                <el-form :model="add_ybformDataTest" label-position="right" ref="elFormRef" :rules="rule"  >
                  <input type="hidden" v-model="add_ybformDataTest.gxmc1">
                  <el-form-item label="" prop="gongxu" class="mab" label-width="50">
                    <el-select v-model="add_ybformDataTest.gongxu" placeholder="请选择"  id="chbm" style="width: 400px;">
                      <el-option v-for="option in add_ybformDataTest.gongxuNameOptions" @click="ongongxufanclick" :key="option" :label="option"  :value="option" />
                    </el-select>
                  </el-form-item>

                    <el-form-item label="工序方案:" prop="address" class="mab" >
                      <el-input disabled v-model="add_ybformDataTest.YB_方案"   style="width: 90px;" id="YB_方案"/>
                      <el-form-item label="印件编号:" prop="address" class="mab" label-width="100">
                        <el-input disabled v-model="add_ybformDataTest.YB_Yjno"   style="width: 90px;" id="YB_Yjno"/>
                      </el-form-item>
                      <el-form-item label="工序编号:" prop="address" class="mab" label-width="100">
                        <el-input disabled v-model="add_ybformDataTest.YB_gxh"   style="width: 90px;" id="YB_gxh"/>
                      </el-form-item>
                    </el-form-item>

                  <el-form-item label="工艺名称:" prop="address" class="mab" >
                    <el-input disabled v-model="add_ybformDataTest.YB_gymc"   style="width: 500px;" id="YB_gymc"/>
                  </el-form-item>
                  <el-form-item label="工序名称:" prop="address" class="mab" >
                    <el-input disabled v-model="add_ybformDataTest.YB_gxmc"   style="width: 500px;" id="YB_gxmc"/>
                  </el-form-item>

                  <br>
                  <el-form-item label="存货编码:" prop="address" class="mab" >
                    <el-input  v-model="add_ybformDataTest.物料代码"   style="width: 200px;" id="YB_gxmc"  @keydown="add_ybzlent($event, '', 'YB_gxmc', '')"/>
                  </el-form-item>
                  <el-form-item label="存货名称:" prop="address" class="mab" >
                    <el-input disabled  v-model="add_ybformDataTest.物料名称"   style="width: 500px;" id="YB_gxmc"/>
                  </el-form-item>
                  <el-form-item label="印版备注:" prop="address" class="mab" >
                    <el-input  type="textarea" resize="none" v-model="add_ybformDataTest.ybbz" rows="1" clearable   style="flex: 1;resize: none" />
                  </el-form-item>

                </el-form>
              </el-scrollbar>
            </el-row>
            <template #footer>
              <div class="dialog-footer">
                <el-button @click="addtbcloseDialog">取 消</el-button>
                <el-button type="primary"   @click="addtbenterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>

          <!-- 新增印版资料查询存货编码 -->
          <el-dialog v-model="addybdisplay" :before-close="() => addybdisplay = false">
            <el-form>
              <div>
                <el-form-item label="" prop="originalName" class="mab">
                  <el-select v-model="addybdisplaydata.chbm" placeholder="请选择"  id="chbm" style="width: 200px;">
                    <el-option v-for="option in addybdisplaydata.chbmNameOptions" @click="onybzlfanclick" :key="option" :label="option"  :value="option" />
                  </el-select>
<!--                </el-form-item>-->

<!--                <el-form-item label=""  class="mab" prop="keyOrder">-->
                  <el-space>
                    <el-input v-model="addyb_keyword" style="width: 100%;margin-left: 20px"/>
                    <el-button @click="addyb_searchHandle(addyb_keyword)"  style="width: 10%;">刷新</el-button>
                  </el-space>
                </el-form-item>
                <div style="border:1px solid #eee; width:100%; height: 400px; overflow-y: auto">
                  <el-tree :data="getYBListdata" :props="defaultProps" @node-click="addyb_selectSHNode" />
                </div>
              </div>
            </el-form>
          </el-dialog>

		<!-- 技术附件 -->
          <el-dialog v-model="jsfjdialogFormVisible" :before-close="jsfjcloseDialog" :title="产品技术附件资料" style="margin-top: 40px" height="500px" width="800px" destroy-on-close>
			  <el-form :model="jsfjformdata" label-position="right" ref="elFormRef" :rules="rule" label-width="75px">
				<el-row :gutter="24">
					<el-col :span="6">
					  <el-form-item label="序号:" prop="address" class="mab">
						<el-input v-model="jsfjformdata.序号"  id="序号" style="width: 140px;"  />
					  </el-form-item>
					</el-col>
					<el-col :span="18">
					  <el-form-item label="附件备注:" prop="address" class="mab">
						<el-input v-model="jsfjformdata.附件备注"  id="附件备注" />
					  </el-form-item>
					</el-col>
				</el-row>
				<el-row :gutter="24">
					<el-col :span="24">
						<el-form-item label="适用工序:" prop="address" class="mab">
							<el-input v-model="jsfjformdata.适用工序"  id="适用工序" />
						</el-form-item>
					</el-col>
				</el-row>
				<el-row :gutter="24">
					<el-col :span="24">
					  <el-form-item label="关联产品:" prop="address" class="mab">
						<el-input v-model="jsfjformdata.关联产品"  id="关联产品" />
					  </el-form-item>
					</el-col>
				</el-row>
				<el-row :gutter="24">
					<el-col :span="6"></el-col>
					<el-col :span="12">
						<input style="font-size:16px;" type="file" @change="uploadExcel" >
					</el-col>
					<el-col :span="6">
						<el-button @click="yulan">预览</el-button>
					</el-col>
				</el-row>
			  </el-form>
			  <template #footer>
				<div class="dialog-footer">
				  <el-button @click="jsfjcloseDialog">取 消</el-button>
				  <el-button type="primary"  @click="jsfjenterDialog">确 定</el-button>
				</div>
			  </template>
			</el-dialog>

<el-dialog v-model="luckyexcelVisible" :before-close="luckyexcelCloseDialog" width="100%" top="0vh">
  <div id="luckyexcel" style="width: 100%;height: 90vh;"></div>
</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 $script from 'scriptjs'
import $ from 'jquery';
import LuckyExcel from 'luckyexcel';
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, nextTick, } from 'vue'
import {
  DataList,
  ProductDetailData,
  editGyName,
  editGyNo,
  editProduct,
  getProductYbMaterialDetail,
  editProductYjInfo,
  getProductGyInfo,
  getCustom,
  getDepartment,
  getProduct,
  editGy,
  getProductData,
  getProductYjInfo,
  getGyTotal,
  ProductCodeList,
  getProductGy,
  editGyWaste,
  editGyMs,
  getStaffList,
  setProductStatus,
  getProductYjList,
  getProductZzList,
  addProductYjInfo,
  getDepartName,
  getProcess,
  getProcessLoss,
  addProductGyInfo,
  copyProductGy,
  getProductYbMaterialList,
  getProductYbInfo,
  addProductYbInfo,
  getAnnexTable,
  annexAdd,
  annexDel,
  getLossCode,
  PrintlDel,
  ProcessDel,
  addProduct,
  ProcessEdit,
  getCouplet,
  ProductgetCouplet
} from '@/api/yunyin/yunying'
defineOptions({   name: 'Company'})
import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore()
const _username = ref('')
_username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
// =========== 导出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 cpgyfzlist = ref(false);
const cpgyfzformData = reactive({
  process: '',
  processName: '',
  gongyifa:'',
  gongyifaNameOptions: [],
  mubprocess: '',
  mubprocessName: '',
  to_pro:'',
  fzgyzl: false,
  fzybzl: true,
});
const cpgyfzclick = async () => {
  if(_product_code.value == null){
    gygmlist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择分类项目，再操作此功能'
    })
  }else{
    cpgyfzlist.value = true;
    cpgyfzformData.process = _product_code.value;
    await _getGyTotal();
  }
};
//取消
const cpgyfzhandleCancel = async () => {
  cpgyfzlist.value = false;
};
//确定
const is_copy_gy = ref(0);
const is_copy_yb = ref(0);
const toProUpperCase = ref('');
const cpgyfzhandleConfirm = async () => {
  // console.log(cpgyfzformData)
  if(cpgyfzformData['process'] === ''){
    ElMessage({type: 'warning',message: '参照产品代号不能为空' })
    return false;
  }
  if(cpgyfzformData['mubprocess'] === ''){
    ElMessage({type: 'warning',message: '目标产品编号不能为空' })
    return false;
  }
  if(cpgyfzformData['gongyifa'] === '' ||  cpgyfzformData['gongyifa'] === undefined){
    ElMessage({type: 'warning',message: '该产品未查询到工艺方案' })
    return false;
  }
  if(cpgyfzformData['mubprocess'] === ''){
    ElMessage({type: 'warning',message: '目标产品代号不能为空' })
    return false;
  }
  //选择复制工艺资料
  if (cpgyfzformData['fzgyzl'] === true) {
    is_copy_gy.value = 1;
  }
  //选择复制印版资料
  if (cpgyfzformData['fzybzl'] === true) {
    is_copy_yb.value = 1;
  }
  //选择复制工艺资料、不选择复制印版资料
  if (cpgyfzformData['fzgyzl'] === true && cpgyfzformData['fzybzl'] === false) {
    if(cpgyfzformData['to_pro'] === ''){
      ElMessage({type: 'warning',message: '目标工艺方案不能为空' })
      return false;
    }
    is_copy_gy.value = 1;
    is_copy_yb.value = 0;
  }
  //选择复制印版资料、不选择复制工艺资料
  if (cpgyfzformData['fzgyzl'] === false && cpgyfzformData['fzybzl'] === true) {
    is_copy_gy.value = 0;
    is_copy_yb.value = 1;
    cpgyfzformData['to_pro'] = '';
  }
  //都不选择提示信息
  if (cpgyfzformData['fzgyzl'] === false && cpgyfzformData['fzybzl'] === false) {
    ElMessage({type: 'warning',message: '请选择复制工艺资料 或 复制印版资料' })
    return false;
  }
  // 判断是否为大写字母
  if (cpgyfzformData['to_pro'] === cpgyfzformData['to_pro'].toUpperCase()) {
    toProUpperCase.value = cpgyfzformData['to_pro'];
  } else {
    // 如果不是大写字母，则将其转换为大写
    toProUpperCase.value  = cpgyfzformData['to_pro'].toUpperCase();
  }
  const formattedData = {
    from_code: cpgyfzformData['process'],
    from_pro: cpgyfzformData['gongyifa'],
    to_code: cpgyfzformData['mubprocess'],
    is_copy_gy: is_copy_gy.value,
    to_pro: toProUpperCase.value,
    is_copy_yb: is_copy_yb.value,
  };
  console.log(formattedData);
  const copyProductGy_add = await copyProductGy(formattedData);
  console.log(copyProductGy_add)
  if (copyProductGy_add.code === 0) {
    ElMessage({ type: 'success', message: '更新成功' });
  } else {
    // ElMessage({ type: 'error', message: '更新失败' });
  }
  cpgyfzlist.value = false;

};




cpgyfzhandleConfirm
//101201052
const _getGyTotal = async () => {
  console.log(_product_code.value)
  const getGyTotaldata = await getGyTotal({code:_product_code.value});
  cpgyfzformData.processName = getGyTotaldata.data.name
  cpgyfzformData.gongyifa = getGyTotaldata.data.gy[0]
  cpgyfzformData.gongyifaNameOptions = getGyTotaldata.data.gy
};

const cpgyfzdisplay = ref(false)
const cpgyfzLists = ref(false);
const cpgyfz_keyword = ref('')
//点击客户代号
const cpgyfzselectGongDanNode = (node, type) => {
  if (type === '产品代号') {
    cpgyfzformData['mubprocess'] = node.产品编号
    cpgyfzformData['mubprocessName'] = node.产品名称
    cpgyfzdisplay.value = false
  }
}
const cpgyfzSearchHandle = async (v, type) => {
  if (type === '产品代号') {
    await _ProductCodeList(v)
  }
}
//【回车】
const cpgyfz_ProductValue = async (v) => {
  await _ProductCodeList(cpgyfz_keyword.value)
};
//产品代号列表
const _ProductCodeList = async (v = '')=>{
  try {
    const ProductCodeListdata = await ProductCodeList({cilent: v});
    cpgyfzLists.value = ProductCodeListdata.data
  } catch (error) {
    console.error(error);
  }
}
const add_cpgyfzent = async (event,id1,id2,id3) => {
  if (id2 === 'mubprocess' &&  event.key==='Tab' || id2 === 'mubprocess' && event.key=== 'Enter') {
    // cpgyfz_keyword.value = '';
    await _ProductCodeList(cpgyfzformData['mubprocess'])
    if (cpgyfzLists.value != null) {
      const row = cpgyfzLists.value.find(item => item.产品编号 === cpgyfzformData['mubprocess'])
      if (row) {
        cpgyfzformData['mubprocess'] = row.产品编号
        cpgyfzformData['mubprocessName'] = row.产品名称
      } else {
        cpgyfzdisplay.value = true
      }
    } else {
      cpgyfzdisplay.value = true
    }
  }
  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 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 () => {
  if(gyformData.originalName === '' ||  gyformData.originalName === undefined){
    ElMessage({type: 'warning',message: '该产品未查询到工艺方案原名' })
    return false;
  }
  if(gyformData.newName === ''){
    ElMessage({
      type: 'warning',
      message: '工艺方案新名不能为空'
    })
    return;
  }
  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()
    // console.log("左侧菜单列表↓")
    // console.log(data)
    // treeData.value = data.data;
    const response = await getCustom();
    console.log("左侧菜单列表↓");
    console.log(response);
    const formattedData = [];
    for (const category in response.data) {
      const categoryNode = {
        label: category, // 使用分类名称作为节点标签
        children: response.data[category].map(item => ({
          label: `${item['客户编号']}【${item['客户名称']}】`, // 将客户信息格式化为节点标签
          ...item // 保留原始数据，可能在后面需要使用
        }))
      };
      formattedData.push(categoryNode);
    }
    treeData.value = formattedData;
  } catch (error) {
    console.error('Error fetching custom data:', error);
  }
}

getCustomdata()

//点击左侧树形获取列表
const tableData = reactive([])
const _custom_code = ref(null)
const selectedLabel = ref(null);

const handleNodeClick = async (node) => {
  // if(node.label === '印刷产品' || node.label === '糊盒产品'){
  //   tableData.splice(0);
  //   return false;
  // }
  if(node.label === '印刷产品' ){
    _custom_code.value = 'Y';
  }else if(node.label === '糊盒产品'){
    _custom_code.value = 'J';
  }else{
    _custom_code.value = node.客户编号;
  }
  //清空搜索框
  searchInfo.value = '';
  _getProduct()
  selectedLabel.value = node.label;  // 更新当前选中的节点标签

};


//印件资料
const yjtableData = reactive([])
//工艺资料
const gytableData = reactive([])
//印版资料
const ybtableData = reactive([])
//技术资料附件【暂时为空】
const jstableData = reactive([])
//全局调用产品编号
const _product_code = ref(null)
//全局调用产品名称
const _kehu_code = ref(null)
const _UniqID = ref(null)
const addgy = ref(false)
const addyb = ref(false)
const addyj = ref(false)
const delall = ref(false)
//点击表格行 下方表格获取数据
const tableRowClick = async (row) => {
  console.log(row)
  _UniqID.value = row.UniqID;
	_Gd_gdbh.value = row.产品编号;
  _product_code.value = row.产品编号;
  _kehu_code.value = row.产品名称;
  const res = await getProductData({product_code:_product_code.value});
  console.log(_product_code.value + "--->下方表格获取数据")
  console.log(res)
  console.log(res.data.gyData)
  const processedData = res.data.gyData.map(item => {
    return {
      ...item,
      combinedProp: item.Gy0_yjno + '--'+item.Gy0_gxh,
      combinedProp2: item.gy0_gxmc + '-'+item.add_gxmc,
	  combinedProp3: item.Gy0_Ks + '*'+item.Gy0_ls
    };
  });
  yjtableData.splice(0, yjtableData.length, ...res.data.yjData);
  gytableData.splice(0, gytableData.length, ...processedData);
  ybtableData.splice(0, ybtableData.length, ...res.data.ybData);
  jstableData.splice(0, jstableData.length, ...res.data.jsData);
  if(yjtableData.length==0){
	   yjzuidahaoma.value = 1
  }else{
	  let tmp = yjtableData.map(item => item.yj_yjno)
	  tmp = tmp.sort((a,b)=>b-a)
	  yjzuidahaoma.value = Number(tmp[0]) + 1
  }
  // console.log(yjzuidahaoma.value)
  // yjzuidahaoma.value = yjtableData.length+1
  addgy.value=true
  addyb.value=true
  addyj.value=true
  delall.value=true
};
const yjSelection = ref('')
const gySelection = ref('')
// 印件资料多选、工艺资料多选
const selectionChange = (selection, type) => {
  const ids = selection.map(item => {
	  if(type === '印件资料'){
		return type === '印件资料' ? item.UniqId: item.UniqId
	  }
	  if(type === '工艺资料'){
	  return type === '工艺资料' ? item.UniqID: item.UniqID
	  }

  })
  console.log(ids)
  if (type === '印件资料') {
    yjSelection.value = ids.join(',')
  }
  if (type === '工艺资料') {
    gySelection.value = ids.join(',')
  }
}
// ===========删除印件资料、工艺资料 ===========
const delgd_delclick = async () => {
  console.log(yjSelection.value)
  console.log(gySelection.value)

  if (yjSelection.value !== '') {
    try {
      const res1 = await PrintlDel({UniqId: yjSelection.value})
      res1.code === 0 && ElMessage.success('印件资料删除成功')
	  GetInfo()
    } catch(err) {
      ElMessage.error(err)
    }
  }
  if (gySelection.value !== ''){
    try {

      const res2 = await ProcessDel({UniqId: gySelection.value})
      res2.code === 0 && ElMessage.success('工艺资料删除成功')
	  GetInfo()
    } catch(err) {
      ElMessage.error(err)
    }
  }

  // const getProductData_data = await getProductData({product_code:_Gd_gdbh.value});
  // yjtableData.splice(0, yjtableData.length, ...getProductData_data.data.yjData);
  // gytableData.splice(0, gytableData.length, ...getProductData_data.data.gyData);
}
//搜索查询
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;
  console.log(params)
  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(30)
const handleCurrentChange = (val) => {
  page.value = val;
  _getProduct();
};

// 修改页面容量 点击多少条/页
const handleSizeChange = (val) => {

  pageSize.value = val;
  _getProduct();
};

//=========修改产品基本资料产品表格弹窗========
let formDataTest = reactive({})
//弹窗
const dialogFormVisible = ref(false)
const huanxingVisible = ref(false)

// 行为控制标记（弹窗内部需要增还是改）
const typeGy = ref('')

//双击修改弹窗
const dbclickId = ref()
const type = ref('')

const updateCompanyFunc = async (row, cols) => {
   type.value = 'update';
  dbclickId.value = row.UniqID
  formDataTest = Object.assign(formDataTest,row);
  dialogFormVisible.value = true;
};
//点击新增产品资料按钮
const addcp_onclick = () => {
	type.value = 'create'
	dialogFormVisible.value = true;
}

//客户编号失去焦点事件
const getCustominfo = () => {
 	huanxingVisible.value=true
}
const treeDataClick = async (node) => {
  if(node.label === '印刷产品' || node.label === '糊盒产品'){
    tableData.splice(0);
    return false;
  }
  formDataTest['客户编号']=node.客户编号
  formDataTest['客户名称']=node.客户名称
  huanxingVisible.value=false
};
//关闭修改弹窗
const closeDialog = () => {
  dialogFormVisible.value = false
}
//点击确定修改表格
const enterDialog = async () => {
  const formattedData = {
    '客户编号': formDataTest['客户编号'],
    '客户名称': formDataTest['客户名称'],
    // '印品代号': formDataTest['产品编号'],
	'产品编号': formDataTest['产品编号'],
    '版本号': formDataTest['版本号'],
    '客户料号': formDataTest['客户料号'],
    '产品名称': formDataTest['产品名称'],
    '产品类别': formDataTest['产品类别'],
    '计量单位': formDataTest['计量单位'],
    '成品规格': formDataTest['成品规格'],
    '产品备注': formDataTest['产品备注'],
  };
  console.log(type.value)
  if(type.value =='create'){
  const formattedData = {
    '客户编号': formDataTest['客户编号'],
    '客户名称': formDataTest['客户名称'],
    // '印品代号': formDataTest['产品编号'],
  	'产品编号': formDataTest['产品编号'],
    '版本号': formDataTest['版本号'],
    '客户料号': formDataTest['客户料号'],
    '产品名称': formDataTest['产品名称'],
    '产品类别': formDataTest['产品类别'],
    '计量单位': formDataTest['计量单位'],
    '成品规格': formDataTest['成品规格'],
    '产品备注': formDataTest['产品备注'],
  };
  const res = await addProduct(formattedData);
  if (res.code === 0) {
    ElMessage({type: 'success',message: '新增成功'})
  } else {
    ElMessage({ type: 'error',message: '新增失败'})
  }
  formDataTest=[]
  dialogFormVisible.value = false;
  _getProduct();
  }else{
  const formattedData = {
    '客户编号': formDataTest['客户编号'],
    '客户名称': 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: '更新失败'})
  }
  formDataTest=[]
  dialogFormVisible.value = false;
  _getProduct();
  }

}

//=========修改印件资料========
let yjformDataTest = reactive({})
const type2=ref()
//双击修改
const yjupdateCompanyFunc = async (row) => {
	type2.value='update'
  //3.1获取产品印件资料
  const getProductYjInfo_edit = await getProductYjInfo({UniqId:row.UniqId})
  Object.assign(yjformDataTest,getProductYjInfo_edit.data[0]);
  yjdialogFormVisible.value = true;
};
// 弹窗
const yjdialogFormVisible = ref(false)
//关闭修改弹窗
const yjcloseDialog = () => {
  yjdialogFormVisible.value = false
}
//点击确定修改表格
const yjenterDialog = async () => {
  console.log(yjformDataTest)
  const formattedData = {
    UniqId: yjformDataTest['UniqId'],
    yj_yjno: yjformDataTest['yj_yjno'],
    yj_yjdh: yjformDataTest['yj_yjdh'],
    yj_yjmc: yjformDataTest['yj_yjmc'],
    yj_zzdh: yjformDataTest['yj_zzdh'],
    yj_zzdh1: yjformDataTest['yj_zzdh1'],
    yj_zzdh2: yjformDataTest['yj_zzdh2'],
    yj_zzdh3: yjformDataTest['yj_zzdh3'],
    yj_zzdh4: yjformDataTest['yj_zzdh4'],
    yj_zzmc: yjformDataTest['yj_zzmc'],
    yj_zzmc1: yjformDataTest['yj_zzmc1'],
    yj_zzmc2: yjformDataTest['yj_zzmc2'],
    yj_zzmc3: yjformDataTest['yj_zzmc3'],
    yj_zzmc4: yjformDataTest['yj_zzmc4'],
    yj_tlgg: yjformDataTest['yj_tlgg'],
    yj_klgg: yjformDataTest['yj_klgg'],
    yj_ks: yjformDataTest['yj_ks'],
    yj_ls: yjformDataTest['yj_ls'],
    KgToPages: yjformDataTest['KgToPages'],
    yj_desc: yjformDataTest['yj_desc'],
  };
  //3.2修改产品印件资料
  const editProductYjInfo_edit = await editProductYjInfo(formattedData);
  if (editProductYjInfo_edit.code === 0) {
    ElMessage({type: 'success',message: '更新成功'})
  } else {
    ElMessage({ type: 'error',message: '更新失败'})
  }
  yjdialogFormVisible.value = false;
}

//=========新增印件资料========
//全局调用工单编号
const _Gd_gdbh = ref(null)
const add_gdyjdialogFormVisible = ref(false)
const cgugdlist = ref(false);
const searchModel = ref(false)
const cpyjdh_keyword = ref('')
const getProductZhiListdata = ref()
const searchZhiModel = ref(false)
const zzdhIndex = ref(null)
const yjzuidahaoma = ref(0)
const add_yjzlformdata = reactive({
  yjno: '',
  yjdh: '',
  yjmc: '',
  zzdh: '',
  zzdh1: '',
  zzdh2: '',
  zzdh3: '',
  zzdh4: '',
  zzmc: '',
  zzmc1: '',
  zzmc2: '',
  zzmc3: '',
  zzmc4: '',
  cpsl: '',
  sjtl: '',
  pztl: '',
  tlgg: '',
  klgg: '',
  hsgg: '',
  ks: '',
  ls: '',
  desc: '',
  万小张: '',
  KgToPages:'',
});
const getProductYjListdata = ref()

//点击新增印件资料按钮
const addcpyj_onclick = () => {
	type2.value='add'
	if(_Gd_gdbh.value == null){
	  cgugdlist.value = false;
	  ElMessage({type: 'warning',message: '请选择具体的工单后，再操作此功能'})
	}else{
	  gdyj_clearFormData();
	  add_gdyjdialogFormVisible.value = true
	}

}
//印件代号Tab或回车
// const openSearchModal = (code) => {
//   if (code.key==='Tab' || code.key==='Enter') {
//     setTimeout(() =>document.querySelector('#yjdhId').focus(), 50)
//     _getProductYjList();
//     searchModel.value = true
//   }
// }
//印件代号刷新按钮
const cpsearchHandle = async (v) => {
  const response = await getProductYjList({search:v});
  getProductYjListdata.value = handleTreeData(response.data)
}
//印件代号 点击树状图获取点击的数据
const selectNode = (v) => {
	console.log(type2.value)
if(type2.value==='add'){
	if(v.物料名称){
	  add_yjzlformdata['yjdh'] = v.物料代码
	  add_yjzlformdata['yjmc'] = v.物料名称
	  searchModel.value= false
	}
}else if(type2.value==='update'){
	if(v.物料名称){
	  yjformDataTest['yj_yjdh'] = v.物料代码
	  yjformDataTest['yj_yjmc'] = v.物料名称
	  searchModel.value= false
	}
}
}

const openSearchZhiModal = (code, idx) => {
  if (code.key==='Tab') {
    setTimeout(() => document.querySelector('.zhi').focus(), 50)
    _getProductZzList()
    zzdhIndex.value = idx
  }
}
const zhi_keyword = ref('')
//3.5获取纸张代号及名称
const searchZhiHandle = async(v) => {
  const response = await getProductZzList({search:v});
  getProductZhiListdata.value = handleTreeDatas(response.data)
}
//3.5获取纸张代号及名称
const _getProductZzList = async ()=>{
  try {
    const response = await getProductZzList({search:''});
    getProductZhiListdata.value = handleTreeDatas(response.data)
	nextTick(() => {
	 searchZhiModel.value = true
	});
  } catch (error) {
    console.error(error);
  }
}
//印件新增【纸张】树状图
const handleTreeDatas = (treeData) => {
  const data = Object.keys(treeData).map((key)=>({
    label:key,
    children: Object.keys(treeData[key]).map((keys)=>({
      label:keys,
      children:Object.keys(treeData[key][keys]).map((keyss)=>({
        label:keyss,
        children:treeData[key][keys][keyss].map(item=>({
          label:`${item.物料代码} ${item.物料名称}`,
          规格:item.规格,
          物料代码:item.物料代码,
          物料名称:item.物料名称
        }))
      }))
    }))
  }))
  return data
}
const _getProductYjList = async ()=>{
  try {
    const response = await getProductYjList({search:''});
    getProductYjListdata.value = handleTreeData(response.data)
  } catch (error) {
    console.error(error);
  }
}
//印件新增【印件代码】树状图
const handleTreeData = (treeData) => {
 const data = Object.keys(treeData).map((key)=>({
   label:key,
    children: Object.keys(treeData[key]).map((keys)=>({
      label:keys,
      children:treeData[key][keys].map(item=>({
        label:`${item.物料代码} ${item.物料名称}`,
        物料代码:item.物料代码,
        物料名称:item.物料名称
      }))
    }))
  }))
  return data
}
//纸张tab 点击事件
const selectZhiNode = (v) => {
  if (v.children && v.children.length > 0) {
    // Node has child nodes, expand the structure
    // Perform any necessary actions for expanding the structure
  } else {
    // Node does not have child nodes, assign values
    if (type2.value === 'add') {
      if (v.物料名称) {
        if (zzdhIndex.value == 0) {
          add_yjzlformdata['zzdh'] = v.物料代码;
          add_yjzlformdata['zzmc'] = v.物料名称;
          add_yjzlformdata['tl'] = v.规格;
        } else {
          add_yjzlformdata['zzdh' + zzdhIndex.value] = v.物料代码;
          add_yjzlformdata['zzmc' + zzdhIndex.value] = v.物料名称;
        }
        zhi_keyword.value = '';
      }
    } else if (type2.value === 'update') {
      if (v.物料名称) {
        if (zzdhIndex.value == 0) {
          yjformDataTest['yj_zzdh'] = v.物料代码;
          yjformDataTest['yj_zzmc'] = v.物料名称;
          yjformDataTest['yj_tlgg'] = v.规格;
        } else {
          yjformDataTest['yj_zzdh' + zzdhIndex.value] = v.物料代码;
          yjformDataTest['yj_zzmc' + zzdhIndex.value] = v.物料名称;
        }
        zhi_keyword.value = '';
      }
    }
    searchZhiModel.value = false;
  }
}



//清空对象的属性值
const gdyj_clearFormData = () => {
  Object.keys(add_yjzlformdata).forEach(key => {
    add_yjzlformdata[key] = '';
  });
  add_yjzlformdata.yjno = yjzuidahaoma.value;
  add_yjzlformdata['pztl'] = 0;
  add_yjzlformdata['ks'] = 0;
  add_yjzlformdata['ls'] = 0;
  add_yjzlformdata['万小张'] = 0;
};

//印件新增确定
const add_gdyjenterDialog = () => {
  console.log(add_yjzlformdata)
  const formattedData = {
    yj_cpdh: _Gd_gdbh.value,
    yj_yjno: add_yjzlformdata['yjno'],
    yj_yjdh: add_yjzlformdata['yjdh'],
    yj_yjmc: add_yjzlformdata['yjmc'],
    yj_zzdh: add_yjzlformdata['zzdh'],
    yj_zzdh1: add_yjzlformdata['zzdh1'],
    yj_zzdh2: add_yjzlformdata['zzdh2'],
    yj_zzdh3: add_yjzlformdata['zzdh3'],
    yj_zzdh4: add_yjzlformdata['zzdh4'],
    yj_zzmc: add_yjzlformdata['zzmc'],
    yj_zzmc1: add_yjzlformdata['zzmc1'],
    yj_zzmc2: add_yjzlformdata['zzmc2'],
    yj_zzmc3: add_yjzlformdata['zzmc3'],
    yj_zzmc4: add_yjzlformdata['zzmc4'],
    KgToPages:add_yjzlformdata['KgToPages'],
    yj_tlgg: add_yjzlformdata['tl'],
    yj_klgg: add_yjzlformdata['kl'],
    yj_ks: add_yjzlformdata['ks'],
    yj_ls: add_yjzlformdata['ls'],
    yj_desc: add_yjzlformdata['desc'],
    sys_id  : _username.value,
    // 万小张: add_yjzlformdata['万小张'],
  };
  console.log(formattedData)
  const res=addProductYjInfo(formattedData)
  res.then(result => {
    if(result.code===0){
		ElMessage({
		  type: 'success',
		  message: '成功'
		})
	 add_gdyjdialogFormVisible.value = false
	}else{
		ElMessage({
		  type: 'error',
		  message: '失败'
		})
	}
  });

}
//印件新增取消
const add_dyjcloseDialog = () => {
  add_gdyjdialogFormVisible.value = false
}

const add_yinjian_ent = (event,id1,id2,id3) => {
  if (id2 === '印件代号' && event.key==='Tab' || event.key==='Enter') {
    _getProductYjList(add_yjzlformdata['yjdh']);
    searchModel.value = true
  }
  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 add_gdzlyjent = async (event,id1,id2,id3,idx) => {
  if (id2 === 'yjdh' && event.key==='Tab' || id2 === 'yjdh' && event.key=== 'Enter') {
    _getProductYjList();
    searchModel.value = true
  }
  if (id2 === 'zzdh' && event.key==='Tab' || id2 === 'zzdh' && event.key=== 'Enter') {
    _getProductZzList()
    searchZhiModel.value = true
    zzdhIndex.value = idx
  }
  if (id2 === 'zzdh1' && event.key==='Tab' || id2 === 'zzdh1' && event.key=== 'Enter') {
    _getProductZzList()
    searchZhiModel.value = true
    zzdhIndex.value = idx
  }
  if (id2 === 'zzdh2' && event.key==='Tab' || id2 === 'zzdh2' && event.key=== 'Enter') {
    _getProductZzList()
    searchZhiModel.value = true
    zzdhIndex.value = idx
  }
  if (id2 === 'zzdh3' && event.key==='Tab' || id2 === 'zzdh3' && event.key=== 'Enter') {
    _getProductZzList()
    searchZhiModel.value = true
    zzdhIndex.value = idx
  }
  if (id2 === 'zzdh4' && event.key==='Tab' || id2 === 'zzdh4' && event.key=== 'Enter') {
    _getProductZzList()
    searchZhiModel.value = true
    zzdhIndex.value = idx
  }
  if(event.keyCode === 40){
    if(id3!=''){
      document.getElementById(id3).focus()
    }
  }else if (event.keyCode === 13) { // 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()
    }
  }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 addgydialogFormVisible = ref(false)
const searchCJModel = ref(false)
const searchSHModel = ref(false)
// 点击工艺行获取数据
const addcpgy_onclick =  async () => {
	if(_gyrow.value){
		//3.6工艺资料-获取产品工艺资料
		const getProductGyInfo_edit = await getProductGyInfo({UniqID:_gyrow.value.UniqID})
		Object.assign(add_gyformData,getProductGyInfo_edit.data);
	}
	add_gyformData.Gy0_方案 = 'A';
	//新增
	typeGy.value = 'create'
	addgydialogFormVisible.value=true
  // add_yjdialogFormVisible.value = true
  // console.log(yjtableData.length)
}
const add_gyformData = reactive({
	Gy0_cpdh: '',
  Gy0_方案: '',
  Gy0_yjno: '',
  Gy0_gxh: '',
  Gy0_Ks: '',
  Gy0_ls: '',
  Gy0_site: '',
  gy0_gxmc: '',
  Add_gxmc: '',
  Gy0_Ms: '',
  Gy0_sbbh: '',
  难度系数:'1.000',
  Gy0_shdh: '',
  sys_mc:'',
  sys_rate0: '',
  sys_rate1: '',
  损耗系数: '1.000',
  工序备注: '',
  质量要求: '',
  质量隐患: '',
  Sys_id: _username.value,
  
});
const getcjmc = (code) => {
  // if (code.key==='Tab') {
  //   setTimeout(() =>document.querySelector('#yjdhId').focus(), 50)
  //   _getCJList();

  // }
  _getCJList()
}

const getCJListdata = ref([]);
const _getCJList = async () => {
  try {
    const response = await getDepartName({ search: '' });
    getCJListdata.value = Object.keys(response.data).map(process => {
      return {
        label: process,
        level: 1,
        children: Object.keys(response.data[process]).map(department => {
          return {
            label: department,
            level: 2,
            children: response.data[process][department].map(subDepartment => {
              return {
                label: subDepartment,
                level: 3
              };
            })
          };
        })
      };
    });
    searchCJModel.value = true;
  } catch (error) {
    console.error(error);
  }
};
const selectCJNode = (nodeData) => {
  if(nodeData.level==2){
	add_gyformData.Gy0_site=nodeData.label
  }
  console.log(nodeData)
  if(nodeData.level==3){
	InSH(nodeData.label)
	add_gyformData.gy0_gxmc=nodeData.label
	searchCJModel.value = false
  }
}
const InSH = async (value) => {
	const response = await getLossCode({ code:value});
	console.log(response)
	if(response.code===0){
		if(response.data.length){
			add_gyformData.Gy0_shdh=response.data[0].sys_bh
			add_gyformData.sys_mc=response.data[0].sys_mc
			add_gyformData.sys_rate0=response.data[0].sys_rate0
			add_gyformData.sys_rate1=response.data[0].sys_rate1
		}else{
			add_gyformData.Gy0_shdh=''
			add_gyformData.sys_mc=''
			add_gyformData.sys_rate0=''
			add_gyformData.sys_rate1=''
		}
	}else{
		add_gyformData.Gy0_shdh=''
		add_gyformData.sys_mc=''
		add_gyformData.sys_rate0=''
		add_gyformData.sys_rate1=''
	}
}
const getSHListdata = ref([]);
const getSH = (code) => {
  _getSH()
}
//填充树形结构
const _getSH = async () => {
  const response = await getLossCode({ code: '' });

  if (response.code === 0) {
    const data = response.data;

    const treeData = [];
    const map = {};

    // 构建树形结构
    data.forEach(item => {
      map[item.sys_bh] = { ...item, children: [], label: `${item.sys_bh}---${item.sys_mc}---${item.sys_rate0}---${item.sys_rate1}` };
    });

    data.forEach(item => {
      if (item.sys_bh.length === 3) {
        map[item.sys_bh].level = 1;
        treeData.push(map[item.sys_bh]);
      } else {
        map[item.sys_bh].level = 2;
        map[item.sys_bh.substring(0, 3)].children.push(map[item.sys_bh]);
      }
    });

    getSHListdata.value = treeData;
    searchSHModel.value = true;
  } else {
    // 处理错误情况
    console.error('获取损耗列表失败');
  }
};
//损耗树形结构点击
const selectSHNode = (node,check) => {
   if(node.level==1){
   	console.log(node.label)
   }
   if(node.level==2){
   	add_gyformData.Gy0_shdh = node.sys_bh
	add_gyformData.sys_mc = node.sys_mc
	add_gyformData.sys_rate0 = node.sys_rate0
	add_gyformData.sys_rate1 = node.sys_rate1
	searchSHModel.value = false;
   }
}
// const processData = (data) => {
//   const map = {};
//   const tree = [];
//   console.log(data)
//   data.forEach(item => {
//     map[item.sys_bh] = { label: `${item.sys_bh} ${item.sys_mc}`, level: 1, children: [] };

//   });


//   data.forEach(item => {
//     if (item.Parent !== "0_") {
//       map[item.Parent].children.push(map[item.sys_bh]);	 console.log(item) }
//    //  } else {
//    //    tree.push(map[item.sys_bh]);
// 	  // console.log(item)
//    //  }
//   });

//   tree.forEach(item => {
// 	  // console.log(item)
//     // if (item.children.length === 0) {
//       // item.children.push({ label: `${item.sys_bh} ${item.sys_mc}`, level: 2 });
//     // }
//   });

//   return tree;
// };
//工艺新增确定
const addgyenterDialog = () =>{
  const formattedData = {
    Gy0_cpdh: _Gd_gdbh.value,
    Gy0_方案: add_gyformData['Gy0_方案'],
    Gy0_yjno: add_gyformData['Gy0_yjno'],
    Gy0_gxh: add_gyformData['Gy0_gxh'],
    Gy0_Ks: add_gyformData['Gy0_Ks'],
    Gy0_ls: add_gyformData['Gy0_ls'],
    Gy0_site: add_gyformData['Gy0_site'],
    gy0_gxmc: add_gyformData['gy0_gxmc'],
    Add_gxmc: add_gyformData['Add_gxmc'],
    Gy0_Ms: add_gyformData['Gy0_Ms'],
    Gy0_sbbh: add_gyformData['Gy0_sbbh'],
    Gy0_shdh: add_gyformData['Gy0_shdh'],
    工价系数: add_gyformData['难度系数'],
    损耗系数: add_gyformData['损耗系数'],
    工序备注:add_gyformData['工序备注'],
    质量要求: add_gyformData['质量要求'],
    质量隐患: add_gyformData['质量隐患'],
    Sys_id  : _username.value,
    // 万小张: add_yjzlformdata['万小张'],
  };
 
  if(typeGy.value == 'create'){
	  addProductGyInfo(formattedData).then( result =>{
	  	  if(result.code===0){
	  	  	ElMessage({
	  	  	  type: 'success',
	  	  	  message: '成功'
	  	  	})
	  	    GetInfo();
	  	    addgydialogFormVisible.value = false
	  	   Object.keys(add_gyformData).forEach(key => {
	  	  		add_gyformData[key] = '';
	  	  	  });
	  	  }else{
	  	  	ElMessage({
	  	  	  type: 'error',
	  	  	  message: '失败'
	  	  	})
	  	  }
	  })
  }else{
	  formattedData['UniqID'] = add_gyformData['UniqID']
	  ProcessEdit(formattedData).then( editdata =>{
	  	  if (editdata.code == 0) {
	  	    ElMessage({type: 'success',message: '更新成功'})
	  	  	addgydialogFormVisible.value = false
	  	  	GetInfo()
	  	  } else {
	  	    ElMessage({ type: 'error',message: '更新失败'})
	  	  }
	  });
  }
}
//新增后刷新
const GetInfo = async () => {
  const res = await getProductData({product_code:_product_code.value});
  console.log(res)
  console.log(res.data.gyData)
  const processedData = res.data.gyData.map(item => {
    return {
      ...item,
      combinedProp: item.Gy0_yjno + '--'+item.Gy0_gxh,
      combinedProp2: item.gy0_gxmc + '-'+item.add_gxmc,
      combinedProp3: item.Gy0_Ks + '*'+item.Gy0_ls
    };
  });
  yjtableData.splice(0, yjtableData.length, ...res.data.yjData);
  gytableData.splice(0, gytableData.length, ...processedData);
  ybtableData.splice(0, ybtableData.length, ...res.data.ybData);
  jstableData.splice(0, jstableData.length, ...res.data.jsData);
  if(yjtableData.length==0){
    yjzuidahaoma.value = 1
  }else{
    let tmp = yjtableData.map(item => item.yj_yjno)
    tmp = tmp.sort((a,b)=>b-a)
    yjzuidahaoma.value = Number(tmp[0]) + 1
  }
}
//工艺新增取消
const addgycloseDialog = () => {
  addgydialogFormVisible.value = false
}
//=========新增印版资料========
const addybdialogFormVisible = ref(false);
const addybdisplay = ref(false);
const addyb_keyword = ref('');
const getYBListdata = ref([]);
const addybdisplaydata = reactive({
  chbm: '',
  chbmNameOptions: [],
});
const add_ybformDataTest = reactive({
  gongxu: '',
  gongxuNameOptions: [],
  YB_方案: '',
  YB_Yjno: '',
  YB_gxh: '',
  YB_gymc: '',
  YB_gxmc: '',
  物料代码: '',
  物料名称: '',
  ybbz: '',
  gxmc1: '',
});

const addyb_onclick = async () => {
  console.log(_UniqID.value)
  console.log(_Gd_gdbh.value)
  console.log(ybID.value)
  // if (ybID.value === '' || ybID.value === undefined || ybID.value === null) {
    // ElMessage({ type: 'warning', message: '请选择具体的工单后，再操作此功能' });
    // return false;
  // } else {
    addybdialogFormVisible.value = true;

    const getProductYbInfo_list = await getProductYbInfo({ UniqID: _UniqID.value });
    console.log(getProductYbInfo_list)
  if(getProductYbInfo_list.code == 0){
    add_ybformDataTest.gxmc1 = getProductYbInfo_list.data['印版名称'];
    add_ybformDataTest.YB_方案 = getProductYbInfo_list.data['YB_方案'];
    add_ybformDataTest.YB_Yjno = getProductYbInfo_list.data['YB_Yjno'];
    add_ybformDataTest.YB_gxh = getProductYbInfo_list.data['YB_gxh'];
    add_ybformDataTest.YB_gymc = getProductYbInfo_list.data['印版名称'];
    add_ybformDataTest.YB_gxmc = getProductYbInfo_list.data['YB_gxmc'];
    add_ybformDataTest.物料代码 = getProductYbInfo_list.data['存货编码'];
    add_ybformDataTest.物料名称 = getProductYbInfo_list.data['物料名称'];
    add_ybformDataTest.ybbz = getProductYbInfo_list.data['印版备注'];
    add_ybformDataTest.gongxuNameOptions = getProductYbInfo_list.data.gy_data.map(item => item.gy);
  }

  // }
};

//点击下拉框获取数据方案、印件、编号、工艺名称、工序名称
const ongongxufanclick = async (v) => {
  add_ybformDataTest.YB_方案 = add_ybformDataTest.gongxu.split('-->')[0];
  add_ybformDataTest.YB_Yjno = add_ybformDataTest.gongxu.split('-->')[1].split('-')[0];
  add_ybformDataTest.YB_gxh = add_ybformDataTest.gongxu.split('-->')[1].split('-')[1].split('-')[0].split(' ')[0];
  add_ybformDataTest.YB_gymc = add_ybformDataTest.gongxu.split('-->')[1].split('-')[1].split('-')[0].split(' ')[1];
  add_ybformDataTest.YB_gxmc = add_ybformDataTest.gxmc1;
  // addybdialogFormVisible.value = false;
};

//新增印版资料确定
const addtbenterDialog = async () => {
  // console.log(add_ybformDataTest)
  if(add_ybformDataTest.YB_方案 === '' || add_ybformDataTest.YB_方案 === undefined){
    ElMessage({type: 'warning',message: '工艺方案不能为空'})
    return false;
  }
  if(add_ybformDataTest.物料代码 === '' || add_ybformDataTest.物料代码 === undefined){
    ElMessage({type: 'warning',message: '存货编码不能为空'})
    return false;
  }
  const formattedData = {
    YB_Cpdh: _Gd_gdbh.value,
    YB_方案: add_ybformDataTest.YB_方案 ,
    YB_Yjno: add_ybformDataTest.YB_Yjno,
    YB_gxh: add_ybformDataTest.YB_gxh,
    存货编码: add_ybformDataTest.物料代码,
    印版名称: add_ybformDataTest.物料名称,
    Sys_id: _username.value,
    // 印版备注: add_ybformDataTest.ybbz,
  };
  console.log(formattedData)
  const addProductYbInfo_add = await addProductYbInfo(formattedData);
  if(addProductYbInfo_add.code === 0) {
    ElMessage({type: 'success',message: '更新成功'})
    addybdialogFormVisible.value = false;
  } else {
    ElMessage({type: 'error',message: '更新失败' })
  }
};
//新增印版资料取消
const addtbcloseDialog = async () => {
  addybdialogFormVisible.value = false;
};

//新增印版资料弹窗 键盘 input框跳转
const add_ybzlent = async (event,id1,id2,id3) => {
  if (id2==='YB_gxmc' && event.key==='Tab' || id2 === 'YB_gxmc' && event.key=== 'Enter') {
    addybdisplay.value = true
    addyb_keyword.value = '';
    await _getProductYbMaterialList();
  }
  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()
    }
  }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 addyb_searchHandle = async () => {
  await _getProductYbMaterialDetail();
};
//3.11印版资料-获取存货名称列表
const _getProductYbMaterialList = async () => {
  const getProductYbMaterialList_list = await getProductYbMaterialList();
  //默认取第一个数据
  addybdisplaydata.chbm = getProductYbMaterialList_list.data[0]['编号'] + "【" + getProductYbMaterialList_list.data[0]['名称'] + "】";
  addybdisplaydata.chbmNameOptions = getProductYbMaterialList_list.data.map(item=>{
    return `${item.编号}【${item.名称}】`
  });
};

//点击下拉框获取输入框的值
const onybzlfanclick = async () => {
  await _getProductYbMaterialDetail();
}

const addyb_selectSHNode = async (v) => {
  console.log(v.物料代码)
  if(v.物料名称){
    add_ybformDataTest.物料代码 = v.物料代码
    add_ybformDataTest.物料名称 = v.物料名称
    addybdisplay.value = false
  }
}

//点击下拉框获取输入框的值
const _getProductYbMaterialDetail = async () => {
  const code = addybdisplaydata.chbm.split('【')[0];
  console.log(code)
  console.log(addyb_keyword.value)
  const getProductYbMaterialDetail_list = await getProductYbMaterialDetail({code:code,search:addyb_keyword.value});
  getYBListdata.value = Object.keys(getProductYbMaterialDetail_list.data).map((key)=>({
    label:key,
    children: Object.keys(getProductYbMaterialDetail_list.data[key]).map((keys)=>({
      label:keys,
      children:Object.keys(getProductYbMaterialDetail_list.data[key][keys]).map((keyss)=>({
        label:keyss,
        children:getProductYbMaterialDetail_list.data[key][keys][keyss].map(item=>({
          label:`${item.物料代码}/${item.物料名称}/${item.规格}`,
          物料代码:item.物料代码,
          物料名称:item.物料名称,
        }))
      }))
    }))
  }))
}

//=========mes同步========
const messtatuslist = ref(false)
const mesformDataTest = reactive({
  gdbh:'',
})
const mestb_oncilck = async () => {
  messtatuslist.value = true;
}
//确定
const meshandleConfirm = async () => {
  // const formattedData = {
  //   productCode: mesformDataTest['gdbh'],
  //   sys_id: _username.value,
  // }
  // console.log(formattedData)
  const ProductDetailData_add = await ProductDetailData({productCode: mesformDataTest['gdbh'],sys_id: _username.value})
  console.log(ProductDetailData_add)
  // if (ProductDetailData_add.code === 0) {
  //   ElMessage({type: 'success',message: '更新成功'})
  // } else {
  //   ElMessage({ type: 'error',message: '更新失败'})
  // }
  // messtatuslist.value = false;
}
//取消
const meshandleCancel = async () => {
  messtatuslist.value = false;
}

//=========修改工艺资料========
let gyformDataTest = reactive({})
const _gyrow = ref('')
const clickybupdate = async (row) => {
	console.log(row)
	_gyrow.value = row 
}

//双击修改
const gyupdateCompanyFunc = async (row) => {
  //3.6工艺资料-获取产品工艺资料
  const getProductGyInfo_edit = await getProductGyInfo({UniqID:row.UniqID})
  
  Object.assign(add_gyformData,getProductGyInfo_edit.data);
  console.log(add_gyformData)
  typeGy.value = 'update'
  addgydialogFormVisible.value = true;
};
//=========印版修改========
let ybformDataTest = reactive({})
//双击修改
const ybupdateCompanyFunc = async (row) => {
  console.log(ybformDataTest)
  console.log(row)
  Object.assign(ybformDataTest,row);
  // ybformDataTest = row;
  ybdialogFormVisible.value = true;
};
const ybID=ref()
//双击修改
const ybClick = async (row) => {
  console.log(row.UniqID)
  ybID.value=row.UniqID
};
// 弹窗
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 (id2==='车间名称' && event.key==='Tab' || id2 === '车间名称' && event.key=== 'Enter') {
		_getCJList()
	}
  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 getKlKs = () =>{
	ProductgetCouplet({ product:_Gd_gdbh.value,yjno:add_gyformData.Gy0_yjno}).then( response => {
		if(response.code==0){
			if(response.data){
				add_gyformData.Gy0_Ks = response.data['开数']
				add_gyformData.Gy0_ls = response.data['联数']
			}else{
				add_gyformData.Gy0_Ks = ''
				add_gyformData.Gy0_ls = ''
			}
			
		}
	});
}
// const  _yjdh = ref(null);
const yj_ent = (event,id1,id2,id3) => {
  // if(event.keyCode == 13){
  //   if(yjformDataTest['yj_yjdh']){
  //     _getProductDatat()
  //   }
  // }
  if ( 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';
  }
}

//点击技术附件按钮
const jsfjClick = () => {
	if(_Gd_gdbh.value == null){
	  cgugdlist.value = false;
	  ElMessage({type: 'warning',message: '请选择具体的工单后，再操作此功能'})
	}else{
	  initJsfjformdata();
	  jsfjformdata.value.关联产品 = _Gd_gdbh.value
	  jsfjdialogFormVisible.value = true
	}
}
//技术附件弹窗
const jsfjdialogFormVisible = ref(false)
const jsfjformdata = ref({
	sys_id: _username.value,
	序号: '',
	附件备注: '',
	附件内容: '',
	附件类型: '',
	适用工序: '',
	关联产品: '',
});
//技术附件弹窗取消
const initJsfjformdata = () => {
  jsfjformdata.value = {
	sys_id: _username.value,
	序号: '',
	附件备注: '',
	附件内容: '',
	附件类型: '',
	适用工序: '',
	关联产品: '',
  }
}
//技术附件弹窗取消
const jsfjcloseDialog = () => {
  jsfjdialogFormVisible.value = false
}
const uploadExcel = (event) =>{
	const files = event.target.files;
	let suffixArr = name.split("."), suffix = suffixArr[suffixArr.length-1];
	// if(suffix!="xlsx"){
	// 	alert("Currently only supports the import of xlsx files");
	// 	return;
	// }
	jsfjformdata.value.附件内容 = files[0]
	jsfjformdata.value.附件类型 = 'XLSX'
}

const yulan = (event) =>{
	if(!jsfjformdata.value.附件内容) return
	$.getScript('/luckysheet/plugins/js/plugin.js', () => {
			$script('/luckysheet/luckysheet.umd.js', () => {
			luckyexcelVisible.value = true
			LuckyExcel.transformExcelToLucky(jsfjformdata.value.附件内容, function(exportJson, luckysheetfile){
				if(exportJson.sheets==null || exportJson.sheets.length==0){
					alert("Failed to read the content of the excel file, currently does not support xls files!");
					return;
				}
				if(luckyExcel) luckyExcel.destroy();
				luckysheet.create({
					container: 'luckyexcel', //容器的ID
					data: exportJson.sheets,
					title: exportJson.info.name, // 工作簿名称
					lang: "zh", // 设定表格语言 国际化设置，允许设置表格的语言，支持中文("zh")和英文("en")
					showtoolbar: false, // 是否显示工具栏
					showinfobar: false, // 是否显示顶部信息栏
					allowEdit: false, // 是否允许前台编辑
					enableAddRow: false, // 允许增加行
					enableAddCol: false, // 允许增加列
					userInfo: false, // 右上角的用户信息展示样式
					showRowBar: false, // 是否显示行号区域
					showColumnBar: false, // 是否显示列号区域
					sheetFormulaBar: false, // 是否显示公式栏
					enableAddBackTop: false,//返回头部按钮
				});
				luckyExcel = luckysheet;
			})
		})
		})
		$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/css/pluginsCss.css'));
		$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/plugins.css'));
		$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/css/luckysheet.css'));
		$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/assets/iconfont/iconfont.css'));

}
const jsfj_del = (row) =>{
	ElMessageBox.confirm('确定要删除吗?', '提示', {
	    confirmButtonText: '确定',
	    cancelButtonText: '取消',
	    type: 'warning'
	}).then(() => {
		annexDel({'UniqId':row.UniqId,'cpdh':_Gd_gdbh.value}).then(response => {
			 if(response.code==0){
				 ElMessage({
				   type: 'success',
				   message: '删除成功',
				 })
				 let row = {
					 'UniqID':_UniqID.value,
					 '产品编号':_product_code.value,
					 '产品名称':_kehu_code.value,
				 }
				 tableRowClick (row)
			  }
		   })
	})

}

//技术附件弹窗确定
const jsfjenterDialog = () => {
	if(jsfjformdata.value.序号==''){
		ElMessage({
			type: 'error',
			message: '请填写序号'
		});
		return;
	}
	if(jsfjformdata.value.附件备注==''){
		ElMessage({
			type: 'error',
			message: '请填写附件备注'
		});
		return;
	}
	if(jsfjformdata.value.附件内容==''){
		ElMessage({
			type: 'error',
			message: '请上传文件'
		});
		return;
	}
	if(jsfjformdata.value.适用工序==''){
		ElMessage({
			type: 'error',
			message: '请填写适用工序'
		});
		return;
	}
	if(jsfjformdata.value.关联产品==''){
		ElMessage({
			type: 'error',
			message: '请填写关联产品'
		});
		return;
	}

	let fr = new FileReader();
	fr.readAsDataURL(jsfjformdata.value.附件内容);
	fr.onload = function () {
	  const restoredData = new FormData();
	  restoredData.append('sys_id', jsfjformdata.value.sys_id);
	  restoredData.append('序号', jsfjformdata.value.序号);
	  restoredData.append('附件备注', jsfjformdata.value.附件备注);
	  restoredData.append('附件内容', fr.result);
	  restoredData.append('附件类型', jsfjformdata.value.附件类型);
	  restoredData.append('适用工序', jsfjformdata.value.适用工序);
	  restoredData.append('关联产品', jsfjformdata.value.关联产品);

	   annexAdd(restoredData).then(response => {
		 if(response.code==0){
			 ElMessage({
			   type: 'success',
			   message: '新增成功',
			 })
			 jsfjdialogFormVisible.value = false
			 let row = {
				 'UniqID':_UniqID.value,
				 '产品编号':_product_code.value,
				 '产品名称':_kehu_code.value,
			 }
			 tableRowClick (row)
		 }
	   })
	}
}

//技术资料excel展示
const ExcelShow = (row) =>{
	if(!row.附件内容) return
	$.getScript('/luckysheet/plugins/js/plugin.js', () => {
		$script('/luckysheet/luckysheet.umd.js', () => {
					console.log(row.附件内容)
					function dataURLtoBlob(dataUrl) {
					    const byteString = atob(dataUrl.split(',')[1]);
					    const ab = new ArrayBuffer(byteString.length);
					    const ia = new Uint8Array(ab);

					    for (let i = 0; i < byteString.length; i++) {
					        ia[i] = byteString.charCodeAt(i);
					    }

					    return new Blob([ab], { type: 'application/octet-stream' });
					}

					const blob = dataURLtoBlob(row.附件内容);
					luckyexcelVisible.value = true
					LuckyExcel.transformExcelToLucky(blob, function(exportJson, luckysheetfile){
						if(exportJson.sheets==null || exportJson.sheets.length==0){
							alert("Failed to read the content of the excel file, currently does not support xls files!");
							return;
						}
						if(luckyExcel) luckyExcel.destroy();
						luckysheet.create({
							container: 'luckyexcel', //容器的ID
							data: exportJson.sheets,
							title: exportJson.info.name, // 工作簿名称
							lang: "zh", // 设定表格语言 国际化设置，允许设置表格的语言，支持中文("zh")和英文("en")
							showtoolbar: false, // 是否显示工具栏
							showinfobar: false, // 是否显示顶部信息栏
							allowEdit: false, // 是否允许前台编辑
							enableAddRow: false, // 允许增加行
							enableAddCol: false, // 允许增加列
							userInfo: false, // 右上角的用户信息展示样式
							showRowBar: false, // 是否显示行号区域
							showColumnBar: false, // 是否显示列号区域
							sheetFormulaBar: false, // 是否显示公式栏
							enableAddBackTop: false,//返回头部按钮
						});
						luckyExcel = luckysheet;
					})
		})
	})
	$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/css/pluginsCss.css'));
	$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/plugins/plugins.css'));
	$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/css/luckysheet.css'));
	$('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', '/luckysheet/assets/iconfont/iconfont.css'));

}

let luckyExcel = null

const luckyexcelVisible = ref(false)
const luckyexcelCloseDialog = () => {
  luckyexcelVisible.value = false
}
/**
 * 只读版luckyExcel 创建
 */
const createROLuckyExcel = (files) => {
	LuckyExcel.transformExcelToLucky(files, function (exportJson, luckysheetfile) {
		if (exportJson.sheets == null || exportJson.sheets.length == 0) {
		  alert("Failed to read the content of the excel file, currently does not support xls files!");
		  return;
		}
		if(luckyExcel) luckyExcel.destroy();
			nextTick(() => {
				$(function () {
					luckysheet.create({
						container: 'luckyexcel', //容器的ID
						data: exportJson.sheets,
						title: exportJson.info.name, // 工作簿名称
						lang: "zh", // 设定表格语言 国际化设置，允许设置表格的语言，支持中文("zh")和英文("en")
						// allowCopy: false, // 是否允许拷贝
						showtoolbar: false, // 是否显示工具栏
						showinfobar: false, // 是否显示顶部信息栏
						// showsheetbar: false, // 是否显示底部sheet页按钮
						// showstatisticBar: false, // 是否显示底部计数栏
						// sheetBottomConfig: false, // sheet页下方的添加行按钮和回到顶部按钮配置
						allowEdit: false, // 是否允许前台编辑
						enableAddRow: false, // 允许增加行
						enableAddCol: false, // 允许增加列
						userInfo: false, // 右上角的用户信息展示样式
						showRowBar: false, // 是否显示行号区域
						showColumnBar: false, // 是否显示列号区域
						sheetFormulaBar: false, // 是否显示公式栏
						enableAddBackTop: false,//返回头部按钮
						// rowHeaderWidth: 0,//纵坐标
						// columnHeaderHeight: 0,//横坐标
						// showstatisticBarConfig: {
						// count:false,
						// view:false,
						// zoom:false,
						// },
						// showsheetbarConfig: {
						// add: false, //新增sheet
						// menu: false, //sheet管理菜单
						// sheet: false, //sheet页显示
						// },
						// hook: {
						// cellMousedown:this.cellMousedown,//绑定鼠标事件
						// },
						// forceCalculation: true,//强制计算公式
					});
					luckyExcel = luckysheet;
				});
			});

	})
}
</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>
