<template>
  <div class="mod-config">
    <!-- 查询条件 -->
    <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
      <el-form-item :label="'流程名称'">
        <el-input v-model="searchData.workflowId" clearable style="width: 160px"></el-input>
      </el-form-item>
      <el-form-item :label="'菜单名称'">
        <el-input v-model="searchData.name" clearable style="width: 160px"></el-input>
      </el-form-item>
      <el-form-item :label="'状态'">
        <el-select clearable v-model="searchData.status" style="width: 120px">
          <el-option label="启用" value="Y"></el-option>
          <el-option label="停用" value="N"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="' '">
        <el-button @click="getDataList()">查询</el-button>
        <el-button type="primary" @click="addModal()">新增</el-button>
        <el-button type="primary" @click="delModal()">删除</el-button>
        <download-excel
          :fields="fields()"
          :data="exportData"
          type="xls"
          :name="exportName"
          :header="exportHeader"
          :footer="exportFooter"
          :fetch="createExportData"
          :before-generate="startDownload"
          :before-finish="finishDownload"
          worksheet="导出信息"
          class="el-button el-button--primary el-button--medium">
          {{ "导出" }}
        </download-excel>
      </el-form-item>
    </el-form>

    <!-- 列表 -->
    <el-table
      :height="height"
      :data="dataList"
      border
      ref="requestTable"
      :row-style="rowStyle"
      @row-click="requestClickRow"
      @selection-change="selectionRequest"
      @current-change="changeCurrentRow"
      style="width: 100%;">
      <el-table-column
        type="selection"
        header-align="center"
        align="center"
        :selectable="selectFlag"
        width="50">
      </el-table-column>
      <el-table-column
        v-for="(item,index) in columnList" :key="index"
        :sortable="item.columnSortable"
        :prop="item.columnProp"
        :header-align="item.headerAlign"
        :show-overflow-tooltip="item.showOverflowTooltip"
        :align="item.align"
        :fixed="item.fixed === ''?false:item.fixed"
        :min-width="item.columnWidth"
        :label="item.columnLabel">
        <template slot-scope="scope">
          <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
          <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
        </template>
      </el-table-column>
      <el-table-column
        fixed="right"
        header-align="center"
        align="center"
        width="100"
        label="操作">
        <template slot-scope="scope">
          <el-link style="cursor: pointer" @click="updateModal(scope.row)">编辑</el-link>
        </template>
      </el-table-column>
    </el-table>

    <selectDiv ref="selectDiv"></selectDiv>

    <!-- 分页插件 -->
    <el-pagination style="margin-top: 0px"
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[20, 50, 100, 200, 500]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>

    <!-- 流程维护模态框 -->
    <el-dialog title="流程维护" top="29vh" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="510px">
<!--      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="分类编码" prop="classificationNo">
          <el-input v-model="modalData.classificationNo" clearable style="width: 120px" disabled></el-input>
        </el-form-item>
        <el-form-item label="分类名称" prop="classificationName" :rules="rules.classificationName" style="margin-left: -10px">
          <el-input v-model="modalData.classificationName" clearable style="width: 330px"></el-input>
        </el-form-item>
      </el-form>-->
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item prop="workflowId" :rules="rules.workflowId">
          <span style="cursor: pointer" v-if="modalData.flag === '1'" slot="label" @click="getBaseList(1015)"><a herf="#">流程ID</a></span>
          <span style="cursor: pointer" v-else slot="label" >流程ID</span>
          <el-input v-model="modalData.workflowId" @blur="workflowBlur(1015)" style="width: 120px" :disabled="maintenanceFlag"></el-input>
        </el-form-item>
        <el-form-item label="流程名称" style="margin-left: -10px">
          <el-input v-model="modalData.workflowname" clearable style="width: 330px" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item prop="menuId" :rules="rules.menuId">
          <span style="cursor: pointer" slot="label" v-if="modalData.flag==='1'" @click="getBaseList(1014)"><a herf="#">菜单ID</a></span>
          <span style="cursor: pointer" slot="label" v-else >菜单ID</span>
          <el-input v-model="modalData.menuId" @blur="menuBlur(1014)" style="width: 120px" :disabled="maintenanceFlag"></el-input>
        </el-form-item>
        <el-form-item label="菜单名称" style="margin-left: -10px">
          <el-input v-model="modalData.name" clearable style="width: 330px" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="状态"  prop="status" :rules="rules.status">
          <dict-data-select v-model="modalData.status" clearable dict-type="sys_status"
                            :use-default-value="false" style="width: 120px"></dict-data-select>
        </el-form-item>
        <el-form-item style="margin-left: -10px;">
          <span style="cursor: pointer" slot="label" >备注</span>
          <el-input v-model="modalData.remark" style="width: 330px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer style="height:35px;margin-top: 25px;text-align:center">
        <el-button type="primary" @click="saveData()">保存</el-button>
        <el-button type="primary" @click="modalFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- 页签 -->
    <el-tabs v-model="activeTable" style="width: 100%" :style="{height: this.secondHeight + 'px'}" type="border-card" @tab-click="tabClick" class="customer-tab">
      <!-- 流程节点页签 -->
      <el-tab-pane label="流程节点" name="node_item">
