| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout :permissions="['business:labels: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="parentId"> |
| | | <el-select v-model="searchForm.parentId" placeholder="è¯·éæ©æå±åç" @change="search" > |
| | | <el-option |
| | | v-for="item in labels" |
| | | :key="item.id" |
| | | :value="item.id" |
| | | :label="item.name" |
| | | ></el-option> |
| | | </el-select> |
| | | </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:labels:create', 'business:labels:delete']"> |
| | | <li><el-button type="primary" @click="$refs.operaLabelsWindow.open('æ°å»ºåçç³»åä¿¡æ¯è¡¨',null,searchForm.type)" icon="el-icon-plus" v-permissions="['business:labels:create']">æ°å»º</el-button></li> |
| | | <li><el-button type="danger" @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:labels:delete']">å é¤</el-button></li> |
| | | </ul> |
| | | <el-table |
| | | v-loading="isWorking.search" |
| | | :data="tableData.list" |
| | | border |
| | | stripe |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <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="parentName" label="æå±åç" min-width="100px"></el-table-column> |
| | | <el-table-column prop="imgurlfull" label="å±ç¤ºå¾" align="center" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <el-image style="max-width: 100px;max-height: 50px;" v-if="row.imgFullurl" :src="row.imgFullurl" :preview-src-list="[row.imgFullurl]"></el-image> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="sortnum" label="æåºç " min-width="100px"></el-table-column> |
| | | <el-table-column prop="editDate" label="æè¿æ¶é´" min-width="100px"></el-table-column> |
| | | <el-table-column prop="status" label="ç¶æ" min-width="100px"> |
| | | <template slot-scope="{row}"> |
| | | <el-switch |
| | | v-model="row.status" |
| | | :active-value="1" |
| | | :inactive-value="0" |
| | | active-color="#13ce66" |
| | | inactive-color="#ff4949" |
| | | @change="statusChange(row)" |
| | | ></el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="containPermissions(['business:labels:update', 'business:labels:delete'])" |
| | | label="æä½" |
| | | min-width="120" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" @click="$refs.operaLabelsWindow.open('ç¼è¾åçç³»åä¿¡æ¯è¡¨', row,searchForm.type)" icon="el-icon-edit" v-permissions="['business:labels:update']">ç¼è¾</el-button> |
| | | <el-button style="color: red" type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:labels:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handlePageChange" |
| | | :pagination="tableData.pagination" |
| | | > |
| | | </pagination> |
| | | </template> |
| | | <!-- æ°å»º/ä¿®æ¹ --> |
| | | <OperaLabelsWindow ref="operaLabelsWindow" @success="handlePageChange"/> |
| | | </TableLayout> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout from '@/layouts/TableLayout' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import OperaLabelsWindow from '@/components/business/OperaLabelsZhuanquWindow' |
| | | import {findAll as labelList, updateStatusById} from '@/api/business/labels' |
| | | export default { |
| | | name: 'Labels', |
| | | extends: BaseTable, |
| | | components: { TableLayout, Pagination, OperaLabelsWindow }, |
| | | data () { |
| | | return { |
| | | // æç´¢ |
| | | labels: [], |
| | | searchForm: { |
| | | name: '', |
| | | parentId: null, |
| | | type: 15 |
| | | } |
| | | } |
| | | }, |
| | | provide() { |
| | | return { |
| | | labels: () => this.labels |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: 'åçç³»åä¿¡æ¯è¡¨', |
| | | api: '/business/labels', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | this.loadLabels() |
| | | this.search() |
| | | }, |
| | | methods: { |
| | | loadLabels () { |
| | | labelList({type: 14}) |
| | | .then(res => { |
| | | this.labels = res |
| | | }) |
| | | }, |
| | | statusChange (row) { |
| | | this.api.updateStatusById({ id: row.id, status: row.status }) |
| | | .then(() => { |
| | | this.$message.success('æä½æå') |
| | | }) |
| | | .catch(e => { |
| | | this.$message.error('æä½æå') |
| | | }) |
| | | .then(() => { |
| | | this.handlePageChange() |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |