<template>
  <div class="detail-wrap">
    <el-form ref="editForm" :model="fileObjAuth">
      <div class="d-header clearfix">
        <div class="fl">
          <i class="el-icon-info"/>
          {{
            dataId ? $t2('查看', 'system.button.check') : $t2('新增', 'system.button.add')
          }}{{ $t2('文件权限', 'components.fileLibrary.fileAuth') }}
        </div>
        <div class="fr">
          <el-button type="primary" plain class="button-sty" @click="$baseReload()" icon="el-icon-refresh-right">
            {{ $t2('重置', 'system.button.reset') }}
          </el-button>
          <el-button type="primary" class="button-sty" icon="el-icon-check" @click="saveData">
            {{ $t2('保存', 'system.button.save') }}
          </el-button>
        </div>
      </div>
      <div class="d-cont">
        <div class="d-item">
          <div class="title first"><b>{{ $t2('基本信息', 'system.label.baseInfo') }}</b></div>
          <table class="table-detail">
            <tbody>
            <tr>
              <th>文件路径</th>
              <td colspan="3">
                <el-breadcrumb separator-class="el-icon-arrow-right">
                  <el-breadcrumb-item v-for="(treeNode,index) in treeNodeArr" :key="index">{{
                      treeNode.label
                    }}
                  </el-breadcrumb-item>
                </el-breadcrumb>
              </td>
            </tr>
            <tr>
              <th>
                {{ $t2('用户', 'components.fileLibrary.user') }}
              </th>
              <td>
                <el-form-item prop="nickName" :rules="[{ required: false, trigger: 'blur' }]">
                  <el-input
                    class="search-input"
                    v-model="fileObjAuth.nickName"
                    clearable
                    @clear="
                    fileObjAuth.userId = null;
                  "
                    v-el-readonly
                  >
                    <i slot="suffix" class="el-input__icon el-icon-search" @click="showUserDialog=true"></i>
                  </el-input>
                </el-form-item>
              </td>
              <th>
                {{ $t2('机构', 'components.fileLibrary.saleOrg') }}
              </th>
              <td>
                <el-form-item prop="saleOrgName" :rules="[{ required: false, trigger: 'blur' }]">
                  <el-input
                    class="search-input"
                    v-model="fileObjAuth.saleOrgName"
                    clearable
                    @clear="
                    fileObjAuth.saleOrgId = null;
                  "
                    v-el-readonly
                  >
                    <i slot="suffix" class="el-input__icon el-icon-search" @click="showSaleOrgDialog=true"></i>
                  </el-input>
                </el-form-item>
              </td>
              <th>
                {{ $t2('岗位', 'components.fileLibrary.position') }}
              </th>
              <td>
                <el-form-item prop="positionName" :rules="[{ required: false, trigger: 'blur' }]">
                  <el-input
                    class="search-input"
                    v-model="fileObjAuth.positionName"
                    clearable
                    @clear="
                    fileObjAuth.positionId = null;
                  "
                    v-el-readonly
                  >
                    <i slot="suffix" class="el-input__icon el-icon-search" @click="showPositionDialog=true"></i>
                  </el-input>
                </el-form-item>
              </td>
              <th>
                {{ $t2('角色', 'components.fileLibrary.role') }}
              </th>
              <td>
                <el-form-item prop="roleName" :rules="[{ required: false, trigger: 'blur' }]">
                  <el-input
                    class="search-input"
                    v-model="fileObjAuth.roleName"
                    clearable
                    @clear="
                    fileObjAuth.roleId = null;
                  "
                    v-el-readonly
                  >
                    <i slot="suffix" class="el-input__icon el-icon-search" @click="showRoleDialog=true"></i>
                  </el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th>{{ $t2('新增', 'components.fileLibrary.add') }}</th>
              <td>
                <el-form-item prop="addAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.addAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
              <th>{{ $t2('编辑', 'components.fileLibrary.edit') }}</th>
              <td>
                <el-form-item prop="editAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.editAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
              <th>{{ $t2('查看', 'components.fileLibrary.view') }}</th>
              <td>
                <el-form-item prop="viewAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.viewAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
              <th>{{ $t2('上传', 'components.fileLibrary.upload') }}</th>
              <td>
                <el-form-item prop="uploadAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.uploadAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th>{{ $t2('下载', 'components.fileLibrary.download') }}</th>
              <td>
                <el-form-item prop="downloadAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.downloadAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
              <th>{{ $t2('移动', 'components.fileLibrary.move') }}</th>
              <td>
                <el-form-item prop="moveAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.moveAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
              <th>{{ $t2('复制', 'components.fileLibrary.copy') }}</th>
              <td>
                <el-form-item prop="copyAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.copyAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
              <th>{{ $t2('替换', 'components.fileLibrary.replace') }}</th>
              <td>
                <el-form-item prop="replaceAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.replaceAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th>{{ $t2('删除文件', 'components.fileLibrary.deleteFile') }}</th>
              <td>
                <el-form-item prop="deleteAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.deleteAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
              <th>{{ $t2('删除文件夹', 'components.fileLibrary.deleteCategory') }}</th>
              <td>
                <el-form-item prop="deleteDirAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.deleteDirAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
              <th>{{ $t2('查看历史', 'components.fileLibrary.checkHistory') }}</th>
              <td>
                <el-form-item prop="historyAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.historyAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
              <th>{{ $t2('分享', 'components.fileLibrary.share') }}</th>
              <td>
                <el-form-item prop="shareAuth" :rules="[{ required: true, trigger: 'blur' }]">
                  <el-radio-group v-model="fileObjAuth.shareAuth">
                    <el-radio :label="1">{{ $t2('是', 'components.fileLibrary.auThLaebl1') }}</el-radio>
                    <el-radio :label="0">{{ $t2('否', 'components.fileLibrary.auThLaebl0') }}</el-radio>
                  </el-radio-group>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th>{{ $t2('创建人', 'system.label.createBy') }}</th>
              <td>{{ fileObjAuth.createBy }}</td>
              <th>{{ $t2('创建时间', 'system.label.createDate') }}</th>
              <td>{{ fileObjAuth.createDate }}</td>
              <th>{{ $t2('更新人', 'system.label.modifyBy') }}</th>
              <td>{{ fileObjAuth.modifyBy }}</td>
              <th>{{ $t2('更新时间', 'system.label.modifyDate') }}</th>
              <td>{{ fileObjAuth.modifyDate }}</td>
            </tr>
            </tbody>
          </table>
        </div>
      </div>
    </el-form>
    <userDialog v-if="showUserDialog" :visiable.sync="showUserDialog" @confirm="confirmInsertUser"
                multi="false"/>
    <saleOrgDialog v-if="showSaleOrgDialog" :visiable.sync="showSaleOrgDialog" @confirm="confirmInsertSaleOrg"
                   multi="false"/>
    <positionDialog v-if="showPositionDialog" :visiable.sync="showPositionDialog" @confirm="confirmInsertPosition"
                    multi="false"/>
    <roleDialog v-if="showRoleDialog" :visiable.sync="showRoleDialog" @confirm="confirmInsertRole"
                multi="false"/>
  </div>
</template>

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

export default {
  mixins: [mixin]
};
</script>
