<template>
  <el-dialog
    :title="title || $t1('表单脚本列表')"
    :append-to-body="true"
    :modal-append-to-body="true"
    :close-on-click-modal="falseValue"
    :visible.sync="showDialog"
    :modal="falseValue"
    custom-class="dialog-style list-dialog dialog-checkbox dialog-tab"
    width="1200px"
    @close="dialogClose"
    v-el-drag-dialog
    v-el-dialog-center
  >
    <div class="cont">
      <x-tabs ref="xTabs" v-model="activeName" class="tab-box">
        <el-tab-pane :label="$t1('常规')" name="first">
          <div id="containt">
            <editView v-if="showEdit" visible-key="showEdit" :_dataId.sync="dataId" :parent-target="_self"
                      @reload="$reloadHandle" :readonly="true"></editView>
          </div>
        </el-tab-pane>
        <el-tab-pane :label="$t1('列表')" name="second">
          <div style="height:450px">
            <vxe-grid
              class="is-pointer"
              ref="table-m1"
              v-bind="vxeOption"
              @resizable-change="$vxeTableUtil.onColumnWitchChange"
              @custom="$vxeTableUtil.customHandle"
              @checkbox-change="addDataTable"
              @checkbox-all="checkAll"
              @cell-dblclick="checkWithSubmit"
            >
              <template #form>
                <div class="clearfix screen-btns">
                  <div class="fr">
                    <vxe-button icon="el-icon-brush" class="button-sty" @click="resetEvent" type="text" status="primary"
                                plain>{{ $t1('重置') }}
                    </vxe-button>
                    <vxe-button status="warning" icon="el-icon-search" class="button-sty" @click="searchEvent">
                      {{ $t1('搜索') }}
                    </vxe-button>
                  </div>
                </div>
                <vxe-form class="screen-box" title-width="92px" title-align="right" :data="formData"
                          @submit="searchEvent"
                          @reset="resetEvent">
                  <vxe-form-item :title="$t1('脚本名称') + ':'" field="scriptName">
                    <template v-slot>
                      <el-input v-model="formData.scriptName" size="small" clearable/>
                    </template>
                  </vxe-form-item>
                  <vxe-form-item :title="$t1('脚本编码') + ':'" field="scriptCode">
                    <template v-slot>
                      <el-input v-model="formData.scriptCode" size="small" clearable/>
                    </template>
                  </vxe-form-item>
                  <vxe-form-item :title="$t1('脚本说明') + ':'" field="scriptRemark">
                    <template v-slot>
                      <el-input v-model="formData.scriptRemark" size="small" clearable/>
                    </template>
                  </vxe-form-item>
                  <vxe-form-item :title="$t1('脚本') + ':'" field="script">
                    <template v-slot>
                      <el-input v-model="formData.script" size="small" clearable/>
                    </template>
                  </vxe-form-item>
                </vxe-form>
              </template>
            </vxe-grid>
          </div>
          <label id="labBtn" class="transverse">
            <div class="icon">
              <i class="el-icon-more"></i>
              <i class="el-icon-more"></i>
            </div>
          </label>
          <div class="multipleChoice">
            <el-tooltip :enterable="false" effect="dark" :content="$t1('全部删除')" placement="top"><a
              class="allDel icon-quanbushanchu" @click="clearChecked()"></a></el-tooltip>
            <div class="list">
              <div class="item" v-for="(checkRow, index) in checkRows" :key="index">
                <p>{{ checkRow.scriptName }}</p>
                <a class="el-icon-close" @click="clearTable1Select(index)"></a>
              </div>
            </div>
          </div>
        </el-tab-pane>
        <template #editTab="{tab,index,reloadTabContent}">
          <el-tab-pane :key="tab.data.id" :label.sync="tab.data.scriptName" :name="tab.data.id+''"
                       :closable="true">
            <div id="containt">
              <editView v-if="tab.showContent" :_dataId="tab.dataId" :parent-target="_self"
                        @reload="reloadTabContent" :readonly="true"></editView>
            </div>
          </el-tab-pane>
        </template>
      </x-tabs>
    </div>
    <span slot="footer" class="dialog-footer">
			<span class="fl tips" v-if="!selectMulti">{{ $t1('注：双击确认选择（单选）') }}</span>
			<el-button type="primary" plain class="button-sty" @click="dialogClose">
				<i class="el-icon-close el-icon"></i>
				{{ $t1('取 消') }}
			</el-button>
			<el-button type="primary" @click="dialogPrimary" class="button-sty">
				<i class="el-icon-check el-icon"></i>
				{{ $t1('确 定') }}
			</el-button>
		</span>
  </el-dialog>
</template>

<script>
import mixin from "./mixins/dialog";

export default {
  name: 'formScriptDialog',
  mixins: [mixin]
};
</script>
