¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <GlobalWindow |
| | | :title="dictName + 'æ°æ®ç®¡ç'" |
| | | width="78%" |
| | | :visible.sync="visible" |
| | | :with-footer="false" |
| | | > |
| | | <TableLayout :with-breadcrumb="false"> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar"> |
| | | <li><el-button type="primary" @click="$refs.operaDictDataWindow.open('æ°å»ºåå
¸æ°æ®', searchForm.dictId)" icon="el-icon-plus">æ°å»º</el-button></li> |
| | | <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete">å é¤</el-button></li> |
| | | <li><el-button @click="sort('top')" :loading="isWorking.sort" icon="el-icon-sort-up" v-permissions="['system:menu:sort']">ä¸ç§»</el-button></li> |
| | | <li><el-button @click="sort('bottom')" :loading="isWorking.sort" icon="el-icon-sort-down" v-permissions="['system:menu:sort']">ä¸ç§»</el-button></li> |
| | | </ul> |
| | | <el-table |
| | | v-loading="isWorking.search" |
| | | :data="tableData.list" |
| | | stripe |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="remark" label="æ°æ®è¯´æ" min-width="130px"></el-table-column> |
| | | <el-table-column prop="label" label="æ°æ®æ ç¾" min-width="130px"></el-table-column> |
| | | <el-table-column prop="code" label="æ°æ®å¼" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <div v-if="row.code && row.code.length>20" :title="row.code"> |
| | | <el-button type="text" @click="showCode(row)" >ç¹å»æ¥ç</el-button> |
| | | </div> |
| | | <div v-else>{{row.code}}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="disabled" label="ç¶æ" min-width="100px"> |
| | | <template slot-scope="{row}">{{row.disabled | disabledText}}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="createUser" label="å建人" min-width="100px"> |
| | | <template slot-scope="{row}">{{row.createUserInfo == null ? '' : row.createUserInfo.username}}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="updateUser" label="æ´æ°äºº" min-width="100px"> |
| | | <template slot-scope="{row}">{{row.updateUserInfo == null ? '' : row.updateUserInfo.username}}</template> |
| | | </el-table-column> |
| | | <el-table-column prop="createTime" label="å建æ¶é´" min-width="100px"></el-table-column> |
| | | <el-table-column prop="updateTime" label="æ´æ°æ¶é´" min-width="100px"></el-table-column> |
| | | <el-table-column |
| | | label="æä½" |
| | | min-width="120" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" @click="$refs.operaDictDataWindow.open('ç¼è¾åå
¸æ°æ®', dictId, row)" icon="el-icon-edit">ç¼è¾</el-button> |
| | | <el-button type="text" @click="deleteById(row)" icon="el-icon-delete">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handlePageChange" |
| | | :pagination="tableData.pagination" |
| | | ></pagination> |
| | | </template> |
| | | <!-- æ°å»º/ä¿®æ¹ --> |
| | | <OperaDictDataWindow ref="operaDictDataWindow" @success="handlePageChange(tableData.pagination.pageIndex)"/> |
| | | <el-dialog |
| | | class="center-title" |
| | | title="åå
¸å¼" |
| | | width="70%" |
| | | height="70%" |
| | | text="åå
¸å¼" |
| | | :visible.sync="visible1" |
| | | append-to-body |
| | | > |
| | | <div class="agree-list" v-html="agreement"> |
| | | </div> |
| | | <template v-slot:footer> |
| | | <el-button @click="visible1=false">è¿å</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </TableLayout> |
| | | </GlobalWindow> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import TableLayout from '@/layouts/TableLayout' |
| | | import OperaDictDataWindow from './OperaDictDataWindow' |
| | | export default { |
| | | name: 'DictDataManagerWindow', |
| | | extends: BaseTable, |
| | | components: { OperaDictDataWindow, TableLayout, GlobalWindow, Pagination }, |
| | | data () { |
| | | return { |
| | | visible: false, |
| | | visible1: false, |
| | | agreement: '', |
| | | searchForm: { |
| | | // åå
¸ID |
| | | dictId: null |
| | | }, |
| | | // æ¯å¦æ£å¨å¤çä¸ |
| | | isWorking: { |
| | | sort: false |
| | | }, |
| | | // åå
¸åç§° |
| | | dictName: '' |
| | | } |
| | | }, |
| | | methods: { |
| | | showCode(row){ |
| | | this.agreement=row.code |
| | | this.visible1=true |
| | | }, |
| | | /** |
| | | * æå¼çªå£ |
| | | * |
| | | * @param dictId åå
¸ID |
| | | * @param dictName åå
¸åç§° |
| | | */ |
| | | open (dictId, dictName) { |
| | | this.searchForm.dictId = dictId |
| | | this.dictName = dictName |
| | | this.visible = true |
| | | this.search() |
| | | }, |
| | | /** |
| | | * æåº |
| | | * |
| | | * @param direction æ¹åï¼åå¼[top:ä¸ç§»,bottom:ä¸ç§»] |
| | | */ |
| | | sort (direction) { |
| | | if (this.isWorking.sort) { |
| | | return |
| | | } |
| | | if (this.tableData.selectedRows.length === 0) { |
| | | this.$tip.warning('è¯·éæ©ä¸æ¡æ°æ®') |
| | | return |
| | | } |
| | | if (this.tableData.selectedRows.length > 1) { |
| | | this.$tip.warning('æåºæ¶ä»
å
è®¸éæ©ä¸æ¡æ°æ®') |
| | | return |
| | | } |
| | | const rowId = this.tableData.selectedRows[0].id |
| | | const index = this.tableData.list.findIndex(item => item.id === rowId) |
| | | // ä¸ç§»æ ¡éª |
| | | if (direction === 'top' && index === 0) { |
| | | this.$tip.warning('æ°æ®å·²å°é¡¶é¨') |
| | | return |
| | | } |
| | | // ä¸ç§»æ ¡éª |
| | | if (direction === 'bottom' && index === this.tableData.list.length - 1) { |
| | | this.$tip.warning('æ°æ®å·²å°åºé¨') |
| | | return |
| | | } |
| | | this.isWorking.sort = true |
| | | this.api.sort({ |
| | | id: this.tableData.selectedRows[0].id, |
| | | direction |
| | | }) |
| | | .then(() => { |
| | | if (direction === 'top') { |
| | | this.tableData.list.splice(index, 0, this.tableData.list.splice(index - 1, 1)[0]) |
| | | } else { |
| | | this.tableData.list.splice(index, 0, this.tableData.list.splice(index + 1, 1)[0]) |
| | | } |
| | | }) |
| | | .catch(e => { |
| | | this.$tip.apiFailed(e) |
| | | }) |
| | | .finally(() => { |
| | | this.isWorking.sort = false |
| | | }) |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | api: '/system/dictData', |
| | | 'field.main': 'label' |
| | | }) |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | /deep/ .window__body { |
| | | .table-content { |
| | | padding: 0; |
| | | .table-wrap { |
| | | padding-top: 0; |
| | | } |
| | | } |
| | | } |
| | | </style> |