<template> 
 | 
  <div class="mod-sys__dict"> 
 | 
    <zt-table-wraper ref="dataTable" v-slot="{ table }" :lazy="true" delete-url="/sys/dict/data" 
 | 
                     query-url="/sys/dict/data/page"> 
 | 
          <el-form :inline="true" :model="dataForm" @keyup.enter.native="table.query()"> 
 | 
            <el-form-item style="margin-top: 2px;margin-left: 10px"> 
 | 
              <el-input v-model="dataForm.dictLabel" :placeholder="$t('dict.dictLabel')" clearable></el-input> 
 | 
            </el-form-item> 
 | 
            <el-form-item> 
 | 
              <zt-button class="admin-query-button" type="query" @click="table.query()"/> 
 | 
              <zt-button v-if="dataForm.dictTypeId" perm="sys:dict" type="add" @click="table.editHandle()"/> 
 | 
            </el-form-item> 
 | 
          </el-form> 
 | 
          <el-table v-adaptive="{bottomOffset:70}" v-loading="table.dataLoading" :data="table.dataList" 
 | 
                    border 
 | 
                    height="650px" 
 | 
                    @selection-change="table.selectionChangeHandle" @sort-change="table.sortChangeHandle"> 
 | 
            <el-table-column :label="$t('dict.dictValue')" align="center" prop="dictValue" width="100"/> 
 | 
            <el-table-column :label="$t('dict.dictLabel')" prop="dictLabel"/> 
 | 
            <el-table-column :label="$t('dict.sort')" align="center" prop="sort" width="60"/> 
 | 
            <el-table-column :label="$t('dict.remark')" prop="remark"/> 
 | 
            <zt-table-column-handle :has-delete="isCanDelete" :has-edit="isCanUpdate" :table="table" 
 | 
                                    delete-perm="sys:dict:delete" edit-perm="sys:dict:update"/> 
 | 
          </el-table> 
 | 
  
 | 
      <!-- 弹窗, 新增 / 修改 --> 
 | 
      <add-or-update :dictTypeId="dataForm.dictTypeId" :dictTypeName="dataForm.dictTypeName" 
 | 
                     @refreshDataList="table.query"/> 
 | 
    </zt-table-wraper> 
 | 
  </div> 
 | 
</template> 
 | 
  
 | 
<script> 
 | 
import AddOrUpdate from './dict-data-add-or-update' 
 | 
  
 | 
export default { 
 | 
  data() { 
 | 
    return { 
 | 
      dataForm: { 
 | 
        dictTypeId: '', 
 | 
        dictTypeName: '', 
 | 
        dictLabel: '', 
 | 
        dictValue: '' 
 | 
      } 
 | 
    } 
 | 
  }, 
 | 
  components: { 
 | 
    AddOrUpdate 
 | 
  }, 
 | 
  methods: { 
 | 
    init(dictTypeId, dictTypeName) { 
 | 
      this.dataForm.dictTypeId = dictTypeId 
 | 
      this.dataForm.dictTypeName = dictTypeName 
 | 
      this.$refs.dataTable.query() 
 | 
    }, 
 | 
    isCanUpdate(row) { 
 | 
      return row.tenantId === this.$store.state.user.tenantId 
 | 
    }, 
 | 
    isCanDelete(row) { 
 | 
      return row.tenantId === this.$store.state.user.tenantId 
 | 
    } 
 | 
  } 
 | 
} 
 | 
</script> 
 |