<!--        <el-form label-position="top" style="margin-top: 2px; margin-left: 2px;">
          <el-button type="primary" @click="addOrDelItem">新增</el-button>
          <el-button type="primary" @click="updateItemValue">编辑</el-button>
        </el-form>-->
        <el-table
          :data="nodeList"
          :height="secondHeight - 60"
          border
          style="width: 100%;">
          <el-table-column
            v-for="(item,index) in columnNodeList" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="item.fixed==''?false:item.fixed"
            :min-width="item.columnWidth"
            :label="item.columnLabel">
            <template slot-scope="scope">
              <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
              <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
            </template>
          </el-table-column>
          <el-table-column
            fixed="right"
            header-align="center"
            align="center"
            width="160"
            label="操作">
            <template slot-scope="scope">
              <el-link style="cursor: pointer" @click="editNodeModal(scope.row)">编辑</el-link>
              <el-link style="cursor: pointer" @click="subDetailModal(scope.row)">出口配置</el-link>
              <el-link style="cursor: pointer" @click="authorityModal(scope.row)">权限配置</el-link>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>

    <el-dialog title="出口配置" :close-on-click-modal="false" v-drag :visible.sync="subDetailFlag" width="1021px">
      <el-form :inline="true" label-position="top" :model="nodeCurrentRow" style="margin-top: -5px;">
        <el-form-item label="流程名称" style="">
          <el-input v-model="nodeCurrentRow.workflowname" clearable style="width: 210px" readonly></el-input>
        </el-form-item>
        <el-form-item label="节点名称" style="margin-left: -5px">
          <el-input v-model="nodeCurrentRow.nodeName" clearable style="width: 210px" readonly></el-input>
        </el-form-item>
      </el-form>
      <el-button type="success" icon="el-icon-plus" size="mini" @click="handleAddBtn()">添加</el-button>
      <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteBtn()">删除</el-button>
      <div class="rq ">
        <el-table
          :height="400"
          :data="tableData"
          border
          :row-class-name="rowClassName"
          @selection-change="handleDetailSelectionChange"
          style="width: 100%;">
          <el-table-column type="selection" align="center" width="50"></el-table-column>
          <el-table-column label="序号" align="center" prop="xh" width="50"></el-table-column>
          <el-table-column prop="plmTable" header-align="center" align="center" :required="true" label="PLM数据表" width="240">
            <template slot-scope="{row}">
              <el-select :ref="`${row.xh-1}` + `a`" v-model="tableData[row.xh-1].plmTable" placeholder="请选择数据表名" style="width: 220px">
                <el-option
                  v-for = "i in tableList"
                  :key = "i.tableId"
                  :label = "i.tableId"
                  :value = "i.tableId">
                </el-option>
              </el-select>
            </template>
          </el-table-column>
          <el-table-column prop="plmTable" header-align="center" align="center" :required="true" label="PLM字段名" width="220">
            <template slot-scope="{row}">
              <el-select :ref="`${row.xh-1}` + `a`" @focus="tableChange(row.xh-1)" v-model="tableData[row.xh-1].plmField" placeholder="请选择PLM字段名" style="width: 200px">
                <el-option
                  v-for = "i in fieldList"
                  :key = "i.fieldId"
                  :label = "i.fieldName"
                  :value = "i.fieldId">
                </el-option>
              </el-select>
            </template>
          </el-table-column>
