| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout :permissions="['business:sites:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline> |
| | | <el-form-item label="ç«ç¹ç¼å·" prop="code"> |
| | | <el-input v-model="searchForm.code" placeholder="请è¾å
¥ç«ç¹ç¼å·" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <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:sites:create']"> |
| | | <li><el-button type="primary" @click="$refs.operaSitesWindow.open('æ°å»ºç«ç¹')" icon="el-icon-plus" |
| | | v-permissions="['business:sites:create']">æ°å»º</el-button></li> |
| | | </ul> |
| | | <el-table v-loading="isWorking.search" :data="tableData.list" stripe border> |
| | | <el-table-column prop="code" label="ç«ç¹ç¼å·" :sort-method="(a, b) => { return a.code - b.code }" sortable |
| | | min-width="100px" align="center"></el-table-column> |
| | | <el-table-column prop="name" label="ç«ç¹åç§°" sortable min-width="100px" align="center"></el-table-column> |
| | | |
| | | <el-table-column prop="createDate" label="å建æ¶é´" sortable min-width="100px" align="center"></el-table-column> |
| | | <el-table-column v-if="containPermissions(['business:sites:update', 'business:sites:delete'])" label="æä½" |
| | | min-width="120" align="center" fixed="right"> |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" @click="handleDraw(row)">ç»å¶å°å¾åºå</el-button> |
| | | <el-button type="text" @click="$refs.operaSitesWindow.open('ç¼è¾ç«ç¹', row)" icon="el-icon-edit" |
| | | v-permissions="['business:sites:update']">ç¼è¾</el-button> |
| | | <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" |
| | | v-permissions="['business:sites:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination @size-change="handleSizeChange" @current-change="handlePageChange" :pagination="tableData.pagination"> |
| | | </pagination> |
| | | </template> |
| | | <!-- æ°å»º/ä¿®æ¹ --> |
| | | <OperaSitesWindow ref="operaSitesWindow" @success="handlePageChange" /> |
| | | <!-- æ¥çäºç»´ç --> |
| | | <AMap @change="changeMap" ref="MapRef" /> |
| | | </TableLayout> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout from '@/layouts/TableLayout' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import OperaSitesWindow from './components/SitesWindow' |
| | | import AMap from './components/AMap.vue' |
| | | import { Message } from 'element-ui' |
| | | import { updateById } from '@/api/business/sites.js' |
| | | export default { |
| | | name: 'Sites', |
| | | extends: BaseTable, |
| | | components: { TableLayout, Pagination, OperaSitesWindow, AMap }, |
| | | data() { |
| | | return { |
| | | // æç´¢ |
| | | searchForm: { |
| | | id: '', |
| | | createDate: '', |
| | | creator: '', |
| | | editDate: '', |
| | | editor: '', |
| | | isdeleted: '', |
| | | info: '', |
| | | name: '', |
| | | code: '', |
| | | status: '', |
| | | lockNum: '', |
| | | ip: '', |
| | | clientVersion: '', |
| | | type: 1 |
| | | }, |
| | | isShowMap: false |
| | | } |
| | | }, |
| | | created() { |
| | | this.config({ |
| | | module: 'ç«ç¹ä¿¡æ¯è¡¨', |
| | | api: '/business/sites', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | this.search() |
| | | }, |
| | | methods: { |
| | | changeMap(e, row) { |
| | | console.log(e); |
| | | updateById({ ...row, electronicFence: JSON.stringify(e) }).then(res => { |
| | | if (res) { |
| | | Message.success('设置æå') |
| | | this.search() |
| | | } |
| | | }) |
| | | }, |
| | | handleDraw(row) { |
| | | this.$refs.MapRef.isShowModal = true |
| | | this.$nextTick(() => { |
| | | this.$refs.MapRef.row = row |
| | | // if (row.electronicFence) { |
| | | // this.$refs.MapRef.polygons = JSON.parse(row.electronicFence) |
| | | // } |
| | | |
| | | this.$refs.MapRef.initMap() |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |