<template>
|
<div class="app-container">
|
<div class="filter-container">
|
<el-input v-model="listQuery.keyword" size="small" placeholder="请输入编号/名称/卡号" clearable
|
class="filter-item w-200" />
|
<el-button-group class="filter-item">
|
<el-button size="small" type="primary" icon="el-icon-search" @click="search">
|
搜索
|
</el-button>
|
<el-button size="small" type="primary" icon="el-icon-refresh" @click="refresh">
|
刷新
|
</el-button>
|
<el-button v-if="uadd == 'Yes'" size="small" type="primary" icon="el-icon-plus" @click="add">
|
新增
|
</el-button>
|
</el-button-group>
|
|
<span style="margin-left: 100px;">
|
<!-- <el-date-picker v-model="timeExport" type="daterange" unlink-panels :picker-options="pickerOptions"
|
range-separator="至" start-placeholder="开始时间" end-placeholder="结束时间" value-format="yyyy-MM-dd" /> -->
|
|
<!-- <el-button style="margin-left: 10px;" type="primary" @click="exportExcel">导出EXCEL</el-button> -->
|
|
<el-button style="margin-left: 10px;" type="primary" @click="resetzuobiao">重置基站坐标</el-button>
|
|
</span>
|
</div>
|
|
<el-table v-loading="listLoading" :data="list" element-loading-text="Loading" border fit height="100%"
|
class="table-container" highlight-current-row @selection-change="handleSelectionChange">
|
<el-table-column type="selection" width="55">
|
</el-table-column>
|
<el-table-column fixed label="ID" width="70">
|
<template slot-scope="scope">
|
{{ scope.row.id }}
|
</template>
|
</el-table-column>
|
<el-table-column label="编号" width="70">
|
<template slot-scope="scope">
|
{{ scope.row.tagid }}
|
</template>
|
</el-table-column>
|
<el-table-column label="名称" width="150">
|
<template slot-scope="scope">
|
{{ scope.row.anchorname }}
|
</template>
|
</el-table-column>
|
<el-table-column label="公司" width="170">
|
<template slot-scope="scope">
|
{{ scope.row.company }}
|
</template>
|
</el-table-column>
|
<el-table-column label="状态" width="80">
|
|
<template slot-scope="scope">
|
<!-- <template slot-scope="scope"> -->
|
<!-- <span v-if="scope.row.onlie == '1'"><img src="../../assets/images/online6.png"></span>
|
<span v-else-if="scope.row.onlie == '0'"><img src="../../assets/images/offline4.png"></span> -->
|
<span v-if="scope.row.onlie == '1'">在线</span>
|
<span v-else-if="scope.row.onlie == '0'">离线</span>
|
<span v-else-if="scope.row.onlie == '4'">高精度</span>
|
<span v-else-if="scope.row.onlie == '6'">超阈值告警</span>
|
<span v-else-if="scope.row.onlie == '7'">非高精度告警</span>
|
<!-- </template> -->
|
<!-- <span v-if="scope.row.onlie == 1">在线</span>
|
<span v-if="scope.row.onlie == 0">离线</span> -->
|
</template>
|
</el-table-column>
|
|
<!-- <el-table-column label="电量" width="60">
|
<template slot-scope="scope">
|
{{ scope.row.electricity }}
|
</template>
|
</el-table-column> -->
|
<el-table-column label="版本" width="60">
|
<template slot-scope="scope">
|
{{ scope.row.banben }}
|
</template>
|
</el-table-column>
|
<el-table-column label="卫星" width="60">
|
<template slot-scope="scope">
|
{{ scope.row.gpsnum }}
|
</template>
|
</el-table-column>
|
<el-table-column label="卡号" width="190">
|
<template slot-scope="scope">
|
{{ scope.row.cid }}
|
</template>
|
</el-table-column>
|
<el-table-column label="经度" width="120">
|
<template slot-scope="scope">
|
{{ scope.row.lon }}
|
</template>
|
</el-table-column>
|
<el-table-column label="纬度" width="120">
|
<template slot-scope="scope">
|
{{ scope.row.lat }}
|
</template>
|
</el-table-column>
|
<el-table-column label="高程">
|
<template slot-scope="scope">
|
{{ scope.row.height }}
|
</template>
|
</el-table-column>
|
<el-table-column label="时间" width="180">
|
<template slot-scope="scope">
|
{{ scope.row.addtime }}
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" width="200" v-if="uupdate == 'Yes' || udelete == 'Yes'">
|
<template slot-scope="scope">
|
<el-button-group>
|
<el-button v-if="uupdate == 'Yes'" type="primary" icon="el-icon-edit" size="mini" @click="edit(scope)">
|
修改
|
</el-button>
|
<el-button v-if="udelete == 'Yes'" type="danger" icon="el-icon-delete" size="mini" @click="del(scope)">
|
删除
|
</el-button>
|
</el-button-group>
|
</template>
|
</el-table-column>
|
</el-table>
|
|
<pagination v-show="total > 0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size"
|
@pagination="fetchData" />
|
|
<el-dialog :visible.sync="dialogVisible" :title="dialogType === 'modify' ? '修改' : '新增'">
|
<el-form :ref="temp" :model="temp" label-width="120px" label-position="right" :rules="rules">
|
<el-form-item label="编号" prop="tagid">
|
<el-input v-model="temp.tagid
|
" placeholder="请输入编号" />
|
</el-form-item>
|
<el-form-item label="名称" prop="anchorname">
|
<el-input v-model="temp.anchorname
|
" placeholder="请输入名称" />
|
</el-form-item>
|
<el-form-item label="公司" prop="companyid">
|
<el-select style="width: 100%;" v-model="temp.company" filterable remote placeholder="请选择公司"
|
:remote-method="searchMethod" :loading="searchloading">
|
<el-option v-for="item in options" :key="item.id" :label="item.companyname" :value="item.id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<!-- <el-form-item label="卡号" prop="cid">
|
<el-input v-model="temp.cid
|
" placeholder="请输入卡号" />
|
</el-form-item> -->
|
</el-form>
|
<div class="text-right">
|
<el-button type="danger" @click="dialogVisible = false">
|
取消
|
</el-button>
|
<el-button type="primary" @click="submit()">
|
确定
|
</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import Pagination from '@/components/Pagination'
|
import { getList, delEquipment, addorupEquipment, searchEquipment, search, addSystemOperationLog, resetzuobiao,searchfive } from '@/api/equipment'
|
import { deepClone } from '@/utils'
|
|
const _temp = {
|
adminname: '',
|
id: '',
|
anchorname: '',
|
tagid: '',
|
companyid: '',
|
// cid: '',
|
type: 0
|
}
|
|
export default {
|
components: {
|
Pagination
|
},
|
data() {
|
return {
|
uadd: '',
|
udelete: '',
|
uupdate: '',
|
total: 0,
|
list: [],
|
menus: [],
|
listLoading: true,
|
listQuery: {
|
username: localStorage.getItem('username') || '',
|
current: 1,
|
size: 20,
|
keyword: undefined,
|
type: 0
|
},
|
multipleSelection: [],
|
uploadUrl: '',
|
temp: Object.assign({}, _temp),
|
dialogVisible: false,
|
dialogType: 'create',
|
loading: false,
|
value: '',
|
options: [],
|
rules: {
|
tagid: [
|
{ required: true, message: '请输入编号', trigger: 'blur' },
|
],
|
anchorname: [
|
{ required: true, message: '请数据名称', trigger: 'blur' }
|
],
|
companyid: [
|
{ required: true, message: '请选择公司', trigger: 'blur' }
|
],
|
// cid: [
|
// { required: true, message: '请输入卡号', trigger: 'blur' }
|
// ]
|
},
|
searchloading: false
|
}
|
},
|
created() {
|
this.fetchData()
|
},
|
methods: {
|
handleSelectionChange(val) {
|
this.multipleSelection = val;
|
},
|
resetzuobiao() {
|
if (this.multipleSelection.length == 0) {
|
this.$message({
|
message: '请先选择一条数据',
|
type: 'error'
|
})
|
} else if (this.multipleSelection.length > 1) {
|
this.$message({
|
message: '请选择一条数据',
|
type: 'error'
|
})
|
|
|
} else {
|
this.$prompt('该操作需要由专业技术人员完成,请输入操作密码', '设备编号' + this.multipleSelection[0].tagid + '确认操作', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
// inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,
|
|
inputErrorMessage: '密码错误',
|
inputValidator: (value) => {//input校验
|
if (value != 20151102) {
|
return '密码错误';
|
}
|
},
|
}).then(({ value }) => {
|
|
const params = { tagid: this.multipleSelection[0].tagid };
|
resetzuobiao(params).then(response => {
|
const params = { name: localStorage.getItem('username') || '', content: localStorage.getItem('username')+"将设备编号" +
|
this.multipleSelection[0].tagid +
|
'重置基准站坐标' };
|
addSystemOperationLog(params).then(response => {
|
|
|
});
|
|
})
|
this.$message({
|
type: 'success',
|
message: '重置成功!'
|
});
|
}).catch(() => {
|
this.$message({
|
type: 'info',
|
message: '取消重置'
|
});
|
});
|
}
|
},
|
// 远程搜索
|
searchMethod(query) {
|
if (query !== '') {
|
this.loading = true;
|
var params = { query: query }
|
search(params).then(response => {
|
this.options = response.data;
|
this.loading = false;
|
})
|
} else {
|
this.options = [];
|
}
|
},
|
|
// 远程搜索
|
searchMethodfive(query) {
|
if (query !== '') {
|
this.loading = true;
|
// var params = { query: query }
|
searchfive().then(response => {
|
this.options = response.data;
|
this.loading = false;
|
})
|
} else {
|
this.options = [];
|
}
|
},
|
// 搜索
|
search() {
|
this.listLoading = true
|
searchEquipment(this.listQuery).then(response => {
|
if (response.data != null) {
|
this.list = response.data.records
|
this.total = response.data.total
|
} else {
|
this.$message({
|
message: '未搜索到数据',
|
type: 'error'
|
})
|
}
|
|
this.listLoading = false
|
})
|
},
|
refresh() {
|
this.listQuery = {
|
username: localStorage.getItem('username') || '',
|
current: 1,
|
size: 20,
|
keyword: undefined,
|
type: 0
|
}
|
this.fetchData()
|
},
|
// 分页数据
|
fetchData() {
|
this.uadd = localStorage.getItem('uadd') || '';
|
this.udelete = localStorage.getItem('udelete') || '';
|
this.uupdate = localStorage.getItem('uupdate') || '';
|
this.listLoading = true
|
getList(this.listQuery).then(response => {
|
this.list = response.data.records
|
this.total = response.data.total
|
this.listLoading = false
|
})
|
this.searchMethodfive()
|
},
|
resetTemp() {
|
this.temp = Object.assign({}, _temp)
|
},
|
add() {
|
this.resetTemp()
|
this.dialogVisible = true
|
this.dialogType = 'create'
|
// this.$nextTick(() => {
|
// this.$refs['dataForm'].clearValidate()
|
// })
|
},
|
edit(scope) {
|
this.resetTemp()
|
this.dialogVisible = true
|
this.dialogType = 'modify'
|
// this.temp.anchorname = scope.row.anchorname
|
// this.temp.companyid = scope.row.companyid
|
// this.temp.id = scope.row.id
|
// this.temp.needbaseid = scope.row.needbaseid
|
// this.temp.tagid = scope.row.tagid
|
// this.temp.type = scope.row.type
|
this.temp = deepClone(scope.row)
|
// this.$nextTick(() => {
|
// this.$refs['dataForm'].clearValidate()
|
// })
|
},
|
changeStatus(value, scope) {
|
setTimeout(() => {
|
this.list[scope.$index].status = value
|
this.$message({
|
message: '更新成功',
|
type: 'success'
|
})
|
}, 300)
|
},
|
// 删除
|
del(scope) {
|
|
this.$confirm('确认删除该条数据吗?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
setTimeout(() => {
|
const params = { id: scope.row.id };
|
this.list.splice(scope.$index, 1)
|
delEquipment(params).then(response => {
|
this.temp.adminname = localStorage.getItem('username') || '';
|
const params = { name: this.temp.adminname, content: '删除了一个基准站,该编号为:' + scope.row.tagid };
|
addSystemOperationLog(params).then(response => {
|
|
})
|
this.$message({
|
message: '删除成功',
|
type: 'success'
|
})
|
this.fetchData()
|
})
|
}, 300)
|
})
|
},
|
submit() {
|
|
if (this.loading) {
|
return
|
}
|
if ( this.dialogType != 'modify') {
|
this.temp.companyid=this.temp.company
|
}
|
// this.temp.companyid = this.temp.companyid
|
this.loading = true
|
this.$refs[this.temp].validate((valid) => {
|
if (valid) {
|
addorupEquipment(this.temp).then(() => {
|
if (this.temp.id == "") {
|
this.temp.adminname = localStorage.getItem('username') || '';
|
const params = { name: this.temp.adminname, content: '新增了一个基准站,该编号为:' + this.temp.tagid };
|
addSystemOperationLog(params).then(response => {
|
|
})
|
} else {
|
this.temp.adminname = localStorage.getItem('username') || '';
|
const params = { name: this.temp.adminname, content: '修改了一个基准站,该编号为:' + this.temp.tagid };
|
addSystemOperationLog(params).then(response => {
|
|
})
|
}
|
|
this.fetchData()
|
setTimeout(() => {
|
this.$message({
|
message: '提交成功',
|
type: 'success'
|
})
|
this.dialogVisible = false
|
this.loading = false
|
}, 300)
|
})
|
} else {
|
this.$message({
|
message: '提交失败,请检查表单必填项是否为空',
|
type: 'error'
|
})
|
console.log('error submit!!');
|
return false;
|
}
|
});
|
|
}
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.el-upload {
|
border: 1px dashed #d9d9d9 !important;
|
border-radius: 6px;
|
cursor: pointer;
|
position: relative;
|
overflow: hidden;
|
|
.el-icon-plus.avatar-uploader-icon {
|
border: 1px dashed #d9d9d9 !important;
|
border-radius: 6px;
|
font-size: 28px;
|
color: #8c939d;
|
width: 128px;
|
height: 128px;
|
line-height: 128px;
|
text-align: center;
|
}
|
}
|
|
.avatar-uploader {
|
height: 128px;
|
|
img {
|
width: 128px;
|
height: 128px;
|
}
|
}
|
</style>
|