<!--          <el-table-column prop="plmField" header-align="center" align="center" :required="true" label="PLM字段名" width="150">-->
<!--            <template slot-scope="{row}">-->
<!--              <el-input :ref="`${row.xh-1}` + `b`" v-model="tableData[row.xh-1].plmField" placeholder="请输入PLM字段名"></el-input>-->
<!--            </template>-->
<!--          </el-table-column>-->
          <el-table-column prop="oaField" header-align="center" align="center" :required="true" label="OA字段名" width="150">
            <template slot-scope="{row}">
              <el-input :ref="`${row.xh-1}` + `c`" v-model="tableData[row.xh-1].oaField" placeholder="请输入OA字段名"></el-input>
            </template>
          </el-table-column>

          <el-table-column prop="plmTable" header-align="center" align="center" :required="true" label="PLM字段类型" width="150">
            <template slot-scope="{row}">
              <el-select :ref="`${row.xh-1}` + `a`" v-model="tableData[row.xh-1].fieldType" placeholder="请选择字段类型" style="width: 130px">
                <el-option label="人员参数" value="A"></el-option>
                <el-option label="金额参数" value="C"></el-option>
                <el-option label="其他参数" value="B"></el-option>
              </el-select>
            </template>
          </el-table-column>

          <el-table-column prop="fieldValue" header-align="center" align="center" :required="true" label="默认值" width="200">
            <template slot-scope="{row}">
              <el-input :ref="`${row.xh-1}` + `d`" v-model="tableData[row.xh-1].fieldValue" placeholder="请输入默认值"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="fieldDesc" header-align="center" align="center" :required="true" label="字段描述" width="200">
            <template slot-scope="{row}">
              <el-input :ref="`${row.xh-1}` + `e`" v-model="tableData[row.xh-1].fieldDesc" placeholder="请输入字段描述"></el-input>
            </template>
          </el-table-column>
          <el-table-column prop="remark" header-align="center" align="center" :required="true" label="备注" width="200">
            <template slot-scope="{row}">
              <el-input :ref="`${row.xh-1}` + `f`" v-model="tableData[row.xh-1].remark" placeholder="请输入备注"></el-input>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="checkDataBySubDetail">保存</el-button>
        <el-button type="primary" @click="subDetailFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog width="730px" title="权限" :close-on-click-modal="false" :visible.sync="authorityFlag">
      <el-select v-model="authorityData.tableId" placeholder="请选择数据表名" @change="tableChange3" style="width: 220px">
        <el-option
          v-for = "i in tableList"
          :key = "i.tableId"
          :label = "i.tableId"
          :value = "i.tableId">
        </el-option>
      </el-select>
      <el-table
        :data="authorityData.fieldList"
        border
        :height="300"
        ref="authorityTable"
        @row-click="authorityClickRow"
        @selection-change="selectionAuthority"
        style="width: 100%;">
        <el-table-column
          type="selection"
          header-align="center"
          align="center"
          width="50">
        </el-table-column>
        <el-table-column
          prop="fieldId"
          header-align="center"
          align="center"
          min-width="200"
          label="字段编码">
        </el-table-column>
        <el-table-column
          prop="fieldName"
          header-align="center"
          align="center"
          min-width="200"
          label="字段描述">
        </el-table-column>
        <el-table-column
          header-align="center"
          align="center"
          min-width="50"
          label="必填">
          <template slot-scope="{row}">
            <el-checkbox v-model="row.required" :disabled="!authoritySelections.includes(row)" true-label="Y" false-label="N"></el-checkbox>
          </template>
        </el-table-column>
      </el-table>
      <span slot="footer" class="dialog-footer">
        <div style="margin-top: 5px">
          <el-button type="primary" @click="saveAuthorityList">应用</el-button>
          <el-button type="primary" @click="authorityFlag = false">关闭</el-button>
        </div>
      </span>
    </el-dialog>

    <!-- 流程维护模态框 -->
    <el-dialog title="流程节点" top="29vh" :close-on-click-modal="false" v-drag :visible.sync="nodeModalFlag" width="502px">
      <el-form :inline="true" label-position="top" :model="nodeInfo" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="分类编码">
          <el-input v-model="nodeInfo.classificationNo" :disabled="nodeModalDisableFlag" style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item label="节点顺序">
          <el-input v-model="nodeInfo.seqNo" :disabled="nodeModalDisableFlag" style="width: 142px"></el-input>
        </el-form-item>
        <el-form-item label="是否可驳回">
          <el-select v-model="nodeInfo.isReject" style="width: 142px">
            <el-option label="是" value="Y"></el-option>
            <el-option label="否" value="N"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="nodeInfo" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="流程ID">
          <el-input v-model="nodeInfo.workflowId" :disabled="nodeModalDisableFlag" style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item label="流程名称">
          <el-input v-model="nodeInfo.workflowname" :disabled="nodeModalDisableFlag" style="width: 300px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="nodeInfo" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="节点ID">
          <el-input v-model="nodeInfo.nodeId" :disabled="nodeModalDisableFlag" style="width: 150px"></el-input>
        </el-form-item>
        <el-form-item label="节点名称">
          <el-input v-model="nodeInfo.nodeName" :disabled="nodeModalDisableFlag" style="width: 300px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer style="height:35px;margin-top: 25px;text-align:center">
        <el-button type="primary" @click="editNodeInfo">保存</el-button>
        <el-button type="primary" @click="nodeModalFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!-- chooseList模态框 -->
    <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  </div>
</template>

