<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" clearable placeholder="搜索工单编号" style="width: 180px;"></el-input>
            <el-button type="primary"  icon="search" @click="onSubmit"></el-button>
            <el-button type="primary"  icon="edit"   @click="ontlssclick"       class="bt">U8投料试算</el-button>
            <el-button type="primary"  icon="edit"   @click="onyycpzlclick"     class="bt">引用产品资料</el-button>
            <el-button type="primary"  icon="edit"   @click="oneditgxclhsclick" class="bt">工序产量核算</el-button>
            <el-button type="primary"  icon="edit"   @click="oneditgylctzclick" class="bt">工艺流程调整</el-button>
            <el-button type="primary"  icon="edit"   @click="oneditugdclick"    class="bt">查改U8工单</el-button>
            <!--<el-button type="primary" disabled icon="edit" @click="oneditztfwclick" class="bt">状态复位</el-button>-->
            <el-button type="primary"  icon="edit"   @click="onxzhscsclick"     class="bt">修正核算参数</el-button>
            <el-button type="primary"  icon="edit"   @click="onzjfpxsclick"     class="bt">质检废品系数</el-button>
          </el-form-item>
        </el-form>

<!--按钮弹窗部分-->
        <!--U8投料试算-->
        <el-dialog v-model="tlsslist"     title="U8投料试算"   style="height: 100%;width: 100%;margin: 0;padding: 0">
          <el-button type="primary" icon="" disabled @click="ontlssclicks" class="bt">投料试算</el-button>
          <el-button type="primary" icon="" disabled @click="onbxgxclicks" class="bt">备选工序</el-button>
          <el-button type="primary" icon="" disabled @click="onsjgxclicks" class="bt">实际工序</el-button>
          <el-button type="primary" icon="" @click="oncloneclick" style="margin: 5px">退出</el-button>
          <div style="width: 100%; height: 60px; padding: 0px; margin: 10px 0px 0px 0px; display: flex; align-items: center;">
            <!-- 第一行 -->
            <el-form-item class="mab" label="产品代码 :" prop="currentProcess">
              <el-input v-model="tlssformData['cpdh']" @keyup.enter="tlssgetProductValue" placeholder="" style="width: 200px;"/>
              <el-input v-model="tlssformData['cpmc']" disabled placeholder="" style="width: 700px;"/>
            </el-form-item>
          </div>
          <div style="display: flex; align-items: center; margin: 0px; padding: 0px;">
            <!-- 第二行 -->
            <el-form-item class="mab" label="成品张数 :" prop="currentProcess" style="margin-right: 10px;">
              <el-input disabled v-model="tlssformData['cpzs']" @keyup.enter="tlsscpzsgetProductValue" />
            </el-form-item>
            <el-form-item class="mab" label="主印投料大张数 :" prop="currentProcess" style="margin-right: 10px;">
              <el-input disabled v-model="tlssformData['zytldzs']" style="width: 130px;" />
            </el-form-item>
            <el-form-item class="mab" label="目标合格率 :" prop="currentProcess" style="margin-right: 10px;">
              <el-input disabled v-model="tlssformData['mbhgl']" style="width: 130px;" />
            </el-form-item>
            <el-form-item class="mab" label="损耗数 :" prop="currentProcess" style="margin-right: 10px;">
              <el-input disabled v-model="tlssformData['shs']" style="width: 130px;" />
            </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: 65vh;" border tooltip-effect="dark"
                    :data="tlsstableData" row-key="ID" @selection-change="handleSelectionChange">
            <!--                    <el-table-column type="selection" width="55" />-->
            <el-table-column v-slot="scope" align="left" label=备选工序 width="100" >
              <el-input disabled :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=印件号 width="80" >
              <el-input disabled  v-model="scope.row.印件号" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=工序号 width="80" >
              <el-input disabled  v-model="scope.row.工序号" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=工序名称 width="390" >
              <el-input disabled  v-model="scope.row.工序名称" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=墨色数 width="100" >
              <el-input disabled  v-model="scope.row.墨色数" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=损耗代号 width="120" >
              <el-input disabled  v-model="scope.row.损耗代号" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=调机损耗 width="100" >
              <el-input disabled  v-model="scope.row.调机损耗" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=运行损耗率 width="120" >
              <el-input disabled  v-model="scope.row.运行损耗率" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=损耗系数 width="100" >
              <el-input disabled  v-model="scope.row.损耗系数" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=加工联数 width="100" >
              <el-input disabled  v-model="scope.row.加工联数" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=工序接货数 width="100" >
              <el-input disabled   :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=工序损耗 width="100" >
              <el-input disabled   :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=工序成品数 width="100" >
              <el-input disabled   :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=工序损耗率 width="100" >
              <el-input disabled  :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=产品代号 width="130" >
              <el-input disabled  v-model="scope.row.产品代号" :clearable="false"/>
            </el-table-column>
          </el-table>
        </el-dialog>

        <!--印用产品资料-->
        <el-dialog v-model="onyycpzllist" title="获取产品资料"  style="width: 45%;height: 45%;">
          <div style=" padding: 0px; align-items: center;">
            <el-form-item label="工单编号" prop="processName" class="mab">
              <el-input v-model="yycpzlformData['gdbh']" @keyup.enter="yycpzlProductValue" placeholder="" style="width: 23%;" />
            </el-form-item>
            <el-form-item label="客户代号" prop="processName" class="mab">
              <el-input v-model="yycpzlformData['khdh']" disabled  placeholder="" />
              <el-input v-model="yycpzlformData['khmc']" disabled  placeholder="" style="width: 320px;" />
            </el-form-item>
            <el-form-item label="产品代号" prop="processName" class="mab" >
              <el-input v-model="yycpzlformData['cpdh']"  disabled placeholder="" style="width: 23%;" />
            </el-form-item>
            <el-form-item label="产品名称" prop="processName" class="mab" >
              <el-input v-model="yycpzlformData['cpmc']" disabled  placeholder="" style="width: 69%; height: 70px" type="textarea" rows="2" :resize="false" />
            </el-form-item>
            <el-form-item label="创建选择" class="mab" >
                <div>
                  <el-checkbox disabled v-model="yycpzlformData['yjzl']">获取印件资料</el-checkbox>
                  <el-checkbox disabled v-model="yycpzlformData['gyap']">获取工艺安排</el-checkbox>
                </div>
