You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
408 lines
12 KiB
408 lines
12 KiB
<template>
|
|
<div class="app-container">
|
|
<el-form
|
|
:model="queryParams"
|
|
ref="queryForm"
|
|
size="small"
|
|
:inline="true"
|
|
v-show="showSearch"
|
|
label-width="80px"
|
|
>
|
|
<el-form-item label="房间ID" prop="roomId">
|
|
<el-input
|
|
v-model="queryParams.roomId"
|
|
placeholder="请输入房间ID"
|
|
clearable
|
|
style="width: 180px"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="平台库ID" prop="platformId">
|
|
<el-input
|
|
v-model="queryParams.platformId"
|
|
placeholder="请输入平台库ID"
|
|
clearable
|
|
style="width: 180px"
|
|
@keyup.enter.native="handleQuery"
|
|
/>
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="primary"
|
|
plain
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
@click="handleAdd"
|
|
v-hasPermi="['system:roomPlatformIcon:add']"
|
|
>
|
|
新增
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="success"
|
|
plain
|
|
icon="el-icon-edit"
|
|
size="mini"
|
|
:disabled="single"
|
|
@click="handleUpdate"
|
|
v-hasPermi="['system:roomPlatformIcon:edit']"
|
|
>
|
|
修改
|
|
</el-button>
|
|
</el-col>
|
|
<el-col :span="1.5">
|
|
<el-button
|
|
type="danger"
|
|
plain
|
|
icon="el-icon-delete"
|
|
size="mini"
|
|
:disabled="multiple"
|
|
@click="handleDelete"
|
|
v-hasPermi="['system:roomPlatformIcon:remove']"
|
|
>
|
|
删除
|
|
</el-button>
|
|
</el-col>
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
</el-row>
|
|
|
|
<el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange">
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column label="ID" align="center" prop="id" width="80" />
|
|
<el-table-column label="房间ID" align="center" prop="roomId" width="120" />
|
|
<el-table-column label="平台库ID" align="center" prop="platformId" width="120" />
|
|
<el-table-column label="平台名称" align="center" prop="platformName" min-width="140" />
|
|
<el-table-column label="平台类型" align="center" prop="platformType" min-width="120" />
|
|
<el-table-column label="图标" align="center" min-width="160">
|
|
<template slot-scope="scope">
|
|
<img
|
|
v-if="scope.row.iconUrl"
|
|
:src="resolveImageUrl(scope.row.iconUrl)"
|
|
class="room-platform-icon-img"
|
|
alt=""
|
|
/>
|
|
<span v-else>-</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="经度" align="center" prop="lng" width="120" />
|
|
<el-table-column label="纬度" align="center" prop="lat" width="120" />
|
|
<el-table-column label="朝向(度)" align="center" prop="heading" width="120" />
|
|
<el-table-column label="缩放(均)" align="center" prop="iconScale" width="90" />
|
|
<el-table-column label="横向" align="center" prop="iconScaleX" width="80" />
|
|
<el-table-column label="纵向" align="center" prop="iconScaleY" width="80" />
|
|
<el-table-column label="排序" align="center" prop="sortOrder" width="120" />
|
|
<el-table-column label="创建时间" align="center" prop="createTime" min-width="160">
|
|
<template slot-scope="scope">
|
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="更新时间" align="center" prop="updateTime" min-width="160">
|
|
<template slot-scope="scope">
|
|
<span>{{ parseTime(scope.row.updateTime) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="180">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-edit"
|
|
@click="handleUpdate(scope.row)"
|
|
v-hasPermi="['system:roomPlatformIcon:edit']"
|
|
>
|
|
修改
|
|
</el-button>
|
|
<el-button
|
|
size="mini"
|
|
type="text"
|
|
icon="el-icon-delete"
|
|
@click="handleDelete(scope.row)"
|
|
v-hasPermi="['system:roomPlatformIcon:remove']"
|
|
class="text-danger"
|
|
>
|
|
删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<pagination
|
|
v-show="total > 0"
|
|
:total="total"
|
|
:page.sync="queryParams.pageNum"
|
|
:limit.sync="queryParams.pageSize"
|
|
@pagination="getList"
|
|
/>
|
|
|
|
<el-dialog :title="title" :visible.sync="open" width="720px" append-to-body>
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="房间ID" prop="roomId">
|
|
<el-input v-model="form.roomId" placeholder="请输入房间ID" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="平台库ID" prop="platformId">
|
|
<el-input v-model="form.platformId" placeholder="请输入平台库ID" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="平台名称快照" prop="platformName">
|
|
<el-input v-model="form.platformName" placeholder="请输入平台名称快照" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="平台类型快照" prop="platformType">
|
|
<el-input v-model="form.platformType" placeholder="请输入平台类型快照" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="图标URL快照" prop="iconUrl">
|
|
<el-input v-model="form.iconUrl" placeholder="例如 /assets/icons/f22.png" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<div class="icon-preview">
|
|
<div>预览</div>
|
|
<img v-if="form.iconUrl" :src="resolveImageUrl(form.iconUrl)" class="room-platform-icon-img" alt="" />
|
|
<div v-else>-</div>
|
|
</div>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="经度" prop="lng">
|
|
<el-input v-model="form.lng" placeholder="请输入经度" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="纬度" prop="lat">
|
|
<el-input v-model="form.lat" placeholder="请输入纬度" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="朝向(度)" prop="heading">
|
|
<el-input v-model="form.heading" placeholder="请输入朝向(度)" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="图标缩放(均)" prop="iconScale">
|
|
<el-input v-model="form.iconScale" placeholder="兼容字段,可为空" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="横向缩放" prop="iconScaleX">
|
|
<el-input v-model="form.iconScaleX" placeholder="默认与缩放均一致" />
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="纵向缩放" prop="iconScaleY">
|
|
<el-input v-model="form.iconScaleY" placeholder="默认与缩放均一致" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item label="排序" prop="sortOrder">
|
|
<el-input v-model="form.sortOrder" placeholder="请输入排序(可为空)" />
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
listRoomPlatformIcon,
|
|
getRoomPlatformIcon,
|
|
delRoomPlatformIcon,
|
|
addRoomPlatformIcon,
|
|
updateRoomPlatformIcon
|
|
} from "@/api/system/roomPlatformIcon"
|
|
import { resolveImageUrl } from "@/utils/imageUrl"
|
|
|
|
export default {
|
|
name: "RoomPlatformIcon",
|
|
data() {
|
|
return {
|
|
loading: true,
|
|
showSearch: true,
|
|
total: 0,
|
|
list: [],
|
|
|
|
ids: [],
|
|
single: true,
|
|
multiple: true,
|
|
|
|
title: "",
|
|
open: false,
|
|
|
|
queryParams: {
|
|
pageNum: 1,
|
|
pageSize: 10,
|
|
roomId: null,
|
|
platformId: null
|
|
},
|
|
|
|
form: {},
|
|
rules: {
|
|
roomId: [{ required: true, message: "房间ID不能为空", trigger: "blur" }],
|
|
platformId: [{ required: true, message: "平台库ID不能为空", trigger: "blur" }],
|
|
lng: [{ required: true, message: "经度不能为空", trigger: "blur" }],
|
|
lat: [{ required: true, message: "纬度不能为空", trigger: "blur" }]
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
this.getList()
|
|
},
|
|
methods: {
|
|
resolveImageUrl,
|
|
/** 查询列表 */
|
|
getList() {
|
|
this.loading = true
|
|
listRoomPlatformIcon(this.queryParams).then(response => {
|
|
this.list = response.rows || []
|
|
this.total = response.total || 0
|
|
this.loading = false
|
|
}).catch(() => {
|
|
this.loading = false
|
|
})
|
|
},
|
|
/** 搜索按钮操作 */
|
|
handleQuery() {
|
|
this.queryParams.pageNum = 1
|
|
this.getList()
|
|
},
|
|
/** 重置按钮操作 */
|
|
resetQuery() {
|
|
this.queryParams.pageNum = 1
|
|
this.resetForm("queryForm")
|
|
this.handleQuery()
|
|
},
|
|
// 表单重置
|
|
reset() {
|
|
this.form = {
|
|
id: null,
|
|
roomId: null,
|
|
platformId: null,
|
|
platformName: "",
|
|
platformType: "",
|
|
iconUrl: "",
|
|
lng: null,
|
|
lat: null,
|
|
heading: 0,
|
|
iconScale: 1,
|
|
iconScaleX: 1,
|
|
iconScaleY: 1,
|
|
sortOrder: null
|
|
}
|
|
this.resetForm("form")
|
|
},
|
|
/** 多选框选中数据 */
|
|
handleSelectionChange(selection) {
|
|
this.ids = selection.map(item => item.id)
|
|
this.single = selection.length !== 1
|
|
this.multiple = !selection.length
|
|
},
|
|
/** 新增按钮操作 */
|
|
handleAdd() {
|
|
this.reset()
|
|
this.open = true
|
|
this.title = "添加房间地图平台图标"
|
|
},
|
|
/** 修改按钮操作 */
|
|
handleUpdate(row) {
|
|
const id = row && row.id != null ? row.id : this.ids[0]
|
|
if (id == null) return
|
|
getRoomPlatformIcon(id).then(response => {
|
|
this.form = response.data || {}
|
|
this.open = true
|
|
this.title = "修改房间地图平台图标"
|
|
})
|
|
},
|
|
/** 提交按钮 */
|
|
submitForm() {
|
|
this.$refs.form.validate(valid => {
|
|
if (!valid) return
|
|
if (this.form.id != null) {
|
|
updateRoomPlatformIcon(this.form).then(() => {
|
|
this.$modal.msgSuccess("修改成功")
|
|
this.open = false
|
|
this.getList()
|
|
})
|
|
} else {
|
|
addRoomPlatformIcon(this.form).then(() => {
|
|
this.$modal.msgSuccess("新增成功")
|
|
this.open = false
|
|
this.getList()
|
|
})
|
|
}
|
|
})
|
|
},
|
|
/** 删除按钮操作 */
|
|
handleDelete(row) {
|
|
const ids = row && row.id != null ? row.id : this.ids
|
|
this.$modal.confirm("是否确认删除选中的房间地图平台图标数据?").then(() => {
|
|
delRoomPlatformIcon(ids).then(() => {
|
|
this.getList()
|
|
this.$modal.msgSuccess("删除成功")
|
|
})
|
|
}).catch(() => {})
|
|
},
|
|
cancel() {
|
|
this.open = false
|
|
this.reset()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.room-platform-icon-img {
|
|
width: 28px;
|
|
height: 28px;
|
|
object-fit: contain;
|
|
vertical-align: middle;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.icon-preview {
|
|
padding-left: 10px;
|
|
line-height: 1.2;
|
|
}
|
|
</style>
|
|
|
|
|