<script>
  import {
    getRequestMainData, // 查询流程绑定主表信息
    saveRequestHeader, // 新增流程绑定信息
    updateRequestHeader, // 修改流程绑定信息
    getNodeInfoByWorkflow,//获取流程节点信息
    deleteRequestHeader,//删除流程绑定信息
    getNodeDetail,//获取流程节点出口配置
    saveRequestNodeDetail,//保存流程节点出口配置
    deleteRequestNodeDetailByLine,//删除流程当前节点的全部出口配置
    getTableList, // 获取table列表
    getFieldList, // 获取表字段
    getAuthorityFieldList, // 获取权限字段集合
    saveAuthorityList, // 保存节点权限
    editNodeInfo, // 修改节点
  } from '@/api/processManagement/processManagement.js'
  import {getChooselistData, verifyData} from "@/api/chooselist/chooselist.js"
  import Chooselist from '@/views/modules/common/Chooselist'
  import DictDataSelect from '../sys/dict-data-select.vue'
  export default {
    components: {
      DictDataSelect,
      Chooselist
    },
    watch: {
      searchData: {
        deep: true,
        handler: function (newV, oldV) {
          this.searchData.workflowname = this.searchData.workflowname.toUpperCase()
        }
      }
    },
    data () {
      return {
        // 导出
        exportData: [],
        exportName: '流程绑定信息' + this.dayjs().format('YYYYMMDDHHmmss'),
        exportHeader: ['流程绑定信息'],
        exportFooter: [],
        resultList: [],
        // ======== 行高 ========
        height: 200,
        secondHeight: 200,
        // ======== 分页 ========
        pageIndex: 1,
        pageSize: 50,
        totalPage: 0,
        // 条件查询
        searchData: {
          site: this.$store.state.user.site,
          workflowId: '',
          workflowname: '',
          name: '',
          page: 1,
          limit: 10
        },
        // 其它
        // 初始页签
        activeTable: 'node_item',
        // ======== 数据对象 ========
        modalData: {
          flag: '',
          site: this.$store.state.user.site,
          bu: '',
          buDesc: '',
          classificationNo: '',
          classificationName: '',
          menuId: '',
          name: '',
          workflowId: '',
          workflowname: '',
          status: '',
          remark: '',
          createBy: '',
          createDate: '',
          updateDate: '',
          updateBy: ''
        },
        authorityData: {
          site: this.$store.state.user.site,
          bu: '',
          classificationNo: '',
          nodeId: '',
          nodeName: '',
          fieldId: '',
          tableId: '',
          fieldList: [],
          createBy: '',
        },
        queryTableParam: {
          tableType: '',
          passTable: [],
          addTable: []
        },
        nodeInfo: {
          site: '',
          bu: '',
          classificationNo: '',
          workflowId: '',
          workflowname: '',
          nodeId: '',
          nodeName: '',
          seqNo: '',
          isReject: ''
        },
        // ======== 数据列表 ========
        dataList: [],
        checkedDetail: [],
        nodeList: [],
        tableData: [],
        tableList: [],
        fieldList: [],
        authoritySelections: [],
        // ======== 列表表头 ========
        columnList: [
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1Site',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'site',
            headerAlign: 'center',
            align: 'center',
            columnLabel: 'Site',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 50
          }/*,
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1BuDesc',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'buDesc',
            headerAlign: 'center',
            align: 'center',
            columnLabel: 'BU',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          }*/,
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1ClassificationNo',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'classificationNo',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '分类编码',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          }/*,
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1ClassificationName',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'classificationName',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '分类名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120
          }*/,
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1Name',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'name',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '菜单名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1WorkflowId',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'workflowId',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '流程ID',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1Workflowname',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'workflowname',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '流程名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 150
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1Status',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'statusDesc',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '状态',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1Remark',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'remark',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '备注',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 150
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1CreateBy',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'createBy',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '创建人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1CreateDate',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'createDate',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '创建时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1UpdateBy',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'updateBy',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '修改人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table1UpdateDate',
            tableId: '109001Table1',
            tableName: '物料信息表',
            columnProp: 'updateDate',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '修改时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120
          }
        ],
        columnNodeList:  [
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table2ClassificationNo',
            tableId: "109001Table2",
            tableName: "节点信息表",
            columnProp: 'classificationNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '分类编码',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table2WorkflowId',
            tableId: "109001Table2",
            tableName: "节点信息表",
            columnProp: 'workflowId',
            headerAlign: "center",
            align: "center",
            columnLabel: '流程ID',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table2Workflowname',
            tableId: "109001Table2",
            tableName: "节点信息表",
            columnProp: 'workflowname',
            headerAlign: "center",
            align: "center",
            columnLabel: '流程名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table2NodeId',
            tableId: "109001Table2",
            tableName: "节点信息表",
            columnProp: 'nodeId',
            headerAlign: "center",
            align: "center",
            columnLabel: '节点ID',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table2NodeName',
            tableId: "109001Table2",
            tableName: "节点信息表",
            columnProp: 'nodeName',
            headerAlign: "center",
            align: "center",
            columnLabel: '节点名称',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table2SeqNo',
            tableId: "109001Table2",
            tableName: "节点信息表",
            columnProp: 'seqNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '节点顺序',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table2IsReject',
            tableId: "109001Table2",
            tableName: "节点信息表",
            columnProp: 'isRejectDesc',
            headerAlign: "center",
            align: "center",
            columnLabel: '是否可驳回',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60,
          },
          /*{
            userId: this.$store.state.user.name,
            functionId: 109001,
            serialNumber: '109001Table2NodeType',
            tableId: "109001Table2",
            tableName: "节点信息表",
            columnProp: 'nodeType',
            headerAlign: "center",
            align: "center",
            columnLabel: '节点分类',
            columnHidden: false,
            columnImage: false,
            columnSortable: true,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70,
          },*/

        ],

        // ======== 必填规则 ========
        rules: {
          classificationName: [
            {
              required: true,
              message: ' ',
              trigger: 'change'
            }
          ],
          menuId: [
            {
              required: true,
              message: ' ',
              trigger: 'change'
            }
          ],
          workflowId: [
            {
              required: true,
              message: ' ',
              trigger: 'change'
            }
          ],
          status: [
            {
              required: true,
              message: ' ',
              trigger: 'change'
            }
          ]
        },
        // ======== 复选数据集 ========
        quotationSelections: [],
        // ======== 选中的当前行数据 ========
        requestCurrentRow: {},
        nodeCurrentRow: {},
        // ======== 模态框开关控制 ========
        subDetailFlag: false,
        maintenanceFlag: false,
        modalFlag: false,
        authorityFlag: false,
        nodeModalFlag: false,
        nodeModalDisableFlag: false
      }
    },

    mounted () {
      this.$nextTick(() => {
        this.height = window.innerHeight / 2 - 30
        /*第二个表格高度的动态调整*/
        this.secondHeight = window.innerHeight - this.height - 180
      })
    },

    created () {
      // 获取数据列表
      this.getDataList()
    },

    methods: {
      // rowStyle2 ({row}) {
      //   if (!this.authoritySelections.includes(row)) {
      //     row.required = 'N'
      //     return{ 'background-color': '#FFF', cursor: 'pointer' }
      //   }
      //   return{ 'background-color': '#FFF', cursor: 'pointer' }
      // },

      // 编辑模态框
      editNodeModal (row) {
        this.nodeInfo = {
          site: row.site,
          bu: row.bu,
          classificationNo: row.classificationNo,
          workflowId: row.workflowId,
          workflowname: row.workflowname,
          nodeId: row.nodeId,
          nodeName: row.nodeName,
          seqNo: row.seqNo,
          isReject: row.isReject
        }
        this.nodeModalFlag = true
        this.nodeModalDisableFlag = true
      },

      // 修改节点信息
      editNodeInfo () {
        if (this.nodeInfo.isReject === '' || this.nodeInfo.isReject == null) {
          this.$message.warning('请选择节点是否可驳回！')
          return false
        }
        editNodeInfo(this.nodeInfo).then(({data}) => {
          if (data && data.code === 0) {
            this.getNodeInfoByWorkFlowSearch()
            this.nodeModalFlag = false
            this.$message({
              message: '操作成功',
              type: 'success',
              duration: 1500,
              onClose: () => {
              }
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      // 点击行选中复选框
      authorityClickRow (row) {
        //this.$refs.authorityTable.toggleRowSelection(row)
      },

      // 多选
      selectionAuthority (val) {
        this.authoritySelections = val
      },

      // 权限配置
      authorityModal (row) {
        this.authorityData = {
          site: row.site,
          bu: '',
          classificationNo: row.classificationNo,
          nodeId: row.nodeId,
          nodeName: row.nodeName,
          fieldId: '',
          tableId: this.tableList.length > 0 ? this.tableList[0].tableId : '',
          fieldList: [],
          createBy: this.$store.state.user.name
        }
        // 先清空缓存选中
        this.$nextTick(() => this.$refs.authorityTable.clearSelection())
        getAuthorityFieldList(this.authorityData).then(({data}) => {
          if (data && data.code === 0) {
            this.authorityData.fieldList = data.rows
            this.authorityData.fieldList.forEach(val => {
              // 回显选中
              if (val.updateCheck) {
                this.$nextTick(() => this.$refs.authorityTable.toggleRowSelection(val, true))
              }
            })
          } else {
            this.authorityData.fieldList = []
          }
        })
        this.authorityFlag = true
      },

      // 表改变事件
      tableChange3 () {
        getAuthorityFieldList(this.authorityData).then(({data}) => {
          if (data && data.code === 0) {
            this.authorityData.fieldList = data.rows
            this.authorityData.fieldList.forEach(val => {
              // 回显选中
              if (val.updateCheck) {
                this.$nextTick(() => this.$refs.authorityTable.toggleRowSelection(val, true))
              }
            })
          } else {
            this.authorityData.fieldList = []
          }
        })
      },

      // 保存节点权限
      saveAuthorityList () {
        let tempData = {
          site: this.authorityData.site,
          bu: '',
          classificationNo: this.authorityData.classificationNo,
          nodeId: this.authorityData.nodeId,
          nodeName: this.authorityData.nodeName,
          fieldId: '',
          tableId: this.authorityData.tableId,
          fieldList: this.authoritySelections,
          createBy: this.$store.state.user.name
        }
        saveAuthorityList(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.$message.success( '操作成功')
          } else {
            this.$message.error(data.msg)
          }
        })
      },

      // 表改变事件
      tableChange (index) {
        let tempData = {
          tableId: this.tableData[index].plmTable
        }
        this.fieldList = []
        getFieldList(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.fieldList = data.rows
          } else {
            this.fieldList = []
          }
        })
        this.tableData[index].plmField = ''
      },

      // 表改变事件
      tableChange2 (index) {
        let tempData = {
          tableId: this.tableData[index].plmTable
        }
        getFieldList(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.fieldList = data.rows
          } else {
            this.fieldList = []
          }
        })
      },

      // 获取Table列表
      getTableList () {
        getTableList(this.queryTableParam).then(({data}) => {
          if (data && data.code === 0) {
            this.tableList = data.rows
          } else {
            this.tableList = []
          }
        })
      },

      // ======= 正则校验 =======
      handleInput (value, type) {
        // 大于等于0，且只能输入4位小数
        let val = value.replace(/^\D*([0-9]\d*\.?\d{0,4})?.*$/,'$1')
        if (val === null || val === undefined || val === '') {
          val = 0
        }
      },

      // ======== 分页相关方法 ========
      /**
       * 每页数
       * @param val
       */
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },
      /**
       * 当前页
       * @param val
       */
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDataList()
      },

      // ======== 页签切换相关方法 ========
      /**
       * 未知
       * @returns {boolean}
       */
      selectFlag (row) {
        if (row.status === 'Y') {
          return false
        } else {
          return true
        }
      },
      /**
       * 列表表格选择替换
       * @param tab
       * @param event
       */
      tabClick (tab, event) {
        // 刷新列表数据
        this.refreshCurrentTabTable()
      },
      /**
       * 当前值发生变化的时候修改
       * @param row
       * @param oldRow
       */
      changeCurrentRow (row, oldRow) {
        // 判断是否是获取焦点的事件
        if (row) {
          this.requestCurrentRow = JSON.parse(JSON.stringify(row))
          // 刷新当前页表
          this.refreshCurrentTabTable()
          this.tableList = []
          this.fieldList = []
          if (row.menuId === '108002') { // 变更
            this.queryTableParam = {
              tableType: 'plm_change',
              passTable: [
                'plm_change_ecn_type_detail',
                'plm_change_ecn_type_header'
              ],
              addTable: []
            }
          } else if (row.menuId === '102001') { // 询价
            this.queryTableParam = {
              tableType: 'plm_quotation',
              passTable: [],
              addTable: []
            }
          } else if (row.menuId === '103001'){ // 打样
            this.queryTableParam = {
              tableType: 'plm_proofing',
              passTable: [],
              addTable: []
            }
          } else if (row.menuId === '107001') { // 测试
            this.queryTableParam = {
              tableType: 'plm_test_information',
              passTable: [],
              addTable: ['plm_test_so_bom']
            }
          } else if (row.menuId === '103002') { // BM
            this.queryTableParam = {
              tableType: 'plm_stepRole_base_bm',
              passTable: [],
              addTable: [
                'plm_technical_specification_sheet',
                'plm_technicalSpecification_team'
              ]
            }
          } else if (row.menuId === '106002') { // 刀模
            this.queryTableParam = {
              tableType: 'plm_project_tool_applyHeader',
              passTable: [],
              addTable: [
                'plm_project_tool_applyHeader',
                'plm_project_tool_applyDetail'
              ]
            }
          } else {
            return
          }
          this.getTableList()
        }
      },
      /**
       * 刷新页签的table数据
       */
      refreshCurrentTabTable () {
        if (this.activeTable === 'node_item') {
          this.getNodeInfoByWorkFlowSearch()
        }
      },

      // 表格的新增
      rowClassName ({ row, rowIndex }) {
        row.xh = rowIndex + 1
      },
      // 单选框选中数据
      handleDetailSelectionChange(selection) {
        this.checkedDetail = selection
      },
      // 点击新增更多
      handleAddBtn () {
        let obj = {
          site: this.$store.state.user.site,
          classificationNo: this.nodeCurrentRow.classificationNo,
          workflowId: this.nodeCurrentRow.workflowId,
          nodeId: this.nodeCurrentRow.nodeId,
          nodeName: this.nodeCurrentRow.nodeName,
          createBy: this.$store.state.user.name,
          remark: '',
          plmField: '',
          oaField: '',
          fieldValue: '',
          fieldDesc: '',
          orderRef1: '',
          orderRef2: '',
          orderRef3: '',
          orderRef4: '',
          plmTable: '',
          fieldType: 'B'
        }
        // obj.site = this.$store.state.user.site
        // obj.classificationNo = this.nodeCurrentRow.classificationNo
        // obj.workflowId = this.nodeCurrentRow.workflowId
        // obj.nodeId = this.nodeCurrentRow.nodeId
        // obj.nodeName = this.nodeCurrentRow.nodeName
        // obj.createBy = this.$store.state.user.name
        // obj.remark = ""
        // obj.plmField = ""
        // obj.oaField = ""
        // obj.fieldValue = ""
        // obj.fieldDesc = ""
        // obj.orderRef1 = ""
        // obj.orderRef2 = ""
        // obj.orderRef3 = ""
        // obj.orderRef4 = ""
        this.tableData.push(obj)
      },

      //删除
      handleDeleteBtn () {
          if (this.checkedDetail.length === 0) {
            this.$alert("请先选择要删除的数据行", "提示", {
              confirmButtonText: "确定",
            })
          } else {
            this.$confirm("请确认是否删除"+this.checkedDetail.length+"条出口配置?", "提示", {
              confirmButtonText: "确定",
              cancelButtonText: "取消",
              type: "warning",
              callback: (action) => {
                if (action === "confirm") {
                  let val = this.checkedDetail
                  val.forEach((val, index) => {
                    this.tableData.forEach((v, i) => {
                      if (val.xh === v.xh) {
                        this.tableData.splice(i, 1)
                      }
                    })
                  })
                  this.$message({
                    message: "删除成功！",
                    type: "success",
                  })
                  return
                } else {
                  this.$message({
                    message: "已取消删除操作",
                    type: "warning",
                  })
                  return
                }
              },
            })
          }
      },


      // ======== 列表数据刷新方法 ========
      /**
       * @Author Yzz
       * @Description 查询节点现有出口配置
       * @Date 2024/15/12 15:00:28
       **/
      // 出口配置信息查询
      subDetailModal (row) {
        this.nodeCurrentRow = row;
        let tempData = {
          site: this.$store.state.user.site,
          workflowId: this.nodeCurrentRow.workflowId,
          nodeId: this.nodeCurrentRow.nodeId,
          classificationNo: this.nodeCurrentRow.classificationNo,
        }
        getNodeDetail(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.tableData = data.rows
            for (let i = 0; i < this.tableData.length; i++) {
              this.tableChange2(i)
            }
          } else {
            this.tableData = []
          }
        })
        this.subDetailFlag = true
      },

      /**
       * 查询节点信息
       */
      getNodeInfoByWorkFlowSearch () {
        let tempData = {
          site: this.$store.state.user.site,
          //workflowId: this.requestCurrentRow.workflowId,
          classificationNo: this.requestCurrentRow.classificationNo
        }
        getNodeInfoByWorkflow(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.nodeList = data.rows
          } else {
            this.nodeList = []
          }
        })
      },
      // ======== 列表数据刷新方法 ========
      /**
       * 获取数据列表 流程绑定主表信息
       */
      getDataList () {
        this.searchData.limit = this.pageSize
        this.searchData.page = this.pageIndex
        getRequestMainData(this.searchData).then(({data}) => {
          if (data.code === 0) {
            this.dataList = data.page.list
            this.pageIndex = data.page.currPage
            this.pageSize = data.page.pageSize
            this.totalPage = data.page.totalCount
            this.$refs.selectDiv.setLengthAll( this.dataList.length)
            // 判断是否全部存在数据
            if (this.dataList.length > 0) {
              // 设置选中行
              this.$refs.requestTable.setCurrentRow(this.dataList[0])
              this.requestClickRow(this.dataList[0])
            } else {
              this.requestCurrentRow = {}
            }
            // 加载当前的页签的table
            this.refreshCurrentTabTable()
          }
        })
      },

      // ======== 新增/编辑模态框 ========
      /**
       * 流程主表新增按钮
       */
      addModal () {
        this.modalData = {
          flag: '1',
          site: this.$store.state.user.site,
          bu: '',
          buDesc: '',
          classificationNo: '*',
          classificationName: '',
          menuId: '',
          name: '',
          workflowId: '',
          workflowname: '',
          status: 'Y',
          remark: '',
          createBy: this.$store.state.user.name,
        }
        this.maintenanceFlag = false
        this.modalFlag = true
      },
      delModal() {
        if (this.quotationSelections.length === 0) {
          this.$message.warning('请勾选需要删除的信息！')
          return
        }
        this.$confirm(`是否删除这 ` + this.quotationSelections.length + ` 条绑定信息及其他关联信息?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deleteRequestHeader(this.quotationSelections).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.quotationSelections = []
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                }
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }).catch(() => {
        })
      },

      /**
       * 流程主表修改按钮
       * @param row
       */
      updateModal (row) {
        this.modalData = {
          flag: '2',
          site: this.$store.state.user.site,
          bu: row.bu,
          buDesc: row.buDesc,
          classificationNo: row.classificationNo,
          classificationName: row.classificationName,
          menuId: row.menuId,
          name: row.name,
          workflowId: row.workflowId,
          workflowname: row.workflowname,
          status: row.status,
          remark: row.remark,
          updateBy: this.$store.state.user.name,
        }
        this.maintenanceFlag = true
        this.modalFlag = true
      },

      checkDataBySubDetail(){
        for (let i = 0; i < this.tableData.length; i++) {
          if(this.tableData[i].plmTable === '' || this.tableData[i].plmTable == null){
            this.$message.warning('序号' + (i+1) +'未选择PLM数据表,数据表为必填项！')
            return
          }
          if(this.tableData[i].plmField === '' || this.tableData[i].plmField == null){
            this.$message.warning('序号' + (i+1) +'未选择PLM字段名,字段名为必填项！')
            return
          }
          if(this.tableData[i].oaField === '' || this.tableData[i].oaField == null){
            this.$message.warning('序号' + (i+1) +'未填写OA字段名,字段名为必填项！')
            return
          }
          if(this.tableData[i].fieldType === '' || this.tableData[i].fieldType == null){
            this.$message.warning('序号' + (i+1) +'未选择PLM字段类型,字段类型为必填项！')
            return
          }
        }
        if (this.tableData.length === 0){
          this.$confirm(`继续将保存"删除节点全部配置"的操作,是否继续?`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            let obj = {}
            obj.site = this.$store.state.user.site,
            obj.classificationNo = this.nodeCurrentRow.classificationNo,
            obj.workflowId = this.nodeCurrentRow.workflowId,
            obj.nodeId = this.nodeCurrentRow.nodeId,
            obj.createBy = this.$store.state.user.name,
            deleteRequestNodeDetailByLine(obj).then(({data}) => {
              if (data && data.code === 0) {
                //清空手动添加的
                this.tableData = [];
                //查询数据库中保存的
                //this.getDataList()
                //关闭模态框
                this.subDetailFlag = false;
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {}
                })
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          }).catch(() => {
          })
        }else {
          saveRequestNodeDetail(this.tableData).then(({data}) => {
            if (data && data.code === 0) {
              //清空手动添加的
              this.tableData = [];
              //查询数据库中保存的
              //this.getDataList()
              //关闭模态框
              this.subDetailFlag = false;
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }
      },

      /**
       * 返回列表唯一值
       * @param row
       * @returns {string|[{trigger: string, message: string, required: boolean}]|*}
       */
      getRowKeys (row) {
        // 唯一值，一般都为id
        return row.agentId
      },

      // ======== 新增/编辑/删除方法 ========
      /**
       * 流程主表绑定关系新增/编辑
       */
      saveData () {
        if (this.modalData.workflowId === '' || this.modalData.workflowId == null) {
          this.$message.warning('请选择流程！')
          return
        }
        if (this.modalData.menuId === '' || this.modalData.menuId == null) {
          this.$message.warning('请选择功能菜单！')
          return
        }
        if (this.modalData.status === '' || this.modalData.status == null) {
          this.$message.warning('请选择状态！')
          return
        }
        if (this.modalData.flag === '1') {
          saveRequestHeader(this.modalData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.modalFlag = false
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        } else {
          updateRequestHeader(this.modalData).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              this.modalFlag = false
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }
      },

      // ======== 列表操作方法 ========
      /**
       * 单机选中主表绑定信息行
       * @param row
       */
      requestClickRow (row) {
        // this.$refs.requestTable.toggleRowSelection(row)
        this.requestCurrentRow = JSON.parse(JSON.stringify(row))
      },
      /**
       * 复选物料信息
       * @param val
       */
      selectionRequest (val) {
        this.quotationSelections = val
        this.$refs.selectDiv.setLengthselected(this.quotationSelections.length)
      },

      // ======== chooseList相关方法 ========
      /**
       * 获取基础数据列表S
       * @param val
       * @param type
       */
      getBaseList (val, type) {
        this.tagNo = val
        this.$nextTick(() => {
          let strVal = ''
          if (val === 1014) {
            strVal = this.modalData.menuId
          }else if (val === 1015){
            strVal = this.modalData.workflowId
          }
          this.$refs.baseList.init(val, strVal)
        })
      },
      /**
       * 列表方法的回调
       * @param val
       */
      getBaseData (val) {
        if (this.tagNo === 1014) {
          this.modalData.menuId = val.Menu_id
          this.modalData.name = val.Name
        } else if (this.tagNo === 1015) {
          this.modalData.workflowId = val.Workflowid
          this.modalData.workflowname = val.Workflowname
        }
      },

      // 流程ID输入校验
      workflowBlur (tagNo) {
        if (this.modalData.workflowId != null && this.modalData.workflowId !== '') {
          let tempData = {
            tagno: tagNo,
            conditionSql: " and Workflowid = '" + this.modalData.workflowId + "'"
          }
          verifyData(tempData).then(({data}) => {
            if (data && data.code === 0) {
              if (data.baseListData.length > 0) {
                this.modalData.workflowId = data.baseListData[0].Workflowid
                this.modalData.workflowname = data.baseListData[0].Workflowname
                return
              }
            }
          })
        }
        this.modalData.workflowname = ''
      },

      // 菜单ID输入校验
      menuBlur (tagNo) {
        if (this.modalData.menuId != null && this.modalData.menuId !== '') {
          let tempData = {
            tagno: tagNo,
            conditionSql: " and Menu_id = '" + this.modalData.menuId + "'"
          }
          verifyData(tempData).then(({data}) => {
            if (data && data.code === 0) {
              if (data.baseListData.length > 0) {
                this.modalData.menuId = data.baseListData[0].Menu_id
                this.modalData.name = data.baseListData[0].Name
                return
              }
            }
          })
        }
        this.modalData.name = ''
      },

      // ======== 导出相关方法 ========
      /**
       * 导出excel
       */
      async createExportData () {
        this.searchData.limit = -1
        this.searchData.page = 1
        await getRequestMainData(this.searchData).then(({data}) => {
          this.resultList = data.page.list
        })
        return this.resultList
      },

      startDownload () {},

      finishDownload () {},

      fields () {
        let json = '{'
        this.columnList.forEach((item, index) => {
          if (index == this.columnList.length - 1) {
            json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
          } else {
            json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
          }
        })
        json += '}'
        let s = eval('(' + json + ')')
        return s
      },

      rowStyle ({row}) {
        if (this.requestCurrentRow.classificationNo === row.classificationNo) {
          return { 'background-color': '#E8F7F6', cursor: 'pointer' };
        }
      }
    }
  }
</script>

<style scoped lang="scss">
/deep/ .customer-tab .el-tabs__content {
  padding: 0px !important;
  height: 459px;
}
/deep/ .customer-tab .el-tabs__content {
  height: 294px;
}
.numInput /deep/ .el-input__inner{
  text-align: right;
}
/deep/  .inlineNumber input::-webkit-outer-spin-button,
/deep/  .inlineNumber input::-webkit-inner-spin-button {
  -webkit-appearance: none;

}
/deep/  .inlineNumber input[type="number"]{
  -moz-appearance: textfield;
  padding-right: 5px !important;
}
</style>

