|
@@ -1,44 +1,49 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div class="list-view">
|
|
|
|
|
- <page-title>
|
|
|
|
|
- <el-button @click="addRow" type="primary" icon="el-icon-plus" :disabled="fetchingData || downloading"
|
|
|
|
|
- class="filter-item">
|
|
|
|
|
- 新增
|
|
|
|
|
- </el-button>
|
|
|
|
|
- <el-button @click="download" icon="el-icon-upload2" :loading="downloading" :disabled="fetchingData"
|
|
|
|
|
- class="filter-item">
|
|
|
|
|
- 导出
|
|
|
|
|
- </el-button>
|
|
|
|
|
- </page-title>
|
|
|
|
|
- <div class="filters-container">
|
|
|
|
|
- <el-input placeholder="搜索..." v-model="search" clearable class="filter-item search"
|
|
|
|
|
- @keyup.enter.native="getData">
|
|
|
|
|
- <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
|
|
|
|
|
- </el-input>
|
|
|
|
|
- </div>
|
|
|
|
|
- <el-table :data="tableData" row-key="id" ref="table" header-row-class-name="table-header-row"
|
|
|
|
|
- header-cell-class-name="table-header-cell" row-class-name="table-row" cell-class-name="table-cell"
|
|
|
|
|
- :height="tableHeight" v-loading="fetchingData">
|
|
|
|
|
- <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
|
|
|
|
|
- <el-table-column prop="objectId" label="物体id" align="center" > </el-table-column>
|
|
|
|
|
- <el-table-column prop="startTime" label="物体开始移动时间" align="center" > </el-table-column>
|
|
|
|
|
- <el-table-column label="操作" align="center" fixed="right" width="150">
|
|
|
|
|
- <template slot-scope="{ row }">
|
|
|
|
|
- <el-button @click="editRow(row)" type="primary" size="mini" plain>查看</el-button>
|
|
|
|
|
- <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </el-table>
|
|
|
|
|
- <div class="pagination-wrapper">
|
|
|
|
|
- <el-pagination background @size-change="onSizeChange" @current-change="onCurrentChange" :current-page="page"
|
|
|
|
|
- :page-sizes="[10, 20, 30, 40, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
- :total="totalElements">
|
|
|
|
|
- </el-pagination>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+ <div class="list-view">
|
|
|
|
|
+ <page-title>
|
|
|
|
|
+ <el-button @click="addRow" type="primary" icon="el-icon-plus" :disabled="fetchingData || downloading"
|
|
|
|
|
+ class="filter-item">
|
|
|
|
|
+ 新增
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ <el-button @click="download" icon="el-icon-upload2" :loading="downloading" :disabled="fetchingData"
|
|
|
|
|
+ class="filter-item">
|
|
|
|
|
+ 导出
|
|
|
|
|
+ </el-button>
|
|
|
|
|
+ </page-title>
|
|
|
|
|
+ <div class="filters-container">
|
|
|
|
|
+ <el-input placeholder="搜索..." v-model="search" clearable class="filter-item search"
|
|
|
|
|
+ @keyup.enter.native="getData">
|
|
|
|
|
+ <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
|
|
|
|
|
+ </el-input>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-table :data="tableData" row-key="id" ref="table" header-row-class-name="table-header-row"
|
|
|
|
|
+ header-cell-class-name="table-header-cell" row-class-name="table-row" cell-class-name="table-cell"
|
|
|
|
|
+ :height="tableHeight" v-loading="fetchingData">
|
|
|
|
|
+ <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
|
|
|
|
|
+ <el-table-column prop="objectId" label="物体id" align="center"> </el-table-column>
|
|
|
|
|
+ <el-table-column prop="regionId" label="区域id" align="center"> </el-table-column>
|
|
|
|
|
+ <el-table-column prop="cityId" label="城市id" align="center"> </el-table-column>
|
|
|
|
|
+ <el-table-column prop="startTime" label="物体开始移动时间" align="center"> </el-table-column>
|
|
|
|
|
+ <el-table-column label="操作" align="center" fixed="right" width="350">
|
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
|
+ <el-button @click="editRow(row)" type="primary" size="mini" plain>查看</el-button>
|
|
|
|
|
+ <el-button @click="start(row)" type="primary" size="mini" plain v-if="!row.run">运行</el-button>
|
|
|
|
|
+ <el-button @click="stop(row)" type="primary" size="mini" plain v-if="row.run">停运</el-button>
|
|
|
|
|
+ <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <div class="pagination-wrapper">
|
|
|
|
|
+ <el-pagination background @size-change="onSizeChange" @current-change="onCurrentChange" :current-page="page"
|
|
|
|
|
+ :page-sizes="[10, 20, 30, 40, 50]" :page-size="pageSize" layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
+ :total="totalElements">
|
|
|
|
|
+ </el-pagination>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
</template>
|
|
</template>
|
|
|
<script>
|
|
<script>
|
|
|
import { mapState } from 'vuex';
|
|
import { mapState } from 'vuex';
|
|
|
|
|
+import axios from 'axios';
|
|
|
import pageableTable from '@/mixins/pageableTable';
|
|
import pageableTable from '@/mixins/pageableTable';
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
@@ -46,6 +51,7 @@ export default {
|
|
|
mixins: [pageableTable],
|
|
mixins: [pageableTable],
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
|
|
+ baseUrl: 'localhost:8088',
|
|
|
multipleMode: false,
|
|
multipleMode: false,
|
|
|
search: '',
|
|
search: '',
|
|
|
url: '/metaObjectMove/all',
|
|
url: '/metaObjectMove/all',
|
|
@@ -57,6 +63,27 @@ export default {
|
|
|
return this.$refs.table.selection.map(i => i.id);
|
|
return this.$refs.table.selection.map(i => i.id);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ created() {
|
|
|
|
|
+ if (location.host === 'test.raex.vip') {
|
|
|
|
|
+ this.baseUrl = 'test.mmo.raex.vip'
|
|
|
|
|
+ } else if (location.host === 'raex.vip') {
|
|
|
|
|
+ this.baseUrl = 'mmo.raex.vip'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.baseUrl = 'localhost:8088'
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ mounted() {
|
|
|
|
|
+ axios
|
|
|
|
|
+ .get(`http://${this.baseUrl}/mmo/websocket/check`)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ if (res.data != 'success') {
|
|
|
|
|
+ this.$message.error(res.data);
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ this.$message.error(e);
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
methods: {
|
|
methods: {
|
|
|
beforeGetData() {
|
|
beforeGetData() {
|
|
|
return { search: this.search, query: { del: false } };
|
|
return { search: this.search, query: { del: false } };
|
|
@@ -107,29 +134,85 @@ export default {
|
|
|
this.$message.error(e.error);
|
|
this.$message.error(e.error);
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- operation1() {
|
|
|
|
|
- this.$notify({
|
|
|
|
|
- title: '提示',
|
|
|
|
|
- message: this.selection
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ deleteRow(row) {
|
|
|
|
|
+ if (row.run) {
|
|
|
|
|
+ this.$message.error('这在运行中的物体不能删除');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ return this.$http.post(`/metaObjectMove/del/${row.id}`);
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ this.$message.success('删除成功');
|
|
|
|
|
+ this.getData();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ if (e !== 'cancel') {
|
|
|
|
|
+ this.$message.error(e.error);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
- operation2() {
|
|
|
|
|
- this.$message('操作2');
|
|
|
|
|
|
|
+ start(row) {
|
|
|
|
|
+ if (row.run) {
|
|
|
|
|
+ this.$message.error('该物体正在运行中');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$alert('确定要运行该物体吗', '警告', { type: 'info' })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ return this.$http.post(`/metaObjectMove/${row.id}/run`);
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ axios
|
|
|
|
|
+ .get(`http://${this.baseUrl}/mmo/websocket/${row.objectId}/start`)
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ this.$message.success('运行成功,正在广播坐标信息');
|
|
|
|
|
+ this.getData();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ if (e !== 'cancel') {
|
|
|
|
|
+ this.$message.error(e.error);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ if (e !== 'cancel') {
|
|
|
|
|
+ this.$message.error(e.error);
|
|
|
|
|
+ this.$http.post(`/metaObjectMove/${row.id}/cancelRun`)
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
},
|
|
},
|
|
|
- deleteRow(row) {
|
|
|
|
|
- this.$alert('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- return this.$http.post(`/metaObjectMove/del/${row.id}`);
|
|
|
|
|
- })
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- this.$message.success('删除成功');
|
|
|
|
|
- this.getData();
|
|
|
|
|
- })
|
|
|
|
|
- .catch(e => {
|
|
|
|
|
- if (e !== 'cancel') {
|
|
|
|
|
- this.$message.error(e.error);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ stop(row) {
|
|
|
|
|
+ if (!row.run) {
|
|
|
|
|
+ this.$message.error('该物体已经停运');
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$alert('确定要停运该物体吗', '警告', { type: 'info' })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ return this.$http.post(`/metaObjectMove/${row.id}/cancelRun`);
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ axios
|
|
|
|
|
+ .get(`http://${this.baseUrl}/mmo/websocket/${row.objectId}/stop`)
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ this.$message.success('停运成功');
|
|
|
|
|
+ this.getData();
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ if (e !== 'cancel') {
|
|
|
|
|
+ this.$message.error(e.error);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(e => {
|
|
|
|
|
+ if (e !== 'cancel') {
|
|
|
|
|
+ this.$message.error(e.error);
|
|
|
|
|
+ this.$http.post(`/metaObjectMove/${row.id}/run`)
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|