|  |  | 
 |  |  | <template> | 
 |  |  |     <TableLayout> | 
 |  |  | <!--        :permissions="['business:company:query']"--> | 
 |  |  |         <!-- 搜索表单 --> | 
 |  |  | <!--        <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>--> | 
 |  |  | <!--            <el-form-item label="组织名称" prop="name">--> | 
 |  |  | <!--                <el-input v-model="searchForm.name" placeholder="请输入组织名称" @keypress.enter.native="search"></el-input>--> | 
 |  |  | <!--            </el-form-item>--> | 
 |  |  | <!--            <el-form-item label="所属上级组织" prop="parentName">--> | 
 |  |  | <!--                <el-input v-model="searchForm.parentName" placeholder="请输入所属上级组织" @keypress.enter.native="search"></el-input>--> | 
 |  |  | <!--            </el-form-item>--> | 
 |  |  | <!--            <section>--> | 
 |  |  | <!--                <el-button type="primary" @click="search">搜索</el-button>--> | 
 |  |  | <!--                <el-button @click="reset">重置</el-button>--> | 
 |  |  | <!--            </section>--> | 
 |  |  | <!--        </el-form>--> | 
 |  |  |         <!-- 表格和分页 --> | 
 |  |  |         <template v-slot:table-wrap> | 
 |  |  |             <ul class="toolbar" v-permissions="['business:company:create', 'business:company:sync']"> | 
 |  |  |                <li><el-button type="primary" v-permissions="['business:company:create']" @click="$refs.OperaInternalCompanyWindow.open('新建企业',null,null)">新建</el-button></li> | 
 |  |  |               <li><el-button @click="sort('top')" :loading="sorting" icon="el-icon-sort-up" v-permissions="['business:company:sort']">上移</el-button></li> | 
 |  |  |               <li><el-button @click="sort('bottom')" :loading="sorting" icon="el-icon-sort-down" v-permissions="['business:company:sort']">下移</el-button></li> | 
 |  |  |               <!--<li><el-button type="primary"  v-permissions="['business:company:sync']" :loading="loading" @click="synchronous()">同步</el-button></li>--> | 
 |  |  |             </ul> | 
 |  |  |             <el-table | 
 |  |  |                 v-loading="isWorking.search" | 
 |  |  |                 :data="list" | 
 |  |  |                 stripe | 
 |  |  |                 :tree-props="{children: 'childList',hasChildren: 'hasChildren'}" | 
 |  |  |                 row-key="id" | 
 |  |  |                 @selection-change="handleSelectionChange" | 
 |  |  |                 default-expand-all | 
 |  |  |             > | 
 |  |  |                 <el-table-column type="selection" width="55"></el-table-column> | 
 |  |  |                 <el-table-column prop="name" label="组织名称" min-width="100px"></el-table-column> | 
 |  |  |                 <el-table-column prop="name" label="组织类型" min-width="80px"> | 
 |  |  |                   <template scope="{row}"> | 
 |  |  |                       <span v-if="row.type == 0">相关方组织</span> | 
 |  |  |                       <span v-if="row.type == 1">内部组织</span> | 
 |  |  |                   </template> | 
 |  |  |                 </el-table-column> | 
 |  |  |                 <el-table-column prop="companyNamePath" label="组织路径" min-width="100px"></el-table-column> | 
 |  |  |               <el-table-column prop="editorName" label="操作人" min-width="100px"></el-table-column> | 
 |  |  |               <el-table-column prop="editDate" label="最后更新时间" min-width="100px"></el-table-column> | 
 |  |  |                 <el-table-column | 
 |  |  |                     label="操作" | 
 |  |  |                     width="230" | 
 |  |  |                     fixed="right" | 
 |  |  |                 > | 
 |  |  |                     <template slot-scope="{row}"> | 
 |  |  |                         <el-button type="text" @click="$refs.OperaInternalCompanyWindow.open('编辑企业信息',{  id: row.parentId,name:row.parentName,type:row.parentType, companyPath:row.parentCompanyPath}, row)" icon="el-icon-edit" v-permissions="['business:company:update']">编辑</el-button> | 
 |  |  |                         <el-button type="text" @click="$refs.OperaInternalCompanyWindow.open('新建子级',  row,null)" icon="el-icon-plus">新建子级</el-button> | 
 |  |  |                         <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:company:delete']">删除</el-button> | 
 |  |  |                     </template> | 
 |  |  |                 </el-table-column> | 
 |  |  |             </el-table> | 
 |  |  |         </template> | 
 |  |  |         <!-- 新建/修改 --> | 
 |  |  |         <OperaInternalCompanyWindow ref="OperaInternalCompanyWindow" :list="list" @success="handlePageChange"/> | 
 |  |  |     </TableLayout> | 
 |  |  |   <TableLayout> | 
 |  |  |     <!--        :permissions="['business:company:query']"--> | 
 |  |  |     <!-- 搜索表单 --> | 
 |  |  |     <!--        <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>--> | 
 |  |  |     <!--            <el-form-item label="组织名称" prop="name">--> | 
 |  |  |     <!--                <el-input v-model="searchForm.name" placeholder="请输入组织名称" @keypress.enter.native="search"></el-input>--> | 
 |  |  |     <!--            </el-form-item>--> | 
 |  |  |     <!--            <el-form-item label="所属上级组织" prop="parentName">--> | 
 |  |  |     <!--                <el-input v-model="searchForm.parentName" placeholder="请输入所属上级组织" @keypress.enter.native="search"></el-input>--> | 
 |  |  |     <!--            </el-form-item>--> | 
 |  |  |     <!--            <section>--> | 
 |  |  |     <!--                <el-button type="primary" @click="search">搜索</el-button>--> | 
 |  |  |     <!--                <el-button @click="reset">重置</el-button>--> | 
 |  |  |     <!--            </section>--> | 
 |  |  |     <!--        </el-form>--> | 
 |  |  |     <!-- 表格和分页 --> | 
 |  |  |     <template v-slot:table-wrap> | 
 |  |  |       <ul class="toolbar" v-permissions="['business:company:create', 'business:company:sync']"> | 
 |  |  |         <li><el-button type="primary" v-permissions="['business:company:create']" | 
 |  |  |             @click="$refs.OperaInternalCompanyWindow.open('新建企业', null, null)">新建</el-button></li> | 
 |  |  |         <li><el-button @click="sort('top')" :loading="sorting" icon="el-icon-sort-up" | 
 |  |  |             v-permissions="['business:company:sort']">上移</el-button></li> | 
 |  |  |         <li><el-button @click="sort('bottom')" :loading="sorting" icon="el-icon-sort-down" | 
 |  |  |             v-permissions="['business:company:sort']">下移</el-button></li> | 
 |  |  |         <li><el-button type="primary" v-permissions="['business:company:sync']" :loading="loading" | 
 |  |  |             @click="synchronous()">同步</el-button></li> | 
 |  |  |       </ul> | 
 |  |  |       <el-table :max-height="tableHeight" v-loading="isWorking.search" :data="list" stripe | 
 |  |  |         :tree-props="{ children: 'childList', hasChildren: 'hasChildren' }" row-key="id" | 
 |  |  |         @selection-change="handleSelectionChange" default-expand-all> | 
 |  |  |         <el-table-column type="selection" width="55"></el-table-column> | 
 |  |  |         <el-table-column prop="name" label="组织名称" min-width="100px"></el-table-column> | 
 |  |  |         <el-table-column prop="name" label="组织类型" min-width="80px"> | 
 |  |  |           <template scope="{row}"> | 
 |  |  |             <span v-if="row.type == 0">相关方组织</span> | 
 |  |  |             <span v-if="row.type == 1">内部组织</span> | 
 |  |  |           </template> | 
 |  |  |         </el-table-column> | 
 |  |  |         <el-table-column prop="companyNamePath" label="组织路径" min-width="100px"></el-table-column> | 
 |  |  |         <el-table-column prop="editorName" label="操作人" width="100px"></el-table-column> | 
 |  |  |         <el-table-column prop="editDate" label="最后更新时间" min-width="100px"></el-table-column> | 
 |  |  |         <el-table-column label="操作" width="230" fixed="right"> | 
 |  |  |           <template slot-scope="{row}"> | 
 |  |  |             <el-button type="text" | 
 |  |  |               @click="$refs.OperaInternalCompanyWindow.open('编辑企业信息', { id: row.parentId, name: row.parentName, type: row.parentType, companyPath: row.parentCompanyPath }, row)" | 
 |  |  |               icon="el-icon-edit" v-permissions="['business:company:update']">编辑</el-button> | 
 |  |  |             <el-button type="text" @click="$refs.OperaInternalCompanyWindow.open('新建子级', row, null)" | 
 |  |  |               icon="el-icon-plus">新建子级</el-button> | 
 |  |  |             <el-button type="text" @click="deleteById(row)" style="color: red" icon="el-icon-delete" | 
 |  |  |               v-permissions="['business:company:delete']">删除</el-button> | 
 |  |  |           </template> | 
 |  |  |         </el-table-column> | 
 |  |  |       </el-table> | 
 |  |  |     </template> | 
 |  |  |     <!-- 新建/修改 --> | 
 |  |  |     <OperaInternalCompanyWindow ref="OperaInternalCompanyWindow" :list="list" @success="handlePageChange" /> | 
 |  |  |   </TableLayout> | 
 |  |  | </template> | 
 |  |  |  | 
 |  |  | <script> | 
 |  |  | 
 |  |  |   name: 'internalCompany', | 
 |  |  |   extends: BaseTable, | 
 |  |  |   components: { TableLayout, OperaInternalCompanyWindow }, | 
 |  |  |   data () { | 
 |  |  |   data() { | 
 |  |  |     return { | 
 |  |  |       // 搜索 | 
 |  |  |       loading: false, | 
 |  |  | 
 |  |  |       total: 0 | 
 |  |  |     } | 
 |  |  |   }, | 
 |  |  |   created () { | 
 |  |  |   created() { | 
 |  |  |     this.config({ | 
 |  |  |       module: '企业信息表', | 
 |  |  |       api: '/business/company', | 
 |  |  | 
 |  |  |     }) | 
 |  |  |     this.search() | 
 |  |  |   }, | 
 |  |  |   mounted() { | 
 |  |  |     this.$nextTick(() => { | 
 |  |  |       this.tableHeight = document.body.scrollHeight - 220 | 
 |  |  |     }) | 
 |  |  |   }, | 
 |  |  |   methods: { | 
 |  |  |     // 页码变更处理 | 
 |  |  |     handlePageChange (pageIndex) { | 
 |  |  |     handlePageChange(pageIndex) { | 
 |  |  |       this.__checkApi() | 
 |  |  |       this.isWorking.search = true | 
 |  |  |       this.api.fetchList(this.searchForm.type) | 
 |  |  | 
 |  |  |         }) | 
 |  |  |     }, | 
 |  |  |     // 同步信息 | 
 |  |  |     async synchronous () { | 
 |  |  |       this.$dialog.actionConfirm('操作确认提醒', '您确认同步全部信息吗?') | 
 |  |  |     async synchronous() { | 
 |  |  |       this.$dialog.actionConfirm('该操作将系统清空已有组织信息,您确认同步全部信息吗?', '操作确认提醒') | 
 |  |  |         .then(() => { | 
 |  |  |           this.loading = true | 
 |  |  |           companySync({}) | 
 |  |  | 
 |  |  |               this.loading = false | 
 |  |  |             }) | 
 |  |  |         }) | 
 |  |  |         .catch(() => {}) | 
 |  |  |         .catch(() => { }) | 
 |  |  |     }, | 
 |  |  |     // 排序 | 
 |  |  |     sort (direction) { | 
 |  |  |     sort(direction) { | 
 |  |  |       if (this.sorting) { | 
 |  |  |         return | 
 |  |  |       } | 
 |  |  | 
 |  |  |         direction | 
 |  |  |       }) | 
 |  |  |         .then(() => { | 
 |  |  |           if (direction === 'top') { | 
 |  |  |             menuPool.splice(menuIndex, 0, menuPool.splice(menuIndex - 1, 1)[0]) | 
 |  |  |           } else { | 
 |  |  |             menuPool.splice(menuIndex, 0, menuPool.splice(menuIndex + 1, 1)[0]) | 
 |  |  |           } | 
 |  |  |           /* if (direction === 'top') { | 
 |  |  |              menuPool.splice(menuIndex, 0, menuPool.splice(menuIndex - 1, 1)[0]) | 
 |  |  |            } else { | 
 |  |  |              menuPool.splice(menuIndex, 0, menuPool.splice(menuIndex + 1, 1)[0]) | 
 |  |  |            }*/ | 
 |  |  |           this.search() | 
 |  |  |         }) | 
 |  |  |         .catch(e => { | 
 |  |  |           this.$tip.apiFailed(e) | 
 |  |  | 
 |  |  |         }) | 
 |  |  |     }, | 
 |  |  |     // 查询父节点 | 
 |  |  |     __findParent (id, parent) { | 
 |  |  |     __findParent(id, parent) { | 
 |  |  |       if (parent.childList === 0) { | 
 |  |  |         return | 
 |  |  |       } | 
 |  |  | 
 |  |  |         } | 
 |  |  |       } | 
 |  |  |       return null | 
 |  |  |     }, | 
 |  |  |     } | 
 |  |  |   } | 
 |  |  | } | 
 |  |  | </script> |