<!--                <el-form-item label="工艺方案" prop="processName">-->
<!--                  <el-input v-model="yycpzlformData['gyfa']"  placeholder="" />-->
<!--                </el-form-item>-->
            </el-form-item>
          </div>

          <div slot="footer" class="dialog-footer" style="text-align: right;margin-left: 25%">
              <el-button @click="yycpzlhandleCancel">放弃</el-button>
              <el-button type="primary" @click="yycpzlhandleConfirm">执行</el-button>
            </div>
        </el-dialog>

        <!--工序产量核算-->
        <el-dialog v-model="gxclhslist"   title="印件投料核算"  style="width: 20%;position: fixed; bottom: 35%; left: 35%">
          <div style="display: flex; flex-direction: column;  height: 100%;">
            <el-form-item label="工单编号:" prop="process" class="mab">
              <el-input v-model="gxclhsformData['gdbh']"  :clearable="true" placeholder="" style="width: 160px;"/>
            </el-form-item>
            <div class="dialog-footer" style="margin-top: 20px; text-align: right ">
              <el-button @click="gxclhshandleCancel">取消</el-button>
              <el-button type="primary" disabled @click="gxclhshandleConfirm">确定</el-button>
            </div>
          </div>
        </el-dialog>

        <!--工艺流程调整-->
        <el-dialog v-model="gylctzlist"   title="工艺方案附加"  style="width: 100%;height: 100%;margin: 0px;padding: 0px">
          <el-button type="primary" disabled @click="gylctz_gxdqcpgx" style="margin: 5px;">更新当前产品工序</el-button>
          <el-button type="primary"  @click="gylctz_fjbzgx" style="margin: 5px;">附加标准工序</el-button>

          <!--工艺流程调整中 附加标准工序-->
          <el-dialog v-model="gdzlfjxx" title="工单工艺流程附加选择"  style="width: 80%;height:80%;bottom: 3%;">
            <div><el-button  type="primary" @click="addGongyiAttach" :disabled="attachList.length === 0">执行</el-button></div>
            <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" class="mab">
                  <el-input v-model="gdzlfjxxformData['cpdh']" disabled placeholder="" />
                  <el-input v-model="gdzlfjxxformData['cpmc']" disabled placeholder="" />
                </el-form-item>
                <el-form-item label="工单编号:" prop="originalName"  class="mab">
                  <el-select v-model="gdzlfjxxformData.cpgyfan" placeholder="请选择" allow-create filterable >
                    <el-option v-for="option in gdzlfjxxformData.cpgyfans" @click="ongdzlfanclick" :key="option" :label="option" :value="option" />
                  </el-select>
                </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: 57vh" border tooltip-effect="dark"
                        :data="gdzlfjxxtableData" row-key="ID" @selection-change="attachChange">
                <el-table-column type="selection" width="55" />
                <el-table-column v-slot="scope" align="left" label="方案" width="80">
                  <el-input disabled v-model="scope.row.方案" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="印件号" width="80">
                  <el-input disabled v-model="scope.row.印件号" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="工序号" width="100">
                  <el-input disabled v-model="scope.row.工序号" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="工序名称" width="340">
                  <el-input disabled v-model="scope.row.工序名称" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="工价系数" width="100">
                  <el-input disabled v-model="scope.row.工价系数" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="损耗系数" width="100">
                  <el-input disabled v-model="scope.row.损耗系数" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="开数" width="80">
                  <el-input disabled v-model="scope.row.ks" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="联数" width="80">
                  <el-input disabled v-model="scope.row.ls" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="备注" width="100">
                  <el-input disabled v-model="scope.row.备注" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="车间" width="120">
                  <el-input disabled v-model="scope.row.车间" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="设备编号" width="100">
                  <el-input disabled v-model="scope.row.设备编号" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="设备名称" width="100">
                  <el-input disabled v-model="scope.row.设备名称" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="建档用户" width="160">
                  <el-input disabled v-model="scope.row.建档用户" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="建档时间" width="160">
                  <el-input disabled v-model="scope.row.建档时间" :clearable="false"/>
                </el-table-column>
                <el-table-column v-slot="scope" align="left" label="更新时间" width="160">
                  <el-input disabled v-model="scope.row.更新时间" :clearable="false"/>
                </el-table-column>
              </el-table>



            </div>
          </el-dialog>


          <el-button type="primary" @click="gylctzhandleCancel" style="margin: 5px">放弃操作</el-button>
          <div>
            <div style="align-items: center;">
              <el-form-item label="当前工单:" prop="currentProcess">
                <el-input v-model="gylctzformData['gdbh']"  @keyup.enter="gylctzProductValue"  placeholder="" style="width: 160px;margin: 10px"/>
                <el-input v-model="gylctzformData['gddh']"  disabled  placeholder="" style="width: 170px;margin-left: 10px;margin: 10px"/>
                <el-input v-model="gylctzformData['gdmc']"  disabled  placeholder="" style="width: 340px;margin-left: 10px;margin: 10px"/>
              </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="gylctztableData" row-key="ID" @selection-change="handleSelectionChange">
              <el-table-column v-slot="scope" align="left" label="方案" width="80">
                <el-input disabled v-model="scope.row.方案" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="印件号" width="80">
                <el-input disabled v-model="scope.row.印件号" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="工序号" width="100">
                <el-input v-model="scope.row.工序号" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="工序名称" width="340">
                <el-input disabled v-model="scope.row.工序名称" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="工价系数" width="100">
                <el-input disabled v-model="scope.row.工价系数" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="损耗系数" width="100">
                <el-input disabled v-model="scope.row.损耗系数" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="开数" width="80">
                <el-input disabled v-model="scope.row.ks" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="联数" width="80">
                <el-input disabled v-model="scope.row.ls" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="备注" width="100">
                <el-input disabled v-model="scope.row.备注" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="车间" width="120">
                <el-input disabled v-model="scope.row.车间" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="设备编号" width="100">
                <el-input disabled v-model="scope.row.设备编号" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="设备名称" width="100">
                <el-input disabled v-model="scope.row.设备名称" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="建档用户" width="160">
                <el-input disabled v-model="scope.row.建档用户" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="建档时间" width="160">
                <el-input disabled v-model="scope.row.建档时间" :clearable="false"/>
              </el-table-column>
              <el-table-column v-slot="scope" align="left" label="更新时间" width="160">
                <el-input disabled v-model="scope.row.更新时间" :clearable="false"/>
              </el-table-column>
            </el-table>
          </div>
        </el-dialog>

        <!--查改U8工单-->
        <el-dialog v-model="cgugdlist"    title="查改U8工单"   style="width: 100%;height: 100%;margin: 0;padding: 0">

          <el-button type="primary"  icon=""  @click="oncgugdclickdel" :disabled="multipleSelection.length === 0" style="margin: 0px 0px 20px 0px">删除</el-button>
          <el-button type="primary"  icon="" @click="oncgugdcloneclick" style="margin: 0px 0px 20px 10px">退出</el-button>

          <div>
            <div style="width: 100%; padding: 0px; margin: 10px 0px 0px 0px; display: flex; align-items: center;margin: 0px 0px 20px 0px">
              <el-form-item label="当前工单:" prop="currentProcess" style="margin-right: 20px;padding: 0px">
                <el-input v-model="cgugdformData['gdbh']"  @keyup.enter="cgugdProductValue"  placeholder="" style="width: 160px;"/>
                <el-input v-model="cgugdformData['cpdh']"  disabled  placeholder="" style="width: 160px;margin-left: 10px"/>
                <el-input v-model="cgugdformData['gdmc']"  disabled  placeholder="" style="width: 340px;margin-left: 10px"/>
              </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' }"
                      highlight-current-row="true"
                      style="width: 100%; height: 74vh; margin: 0px;"
                      border tooltip-effect="dark"
                      :data="cgugdtableData" row-key="ID" @selection-change="cguzlgd_del">
              <el-table-column type="selection" width="55"/>
              <el-table-column align="left" label="工单编号" prop="工单编号" width="120"/>
              <el-table-column align="left" label="行号" prop="行号"/>
              <el-table-column align="left" label="客户代号" prop="客户代号"/>
              <el-table-column align="left" label="客户名称" prop="客户名称"/>
              <el-table-column align="left" label="成品代号" prop="成品代号"/>
              <el-table-column align="left" label="成品名称" prop="成品名称" width="340"/>
              <el-table-column align="left" label="获取日期" prop="获取日期"/>
              <el-table-column align="left" label="序号" prop="序号"/>
            </el-table>
          </div>
        </el-dialog>

        <!--修正核算参数-->
        <el-dialog v-model="xzhscslist"   title="修正核算参数"  style="width: 100%;height: 100%;margin: 0px;padding: 0px">

          <el-button type="primary"  @click="xzhscsConfirm">更新</el-button>
          <el-button type="" @click="sxzhscsCancel">退出</el-button>

          <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="xzhscsformData['gdbh']"
                        @keyup.enter="xzhscsgetProductValue" placeholder="" style="width: 500px;"/>
            </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="sxzhscstableData" row-key="ID" @selection-change="handleSelectionChange">
            <el-table-column v-slot="scope" align="left" label=方案 width="70" >
              <el-input disabled  v-model="scope.row.方案" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=印件号及工序名称 width="270" >
              <el-input disabled  v-model="scope.row.印件号及工序名称" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=参照设备 width="94" >
              <el-input disabled  v-model="scope.row.参照设备" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=难度系数 width="90" >
              <el-input disabled  v-model="scope.row.sxzhscsold_难度系数" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新难度系数 width="100" >
              <el-input   v-model="scope.row.难度系数" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原损耗代号 width="150" >
              <el-input disabled  v-model="scope.row.sxzhscsold_损耗代号" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=基础损耗 width="90" >
              <el-input disabled  v-model="scope.row.基础损耗" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=损耗率 width="100" >
              <el-input disabled  v-model="scope.row.损耗率" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新损耗代号 width="150" >
              <el-input  v-model="scope.row.损耗代号" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原印刷方式 width="100" >
              <el-input disabled  v-model="scope.row.sxzhscsold_印刷方式" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原来版距 width="90" >
              <el-input disabled  v-model="scope.row.sxzhscsold_版距" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新印刷方式 width="100" >
              <el-input   v-model="scope.row.印刷方式" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新来版距 width="90" >
              <el-input   v-model="scope.row.版距" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原计损色数 width="100" >
              <el-input disabled  v-model="scope.row.sxzhscsold_计损色数" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=计损色数 width="90" >
              <el-input   v-model="scope.row.计损色数" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原损耗系数 width="100" >
              <el-input disabled  v-model="scope.row.sxzhscsold_损耗系数" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=损耗系数 width="90" >
              <el-input   v-model="scope.row.损耗系数" :clearable="false"/>
            </el-table-column>
          </el-table>
        </el-dialog>

        <!--质检废品系数-->
        <el-dialog v-model="scfjfpxslist" title="质检废品系数"  style="width: 100%;height: 100%;margin: 0px;padding: 0px">
          <el-button type="primary"  @click="scfjfpxsConfirm">更新</el-button>
          <el-button type="" @click="scfjfpxsCancel">退出</el-button>
          <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="scfjfpxsformData['cpdh']"
                        @keyup.enter="scfjfpxsgetProductValue" placeholder="" style="width: 500px;"/>
            </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="scfjfpxstableData" row-key="ID" @selection-change="handleSelectionChange">
            <el-table-column v-slot="scope" align="left" label=产品编号 width="120" >
              <el-input disabled  v-model="scope.row.产品编号" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=产品名称 width="200" >
              <el-input disabled  v-model="scope.row.产品名称" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=印件工序及工艺 width="220" >
              <el-input disabled  v-model="scope.row.印件工序及工艺" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原人工正品板 width="110" >
              <el-input disabled  v-model="scope.row.scfjfpxsold_人工正品板" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原人工次品板 width="110" >
              <el-input disabled  v-model="scope.row.scfjfpxsold_人工次品板" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原人工废检 width="110" >
              <el-input disabled  v-model="scope.row.scfjfpxsold_人工废检" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原机检正品板 width="110" >
              <el-input disabled  v-model="scope.row.scfjfpxsold_机检正品板" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原机检次品板 width="110" >
              <el-input disabled  v-model="scope.row.scfjfpxsold_机检次品板" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=原机检废检 width="110" >
              <el-input disabled  v-model="scope.row.scfjfpxsold_机检废检" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新人工正品板 width="110" >
              <el-input   v-model="scope.row.人工正品板" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新人工次品板 width="110" >
              <el-input   v-model="scope.row.人工次品板" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新人工废检 width="110" >
              <el-input   v-model="scope.row.人工废检" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新机检正品板 width="110" >
              <el-input   v-model="scope.row.机检正品板" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新机检次品板 width="110" >
              <el-input   v-model="scope.row.机检次品板" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=新机检废检 width="110" >
              <el-input   v-model="scope.row.机检废检" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=设备编号 width="100" >
              <el-input disabled  v-model="scope.row.设备编号" :clearable="false"/>
            </el-table-column>
            <el-table-column v-slot="scope" align="left" label=客户名称 width="200" >
              <el-input disabled  v-model="scope.row.客户名称" :clearable="false"/>
            </el-table-column>
          </el-table>
        </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.data"  @node-click="handleNodeClick"></el-tree>
        </div>
      </layout-sider>

<!-- 右侧内容区域 -->
      <layout-content >
        <el-main>
          <!-- 表格列表 -->
          <div class="gva-table-box">
            <el-table ref="multipleTable"
                      style="width: 100%;height: 30vh"
                      :row-style="{ height: '20px' }"
                      :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                      :header-cell-style="{ padding: '0px' }"
                      border
                      tooltip-effect="dark"
                      :data="tableData"
                      row-key="ID"
                      @row-click="tableRowClick"
                      highlight-current-row="true"
                      @row-dblclick="updateCompanyFunc"
                      @selection-change="handleSelectionChange"
                      :show-overflow-tooltip="true">
<!--              <el-table-column type="selection" width="55"/>-->
                <el-table-column align="left" label="工单编号" prop="工单编号"  width="90" />
                <el-table-column align="left" label="生产分类" prop="生产分类" width="90" />
                <el-table-column align="left" label="销售订单号" prop="销售订单号" width="100" />
                <el-table-column align="left" label="产品代号" prop="产品代号" width="100" />
                <el-table-column align="left" label="产品名称" prop="产品名称" width="370" />
                <el-table-column align="left" label="订单数量" prop="订单数量" width="100" />
                <el-table-column align="left" label="单位" prop="单位" />
                <el-table-column align="left" label="折合大箱" prop="折合大箱" width="90" />
                <el-table-column align="left" label="投料率" prop="投料率"  />
                <el-table-column align="left" label="平均合格率" prop="平均合格率" width="100" />
                <el-table-column align="left" label="开单日期" prop="开单日期" width="100" />
                <el-table-column align="left" label="交货日期" prop="交货日期" width="100" />
                <el-table-column align="left" label="工单类型" prop="工单类型" width="100" />
                <el-table-column align="left" label="工单状态" prop="工单状态" width="100" />
                <el-table-column align="left" label="当前生产工序" prop="当前生产工序" width="110" />
                <el-table-column align="left" label="产量提交时间" prop="产量提交时间" width="110" />
                <el-table-column align="left" label="建档用户" prop="建档用户" width="110" />
                <el-table-column align="left" label="建档时间" prop="建档时间" width="160" />
                <el-table-column align="left" label="更新时间" prop="更新时间" width="160" />
            </el-table>
            <!-- 分页 -->
<!--            <div class="gva-pagination">-->
<!--              <el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page"-->
<!--                             :page-size="pageSize" :total="total" :page-sizes="[10, 30, 50, 100]"-->
<!--                             @current-change="handleCurrentChange" @size-change="handleSizeChange" />-->
<!--            </div>-->

            <div class="gva-pagination">
              <el-pagination
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="page"
                  :page-sizes="[10, 30, 50, 100]"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="total">
              </el-pagination>
            </div>

<!--            <div class="gva-pagination">-->
<!--              <el-pagination layout="total" :current-page="page" :page-size="pageSize"-->
<!--                             :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />-->
<!--              &lt;!&ndash;              <el-pagination layout="total, sizes, prev, pager, next, jumper" :current-page="page" :page-size="pageSize" :page-sizes="[10, 30, 50, 100]"&ndash;&gt;-->
<!--              &lt;!&ndash;                             :total="total" @current-change="handleCurrentChange" @size-change="handleSizeChange" />&ndash;&gt;-->
<!--            </div>-->
<!--            -->


          </div>

          <!--  印件资料、工艺资料、BOM资料列表  -->
          <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="印件资料"  @click="showTable('印件资料')"  name="first">
              <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"
                        @row-dblclick="gdyjupdateCompanyFunc"
                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="yjtableData" row-key="ID" @selection-change="handleSelectionChange">
                <!--<el-table-column type="selection" width="55" />-->
                <el-table-column align="left" label="印件号" prop="印件号"  width="80"/>
                <el-table-column align="left" label="印件代号" prop="印件代号"  width="120"/>
                <el-table-column align="left" label="印件名称" prop="印件名称"  width="340"/>
                <el-table-column align="left" label="纸张代号" prop="纸张代号"  width="100"/>
                <el-table-column align="left" label="纸张名称" prop="纸张名称"  width="340"/>
                <el-table-column align="left" label="投料规格" prop="投料规格"  width="100"/>
                <el-table-column align="left" label="平张投料" prop="平张投料"  width="100"/>
                <el-table-column align="left" label="开料规格" prop="开料规格"  width="100"/>
                <el-table-column align="left" label="开数*联数" prop="开数*联数"  width="100"/>
                <el-table-column align="left" label="建档用户" prop="建档用户"  width="120"/>
                <el-table-column align="left" label="建档时间" prop="建档时间"  width="160"/>
                <el-table-column align="left" label="更新时间" prop="更新时间"  width="160"/>
              </el-table>
            </el-tab-pane>

            <el-tab-pane label="工艺资料" @click="showTable('工艺资料')" name="second">
              <el-table ref="multipleTable"
                        :row-style="{ height: '20px' }"
                        :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
                        :header-cell-style="{ padding: '0px' }"
                        highlight-current-row="true"
                        :show-overflow-tooltip="true"
                        size="small"
                        @row-dblclick="gdgyupdateCompanyFunc"
                        @row-click="clickybupdate2"
                        :row-class-name="rowClassStyle2"
                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="gytableData" row-key="ID" @selection-change="handleSelectionChange">
                <!-- <el-table-column type="selection" width="55" />-->
                <el-table-column align="left" label="重点工序" prop="重点工序"  width="100"/>
                <el-table-column align="left" label="印件-工序" prop="印件-工序"  width="100"/>
                <el-table-column align="left" label="备选工序" prop="备选工序"  width="100"/>
                <el-table-column align="left" label="工序名称" prop="工序名称"  width="340"/>
                <el-table-column align="left" label="计划产量" prop="计划产量"  width="100"/>
                <el-table-column align="left" label="基础损耗" prop="基础损耗"  width="100"/>
                <el-table-column align="left" label="报废定额" prop="报废定额"  width="100"/>
                <el-table-column align="left" label="允损比例" prop="允损比例"  width="100"/>
                <el-table-column align="left" label="难度系数" prop="难度系数"  width="100"/>
                <el-table-column align="left" label="损耗系数" prop="损耗系数"  width="100"/>
                <el-table-column align="left" label="人工检_次品板" prop="人工检_次品板"  width="160"/>
                <el-table-column align="left" label="人工检_废检" prop="人工检_废检"  width="160"/>
                <el-table-column align="left" label="机检_正品板" prop="机检_正品板"  width="160"/>
                <el-table-column align="left" label="机检_次品板" prop="机检_次品板"  width="160"/>
                <el-table-column align="left" label="机检_废检" prop="机检_废检"  width="100"/>
                <!--<el-table-column align="left" label="开数*联数" prop="开数*联数"  width="100"/>-->
                <el-table-column align="left" label="开数" prop="开数"  width="70"/>
                <el-table-column align="left" label="联数" prop="联数"  width="70"/>
                <el-table-column align="left" label="备注" prop="备注"  width="450"/>
                <el-table-column align="left" label="印刷方式" prop="印刷方式"  width="100"/>
                <el-table-column align="left" label="版距" prop="版距"  width="100"/>
                <el-table-column align="left" label="建档用户" prop="建档用户"  width="160"/>
                <el-table-column align="left" label="建档日期" prop="建档日期"  width="160"/>
                <el-table-column align="left" label="更新时间" prop="更新时间"  width="160"/>
                <el-table-column align="left" label="更新时间" prop="更新时间"  width="160"/>
              </el-table>
            </el-tab-pane>

            <el-tab-pane label="BOM资料" @click="showTable('BOM资料')" name="third">
              <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"
                        @row-dblclick="gdbomupdateCompanyFunc"
                        style="width: 100%;height: 40vh" border tooltip-effect="dark" :data="bomtableData" row-key="ID" @selection-change="handleSelectionChange">
                <el-table-column type="selection" width="55" />
                <el-table-column align="left" label="方案" prop="方案"  width="120"/>
                <el-table-column align="left" label="物料编号" prop="物料编号"  width="100"/>
                <el-table-column align="left" label="物料名称" prop="物料名称"  width="400"/>
                <el-table-column align="left" label="计划用量" prop="计划用量"  width="100"/>
                <el-table-column align="left" label="建档用户" prop="建档用户"  width="120"/>
                <el-table-column align="left" label="建档时间" prop="建档时间"  width="160"/>
                <el-table-column align="left" label="更新时间" prop="更新时间"  width="160"/>
                <el-table-column align="left" label="消耗定量" prop="消耗定量"  width="210"/>
              </el-table>
            </el-tab-pane>
          </el-tabs>

         <!-- 修改工单资料弹窗 -->
         <el-dialog v-model="dialogFormVisible" :before-close="closeDialog"
                    style="width: 80%;height: 750px;; bottom: 7%"
                    :title="'修改工单资料'" destroy-on-close>
           <el-row>
             <el-form :model="scgdformData" label-position="right" ref="elFormRef" :rules="rule" >
				        <!-- 第一排 -->
                <el-row :gutter="24">
                  <el-col :span="6">
                    <el-form-item label="重点工单:" prop="keyOrder">
                      <el-input v-model="scgdformData['重点工单']"  placeholder="" style="width: 180px;"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="6">
                    <el-form-item label="开单日期" prop="orderDate">
                      <el-date-picker v-model="scgdformData['开单日期']" type="date" placeholder=""  style="width: 280px;" />
                    </el-form-item>
                  </el-col>
                  <el-col :span="5">
                    <el-form-item label="工单编号:" prop="orderNumber">
                      <el-input v-model="scgdformData['工单编号']"  placeholder="" style="width: 140px;"/>
                    </el-form-item>
                  </el-col>
                  <el-col :span="5">
                    <el-form-item label="生产类型:" prop="productionType">
                      <el-input v-model="scgdformData['生产类型']" placeholder="" style="width: 140px;" />
                    </el-form-item>
                  </el-col>
                </el-row>
              <!-- 第二排 -->
              <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="客户代号:" prop="customerCode">
                <el-input v-model="scgdformData['客户代号']"  placeholder="" style="width: 180px;" />
                </el-form-item>
              </el-col>
              <el-col :span="16">
                <el-form-item label="客户名称:" prop="customerName">
                <el-input v-model="scgdformData['客户名称']"  placeholder=""  />
                </el-form-item>
              </el-col>
              </el-row>
              <!-- 第三排 -->
              <el-row :gutter="24">
              <el-col :span="6">
                <el-form-item label="产品代码:" prop="productCode">
                <el-input v-model="scgdformData['产品代号']"  placeholder="" style="width: 180px;"/>
                </el-form-item>
              </el-col>
              <el-col :span="16">
                <el-form-item label="产品名称:" prop="productName">
                <el-input v-model="scgdformData['产品名称']"  placeholder="" />
                </el-form-item>
              </el-col>
              </el-row>
              <!-- 第四排 -->
              <el-row :gutter="24">
                <el-col :span="6">
                  <el-form-item label="印件代码:" prop="customerCode">
                    <el-input v-model="scgdformData['印件代号']"  placeholder="" style="width: 180px;"/>
                  </el-form-item>
                </el-col>
                <el-col :span="16">
                  <el-form-item label="印件名称:" prop="customerName">
                    <el-input v-model="scgdformData['印件名称']" placeholder=""  />
                  </el-form-item>
                </el-col>
              </el-row>
                  <!-- 第五排 -->
               <el-row :gutter="24">
                 <el-col :span="6">
                   <el-form-item label="订单数量:" prop="orderQuantity">
                     <el-input v-model="scgdformData['订单数量']"  placeholder="" style="width: 180px;" />
                   </el-form-item>
                 </el-col>
                 <el-col :span="6">
                   <el-form-item label="交货日期:" prop="deliveryDate">
                     <el-date-picker v-model="scgdformData['交货日期']" type="date" placeholder="选择日期"  style="width: 280px;" />
