<!-- @desc:工艺流程工序弹窗  @auth:张潇木  @time:2023/1/5 9:35 -->
<template>
  <div class="main-div" ref="node-modal-div" v-if="existsFlag">
    <DkModal
      :title="'工序 - '+nodeData.nodeKindName"
      v-model="modalDisplay"
      :mask-closable="false"
      :loading="loading"
      draggable
      width="800"
      sticky
      @modalOk="modalOk"
      @modalCancel="modalCancel"
      @on-cancel="modalCancel">
        <DkTabs ref='tabs' :options="tabsOptions" v-model="currentTab" @on-click="changeTabs" style="margin: 10px 0;"/>


<!--        {{ nodeData }}<br/>-->

        <!--   tab1 - 基本信息    -->
        <DkForm ref="formInline" v-if="currentTab =='tab1'" v-model="nodeData" :label-max-words="6" :colCount="2">
          <!--   工序名称    -->
          <DkFormItem prop="nodeName" :required="true">
            <InputPop v-model="nodeData.nodeName" ref="nodeName"/>
          </DkFormItem>
          <!--    显示顺序    -->
          <DkFormItem prop="displayNo" :required="true" :data-type="this.$config.dataType.number">
            <InputNumberPop v-model="nodeData.displayNo" ref="displayNo" :min="1" :digits="0"/>
          </DkFormItem>
          <!--    流程类型  工艺工序-计件&&工序流程-结束，报损标识不可用（否）。其他可用） -->
          <DkFormItem prop="flowKind" :required="true" v-if="nodeControl?.flowKind?.visible">
            <SelectPop ref="flowKind" v-model="nodeData.flowKind" label-key="kindName" value-key="kindCode"
                       @on-select="handleSelectFlowKind"
                       :multiple="false"
                       :options="flowKindList.filter(it=>!(nodeControl?.flowKind?.invalidCode||[]).includes(it.kindCode))"/>
          </DkFormItem>
          <!--    可判分级  -->
          <DkFormItem prop="judgeGradeIds" :required="true" v-if="nodeControl?.judgeGradeIds?.visible" :data-type="$config.dataType.array">
            <MultiSelect v-model="nodeData.judgeGradeIds"
                         main-field="defGradeId"
                         main-field-text="【默认】"
                         :mainFieldId="nodeData.defGradeId"
                         @ok="chooseJudgeGradeIds"
                         :default-value="judgeGradeDefaultValue"
                         :check-auto-set-main-field="false"
                         :type="$config.MagnifierType.judgeGrade"
                         :other-condition="{flgValid: true,notInGradeKinds:[$config.gradeKind.damage],gradeTypes:[nodeData.nodeKind]}"/>
          </DkFormItem>
          <!--    工号类型    -->
          <DkFormItem prop="userKind" :required="true" v-if="nodeControl?.userKind?.visible">
            <SelectPop ref="userKind" v-model="nodeData.userKind" label-key="kindName" value-key="kindCode"
                       @on-select="changeUserKind"
                       :multiple="false"
                       :options="userKindList.filter(it=>!(nodeControl?.userKind?.invalidCode||[]).includes(it.kindCode))"/>
          </DkFormItem>
          <!--    操作模式 -->
          <DkFormItem prop="opnKind" :required="true" v-if="nodeControl?.opnKind?.visible">
            <SelectPop ref="opnKind" v-model="nodeData.opnKind" label-key="kindName" value-key="kindCode"
                       @on-select="changeOpnKind"
                       :multiple="false"
                       :options="opnKindList.filter(it=>!(nodeControl?.opnKind?.invalidCode||[]).includes(it.kindCode))"/>
          </DkFormItem>
          <!--    载具模式 -->
          <DkFormItem prop="carKind"  v-if="[$config.processType.dressKilnCar,$config.processType.exchangeKilnCar].includes(nodeData.opnKind)">
            <SelectPop ref="carKind" v-model="nodeData.carKind" label-key="kindName" value-key="kindCode" :multiple="false" :options="carKindList"/>
          </DkFormItem>
          <!--    计件模式    -->
          <DkFormItem prop="pieceKind" :required="true" v-if="nodeControl?.pieceKind?.visible
          &&!([$config.nodeKind.outKiln,$config.nodeKind.inKiln].includes(nodeData.nodeKind)&&nodeData.opnKind==$config.processType.carCode)
          &&!($config.nodeKind.register==nodeData.nodeKind&&nodeData.opnKind!=$config.processType.productCode)">
            <SelectPop ref="pieceKind" v-model="nodeData.pieceKind" label-key="kindName" value-key="kindCode"
                       :multiple="false"
                       :options="pieceKindList.filter(it=>!(nodeControl?.pieceKind?.invalidCode||[]).includes(it.kindCode))"/>
          </DkFormItem>
          <!--    回收后到达    -->
          <DkFormItem prop="recycledKind" v-if="nodeControl?.recycledKind?.visible" :required="true">
            <SelectPop ref="recycledKind" v-model="nodeData.recycledKind" label-key="kindName" value-key="kindCode"
                       :options="recycledKindList" :multiple="false" @on-select="changeRecycledKind"/>
          </DkFormItem>
          <!--    可回收分级    -->
          <DkFormItem prop="recycledGradeIds" v-if="nodeControl?.recycledGradeIds?.visible">
            <SelectPop ref="recycledGradeIds" v-model="nodeData.recycledGradeIds" label-key="gradeName"
                       value-key="gradeId" :multiple="true"
                       :options="productGradeList.filter(it=>[$config.gradeKindType.decrease,$config.gradeKindType.inferior].includes(it.gradeKind))"/>
          </DkFormItem>
          <!--    工序标签    -->
          <DkFormItem prop="nodeSysTags" v-if="nodeControl?.nodeSysTags?.visible">
            <SelectPop ref="nodeSysTags" v-model="nodeData.nodeSysTags" label-key="kindName" value-key="kindCode"
                       :multiple="true"
                       :options="nodeSysTagsList.filter(it=>!(nodeControl?.nodeSysTags?.invalidCode||[]).includes(it.kindCode))"/>
          </DkFormItem>
          <!--    可用窑炉    -->
          <DkFormItem prop="kilnIds" v-if="nodeControl?.kilnIds?.visible">
            <SelectPop ref="kilnIds" v-model="nodeData.kilnIds" label-key="kilnName" value-key="uniqueId"
                       :multiple="true" :options="kilnList"/>
          </DkFormItem>
          <!--    生产车间    -->
          <DkFormItem prop="workShop" :data-type="$config.dataType.number">
            <SelectPop ref="workShop" v-model="nodeData.workShop" label-key="spaceName" value-key="spaceId"
                       :multiple="false" :options="shopList"/>
          </DkFormItem>
          <!--    备注    -->
          <DkFormItem prop="remarks" :span="24">
            <InputPop ref="remarks" v-model="nodeData.remarks"/>
          </DkFormItem>
        </DkForm>
        <!--   tab2 - 缺陷设置    -->
        <DkForm ref="formInline" v-if="currentTab =='tab2'" v-model="nodeData" :label-max-words="6" :colCount="2">
          <!--    产生缺陷    -->
          <DkFormItem prop="flgJobDefect" v-if="nodeControl?.jobDefectTable?.visible"
                      :info="$config.nodeInfo.flgJobDefect">
            <DkSwitch ref="flgJobDefect" v-model="nodeData.flgJobDefect"
                      @on-change="(e)=>{if(!e)nodeData.jobDefectList=undefined;}"></DkSwitch>
          </DkFormItem>
        </DkForm>
        <!--   tab3 - 高级属性    -->
        <DkForm ref="formInline" v-if="currentTab =='tab3'" v-model="nodeData" :label-max-words="6" :colCount="2">
          <!--    工艺类别    -->
          <DkFormItem prop="techType" :data-type="$config.dataType.number">
            <SelectPop ref="techType" v-model="nodeData.techType" label-key="dataValue" value-key="dataId"
                       :multiple="false" :options="techTypeList"/>
          </DkFormItem>
          <!--    工序类别    -->
          <DkFormItem prop="nodeTypes" :data-type="$config.dataType.array">
            <SelectPop ref="nodeTypes" v-model="nodeData.nodeTypes" label-key="dataValue" value-key="dataId"
                       :multiple="true" :options="nodeTypeList"/>
          </DkFormItem>
          <!--    工序描述    -->
          <DkFormItem prop="nodeDesc">
            <InputPop v-model="nodeData.nodeDesc" ref="nodeDesc"/>
          </DkFormItem>
          <!--    默认分级    -->
          <DkFormItem prop="defGradeId" v-if="nodeControl?.defGradeId?.visible" :data-type="$config.dataType.number">
            <SelectPop ref="defGradeId" v-model="nodeData.defGradeId" label-key="gradeName" value-key="gradeId"
                       :multiple="false"
                       :options="productGradeList.filter(it=>[$config.gradeKind.good,$config.gradeKind.fine].includes(it.gradeKind))"/>
          </DkFormItem>
          <!--    报损标识    -->
          <DkFormItem prop="scrapFlg"
                      v-if="nodeControl?.flgScrap?.visible && !(nodeData.nodeKind==$config.nodeKind.register&&nodeData.flowKind==$config.flowKind.end)">
            <DkSwitch ref="flgScrap" v-model="nodeData.flgScrap"></DkSwitch>
          </DkFormItem>
          <!--    撤销标识    -->
          <DkFormItem prop="flgUndo"
                      v-if="nodeControl?.flgUndo?.visible && !(nodeData.nodeKind==$config.nodeKind.register&&nodeData.opnKind!=$config.processType.productCode)">
            <DkSwitch ref="flgScrap" v-model="nodeData.flgUndo"></DkSwitch>
          </DkFormItem>
          <!--    验证标签    -->
          <DkFormItem prop="flgCheckLabel"
                      v-if="nodeControl?.flgCheckLabel?.visible && !(nodeData.nodeKind===$config.nodeKind.register&&nodeData.opnKind!==$config.processType.productCode)">
            <DkSwitch ref="flgCheckLabel" v-model="nodeData.flgCheckLabel"
                      @on-change="(e)=>{if(!e) nodeData.pdtLabelKinds=undefined;this.$refs['formInline'].clearValidate()}"></DkSwitch>
          </DkFormItem>
          <!--    标签类型    -->
          <DkFormItem prop="pdtLabelKinds" v-if="nodeControl?.pdtLabelKinds?.visible && nodeData.flgCheckLabel"
                      :required="nodeData.flgCheckLabel"
                      :data-type="$config.dataType.array">
            <SelectPop ref="pdtLabelKinds" v-model="nodeData.pdtLabelKinds" label-key="kindName" value-key="kindCode"
                       :multiple="true" :options="pdtLabelKindsList"/>
          </DkFormItem>
          <!--    独立检验    -->
          <DkFormItem prop="flgAloneJudge"
                      v-if="nodeControl?.flgAloneJudge?.visible && [$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flowKind!=$config.flowKind.start">
            <DkSwitch ref="flgScrap" v-model="nodeData.flgAloneJudge"
                      @on-change="changeFlgAloneJudge"></DkSwitch>
          </DkFormItem>
          <!--    返回分级    -->
          <DkFormItem prop="backGradeIds"
                      v-if="nodeControl?.backGradeIds?.visible && ([$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flgAloneJudge)"
                      :data-type="$config.dataType.array">
            <SelectPop ref="backGradeIds" v-model="nodeData.backGradeIds" label-key="gradeName" value-key="gradeId"
                       :multiple="true" :options="productGradeList" @on-select="changeBackGradeIds" />
          </DkFormItem>
          <!--    入库仓库    -->
          <DkFormItem prop="whId" :label="$t('whCodeName')"
                      v-if="nodeTypeList.filter(it=>it.dataValue=='入库').length && nodeData.nodeTypes && nodeData.nodeTypes.length &&
                      nodeData.nodeTypes.includes(nodeTypeList.filter(it=>it.dataValue=='入库')[0].dataId)"
                      :data-type="$config.dataType.array">
            <SelectPop ref="whId" v-model="nodeData.whId" label-key="whName" value-key="whId"
                       :multiple="false" :options="whList" />
          </DkFormItem>
        </DkForm>
        <!--   tab4 - 流程控制    -->
        <DkForm ref="formInline" v-if="currentTab =='tab4'" v-model="nodeData" :label-max-words="6" :colCount="2">
          <!--    成型标签    -->
          <DkFormItem prop="moldlineTags" v-if="nodeControl?.moldlineTags?.visible" :span="12" :info="$config.nodeInfo.moldlineTags">
            <SelectPop ref="moldlineTags" v-model="nodeData.moldlineTags" label-key="dataValue" value-key="dataId"
                       :multiple="true" :options="moldlineTagsList"/>
          </DkFormItem>
        </DkForm>
        <!--   表格     -->
        <div style="margin-bottom: 8px">
          <div v-if="currentTab =='tab1'">
            <Divider v-if="nodeControl?.userTable?.visible"/>
            <!--    生产工号    -->
            <EditTable ref="productUserTable" :title='"生产工号"' :titleInfo='"未设置代表有数据采集权限的用户都可以作为此工序生产工号"'
                       :data="productUserList"
                       v-if="nodeControl?.userTable?.visible&&productUserTableFlag"
                       :columns="userColumns"
                       enabledRepeatId="userId"
                       :height="200"
                       controlId="userId"
                       :enabledRepeat="false"
                       :show-setting-flag="false"/>
            <!--    操作工号    -->
            <EditTable ref="operateUserTable" :title='"操作工号"' :titleInfo='"未设置代表有数据采集权限的用户都可以操作此工序"'
                       :data="operateUserList"
                       v-if="nodeControl?.userTable?.visible&&operateUserTableFlag&&nodeData.userKind==$config.userKind.operate"
                       :columns="userColumns"
                       enabledRepeatId="userId"
                       :height="200"
                       controlId="userId"
                       :enabledRepeat="false"
                       :show-setting-flag="false"/>
          </div>
          <div v-if="currentTab =='tab2'">
            <Divider v-if="(nodeControl?.defectTable?.visible)||(nodeControl?.jobDefectTable?.visible&&nodeData.flgJobDefect)"/>
            <!--    工序可检缺陷    -->
            <EditTable ref="defectTable" :title='"工序可检缺陷"' :data="nodeData.defectList"
                       v-if="nodeControl?.defectTable?.visible&&defectTableFlag"
                       :columns="defectColumns"
                       enabledRepeatId="defectId"
                       :height="200"
                       controlId="pdtDefectId"
                       :enabledRepeat="false"
                       :show-setting-flag="false"/>
            <!--    工序工种缺陷    -->
            <EditTable ref="jobDefectTable" :title='"工序工种缺陷"' :data="nodeData.jobDefectList"
                       v-if="nodeControl?.jobDefectTable?.visible&&jobDefectTableFlag&&nodeData.flgJobDefect"
                       :columns="jobDefectColumns"
                       :enabledRepeatId="['pdtDefectId','jobId']"
                       :height="200"
                       controlId="pdtDefectId"
                       :enabledRepeat="false"
                       :show-setting-flag="false"/>
          </div>
          <div v-if="currentTab =='tab3'">
            <Divider v-if="(([$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flgAloneJudge)
                            ||$config.nodeKind.recover==nodeData.nodeKind)
                            &&checkRecoverTableFlag"/>
            <!--    回收/检验设置    -->
            <EditTable ref="checkRecoverTable" :title='nodeData.nodeKind===$config.nodeKind.recover?"回收设置":"检验设置"'
                       :data="checkRecoverRouterList"
                       v-if="(([$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flgAloneJudge)
                              ||$config.nodeKind.recover==nodeData.nodeKind)
                              &&checkRecoverTableFlag"
                       :columns="([$config.nodeKind.halfCheck,$config.nodeKind.finishCheck].includes(nodeData.nodeKind)&&nodeData.flgAloneJudge)
                              ||($config.nodeKind.recover==nodeData.nodeKind&&nodeData.recycledKind==$config.recycledKind.before)?checkRecoverColumns:checkRecoverColumns_noBack"
                       :controlId="'node1Id'"
                       :height="200"
                       :enabledRepeatId="['node1Id','backNodeIds']"
                       :enabledRepeat="false"
                       :show-setting-flag="false"/>
          </div>
          <div v-if="currentTab =='tab4'">
            <Divider v-if="(nodeControl?.pdtTable?.visible)||(nodeControl?.routerTable?.visible&&nodeData.recycledKind!==$config.recycledKind.before)"/>
            <!--    工序在制品    -->
            <EditTable ref="pdtTable" :title='"工序在制品"' :data="nodeData.pdtList"
                       v-if="nodeControl?.pdtTable?.visible&&pdtTableFlag"
                       :columns="pdtColumns"
                       enabledRepeatId="modelId"
                       controlId="pdtModelId"
                       :height="200"
                       :enabledRepeat="false"
                       :show-setting-flag="false"/>
            <!--    跨流程工序    -->
            <!--          {{nodeData.routeType}}-->
            <EditTable ref="routerTable" :title='"跨流程工序"' :data="crossRouterList"
                       v-if="nodeControl?.routerTable?.visible&&routerTableFlag&&nodeData.recycledKind!==$config.recycledKind.before"
                       :columns="crossRouterColumns"
                       :controlId="'node2Id'"
                       :height="200"
                       :enabledRepeatId="'nodeId'"
                       :enabledRepeat="false"
                       :show-setting-flag="false"/>
          </div>
        </div>
        <!--            {{ nodeControl }}<br/>-->
        <!--            {{ allNodes }}<br/>-->
        <!--      {{nodeData.routerList}}<br/>-->

    </DkModal>
  </div>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
