From e80fb1e51d652d0ccecc27688c72a168c8297075 Mon Sep 17 00:00:00 2001 From: liukangdong <898885815@qq.com> Date: 星期四, 27 二月 2025 17:12:41 +0800 Subject: [PATCH] 表格优化lll --- admin/src/views/business/internalCompany.vue | 145 ++++++++++++++++++++++++----------------------- 1 files changed, 74 insertions(+), 71 deletions(-) diff --git a/admin/src/views/business/internalCompany.vue b/admin/src/views/business/internalCompany.vue index 60279db..0947c2b 100644 --- a/admin/src/views/business/internalCompany.vue +++ b/admin/src/views/business/internalCompany.vue @@ -1,63 +1,61 @@ <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)" 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> + <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> @@ -69,7 +67,7 @@ name: 'internalCompany', extends: BaseTable, components: { TableLayout, OperaInternalCompanyWindow }, - data () { + data() { return { // 鎼滅储 loading: false, @@ -81,7 +79,7 @@ total: 0 } }, - created () { + created() { this.config({ module: '浼佷笟淇℃伅琛�', api: '/business/company', @@ -90,9 +88,14 @@ }) 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) @@ -107,7 +110,7 @@ }) }, // 鍚屾淇℃伅 - async synchronous () { + async synchronous() { this.$dialog.actionConfirm('璇ユ搷浣滃皢绯荤粺娓呯┖宸叉湁缁勭粐淇℃伅锛屾偍纭鍚屾鍏ㄩ儴淇℃伅鍚楋紵', '鎿嶄綔纭鎻愰啋') .then(() => { this.loading = true @@ -123,10 +126,10 @@ this.loading = false }) }) - .catch(() => {}) + .catch(() => { }) }, // 鎺掑簭 - sort (direction) { + sort(direction) { if (this.sorting) { return } @@ -166,11 +169,11 @@ 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 => { @@ -181,7 +184,7 @@ }) }, // 鏌ヨ鐖惰妭鐐� - __findParent (id, parent) { + __findParent(id, parent) { if (parent.childList === 0) { return } -- Gitblit v1.9.3