<!--                     <el-input v-model="scgdformData['交货日期']" type="date"  placeholder="" style="width: 140px;" />-->
                   </el-form-item>
                 </el-col>
                 <el-col :span="5">
                   <el-form-item label="投料率:" prop="feedRate">
                     <el-input v-model="scgdformData['投料率']"  placeholder="" style="width: 140px;" />
                   </el-form-item>
                 </el-col>
                 <el-col :span="5">
                   <el-form-item label="平均合格率:" prop="passRate">
                     <el-input v-model="scgdformData['平均合格率']"  placeholder="" style="width: 140px;" />
                   </el-form-item>
                 </el-col>
               </el-row>
              <!-- 第六排 -->
              <el-row :gutter="24">
                <el-col :span="6">
                  <el-form-item label="平张投料:" prop="flatFeed">
                    <el-input v-model="scgdformData['平张投料']" placeholder="" style="width: 180px;" />
                  </el-form-item>
                </el-col>
                <el-col :span="6">
                  <el-form-item label="万小张:" prop="perTenThousand">
                    <el-input v-model="scgdformData['万小张']"  placeholder="" style="width: 110px;" />
                    <el-input v-model="scgdformData['单位']"  placeholder="" style="width: 60px;" />
                  </el-form-item>
                </el-col>
                <el-col :span="5">
                  <el-form-item label="投料大箱:" prop="feedBox">
                    <el-input v-model="scgdformData['投料大箱']" placeholder="" style="width: 140px;" />
                  </el-form-item>
                </el-col>
                <el-col :span="5">
                  <el-form-item label="库存大箱:" prop="stockBox">
                    <el-input v-model="scgdformData['库存大箱']"  placeholder="" style="width: 140px;" />
                  </el-form-item>
                </el-col>
              </el-row>

                  <!-- 第七排 -->
              <el-row :gutter="20">
                <el-col :span="20">
                  <el-form-item label="销售订单号:" prop="salesOrder">
                    <el-input v-model="scgdformData['销售订单号']"  placeholder="" />
                  </el-form-item>
                </el-col>
              </el-row>

                  <!-- 第八排 -->
              <el-row :gutter="20">
                <el-col :span="20">
                  <el-form-item label="警语版面:" prop="warningLayout">
                    <el-input v-model="scgdformData['警语版面']"  placeholder=""  />
                  </el-form-item>
                </el-col>
              </el-row>

              <!-- 第九排 -->
              <el-row :gutter="20">
                <el-col :span="6">
                  <el-form-item label="版本号:" prop="versionNumber">
                    <el-input v-model="scgdformData['版本号']"  placeholder="" />
                  </el-form-item>
                </el-col>
                <el-col :span="14">
                  <el-form-item label="客户ERP编码:" prop="customerErpCode">
                    <el-input v-model="scgdformData['客户ERP编码']"  placeholder=""  />
                  </el-form-item>
                </el-col>
              </el-row>

              <!-- 第十排 -->
              <el-row :gutter="20">
                <el-col :span="6">
                  <el-form-item label="码源数量:" prop="codeSourceQuantity">
                    <el-input v-model="scgdformData['码源数量']"  placeholder="" style="width: 170px;" />
                  </el-form-item>
                </el-col>
                <el-col :span="14">
                  <el-form-item label="进程备注:" prop="processNote">
                    <el-input v-model="scgdformData['进程备注']"  placeholder="" />
                  </el-form-item>
                </el-col>
              </el-row>

             <el-row :gutter="20">
               <el-col :span="20">
                 <el-form-item label="备注说明:" prop="remark">
                   <el-input type="textarea" v-model="scgdformData['备注']" :rows="2" :clearable="true" placeholder="" style="width: 100%;" />
                 </el-form-item>
               </el-col>
             </el-row>
             </el-form>
           </el-row>
             <template #footer>
                 <div class="dialog-footer" style="text-align: right;">
                 <el-button @click="closeDialog">取 消</el-button>
                 <el-button type="primary"  @click="enterDialog">确 定</el-button>
                 </div>
             </template>
		   </el-dialog>

          <!-- 修改印件资料弹窗 -->
          <el-dialog v-model="gdyjdialogFormVisible" :before-close="gdyjcloseDialog"
                     style="width: 1000px; height: 750px; bottom: 7%;"
                     :title="'修改印件资料'" destroy-on-close>
            <el-form label-width="100px">
              <el-form-item label="印件号:" prop="keyOrder">
                <el-input v-model="gdyjformData['印件号']" placeholder="" style="width: 140px;"/>
              </el-form-item>
              <el-form-item label="印件代码:" prop="keyOrder">
                <el-input v-model="gdyjformData['印件代号']" placeholder="" style="width: 140px;"/>
                <el-input v-model="gdyjformData['印件名称']" placeholder="" style="width: 400px; margin-left: 10px"/>
              </el-form-item>
              <el-form-item label="纸张编号:" prop="keyOrder">
                <el-input v-model="gdyjformData['纸张代号']" placeholder="" style="width: 140px;"/>
                <el-input v-model="gdyjformData['纸张名称']" placeholder="" style="width: 400px; margin-left: 10px"/>
              </el-form-item>
              <el-form-item label="备用纸张1:" prop="keyOrder">
                <el-input v-model="gdyjformData['备用纸张1']" placeholder="" style="width: 140px;"/>
                <el-input v-model="gdyjformData['纸张名称11']" placeholder="" style="width: 400px; margin-left: 10px"/>
              </el-form-item>
              <el-form-item label="备用纸张2:" prop="keyOrder">
                <el-input v-model="gdyjformData['备用纸张2']" placeholder="" style="width: 140px;"/>
                <el-input v-model="gdyjformData['纸张名称22']" placeholder="" style="width: 400px; margin-left: 10px"/>
              </el-form-item>
              <el-form-item label="备用纸张3:" prop="keyOrder">
                <el-input v-model="gdyjformData['备用纸张3']" placeholder="" style="width: 140px;"/>
                <el-input v-model="gdyjformData['纸张名称33']" placeholder="" style="width: 400px; margin-left: 10px"/>
              </el-form-item>
              <el-form-item label="备用纸张4:" prop="keyOrder">
                <el-input v-model="gdyjformData['备用纸张4']" placeholder="" style="width: 140px;"/>
                <el-input v-model="gdyjformData['纸张名称44']" placeholder="" style="width: 400px; margin-left: 10px"/>
              </el-form-item>
              <div style="display: flex; gap: 0px;">
                <el-form-item label="订单数量:" prop="keyOrder">
                  <el-input v-model="gdyjformData['订单数量']" placeholder="" style="width: 100px;"/>
                </el-form-item>
                <el-form-item label="平张投料:" prop="keyOrder">
                  <el-input v-model="gdyjformData['平张投料']" placeholder="" style="width: 100px;"/>
                </el-form-item>
                <el-form-item label="万小张:" prop="keyOrder">
                  <el-input v-model="gdyjformData['万小张']" placeholder="" style="width: 100px;"/>
                </el-form-item>
                <el-form-item label="纸张规格:" prop="keyOrder">
                  <el-input disabled v-model="gdyjformData['投料规格']" placeholder="" style="width: 240px;"/>
                </el-form-item>
              </div>
              <div style="display: flex; gap: 0px;">
                <el-form-item label="投料规格:" prop="keyOrder">
                  <el-input v-model="gdyjformData['开料规格']" placeholder="" style="width: 100px;"/>
                </el-form-item>
                <el-form-item label="开料开数:" prop="keyOrder">
                  <el-input v-model="gdyjformData['开数']" placeholder="" style="width: 100px;"/>
                </el-form-item>
                <el-form-item label="开料联数:" prop="keyOrder">
                  <el-input v-model="gdyjformData['联数']" placeholder="" style="width: 100px;"/>
                </el-form-item>
                <el-form-item label="核算规格:" prop="keyOrder">
                  <el-input v-model="gdyjformData['核算规格']" placeholder="" style="width: 100px;"/>
                </el-form-item>
              </div>
              <el-form-item label="备注说明:" prop="remark">
                <el-input type="textarea" v-model="gdyjformData['备注说明']" rows="4" clearable placeholder=""  />
              </el-form-item>
            </el-form>

            <template #footer>
              <div class="dialog-footer" style="text-align: right;">
                <el-button @click="gdyjcloseDialog">取消</el-button>
                <el-button type="primary"  @click="gdyjenterDialog">确定</el-button>
              </div>
            </template>
          </el-dialog>

          <!-- 修改工艺资料弹窗 -->
          <el-dialog v-model="gdgydialogFormVisible" :before-close="gycloseDialog"
                     style="width: 1200px;height: 750px; bottom: 7%"
                     :title="'修改工艺资料'" destroy-on-close>

              <el-form label-width=" 90px">
                <div style="display: flex; gap: 0px;">
                  <el-form-item label="印件编号:" prop="keyOrder">
                    <el-input disabled v-model="gdgyformData['印件']" placeholder="" style="width: 70px;"/>
                  </el-form-item>
                  <el-form-item label="工序编号:" prop="keyOrder" label-width=" 110">
                    <el-input disabled v-model="gdgyformData['工序']" placeholder="" style="width: 70px;"/>
                  </el-form-item>
                  <el-form-item label="重点工序:" prop="keyOrder" label-width=" 120">
                    <el-input  v-model="gdgyformData['重点工序']" placeholder="" style="width: 130px;"/>
                  </el-form-item>
                  <el-form-item label="备选工序：" prop="isBanciSelected" label-width=" 130px">
                    <el-checkbox v-model="gdgyformData['备选工序']"></el-checkbox>
                  </el-form-item>
                  <el-form-item label="加工开数:" prop="keyOrder" label-width=" 130">
                    <el-input disabled v-model="gdgyformData['开数']" placeholder="" style="width: 70px;"/>
                  </el-form-item>
                  <el-form-item label="加工联数:" prop="keyOrder">
                    <el-input disabled v-model="gdgyformData['联数']" placeholder="" style="width: 70px;"/>
                  </el-form-item>
                </div>

                <div style="display: flex; gap: 0px;">
                  <el-form-item label="车间名称:" prop="keyOrder">
                    <el-input disabled v-model="gdgyformData['车间名称']" placeholder="" style="width: 90px;"/>
                  </el-form-item>

                  <el-form-item label="工艺名称:" prop="keyOrder">
                    <el-input disabled v-model="gdgyformData['工艺名称']" placeholder="" style="width: 100px;"/>
                  </el-form-item>
                  <el-form-item label="工序名称:" prop="keyOrder">
                    <el-input disabled v-model="gdgyformData['工序名称']" placeholder=""  style="width: 450px;"/>
                  </el-form-item>
                  <el-form-item label="计损色数" prop="keyOrder">
                    <el-input disabled v-model="gdgyformData['计损色数']" placeholder="" style="width: 100px;"/>
                  </el-form-item>
                </div>

                <el-form-item label="设备编号:" prop="remark">
                  <el-select v-model="gdgyformData['设备编号']" multiple collapse-tags placeholder="请选择设备编号" style="width: 600px; height: auto;">
                    <el-option
                        v-for="(item, index) in gdzl_MachineList_address.data"
                        :key="index"
                        :label="item"
                        :value="item.split('-->')[0].trim()">
                    </el-option>
                  </el-select>
                </el-form-item>

                <div style="display: flex; gap: 0px;">
                  <el-form-item label="工序损耗:" prop="keyOrder" >
                    <el-input v-model="gdgyformData['shdh']" placeholder="" style="width: 100px;"/>
                    <el-input disabled v-model="gdgyformData['工序名称']" placeholder="" style="width: 800px;margin-left: 10px"/>
                  </el-form-item>
                </div>

                <div style="display: flex; gap: 0px;">
                  <el-form-item label="损耗系数:" prop="keyOrder">
                    <el-input v-model="gdgyformData['损耗系数']" placeholder="" style="width: 90px;"/>
                  </el-form-item>
                  <el-form-item label="难度系数" prop="keyOrder">
                    <el-input v-model="gdgyformData['难度系数']" placeholder="" style="width: 90px;"/>
                  </el-form-item>
                  <el-form-item label="装版工时:" prop="keyOrder">
                    <el-input disabled v-model="gdgyformData['装版工时']" placeholder="" style="width: 90px;"/>
                  </el-form-item>
                  <el-form-item label="排产小时产能:" prop="keyOrder" label-width=" 120px">
                    <el-input disabled v-model="gdgyformData['小时产能']" placeholder="" style="width: 90px;"/>
                  </el-form-item>
                  <el-form-item label="印刷方式" prop="keyOrder">
                    <el-input disabled v-model="gdgyformData['印刷方式']" placeholder="" style="width: 100px;"/>
                  </el-form-item>
                  <el-form-item label="版距" prop="keyOrder">
                    <el-input disabled v-model="gdgyformData['版距']" placeholder="" style="width: 100px;"/>
                  </el-form-item>
                </div>

                <el-form-item label="工序备注:" prop="remark">
                  <el-input disabled type="textarea" v-model="gdgyformData['备注']" rows="3" clearable placeholder=""  />
                </el-form-item>

                <el-form-item  label="质量要求:" prop="remark">
                  <el-input disabled type="textarea" v-model="gdgyformData['质量要求']" rows="3" clearable placeholder=""  />
                </el-form-item>

                <el-form-item label="质量隐患:" prop="remark">
                  <el-input disabled type="textarea" v-model="gdgyformData['质量隐患']" rows="3" clearable placeholder=""  />
                </el-form-item>


              </el-form>

            <template #footer>
              <div class="dialog-footer" style="text-align: right;">
                <el-button @click="gdgycloseDialog">取 消</el-button>
                <el-button type="primary" @click="gdgyenterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>

          <!-- 修改BOM资料弹窗【MES系统没有修改功能】 -->
          <el-dialog v-model="gdbomdialogFormVisible" :before-close="bomcloseDialog"
                     style="width: 1300px;height: 750px;; bottom: 7%"
                     :title="'修改BOM资料'" destroy-on-close>
            <template #footer>
              <div class="dialog-footer" style="text-align: right;">
                <el-button @click="bomcloseDialog">取 消</el-button>
                <el-button type="primary" @click="bomenterDialog">确 定</el-button>
              </div>
            </template>
          </el-dialog>
        </el-main>

      </layout-content>

      </layout>
    </layout>
  </div>
