| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout :permissions="['business:dispatchunit: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> |
| | | <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:dispatchunit:create']"> |
| | | <li><el-button type="primary" @click="$refs.operaDispatchUnitWindow.open('æ·»å æ´¾é£åä½')" v-permissions="['business:dispatchunit:create']">æ°å¢æ´¾é£åä½</el-button></li> |
| | | </ul> |
| | | <el-table |
| | | v-loading="isWorking.search" |
| | | :data="tableData.list" |
| | | stripe |
| | | > |
| | | <el-table-column label="åºå·" width="80px"> |
| | | <template slot-scope="scope"> |
| | | <span>{{scope.$index + 1}}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="name" label="æ´¾é£åä½"></el-table-column> |
| | | <el-table-column label="ä¼ä¸ç¶æ"> |
| | | <template slot-scope="{row}"> |
| | | <span v-if="row.unitStatus === 0">å¾
å®¡æ ¸</span> |
| | | <span v-if="row.unitStatus === 1" style="color: green;">å®¡æ ¸éè¿</span> |
| | | <span v-if="row.unitStatus === 2" style="color: red;">å®¡æ ¸ä¸éè¿</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="createDate" label="æ·»å æ¥æ"></el-table-column> |
| | | <el-table-column label="æ¯å¦åç¨"> |
| | | <template slot-scope="{row}"> |
| | | <el-switch |
| | | @change="changeStatus($event, row)" |
| | | v-model="row.status" |
| | | active-color="#13ce66" |
| | | inactive-color="#ff4949" |
| | | :active-value="1" |
| | | :inactive-value="0"> |
| | | </el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | v-if="containPermissions(['business:dispatchunit:update', 'business:dispatchunit:delete'])" |
| | | label="æä½" |
| | | min-width="120" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" @click="$refs.dispatchUnitDetails.open('æ´¾é£åä½è¯¦æ
', row)" v-permissions="['business:dispatchunit:update']">æ¥ç详æ
</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handlePageChange" |
| | | :pagination="tableData.pagination" |
| | | > |
| | | </pagination> |
| | | </template> |
| | | <!-- æ°å»º/ä¿®æ¹ --> |
| | | <OperaDispatchUnitWindow ref="operaDispatchUnitWindow" @success="handlePageChange"/> |
| | | <!-- 详æ
--> |
| | | <dispatchUnitDetails ref="dispatchUnitDetails" @success="handlePageChange"/> |
| | | </TableLayout> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout from '@/layouts/TableLayout' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import OperaDispatchUnitWindow from '@/components/business/OperaDispatchUnitWindow' |
| | | import dispatchUnitDetails from '@/components/business/dispatchUnitDetails' |
| | | import { updateById } from '@/api/business/dispatchUnit' |
| | | export default { |
| | | name: 'DispatchUnit', |
| | | extends: BaseTable, |
| | | components: { TableLayout, Pagination, OperaDispatchUnitWindow, dispatchUnitDetails }, |
| | | data () { |
| | | return { |
| | | // æç´¢ |
| | | searchForm: { |
| | | name: '', |
| | | dataType: 0 |
| | | } |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: 'æ´¾é£åä½ä¿¡æ¯è¡¨', |
| | | api: '/business/dispatchUnit', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | this.search() |
| | | }, |
| | | methods: { |
| | | // ä¿®æ¹ç¶æ |
| | | changeStatus(status, row) { |
| | | updateById({ status, id: row.id }) |
| | | .then(res => { |
| | | this.search() |
| | | }) |
| | | .catch(err => { |
| | | row.status = row.status === 0 ? 1 : 0 |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |