<template>
  <el-container v-loading="loading">
    <el-container id="repositoryList">
      <el-main :style="{'height': mainHeight}">
        <div style="width: 100%;height: 100%;overflow: auto;display: inline">
          <div style="margin: 12px 10px 10px 10px;">
            <div style="margin-bottom: 10px;margin-left: 10px;">
              <div style="min-width:50%;display: inline-block;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;">
                <template v-for="(item, i) in repositoryPathData">
                  <label v-if="i != repositoryPathData.length-1" style="font-size: 14px;color: #6F91B9;">
                    <span class="repository-path-title" style="cursor: pointer;" @click="positionRepositoryPath(item.id, item.versionId)">{{item.name}}</span>
                    <i class="awsui-iconfont">&nbsp;&#xe717;&nbsp;</i>
                  </label>
                  <label v-if="i == repositoryPathData.length-1" style="font-size: 14px;color: #384148">
                    <span class="cur-title">
                      <span @click="initData">{{item.name}}</span>
                      <!--面包屑 中文件，文件夹的操作-->

                      <div v-if="undefined != mainRepository" style="width: 16px; margin-left: 10px;" class="cur-title-operate">
                          <div class="operate-icon-display">
                            <el-dropdown
                                    :hide-on-click="true"
                                    trigger="click"
                                    placement="bottom-end">
                                <span class="el-dropdown-link">
                                    <i class="iconfont icon-operate" style="cursor: pointer;">&#xe63c;</i>
                                </span>
                                <el-dropdown-menu slot="dropdown" style="min-width: 200px;">
                                  <el-dropdown-item v-if="mainRepository.folder && (isOlderVersion ? havingWritePerm : mainRepository.havingWritePerm) " class="el-dropdown-row" @click.native="openUpdateFolder(mainRepository.id,mainRepository.name,mainRepository.desc,mainRepository.methodId,mainRepository.methodName)">
                                      <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">修改{{mainRepository.methodName}}</span></div>
                                  </el-dropdown-item>
                                  <el-dropdown-item v-if="!mainRepository.folder" class="el-dropdown-row" @click.native="openDesigner(mainRepository.id)">
                                      <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">打开模型</span></div>
                                  </el-dropdown-item>

                                  <el-dropdown-item v-if="(mainRepository.methodId =='default' && (isOlderVersion ? havingWritePerm : mainRepository.havingWritePerm)) || mainRepository.methodId !='default'" divided/>

                                  <el-dropdown-item v-if="mainRepository.isFavorite" class="el-dropdown-row" @click.native="setFavorite('0', mainRepository.versionId, mainRepository.id)">
                                    <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"><i class="iconfont" style="font-size: 12px;color: #FFB800;">&#xe618;</i></span><span style="font-size: 12px;">取消收藏</span></div>
                                  </el-dropdown-item>
                                  <el-dropdown-item v-else class="el-dropdown-row" @click.native="setFavorite('1', mainRepository.versionId, mainRepository.id)">
                                    <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"><i class="iconfont" style="font-size: 12px;">&#xe630;</i></span><span style="font-size: 12px;">收藏</span></div>
                                  </el-dropdown-item>

                                  <el-dropdown-item v-if="(isOlderVersion ? havingWritePerm : mainRepository.havingWritePerm)" class="el-dropdown-row" @click.native="moveFile(mainRepository.id)">
                                    <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">移动至</span></div>
                                  </el-dropdown-item>
                                  <el-dropdown-item v-if="(isOlderVersion ? havingWritePerm : mainRepository.havingWritePerm)" class="el-dropdown-row" @click.native="copyFiles(mainRepository.id)">
                                    <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">创建副本</span></div>
                                  </el-dropdown-item>
                                  <el-dropdown-item class="el-dropdown-row" @click.native="exportFiles(mainRepository.id)">
                                    <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">导出</span></div>
                                  </el-dropdown-item>
                                  <el-dropdown-item class="el-dropdown-row" @click.native="openRepositoryInfoById('version',mainRepository)">
                                     <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">版本管理</span></div>
                                  </el-dropdown-item>
                                  <el-dropdown-item v-if="(isOlderVersion ? havingWritePerm : mainRepository.havingWritePerm)" divided style="height: 30px;line-height: 30px;" @click.native="removeFiles(mainRepository.id)">
                                    <div class="text-important-color" style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"><i class="iconfont icon-lajitong1" style="font-size: 12px;"></i></span><span style="font-size: 12px;">删除模型</span></div>
                                  </el-dropdown-item>



                                </el-dropdown-menu>
                            </el-dropdown>
                          </div>
                      </div>
                    </span>
                  </label>
                </template>
              </div>
              <!-- 流程库批处理，应用安装且当前为流程分类下显示 -->
              <div v-if="uuid.length < 36" style="float:right;position:relative;right: 10px;display:inline-block;">
                <!--  端到端功能入口  -->
                <awsui-button v-if="subProcess.appInstall" @click="subProcess.visible = true" class="button-general-color-reverse">生成端到端流程图</awsui-button>
                <!-- 小组模式下不能进行批量创建 -->
                <awsui-button v-if="batchAppVisible && $store.getters.getTeamIdFn != null" id="batchCreateButton" visit-type="" style="width: 100px;margin: 0;border-bottom-right-radius: 0px;border-top-right-radius: 0px;" class="button-general-color-reverse" @click="batchCreateFn">批量创建</awsui-button>
                <!-- 批量替换 -->
                <awsui-button v-if="batchAppVisible && $store.getters.getTeamIdFn != null" id="batchReplaceButton" style="width: 100px;margin: 0;border-bottom-left-radius: 0px;border-top-left-radius: 0px;" class="button-general-color" type="primary" @click="batchReplaceFn">批量替换</awsui-button>
              </div>
            </div>
            <div>
              <div ref="repositorysDiv" style="margin-left: 10px;margin-right: 10px;">
                <el-table
                        ref="table"
                        :row-style="{height:'46px'}"
                        :cell-style="{padding:'0px'}"
                        v-loading="tableLoading"
                        element-loading-text="拼命加载中"
                        :data="tableData"
                        style="width: 100%;"
                        :show-header=false
                        highlight-current-row
                        @cell-mouse-enter="showCheckbox"
                        @cell-mouse-leave="hideCheckbox"
                        :cell-class-name="hideCheckBoxCell"
                        @row-click="clickTableRow"
                        @selection-change="handlecheckedRepositorysChange">
                  <el-table-column
                          class-name="rowDropFilter el-table-column--selection"
                          type="selection"
                          width="40"
                          align="left">
                  </el-table-column>
                  <el-table-column
                          prop="main"
                          label="名称"
                          class-name="row-repository-title"
                          min-width="250px">
                    <template slot-scope="scope">
                      <div v-if="!scope.row.folder" :style="{'background-color': scope.row.icon.color}" class="icon-div-repository rowDropFilter">
                        <i class="awsui-iconfont icon-dynamic-repository" v-html="scope.row.icon.code"></i>
                      </div>
                      <div v-else class="icon-div-repository rowDropFilter">
                        <i class="awsui-iconfont icon-dynamic-repository" :style="{color: scope.row.icon.color, 'font-size': '32px'}" v-html="scope.row.icon.code"></i>
                      </div>
                      <div class="div-repository-title rowDropFilter">
                        <p class="text-general-color" style="cursor: pointer;" @click="positionTableRoleRepository(scope.row.id, scope.row.versionId, scope.row.childSize, scope.row.folder)">
                          {{scope.row.name}}
                          <span style="color: #909399;margin-left: 12px;">( {{ scope.row.versionStatus.versionNo }} )</span>
                        </p>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                                   prop="second"
                          label="修改日期"
                          width="300">
                    <template slot-scope="scope" v-if="scope.row.methodId!='default' && scope.row.methodId!='process.framework' ">
                      <div class="div-update-date" >
                        <p>
                          {{scope.row.updateUser}} 于 {{scope.row.updateDate}}修改
                          <span :style="{'color': scope.row.versionStatus.stateColor}" style="margin-left: 12px;font-size: 13px;">( {{ scope.row.versionStatus.state }} )</span>
                        </p>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                          class-name="rowDropFilter"
                          prop="operate"
                          label="操作"
                          align="right"
                          width="135">
                    <template slot-scope="scope">
                      <div style="width: 16px;display: inline-block;">
                        <div class="operate-icon-display">
                          <el-tooltip v-if="scope.row.folder && (isOlderVersion ? havingWritePerm : scope.row.havingWritePerm) " placement="bottom" :hide-after=2000>
                            <span slot="content">修改{{scope.row.methodName}}</span>
                            <i class="iconfont icon-operate" style="display: inline-block;cursor: pointer;" @click="openUpdateFolder(scope.row.id, scope.row.name, scope.row.desc, scope.row.methodId, scope.row.methodName)">&#xe8b5;</i>
                          </el-tooltip>
                          <el-tooltip v-if="!scope.row.folder" content="打开模型" placement="bottom" :hide-after=2000>
                            <i class="iconfont icon-operate" style="display: inline-block;cursor: pointer;" @click="openDesigner(scope.row.id)">&#xe8b5;</i>
                          </el-tooltip>
                        </div>
                      </div>
                      <div style="width: 16px;margin: 0 15px;display: inline-block;">
                        <div v-if="scope.row.isFavorite" style="display: inline-block;">
                          <el-tooltip content="取消收藏" placement="bottom" :hide-after=2000>
                            <i class="iconfont" style="cursor: pointer;color: #FFB800;" @click="setFavorite('0', scope.row.versionId, scope.row.id)">&#xe618;</i>
                          </el-tooltip>
                        </div>
                        <div v-if="!scope.row.isFavorite" class="non-favorite-display">
                          <el-tooltip content="收藏" placement="bottom" :hide-after=2000>
                            <i class="iconfont icon-operate" style="cursor: pointer;" @click="setFavorite('1', scope.row.versionId, scope.row.id)">&#xe630;</i>
                          </el-tooltip>
                        </div>
                      </div>
                      <div style="width: 16px;display: inline-block;margin-right: 5px;">
                        <div class="operate-icon-display">
                          <el-dropdown
                                  :hide-on-click="true"
                                  trigger="click"
                                  placement="bottom-end">
                          <span class="el-dropdown-link">
                            <i class="iconfont icon-operate" style="cursor: pointer;">&#xe63c;</i>
                          </span>
                            <el-dropdown-menu slot="dropdown" style="min-width: 200px;">
                              <el-dropdown-item v-if="scope.row.folder && (isOlderVersion ? havingWritePerm : scope.row.havingWritePerm)" class="el-dropdown-row" @click.native="openUpdateFolder(scope.row.id, scope.row.name, scope.row.desc, scope.row.methodId, scope.row.methodName)">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">修改{{scope.row.methodName}}</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item v-if="!scope.row.folder" class="el-dropdown-row" @click.native="openDesigner(scope.row.id)">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">打开模型</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item v-if="(scope.row.methodId=='default' && (isOlderVersion ? havingWritePerm : scope.row.havingWritePerm)) || scope.row.methodId!='default'" divided/>
                              <el-dropdown-item v-if="scope.row.isFavorite" class="el-dropdown-row" @click.native="setFavorite('0', scope.row.versionId, scope.row.id)">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"><i class="iconfont" style="font-size: 12px;color: #FFB800;">&#xe618;</i></span><span style="font-size: 12px;">取消收藏</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item v-else class="el-dropdown-row" @click.native="setFavorite('1', scope.row.versionId, scope.row.id)">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"><i class="iconfont" style="font-size: 12px;">&#xe630;</i></span><span style="font-size: 12px;">收藏</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item v-if="(isOlderVersion ? havingWritePerm : scope.row.havingWritePerm)" class="el-dropdown-row" @click.native="moveFile(scope.row.id)">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">移动至</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item v-if="(isOlderVersion ? havingWritePerm : scope.row.havingWritePerm)" class="el-dropdown-row" @click.native="copyFiles(scope.row.id)">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">创建副本</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item class="el-dropdown-row" @click.native="exportFiles(scope.row.id)">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">导出</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item class="el-dropdown-row" @click.native="openRepositoryInfo('version')">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">版本管理</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item v-if="modelConvertInstall && scope.row.methodId == 'process.epc'" @click.native="openModelConvertDialog(scope.row.id,scope.row.methodId,'single')">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">模型转换</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item v-if="subProcess.appInstall && (scope.row.methodId === 'process.epc' || scope.row.methodId === 'process.flowchart')" class="el-dropdown-row" @click.native="openSubProcessFn(scope.row)">
                                <div style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"></span><span style="font-size: 12px;">生成端到端流程图</span></div>
                              </el-dropdown-item>
                              <el-dropdown-item v-if="(isOlderVersion ? havingWritePerm : scope.row.havingWritePerm)" divided style="height: 30px;line-height: 30px;" @click.native="removeFiles(scope.row.id)">
                                <div class="text-important-color" style="height: 100%;width: 100%;font-size: 14px;"><span style="display: inline-block;width: 20px;"><i class="iconfont icon-lajitong1" style="font-size: 12px;"></i></span><span style="font-size: 12px;">删除模型</span></div>
                              </el-dropdown-item>
                            </el-dropdown-menu>
                          </el-dropdown>
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </div>
        </div>
      </el-main>
      <el-aside v-if="isShow" width="280px" :style="{'width':newwidth, 'height': (parseInt(mainHeight) - 5) + 'px', 'background-color': '#FAFAFB','position': 'relative','top': '5px'}">
        <div @click="newwidthbind()">
          <img :src="imgPath" style="border-radius: 4px;border:1px solid #F2F2F2;width:20px;">
          {{newtitle}}
        </div>
        <div style="border-left: 1px solid #f2f2f2;height: 100%;" v-if="newwidthtrue==false">
          <!-- 名称和缩略图 -->
          <div>
            <div style="min-height: 47px;margin-left:15px; margin-right:15px;">
              <div style="position:relative;padding-top: 12px;">
                <div v-if="!currRepositoryDetail.folder" class="icon-div-repository-detail" :style="{'background-color': currRepositoryDetail.iconColor}">
                  <i class="awsui-iconfont icon-repository-detail" v-html="currRepositoryDetail.iconCode"></i>
                </div>
                <div v-else class="icon-div-repository-detail">
                  <i class="awsui-iconfont icon-repository-detail" :style="{color: currRepositoryDetail.iconColor, 'font-size': '32px'}" v-html="currRepositoryDetail.iconCode"></i>
                </div>
                <div class="icon-repository-detail-title">
                  <span class="text-general-color">
                    {{currRepositoryDetail.name}}
                  </span>
                  <span class="text-second-color" style="display:inline-block;font-size:12px;-webkit-transform: scale(0.9);">(v{{currRepositoryDetail.version}})</span>
                </div>
              </div>
            </div>
            <!--图片-->
            <div style="height: 140px;margin:15px;position: relative;overflow: hidden;">
              <img v-if="currRepositoryDetail.photoType=='image'" style="border-radius: 4px;border:1px solid #F2F2F2;width:238px;" :src="currRepositoryDetail.photo" height="138px;">
              <div v-if="currRepositoryDetail.photoType=='icon'" style="background-color: #fff;border-radius: 4px;border:1px solid #F2F2F2;width:238px;height:138px;text-align: center;line-height: 138px;vertical-align: middle;">
                <i class="awsui-iconfont text-second-color" :style="{color: currRepositoryDetail.folder ? currRepositoryDetail.iconColor : '#909399', 'font-size': '60px'}" v-html="currRepositoryDetail.photo"></i>
              </div>
              <div class="repository-img-halve" :style="{'background':currRepositoryDetail.stateColor}">
                <span>{{currRepositoryDetail.state}}</span>
              </div>
            </div>
          </div>
          <!-- 操作 -->

          <div>
            <ul>
              <!-- 修改文件夹类型 条件：是文件夹类型建模方法 且 有小组写权限 -->
              <li v-if="currRepositoryDetail.folder && (isOlderVersion ? havingWritePerm : filePerm.havingWritePerm) && crrentUserId=='admin'" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="openUpdateFolder(currRepositoryDetail.id, currRepositoryDetail.name, currRepositoryDetail.desc, currRepositoryDetail.methodId, currRepositoryDetail.methodName)"><i class="iconfont icon-bianji5 aside-repository-operate-li-icon"></i><span>修改{{currRepositoryDetail.methodName}}</span></li>
              <!-- 打开文件类型 条件：是文件类型建模方法 -->
              <li v-if="!currRepositoryDetail.folder" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="openDesigner(currRepositoryDetail.id)"><i class="iconfont icon-bianji5  aside-repository-operate-li-icon"></i><span>打开文件</span></li>
              <!-- 文件的文件属性 条件：是文件类型建模方法 -->
              <li v-if="!currRepositoryDetail.folder" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="openRepositoryInfo('property')"><i class="iconfont icon-21file aside-repository-operate-li-icon"></i><span>文件属性</span></li>
              <!-- 文件的版本管理  条件：是文件类型建模方法-->
              <li v-if="!currRepositoryDetail.folder" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="openRepositoryInfo('version')"><i class="iconfont icon-jurassic_version aside-repository-operate-li-icon"></i><span>版本管理</span></li>
              <!-- 文件的附件管理 -->
              <li v-if="crrentUserId=='admin'" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="openRepositoryInfo('upfile')"><i class="iconfont icon-wendangfujian aside-repository-operate-li-icon"></i><span>附件管理</span></li>
              <!-- 文件的流程手册预览 条件：安装了流程手册 且 安装了在线预览 且 流程大类下 且 不是文件夹类建模方法 且 不是evc-->
              <li v-if="outputPrInstall && onlineDocInstall && category == 'process' && !currRepositoryDetail.folder && currRepositoryDetail.methodId != 'process.evc'" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="createOutputPr(currRepositoryDetail.id)"><i class="iconfont icon-ziliaoshouce-xianxing aside-repository-operate-li-icon"></i><span>流程手册</span></li>
              <!-- 文件的串联分析 条件：流程大类下 且 不是文件夹类型建模方法 且安装了串联分析应用 -->
              <li v-if="category == 'process' && !currRepositoryDetail.folder && processLinkInstall" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="eteCascadeAnalysis(currRepositoryDetail.id)"><i class="iconfont icon-liuchengguanli- aside-repository-operate-li-icon"></i><span>串联分析</span></li>
              <!-- 文件的下载图片 条件：是文件类型建模方法 -->
              <li v-if="!currRepositoryDetail.folder" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="downloadPng(currRepositoryDetail.id)"><i class="iconfont icon-tupian aside-repository-operate-li-icon"></i><span>下载图片</span></li>
              <!-- 文件的导出文件 条件：是文件类型建模方法 -->
              <li v-if="!currRepositoryDetail.folder" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="exportFiles(currRepositoryDetail.id)"><i class="iconfont icon-daochu aside-repository-operate-li-icon"></i><span>导出文件</span></li>
              <!-- 文件夹的导出 -->
              <li v-if="crrentUserId=='admin'"  class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="exportFiles(currRepositoryDetail.id)"><i class="iconfont icon-daochu aside-repository-operate-li-icon"></i><span>导出{{currRepositoryDetail.methodName}}</span></li>
              <!-- 删除文件/文件夹 -->
              <template v-if="isOlderVersion ? havingRemovePerm : filePerm.havingRemovePerm">
                <li v-if="!currRepositoryDetail.folder" class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="removeFiles(currRepositoryDetail.id)"><i class="iconfont icon-lajitong1 aside-repository-operate-li-icon"></i><span>删除文件</span></li>
                <li v-if="crrentUserId=='admin'"  class="general-bgcolor-text-hover text-general-color aside-repository-operate-li" @click="removeFiles(currRepositoryDetail.id)"><i class="iconfont icon-lajitong1 aside-repository-operate-li-icon"></i><span>删除{{currRepositoryDetail.methodName}}</span></li>
              </template>
            </ul>
          </div>

        </div>
      </el-aside>
    </el-container>
    <el-footer id="operateFooter" v-show="showFooter" style="height: 45px;padding: 0;" key="operateFooter">
      <div style="border-top: 1px solid #F2F2F2;height: 44px;">
        <!-- 如果分类为IT系统图 /角色模型/岗位模型则隐藏操作字段-->
        <div style="padding: 8px 8px 8px 34px;"  >
          <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange"></el-checkbox>
          <awsui-button v-if="isOlderVersion ? havingWritePerm : true " style="width: 100px;margin-left: 15px;" class="button-general-color" type="primary" @click="moveFiles">移动至</awsui-button>
          <awsui-button v-if="isOlderVersion ? havingWritePerm : true" style="width: 100px;" class="button-general-color-reverse" plain @click="copyFiles()">创建副本</awsui-button>
          <awsui-button v-if="modelConvertInstall && modelConvertDialog.footerBtnVisible" style="width: 100px;" class="button-general-color-reverse" plain @click="openModelConvertDialog('','','batch')">模型转换</awsui-button>
          <awsui-button style="width: 100px;" class="button-general-color-reverse" plain @click="exportFiles()">导出</awsui-button>
          <awsui-button v-if="subProcess.appInstall && subProcess.footerBtnVisible" class="button-general-color-reverse" plain @click="openSubProcessFn(null)">生成端到端流程图</awsui-button>
          <awsui-button v-if="isOlderVersion ? havingRemovePerm : true && category != 'itsystem'"  style="width: 100px;" class="button-general-color-reverse2" plain @click="removeFiles()">删除</awsui-button>
          <awsui-button style="width: 100px;" class="button-general-color-reverse3" plain @click="closeFooter">取消</awsui-button>
        </div>
      </div>
    </el-footer>
    <el-container>
      <RepositoryInfo ref="repositoryInfo"/>
    </el-container>
    <el-container id="repositoryListFolderDlg">
      <el-dialog
              title="修改文件夹"
              :visible.sync="folderDialog.dialogVisible"
              :modal-append-to-body=false
              :close-on-click-modal=false
              :close-on-press-escape=true
              :before-close="handleCloseFolder"
              width="600px">
        <div style="border: 1px solid #F2F2F2;padding: 0px 10px 10px 10px;">
          <awsui-form :model="folderDialog.folderForm" :rules="folderDialog.rules" ref="folderForm" label-position="top">
            <awsui-form-item label="名称" prop="name">
              <awsui-input v-model="folderDialog.folderForm.name"></awsui-input>
            </awsui-form-item>
            <awsui-form-item label="描述" prop="desc">
              <awsui-input type="textarea" v-model="folderDialog.folderForm.desc"></awsui-input>
            </awsui-form-item>
          </awsui-form>
        </div>
        <span slot="footer" class="dialog-footer">
        <awsui-button class="button-general-color" type="primary" @click="updateFolderSave('folderForm')">确定</awsui-button>
        <awsui-button @click="closeFolderDlg">取消</awsui-button>
      </span>
      </el-dialog>
      <awsui-dialog
              :title="customFolderDialog.title"
              :visible.sync="customFolderDialog.dialogVisible"
              :modal-append-to-body=false
              :close-on-click-modal=false
              :close-on-press-escape=true
              :border="false"
              width="800px">
        <div>
          <repository-info-property v-if="customFolderDialog.dialogVisible" :id="customFolderDialog.id" :repositoryRefresh="repositoryRefresh"/>
        </div>
      </awsui-dialog>
    </el-container>
    <PALRepositoryTree
            ref="moveRepository"
            :visible.sync="moveRepository.visible"
            :wsId="moveRepository.wsId"
            :teamId="moveRepository.teamId"
            :categorys="moveRepository.categorys"
            :multiple=false
            v-on:cancel="moveRepository.visible = false"
            v-on:getResult="saveMoveRepositoryResult"
            :title="moveRepository.title"
    ></PALRepositoryTree>
    <!-- 批处理dlg -->
    <batch-create
            ref="batchCreate"
            :visible.sync="batchCreate.visible"
            :methodCategory="uuid"
            v-on:getResult="closeBatchCreateFn"
    ></batch-create>
    <batch-replace
            :ref="batchReplace"
            :visible.sync="batchReplace.visible"
            :methodCategory="uuid"
            v-on:getResult="closeBatchReplaceFn"></batch-replace>
    <!-- 端到端dialog -->
    <sub-process
            ref="subProcessRef"
            :visible.sync="subProcess.visible"
            :default-tags="subProcess.tags"
            v-on:getResult="closeSubProcessFn">
    </sub-process>
    <!-- 模型转换的dialog -->
    <el-dialog
            custom-class="model-convert-dialog"
            width="30%"
            :close-on-click-modal="false"
            :close-on-press-escape="false"
            :show-close="false"
            :visible.sync="modelConvertDialog.visible"
            :title="modelConvertDialog.title">
        <div v-if="modelConvertDialog.isSameName">
            <span v-html="modelConvertDialog.content"></span>
        </div>
        <div class="model-convert-dialog-body" v-else>
            <div>请选择要转换的模型类型:</div>
            <el-radio-group v-model="modelConvertDialog.checkTargetMethod">
                <el-radio
                        v-for="item in modelConvertDialog.targetMethodArr"
                        :key="item.value"
                        :disabled="item.disabled"
                        :label="item.value">
                    {{ item.text }}
                </el-radio>
            </el-radio-group>
        </div>
        <div slot="footer" class="dialog-footer">
            <el-button size="small" @click="clearModelConvertDialog">取 消</el-button>
            <el-button v-if="modelConvertDialog.isSameName" size="small" type="primary" :loading="modelConvertDialog.loading" @click="convertFn(modelConvertDialog.type)">转 换</el-button>
            <el-button v-else size="small" type="primary" :loading="modelConvertDialog.loading" @click="modelConvertFn">转 换</el-button>
        </div>
    </el-dialog>
  </el-container>


</template>

<script>
  import RepositoryInfo from "./RepositoryInfo";
  import {newPageWin,openDesigner, newWin} from "../../api/commonFun";
  import PALRepositoryTree from "../../components/common/PALRepositoryTree/component";
  import awsuiAxios from "../../awsuiAxios";
  import RepositoryInfoProperty from "./RepositoryInfoProperty";
  import Sortable from 'sortablejs'
  import BatchCreate from "../batch/create";
  import BatchReplace from "../batch/replace";
  import bus from '../../eventBus'
  import SubProcess from "../subprocess/SubProcess";

  export default {
    name: "RepositoryList",
    components: {
      SubProcess,
      RepositoryInfoProperty, PALRepositoryTree, RepositoryInfo, BatchCreate, BatchReplace},
    props: {
      uuid: {
        type: String,
        default: ''
      },
      refreshTreeParentNode: {
        type: Function,
        default: null
      },
      refreshTreeNode: {
        type: Function,
        default: null
      },
      treeNode: {
        type: Object,
        default: null
      },
    },
    data(){
      return {
        loading: false,
        newwidth:'280px',
        newwidthtrue:false,
        newtitle:'收起',
        mainHeight: (parseInt(this.$store.getters.getTopMainHeightFn) - (this.showFooter ? 45 : 0)) + 'px',
        tableLoading: false,
        showFooter: false,
        repositoryPathData: [],
        isShow :true,
        category: '',
        batchAppVisible: false,
        batchDlg: '',
        tableData: [],
        mainRepository:{},
        isClickTreeRoot: false,
        processLinkInstall: false,// 串联分析应用是否安装
        outputPrInstall: false,// 流程手册是否安装
        onlineDocInstall: false,// 预览应用是否安装
        modelConvertInstall: false, // 模型转换应用是否安装
        havingWritePerm: false,// 是否有新增、修改权限
        havingRemovePerm: false,// 是否有删除权限
        havingVersionManagePerm: false,// 是否有版本管理权限
        imgPath: require('@/assets/double-arro-right.png'),
        crrentUserId:'',
        currRepositoryDetail: {
          name: '',
          id: '',
          desc: '',
          versionId: '',
          version: '',
          iconCode: '',
          iconColor: '',
          state: '',
          stateColor: '',
          isUse: false,
          isPublish: false,
          isApproval: false,
          isStop: false,
          photoType: 'icon',
          photo: '',
          methodId: '',
          methodName: '',
          folder: true,
          rowIndex: 0
        },
        checkAll: false,
        checkedRepositorys: [],// 多选已选中结果记录
        singleSelectedRepository: {},// 单个文件快捷菜单操作文件记录
        isIndeterminate: false,
        folderDialog: {
          dialogVisible: false,
          folderForm: {
            id: '',
            name: '',
            desc: ''
          },
          rules: {
            name: [
              { required: true, message: '请输入名称', trigger: 'blur' },
              { min: 1, max: 120, message: '长度在 1 到 120 个字符', trigger: 'blur' }
            ]
          }
        },
        customFolderDialog: {// 扩展的文件夹类建模方法
          dialogVisible: false,
          title: '',
          id: ''
        },
        moveRepository: {// pal文件树组件
          visible: false,
          title: '移动到',
          wsId: this.$store.getters.getWsIdFn,
          teamId: this.$store.getters.getTeamIdFn,
          categorys: '',
          type: 'batch'
        },
        batchCreate: {// 流程批量创建
          visible: false
        },
        batchReplace: {
          visible: false,

        },
        subProcess: {
          visible: false,
          appInstall: false,
          tags: [],
          footerBtnVisible: false
        },
        isFileSecurity: false,
        isHighSecurity: false,
        isOlderVersion: true,
        havingCreatePerm: false,
        havingBatchPerm: false,
        filePerm:{
          havingRemovePerm:false,
          havingVersionManagePerm: false,
          havingWritePerm: false
        },
        modelConvertDialog: {
          visible: false,
          title: '',
          isSameName: false,
          duplicateName: false,
          checkTargetMethod: '',
          targetMethodArr: [
            {value: 'process.flowchart',text: 'FlowChart',disabled: false},
            {value: 'process.bpmn2',text: 'BPMN',disabled: false},
          ],
          repositoryId: '',
          sourceMethod: '',
          content: '',
          repositoryIds: [],
          type: '', // single / batch
          loading: false,
          footerBtnVisible: false
        }
      }
    },
    created() {
      this.initParam();
    },
    mounted(){
      this.initData();
      this.rowDrop();
      // 【伊利架构筛选需求】将本组件内的initData方法暴露 方便别的组件调用
      let self = this;
      this.$nextTick(() => {
        let eventObj = {};
        for (const selfItem in self) {
          if (selfItem === 'initData') {
            let funcName = 'repositoryList_initData'
            eventObj[funcName] = self[selfItem];
            break;
          }
        }
        this.$store.commit('setPageFunction',eventObj)
      });
    },
    methods: {
      initParam() {// 初始化参数
        const that = this;
        const data = {
          url:'jd',
          data:{
            cmd : 'com.actionsoft.apps.coe.pal_nav_header_data',
            mainType : mainType
          }
        };
        awsuiAxios.post(data).then(function (ro) {
          if (ro.result == 'ok') {
            let data = ro.data;
            that.crrentUserId=data.crrentUserId;
          }
        }).catch(error=>{
          console.log(error);
        })
      },
      openModelConvertDialog(repositoryId,sourceMethod,type){
        let that = this;
        that.modelConvertDialog.visible = true;
        that.modelConvertDialog.title = '选择转换类型';
        that.modelConvertDialog.repositoryId = repositoryId;
        that.modelConvertDialog.sourceMethod = sourceMethod;
        that.modelConvertDialog.type = type;
      },
      clearModelConvertDialog(){
        let that = this;
        that.modelConvertDialog.visible = false;
        that.modelConvertDialog.title = '';
        that.modelConvertDialog.repositoryId = '';
        that.modelConvertDialog.checkTargetMethod = '';
        that.modelConvertDialog.isSameName = false;
        that.modelConvertDialog.sourceMethod = '';
        that.modelConvertDialog.content = '';
        that.modelConvertDialog.repositoryIds = [];
        that.modelConvertDialog.type = '';
        that.modelConvertDialog.loading = false;
      },
      convertFn(type){
        let that = this;
        that.modelConvertDialog.loading = true;
        const data = {
          url:'jd',
          data:{}
        };
        if (type === 'single') {
          data.data.cmd = 'com.actionsoft.apps.coe.pal.handle_epc_to_flowchart';
          data.data.repositoryId = that.modelConvertDialog.repositoryId;
          data.data.targetMethod = that.modelConvertDialog.checkTargetMethod;
          data.data.sourceMethod = that.modelConvertDialog.sourceMethod;
          data.data.duplicateName = that.modelConvertDialog.duplicateName;
        }else if (type === 'batch') {
          // console.log('batch',that.modelConvertDialog.repositoryIds);
          data.data.cmd = 'com.actionsoft.apps.coe.pal.handle_epc_to_flowchart_batch';
          data.data.repositoryIds = JSON.stringify(that.modelConvertDialog.repositoryIds);
          data.data.targetMethod = that.modelConvertDialog.checkTargetMethod;
          data.data.sourceMethod = 'process.epc';
          data.data.duplicateName = that.modelConvertDialog.duplicateName;
        }
        // console.log('=======',data,type);
        // 查询数据
        awsuiAxios.post(data).then(function (ro) {
          if(ro.result == 'ok') {
            // console.log('转换结果',ro);
            that.$message({type: 'success',message: '转换成功'});
            that.initData();
            that.modelConvertDialog.loading = false;
            that.clearModelConvertDialog();
          }
        }).catch(error=>{
          console.log(error);
        })
      },
      // 模型转换
      modelConvertFn(){
        let that = this;
        if (!that.modelConvertDialog.checkTargetMethod){
          that.$message({type: 'warning',message: '请选择转换类型'});
          return;
        }
        that.modelConvertDialog.loading = true;
        const data = {
          url:'jd',
          data:{
            targetMethod: that.modelConvertDialog.checkTargetMethod,
          }
        };
        // console.log('modelConvertFn',that.modelConvertDialog.repositoryIds);
        if (that.modelConvertDialog.type === 'single') {
          data.data.cmd = 'com.actionsoft.apps.coe.pal.check_repository_name_exist';
          data.data.repositoryId = that.modelConvertDialog.repositoryId;
        }else if (that.modelConvertDialog.type === 'batch') {
          data.data.cmd = 'com.actionsoft.apps.coe.pal.check_repository_name_exist_batch';
          data.data.repositoryIds = JSON.stringify(that.modelConvertDialog.repositoryIds);
        }
        awsuiAxios.post(data).then(function (ro) {
          if(ro.result == 'ok') {
            that.modelConvertDialog.loading = false;
            // console.log('重名校验',ro);
            if (ro.data.duplicateName) {
              that.modelConvertDialog.title = '提示';
              that.modelConvertDialog.isSameName = true;
              if (that.modelConvertDialog.type === 'single') {
                that.modelConvertDialog.content = `文件【${ro.data.repositoryName}】已经存在,是否继续转换生成新的副本`;
              }else if (that.modelConvertDialog.type === 'batch') {
                let repositoryNames = ro.data.repositoryNames;
                // console.log('重名',repositoryNames);
                let content = `文件<br/>`;
                repositoryNames.forEach(item => {
                  content += `【${item}】<br/>`;
                });
                content += '已经存在,是否继续转换生成新的副本';
                that.modelConvertDialog.content = content;
              }
              that.modelConvertDialog.duplicateName = ro.data.duplicateName;
            }else {
              that.convertFn(that.modelConvertDialog.type);
            }
          }
        }).catch(error=>{
          console.log(error);
        })
      },
      newwidthbind(){
        if(this.newwidthtrue==false){
          this.newwidthtrue = true;
          this.newwidth ='28px';
          this.newtitle = '展开';
          this.imgPath=require('@/assets/double-arrow-left.png');
        }else{
          this.newwidthtrue = false;
          this.newwidth ='280px';
          this.newtitle = '收起';
          this.imgPath=require('@/assets/double-arro-right.png');
        }
      },
      handleCloseFolder(done) {
        this.folderDialog.dialogVisible = false;
        done();
      },
      openUpdateFolder(id, name, desc, methodId, methodName) {
        if (methodId == 'default') {// 默认文件夹
          this.folderDialog.folderForm.name = name;
          this.folderDialog.folderForm.desc = desc;
          this.folderDialog.folderForm.id = id;
          this.folderDialog.dialogVisible = true;
        } else {
          this.customFolderDialog.id = id;
          this.customFolderDialog.title = '修改' + methodName;
          this.customFolderDialog.dialogVisible = true;
        }
      },
      closeFolderDlg() {
        this.folderDialog.dialogVisible = false;
        this.folderDialog.folderForm.name = '';
        this.folderDialog.folderForm.desc = '';
        this.folderDialog.folderForm.id = '';
      },
      updateFolderSave(formName) {
        const that = this;
        that.$refs[formName].validate((valid) => {
          if (valid) {
            const name = that.folderDialog.folderForm.name;
            const desc = that.folderDialog.folderForm.desc;
            if (desc.length > 255) {
              that.$message({message: '[描述]不允许超过255个字符',type: 'warning'});
              return;
            }
            const id = that.folderDialog.folderForm.id;
            const wsId = that.$store.getters.getWsIdFn;
            const teamId = that.$store.getters.getTeamIdFn;
            const method = 'default';// 文件夹
            const data = {
              url:'jd',
              data:{
                cmd: 'com.actionsoft.apps.coe.pal_processlevel_folder_create_save',
                wsId: wsId,
                teamId: teamId,
                method: method,
                name: name,
                desc: desc,
                id: id
              }
            };
            // 查询数据
            awsuiAxios.post(data).then(function (ro) {
              if(ro.result == 'ok') {
                that.initData();
                if (that.refreshTreeParentNode) {
                  that.refreshTreeParentNode(id);
                }
                that.closeFolderDlg();
              }
            }).catch(error=>{
              console.log(error);
            })
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      initData() {
        const that = this;
        that.tableLoading = true;
        const wsId = that.$store.getters.getWsIdFn;
        const teamId = that.$store.getters.getTeamIdFn;

        const data = {
          url:'jd',
          data:{
            cmd: 'com.actionsoft.apps.coe.pal_processlevel_repository_child_data_query',
            wsId: wsId,
            teamId: teamId,
            id: that.uuid,
            createUsers: JSON.stringify(that.$store.getters.getCreateUsers),
            orgIds: JSON.stringify(that.$store.getters.getOrgIds),
            methodIds: JSON.stringify(that.$store.getters.getMethodIds)
          }
        };
        // 查询数据
        awsuiAxios.post(data).then(function (ro) {
          if(ro.result == 'ok') {
            //isClickTreeRoot
            // if(ro.data.mainRepository=="undefined"){
            //   if(ro.data.mainRepository.folder==false){
            //     bus.$emit("getisDisabled",true);
            //   }else{
            //     bus.$emit("getisDisabled",false);
            //   }
            // }
            if(ro.data.mainRepository!=undefined){
              if(ro.data.mainRepository.folder==false){
                bus.$emit("getisDisabled",true);
              }else{
                bus.$emit("getisDisabled",false);
              }
            }else{
              bus.$emit("getisDisabled",false);
            }


            const repositoryPathData = ro.data.repositoryPathData;
            that.repositoryPathData = repositoryPathData;
            that.isClickTreeRoot = ro.data.isClickTreeRoot;
            that.category = ro.data.category;
            that.moveRepository.categorys = ro.data.category;
            for (let i = 0; i < ro.data.tableData.length; i++) {
              if (ro.data.tableData[i].versionStatus.isApproval) {
                ro.data.tableData[i].versionStatus.stateColor = '#1AA477';
                ro.data.tableData[i].versionStatus.state = '审批中';
                ro.data.tableData[i].versionStatus.stateCode = 'approval';
              } else if (ro.data.tableData[i].versionStatus.isStop) {
                ro.data.tableData[i].versionStatus.stateColor = '#D9001B';
                ro.data.tableData[i].versionStatus.state = '已停用';
                ro.data.tableData[i].versionStatus.stateCode = 'stop';
              } else if (ro.data.tableData[i].versionStatus.isPublish) {
                ro.data.tableData[i].versionStatus.stateColor = '#1AA477';
                ro.data.tableData[i].versionStatus.state = '已发布';
                ro.data.tableData[i].versionStatus.stateCode = 'publish';
              } else if (ro.data.tableData[i].versionStatus.isUse) {
                ro.data.tableData[i].versionStatus.stateColor = '#4E7FF9';
                ro.data.tableData[i].versionStatus.state = '设计中';
                ro.data.tableData[i].versionStatus.stateCode = 'use';
              } else {
                ro.data.tableData[i].versionStatus.stateColor = '#4E7FF9';
                ro.data.tableData[i].versionStatus.state = '设计中';
                ro.data.tableData[i].versionStatus.stateCode = 'designer';
              }
            }
            that.tableData = ro.data.tableData;
            that.mainRepository = ro.data.mainRepository;

            that.tableLoading = false;
            that.processLinkInstall = ro.data.processLinkInstall;
            that.outputPrInstall = ro.data.outputPrInstall;
            that.onlineDocInstall = ro.data.onlineDocInstall;
            that.modelConvertInstall = ro.data.modelConvertInstall;
            that.havingWritePerm = ro.data.havingWritePerm;
            that.havingRemovePerm = ro.data.havingRemovePerm;
            that.havingVersionManagePerm = ro.data.havingVersionManagePerm;
            that.batchAppVisible = ro.data.batchAppVisible;
            that.subProcess.appInstall = ro.data.subProcessAppVisible;
            that.batchDlg = ro.data.batchDlg;
            that.isHighSecurity = ro.data.isHighSecurity;
            that.isFileSecurity = ro.data.isFileSecurity;
            that.isOlderVersion = ro.data.isOlderVersion;
            that.havingBatchPerm = ro.data.havingBatchPerm;
            that.havingCreatePerm = ro.data.havingCreatePerm;
            if(that.tableData.length==0){
              that.isShow = false;
            } else {
              if(undefined != ro.data.mainRepository){
                let row = {
                  id: ro.data.mainRepository.id
                }
                //加载tableData父级目录详情
                that.loadRepositoryDetail(row);
              }else{
                //加载tableData 第一个详情
                that.setCurrentRow(that.tableData[0]);
              }
            }

            //默认收起操作
            /*that.newwidth ='28px';
            that.newtitle = '展开';
            that.imgPath=require('@/assets/double-arrow-left.png');*/
            that.imgPath=require('@/assets/double-arro-right.png');
          }
        }).catch(error=>{
          console.log(error);
          that.tableLoading = false;
        })

      },
      setCurrentRow(row) {
        this.clickTableRow(row, null, null);
      },
      clickTableRow(row, column, event) {
        this.$refs.table.setCurrentRow(row);
        // 获取详情
        this.loadRepositoryDetail(row);
      },
      loadRepositoryDetail(row) {// 加载模型文件详情
        if (!row) {
          return;
        }
        const that = this;
        const data = {
          url:'jd',
          data:{
            cmd: 'com.actionsoft.apps.coe.pal_processlevel_repository_detail_data_query',
            wsId: that.$store.getters.getWsIdFn,
            teamId: that.$store.getters.getTeamIdFn,
            id: row.id,
          }
        };
        // 查询数据
        awsuiAxios.post(data).then(function (ro) {
          if(ro.result == 'ok') {
            that.currRepositoryDetail.name = ro.data.name;
            that.currRepositoryDetail.id = ro.data.id;
            that.currRepositoryDetail.desc = ro.data.desc;
            that.currRepositoryDetail.version = ro.data.version;
            that.currRepositoryDetail.iconCode = ro.data.iconCode;
            that.currRepositoryDetail.iconColor = ro.data.iconColor;
            that.currRepositoryDetail.isPublish = ro.data.isPublish;
            that.currRepositoryDetail.isUse = ro.data.isUse;
            that.currRepositoryDetail.isApproval = ro.data.isApproval;
            that.currRepositoryDetail.isStop = ro.data.isStop;
            that.currRepositoryDetail.photoType = ro.data.photoType;
            that.currRepositoryDetail.photo = ro.data.photo;
            that.currRepositoryDetail.methodId = ro.data.methodId;
            that.currRepositoryDetail.methodName = ro.data.methodName;
            that.currRepositoryDetail.folder = ro.data.folder;
            if (that.currRepositoryDetail.isApproval) {
              that.currRepositoryDetail.stateColor = '#1AA477';
              that.currRepositoryDetail.state = '审批中';
            } else if (that.currRepositoryDetail.isStop) {
              that.currRepositoryDetail.stateColor = '#D9001B';
              that.currRepositoryDetail.state = '已停用';
            } else if (that.currRepositoryDetail.isPublish) {
              that.currRepositoryDetail.stateColor = '#1AA477';
              that.currRepositoryDetail.state = '已发布';
            } else if (that.currRepositoryDetail.isUse) {
              that.currRepositoryDetail.stateColor = '#4E7FF9';
              that.currRepositoryDetail.state = '设计中';
            }
            that.currRepositoryDetail.rowIndex = row.index;
            that.filePerm.havingRemovePerm = ro.data.havingRemovePerm
            that.filePerm.havingVersionManagePerm = ro.data.havingVersionManagePerm
            that.filePerm.havingWritePerm = ro.data.havingWritePerm
          }
        }).catch(error=>{
          console.log(error);
        })
      },
      openDesigner(id) {
        let that = this;
        if(that.isHighSecurity && that.isFileSecurity){
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_query',
              uuid: id,
            }
          };
          awsuiAxios.post(data).then(function (ro) {
            if(ro.result == 'ok') {
              openDesigner(that.$store.getters.getTeamIdFn, id, that.$store.state.sessionId);
            }else{
              that.$message.error(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
            that.$message.error(error.msg);
          })
        }else{
          openDesigner(this.$store.getters.getTeamIdFn, id, this.$store.state.sessionId);
        }
      },
      setFavorite(state, versionId, id) {
        if (state == '0') {// 取消收藏
          const that = this;
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_processlevel_favorite_cancel',
              wsId: that.$store.getters.getWsIdFn,
              teamId: that.$store.getters.getTeamIdFn,
              versionId: versionId
            }
          };
          // 查询数据
          awsuiAxios.post(data).then(function (ro) {
            if(ro.result == 'ok') {
              that.initData();
            }
          }).catch(error=>{
            console.log(error);
          })
        } else {// 收藏
          const that = this;
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_processlevel_favorite_save',
              wsId: that.$store.getters.getWsIdFn,
              teamId: that.$store.getters.getTeamIdFn,
              versionId: versionId
            }
          };
          // 查询数据
          awsuiAxios.post(data).then(function (ro) {
            if(ro.result == 'ok') {
              that.initData();
            }
          }).catch(error=>{
            console.log(error);
          })
        }
      },
      handleCheckAllChange(val) {// 全选事件
        if (val) {
          this.$refs.table.clearSelection();
          this.tableData.forEach(row => {
            this.$refs.table.toggleRowSelection(row);
          });
        } else {
          this.$refs.table.clearSelection();
        }
        this.isIndeterminate = false;
      },
      handlecheckedRepositorysChange(val) {// 多选变化事件
        const that = this;
        that.checkedRepositorys = val;
        let checkedCount = val.length;
        that.modelConvertDialog.repositoryIds = [];
        that.subProcess.tags = [];
        if (checkedCount > 0) {
          let flag = false;
          let subProcessFooterFlag = false;
          val.forEach(item => {
            if (that.modelConvertDialog.repositoryIds.indexOf(item.id) === -1){
              that.modelConvertDialog.repositoryIds.push(item.id);
            }
            if (item.methodId !== 'process.epc'){
              flag = true;
            }
            if (item.methodId === 'process.epc' || item.methodId === 'process.flowchart'){
              subProcessFooterFlag = true;
            }
            let tag = {value: item.id, label: item.name}
            that.subProcess.tags.push(tag);
          });
          if (subProcessFooterFlag) {
            that.subProcess.footerBtnVisible = true;
          }else {
            that.subProcess.footerBtnVisible = false;
            that.subProcess.tags = [];
          }
          if (flag){
            that.modelConvertDialog.footerBtnVisible = false;
          }else {
            that.modelConvertDialog.footerBtnVisible = true;
          }
          that.showFooter = true;
          //控制多选选中后不隐藏
          for (let i = 0; i < checkedCount; i++) {
            let index = that.tableData.indexOf(val[i]);
            const childNodes = that.tbody[0].childNodes;
            if (childNodes != undefined) {
              const selectChildNode = childNodes[index];
              const selectTd = selectChildNode.childNodes[0];
              if (selectTd && selectTd.querySelector(".el-checkbox__input")) {
                selectTd.querySelector(".el-checkbox__input").style.visibility = "visible"
              }
            }
          }
        } else {
          that.showFooter = false;
          that.subProcess.tags = [];
          for (let j = 0; j < that.tableData.length; j++) {
            const childNodes = that.tbody[0].childNodes;
            if (childNodes != undefined) {
              const selectChildNode = childNodes[j];
              const selectTd = selectChildNode.childNodes[0];
              if (selectTd && selectTd.querySelector(".el-checkbox__input")) {
                selectTd.querySelector(".el-checkbox__input").style.visibility = "hidden"
              }
            }
          }
        }
        that.refreshMainHeight();
        that.checkAll = checkedCount === that.tableData.length;
        that.isIndeterminate = checkedCount > 0 && checkedCount < that.tableData.length;
      },
      closeFooter() {
        this.handleCheckAllChange(false);
        this.showFooter = false;
        this.refreshMainHeight();
      },
      refreshMainHeight() {
        this.mainHeight = (parseInt(this.$store.getters.getTopMainHeightFn) - (this.showFooter ? 45 : 0)) + 'px';
      },
      hideCheckBoxCell(row) {
        return "hideCheckBoxCell";
      },
      showCheckbox(row, column, cell, event) {
        cell.parentNode.querySelector(".el-table-column--selection").querySelector(".el-checkbox__input").style.visibility = "visible";
      },
      hideCheckbox(row, column, cell, event) {
        let ck = cell.parentNode.querySelector(".el-table-column--selection").querySelector(".el-checkbox__input");
        if (ck != null && this.checkedRepositorys.indexOf(row) < 0) {
          ck.style.visibility = "hidden";
        }
      },
      moveFile(id) {// 移动文件（通过表格下拉菜单操作）
        this.moveRepository.type = 'single';
        for (let i = 0; i < this.tableData.length; i++) {
          if (this.tableData[i].id == id) {
            this.singleSelectedRepository = this.tableData[i];
            break;
          }
        }

        // console.log(this.singleSelectedRepository)
        //主repository移动文件
        if(undefined == this.singleSelectedRepository.id || null == this.singleSelectedRepository.id){
          this.singleSelectedRepository = this.mainRepository;
        }
        if(this.singleSelectedRepository.folder==true && this.crrentUserId!='admin'){
          this.$message({message: '文件夹不可进行移动操作！！',type: 'warning'});
          return;
        }
        if (this.singleSelectedRepository.isPublish == true && "admin" != this.crrentUserId) {
          this.$message({message: '当前文件已处于发布状态，不可进行移动文件操作！！', type: 'warning'});
          return;
        }


        this.moveRepository.visible = true;
      },
      moveFiles() {// 移动文件（多选批量）
        this.moveRepository.type = 'batch';
        if (this.checkedRepositorys.length == 0) {
          this.$message({message: '请选择移入的目标文件',type: 'warning'});
          return;
        }else{
          for(let i=0;i<this.checkedRepositorys.length;i++){
            if(this.checkedRepositorys[i].folder==true && this.crrentUserId!='admin'){
              this.$message({message: '文件夹不可进行移动操作！！',type: 'warning'});
              return;
            }
            if(this.checkedRepositorys[i].versionStatus!=""){
              if(this.checkedRepositorys[i].versionStatus.isPublish==true && "admin" != this.crrentUserId){
                this.$message({message: '当前文件已处于发布状态，不可进行移动文件操作！！',type: 'warning'});
                return;
              }
            }
          }

        }
        this.moveRepository.visible = true;
      },
      saveMoveRepositoryResult(data) {// 移动文件之后获取确定结果

        if (data.length == 0) {
          this.$message({message: '未选择要移入的目标文件，移动操作被取消',type: 'warning'});
          return;
        }
        this.moveRepository.visible = false;
        // 移动
        const that = this;

        that.tableLoading = true;
        let sourceData = JSON.stringify(that.checkedRepositorys);
        if (this.moveRepository.type == 'single') {
          let tmpArr = [];
          tmpArr.push(that.singleSelectedRepository);
          sourceData = JSON.stringify(tmpArr);
        }
        const params = {
          url:'jd',
          data:{
            cmd: 'com.actionsoft.apps.coe.pal_processlevel_move_save',
            teamId: that.$store.getters.getTeamIdFn,
            sourceData: sourceData,
            targetData: JSON.stringify(data)
          }
        };
        //三员管理
        if(that.isHighSecurity && that.isFileSecurity){
          const originData = data;
          let tempArr = [];
          for(let i=0;i<that.checkedRepositorys.length;i++){
            let obj = that.checkedRepositorys[i];
            tempArr.push(obj.id);
          }
          const param = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_batch_query',
              uuids: JSON.stringify(tempArr),
              isSub: true
            }
          };
          //密级权限校验
          awsuiAxios.post(param).then(function (ro) {
            if(ro.result == 'ok') {
              let checkArr = ro.data.checkArr;
              if(checkArr.length<=0){
                that.$message.error("无密级访问权限");
              }else{
                let tempArr = [];
                for(let i=0; i<checkArr.length;i++){
                  for(let j=0; j<that.checkedRepositorys.length; j++){
                    if(checkArr[i] === that.checkedRepositorys[j].id){
                      tempArr.push(that.checkedRepositorys[j]);
                    }
                  }
                }
                params.data.sourceData = JSON.stringify(tempArr);
                // 查询数据
                awsuiAxios.post(params).then(function (ro) {
                  that.tableLoading = false;
                  if(ro.result == 'ok') {
                    that.$message({
                      message: '移动成功',
                      type: 'success'
                    });
                    if (that.refreshTreeNode) {
                      that.refreshTreeNode(data[0].pid);
                    }
                    if (that.refreshTreeParentNode) {
                      that.refreshTreeParentNode(that.uuid);
                    }
                    that.initData();
                  } else {
                    that.$message({message: ro.msg,type: 'warning'});
                  }
                }).catch(error=>{
                  console.log(error);
                })
              }
            }else{
              that.$message(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
            that.$message.error(error.msg);
          })
        }else{
          // 查询数据
          awsuiAxios.post(params).then(function (ro) {
            that.tableLoading = false;
            if(ro.result == 'ok') {
              that.$message({
                message: '移动成功',
                type: 'success'
              });
              if (that.refreshTreeNode) {
                that.refreshTreeNode(data[0].pid);
              }
              if (that.refreshTreeParentNode) {
                that.refreshTreeParentNode(that.uuid);
              }
              that.initData();
            } else {
              that.$message({message: ro.msg,type: 'warning'});
            }
          }).catch(error=>{
            console.log(error);
          })
        }
      },
      copyFiles(id) {//复制文件
        const that = this;
        that.tableLoading = true;
        let sourceIds = [];
        if (id) {// 单个文件复制
          sourceIds.push(id);
        } else {// 多个文件复制
          let checkedData = that.checkedRepositorys;
          for (let i = 0; i < checkedData.length; i++) {
            sourceIds.push(checkedData[i].id);
          }
        }
        const targetId = that.uuid;
        const params = {
          url:'jd',
          data:{
            cmd: 'com.actionsoft.apps.coe.pal_processlevel_copy_save',
            targetId: targetId,
            sourceIds: JSON.stringify(sourceIds),
            wsId: that.$store.getters.getWsIdFn,
            teamId: that.$store.getters.getTeamIdFn
          }
        };
        //三员管理
        if(that.isHighSecurity && that.isFileSecurity){
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_batch_query',
              uuids: JSON.stringify(sourceIds),
              isSub: true
            }
          };
          awsuiAxios.post(data).then(function (ro) {
            if(ro.result == 'ok') {
              let checkArr = ro.data.checkArr;
              if(checkArr.length<=0){
                that.tableLoading = false;
                that.$message.error("无密级访问权限");
              }else{
                params.data.sourceIds = JSON.stringify(checkArr);
                // 查询数据
                awsuiAxios.post(params).then(function (ro) {
                  if(ro.result == 'ok') {
                    that.$message({
                      message: '复制成功',
                      type: 'success'
                    });
                    if (targetId == id) {
                      if (that.refreshTreeParentNode) {
                        that.refreshTreeParentNode(that.uuid);
                      }
                    } else {
                      if (that.refreshTreeNode) {
                        that.refreshTreeNode(that.uuid);
                      }
                    }
                    that.initData();
                    that.tableLoading = false;
                  } else {
                    that.tableLoading = false;
                    that.$message(ro.msg);
                  }
                }).catch(error=>{
                  console.log(error);
                })
              }
            }else{
              that.tableLoading = false;
              that.$message(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
            that.$message.error(error.msg);
          })
        }else{
          // 查询数据
          awsuiAxios.post(params).then(function (ro) {
            if(ro.result == 'ok') {
              that.$message({
                message: '复制成功',
                type: 'success'
              });
              if (targetId == id) {
                if (that.refreshTreeParentNode) {
                  that.refreshTreeParentNode(that.uuid);
                }
              } else {
                if (that.refreshTreeNode) {
                  that.refreshTreeNode(that.uuid);
                }
              }
              that.initData();
              that.tableLoading = false;
            } else {
              that.tableLoading = false;
              that.$message(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
          })
        }
      },
      exportFiles(id) {// 导出文件
        const that = this;
        that.loading = true;
        let repositoryIds = [];
        if (id) {// 单个文件导出
          repositoryIds.push(id);
        } else {// 多个文件导出
          let checkedData = that.checkedRepositorys;
          for (let i = 0; i < checkedData.length; i++) {
            repositoryIds.push(checkedData[i].id);
          }
        }
        const params = {
          url:'jd',
          data:{
            cmd: 'com.actionsoft.apps.coe.pal_pl_export_handle',
            repositoryIds: JSON.stringify(repositoryIds)
          }
        };
        //三员管理
        if(that.isHighSecurity && that.isFileSecurity){
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_batch_query',
              uuids: JSON.stringify(repositoryIds),
              isSub: false
            }
          };
          awsuiAxios.post(data).then(function (ro) {
            if(ro.result == 'ok') {
              let checkArr = ro.data.checkArr;
              if(checkArr.length<=0){
                that.loading = false;
                that.$message.error("无密级访问权限");
              }else{
                params.data.repositoryIds = JSON.stringify(checkArr);
                // 查询数据
                awsuiAxios.post(params).then(function (ro) {
                  that.loading = false;
                  if(ro.result == 'ok') {
                    that.$message({
                      message: '导出完成，正在下载...',
                      type: 'success'
                    });
                    const exportTitle = ro.data.exportTitle;
                    const exportCount = ro.data.exportCount;
                    const dcId = ro.data.dcId;
                    const params2 = {
                      url:'jd',
                      data:{
                        cmd: 'com.actionsoft.apps.coe.pal_pl_export',
                        exportTitle: exportTitle,
                        exportCount: exportCount,
                        dcId: dcId
                      }
                    };
                    // 查询数据
                    awsuiAxios.post(params2).then(function (r) {
                      if(r.result == 'ok') {
                        window.open(r.data.downLoadUrl);
                      } else {
                        that.$message(r.msg);
                      }
                    }).catch(error=>{
                      console.log(error);
                    })
                  } else {
                    that.$message(ro.msg);
                  }
                }).catch(error=>{
                  console.log(error);
                })
              }
            }else{
              that.tableLoading = false;
              that.$message(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
            that.$message.error(error.msg);
          })
        }else{
          // 查询数据
          awsuiAxios.post(params).then(function (ro) {
            that.loading = false;
            if(ro.result == 'ok') {
              that.$message({
                message: '导出完成，正在下载...',
                type: 'success'
              });
              const exportTitle = ro.data.exportTitle;
              const exportCount = ro.data.exportCount;
              const dcId = ro.data.dcId;
              const params2 = {
                url:'jd',
                data:{
                  cmd: 'com.actionsoft.apps.coe.pal_pl_export',
                  exportTitle: exportTitle,
                  exportCount: exportCount,
                  dcId: dcId
                }
              };
              // 查询数据
              awsuiAxios.post(params2).then(function (r) {
                if(r.result == 'ok') {
                  window.open(r.data.downLoadUrl);
                } else {
                  that.$message(r.msg);
                }
              }).catch(error=>{
                console.log(error);
              })
            } else {
              that.$message(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
          })
        }

      },
      removeFiles(id) {
        this.$confirm('确定要删除吗？', '提示', {
          confirmButtonText: '确定',
          confirmButtonClass: 'button-general-color',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          const that = this;
          let repositoryIds = [];
          let delId = id;
          if (id) {// 单个文件删除
            repositoryIds.push(id);
          } else {// 多个文件删除
            let checkedData = that.checkedRepositorys;
            for (let i = 0; i < checkedData.length; i++) {
              repositoryIds.push(checkedData[i].id);
            }
          }
          const params = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_processlevel_remove',
              repositoryIds: JSON.stringify(repositoryIds),
              wsId: that.$store.getters.getWsIdFn,
              teamId: that.$store.getters.getTeamIdFn
            }
          };
          if(that.isHighSecurity && that.isFileSecurity){
            const param = {
              url:'jd',
              data: {
                cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_batch_query',
                uuids: JSON.stringify(repositoryIds),
                isSub: true
              }
            };
            awsuiAxios.post(param).then(function (ro) {
              if(ro.result == 'ok') {
                let checkArr = ro.data.checkArr;
                if(checkArr.length<=0){
                  that.$message.error("无密级访问权限");
                }else{
                  params.data.repositoryIds = JSON.stringify(checkArr);
                  // 查询数据
                  awsuiAxios.post(params).then(function (ro) {
                    if(ro.result == 'ok') {
                      that.$message({
                        message: '已放入回收站',
                        type: 'success'
                      });
                      if (that.uuid.length < 36) {
                        if (that.refreshTreeNode) {
                          that.refreshTreeNode(that.uuid);
                        }
                        that.initData();
                      } else {
                        if(delId == that.mainRepository.id){
                          that.refreshTreeParentNode(that.uuid);
                        }else{
                          if (that.refreshTreeNode) {
                            that.refreshTreeNode(that.uuid);
                          }
                          that.initData();
                        }
                      }
                    } else {
                      that.$message(ro.msg);
                    }
                  }).catch(error=>{
                    console.log(error);
                  })
                }
              }else{
                that.tableLoading = false;
                that.$message(ro.msg);
              }
            }).catch(error=>{
              console.log(error);
              that.$message.error(error.msg);
            })
          }else {
            // 查询数据
            awsuiAxios.post(params).then(function (ro) {
              if(ro.result == 'ok') {
                that.$message({
                  message: '已放入回收站',
                  type: 'success'
                });
                if (that.uuid.length < 36) {
                  if (that.refreshTreeNode) {
                    that.refreshTreeNode(that.uuid);
                  }
                  that.initData();
                } else {
                  if(delId == that.mainRepository.id){
                    that.refreshTreeParentNode(that.uuid);
                  }else{
                    if (that.refreshTreeNode) {
                      that.refreshTreeNode(that.uuid);
                    }
                    that.initData();
                  }
                }
              } else {
                that.$message(ro.msg);
              }
            }).catch(error=>{
              console.log(error);
            })
          }

        }).catch(() => {
        });
      },
      downloadPng(id) {// 下载图片
        const that = this;
        that.loading = true;
        const params = {
          url:'jd',
          data:{
            cmd: 'com.actionsoft.apps.coe.pal_pl_repository_download_png',
            uuid: id,
            type: 'image'
          }
        };
        //三员管理
        if(that.isHighSecurity && that.isFileSecurity){
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_query',
              uuid: id,
            }
          };
          awsuiAxios.post(data).then(function (ro) {
            if(ro.result == 'ok') {
              // 查询数据
              awsuiAxios.post(params).then(function (ro) {
                that.loading = false;
                if(ro.result == 'ok') {
                  if (ro.data.url == '') {
                    that.$message({message: '检测到尚未进行作图，下载被取消',type: 'warning'});
                  } else {
                    that.$message({
                      message: '创建图片完成，正在下载...',
                      type: 'success'
                    });
                    window.open(ro.data.url);
                  }
                } else {
                  that.$message(ro.msg);
                }
              }).catch(error=>{
                console.log(error);
              })
            }else{
              that.loading = false;
              that.$message.error(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
            that.loading = false;
            that.$message.error(error.msg);
          })
        }else{
          // 查询数据
          awsuiAxios.post(params).then(function (ro) {
            that.loading = false;
            if(ro.result == 'ok') {
              if (ro.data.url == '') {
                that.$message({message: '检测到尚未进行作图，下载被取消',type: 'warning'});
              } else {
                that.$message({
                  message: '创建图片完成，正在下载...',
                  type: 'success'
                });
                window.open(ro.data.url);
              }
            } else {
              that.$message(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
          })
        }
      },
      eteCascadeAnalysis(id) {// 串联分析
        const wsId = this.$store.getters.getWsIdFn;
        const teamId = this.$store.getters.getTeamIdFn;
        const appId = 'com.actionsoft.apps.coe.pal.processlink';
        let that = this;
        //三员管理
        if(that.isHighSecurity && that.isFileSecurity){
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_query',
              uuid: id,
            }
          };
          awsuiAxios.post(data).then(function (ro) {
            if(ro.result == 'ok') {
              newPageWin('cascadeAnalysis', that.$store.state.sessionId, 'com.actionsoft.apps.coe.pal.processlink_ete_analysis_home', {wsId: wsId, teamId: teamId, appId: appId, uuid: id});
            }else{
              that.$message.error(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
            that.$message.error(error.msg);
          })
        }else{
          newPageWin('cascadeAnalysis', this.$store.state.sessionId, 'com.actionsoft.apps.coe.pal.processlink_ete_analysis_home', {wsId: wsId, teamId: teamId, appId: appId, uuid: id});
        }
      },
      createOutputPr(id) {// 创建流程手册
        const that = this;
        const params = {
          url:'jd',
          data:{
            cmd: 'com.actionsoft.apps.coe.pal_outputreport_output_process_create',
            wsId: that.$store.getters.getWsIdFn,
            teamId: that.$store.getters.getTeamIdFn,
            fileId: id
          }
        };
        //三员管理
        if(that.isHighSecurity && that.isFileSecurity){
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_query',
              uuid: id,
            }
          };
          awsuiAxios.post(data).then(function (ro) {
            if(ro.result == 'ok') {
              // 查询数据
              awsuiAxios.post(params).then(function (ro) {
                if(ro.result == 'ok') {
                  const taskId = ro.data.taskId;
                  setTimeout(function(){
                    const params2 = {
                      url:'jd',
                      data:{
                        taskId: taskId,
                        cmd: 'com.actionsoft.apps.coe.pal_outputreport_output_process_preview'
                      }
                    };
                    awsuiAxios.post(params2).then(function (r) {
                      if(r.result == 'ok') {
                        window.open(r.data.url);
                      }
                    }).catch(error=>{
                      console.log(error);
                    })
                  },2000);
                }
              }).catch(error=>{
                console.log(error);
              })
            }else{
              that.$message.error(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
            that.$message.error(error.msg);
          })
        }else{
          // 查询数据
          awsuiAxios.post(params).then(function (ro) {
            if(ro.result == 'ok') {
              const taskId = ro.data.taskId;
              setTimeout(function(){
                const params2 = {
                  url:'jd',
                  data:{
                    taskId: taskId,
                    cmd: 'com.actionsoft.apps.coe.pal_outputreport_output_process_preview'
                  }
                };
                awsuiAxios.post(params2).then(function (r) {
                  if(r.result == 'ok') {
                    window.open(r.data.url);
                  }
                }).catch(error=>{
                  console.log(error);
                })
              },2000);
            }
          }).catch(error=>{
            console.log(error);
          })
        }
      },
      openRepositoryInfo(type) {// 打开文件属性、版本管理、附件管理'
        let that = this;
        //三员管理
        if(that.isHighSecurity && that.isFileSecurity){
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_query',
              uuid: that.currRepositoryDetail.id,
            }
          };
          awsuiAxios.post(data).then(function (ro) {
            if(ro.result == 'ok') {
              that.$refs.repositoryInfo.openRepositoryInfoDlg(that, that.currRepositoryDetail.id, that.currRepositoryDetail.version, type, that.currRepositoryDetail.isUse, that.currRepositoryDetail.isPublish, that.currRepositoryDetail.isStop, that.currRepositoryDetail.isApproval, that.currRepositoryDetail.methodId);
            }else{
              that.$message.error(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
            that.$message.error(error.msg);
          })
        }else{
          this.$refs.repositoryInfo.openRepositoryInfoDlg(this, this.currRepositoryDetail.id, this.currRepositoryDetail.version, type, this.currRepositoryDetail.isUse, this.currRepositoryDetail.isPublish, this.currRepositoryDetail.isStop, this.currRepositoryDetail.isApproval, this.currRepositoryDetail.methodId);
        }
      },

      /**
       * 重新打开版本管理
       * @param currRepositoryDetailId
       */
      openRepositoryInfoById(type,mainRepository) {// 打开文件属性、版本管理、附件管理
        let that = this;
        //三员管理
        if(that.isHighSecurity && that.isFileSecurity){
          const data = {
            url:'jd',
            data:{
              cmd: 'com.actionsoft.apps.coe.pal_pl_file_permission_query',
              uuid: mainRepository.id,
            }
          };
          awsuiAxios.post(data).then(function (ro) {
            debugger;
            if(ro.result == 'ok') {
              that.$refs.repositoryInfo.openRepositoryInfoDlg(that, mainRepository.id, mainRepository.version, type, mainRepository.isUse, mainRepository.isPublish, mainRepository.isStop, mainRepository.isApproval, mainRepository.methodId);
            }else{
              that.$message.error(ro.msg);
            }
          }).catch(error=>{
            console.log(error);
            that.$message.error(error.msg);
          })
        }else{
          this.$refs.repositoryInfo.openRepositoryInfoDlg(this, mainRepository.id, mainRepository.version, type, mainRepository.isUse, mainRepository.isPublish, mainRepository.isStop, mainRepository.isApproval, mainRepository.methodId);
        }
      },


      positionRepositoryPath(id, versionId) {// 路径定位模型文件
        const arr = [];
        for (let i = 0; i < this.repositoryPathData.length; i++) {
          const tempId = this.repositoryPathData[i].versionId;
          arr.push(tempId);
          if (tempId == id) {
            break;
          }
        }
        this.$router.push({path: '/Repository', query: {id: id, versionId: versionId, path: arr.join(','), param: Math.random()}});
      },
      positionTableRoleRepository(id, versionId, childSize, folder) {// 表格行标题点击定位
        if (childSize == 0) {
          // 如果是最后一级，文件夹提示，文件直接打开
          if (folder) {
            this.$message('已经到最后一级了');
          } else {
            this.openDesigner(id);
          }
          return;
        }
        let flag = false;
        const arr = [];
        for (let i = 0; i < this.repositoryPathData.length; i++) {
          const tempId = this.repositoryPathData[i].versionId;
          arr.push(tempId);
          if (tempId == versionId) {
            flag = true;
            break;
          }
        }
        if (!flag) {
          arr.push(versionId);
        }
        this.$router.push({path: '/Repository', query: {id: id, versionId: versionId, path: arr.join(','), param: Math.random()}});
      },
      repositoryRefresh(id) {// 刷新父页面树
        if (this.refreshTreeParentNode) {
          this.refreshTreeParentNode(id);
        }
        this.initData();
      },
      rowDrop() { // 拖动列表column
        const tbody = document.querySelector(".el-table__body-wrapper tbody");
        let that = this;
        Sortable.create(tbody,{
          //设置样式
          animation: 1000,
          direction: 'vertical',
          forceFallback:true,
          filter:".rowDropFilter",
          //事件监听
          //拖动结束
          onEnd: function (evt) {
            let oldIndex = evt.oldIndex;
            let newIndex = evt.newIndex;
            if(oldIndex != newIndex){
              let oldNode = that.tableData[oldIndex];
              let newNode = that.tableData[newIndex];
              const wsId = that.$store.getters.getWsIdFn;
              const data = {
                url:'jd',
                data:{
                  cmd: 'com.actionsoft.apps.coe.pal_processlevel_repository_order_index_update',
                  wsId: wsId,
                  currentId: oldNode.id,
                  originId : newNode.id
                }
              };
              // 查询数据
              awsuiAxios.post(data).then(res => {
                if (that.refreshTreeNode) {
                  that.refreshTreeNode(that.uuid);
                }
                if(res.data.updateFlag){
                  that.$message({
                    message: res.data.desc,
                    type: 'success'
                  });
                }else{
                  that.$message({
                    showClose: false,
                    message: res.data.desc,
                    type: 'error'
                  });
                }
              }).catch(error =>{
                that.$message({
                  showClose: false,
                  message: "服务调用失败",
                  type: 'error'
                });o
              });
            }
          },
        });
      },
      batchCreateFn() {// 批量创建
        this.batchCreate.visible = true;
      },
      closeBatchCreateFn() {// 关闭批量创建
        this.batchCreate.visible = false;
      },
      batchReplaceFn() {// 批量替换
        this.batchReplace.visible = true;
      },
      closeBatchReplaceFn() {// 关闭批量替换
        this.batchReplace.visible = false;
      },
      closeSubProcessFn(){
        this.subProcess.visible = false;
      },
      openSubProcessFn(data) {
        this.subProcess.visible = true;
        if (data){
          let tag = {value: data.versionId, label: data.name};
          this.subProcess.tags.push(tag);
        }
      }
    },
    computed: {
      tbody() {
        return this.$refs.repositorysDiv.querySelector(".el-table__body-wrapper").querySelector(".el-table__body").getElementsByTagName("tbody");
      },
      listenTopMainHeight() {
        return this.$store.getters.getTopMainHeightFn;
      }
    },
    watch : {
      listenTopMainHeight: function (newd, old) {
        this.mainHeight = (parseInt(newd) - (this.showFooter ? 45 : 0)) + 'px';
      }
    }
  }
</script>

<style scoped>
  .icon-div-repository {
    position: absolute;
    border-radius: 10%;
    left: 0px;
    display: inline-block;
    width: 32px;
    height: 32px;
    text-align: center;
    line-height: 32px;
    vertical-align: middle;
  }
  .icon-dynamic-repository {
    color: white;
    font-size: 18px;
  }
  .div-repository-title {
    display: inline-block;
    position: relative;
    left: 32px;
    text-align: center;
    height: 32px;
    line-height: 32px;
    font-size: 13px;
  }
  .div-repository-title :hover {
    color: #4E7FF9;
  }
  .div-update-date {
    display: inline-block;
    position: relative;
    left: 30px;
    text-align: center;
    height: 30px;
    line-height: 30px;
    font-size: 12px;
    color: #92A2B2;
  }
  .icon-div-repository-detail {
    display: inline-block;
    width: 30px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    vertical-align: middle;
    border-radius: 10%;
    left: 0px;
    position: absolute;
  }
  .icon-repository-detail {
    color: white;
    font-size: 16px;
  }
  .icon-repository-detail-title {
    display: inline-block;
    position: relative;
    left: 30px;
    text-align: left;
    height: 30px;
    line-height: 30px;
    width: 200px;
    margin-left: 10px;
  }
  #repositoryListFolderDlg >>> .el-dialog__body {
    padding: 10px 20px;
    color: #606266;
    font-size: 14px;
    word-break: break-all;
  }
  #repositoryListFolderDlg >>> .el-form-item__label {
    line-height: 0;
  }
  #repositoryList >>> .el-table td, .el-table th {
    padding: 8px 0;
  }
  #repositoryList >>> .el-table td {
    border-bottom: 0px solid #F2F2F2;
  }
  #repositoryList >>> .el-table__row .non-favorite-display{
    display: none;
  }
  #repositoryList >>> .el-table__row:hover .non-favorite-display{
    display: inline-block;
  }
  #repositoryList >>> .el-table__row .operate-icon-display{
    display: none;
  }
  #repositoryList >>> .el-table__row:hover .operate-icon-display{
    display: inline-block;
  }
  #repositoryList >>> .row-repository-title .cell {/*IE错位问题*/
    position: relative;
  }
  /**当前title 样式 */
  .cur-title:hover  {
    color: #4E7FF9;
    cursor: pointer;
  }
  .cur-title .cur-title-operate{
    display: none;
  }
  .cur-title:hover .cur-title-operate{
    display: inline-block;
  }

  .aside-repository-operate-li {
    height: 50px;
    line-height: 50px;
    padding-left: 20px;
    cursor: pointer;
    font-size: 13px;
  }
  .aside-repository-operate-li span{
    display: inline-block;
  }
  .aside-repository-operate-li-icon {
    padding-right: 10px;
    position: relative;
    top: 1px;
    font-size: 13px;
  }
  #repositoryList >>> .awsui-halve-green {
    background-color: #1AA477;
  }
  #repositoryList >>> .el-table::before {
    height: 0px !important;
  }
  #repositoryList >>> .hideCheckBoxCell .el-checkbox__input {
    visibility: hidden;
  }
  #repositoryList >>> .el-table__body-wrapper::-webkit-scrollbar {
    display: none;
  }
  .repository-path-title:hover {
    color: #4E7FF9;
  }
  .icon-operate:hover {
    color: #4E7FF9 !important;
  }
  .el-dropdown-row {
    height: 30px;
    line-height: 30px;
  }
  .el-dropdown-row :hover {
    color: #4E7FF9 !important;
  }
  .repository-img-halve {
    right: 0;
    transform: rotate(45deg) translate(29%,-90%);
    position: absolute;
    top: 0;
    z-index: 9;
    height: 24px;
    line-height: 24px;
    font-size: 12px;
    white-space: nowrap;
    color: #fff;
    padding: 0 50px;
  }
  .repository-img-halve span {
    position: relative;
    top: 0px;
  }
  /deep/ .model-convert-dialog .el-dialog__body {
      padding-top: 0px;
  }
  /deep/ .model-convert-dialog .model-convert-dialog-body {
      padding: 0 30px;
  }
  /deep/ .model-convert-dialog .model-convert-dialog-body div:first-child{
      margin: 15px 0;
      font-weight: 800;
  }
  /deep/ .model-convert-dialog .model-convert-dialog-body div:last-child{
      padding: 0 20px;
  }
</style>