</template>
<script>
//点击按钮显示下方表格
export default {
  data() {
    return {
      currentTable: '', // 当前展示的表格
      activeName: 'first',
    };
  },
  methods: {
    showTable(tableName) {
      this.currentTable = tableName;
    },
    showTableChange() {
      // 处理表格选中事件
    },
  }
};
</script>
<script setup>
// 全量引入格式化工具 请按需保留
import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
import { ElMessage, ElMessageBox } from 'element-plus'
import { ref, reactive } from 'vue'
import {
  DataList,
  WorkList,gdzl_MachineList,
  Craft, U8workOrder,ProcessDetailEdit,PrintedEdit,PrintJobOrder,
  Printed,WorkOrderEdit,ReferenceWorkOrder,
  Bom,editGyWaste,U8DataCorrection,AccountingParameterEdit,
  ProductInformation, TestCoefficient,
  DataCorrection, U8Trial, ProcessFlow, AccountingParameter,
  setProductStatus,
  getProduct, getProductGy, ProductInformationEdit,
} from "@/api/yunyin/yunying";
defineOptions({name: 'Company'})

// =========== 修正核算参数 ===========
const xzhscslist = ref(false);
const xzhscsformData = reactive({
  gdbh: '',
});
const sxzhscstableData = ref([]);
//修正核算参数按钮
const onxzhscsclick = () => {
  if(_Gd_gdbh.value == null){
    xzhscslist.value = false;
    ElMessage({type: 'warning',message: '请选择具体的工单后，再操作此功能' })
  }else{
    xzhscsformData['gdbh'] = _Gd_gdbh.value;
    _AccountingParameterdata();
    xzhscslist.value = true;
  }
};
//修正核算参数回车
const xzhscsgetProductValue = () => {
  _AccountingParameterdata()
};
// 修正工单核算参数->数据获取
const _AccountingParameterdata = async ()=>{
  let workOrder = xzhscsformData['gdbh'];
  try {
    const AccountingParameterdata = await AccountingParameter({workOrder:workOrder});
    sxzhscstableData.value = AccountingParameterdata.data;
    const formattedData = AccountingParameterdata.data.map(item=>{
      item.sxzhscsold_难度系数 = item.难度系数;
      item.sxzhscsold_损耗代号 = item.损耗代号;
      item.sxzhscsold_印刷方式 = item.印刷方式;
      item.sxzhscsold_版距 = item.版距;
      item.sxzhscsold_计损色数 = item.计损色数;
      item.sxzhscsold_损耗系数 = item.损耗系数;
      return item
    });
  } catch (error) {
    console.error(error);
  }
}

