<template>
  <div class="detail-wrap">
    <el-form ref="editForm" :model="szTaMb">
      <div class="d-header clearfix">
        <div class="fl">
          <i class="el-icon-info" />
          {{ dataId ? $t1("查看数据表定义模板") : $t1("新增数据表定义模板") }}
        </div>
        <div class="fr">
          <formVersionButton
            v-if="!hData && szTaMb.id && !readonly"
            objType="SzTaMb"
            :objCode="szTaMb.taCode"
            @reverCallback="$baseReload()"
          ></formVersionButton>
          <reverButton
            v-if="!!hData"
            objType="SzTaMb"
            :objCode="szTaMb.taCode"
            :hData="hData"
            @reverCallback="$emit('reverCallback')"
          ></reverButton>
          <el-button
            type="primary"
            plain
            class="button-sty"
            icon="el-icon-set-up"
            @click="openOtherAuthDialog"
            v-if="
              isDev && !!dataId && menuKindAuth.editAuth === 1 && !readonly && !otherFlag
            "
          >
            {{ $t1("分派") }}
          </el-button>
          <el-button
            type="primary"
            plain
            class="button-sty"
            icon="el-icon-set-up"
            @click="openDtDialog"
            v-if="isDev && !dataId && menuKindAuth.editAuth === 1 && !readonly"
          >
            {{ $t1("引用数据库中数据表结构") }}
          </el-button>
          <el-button
            type="primary"
            plain
            class="button-sty"
            icon="el-icon-set-up"
            @click="openTmDialog"
            v-if="isDev && !dataId && menuKindAuth.editAuth === 1 && !readonly"
          >
            {{ $t1("引用数据表定义的结构") }}
          </el-button>

          <el-button
            type="success"
            class="button-sty"
            icon="el-icon-check"
            @click="createModifyTable()"
            v-if="
              !szTaMb.systems && szTaMb.id && menuKindAuth.editAuth === 1 && !readonly
            "
          >
            {{ $t1("创建/更新数据表") }}
          </el-button>
          <el-button
            type="primary"
            plain
            class="button-sty"
            @click="$baseReload()"
            icon="el-icon-refresh-right"
          >
            {{ $t1("重置") }}
          </el-button>
          <el-button
            type="primary"
            class="button-sty"
            icon="el-icon-check"
            @click="saveData"
            v-if="isDev && !szTaMb.systems && menuKindAuth.editAuth === 1 && !readonly"
          >
            {{ $t1("保存") }}
          </el-button>
        </div>
      </div>
      <baseTabs>
        <baseTabPane :label="$t1('基本信息')">
          <template #default>
            <table class="table-detail">
              <tbody>
                <tr>
                  <th>{{ $t1("数据库表名") }}</th>
                  <td colspan="3">
                    <el-form-item
                      prop="taBm"
                      :rules="[{ required: false, trigger: ['blur', 'change'] }]"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.taBm"
                        :newVal="szTaMb.taBm"
                      >
                        <el-input
                          type="text"
                          autocomplete="off"
                          v-model="szTaMb.taBm"
                          clearable
                          :disabled="!!dataId"
                        />
                      </fieldCompare>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th class="no"></th>
                  <td colspan="7">
                    <span class="fl tips">{{
                      $t1(
                        "注：数据库表名必须定义为：1、与实体名称一样，2、表单分类数据表前缀_实体名称，3、不填自动生成：表单分类数据表前缀_实体名称。"
                      )
                    }}</span>
                  </td>
                </tr>
                <tr>
                  <th>
                    <em class="f-red">*</em>
                    {{ $t1("实体名称") }}
                  </th>
                  <td colspan="3">
                    <el-form-item
                      prop="taEn"
                      :rules="[{ required: true, trigger: ['blur', 'change'] }]"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.taEn"
                        :newVal="szTaMb.taEn"
                      >
                        <el-input
                          type="text"
                          autocomplete="off"
                          v-model="szTaMb.taEn"
                          clearable
                        />
                      </fieldCompare>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th><em class="f-red">*</em>{{ $t1("表描述") }}</th>
                  <td colspan="5">
                    <el-form-item
                      prop="taCh"
                      :rules="[{ required: true, trigger: ['blur', 'change'] }]"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.taCh"
                        :newVal="szTaMb.taCh"
                      >
                        <el-input
                          type="text"
                          autocomplete="off"
                          v-model="szTaMb.taCh"
                          clearable
                        />
                      </fieldCompare>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th><em class="f-red">*</em>{{ $t1("是否明细") }}</th>
                  <td>
                    <el-form-item
                      prop="taType"
                      :rules="[{ required: true, trigger: ['blur', 'change'] }]"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.taType"
                        :newVal="szTaMb.taType"
                      >
                        <el-radio-group v-model="szTaMb.taType">
                          <el-radio :label="1">{{ $t1("是") }}</el-radio>
                          <el-radio :label="0">{{ $t1("否") }}</el-radio>
                        </el-radio-group>
                      </fieldCompare>
                    </el-form-item>
                  </td>
                  <th>
                    <em class="f-red" v-show="szTaMb.taType === 1">*</em>
                    {{ $t1("所属主实体") }}
                  </th>
                  <td colspan="3">
                    <el-form-item
                      prop="sszstEn"
                      :rules="[
                        {
                          required: szTaMb.taType === 1,
                          trigger: ['blur', 'change'],
                        },
                      ]"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.sszstEn"
                        :newVal="szTaMb.sszstEn"
                      >
                        <el-input
                          class="search-input"
                          max="200"
                          v-model="szTaMb.sszstEn"
                          @clear="
                            szTaMb.sszst = null;
                            szTaMb.sszstBm = null;
                            $forceUpdate();
                          "
                          :disabled="szTaMb.taType === 0"
                          v-el-readonly
                          clearable
                        >
                          <i
                            slot="suffix"
                            class="el-input__icon el-icon-search"
                            @click="showSzTaMbDialog = true"
                          ></i>
                        </el-input>
                      </fieldCompare>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th><em class="f-red">*</em>{{ $t1("是否树结构") }}</th>
                  <td>
                    <el-form-item
                      prop="taRule"
                      :rules="[{ required: true, trigger: ['blur', 'change'] }]"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.taRule"
                        :newVal="szTaMb.taRule"
                      >
                        <el-radio-group v-model="szTaMb.taRule" @change="changeTaRule">
                          <el-radio :label="1">{{ $t1("是") }}</el-radio>
                          <el-radio :label="0">{{ $t1("否") }}</el-radio>
                        </el-radio-group>
                      </fieldCompare>
                    </el-form-item>
                  </td>
                  <th><em class="f-red">*</em>{{ $t1("数据范围") }}</th>
                  <td colspan="3">
                    <el-form-item
                      prop="dataRange"
                      :rules="[{ required: true, trigger: ['blur', 'change'] }]"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.dataRange"
                        :newVal="szTaMb.dataRange"
                      >
                        <el-radio-group v-model="szTaMb.dataRange">
                          <el-radio :label="1">{{ $t1("集团") }}</el-radio>
                          <el-radio :label="0">{{ $t1("当前组织") }}</el-radio>
                        </el-radio-group>
                      </fieldCompare>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th>
                    <em class="f-red">*</em>
                    {{ $t1("表单分类") }}
                  </th>
                  <td colspan="5">
                    <el-form-item
                      prop="menuKindName"
                      :rules="[
                        {
                          required: true,
                          trigger: ['blur', 'change'],
                        },
                      ]"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.menuKindName"
                        :newVal="szTaMb.menuKindName"
                      >
                        <el-input
                          class="search-input"
                          max="200"
                          v-model="szTaMb.menuKindName"
                          @clear="
                            szTaMb.menuKindCode = '';
                            $forceUpdate();
                          "
                          v-el-readonly
                          clearable
                          :disabled="otherFlag"
                        >
                          <i
                            slot="suffix"
                            class="el-input__icon el-icon-search"
                            @click="showMenuKindDialog = true"
                          ></i>
                        </el-input>
                      </fieldCompare>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th>
                    {{ $t1("项目标签") }}
                  </th>
                  <td colspan="7">
                    <projectTagView v-model="szTaMb.szTaMbTagDTOs"></projectTagView>
                  </td>
                </tr>
                <tr>
                  <th>{{ $t1("是否启用") }}</th>
                  <td>
                    <el-form-item
                      prop="enabled"
                      :rules="[{ required: false, trigger: 'blur' }]"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.enabled"
                        :newVal="szTaMb.enabled"
                      >
                        <el-radio-group v-model="szTaMb.enabled">
                          <el-radio :label="true">{{ $t1("启用") }}</el-radio>
                          <el-radio :label="false">{{ $t1("禁用") }}</el-radio>
                        </el-radio-group>
                      </fieldCompare>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th>
                    {{ $t1("服务名") }}
                  </th>
                  <td colspan="7">
                    <el-form-item>
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="oldSzTaMb.serviceName"
                        :newVal="szTaMb.serviceName"
                      >
                        {{ szTaMb.serviceName }}
                      </fieldCompare>
                    </el-form-item>
                  </td>
                </tr>
                <tr>
                  <th>
                    {{ $t1("版本号") }}
                  </th>
                  <td colspan="7">
                    {{ szTaMb.version }}
                  </td>
                </tr>
                <tr>
                  <th>
                    {{ $t1("唯一标识") }}
                  </th>
                  <td colspan="7">
                    {{ szTaMb.sid }}
                  </td>
                </tr>
                <tr>
                  <th>{{ $t1("创建人") }}</th>
                  <td>{{ szTaMb.createBy }}</td>
                  <th>{{ $t1("创建时间") }}</th>
                  <td>{{ szTaMb.createDate }}</td>
                  <th>{{ $t1("更新人") }}</th>
                  <td>{{ szTaMb.modifyBy }}</td>
                  <th>{{ $t1("更新时间") }}</th>
                  <td>{{ szTaMb.modifyDate }}</td>
                </tr>
              </tbody>
            </table>
          </template>
        </baseTabPane>
        <baseTabPane :label="$t1('数据表字段明细')">
          <template #button>
            <el-button class="button-sty" @click="addTaMbItems" icon="el-icon-plus"
              >{{ $t1("新增") }}
            </el-button>
            <el-button
              v-if="userFlag === 6"
              type="primary"
              class="button-sty"
              icon="el-icon-upload2"
              @click="excelExport"
              >导出</el-button
            >
          </template>
          <template #default>
            <div>
              <vxe-grid
                ref="table-szTaZdMb"
                :data="szTaMb.szTaZdMbDTOs"
                v-bind="productOption"
                @resizable-change="$vxeTableUtil.onColumnWitchChange"
                @custom="$vxeTableUtil.customHandle"
              >
                <template #zdType="{ row, column }">
                  <el-form-item>
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="zdTypeMap[row[column.property]]"
                    >
                      <el-select
                        v-model="row.zdType"
                        clearable
                        :disabled="!!row.systems || !!row.relationZd"
                        @change="changeZdType(row)"
                      >
                        <el-option value="Boolean" :label="$t1('布尔')"></el-option>
                        <el-option value="Integer" :label="$t1('整数')"></el-option>
                        <el-option value="Long" :label="$t1('长整数')"></el-option>
                        <el-option value="Decimal" :label="$t1('精度小数')"></el-option>
                        <el-option value="Money" :label="$t1('金额')"></el-option>
                        <el-option value="Text" :label="$t1('文本')"></el-option>
                        <el-option value="TextArea" :label="$t1('长文本')"></el-option>
                        <el-option value="DateTime" :label="$t1('日期时间')"></el-option>
                        <el-option value="Reference" :label="$t1('关联表(文本)')"></el-option>
                        <el-option value="ReferenceLong" :label="$t1('关联表(长整型)')"></el-option>
                      </el-select>
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #zdLength="{ row, rowIndex, column }">
                  <el-form-item
                    :prop="'szTaZdMbDTOs.' + rowIndex + '.zdLength'"
                    :rules="[{ required: false, trigger: ['blur', 'change'] }]"
                  >
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-input
                        v-model="row.zdLength"
                        clearable
                        :disabled="!!row.systems || !!row.relationZd"
                      />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #referenceZd="{ row, rowIndex, column, $table }">
                  <el-form-item>
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-input
                        class="search-input"
                        v-model="row.referenceZd"
                        v-el-readonly
                        v-if="isReferenceZdType(row.zdType)"
                        :disabled="!row.zdEn"
                      >
                        <span slot="suffix" class="el-input__suffix-inner">
                          <i
                            v-if="row.referenceZd"
                            class="el-input__icon el-icon-circle-close"
                            @click.stop="confirmClearReferenceZd(row)"
                          ></i>
                          <i
                            class="el-input__icon el-icon-search"
                            @click="openReferenceZdDialog(row, rowIndex, $table)"
                          ></i>
                        </span>
                      </el-input>
                      <template v-else>
                        {{ row.referenceZd }}
                      </template>
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #zdEn="{ row, rowIndex, column }">
                  <template v-if="!!row.systems || row.fromTable">
                    <el-form-item>
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="getHValue(row, column)"
                        :newVal="row[column.property]"
                      >
                        {{ row.zdEn }}
                      </fieldCompare>
                    </el-form-item>
                  </template>
                  <template v-else>
                    <el-form-item
                      :prop="'szTaZdMbDTOs.' + rowIndex + '.zdEn'"
                      :rules="[{ required: true, trigger: ['blur', 'change'] }]"
                      :style="!!row.relationZd ? 'padding-left:20px' : ''"
                    >
                      <fieldCompare
                        :isCompare="isCompare"
                        :oldVal="getHValue(row, column)"
                        :newVal="row[column.property]"
                      >
                        <el-input
                          v-model="row.zdEn"
                          @keydown.native="inputZdEn(row)"
                          @input="
                            (val) => {
                              changeZdEn(val, row);
                            }
                          "
                        />
                      </fieldCompare>
                    </el-form-item>
                  </template>
                </template>
                <template #zdCh="{ row, rowIndex, column }">
                  <el-form-item
                    :prop="'szTaZdMbDTOs.' + rowIndex + '.zdCh'"
                    :rules="[{ required: true, trigger: ['blur', 'change'] }]"
                  >
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-input v-model="row.zdCh" clearable :disabled="!!row.systems" />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #zdTypeValues="{ row, rowIndex, column }">
                  <el-form-item
                    :prop="'szTaZdMbDTOs.' + rowIndex + '.zdTypeValues'"
                    :rules="[{ required: false, trigger: ['blur', 'change'] }]"
                  >
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-input
                        v-model="row.zdTypeValues"
                        clearable
                        :disabled="!!row.systems || !!row.relationZd"
                      />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #required="{ row, rowIndex, column }">
                  <el-form-item>
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-checkbox
                        v-model="row.required"
                        :disabled="!!row.systems || !!row.relationZd"
                      />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #enabled="{ row, rowIndex, column }">
                  <el-form-item>
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-checkbox
                        v-model="row.enabled"
                        :disabled="!!row.systems || !!row.relationZd"
                      />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #generateCode="{ row, rowIndex, column }">
                  <el-form-item>
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-checkbox
                        v-model="row.generateCode"
                        :disabled="!!row.systems || !!row.relationZd"
                      />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #atened="{ row, rowIndex, column }">
                  <el-form-item>
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-checkbox
                        v-model="row.atened"
                        :disabled="!!row.systems || !!row.relationZd"
                      />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #updateIgnore="{ row, rowIndex, column }">
                  <el-form-item>
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-checkbox
                        v-model="row.updateIgnore"
                        :disabled="!!row.systems || !!row.relationZd"
                      />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #codeType="{ row, rowIndex, column }">
                  <el-form-item
                    :prop="'szTaZdMbDTOs.' + rowIndex + '.codeType'"
                    :rules="[{ required: false, trigger: ['blur', 'change'] }]"
                  >
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-input
                        v-model="row.codeType"
                        clearable
                        :disabled="!!row.systems || !!row.relationZd"
                      />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #orders="{ row, rowIndex, column }">
                  <el-form-item
                    :prop="'szTaZdMbDTOs.' + rowIndex + '.orders'"
                    :rules="[{ required: false, trigger: ['blur', 'change'] }]"
                  >
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <base-input-number
                        v-model="row.orders"
                        clearable
                        :disabled="!!row.systems"
                        @change="changeOrders(row)"
                      />
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #toTaBmZd="{ row, rowIndex, column, $table }">
                  <el-form-item
                    :prop="'szTaZdMbDTOs.' + rowIndex + '.toTaBmZd'"
                    :rules="[{ required: false, trigger: ['blur', 'change'] }]"
                  >
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="row[column.property]"
                    >
                      <el-input
                        class="search-input"
                        v-model="row.toTaBmZd"
                        clearable
                        @clear="$forceUpdate()"
                        v-el-readonly
                        :disabled="!!row.systems || !!row.relationZd"
                      >
                        <i
                          slot="suffix"
                          class="el-input__icon el-icon-search"
                          @click="openToTaBmZdDialog(row, rowIndex, $table)"
                        ></i>
                      </el-input>
                    </fieldCompare>
                  </el-form-item>
                </template>
                <template #treeFlag="{ row, column }">
                  <el-form-item>
                    <fieldCompare
                      :isCompare="isCompare"
                      :oldVal="getHValue(row, column)"
                      :newVal="treeFlagMap[row[column.property]]"
                    >
                      <el-select
                        v-model="row.treeFlag"
                        clearable
                        :disabled="
                          !!row.systems || !!row.relationZd || szTaMb.taRule !== 1
                        "
                      >
                        <el-option value="name" :label="$t1('名称')"></el-option>
                        <el-option value="wbs" :label="$t1('WBS码')"></el-option>
                        <el-option value="parent" :label="$t1('上级ID')"></el-option>
                        <el-option value="treePath" :label="$t1('树ID路径')"></el-option>
                        <el-option
                          value="treePathName"
                          :label="$t1('树名称路径')"
                        ></el-option>
                        <el-option
                          value="hasChild"
                          :label="$t1('是否有下级')"
                        ></el-option>
                        <el-option value="grade" :label="$t1('层级')"></el-option>
                      </el-select>
                    </fieldCompare>
                  </el-form-item>
                </template>
              </vxe-grid>
            </div>
            <table class="table-detail">
              <tbody>
                <tr>
                  <th>
                    {{ $t1("表编码") }}
                  </th>
                  <td colspan="7">
                    {{ szTaMb.taCode }}
                  </td>
                </tr>
              </tbody>
            </table>
          </template>
        </baseTabPane>
        <baseTabPane :label="$t1('操作日志')">
          <template #default>
            <formOplogTable :parent-target="_self" ref="oplogTable"></formOplogTable>
          </template>
        </baseTabPane>
      </baseTabs>
    </el-form>

    <szTaMbDialog
      v-if="showSzTaMbDialog"
      :visiable.sync="showSzTaMbDialog"
      @confirm="confirmInsertSzTaMb"
      :multi="false"
    />
    <szTaMbDialog
      v-if="showItemSzTaMbDialog"
      :visiable.sync="showItemSzTaMbDialog"
      @confirm="confirmInsertItemSzTaMb"
      multi="false"
    />
    <MenuKindDialog
      v-if="showMenuKindDialog"
      :visiable.sync="showMenuKindDialog"
      @confirm="confirmInsertMenuKind"
      :multi="false"
    />

    <el-dialog
      :title="$t1('关联表维护')"
      v-if="showReferenceZdDialog"
      :visible.sync="showReferenceZdDialog"
      :modal-append-to-body="false"
      :close-on-click-modal="false"
      :modal="false"
      custom-class="dialog-style wf-dialog"
      v-el-drag-dialog
      v-el-dialog-center
    >
      <el-form>
        <div id="containt">
          <table class="table-detail">
            <tbody>
              <tr>
                <th>
                  <span class="t">
                    {{ $t1("关联表") }}
                  </span>
                </th>
                <td>
                  <el-form-item label="">
                    <el-input
                      class="search-input"
                      max="200"
                      v-model="referenceEntity"
                      @clear="
                        referenceKey = null;
                        refServiceName = null;
                        referenceShowFields = [];
                        $forceUpdate();
                      "
                      v-el-readonly
                      clearable
                    >
                      <i
                        slot="suffix"
                        class="el-input__icon el-icon-search"
                        @click="showEntityDialog = true"
                      ></i>
                    </el-input>
                  </el-form-item>
                </td>
              </tr>
              <tr>
                <th>
                  <span class="t">
                    {{ $t1("关联字段") }}
                  </span>
                </th>
                <td>
                  <el-form-item label="">
                    <el-input
                      class="search-input"
                      max="200"
                      v-model="referenceKey"
                      @clear="referenceKey = null"
                      v-el-readonly
                      clearable
                    >
                      <i
                        slot="suffix"
                        class="el-input__icon el-icon-search"
                        @click="openEntityFieldDialog1"
                      ></i>
                    </el-input>
                  </el-form-item>
                </td>
              </tr>
              <tr>
                <th>
                  <span class="t">
                    {{ $t1("显示字段") }}
                  </span>
                </th>
                <td>
                  <el-form-item label="">
                    <el-input
                      class="search-input"
                      max="200"
                      :value="referenceShowFields.join(',')"
                      @clear="referenceShowFields = []"
                      v-el-readonly
                      clearable
                    >
                      <i
                        slot="suffix"
                        class="el-input__icon el-icon-search"
                        @click="openEntityFieldDialog2"
                      ></i>
                    </el-input>
                  </el-form-item>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button
          type="primary"
          plain
          class="button-sty"
          @click="showReferenceZdDialog = false"
        >
          <i class="el-icon-close el-icon"></i>
          {{ $t1("取 消") }}
        </el-button>
        <el-button type="primary" @click="confirmReferenceZdDialog" class="button-sty">
          <i class="el-icon-check el-icon"></i>
          {{ $t1("确 定") }}
        </el-button>
      </span>
    </el-dialog>

    <szTaMbDialog
      v-if="showEntityDialog"
      :visiable.sync="showEntityDialog"
      @confirm="confirmEntityDialog"
      :multi="false"
    />

    <zdDialog
      v-if="showEntityFieldDialog1"
      :visiable.sync="showEntityFieldDialog1"
      @confirm="confirmEntityFieldDialog1"
      :taBm="referenceEntity"
      :multi="false"
    />
    <zdDialog
      v-if="showEntityFieldDialog2"
      :visiable.sync="showEntityFieldDialog2"
      @confirm="confirmEntityFieldDialog2"
      :taBm="referenceEntity"
      :multi="true"
    />
    <preformDialog
      v-if="showPreformDialog"
      :visiable.sync="showPreformDialog"
      @confirm="confirmPreformDialog"
    ></preformDialog>

    <szTaMbDialog
      v-if="showTmDialog"
      :visiable.sync="showTmDialog"
      @confirm="confirmTmDialog"
      :multi="false"
    />

    <el-dialog
      :title="$t1('引用数据库中数据表结构')"
      :append-to-body="true"
      :modal-append-to-body="true"
      :close-on-click-modal="false"
      v-if="showDtDialog"
      :visible.sync="showDtDialog"
      :modal="false"
      custom-class="dialog-style list-dialog dialog-checkbox pd_8"
      width="350px"
      v-el-drag-dialog
    >
      <div class="cont">
        <el-form
          ref="editCategoryForm"
          label-width="102px"
          class="adSearchForm"
          style="height: auto; width: auto"
        >
          <el-form-item :label="$t1('数据表')">
            <el-input v-model="dbTable" clearable class="all-width" />
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" plain class="button-sty" @click="showDtDialog = false">
          <i class="el-icon-close el-icon"></i>
          {{ $t2("取 消", "system.button.cancel2") }}
        </el-button>
        <el-button type="primary" @click="confirmDtDialog" class="button-sty">
          <i class="el-icon-check el-icon"></i>
          {{ $t1("确定") }}
        </el-button>
      </span>
    </el-dialog>

    <otherAuthDialog
      v-if="showOtherAuthDialog"
      :visiable.sync="showOtherAuthDialog"
      :sid="sid"
      @confirm="confirmOtherAuthDialog"
    ></otherAuthDialog>

    <!--begin-->
    <el-dialog
      :title="$t1('数据值对应表字段')"
      v-if="showToTaBmZdDialog"
      :visible.sync="showToTaBmZdDialog"
      :modal-append-to-body="false"
      :close-on-click-modal="false"
      :modal="false"
      custom-class="dialog-style wf-dialog"
      v-el-drag-dialog
      v-el-dialog-center
    >
      <el-form>
        <div id="containt">
          <table class="table-detail">
            <tbody>
              <tr>
                <th>
                  <span class="t">
                    {{ $t1("对应表") }}
                  </span>
                </th>
                <td>
                  <el-form-item label="">
                    <el-input
                      class="search-input"
                      max="200"
                      v-model="toTaBmZdEntity"
                      @clear="
                        toTaBmZdEntity = null;
                        toTaBmZdField = null;
                      "
                      v-el-readonly
                      clearable
                    >
                      <i
                        slot="suffix"
                        class="el-input__icon el-icon-search"
                        @click="showEntityDialog3 = true"
                      ></i>
                    </el-input>
                  </el-form-item>
                </td>
              </tr>
              <tr>
                <th>
                  <span class="t">
                    {{ $t1("对应表字段") }}
                  </span>
                </th>
                <td>
                  <el-form-item label="">
                    <el-input
                      class="search-input"
                      max="200"
                      v-model="toTaBmZdField"
                      @clear="toTaBmZdField = null"
                      v-el-readonly
                      clearable
                    >
                      <i
                        slot="suffix"
                        class="el-input__icon el-icon-search"
                        @click="openEntityFieldDialog3"
                      ></i>
                    </el-input>
                  </el-form-item>
                </td>
              </tr>
            </tbody>
          </table>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button
          type="primary"
          plain
          class="button-sty"
          @click="showToTaBmZdDialog = false"
        >
          <i class="el-icon-close el-icon"></i>
          {{ $t1("取 消") }}
        </el-button>
        <el-button type="primary" @click="confirmToTaBmZdDialog" class="button-sty">
          <i class="el-icon-check el-icon"></i>
          {{ $t1("确 定") }}
        </el-button>
      </span>
    </el-dialog>

    <szTaMbDialog
      v-if="showEntityDialog3"
      :visiable.sync="showEntityDialog3"
      @confirm="confirmEntityDialog3"
      :multi="false"
    />

    <zdDialog
      v-if="showEntityFieldDialog3"
      :visiable.sync="showEntityFieldDialog3"
      @confirm="confirmEntityFieldDialog3"
      :taBm="toTaBmZdEntity"
      :multi="false"
    />
    <!--end-->
  </div>
</template>

<script>
import mixin from "./mixins/edit";
import formVersionButton from "@base/views/bd/setting/formVersion/button.vue";
import reverButton from "@base/views/bd/setting/formVersion/reverButton.vue";
import fieldCompare from "@base/views/bd/setting/formVersion/fieldCompare.vue";
export default {
  name: "szTaMbEdit",
  mixins: [mixin],
  components: {
    formVersionButton,
    reverButton,
    fieldCompare,
  },
  methods: {},
};
</script>