import Process from '@/view/process/process-flow/config/ProcessConfig'

export default {
  name: 'NodeModal',
  props: {
    shopList: {
      type: Array,
      default: () => []
    },
    dictionaryDataList: {
      type: Array,
      default: () => []
    },
    jobList: {
      type: Array,
      default: () => []
    },
    kilnList: {
      type: Array,
      default: () => []
    },
    whList: {
      type: Array,
      default: () => []
    },
    dataKindList: {
      type: Array,
      default: () => []
    },
    productGradeList: {
      type: Array,
      default: () => []
    },
    flowFormData: {
      type: Object,
      default: undefined,
    },
    isFromIndex: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    ...mapState(['process']),
  },
  data() {
    let self = this
    return {
      operateUserList:[],//操作工号集合
      productUserList:[],///生产工号集合
      crossRouterList:[],///生产工号集合
      checkRecoverRouterList:[],//检验回收集合
      currentTab: 'tab1',
      judgeGradeDefaultValue: '',
      loading: false,
      existsFlag: true,
      productUserTableFlag: true,
      operateUserTableFlag: true,
      defectTableFlag: true,
      jobDefectTableFlag: true,
      pdtTableFlag: true,
      routerTableFlag: true,
      checkRecoverTableFlag: true,//检验/回收table
      modalDisplay: false,//如不定义此变量，则进入modal无动画
      split: 0.5,
      tableHeight: null,
      allNodes: [],//所有工序
      graph: null,//图形对象
      nodeData: {},//工序数据
      nodeDataSocial: {},// 工序数据（原始）
      nodeControl: {},//工序控制
      //tabs选项
      tabsOptions: [
        { label: self.$t('basic_info'), name: 'tab1' },
        { label: self.$t('defect_setting'), name: 'tab2' },
        { label: self.$t('advanced_attribute'), name: 'tab3' },
        { label: self.$t('flow_control'), name: 'tab4' },
      ],
      // 不包括工号类型
      userColumns: [
        {
          field: 'userCode',
          type: 'tableSelect',
          controlId: 'userId',
          param: () => {
            return { userType: self.$config.userType.workTeam }
          },
          sortBoolean: false,
          dataType: self.$config.tableSelectType.user,
          fieldUpdate: self.$updateColumns.processNodeChooseUser,
          searchDetailFlag: true,
          width: 'auto',
        },
        { field: 'userName', type: 'disabled', width: 'auto' },
        { field: 'remarks', type: 'text', width: 'auto' },
      ],
      pdtColumns: [
        {
          field: 'pdtModelCode',
          selectField: 'modelCode',
          type: 'tableSelect',
          controlId: 'pdtModelId',
          param: () => {
            return {}
          },
          sortBoolean: false,
          dataType: self.$config.tableSelectType.product,
          fieldUpdate: self.$updateColumns.processNodeChooseProduct,
          searchDetailFlag: true,

          width: 'auto',
        },
        { field: 'pdtModelName', type: 'disabled', width: 'auto', title: '产品名称' },
        { field: 'categoryName', type: 'disabled', width: 'auto' },
        { field: 'remarks', type: 'text', width: 'auto' },
      ],
      carColumns: [
        {
          field: 'carModelCode',
          selectField: 'modelCode',
          type: 'tableSelect',
          controlId: 'carModelId',
          param: () => {
            return {}
          },
          sortBoolean: false,
          dataType: self.$config.tableSelectType.carrier,
          fieldUpdate: self.$updateColumns.processNodeChooseCarrier,
          searchDetailFlag: true,

          width: 'auto',
        },
        { field: 'carModelName', type: 'disabled', width: 'auto' },
        { field: 'remarks', type: 'text', width: 'auto' },
      ],
      defectColumns: [
        {
          field: 'defectCode',
          type: 'tableSelect',
          controlId: 'pdtDefectId',
          param: () => {
            return { defectKind: self.$config.defectKind.Defect }
          },
          sortBoolean: false,
          dataType: self.$config.tableSelectType.defect,
          fieldUpdate: self.$updateColumns.processNodeChooseDefect,
          searchDetailFlag: true,

          width: 'auto',
        },
        { field: 'defectName', type: 'disabled', width: 'auto' },
        { field: 'defectTypesName', type: 'disabled', width: 'auto' },
        { field: 'remarks', type: 'text', width: 'auto' },
      ],
      jobDefectColumns: [
        {
          field: 'defectCode',
          type: 'tableSelect',
          controlId: 'pdtDefectId',
          param: () => {
            return { defectKind: self.$config.defectKind.Defect }
          },
          sortBoolean: false,
          dataType: self.$config.tableSelectType.defect,
          fieldUpdate: self.$updateColumns.processNodeChooseDefect,
          searchDetailFlag: true,
          width: 'auto',
        },
        { field: 'defectName', type: 'disabled', width: 'auto' },
        { field: 'defectTypesName', type: 'disabled', width: 'auto' },
        {
          field: 'jobId',
          type: 'select',
          options: () => self.jobList,
          labelKey: 'jobName',
          valueKey: 'jobId',
          searchDetailFlag: true,
          width: 'auto'
        },
        { field: 'remarks', type: 'text', width: 'auto' },
      ],
      //router_type=2/3
      checkRecoverColumns: [
        {
          field: 'node1Id',
          type: 'select',
          controlId: 'node1Id',
          options: () => self.allNodes.filter(it => !it.flgAloneJudge && it.id != self.process.currentNodeId),
          labelKey: 'name',
          valueKey: 'id',
          width: 'auto'
        },
        {
          field: 'productGrade',
          type: 'select',
          options: () => self.nodeData.nodeKind === self.$config.nodeKind.recover ?
            self.productGradeList.filter(it => [self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind))
            : self.productGradeList.filter(it => ![self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind)),
          labelKey: 'gradeName',
          valueKey: 'gradeId',
          multiple: true,
          width: 'auto'
        },
        {
          field: 'moldlineTags',
          info:self.$config.nodeInfo.moldlineTags,
          type: 'select',
          options: () => self.moldlineTagsList,
          labelKey: 'dataValue',
          valueKey: 'dataId',
          multiple: true,
          width: 'auto'
        },
        {
          field: 'backNodeIds',
          type: 'select',
          options: () => self.allNodes.filter(it => !it.flgAloneJudge && it.id != self.process.currentNodeId),
          labelKey: 'name',
          valueKey: 'id',
          width: 'auto',
          multiple: true,
          info:'未设置时，默认为下一道工序'
        },
        { field: 'remarks', type: 'text', width: 'auto' },
      ],
      checkRecoverColumns_noBack: [
        {
          field: 'node1Id',
          type: 'select',
          controlId: 'node1Id',
          options: () => self.allNodes.filter(it => !it.flgAloneJudge && it.id != self.process.currentNodeId),
          labelKey: 'name',
          valueKey: 'id',
          width: 'auto'
        },
        {
          field: 'productGrade',
          type: 'select',
          options: () => self.nodeData.nodeKind === self.$config.nodeKind.recover ?
            self.productGradeList.filter(it => [self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind))
            : self.productGradeList.filter(it => ![self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind)),
          labelKey: 'gradeName',
          valueKey: 'gradeId',
          multiple: true,
          width: 'auto'
        },
        {
          field: 'moldlineTags',
          info:self.$config.nodeInfo.moldlineTags,
          type: 'select',
          options: () => self.moldlineTagsList,
          labelKey: 'dataValue',
          valueKey: 'dataId',
          multiple: true,
          width: 'auto'
        },
        { field: 'remarks', type: 'text', width: 'auto' },
      ],
      //router_type=4
      crossRouterColumns: [
        {
          field: 'node2IdName',
          selectField: 'nodeName',
          type: 'tableSelect',
          controlId: 'node2Id',
          param: () => {
            return {
              notInFlowId: [this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id)],
              // notInFlowKind:[this.$config.flowKind.start],
              notInNodeKind: [self.$config.nodeKind.inKiln, self.$config.nodeKind.outKiln, self.$config.nodeKind.uninstallKiln, self.$config.nodeKind.recover, self.$config.nodeKind.shaping],
              flgAloneJudge: false,
            }
          },
          sortBoolean: false,
          dataType: self.$config.tableSelectType.processNode,
          fieldUpdate: self.$updateColumns.processNodeChooseNode,
          searchDetailFlag: true,

          width: 'auto'
        },
        {
          field: 'productGrade',
          type: 'select',
          options: () => self.nodeData.nodeKind === self.$config.nodeKind.recover ?
            self.productGradeList.filter(it => [self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind))
            : self.productGradeList.filter(it => ![self.$config.gradeKindType.decrease, self.$config.gradeKindType.inferior].includes(it.gradeKind)),
          labelKey: 'gradeName',
          valueKey: 'gradeId',
          multiple: true,
          width: 'auto'
        },
        {
          field: 'moldlineTags',
          info:self.$config.nodeInfo.moldlineTags,
          type: 'select',
          options: () => self.moldlineTagsList,
          labelKey: 'dataValue',
          valueKey: 'dataId',
          multiple: true,
          width: 'auto'
        },
        { field: 'remarks', type: 'text', width: 'auto' },
      ],
      nodeKindList: [],// 工艺流程类型
      flowKindList: [],// 流程种类
      userKindList: [],// 用户类型
      pieceKindList: [],// 计件模式
      opnKindList: [],// 操作模式
      carKindList:[],// 载具模式
      nodeSysTagsList: [],// 工序标签
      moldlineTagsList: [],// 成线标签
      recycledKindList: [],// 回收后到达
      recycledKindListSocial: [],// 回收后到达（记录原始数据）
      packKindList: [], // 组装方式
      pdtLabelKindsList: [],//验证标签
      nodeTypeList: [],//工序类别
      techTypeList: [],//工艺类别
    }
  },
  watch: {
    //监听返回分级，处理检验table
    // 'nodeData.backGradeIds'(n, o){
    //   console.log('o',o)
    //   console.log('n',n)
    //   if(!n||!o||n.isEmptyArray()||o.isEmptyArray()){
    //     this.checkRecoverRouterList = []
    //     this.checkRecoverTableFlag=false
    //     this.$nextTick(() => {
    //       this.checkRecoverTableFlag=true
    //     })
    //   }
    // },
  },
  methods: {
    ...mapMutations(['setProcessNodeModalDisplay', 'setProcessNodeModalIndexDisplay','setCurrentNodeId']),
    /**
     * @desc   : 处理可判定分级初始值
     * @author : 张潇木
     * @date   : 2023/5/26 16:03
     */
    handleJudgeGradeDefaultValue() {
      if (!this.nodeData.judgeGradeIds) return
      let value = ''
      //先处理默认
      if (this.nodeData.defGradeId) {
        value += this.productGradeList.filter(it => this.nodeData.defGradeId == it.gradeId)[0].gradeName + '【默认】 | '
      }
      //再处理其他
      this.productGradeList.filter(it => this.nodeData.judgeGradeIds.includes(it.gradeId) && this.nodeData.defGradeId !== it.gradeId).forEach(it => {
        value += it.gradeName + ' | '
      })
      this.judgeGradeDefaultValue = value.substring(0, value.length - 2)
    },
    /**
     * @desc   : 选择可判分级
     * @author : 张潇木
     * @date   : 2023/5/26 16:00
     */
    chooseJudgeGradeIds({ rows }) {
      if (rows && rows.length > 0) {
        this.nodeData.judgeGradeIds = rows.map(it => {
          return it.gradeId
        })
        let defaultRow = rows.filter(it => it.defGradeId)
        if (defaultRow.length > 0) {
          this.$set(this.nodeData, 'defGradeId', defaultRow[0].gradeId)
        }
      } else {
        this.nodeData.judgeGradeIds = []
        this.nodeData.defGradeId = undefined
      }
    },
    /**
     * @desc   : 改变返回分级事件
     * @author : 张潇木
     * @date   : 2023/7/13 16:20
     */
    changeBackGradeIds(e){
      //如果清空了返回分级，清空检验设置table
      if(!e||e.isEmptyArray()){
        this.checkRecoverRouterList = []
        this.checkRecoverTableFlag=false
        this.$nextTick(() => {
          this.checkRecoverTableFlag=true
          this.$nextTick(() => {
            //重新渲染回收/检验设置table列名
            if (this.$refs.checkRecoverTable
              && [this.$config.nodeKind.recover, this.$config.nodeKind.halfCheck, this.$config.nodeKind.finishCheck].includes(this.nodeData.nodeKind)) {
              let columnTile = this.nodeData.nodeKind === this.$config.nodeKind.recover ? '报废前工序' : '可检验工序'
              // console.log('columnTile',columnTile)
              this.$refs.checkRecoverTable.changeColumnTitle('node1Id', columnTile)
            }
          })
        })
      }
    },
    /**
     * @desc   : 当前tab改变事件
     * @author : 张潇木
     * @date   : 2023/5/29 14:50
     */
    changeTabs(e) {
      //清除校验
      this.$refs['formInline'].clearValidate()

      // region重新渲染各table
      this.productUserTableFlag = !this.productUserTableFlag
      this.operateUserTableFlag = !this.operateUserTableFlag
      this.$nextTick(() => {
        this.productUserTableFlag = !this.productUserTableFlag
        this.operateUserTableFlag = !this.operateUserTableFlag
      })

      this.defectTableFlag = !this.defectTableFlag
      this.$nextTick(() => {
        this.defectTableFlag = !this.defectTableFlag
      })
      this.jobDefectTableFlag = !this.jobDefectTableFlag
      this.$nextTick(() => {
        this.jobDefectTableFlag = !this.jobDefectTableFlag
      })
      this.pdtTableFlag = !this.pdtTableFlag
      this.$nextTick(() => {
        this.pdtTableFlag = !this.pdtTableFlag
      })
      this.routerTableFlag = !this.routerTableFlag
      this.$nextTick(() => {
        this.routerTableFlag = !this.routerTableFlag
      })
      this.checkRecoverTableFlag = !this.checkRecoverTableFlag
      this.$nextTick(() => {
        this.checkRecoverTableFlag = !this.checkRecoverTableFlag
          this.$nextTick(() => {
            //重新渲染回收/检验设置table列名
            if (e == 'tab3' &&this.$refs.checkRecoverTable
              && [this.$config.nodeKind.recover, this.$config.nodeKind.halfCheck, this.$config.nodeKind.finishCheck].includes(this.nodeData.nodeKind)) {
              let columnTile = this.nodeData.nodeKind === this.$config.nodeKind.recover ? '报废前工序' : '可检验工序'
              // console.log('columnTile',columnTile)
              this.$refs.checkRecoverTable.changeColumnTitle('node1Id', columnTile)
            }
          })
      })
      //endregion

      //设置表单数据
      this.setTableData()
    },
    /**
     * @desc   : 改变操作模式
     * @author : 张潇木
     * @date   : 2023/5/24 16:05
     */
    changeOpnKind() {
      if (this.nodeData.nodeKind === this.$config.nodeKind.register && this.nodeData.opnKind !== this.$config.processType.productCode) {
        this.nodeData.packKind = undefined
        this.nodeData.flgCheckLabel = false
        this.nodeData.pdtLabelKinds = undefined
      }
      //联动处理计件模式
      if ([this.$config.nodeKind.outKiln, this.$config.nodeKind.inKiln, this.$config.nodeKind.register].includes(this.nodeData.nodeKind)) {
        this.nodeData.pieceKind = this.nodeData.opnKind == this.$config.processType.productCode ? this.$config.registerType.singleProduct : this.$config.registerType.special
      }
      //联动处理撤销标识
      if (this.$config.nodeKind.register == this.nodeData.nodeKind) {
        this.nodeData.flgUndo = this.nodeData.opnKind == this.$config.processType.productCode ? true : false
      }
      //联动处理载具模式
      if(![this.$config.processType.dressKilnCar,this.$config.processType.exchangeKilnCar].includes(this.nodeData.opnKind)){
        this.nodeData.carKind=undefined
      }
      this.$refs['formInline'].clearValidate()
    },
    /**
     * @desc   : 改变独立检验
     * @author : 张潇木
     * @date   : 2023/4/6 16:19
     */
    changeFlgAloneJudge(e) {
      if (!e) {
        this.nodeData.backGradeIds = undefined
      }
      this.checkRecoverRouterList = []
      this.$refs['formInline'].clearValidate()
    },
    /**
     * @desc   : 改变回收后到达类型
     * @author : 张潇木
     * @date   : 2023/4/4 13:12
     */
    changeRecycledKind(e) {
      this.checkRecoverRouterList = []
      this.nodeData.routerList=this.nodeData.routerList.filter(it=>it.routeType!=this.$config.routeType.recover)
    },
    /**
     * @desc   : 选择流程工序
     * @author : 周兴
     * @date   : 2023/3/15 16:25
     */
    handleSelectFlowKind() {
      // 工序类型是计件，流程类型是 结束，那么报损标识为false
      if (this.nodeData.nodeKind == this.$config.nodeKind.register) {
        this.nodeData.flgScrap = this.nodeData.flowKind == this.$config.flowKind.end ? false : true
      }
      // 半检、成检 开始工序时，独立检验标识为false
      if ([this.$config.nodeKind.halfCheck, this.$config.nodeKind.finishCheck].includes(this.nodeData.nodeKind)
        && this.nodeData.flowKind == this.$config.flowKind.start) {
        this.nodeData.flgAloneJudge = false
        this.nodeData.backGradeIds = null
      }
      // 回收时，结束工序，回收初始方式只能是后续流程
      if (this.nodeData.flowKind === this.$config.flowKind.end) {
        this.recycledKindList = this.recycledKindListSocial.filter(it => it.kindCode === this.$config.recycledKind.after)
        this.$nextTick(() => {
          this.nodeData.recycledKind = this.$config.recycledKind.after
        })
      } else {
        this.recycledKindList = this.recycledKindListSocial.copy()
      }
      this.$refs['formInline'].clearValidate()
    },
    /**
     * @desc   : 修改用户类别
     * @author : 张潇木
     * @date   : 2023/3/1 14:11
     */
    changeUserKind(e) {
      //当切换到生产工号时，删除userTable中设置的操作工号
      if (e == this.$config.userKind.product) {
        this.nodeData.userList =this.nodeData.userList?.filter(it=>it.userKind==this.$config.userKind.product)
      }
    },
    /**
     * @desc   : 确定
     * @author : 张潇木
     * @date   : 2023/1/5 10:38
     */
    modalOk() {
      //校验
      if (!this.validData()) return
      //设置业务数据
      this.setParams()
      if (!this.isFromIndex) {
        //关闭modal
        this.setProcessNodeModalDisplay(null)
        //清空当前选中工序id
        this.setCurrentNodeId(undefined)
      }
    },
    /**
     * @desc   : 取消
     * @author : 张潇木
     * @date   : 2023/1/5 10:38
     */
    modalCancel() {
      //还原工序数据
      let cell = this.graph.getCellById(this.process.currentNodeId)
      cell.setData(this.nodeDataSocial, { overwrite: true })
      //设置显示隐藏状态以及清空当前工序id
      if(this.isFromIndex){
        this.setProcessNodeModalIndexDisplay(null)
      }else{
        this.setProcessNodeModalDisplay(null)
      }
      //清空当前选中工序id
      this.setCurrentNodeId(undefined)
    },
    /**
     * @desc   : 设置提交数据格式
     * @author : 张潇木
     * @date   : 2023/2/16 16:21
     */
    setParams() {
      // 设置表单数据
      this.setTableData()

      // region 设置图形业务数据
      //根据工序id获取工序数据
      let cell = this.graph.getCellById(this.process.currentNodeId)
      //移除非法连线
      this.removeInvalidEdge(cell)
      //设置工序数据
      cell.setData(this.nodeData, { overwrite: true })
      // endregion

      //region 如果是一览页面的编辑，直接提交保存
      if (this.isFromIndex) {
        this.flowFormData.flowLayout = this.graph.toJSON()
        //发送保存网络请求
        this.excute(this.$service.processService, this.$service.processService.processSetting, this.flowFormData).then(res => {
          if (res.code === this.$config.SUCCESS_CODE) {
            // 提示信息
            this.$Message.success(vm.$t('I_001', { 'param': vm.$t('edit') }))
            // 刷新一览明细
            this.$emit('node-modal-ok', { row: this.flowFormData })
            //关闭modal
            this.setProcessNodeModalIndexDisplay(null)
            //清空当前选中工序id
            this.setCurrentNodeId(undefined)
          } else {
            // 如果不成功就提示错误信息
            this.$Message.warning(res.message)
          }
        })
      }
      //endregion

    },
    /**
     * @desc   : 设置表单数据 - 判断当前哪些table存在，不存在的table 不需要重新设置数据
     * @author : 张潇木
     * @date   : 2023/5/30 17:19
     */
    setTableData(){

      //region操作工号
      if(this.$refs.operateUserTable){
        //将原操作工号删除
        this.nodeData.userList =this.nodeData?.userList?.filter(it=>it.userKind!==this.$config.userKind.operate)||[]
        //取新的操作工号
        this.operateUserList = this.$refs?.operateUserTable?.getTableDataFilter().map((it, index) => {
          return {
            flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
            nodeId: this.process.currentNodeId,
            userId: it.userId,
            userCode: it.userCode,
            userName: it.userName,
            userKind :this.$config.userKind.operate,
            displayNo: index + 1,
            remarks: it.remarks,
            ftyId: this.$store.state.user.ftyId
          }
        })||[]
        //增加到userList中
        this.nodeData.userList=[...this.nodeData.userList,...this.operateUserList]

      }
      //endregion

      //region生产工号
      if(this.$refs.productUserTable){
        //将原操作工号删除
        this.nodeData.userList =this.nodeData?.userList?.filter(it=>it.userKind!==this.$config.userKind.product)||[]
        //取新的生产工号
        this.productUserList = this.$refs?.productUserTable?.getTableDataFilter().map((it, index) => {
          return {
            flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
            nodeId: this.process.currentNodeId,
            userId: it.userId,
            userCode: it.userCode,
            userName: it.userName,
            userKind :this.$config.userKind.product,
            displayNo: index + 1,
            remarks: it.remarks,
            ftyId: this.$store.state.user.ftyId
          }
        })||[]
        //增加到userList中
        this.nodeData.userList=[...this.nodeData.userList,...this.productUserList]

      }
      //endregion

      //region工序在制品
      if(this.$refs.pdtTable){
        this.nodeData.pdtList = this.$refs?.pdtTable?.getTableDataFilter().map((it) => {
          return {
            flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
            nodeId: this.process.currentNodeId,
            pdtModelId: it.pdtModelId,
            pdtModelCode: it.pdtModelCode,
            pdtModelName: it.pdtModelName,
            categoryName: it.categoryName,
            remarks: it.remarks,
            ftyId: this.$store.state.user.ftyId
          }
        })
        this.nodeData.cntPdtModel = this.nodeData.pdtList?.length  // 在制品型号数量
      }
      //endregion

      //region载具
      if(this.$refs.carTable){
        this.nodeData.carList = this.$refs?.carTable?.getTableDataFilter().map((it) => {
          return {
            flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
            nodeId: this.process.currentNodeId,
            carModelId: it.carModelId,
            carModelCode: it.carModelCode,
            carModelName: it.carModelName,
            remarks: it.remarks,
            ftyId: this.$store.state.user.ftyId
          }
        })
        this.nodeData.cntCarModel = this.nodeData.carList?.length  // 可用载具数量
      }
      //endregion

      //region缺陷
      if(this.$refs.defectTable){
        this.nodeData.defectList = this.$refs?.defectTable?.getTableDataFilter().map((it) => {
        return {
          flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
          nodeId: this.process.currentNodeId,
          pdtDefectId: it.pdtDefectId,
          defectCode: it.defectCode,
          defectName: it.defectName,
          defectTypesName: it.defectTypesName,
          remarks: it.remarks,
          ftyId: this.$store.state.user.ftyId
        }
      })
        this.nodeData.cntQuyDefect = this.nodeData.defectList?.length  // 可检缺陷数量
      }
      //endregion

      //region工种缺陷
      if(this.$refs.jobDefectTable) {
        this.nodeData.jobDefectList = this.$refs?.jobDefectTable?.getTableDataFilter().map((it) => {
          return {
            flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
            nodeId: this.process.currentNodeId,
            jobId: it.jobId,
            jobId_Name:it.jobId_Name,
            pdtDefectId: it.pdtDefectId,
            defectCode: it.defectCode,
            defectName: it.defectName,
            defectTypesName: it.defectTypesName,
            remarks: it.remarks,
            ftyId: this.$store.state.user.ftyId
          }
        })
      }
      this.nodeData.cntJobDefect = this.nodeData.flgJobDefect ? this.nodeData.jobDefectList?.length : -1  // 工种缺陷数量，产生缺陷为true时设置成 -1
      //endregion

      //region检验/回收设置
      if(this.$refs.checkRecoverTable) {
        //将原检验/回收设置删除
        this.nodeData.routerList =this?.nodeData?.routerList?.filter(it=>it.routeType==this.$config.routeType.cross)||[]
        //取新的检验/回收设置
        this.checkRecoverRouterList = this.$refs?.checkRecoverTable?.getTableDataFilter().map((it) => {
          return {
            routeType: this.nodeData.nodeKind===this.$config.nodeKind.recover?this.$config.routeType.recover:this.$config.routeType.check,
            flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
            nodeId: this.process.currentNodeId,
            node1Id: it.node1Id,
            node2Id: this.process.currentNodeId,
            backNodeIds: it.backNodeIds,
            productGrade: it.productGrade,
            moldlineTags: it.moldlineTags,
            remarks: it.remarks,
            ftyId: this.$store.state.user.ftyId
          }
        })||[]
        //增加到routerList中
        this.nodeData.routerList=[...this.nodeData.routerList,...this.checkRecoverRouterList]
      }
      //endregion

      //region跨流程工序
      if(this.$refs.routerTable) {
        //将原跨流程工序删除
        this.nodeData.routerList =this.nodeData?.routerList?.filter(it=>it.routeType!==this.$config.routeType.cross)||[]
        //取新的跨流程工序
        this.crossRouterList = this.$refs?.routerTable?.getTableDataFilter().map((it) => {
            return {
              routeType: this.$config.routeType.cross,
              flowId: this.isFromIndex ? this.flowFormData.flowId : parseInt(this.$route.params.id),
              nodeId: this.process.currentNodeId,
              node1Id: this.process.currentNodeId,
              node2Id: it.node2Id,
              node2IdName: it.node2IdName,
              productGrade: it.productGrade,
              moldlineTags: it.moldlineTags,
              remarks: it.remarks,
              ftyId: this.$store.state.user.ftyId
            }
        })||[]
        //增加到routerList中
        this.nodeData.routerList=[...this.nodeData.routerList,...this.crossRouterList]
      }
      //endregion

    },
    /**
     * @desc   : 校验数据
     * @author : 张潇木
     * @date   : 2023/2/27 11:12
     */
    validData() {
      if(!this.nodeData.nodeName||!this.nodeData.flowKind||!this.nodeData.userKind||!this.nodeData.opnKind||!this.nodeData.pieceKind
      ||(this.nodeControl?.recycledKind?.visible&&!this.nodeData.recycledKind)||(this.nodeControl?.judgeGradeIds?.visible&&!this.nodeData.judgeGradeIds)) {
        this.currentTab='tab1'
        this.$nextTick(() => {
          this.$refs['formInline'].validate()
        })
        return
      }
      if(this.nodeControl?.pdtLabelKinds?.visible&&this.nodeData.flgCheckLabel&&(!this.nodeData.pdtLabelKinds||this.nodeData.pdtLabelKinds.isEmptyArray())){
        this.currentTab='tab3'
        this.$nextTick(() => {
          this.$refs['formInline'].validate()
        })
        return
      }
      // 销毁提示弹窗
      this.$Message.destroy()
      // 通过校验标识
      this.nodeData.isValid = true
      return true
    },
    /**
     * @desc   : 移除非法连线
     * @author : 张潇木
     * @date   : 2023/3/1 13:29
     */
    removeInvalidEdge(cell) {
      // 开始工序不能作为终点
      if (this.nodeData?.flowKind == this.$config.flowKind.start) {
        this.graph.getIncomingEdges(cell)?.forEach(it => {
          this.graph.removeEdge(it.id)
        })
      }
      // 结束工序不能作为起点 特殊处理：（后续流程+回收）允许有出线
      if (this.nodeData?.flowKind == this.$config.flowKind.end) {
        this.graph.getOutgoingEdges(cell)?.forEach(it => {
          this.graph.removeEdge(it.id)
        })
      }
      // 回收工序不能作为终点
      if (this.nodeData?.nodeKind === this.$config.nodeKind.recover) {
        this.graph.getIncomingEdges(cell)?.forEach(it => {
          this.graph.removeEdge(it.id)
        })
      }
      // 回收工序只有回收方式为后续流程时，才可以有出线
      if (this.nodeData?.nodeKind === this.$config.nodeKind.recover && this.nodeData?.recycledKind != this.$config.recycledKind.after) {
        this.graph.getOutgoingEdges(cell)?.forEach(it => {
          this.graph.removeEdge(it.id)
        })
      }
      // 独立检验既不能作为开始也不能作为结束
      if (this.nodeData?.flgAloneJudge) {
        this.graph.getConnectedEdges(cell)?.forEach(it => {
          this.graph.removeEdge(it.id)
        })
      }
    },
    /**
     * @desc   : 处理系统数据
     * @author : 周兴
     * @date   : 2023/3/15 10:26
     */
    handleDataKindList() {
      // 工序
      this.nodeKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.nodeKind)
      // 流程种类
      this.flowKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.flowKind)
      // 用户类型
      this.userKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.userKind)
      // 计件模式
      this.pieceKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.pieceKind)
      // 操作模式
      this.opnKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.opnKind)
      // 载具模式
      this.carKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.carKind)
      // 工序标签
      this.nodeSysTagsList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.nodeSysTags)
      // 回收处理方式
      this.recycledKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.recover)
      this.recycledKindListSocial = this.recycledKindList?.copy()
      // 组装方式
      this.packKindList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.recycledKind)
      // 验证标签
      this.pdtLabelKindsList = this.dataKindList.filter(it => it.kindType === this.$config.dataKind.checkLabel)
      // 工序类别
      this.nodeTypeList = this.dictionaryDataList.filter(it => it.dictCode === this.$config.dictType.nodeType)
      // 工艺类别
      this.techTypeList = this.dictionaryDataList.filter(it => it.dictCode === this.$config.dictType.techType)
      // 成线标签
      this.moldlineTagsList = this.dictionaryDataList.filter(it => it.dictCode === this.$config.dictType.moldlineTag)
    },
    /**
     * @desc   : 设置table初始值
     * @author : 张潇木
     * @date   : 2023/5/31 10:06
     */
    handleTableDefaultValue() {
      //操作工号
      this.operateUserList=this.nodeData?.userList?.filter(it=>it.userKind==this.$config.userKind.operate)
      //生产工号
      this.productUserList=this.nodeData?.userList?.filter(it=>it.userKind==this.$config.userKind.product)
      //跨工序流程
      this.crossRouterList=this.nodeData?.routerList?.filter(it=>it.routeType==this.$config.routeType.cross)
      //检验/回收设置
      this.checkRecoverRouterList=this.nodeData?.routerList?.filter(it=>it.routeType!==this.$config.routeType.cross)
    }

  },
  created() {
    this.loading = true
    //获取图形对象
    if (this.graph == null) this.graph = Process.graph
    //获取业务数据
    this.nodeData = this.graph.getCellById(this.process.currentNodeId)?.data
    // //记录初始值
    this.nodeDataSocial = JSON.parse(JSON.stringify(this.nodeData))
    // //刷新工序属性控制
    this.nodeControl = this.dataKindList.find(it => it.kindCode === this.nodeData.nodeKind)?.kindTags
    // //处理跨流程工序类别
    // this.handleRouterType()
    // //过滤调工序组并将json解构成新结构数组
    this.allNodes = this.graph.getNodes().filter(it => it.shape == 'custom-image').map((it) => {
      return {
        id: it.id,
        name: it.data.nodeName,
        flowKind: it.data.flowKind,
        nodeKind: it.data.nodeKind,
        flgAloneJudge: it.data.flgAloneJudge
      }
    })
    //计算显示顺序
    if (!this.nodeData.displayNo) {
      this.nodeData.displayNo = this.allNodes.length
    }
    //设置系统基础数据初始值
    this.handleDataKindList()
    //设置table初始值
    this.handleTableDefaultValue()
    this.loading = false
  },
  mounted() {
    //处理可判定分级初始值
    this.handleJudgeGradeDefaultValue()
    this.modalDisplay = true
  },
  beforeDestroy() {
    this.existsFlag = null
  },
}
</script>

<style scoped>

.ivu-divider-horizontal {
  margin: 10px 0 2px !important;
}

.switch {
  height: 28px;
  display: flex;
  align-items: center;
}

/deep/ .vxe-select-slots {
  z-index: 5100 !important;
}
</style>