//修正核算参数更新
const xzhscsConfirm = async () => {
  console.log(sxzhscstableData)
  const firstCharValid = sxzhscstableData.value.map(item => {
    const firstChar = item["损耗代号"] ? item["损耗代号"].charAt(0) : '';
    return firstChar === '0' || firstChar === '';
  });
  if(firstCharValid.includes(false)){
    ElMessage({type: 'warning',message: '损耗代号开头必须是 0' })
    return false;
  }
  if (sxzhscstableData.value) {
    const formattedData = sxzhscstableData.value.map(item => {
      return {
        Uniqid: parseInt(item.UniqId),
        chromatic: parseFloat(item.计损色数),
        difficulty: parseFloat(item.难度系数),
        loss: item.损耗代号 ??'',
        plate: parseInt(item.版距),
        printMode: item.印刷方式 ?? '',
        wastage: parseFloat(item.损耗系数),
      }
    });
      const AccountingParameterEditdata = await AccountingParameterEdit(formattedData);
      console.log(AccountingParameterEditdata);
      if (AccountingParameterEditdata.code === 0) {
        xzhscslist.value = false;
        ElMessage({ type: 'success', message: '更新成功' });
      } else {
        ElMessage({ type: 'error', message: '更新失败' });
      }
  } else {
    console.error("数据错误");
  }
};

//修正核算参数退出
const sxzhscsCancel = () => {
  xzhscslist.value = false;
};


// =========== 质检废品系数 ===========
const scfjfpxslist = ref(false);
const scfjfpxsformData = reactive({
  cpdh: '',
});
const scfjfpxstableData = ref([]);
//质检废品系数【按钮】
const onzjfpxsclick = () => {
  if(_Gd_gdbh.value == null){
    scfjfpxslist.value = false;
    ElMessage({type: 'warning',message: '请选择具体的工单后，再操作此功能'});
  }else{
    scfjfpxsformData['cpdh'] = _Gd_gdbh.value;
    _TestCoefficient();
    scfjfpxslist.value = true;
  }
};

//质检废品系数【回车】
const scfjfpxsgetProductValue = () => {
  if(scfjfpxsformData['cpdh'] === ''){
    scfjfpxstableData.value = [];
    ElMessage({type: 'warning',message: '输入框为空'});
    return false;
  }
  _TestCoefficient();
};
//修正工单核算参数->数据获取
const _TestCoefficient = async ()=>{
  let workOrder = scfjfpxsformData['cpdh'];
  try {
    const TestCoefficientdata = await TestCoefficient({workOrder:workOrder});
    scfjfpxstableData.value = TestCoefficientdata.data;
    const formattedData = TestCoefficientdata.data.map(item=>{
      item.scfjfpxsold_人工正品板 = item.人工正品板;
      item.scfjfpxsold_人工次品板 = item.人工次品板;
      item.scfjfpxsold_人工废检 = item.人工废检;
      item.scfjfpxsold_机检正品板 = item.机检正品板;
      item.scfjfpxsold_机检次品板 = item.机检次品板;
      item.scfjfpxsold_机检废检 = item.机检废检;
      return item
    });
  } catch (error) {
    console.error(error);
  }
}

//质检废品系数【更新】
const scfjfpxsConfirm = async () => {
  const rawValueArray = scfjfpxstableData._rawValue;
  const formattedData = rawValueArray.map(item => {
    return {
      UniqID: item.Uniqid,
      artificial_zp: item.人工正品板 !== null ? item.人工正品板 : "",
      artificial_cp: item.人工次品板 !== null ? item.人工次品板 : "",
      artificial_fj: item.人工废检 !== null ? item.人工废检 : "",
      machine_zp: item.机检正品板 !== null ? item.机检正品板 : "",
      machine_cp: item.机检次品板 !== null ? item.机检次品板 : "",
      machine_fj: item.机检废检 !== null ? item.机检废检 : ""
    }
  });
  const editGyWastes = await editGyWaste(formattedData);
  if (editGyWastes.code === 0) {
    scfjfpxslist.value = false;
    ElMessage({type: 'success',message: '更新成功'})
  } else {
    ElMessage({type: 'error',message: '更新失败'})
  }
};

//质检废品系数【退出】
const scfjfpxsCancel = () => {
  scfjfpxslist.value = false;
};

// =========== 查改U8工单 ===========
const cgugdlist = ref(false);
const cgugdformData = reactive({
  gdbh: '',
  cpdh: '',
  gdmc: '',
});
const cgugdtableData = ref([]);
//查改U8工单【按钮】
const oneditugdclick = () => {
  if(_Gd_gdbh.value == null){
    cgugdlist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择具体的工单后，再操作此功能'
    })
  }else{
    cgugdformData['gdbh'] = _Gd_gdbh.value;
    cgugdformData['cpdh'] = _Gd_cpdh.value;
    cgugdformData['gdmc'] = _Gd_cpmc.value;
    _U8workOrder();
    cgugdlist.value = true;
  }
};

//查改U8工单【回车】
const cgugdProductValue = () => {
  _U8workOrder();
};

//查改U8工单->工单列表
const _U8workOrder = async ()=>{
  let workOrder = cgugdformData['gdbh'];
  // console.log(workOrder)
  try {
    const U8workOrderdata = await U8workOrder({workOrder:workOrder});
    // console.log(U8workOrderdata)
    cgugdtableData.value = U8workOrderdata.data;
  } catch (error) {
    console.error(error);
  }
}

// 多选数据
const multipleSelection = ref([]);

// 多选
const cguzlgd_del = (val) => {
  if (Array.isArray(val) && val.length === 0) {
    multipleSelection.value = [];
  } else {
    multipleSelection.value.push(...val.map(item => item.序号));
  }
}

//查改U8工单（工单删除）
const oncgugdclickdel = async ()=>{
  const Uniqid = multipleSelection.value.join(',');
  // console.log(Uniqid)
  try {
    const U8DataCorrection_del = await U8DataCorrection({Uniqid:Uniqid});
    if (U8DataCorrection_del.code === 0) {
      multipleSelection.value = [];
      ElMessage({type: 'success',message: '删除成功'})
    } else {
      ElMessage({type: 'error',message: '删除失败'})
    }
    // 清空 multipleSelection 为空数组，只有在处理完数据后清空
  } catch (error) {
    console.error(error);
  }
}

//查改U8工单【退出】
const oncgugdcloneclick = () => {
  cgugdlist.value = false;
};



// =========== 工艺流程调整 ===========
const gylctzlist = ref(false);
const gylctzformData = reactive({
  gdbh: '',
  gddh: '',
  gdmc: '',
});
const gylctztableData = ref([]);
//工艺流程调整【按钮】
const oneditgylctzclick = () => {
  if(_Gd_gdbh.value == null){
    gylctzlist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择具体的工单后，再操作此功能'
    })
  }else{
    gylctzformData['gdbh'] = _Gd_gdbh.value;
    _ProcessFlow();
    gylctzlist.value = true;
  }
};
////工艺流程调整【回车】
const gylctzProductValue = () => {
  _ProcessFlow();
};

// 工艺流程调整->获取当前工单工艺资料
const _ProcessFlow = async ()=>{
  let workOrder = gylctzformData['gdbh'];
  try {
    const ProcessFlowdata = await ProcessFlow({workOrder:workOrder});
    gylctzformData["gddh"] = ProcessFlowdata.data.成品编号;
    gylctzformData["gdmc"] = ProcessFlowdata.data.成品名称;
    gylctztableData.value = ProcessFlowdata.data.process;
  } catch (error) {
    console.error(error);
  }
}

//附加标准工序【按钮】
const gdzlfjxx = ref(false);
const gdzlfjxxformData = reactive({
  // cpdh: '',
  gdbh: '',
  cpmc: '',
  // 下拉框选项数据
  cpgyfans: [],
  // 设置默认值
  cpgyfan: '',
  // cpgyfan: [],
  // // 默认选择的值
  // cpgyfans: '',
});
//附加标准工序 产品代号【回车】
// const gdzlfjxxgetProductValue = () => {
//   // 回车后 先设置下拉框默认值为“请选择”
//   gdzlfjxxformData.cpgyfan = '请选择';
//   const workOrder = gdzlfjxxformData.gdbh;
//    _ProcessFlow_xiala(workOrder);
// };
//点击下拉框获取输入框的值
const ongdzlfanclick = () => {
  const workOrder = gdzlfjxxformData.cpgyfan;
  _ProcessFlow_xiala(workOrder);
}

// 工艺流程调整->获取当前工单工艺资料
const gdzlfjxxtableData = ref([]);
const _ProcessFlow_xiala = async (workOrder)=>{
  try {
    const ProcessFlow_xiala = await ProcessFlow({ workOrder });
    console.log(ProcessFlow_xiala)
    if (ProcessFlow_xiala.data) {
      gdzlfjxxtableData.value = ProcessFlow_xiala.data.process;
    } else {
      console.log("工艺流程调整->获取当前工单工艺资料 中缺少 data 属性");
    }
  } catch (error) {
    console.error(error);
  }
}
//点击附加标准工序【按钮】
const gylctz_fjbzgx = async () => {
  gdzlfjxxformData['cpdh'] = _Gd_cpdh.value;
  gdzlfjxxformData['gdbh'] = _Gd_gdbh.value;
  gdzlfjxxformData['cpmc'] = _Gd_cpmc.value;
  gdzlfjxxtableData.value = [];
  await _ReferenceWorkOrder();
  gdzlfjxx.value = true;
};
// 工艺流程调整->参照工单列表获取【展示下拉框的数据】
const _ReferenceWorkOrder = async ()=>{
  let params = {};
  params.productCode = _Gd_cpdh.value;
  params.workOrder = _Gd_gdbh.value;
  try {
    const ReferenceWorkOrder_data = await ReferenceWorkOrder(params);
    if(ReferenceWorkOrder_data.code === 0){
      console.log(ReferenceWorkOrder_data);
      // 从数据中提取方案
      const schemes = ReferenceWorkOrder_data.data || [];
      // 直接将数组作为工艺方案数组
      gdzlfjxxformData.cpgyfans = schemes;

      if (gdzlfjxxformData.cpgyfans.length > 0) {
        gdzlfjxxformData.cpgyfan = [gdzlfjxxformData.cpgyfans[0]];
      }
      //默认获取下拉框第一个值
      const workOrder = gdzlfjxxformData.cpgyfan[0]
      console.log(gdzlfjxxformData.cpgyfans)
      gdzlfjxxformData.cpgyfan = gdzlfjxxformData.cpgyfans[0]
      _ProcessFlow_xiala(workOrder)
    }else{
      console.log("该产品下没有工单")
    }
  } catch (error) {
    console.error(error);
  }
}

//更新当前产品工序【按钮】
const gylctz_gxdqcpgx = () => {
  console.log("更新当前产品工序【按钮】")
  console.log(gylctztableData)
};

//放弃操作【按钮】
const gylctzhandleCancel = () => {
  gylctzlist.value = false;
};

// =========== 工序产量核算 ===========
const gxclhslist = ref(false);
const gxclhsformData = reactive({
  gdbh: '',
});
//工序产量核算【按钮】
const oneditgxclhsclick = () => {
  if(_Gd_gdbh.value == null){
    gxclhslist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择具体的工单后，再操作此功能'
    })
  }else{
    gxclhsformData['gdbh'] = _Gd_gdbh.value;
    gxclhslist.value = true;
  }
};
//工序产量核算【确定】
const gxclhshandleConfirm = () => {tlsslist.value = false;};
//工序产量核算【取消】
const gxclhshandleCancel = () => {tlsslist.value = false;};
// =========== U8投料试算 ===========
const tlsslist = ref(false);
const tlsstableData = ref([]);
const tlssformData = reactive({
  cpdh: '',
  cpmc: '',
  cpzs: '',
  zytldzs: '',
  mbhgl: '',
  shs: '',
});
//点击U8投料试算【按钮】
const ontlssclick = () => {
  //工单编号
  if(_Gd_gdbh.value == null){
    tlsslist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择具体的工单后，再操作此功能'
    })
  }else{
    // //产品代号
    // if( _Gd_cpdh.value === ''){
    //   tlsslist.value = false;
    //   ElMessage({
    //     type: 'warning',
    //     message: '该产品号未查询到'
    //   })
    // }else{
      // tlssformData['cpdh'] =  _Gd_cpdh.value;
      tlssformData['cpdh'] =  '100401101';
      tlssformData['cpmc'] = _Gd_cpmc.value;
      tlsslist.value = true;
      _U8Trial();
    // }
  }
};
//点击U8投料试算【回车】
const tlssgetProductValue = async () => {
  _U8Trial();
};
//点击U8投料试算【成品张数回车】
const tlsscpzsgetProductValue = async () => {
  console.log("成品张数回车")
};
//U8投料试算
const _U8Trial = async ()=>{
  let productCode = tlssformData['cpdh'];
  console.log(productCode)
  try {
    const U8Trialdata = await U8Trial({productCode:productCode});
    console.log(U8Trialdata)
    tlsstableData.value = U8Trialdata.data;

  } catch (error) {
    console.error(error);
  }
}
//U8投料试算【退出】
const oncloneclick = () => {tlsslist.value = false;};

// =========== 引用产品资料 ===========
const yycpzlformData = reactive({
  gdbh: '',
  khdh: '',
  khmc: '',
  cpdh: '',
  cpmc: '',
  yjzl:true,
  gyap: true,
  gyfa: '',
});
const onyycpzllist = ref(false);
//引用产品资料【按钮】
const onyycpzlclick = () => {
  if(_Gd_gdbh.value == null){
    onyycpzllist.value = false;
    ElMessage({
      type: 'warning',
      message: '请选择具体的工单后，再操作此功能'
    })
  }else{
    yycpzlformData['gdbh'] = _Gd_gdbh.value;
    _ProductInformations();
    onyycpzllist.value = true;
  }
};
//引用产品资料【回车】
const yycpzlProductValue = async () => {
  _ProductInformations();
};
//引用产品资料->获取产品资料
const _ProductInformations = async ()=>{
  let workOrder = yycpzlformData['gdbh'];
  try {
    const ProductInformations = await ProductInformation({workOrder:workOrder});
    console.log(ProductInformations);
    yycpzlformData['gdbh'] = ProductInformations.data['工单编号'];
    yycpzlformData['khdh'] = ProductInformations.data['客户代号'];
    yycpzlformData['khmc'] = ProductInformations.data['客户名称'];
    yycpzlformData['cpdh'] = ProductInformations.data['产品代号'];
    yycpzlformData['cpmc'] = ProductInformations.data['产品名称'];
  } catch (error) {
    console.error(error);
  }
}
//引用产品资料【执行】
const yycpzlhandleConfirm = async () => {
  _ProductInformationEdit();
};
//引用产品资料->获取产品资料
const _ProductInformationEdit = async ()=>{
  let params = {}
  params.oldWorkOrder = _Gd_gdbh.value;
  params.newWorkOrder = yycpzlformData['gdbh'];
  try {
    const ProductInformationEditdata = await ProductInformationEdit(params);
    if (ProductInformationEditdata.code === 0) {
      ElMessage({
        type: 'success',
        message: '更新成功'
      })
    } else {
      ElMessage({
        type: 'error',
        message: '更新失败'
      })
    }
  } catch (error) {
    console.error(error);
  }
  onyycpzllist.value = false;
}
//引用产品资料【放弃】
const yycpzlhandleCancel = () => {onyycpzllist.value = false;};

// =========== 左侧树侧形结构 ===========
const treeData = reactive({data:[]});
// const treeData = ref({})
const defaultProps = {
  children: 'children',
  label: 'label'
};

const DataListdata = async () => {
  try {
    const data = await DataList();
    for (let key in data.data) {
      // 忽略 "productingAll" 和 "progressAll"
      if (key !== "productingAll" && key !== "progressAll") {
        let temp = data.data[key];
        let object = {};
        object.id = temp[0];
        object.label = data.data[key];
        object.children = [];
        treeData.data.push(object);
      }
    }
  } catch (error) {
    console.error(error);
  }
};
DataListdata();

//点击左侧树形获取编号
const tableData = reactive([])
const _Gd_khdh = ref(null)
const handleNodeClick = async (node) => {
  searchInfo.value = '';
  gytableData.value = [];
  yjtableData.value = [];
  bomtableData.value = [];
  _Gd_khdh.value = node.label.substring(0, 4);
  _WorkList_page();
};
const _WorkList_page = async () => {
  console.log(pageSize.value)
  console.log(page.value)
  try {
    const WorkListdata = await WorkList({ Gd_khdh:_Gd_khdh.value,limit:pageSize.value,page:page.value});//接口调用函数
    tableData.splice(0,tableData.length,...WorkListdata.data.data);//表格数据
    // total.value = tableData.length;//共多少条
    total.value = 999;//共多少条
  } catch (error) {
    console.error(error);
  }
};

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

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


//点击表格行 获取下方表格数据列表
//印件资料
const yjtableData = ref([])
//工艺资料
const gytableData = ref([])
//BOM资料
const bomtableData = ref([])
//全局调用工单编号
const _Gd_gdbh = ref(null)
//全局调用产品代号
const _Gd_cpdh = ref(null)
//全局调用产品名称
const _Gd_cpmc = ref(null)
const tableRowClick = async (row) => {
  _Gd_gdbh.value = row.工单编号;
  _Gd_cpdh.value = row.产品代号;
  _Gd_cpmc.value = row.产品名称;
  const Gd_gdbh = row.工单编号;
  const yjres = await Printed({ Gd_gdbh:Gd_gdbh});
  const gyres = await Craft({ Gd_gdbh:Gd_gdbh});
  const bomres = await Bom({ Gd_gdbh:Gd_gdbh});
  yjtableData.value = yjres.data;
  gytableData.value = gyres.data;
  bomtableData.value = bomres.data;
};

// 搜索查询
const searchInfo = ref('')
//点击【查询】按钮
const onSubmit = () => {
    _cha_WorkList();
};
const _cha_WorkList = async (node) => {
  if(searchInfo.value === ''){
    ElMessage({
      type: 'warning',
      message: '请输入搜索的信息'
    })
    return false;
  }
  const search = searchInfo.value;
  try {
    const WorkListdata = await WorkList({ search:search,limit:1,page:1});//接口调用函数
    tableData.splice(0,tableData.length,...WorkListdata.data);//表格数据
    total.value = tableData.length;//共多少条
  } catch (error) {
    console.error(error);
  }
};

// // 多选数据
// const multipleSelection = ref([])
// // 多选
// const handleSelectionChange = (val) => {
//     multipleSelection.value = val
// }

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



//=========表格列表修改========
let scgdformData = ref([])
//双击修改
const updateCompanyFunc = async(row) => {
  const DataCorrection_list = await DataCorrection({ Gd_gdbh:row['工单编号']});//接口调用函数
  console.log(DataCorrection_list)
  scgdformData.value = DataCorrection_list.data;
  dialogFormVisible.value = true
}
// 弹窗控制标记
const dialogFormVisible = ref(false)
// 弹窗确定
const enterDialog = async () => {
  const zdgx = /^[A-Za-z0-9\u4e00-\u9fa5\s]*$/.test(scgdformData.value['重点工单']);
  if (!zdgx) {
    ElMessage({ type: 'warning', message: '重点工单数据中 只允许出现中文、数字、空格' });
    return false;
  }
  const formattedData = {
    lx: scgdformData.value['重点工单'],
    kdrq: scgdformData.value['开单日期'],
    gdbh: scgdformData.value['工单编号'],
    scfl: scgdformData.value['生产类型'],
    khdh: scgdformData.value['客户代号'],
    khmc: scgdformData.value['客户名称'],
    cpdh: scgdformData.value['产品代号'],
    cpmc: scgdformData.value['产品名称'],
    ddsl: scgdformData.value['订单数量'],
    jhrq: scgdformData.value['交货日期'],
    tll: scgdformData.value['投料率'],
    jhtl: scgdformData.value['平张投料'],
    sjtl: scgdformData.value['万小张'],
    jldw: scgdformData.value['单位'],
    tldx: scgdformData.value['投料大箱'],
    xsddh: scgdformData.value['销售订单号'],
    jymb: scgdformData.value['警语版面'],
    bbh: scgdformData.value['版本号'],
    erp: scgdformData.value['客户ERP编码'],
    ymsl: scgdformData.value['码源数量'],
    jcbz: scgdformData.value['进程备注'],
    desc: scgdformData.value['备注'],
    Uniqid: scgdformData.value['Uniqid'],
    yjdh: scgdformData.value['印件代号'],
    yjmc: scgdformData.value['印件名称'],
    kc: scgdformData.value['库存大箱'],
    avg:scgdformData.value['平均合格率'] === undefined ? '' : scgdformData.value['平均合格率'],
    printID: scgdformData.value['印件ID'],
  };
  const WorkOrderEdit_edit = await WorkOrderEdit(formattedData);
  if (WorkOrderEdit_edit.code === 0) {
    dialogFormVisible.value = false
    ElMessage({type: 'success',message: '更新成功' })
  } else {
    ElMessage({type: 'error', message: '更新失败'})
  }
}
// 关闭弹窗
const closeDialog = () => {dialogFormVisible.value = false}

//=========印件列表修改========
// 弹窗控制标记
const gdyjdialogFormVisible = ref(false)
const gdyjformData = reactive({})
//双击打开印件列表修改
const gdyjupdateCompanyFunc = async(row) => {
  gdyjformData['开数'] = row['开数'];
  gdyjformData['联数'] = row['联数'];
  Object.assign(gdyjformData,row);
  gdyjdialogFormVisible.value = true
}
//印件列表修改【确定】
const gdyjenterDialog = async () => {
  const formattedData = {
    Uniqid: gdyjformData['Uniqid'],
    yjno: gdyjformData['印件号'] ? gdyjformData['印件号'] : "",
    yjdh: gdyjformData['印件代号'] ? gdyjformData['印件代号'] : "",
    yjmc: gdyjformData['印件名称'] ? gdyjformData['印件名称'] : "",
    zzdh:gdyjformData['纸张代号'] ? gdyjformData['纸张代号'] : "",
    zzmc:gdyjformData['纸张名称'] ? gdyjformData['纸张名称'] : "",
    zzdh1:gdyjformData['zzdh1'] ? gdyjformData['zzdh1'] : "",
    zzdh2:gdyjformData['zzdh2'] ? gdyjformData['zzdh2'] : "",
    zzdh3:gdyjformData['zzdh3'] ? gdyjformData['zzdh3'] : "",
    zzdh4:gdyjformData['zzdh4'] ? gdyjformData['zzdh4'] : "",
    zzmc1:gdyjformData['zzmc1'] ? gdyjformData['zzmc1'] : "",
    zzmc2:gdyjformData['zzmc2'] ? gdyjformData['zzmc2'] : "",
    zzmc3:gdyjformData['zzmc3'] ? gdyjformData['zzmc3'] : "",
    zzmc4:gdyjformData['zzmc4'] ? gdyjformData['zzmc4'] : "",
    cpsl:gdyjformData['订单数量'] ? gdyjformData['订单数量'] : "",
    pztl:gdyjformData['平张投料'] ? gdyjformData['平张投料'] : "",
    sjtl:gdyjformData['万小张'] ? gdyjformData['万小张'] : "",
    tlgg:gdyjformData['投料规格'] ? gdyjformData['投料规格'] : "",
    klgg:gdyjformData['开料规格'] ? gdyjformData['开料规格'] : "",
    ks:gdyjformData['开数'] ? gdyjformData['开数'] : "",
    ls:gdyjformData['联数'] ? gdyjformData['联数'] : "",
    hsgg:gdyjformData['核算规格'] ? gdyjformData['核算规格'] : "",
    desc:gdyjformData['备注'] ? gdyjformData['备注'] : "",
  };
  const PrintedEdit_edit = await PrintedEdit(formattedData);
  if (PrintedEdit_edit.code === 0) {
    gdyjdialogFormVisible.value = false
    ElMessage({type: 'success',message: '更新成功' })
  } else {
    ElMessage({type: 'error', message: '更新失败'})
  }
}
// 印件列表修改【关闭弹窗】
const gdyjcloseDialog = () => {
  gdyjdialogFormVisible.value = false
}


//=========工艺列表修改========
const gdgydialogFormVisible = ref(false)
const gdgyformData = reactive({})

const gdzl_MachineList_address = reactive({
  data: []
});
const _cjmc = ref(null);
//双击修改
const gdgyupdateCompanyFunc = async(row) => {
  console.log("双击了")
  console.log(row)

  if(row['车间名称']){
    _cjmc.value = row['车间名称']
  }else{
    _cjmc.value = '';
  }
  const MachineList_jitai = await gdzl_MachineList({address:_cjmc.value});
  gdzl_MachineList_address.data = MachineList_jitai.data;

  // 示例字符串
  const processName = row['工序名称'];
  // 初始化工艺名称和工序名称
  let technologyName = '';
  let operationName = '';
  // 检查字符串中是否包含【】
  const bracketIndex = processName.indexOf('【');
  if (bracketIndex !== -1) {
    // 如果包含【】，则分割字符串
    technologyName = processName.substring(0, bracketIndex).trim();
    operationName = processName.substring(bracketIndex + 1, processName.indexOf('】')).trim();
  } else {
    // 如果没有【】，则整个字符串是工艺名称，工序名称为空
    technologyName = processName.trim();
  }

  // 示例字符串
  const printProcess = row['印件-工序'];
  // 初始化印件和工序
  let yinjian = '';
  let gongxu = '';
  // 检查字符串中是否包含 "-"
  const dashIndex = printProcess.indexOf('-');
  if (dashIndex !== -1) {
    // 如果包含 "-"，则分割字符串
    yinjian = printProcess.substring(0, dashIndex).trim();
    gongxu = printProcess.substring(dashIndex + 1).trim();
  } else {
    // 如果没有 "-"，则整个字符串是印件，工序为空
    yinjian = printProcess.trim();
  }
  gdgyformData['印件'] = yinjian;
  gdgyformData['工序'] = gongxu;
  gdgyformData['工艺名称'] = technologyName;
  gdgyformData['工序名称'] = operationName;

  Object.assign(gdgyformData,row);
  gdgydialogFormVisible.value = true
}

//工艺列表修改【确定】
const gdgyenterDialog = async () => {
  if(_Gd_gdbh.value){
    const selectedValuesAsString = gdgyformData['设备编号'].join(' ');
    if(gdgyformData['shdh'] === ''){
      ElMessage({type: 'warning', message: '工序损耗不能为空'})
    }
    const formattedData = {
      sbbh: selectedValuesAsString ? selectedValuesAsString : "",
      shdh: gdgyformData['shdh'] ? gdgyformData['shdh'] : "",
      shxs:gdgyformData['损耗系数'] ? gdgyformData['损耗系数'] : "",
      ndxs:gdgyformData['难度系数'] ? gdgyformData['难度系数'] : "",
      zdgx: gdgyformData['重点工序'] ? gdgyformData['重点工序'] : "",
      bxgx: gdgyformData['备选工序'] ? 1 : "",
      UniqId: gdgyformData['UniqId'],
      workOrder: _Gd_gdbh.value,
    };
    console.log(formattedData)
    const ProcessDetailEdit_edit = await ProcessDetailEdit(formattedData);
    if (ProcessDetailEdit_edit.code === 0) {
      gdgydialogFormVisible.value = false
      ElMessage({type: 'success',message: '更新成功' })
    } else {
      ElMessage({type: 'error', message: '更新失败'})
    }
  }else{
    ElMessage({type: 'error', message: '更新失败'})
  }
}

//工艺列表修改【关闭弹窗】
const gdgycloseDialog = () => {
  gdgydialogFormVisible.value = false
}


//颜色变黄
const currentGy0_yjno = ref(null)
const rowClassStyle2 = ({row,rowIndex}) =>{
  if(row['印件-工序'].substr(0, 2)==currentGy0_yjno.value){
    return "warning-row"
  }
  return "warning-row"
}
const clickybupdate2 = (row,column,event) => {
  currentGy0_yjno.value = row['印件-工序'].substr(0, 2)
}

const attachList = ref([])
const attachChange = (val) => {
  attachList.value = val
}

const addGongyiAttach = () =>
{
  attachList.value.map(row => gylctztableData.value.push(row))
  gdzlfjxx.value = false
}

//=========BOM列表修改========
// const bomdialogFormVisible = ref(false)
// //双击修改
// const gdbomdialogFormVisible = async(row) => {
//   Object.assign(scgdformData,row);
//   bomdialogFormVisible.value = true
// }
// // BOM列表修改【确定】
// const bomenterDialog = () => {
//   bomdialogFormVisible.value = false
// }
// // BOM列表修改【关闭弹窗】
// const bomcloseDialog = () => {
//   bomdialogFormVisible.value = false
// }


</script>
<style scoped>

:deep(.el-table__body .warning-row) {
  background: #FFFF80 !important;
}

.JKWTree-container {
  display: flex;
}

.JKWTree-tree {
  width: 300px;
  background-color: #fff;
  padding: 10px;
  margin-right: 20px;
}

.JKWTree-tree h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 10px 0;
}

.JKWTree-content {
  flex: 1;
}
/*关闭拖拽功能*/
.el-textarea textarea {
  resize: none !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;
}
.el-pagination{
  margin-top: 0px !important;
}
.mab{
  margin-bottom: 5px;
}
</style>
