Commit 3b8d99bf authored by xiexingan's avatar xiexingan

Merge branch 'dev' of gitlab.suntrayoa.com:geqilin/zhxf_vue into dev

parents 542e698d 1b66f9bf
...@@ -12,22 +12,10 @@ ...@@ -12,22 +12,10 @@
el-form-item(label='资源点类型:' prop='type' ) el-form-item(label='资源点类型:' prop='type' )
el-select( v-model="dataForm.type" placeholder="请选择资源点类型" disabled) el-select( v-model="dataForm.type" placeholder="请选择资源点类型" disabled)
el-option(v-for="(item,index) in typeList" :key="index" :label="item.name" :value="item.id") el-option(v-for="(item,index) in typeList" :key="index" :label="item.name" :value="item.id")
//- el-form-item(label='线路:' prop='lineId' ) el-form-item(label='楼栋:' prop='stationName' )
//- el-select(v-model="dataForm.lineId" placeholder="请选择线路" @change="lineChange" disabled ) el-input(v-model='dataForm.stationName' placeholder='' readonly)
//- el-option(v-for="(item,index) in lineList" :key="index" :label="item.name" :value="item.id")
el-form-item(label='线路:' prop='lineId' )
el-input(v-model='dataForm.lineId' placeholder="")
el-form-item(label='站点:' prop='stationId' )
el-select(v-model="dataForm.stationId" placeholder="请选择站点" @change="stationChange" disabled )
el-option(v-for="(item,index) in stationList" :key="index" :label="item.stationName" :value="item.id")
//- el-option(v-for="(item,index) in stationList" :key="index" :label="item.code+'-'+item.stationName" :value="item.id")
el-form-item(label='子系统:' prop='subSystem' )
el-select(v-model="dataForm.subSystem" placeholder="请选择子系统" @change="subSystemChange")
el-option(v-for="(item,index) in systemList" :key="index" :label="item.name" :value="item.value" :code="item.value" :disabled="item.disabled")
el-form-item(label='资源点编码:' prop='code') el-form-item(label='资源点编码:' prop='code')
el-input(v-model='dataForm.code' placeholder='保存后系统自动生成' readonly) el-input(v-model='dataForm.code' placeholder='保存后系统自动生成' readonly)
el-form-item(label='子系统编码:' prop='subCode')
el-input(v-model='dataForm.subCode' placeholder='请填写子系统编码' readonly)
el-form-item(label='地址码:' prop='addressCode') el-form-item(label='地址码:' prop='addressCode')
el-input(v-model='dataForm.addressCode' placeholder='请填写地址码') el-input(v-model='dataForm.addressCode' placeholder='请填写地址码')
el-form-item(label='端口号:' prop='port') el-form-item(label='端口号:' prop='port')
...@@ -36,10 +24,6 @@ ...@@ -36,10 +24,6 @@
el-input(v-model='dataForm.username' placeholder='请填写用户名') el-input(v-model='dataForm.username' placeholder='请填写用户名')
el-form-item(label='密码:' prop='password') el-form-item(label='密码:' prop='password')
el-input(v-model='dataForm.password' placeholder='请填写密码') el-input(v-model='dataForm.password' placeholder='请填写密码')
el-form-item(label='父节点名称:' prop='parentName' v-if="dataForm.dicTypeName ==='枪机' && dataForm.subCode ==='04'")
el-select(v-model="dataForm.parentName" placeholder="请选择父节点")
el-option(v-for="(item,index) in parentList" :key="index" :label="item.name" :value="item.id" :code="item.id")
//- el-input(v-model='dataForm.parentName' placeholder='请填写父节点名称')
el-form-item(label='设备品牌:' prop='brand') el-form-item(label='设备品牌:' prop='brand')
el-select(v-model="dataForm.brand" placeholder="请选择设备品牌" ) el-select(v-model="dataForm.brand" placeholder="请选择设备品牌" )
el-option(v-for="(item,index) in brandList" :key="index" :label="item.name" :value="item.id" :code="item.id") el-option(v-for="(item,index) in brandList" :key="index" :label="item.name" :value="item.id" :code="item.id")
...@@ -47,8 +31,6 @@ ...@@ -47,8 +31,6 @@
el-input(v-model='dataForm.cameraNames' placeholder='请选择关联摄像头' @click.native="checktable") el-input(v-model='dataForm.cameraNames' placeholder='请选择关联摄像头' @click.native="checktable")
el-form-item(label='通道:' prop='byx1' v-if="dataForm.dicTypeName === '枪机' || dataForm.dicTypeName === '球机' || dataForm.dicTypeName === '安检机'") el-form-item(label='通道:' prop='byx1' v-if="dataForm.dicTypeName === '枪机' || dataForm.dicTypeName === '球机' || dataForm.dicTypeName === '安检机'")
el-input(v-model='dataForm.byx1' placeholder='请填写通道') el-input(v-model='dataForm.byx1' placeholder='请填写通道')
el-form-item(label='输送带端口号:' prop='ajjPort' v-if="dataForm.dicTypeName === '安检机'")
el-input(v-model='dataForm.ajjPort' placeholder='请填写输送带端口号')
el-col(:span="11" style="margin-left: 30px;") el-col(:span="11" style="margin-left: 30px;")
el-row( class='info-block') el-row( class='info-block')
div(class='info-title') 位置信息 div(class='info-title') 位置信息
...@@ -117,7 +99,7 @@ export default { ...@@ -117,7 +99,7 @@ export default {
...mapState('d2admin/user', ['info']) ...mapState('d2admin/user', ['info'])
}, },
props: ['pList'], props: ['pList'],
data () { data() {
// var validatorCamer = (rule, value, callback) => { // var validatorCamer = (rule, value, callback) => {
// if (this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' && this.dataForm.type !== 'ece0b8b2db27411886254e81134988a3') { // if (this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' && this.dataForm.type !== 'ece0b8b2db27411886254e81134988a3') {
// if (this.dataForm.cameraIds === null || this.dataForm.cameraIds === undefined || this.dataForm.cameraIds === '') { // if (this.dataForm.cameraIds === null || this.dataForm.cameraIds === undefined || this.dataForm.cameraIds === '') {
...@@ -144,7 +126,6 @@ export default { ...@@ -144,7 +126,6 @@ export default {
list: [], list: [],
sysOrgList: [], sysOrgList: [],
dataListSelections: [], dataListSelections: [],
lineList: [],
stationList: [], stationList: [],
typeList: [], typeList: [],
systemList: [], systemList: [],
...@@ -160,15 +141,11 @@ export default { ...@@ -160,15 +141,11 @@ export default {
id: 0, id: 0,
name: '', name: '',
type: 1, type: 1,
lineId: '',
lineName: '',
stationId: localStorage.getItem('stationId'), stationId: localStorage.getItem('stationId'),
stationName: '', stationName: '',
tierId: '', tierId: '',
cameraNames: '', cameraNames: '',
subSystem: '',
code: '', code: '',
subCode: '',
addressCode: '', addressCode: '',
port: '', port: '',
username: '', username: '',
...@@ -181,147 +158,195 @@ export default { ...@@ -181,147 +158,195 @@ export default {
{ required: true, message: '资源点名称不能为空', trigger: 'blur' }, { required: true, message: '资源点名称不能为空', trigger: 'blur' },
{ min: 1, max: 10, message: '长度在 1 到 10 个字符', trigger: 'blur' } { min: 1, max: 10, message: '长度在 1 到 10 个字符', trigger: 'blur' }
], ],
type: [{ required: true, message: '资源点类型不能为空', trigger: 'blur' }], type: [
lineId: [{ required: true, message: '线路不能为空', trigger: 'blur' }], { required: true, message: '资源点类型不能为空', trigger: 'blur' }
stationId: [{ required: true, message: '站点不能为空', trigger: 'blur' }],
subSystem: [{ required: true, message: '子系统不能为空', trigger: 'blur' }],
//code: [{ required: true, message: '资源点编码不能为空', trigger: 'blur' },
//{ min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }],
subCode: [{ required: true, message: '子系统编码不能为空', trigger: 'blur' },
{ min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }],
parentName: [{ required: true, message: '父节点名称不能为空', trigger: 'blur' }],
addressCode: [{ min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }],
port: [{ message: '请输入端口号', trigger: 'change' },
{ validator(rule, value, callback) {
if (value) {
if (Number.isInteger(Number(value)) && Number(value) < 65536 && Number(value) > 0) {
callback()
} else {
callback(new Error('请输入1到65535之间的正整数'))
}
} else {
callback()
}
},
trigger: 'blur' }
], ],
ajjPort: [ // parentName: [
{ validator(rule, value, callback) { // { required: true, message: '父节点名称不能为空', trigger: 'blur' }
if (value) { // ],
if (Number.isInteger(Number(value)) && Number(value) < 65536 && Number(value) > 0) { addressCode: [
callback() { min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }
],
port: [
{ message: '请输入端口号', trigger: 'change' },
{
validator(rule, value, callback) {
if (value) {
if (
Number.isInteger(Number(value)) &&
Number(value) < 65536 &&
Number(value) > 0
) {
callback()
} else {
callback(new Error('请输入1到65535之间的正整数'))
}
} else { } else {
callback(new Error('请输入1到65535之间的正整数')) callback()
} }
} else { },
callback() trigger: 'blur'
} }
}, ],
trigger: 'blur' } username: [
{ min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }
],
password: [
{ min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }
],
xlongit: [
{ required: true, message: 'X1坐标不能为空', trigger: 'blur' },
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
],
ylat: [
{ required: true, message: 'Y1坐标不能为空', trigger: 'blur' },
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
],
xpoint: [
{ required: true, message: 'X1坐标不能为空', trigger: 'blur' },
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
],
ypoint: [
{ required: true, message: 'Y1坐标不能为空', trigger: 'blur' },
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }
], ],
username: [{ min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }],
password: [{ min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }],
xlongit: [{ required: true, message: 'X1坐标不能为空', trigger: 'blur' },
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }],
ylat: [{ required: true, message: 'Y1坐标不能为空', trigger: 'blur' },
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }],
xpoint: [{ required: true, message: 'X1坐标不能为空', trigger: 'blur' },
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }],
ypoint: [{ required: true, message: 'Y1坐标不能为空', trigger: 'blur' },
{ min: 1, max: 20, message: '长度在 1 到 20 个字符', trigger: 'blur' }],
//width: [{ required: true, message: '长度不能为空', trigger: 'blur' }], //width: [{ required: true, message: '长度不能为空', trigger: 'blur' }],
tierId: [{ required: true, message: '地图层级不能为空', trigger: 'blur' }], tierId: [
deployLocation: [{ required: true, message: '部署位置不能为空', trigger: 'blur' }, { required: true, message: '地图层级不能为空', trigger: 'blur' }
{ min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }], ],
operatorName: [{ required: true, message: '当前操作员不能为空', trigger: 'blur' }], deployLocation: [
{ required: true, message: '部署位置不能为空', trigger: 'blur' },
{ min: 1, max: 64, message: '长度在 1 到 64 个字符', trigger: 'blur' }
],
operatorName: [
{ required: true, message: '当前操作员不能为空', trigger: 'blur' }
],
// cameraNames: [{ required: true, validator: validatorCamer, trigger: ['blur', 'change'] }], // cameraNames: [{ required: true, validator: validatorCamer, trigger: ['blur', 'change'] }],
brand: [{ required: true, message: '品牌不能为空', trigger: ['blur', 'change'] }], brand: [
icon: [{ required: true, message: '资源点图标不能为空', trigger: 'blur' }], {
attachedInfo: [{ min: 1, max: 500, message: '长度在 1 到 500 个字符', trigger: 'blur' }], required: true,
message: '品牌不能为空',
trigger: ['blur', 'change']
}
],
icon: [
{ required: true, message: '资源点图标不能为空', trigger: 'blur' }
],
attachedInfo: [
{
min: 1,
max: 500,
message: '长度在 1 到 500 个字符',
trigger: 'blur'
}
],
byx1: [ byx1: [
{ validator(rule, value, callback) { {
if (value) { validator(rule, value, callback) {
if (Number.isInteger(Number(value)) && Number(value) < 99 && Number(value) > 0) { if (value) {
callback() if (
Number.isInteger(Number(value)) &&
Number(value) < 99 &&
Number(value) > 0
) {
callback()
} else {
callback(new Error('请输入1到99之间的正整数'))
}
} else { } else {
callback(new Error('请输入1到99之间的正整数')) callback()
} }
} else { },
callback() trigger: 'blur'
} }
}, ],
trigger: 'blur' }], remark: [
remark: [{ min: 1, max: 500, message: '长度在 1 到 500 个字符', trigger: 'blur' }] {
min: 1,
max: 500,
message: '长度在 1 到 500 个字符',
trigger: 'blur'
}
]
} }
} }
}, },
created () { created() {
that = this that = this
}, },
methods: { methods: {
initMap (bean) { initMap(bean) {
if (this.mapDialog) { if (this.mapDialog) {
this.mapDialog.removeLayer(this.imgLayer) this.mapDialog.removeLayer(this.imgLayer)
this.mapDialog.removeLayer(this.vectorLayer) this.mapDialog.removeLayer(this.vectorLayer)
} }
let zoomControl = new Zoom({ let zoomControl = new Zoom({
delta: 0.2, delta: 0.2,
zoomInTipLabel: '', zoomInTipLabel: '',
zoomOutTipLabel: '' zoomOutTipLabel: ''
}) })
this.projection = new Projection({ this.projection = new Projection({
// 投影 // 投影
code: 'xkcd-image', code: 'xkcd-image',
units: 'pixels', units: 'pixels',
extent: this.extent extent: this.extent
}) })
this.imgLayer = new ImageLayer({ this.imgLayer = new ImageLayer({
id: bean.id, id: bean.id,
source: new ImageStatic({ source: new ImageStatic({
url: bean.readPath, //这里添加静态图片的地址 url: bean.readPath, //这里添加静态图片的地址
projection: this.projection, projection: this.projection,
imageExtent: this.extent imageExtent: this.extent
}), }),
visible: true visible: true
}) })
this.mapDialog = new Map({ this.mapDialog = new Map({
target: 'mapDialog', target: 'mapDialog',
layers: [this.imgLayer], layers: [this.imgLayer],
controls: [zoomControl], controls: [zoomControl],
view: new View({ view: new View({
projection: this.projection, projection: this.projection,
center: getCenter([0, 0, 418, 600]), // 获取范围的中心坐标。 center: getCenter([0, 0, 418, 600]), // 获取范围的中心坐标。
zoom: 2.5, zoom: 2.5,
maxZoom: 5, maxZoom: 5,
minZoom: 1.5, minZoom: 1.5,
extent: [-1100, -100, 2000, 1000] extent: [-1100, -100, 2000, 1000]
}) })
}) })
//点击事件 //点击事件
this.mapDialog.on('click', function (evt) { this.mapDialog.on('click', function(evt) {
let feature = evt.map.forEachFeatureAtPixel(evt.pixel, function (feature) { let feature = evt.map.forEachFeatureAtPixel(evt.pixel, function(
return feature feature
}) ) {
if (feature) { return feature
for (let i in that.list) {
if (feature.getId() === that.list[i].id) {
that.list[i].active = !that.list[i].active
let style = null
if (that.list[i].active) {
style = that.getPointStyle(that.list[i].imageSrc + '2.png', that.list[i].name, 0.3)
} else {
style = that.getPointStyle(that.list[i].imageSrc + '.png', that.list[i].name)
}
feature.setStyle(style)
}
}
}
}) })
if (feature) {
for (let i in that.list) {
if (feature.getId() === that.list[i].id) {
that.list[i].active = !that.list[i].active
let style = null
if (that.list[i].active) {
style = that.getPointStyle(
that.list[i].imageSrc + '2.png',
that.list[i].name,
0.3
)
} else {
style = that.getPointStyle(
that.list[i].imageSrc + '.png',
that.list[i].name
)
}
feature.setStyle(style)
}
}
}
})
}, },
init (bean) { init(bean) {
//console.log('bean:', bean) console.log('bean:', bean)
this.dataForm = {} this.dataForm = {}
this.visible = true this.visible = true
this.clickFlag = false this.clickFlag = false
...@@ -331,29 +356,26 @@ export default { ...@@ -331,29 +356,26 @@ export default {
//this.getCameraByResourceId() //this.getCameraByResourceId()
} }
} }
// else { // else {
// this.dataForm.id = id // this.dataForm.id = id
// if (this.dataForm.id) { // if (this.dataForm.id) {
// this.initResource(x, y, endx, endy) // this.initResource(x, y, endx, endy)
// } // }
// } // }
this.dataForm.operatorName = this.info.name this.dataForm.operatorName = this.info.name
this.initLineList()
this.initSubSystemDicList()
this.initResourceTypeDicList() this.initResourceTypeDicList()
this.initBrandDicList() this.initBrandDicList()
this.initStationMapList() this.initStationMapList()
this.initParentNode()
}, },
initResource (x, y, endx, endy) { initResource(x, y, endx, endy) {
this.$http({ this.$http({
url: this.$http.adornUrl(`/liResource/getId`), url: this.$http.adornUrl(`/liResource/getId`),
method: 'get', method: 'get',
params: { id: this.dataForm.id } params: { id: this.dataForm.id }
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.dataForm = data.bean this.dataForm = data.bean
this.checkCameraList = data.list.map(e => { this.checkCameraList = data.list.map((e) => {
return { id: e.cameraId, name: e.cameraName } return { id: e.cameraId, name: e.cameraName }
}) })
...@@ -368,177 +390,60 @@ export default { ...@@ -368,177 +390,60 @@ export default {
this.dataForm.cameraNames = cameraNames.join(',') this.dataForm.cameraNames = cameraNames.join(',')
} }
// this.dataForm.lineId = '0ff691b45da01acb6b5e4b6d8b90cfe5'
// this.dataForm.lineName = '成都地铁1号线'
// this.dataForm.stationId = '40bf04d6f2e2ec3bfbb43aa51a7facc8'
// this.dataForm.stationName = '升仙湖站'
// this.dataForm.tierId = 'b70eb21104124e559cb078f3a8c7174e'
// this.dataForm.tierName = '出入口'
this.dataForm.xpoint = x this.dataForm.xpoint = x
this.dataForm.ypoint = y this.dataForm.ypoint = y
this.initStationList(this.dataForm.lineId) this.initStationList(this.dataForm.lineId)
} }
}) })
}, },
initParentNode () { initStationMapList() {
this.$http({
url: this.$http.adornUrl('/liResource/getResourceList'),
method: 'post',
data: {
stationId: this.dataForm.stationId
}
}).then(data => {
if (data && data.code === 0) {
this.parentList = data.list
}
})
},
initLineList () {
this.$http({
url: this.$http.adornUrl('/liLine/listAll'),
method: 'post',
data: {}
}).then(data => {
if (data && data.code === 0) {
this.lineList = data.page.rows
if (this.dataForm.lineId) {
this.initStationList(this.dataForm.lineId)
}
}
})
},
initStationList (lineId) {
this.$http({
url: this.$http.adornUrl('/liStation/listAll'),
method: 'post',
data: {
lineId: lineId
}
}).then(data => {
if (data && data.code === 0) {
this.stationList = data.page.rows
}
})
},
initStationMapList () {
this.$http({ this.$http({
url: this.$http.adornUrl(`/liStation/getId/${this.dataForm.stationId}`), url: this.$http.adornUrl(`/liStation/getId/${this.dataForm.stationId}`),
method: 'get', method: 'get',
params: this.$http.adornParams() params: this.$http.adornParams()
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.tierList = data.bean.mapList this.tierList = data.bean.mapList
} }
}) })
}, },
initStMapList () { initStMapList() {
this.$http({ this.$http({
url: this.$http.adornUrl(`/liStationMap/getId/${this.dataForm.tierId}`), url: this.$http.adornUrl(`/liStationMap/getId/${this.dataForm.tierId}`),
method: 'get', method: 'get',
params: this.$http.adornParams() params: this.$http.adornParams()
}).then(data => {
if (data && data.code === 0) {
this.tier = data.bean
this.tier.readPath = this.urlPath + this.tier.filePath
this.initMap(this.tier)
//this.changeImageLayer(this.tier)
}
}).then(() => {
this.showResourceByMapId()
}) })
}, .then((data) => {
initSubSystemDicList () { if (data && data.code === 0) {
this.$http({ this.tier = data.bean
url: this.$http.adornUrl('/sysDictionary/getSubSystemDicList'), this.tier.readPath = this.urlPath + this.tier.filePath
method: 'get', this.initMap(this.tier)
params: this.$http.adornParams({ //this.changeImageLayer(this.tier)
stationId: localStorage.getItem('stationId') }
})
.then(() => {
this.showResourceByMapId()
}) })
}).then(data => {
if (data && data.code === 0) {
this.systemList = data.list
//disabled用于禁用选项,初始值都不禁用
this.systemList.forEach(dic => {
dic.disabled = false
})
// if (!this.dataForm.subCode) {
// this.dataForm.subCode = this.systemList[0].value
// this.dataForm.subSystem = this.systemList[0].name
// }
}
})
}, },
initResourceTypeDicList () { initResourceTypeDicList() {
this.$http({ this.$http({
url: this.$http.adornUrl('/sysDictionary/getResourceTypeDicList'), url: this.$http.adornUrl('/sysDictionary/getResourceTypeDicList'),
method: 'get', method: 'get',
params: this.$http.adornParams({ params: this.$http.adornParams({
stationId: localStorage.getItem('stationId') stationId: localStorage.getItem('stationId')
}) })
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.typeList = data.list this.typeList = data.list
this.typeList.forEach(e => { this.typeList.forEach((e) => {
if (e.id === this.dataForm.type) { if (e.id === this.dataForm.type) {
this.dataForm.dicTypeName = e.name this.dataForm.dicTypeName = e.name
} }
}) })
} }
}).then(() => {
// 视频监控:枪机和球机
// 出入口控制:门禁
// 入侵报警:照明灯、入侵报警灯、双鉴探测器、振动光纤
// 安全检查:枪机、球机、安检机、安检门、液体探测器、炸探、一键报警
//根据资源点类型禁用子系统选项
this.systemList.forEach(dic => {
if (['枪机', '球机'].indexOf(this.dataForm.dicTypeName) > -1) {
if (dic.value === '01' || dic.value === '04') {
dic.disabled = false
} else {
dic.disabled = true
}
} else if (this.dataForm.dicTypeName === '门禁') {
if (dic.value === '02') {
dic.disabled = false
} else {
dic.disabled = true
}
} else if (['照明灯', '入侵报警灯', '双鉴探测器', '振动光纤'].indexOf(this.dataForm.dicTypeName) > -1) {
if (dic.value === '03') {
dic.disabled = false
} else {
dic.disabled = true
}
} else if (['安检机', '安检门', '液体探测器', '炸探', '一键报警'].indexOf(this.dataForm.dicTypeName) > -1) {
if (dic.value === '04') {
dic.disabled = false
} else {
dic.disabled = true
}
}
})
//给资源点设置初始的子系统编码
if (!this.dataForm.subCode) {
if (['枪机', '球机'].indexOf(this.dataForm.dicTypeName) > -1) {
this.dataForm.subCode = '01'
this.dataForm.subSystem = '视频监控'
} else if (this.dataForm.dicTypeName === '门禁') {
this.dataForm.subCode = '02'
this.dataForm.subSystem = '出入口控制'
} else if (['照明灯', '入侵报警灯', '双鉴探测器', '振动光纤'].indexOf(this.dataForm.dicTypeName) > -1) {
this.dataForm.subCode = '03'
this.dataForm.subSystem = '入侵报警'
} else if (['安检机', '安检门', '液体探测器', '炸探', '一键报警'].indexOf(this.dataForm.dicTypeName) > -1) {
this.dataForm.subCode = '04'
this.dataForm.subSystem = '安全检查'
} else {
this.dataForm.subCode = '01'
this.dataForm.subSystem = '视频监控'
}
}
}) })
}, },
initBrandDicList () { initBrandDicList() {
this.brandList = [] this.brandList = []
this.$http({ this.$http({
url: this.$http.adornUrl('/sysDictionary/getBrandDicList'), url: this.$http.adornUrl('/sysDictionary/getBrandDicList'),
...@@ -546,79 +451,14 @@ export default { ...@@ -546,79 +451,14 @@ export default {
params: this.$http.adornParams({ params: this.$http.adornParams({
stationId: localStorage.getItem('stationId') stationId: localStorage.getItem('stationId')
}) })
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.brandList = data.list this.brandList = data.list
// if (data.list !== null && data.list.length > 0) {
// //console.log(this.dataForm.type, '**********')
// data.list.forEach((res, index) => {
// if ((res.id === '6f43d870c0dd4327a38549d947b5cb6f' ||
// res.id === '66eb8a17b56f4ca5a8d422591b42cd36') &&
// (this.dataForm.type === 'b6af764f2a6e454490a6b1b3c9057e57' ||
// this.dataForm.type === 'ece0b8b2db27411886254e81134988a3')) { //大华、海康威视 球机、枪机
// this.brandList.push(res)
// } else if (res.id === '47b0724186c848f481fe0b12681308e8' &&
// (this.dataForm.type === 'f4c840711eae4bcb9536a890cdfda493' ||
// this.dataForm.type === '303310efddb34a2e9bf269bdff8a7dc5')) { //同方威视 炸探、安检机
// this.brandList.push(res)
// } else if (res.id === '518be72e65d1441e8dab676cd2e2db89' &&
// this.dataForm.type === 'b47661ca1d454f9792ba5369f3cb2bc5') { //中泰通 液探
// this.brandList.push(res)
// } else if (res.id === 'b9dbc73e04b94e9294f65b5c2109ff22' &&
// this.dataForm.type === '683393c31cf0497bb0f62d457cb1e81f') { //安天下 安检门
// this.brandList.push(res)
// } else if (res.id === 'ae588516d2094d5d828f39a44d9b2973' &&
// this.dataForm.type === 'b45827c068254695864ee3c1d42573cb') { //爱克信 门禁系统
// this.brandList.push(res)
// } else if (res.id === '52b93b5b105b48bd8679cef6babfb6ba' &&
// this.dataForm.type === 'b45827c068254695864ee3c1d42573cb') { //臻通 入侵检测系统
// this.brandList.push(res)
// } else if (res.id === 'df5999e2d8784e41111110619b0e3bf' &&
// this.dataForm.type === '0a18ad66953647d792e4a28a40050e92') { //安朗杰 门禁 出入口控制
// this.brandList.push(res)
// } else if (res.id === 'bdc14bb5e54f4c7d98d928c6622004e2' &&
// this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' &&
// this.dataForm.type !== 'ece0b8b2db27411886254e81134988a3' &&
// this.dataForm.type !== 'f4c840711eae4bcb9536a890cdfda493' &&
// this.dataForm.type !== '303310efddb34a2e9bf269bdff8a7dc5' &&
// this.dataForm.type !== '683393c31cf0497bb0f62d457cb1e81f' &&
// this.dataForm.type !== 'b45827c068254695864ee3c1d42573cb' &&
// this.dataForm.type !== 'b45827c068254695864ee3c1d42573cb') {
// this.brandList.push(res)//国产
// }
// })
// // console.log(this.brandList, '==========')
// }
} }
}) })
}, },
lineChange (lineId) { tierChange(e) {
this.initStationList(lineId) this.tierList.forEach((a) => {
this.stationList.forEach(a => {
if (a.id === lineId) {
this.dataForm.lineName = a.name
}
})
},
stationChange (stationId) {
this.stationList.forEach(a => {
if (a.id === stationId) {
this.dataForm.stationName = a.stationName
}
})
},
subSystemChange (e) {
this.systemList.forEach(a => {
if (a.value === e) {
// Vue.set(this.dataForm, 'subCode', a.value)
// Vue.set(this.dataForm, 'subSystem', a.name)
this.dataForm.subCode = a.value
this.dataForm.subSystem = a.name
}
})
},
tierChange (e) {
this.tierList.forEach(a => {
if (a.name === e) { if (a.name === e) {
this.dataForm.tierId = a.id this.dataForm.tierId = a.id
this.dataForm.tierName = a.name this.dataForm.tierName = a.name
...@@ -627,17 +467,17 @@ export default { ...@@ -627,17 +467,17 @@ export default {
}) })
}, },
// 图标选中 // 图标选中
iconChange (icon) { iconChange(icon) {
// this.icon = icon // this.icon = icon
// this.dataForm.icon = icon.path // this.dataForm.icon = icon.path
}, },
checktable () { checktable() {
this.addVisible = true this.addVisible = true
this.cFlag = false this.cFlag = false
this.initStMapList() this.initStMapList()
this.oldCheckCameraList = JSON.parse(JSON.stringify(this.checkCameraList)) this.oldCheckCameraList = JSON.parse(JSON.stringify(this.checkCameraList))
}, },
submitCamera () { submitCamera() {
this.addVisible = false this.addVisible = false
this.cFlag = true this.cFlag = true
this.dataForm.cameraIds = null this.dataForm.cameraIds = null
...@@ -645,21 +485,21 @@ export default { ...@@ -645,21 +485,21 @@ export default {
let cameraIds = [] let cameraIds = []
let cameraNames = [] let cameraNames = []
for (let i in this.list) { for (let i in this.list) {
if (this.list[i].active) { if (this.list[i].active) {
cameraIds.push(this.list[i].id) cameraIds.push(this.list[i].id)
cameraNames.push(this.list[i].name) cameraNames.push(this.list[i].name)
} }
} }
//关联摄像头只要点击确定按钮,就当作发生改变的数据 //关联摄像头只要点击确定按钮,就当作发生改变的数据
this.dataForm.cameraChange = 'true' this.dataForm.cameraChange = 'true'
this.dataForm.cameraIds = cameraIds.join(',') this.dataForm.cameraIds = cameraIds.join(',')
this.dataForm.cameraNames = cameraNames.join(',') this.dataForm.cameraNames = cameraNames.join(',')
}, },
dialogClose () { dialogClose() {
this.addVisible = false this.addVisible = false
this.checkCameraList = JSON.parse(JSON.stringify(this.oldCheckCameraList)) this.checkCameraList = JSON.parse(JSON.stringify(this.oldCheckCameraList))
}, },
closeC () { closeC() {
this.$confirm('确认取消?', '选择摄像头', { this.$confirm('确认取消?', '选择摄像头', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
...@@ -667,7 +507,9 @@ export default { ...@@ -667,7 +507,9 @@ export default {
}) })
.then(() => { .then(() => {
this.addVisible = false this.addVisible = false
this.checkCameraList = JSON.parse(JSON.stringify(this.oldCheckCameraList)) this.checkCameraList = JSON.parse(
JSON.stringify(this.oldCheckCameraList)
)
}) })
.catch(() => { .catch(() => {
this.$message({ this.$message({
...@@ -676,19 +518,21 @@ export default { ...@@ -676,19 +518,21 @@ export default {
}) })
}) })
}, },
checkC (res) { checkC(res) {
if (this.dataForm.id === res.id) { if (this.dataForm.id === res.id) {
return return
} }
var a = 0 var a = 0
for (var i = 0; i < this.checkCameraList.length; i++) { //如果原来有,则移除出去,并还原颜色 for (var i = 0; i < this.checkCameraList.length; i++) {
//如果原来有,则移除出去,并还原颜色
if (this.checkCameraList[i].id === res.id) { if (this.checkCameraList[i].id === res.id) {
a = 1 a = 1
this.checkCameraList.splice(i, 1) this.checkCameraList.splice(i, 1)
break break
} }
} }
if (a === 0) { //如果原来没有,则添加进去,并改变颜色 if (a === 0) {
//如果原来没有,则添加进去,并改变颜色
res.active = true res.active = true
var r = { id: res.id, name: res.name } var r = { id: res.id, name: res.name }
this.checkCameraList.push(r) this.checkCameraList.push(r)
...@@ -697,7 +541,7 @@ export default { ...@@ -697,7 +541,7 @@ export default {
} }
}, },
//根据层级id查询所有的摄像头 //根据层级id查询所有的摄像头
showResourceByMapId () { showResourceByMapId() {
this.$http({ this.$http({
url: this.$http.adornUrl('/liResource/getStationMapCameraList'), url: this.$http.adornUrl('/liResource/getStationMapCameraList'),
method: 'post', method: 'post',
...@@ -707,25 +551,27 @@ export default { ...@@ -707,25 +551,27 @@ export default {
tierId: this.dataForm.tierId, tierId: this.dataForm.tierId,
myId: this.dataForm.id myId: this.dataForm.id
} }
}).then(data => { })
if (data && data.code === 0) { .then((data) => {
this.list = data.resourceList if (data && data.code === 0) {
} this.list = data.resourceList
}).then(() => { }
})
.then(() => {
let arr = [] let arr = []
if (this.dataForm.cameraIds) arr = this.dataForm.cameraIds.split(',') if (this.dataForm.cameraIds) arr = this.dataForm.cameraIds.split(',')
for (let i in this.list) { for (let i in this.list) {
this.list[i].active = false this.list[i].active = false
for (let j in arr) { for (let j in arr) {
if (arr[j] === this.list[i].id) { if (arr[j] === this.list[i].id) {
this.list[i].active = true this.list[i].active = true
}
} }
}
} }
this.changeVectorLayer(this.list) this.changeVectorLayer(this.list)
}) })
}, },
getCameraByResourceId () { getCameraByResourceId() {
if (this.dataForm.id) { if (this.dataForm.id) {
this.$http({ this.$http({
url: this.$http.adornUrl('/liResourceCamera/getByResourceId'), url: this.$http.adornUrl('/liResourceCamera/getByResourceId'),
...@@ -734,12 +580,15 @@ export default { ...@@ -734,12 +580,15 @@ export default {
resourceId: this.dataForm.id, resourceId: this.dataForm.id,
stationId: this.dataForm.stationId stationId: this.dataForm.stationId
} }
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.checkCameraList = data.list.map(e => { this.checkCameraList = data.list.map((e) => {
return { id: e.cameraId, name: e.cameraName } return { id: e.cameraId, name: e.cameraName }
}) })
if (this.checkCameraList != null && this.checkCameraList.length > 0) { if (
this.checkCameraList != null &&
this.checkCameraList.length > 0
) {
let cameraIds = [] let cameraIds = []
let cameraNames = [] let cameraNames = []
for (let i = 0; i < this.checkCameraList.length; i++) { for (let i = 0; i < this.checkCameraList.length; i++) {
...@@ -754,117 +603,141 @@ export default { ...@@ -754,117 +603,141 @@ export default {
} }
}, },
addTips(tips, base, resource) { addTips(tips, base, resource) {
switch (base.type) { switch (base.type) {
//枪机 球机 安检机 //枪机 球机 安检机
case 'b6af764f2a6e454490a6b1b3c9057e57': case 'b6af764f2a6e454490a6b1b3c9057e57':
case 'ece0b8b2db27411886254e81134988a3': case 'ece0b8b2db27411886254e81134988a3':
case '303310efddb34a2e9bf269bdff8a7dc5': case '303310efddb34a2e9bf269bdff8a7dc5':
if (!base.addressCode || !base.port || !base.byx1 || base.deleted === 1) { if (
break !base.addressCode ||
} !base.port ||
if (base.addressCode === resource.addressCode && base.port === resource.port && base.byx1 === resource.byx1) { !base.byx1 ||
//添加到重复提示 base.deleted === 1
let tip = '地址码:' + base.addressCode + ' 端口:' + base.port + ' 通道号:' + base.byx1 ) {
if (tips && !tips.includes(tip)) { break
tips.push(tip) }
} if (
} base.addressCode === resource.addressCode &&
break base.port === resource.port &&
default: base.byx1 === resource.byx1
if (!base.addressCode || !base.port || base.deleted === 1) { ) {
break //添加到重复提示
} let tip =
if (base.addressCode === resource.addressCode && base.port === resource.port) { '地址码:' +
//添加到重复提示 base.addressCode +
let tip = '地址码:' + base.addressCode + ' 端口:' + base.port ' 端口:' +
if (tips && !tips.includes(tip)) { base.port +
tips.push(tip) ' 通道号:' +
} base.byx1
} if (tips && !tips.includes(tip)) {
} tips.push(tip)
}
}
break
default:
if (!base.addressCode || !base.port || base.deleted === 1) {
break
}
if (
base.addressCode === resource.addressCode &&
base.port === resource.port
) {
//添加到重复提示
let tip = '地址码:' + base.addressCode + ' 端口:' + base.port
if (tips && !tips.includes(tip)) {
tips.push(tip)
}
}
}
}, },
// 表单提交 // 表单提交
dataFormSubmit (id) { dataFormSubmit(id) {
// if (this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' && this.dataForm.type !== 'ece0b8b2db27411886254e81134988a3') { // if (this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' && this.dataForm.type !== 'ece0b8b2db27411886254e81134988a3') {
// if (this.dataForm.cameraIds === null || this.dataForm.cameraIds === undefined || this.dataForm.cameraIds === '') { // if (this.dataForm.cameraIds === null || this.dataForm.cameraIds === undefined || this.dataForm.cameraIds === '') {
// this.$message.error('关联摄像头不能为空') // this.$message.error('关联摄像头不能为空')
// return // return
// } // }
// } // }
if (this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' || this.dataForm.subCode !== '04') { if (
this.dataForm.parentName = null this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' ||
} this.dataForm.subCode !== '04'
this.$refs['dataForm'].validate(valid => { ) {
if (valid) { this.dataForm.parentName = null
//校验数据重复 }
//后台返回的本地是否重复 this.$refs['dataForm'].validate((valid) => {
let list = this.pList if (valid) {
let size = list.length //校验数据重复
let tips = [] //后台返回的本地是否重复
if (this.dataForm.parentName) { let list = this.pList
let n = 0 let size = list.length
for (let h = 0; h < size; h++) { let tips = []
if (list[h].id === this.dataForm.id) { if (this.dataForm.parentName) {
continue let n = 0
} for (let h = 0; h < size; h++) {
if (list[h].parentName && list[h].parentName === this.dataForm.parentName) { if (list[h].id === this.dataForm.id) {
n++ continue
} }
} if (
list[h].parentName &&
list[h].parentName === this.dataForm.parentName
) {
n++
}
}
if (n >= 2) { if (n >= 2) {
this.$message({ this.$message({
message: '已有两个子级摄像头选择该父节点,请重新选择!', message: '已有两个子级摄像头选择该父节点,请重新选择!',
type: 'warning' type: 'warning'
}) })
return return
} }
} }
//添加或修改的数据跟本地比较是否重复 //添加或修改的数据跟本地比较是否重复
for (let h = 0; h < size; h++) { for (let h = 0; h < size; h++) {
const resource = list[h] const resource = list[h]
if (resource.id === this.dataForm.id) { if (resource.id === this.dataForm.id) {
continue continue
} }
this.addTips(tips, resource, this.dataForm) this.addTips(tips, resource, this.dataForm)
} }
//添加或修改的数据跟数据库是否重复 //添加或修改的数据跟数据库是否重复
this.$http({ this.$http({
url: this.$http.adornUrl('/liResource/list'), url: this.$http.adornUrl('/liResource/list'),
method: 'post', method: 'post',
data: { data: {
stationId: localStorage.getItem('stationId') stationId: localStorage.getItem('stationId')
} }
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
let list = data.page.rows let list = data.page.rows
for (let index = 0; index < list.length; index++) { for (let index = 0; index < list.length; index++) {
const resource = list[index] const resource = list[index]
if (resource.id === this.dataForm.id) { if (resource.id === this.dataForm.id) {
continue continue
}
this.addTips(tips, resource, this.dataForm)
}
}
})
// console.log('tips', tips)
if (tips.length > 0) {
let message = ''
tips.map(item => {
message += (item + '<br>')
})
// console.log(message)
this.$emit('addNotify', message)
return
} }
setTimeout(() => { this.addTips(tips, resource, this.dataForm)
this.$emit('refreshBean', this.dataForm) }
this.$emit('refreshdatalist', this.dataForm)
}, 100)
this.visible = false
} }
}) })
// console.log('tips', tips)
if (tips.length > 0) {
let message = ''
tips.map((item) => {
message += item + '<br>'
})
// console.log(message)
this.$emit('addNotify', message)
return
}
setTimeout(() => {
this.$emit('refreshBean', this.dataForm)
this.$emit('refreshdatalist', this.dataForm)
}, 100)
this.visible = false
}
})
// this.$refs['dataForm'].validate(valid => { // this.$refs['dataForm'].validate(valid => {
// if (valid) { // if (valid) {
// this.clickFlag = true // this.clickFlag = true
...@@ -896,7 +769,7 @@ export default { ...@@ -896,7 +769,7 @@ export default {
// }) // })
}, },
//关闭前 //关闭前
handleClose () { handleClose() {
this.visible = false this.visible = false
//this.$emit('refreshBean', this.dataForm) //this.$emit('refreshBean', this.dataForm)
this.$refs.dataForm.resetFields() this.$refs.dataForm.resetFields()
...@@ -919,78 +792,85 @@ export default { ...@@ -919,78 +792,85 @@ export default {
}) })
}, },
changeImageLayer(bean) { changeImageLayer(bean) {
if (bean === null) return if (bean === null) return
if (this.mapDialog) { if (this.mapDialog) {
this.mapDialog.removeLayer(this.imgLayer) this.mapDialog.removeLayer(this.imgLayer)
} else { } else {
return return
} }
this.imgLayer = new ImageLayer({ this.imgLayer = new ImageLayer({
id: bean.id, id: bean.id,
source: new ImageStatic({ source: new ImageStatic({
url: bean.readPath, //这里添加静态图片的地址 url: bean.readPath, //这里添加静态图片的地址
projection: this.projection, projection: this.projection,
imageExtent: this.extent imageExtent: this.extent
}), }),
visible: true visible: true
}) })
this.mapDialog.addLayer(this.imgLayer) this.mapDialog.addLayer(this.imgLayer)
}, },
changeVectorLayer(list) { changeVectorLayer(list) {
if (!list) return if (!list) return
if (this.mapDialog) { if (this.mapDialog) {
this.mapDialog.removeLayer(this.vectorLayer) this.mapDialog.removeLayer(this.vectorLayer)
} else { } else {
return return
} }
let featuresArr = [] let featuresArr = []
for (let i in list) { for (let i in list) {
if (list[i].imageSrc) { if (list[i].imageSrc) {
featuresArr.push(this.getFeature(list[i].xlongit, list[i].ylat)) featuresArr.push(this.getFeature(list[i].xlongit, list[i].ylat))
let style = null let style = null
if (list[i].active) { if (list[i].active) {
style = this.getPointStyle(list[i].imageSrc + '2.png', this.list[i].name, 0.3) style = this.getPointStyle(
} else { list[i].imageSrc + '2.png',
style = this.getPointStyle(list[i].imageSrc + '.png', this.list[i].name) this.list[i].name,
} 0.3
featuresArr[i].setStyle(style) )
featuresArr[i].setId(list[i].id) } else {
} style = this.getPointStyle(
list[i].imageSrc + '.png',
this.list[i].name
)
} }
this.vectorLayer = new OlLayerVector({ featuresArr[i].setStyle(style)
source: new OlSourceVector({ featuresArr[i].setId(list[i].id)
features: featuresArr }
})
})
this.mapDialog.addLayer(this.vectorLayer)
},
getFeature(x, y) {
return new OlFeature({
type: 'icon',
geometry: new OlGeomPoint([x, y])
})
},
getPointStyle(src, name, zoom) {
let style = new OlStyleStyle({
image: new OlStyleIcon({
anchor: [0.5, 0.5],
scale: zoom || 0.4,
//rotation:0 旋转度
src: require('@/assets/images/' + src)
}),
text: new Text({
text: name, // 添加文字描述
font: '14px font-size', // 设置字体大小
fill: new Fill({
// 设置字体颜色
color: 'black'
}),
offsetY: 30 // 设置文字偏移量
})
})
return style
} }
this.vectorLayer = new OlLayerVector({
source: new OlSourceVector({
features: featuresArr
})
})
this.mapDialog.addLayer(this.vectorLayer)
},
getFeature(x, y) {
return new OlFeature({
type: 'icon',
geometry: new OlGeomPoint([x, y])
})
},
getPointStyle(src, name, zoom) {
let style = new OlStyleStyle({
image: new OlStyleIcon({
anchor: [0.5, 0.5],
scale: zoom || 0.4,
//rotation:0 旋转度
src: require('@/assets/images/' + src)
}),
text: new Text({
text: name, // 添加文字描述
font: '14px font-size', // 设置字体大小
fill: new Fill({
// 设置字体颜色
color: 'black'
}),
offsetY: 30 // 设置文字偏移量
})
})
return style
}
} }
} }
</script> </script>
...@@ -1189,8 +1069,8 @@ export default { ...@@ -1189,8 +1069,8 @@ export default {
} }
} }
.map-dialog { .map-dialog {
/deep/ .el-dialog__body { /deep/ .el-dialog__body {
padding: 0; padding: 0;
} }
} }
</style> </style>
...@@ -11,16 +11,10 @@ ...@@ -11,16 +11,10 @@
el-input(v-model='dataForm.name' readonly) el-input(v-model='dataForm.name' readonly)
el-form-item(label='资源点类型:' prop='type' ) el-form-item(label='资源点类型:' prop='type' )
el-input(v-model='dataForm.resourceName' readonly) el-input(v-model='dataForm.resourceName' readonly)
el-form-item(label='线路:' prop='lineId' ) el-form-item(label='楼栋:' prop='stationName' )
el-input(v-model='dataForm.lineName' readonly)
el-form-item(label='站点:' prop='stationId' )
el-input(v-model='dataForm.stationName' readonly) el-input(v-model='dataForm.stationName' readonly)
el-form-item(label='子系统:' prop='subSystem' )
el-input(v-model='dataForm.subSystem' readonly)
el-form-item(label='资源点编码:' prop='code') el-form-item(label='资源点编码:' prop='code')
el-input(v-model='dataForm.code' readonly) el-input(v-model='dataForm.code' readonly)
el-form-item(label='子系统编码:' prop='subCode')
el-input(v-model='dataForm.subCode' readonly)
el-form-item(label='地址码:' prop='addressCode') el-form-item(label='地址码:' prop='addressCode')
el-input(v-model='dataForm.addressCode' readonly) el-input(v-model='dataForm.addressCode' readonly)
el-form-item(label='端口号:' prop='port') el-form-item(label='端口号:' prop='port')
...@@ -38,8 +32,6 @@ ...@@ -38,8 +32,6 @@
el-input(v-model='dataForm.cameraNames' readonly) el-input(v-model='dataForm.cameraNames' readonly)
el-form-item(label='通道:' prop='byx1' v-if="dataForm.dicTypeName === '枪机' || dataForm.dicTypeName === '球机' || dataForm.dicTypeName === '安检机'") el-form-item(label='通道:' prop='byx1' v-if="dataForm.dicTypeName === '枪机' || dataForm.dicTypeName === '球机' || dataForm.dicTypeName === '安检机'")
el-input(v-model='dataForm.byx1' readonly) el-input(v-model='dataForm.byx1' readonly)
el-form-item(label='输送带端口号:' prop='ajjPort' v-if="dataForm.dicTypeName === '安检机'")
el-input(v-model='dataForm.ajjPort' placeholder='请填写输送带端口号')
el-col(:span="11" style="margin-left: 30px;") el-col(:span="11" style="margin-left: 30px;")
el-row( class='info-block') el-row( class='info-block')
...@@ -118,7 +110,7 @@ export default { ...@@ -118,7 +110,7 @@ export default {
computed: { computed: {
...mapState('d2admin/user', ['info']) ...mapState('d2admin/user', ['info'])
}, },
data () { data() {
return { return {
mapDialog: null, mapDialog: null,
vectorLayer: null, vectorLayer: null,
...@@ -147,18 +139,13 @@ export default { ...@@ -147,18 +139,13 @@ export default {
id: 0, id: 0,
name: '', name: '',
type: 1, type: 1,
lineId: '',
lineName: '',
stationId: localStorage.getItem('stationId'), stationId: localStorage.getItem('stationId'),
stationName: '', stationName: '',
tierId: '', tierId: '',
cameraNames: '', cameraNames: '',
subSystem: '',
code: '', code: '',
subCode: '',
addressCode: '', addressCode: '',
port: '', port: '',
ajjPort: '',
username: '', username: '',
password: '', password: '',
remark: '', remark: '',
...@@ -196,309 +183,252 @@ export default { ...@@ -196,309 +183,252 @@ export default {
} }
} }
}, },
created () { created() {
that = this that = this
}, },
methods: { methods: {
initMap (bean) { initMap(bean) {
if (this.mapDialog) { if (this.mapDialog) {
this.mapDialog.removeLayer(this.imgLayer) this.mapDialog.removeLayer(this.imgLayer)
this.mapDialog.removeLayer(this.vectorLayer) this.mapDialog.removeLayer(this.vectorLayer)
} }
let zoomControl = new Zoom({ let zoomControl = new Zoom({
delta: 0.2, delta: 0.2,
zoomInTipLabel: '', zoomInTipLabel: '',
zoomOutTipLabel: '' zoomOutTipLabel: ''
}) })
this.projection = new Projection({ this.projection = new Projection({
// 投影 // 投影
code: 'xkcd-image', code: 'xkcd-image',
units: 'pixels', units: 'pixels',
extent: this.extent extent: this.extent
}) })
this.imgLayer = new ImageLayer({ this.imgLayer = new ImageLayer({
id: bean.id, id: bean.id,
source: new ImageStatic({ source: new ImageStatic({
url: bean.readPath, //这里添加静态图片的地址 url: bean.readPath, //这里添加静态图片的地址
projection: this.projection, projection: this.projection,
imageExtent: this.extent imageExtent: this.extent
}), }),
visible: true visible: true
}) })
this.mapDialog = new Map({ this.mapDialog = new Map({
target: 'mapDialog', target: 'mapDialog',
layers: [this.imgLayer], layers: [this.imgLayer],
controls: [zoomControl], controls: [zoomControl],
view: new View({ view: new View({
projection: this.projection, projection: this.projection,
center: getCenter([0, 0, 418, 600]), // 获取范围的中心坐标。 center: getCenter([0, 0, 418, 600]), // 获取范围的中心坐标。
zoom: 2.5, zoom: 2.5,
maxZoom: 5, maxZoom: 5,
minZoom: 1.5, minZoom: 1.5,
extent: [-1100, -100, 2000, 1000] extent: [-1100, -100, 2000, 1000]
}) })
}) })
}, },
changeImageLayer(bean) { changeImageLayer(bean) {
if (bean === null) return if (bean === null) return
if (this.mapDialog) { if (this.mapDialog) {
this.mapDialog.removeLayer(this.imgLayer) this.mapDialog.removeLayer(this.imgLayer)
} else { } else {
return return
}
this.imgLayer = new ImageLayer({
id: bean.id,
source: new ImageStatic({
url: bean.readPath, //这里添加静态图片的地址
projection: this.projection,
imageExtent: this.extent
}),
visible: true
})
this.mapDialog.addLayer(this.imgLayer)
},
changeVectorLayer(list) {
if (list) {
this.list = list
} else {
return
}
if (this.mapDialog) {
this.mapDialog.removeLayer(this.vectorLayer)
} else {
return
}
let featuresArr = []
for (let i in list) {
if (list[i].imageSrc) {
featuresArr.push(this.getFeature(list[i].xlongit, list[i].ylat))
let style = this.getPointStyle(
list[i].imageSrc + '.png',
this.list[i].name
)
featuresArr[i].setStyle(style)
featuresArr[i].setId(list[i].id)
} }
this.imgLayer = new ImageLayer({ }
id: bean.id, this.vectorLayer = new OlLayerVector({
source: new ImageStatic({ source: new OlSourceVector({
url: bean.readPath, //这里添加静态图片的地址 features: featuresArr
projection: this.projection, })
imageExtent: this.extent })
this.mapDialog.addLayer(this.vectorLayer)
},
getFeature(x, y) {
return new OlFeature({
type: 'icon',
geometry: new OlGeomPoint([x, y])
})
},
getPointStyle(src, name, zoom) {
let style = new OlStyleStyle({
image: new OlStyleIcon({
anchor: [0.5, 0.5],
scale: zoom || 0.4,
//rotation:0 旋转度
src: require('@/assets/images/' + src)
}),
text: new Text({
text: name, // 添加文字描述
font: '14px font-size', // 设置字体大小
fill: new Fill({
// 设置字体颜色
color: 'black'
}), }),
visible: true offsetY: 30 // 设置文字偏移量
}) })
this.mapDialog.addLayer(this.imgLayer) })
return style
}, },
changeVectorLayer(list) { init(id) {
if (list) {
this.list = list
} else {
return
}
if (this.mapDialog) {
this.mapDialog.removeLayer(this.vectorLayer)
} else {
return
}
let featuresArr = []
for (let i in list) {
if (list[i].imageSrc) {
featuresArr.push(this.getFeature(list[i].xlongit, list[i].ylat))
let style = this.getPointStyle(list[i].imageSrc + '.png', this.list[i].name)
featuresArr[i].setStyle(style)
featuresArr[i].setId(list[i].id)
}
}
this.vectorLayer = new OlLayerVector({
source: new OlSourceVector({
features: featuresArr
})
})
this.mapDialog.addLayer(this.vectorLayer)
},
getFeature(x, y) {
return new OlFeature({
type: 'icon',
geometry: new OlGeomPoint([x, y])
})
},
getPointStyle(src, name, zoom) {
let style = new OlStyleStyle({
image: new OlStyleIcon({
anchor: [0.5, 0.5],
scale: zoom || 0.4,
//rotation:0 旋转度
src: require('@/assets/images/' + src)
}),
text: new Text({
text: name, // 添加文字描述
font: '14px font-size', // 设置字体大小
fill: new Fill({
// 设置字体颜色
color: 'black'
}),
offsetY: 30 // 设置文字偏移量
})
})
return style
},
init (id) {
this.visible = true this.visible = true
this.initResource(id) this.initResource(id)
this.dataForm.operatorName = this.info.name this.dataForm.operatorName = this.info.name
}, },
initResource (id) { initResource(id) {
this.$http({ this.$http({
url: this.$http.adornUrl(`/liResource/getId/`), url: this.$http.adornUrl(`/liResource/getId/`),
method: 'get', method: 'get',
params: { id: id } params: { id: id }
}).then(data => { })
if (data && data.code === 0) { .then((data) => {
// this.dataForm = data.bean if (data && data.code === 0) {
this.dataForm.addressCode = data.bean.addressCode // this.dataForm = data.bean
this.dataForm.attachedInfo = data.bean.attachedInfo this.dataForm.addressCode = data.bean.addressCode
this.dataForm.brand = data.bean.brand this.dataForm.attachedInfo = data.bean.attachedInfo
this.dataForm.brandName = data.bean.brandName this.dataForm.brand = data.bean.brand
this.dataForm.byx1 = data.bean.byx1 this.dataForm.brandName = data.bean.brandName
this.dataForm.byx2 = data.bean.byx2 this.dataForm.byx1 = data.bean.byx1
this.dataForm.byx3 = data.bean.byx3 this.dataForm.byx2 = data.bean.byx2
this.dataForm.cameraChange = data.bean.cameraChange this.dataForm.byx3 = data.bean.byx3
this.dataForm.cameraIds = data.bean.cameraIds this.dataForm.cameraChange = data.bean.cameraChange
this.dataForm.cameraNames = data.bean.cameraNames this.dataForm.cameraIds = data.bean.cameraIds
this.dataForm.code = data.bean.code this.dataForm.cameraNames = data.bean.cameraNames
this.dataForm.codeType = data.bean.codeType this.dataForm.code = data.bean.code
this.dataForm.createTime = data.bean.createTime this.dataForm.codeType = data.bean.codeType
this.dataForm.createUserId = data.bean.createUserId this.dataForm.createTime = data.bean.createTime
this.dataForm.deleted = data.bean.deleted this.dataForm.createUserId = data.bean.createUserId
this.dataForm.deployLocation = data.bean.deployLocation this.dataForm.deleted = data.bean.deleted
this.dataForm.dicTypeName = data.bean.dicTypeName this.dataForm.deployLocation = data.bean.deployLocation
this.dataForm.icon = data.bean.icon this.dataForm.dicTypeName = data.bean.dicTypeName
this.dataForm.iconPath = data.bean.iconPath this.dataForm.icon = data.bean.icon
this.dataForm.id = data.bean.id this.dataForm.iconPath = data.bean.iconPath
this.dataForm.imageSrc = data.bean.imageSrc this.dataForm.id = data.bean.id
this.dataForm.lineId = data.bean.lineId this.dataForm.imageSrc = data.bean.imageSrc
this.dataForm.lineName = data.bean.lineName this.dataForm.name = data.bean.name
this.dataForm.name = data.bean.name this.dataForm.operatorId = data.bean.operatorId
this.dataForm.operatorId = data.bean.operatorId this.dataForm.operatorName = data.bean.operatorName
this.dataForm.operatorName = data.bean.operatorName this.dataForm.pName = data.bean.pName
this.dataForm.pName = data.bean.pName this.dataForm.parentName = data.bean.parentName
this.dataForm.parentName = data.bean.parentName this.dataForm.password = data.bean.password
this.dataForm.password = data.bean.password this.dataForm.port = data.bean.port
this.dataForm.port = data.bean.port this.dataForm.remark = data.bean.remark
this.dataForm.ajjPort = data.bean.ajjPort this.dataForm.resourceName = data.bean.resourceName
this.dataForm.remark = data.bean.remark this.dataForm.rotate = data.bean.rotate
this.dataForm.resourceName = data.bean.resourceName this.dataForm.stationId = data.bean.stationId
this.dataForm.rotate = data.bean.rotate this.dataForm.stationName = data.bean.stationName
this.dataForm.stationId = data.bean.stationId this.dataForm.status = data.bean.status
this.dataForm.stationName = data.bean.stationName this.dataForm.statusName = data.bean.statusName
this.dataForm.status = data.bean.status this.dataForm.tierId = data.bean.tierId
this.dataForm.statusName = data.bean.statusName this.dataForm.tierName = data.bean.tierName
this.dataForm.subCode = data.bean.subCode this.dataForm.type = data.bean.type
this.dataForm.subSystem = data.bean.subSystem this.dataForm.updateTime = data.bean.updateTime
this.dataForm.sysSign = data.bean.sysSign this.dataForm.updateUserId = data.bean.updateUserId
this.dataForm.tierId = data.bean.tierId this.dataForm.username = data.bean.username
this.dataForm.tierName = data.bean.tierName this.dataForm.width = data.bean.width
this.dataForm.type = data.bean.type this.dataForm.xlongit = data.bean.xlongit
this.dataForm.updateTime = data.bean.updateTime this.dataForm.xpoint = data.bean.xpoint
this.dataForm.updateUserId = data.bean.updateUserId this.dataForm.ylat = data.bean.ylat
this.dataForm.username = data.bean.username this.dataForm.ypoint = data.bean.ypoint
this.dataForm.width = data.bean.width
this.dataForm.xlongit = data.bean.xlongit this.checkCameraList = data.list.map((e) => {
this.dataForm.xpoint = data.bean.xpoint return { id: e.cameraId, name: e.cameraName }
this.dataForm.ylat = data.bean.ylat })
this.dataForm.ypoint = data.bean.ypoint
this.checkCameraList = data.list.map(e => {
return { id: e.cameraId, name: e.cameraName }
})
if (this.checkCameraList != null && this.checkCameraList.length > 0) { if (
var cameraIds = [] this.checkCameraList != null &&
var cameraNames = [] this.checkCameraList.length > 0
for (var i = 0; i < this.checkCameraList.length; i++) { ) {
cameraIds.push(this.checkCameraList[i].id) var cameraIds = []
cameraNames.push(this.checkCameraList[i].name) var cameraNames = []
for (var i = 0; i < this.checkCameraList.length; i++) {
cameraIds.push(this.checkCameraList[i].id)
cameraNames.push(this.checkCameraList[i].name)
}
this.dataForm.cameraIds = cameraIds.join(',')
this.dataForm.cameraNames = cameraNames.join(',')
} }
this.dataForm.cameraIds = cameraIds.join(',')
this.dataForm.cameraNames = cameraNames.join(',')
} }
} })
}).then(() => { .then(() => {
this.initStationList(this.dataForm.lineId)
this.initLineList()
this.initSubSystemDicList()
this.initResourceTypeDicList() this.initResourceTypeDicList()
this.getCameraByResourceId() this.getCameraByResourceId()
this.initBrandDicList() this.initBrandDicList()
this.initStationMapList() this.initStationMapList()
this.initParentNode() })
})
},
initParentNode () {
this.$http({
url: this.$http.adornUrl('/liResource/getResourceList'),
method: 'post',
data: {
stationId: this.dataForm.stationId
}
}).then(data => {
if (data && data.code === 0) {
this.parentList = data.list
}
})
},
initLineList () {
this.$http({
url: this.$http.adornUrl('/liLine/listAll'),
method: 'post',
data: {}
}).then(data => {
if (data && data.code === 0) {
this.lineList = data.page.rows
if (this.dataForm.lineId) {
this.initStationList(this.dataForm.lineId)
}
}
})
},
initStationList (lineId) {
this.$http({
url: this.$http.adornUrl('/liStation/listAll'),
method: 'post',
data: {
lineId: lineId
}
}).then(data => {
if (data && data.code === 0) {
this.stationList = data.page.rows
}
})
}, },
initStationMapList () { initStationMapList() {
this.$http({ this.$http({
url: this.$http.adornUrl(`/liStation/getId/${this.dataForm.stationId}`), url: this.$http.adornUrl(`/liStation/getId/${this.dataForm.stationId}`),
method: 'get', method: 'get',
params: this.$http.adornParams() params: this.$http.adornParams()
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.tierList = data.bean.mapList this.tierList = data.bean.mapList
} }
}) })
}, },
initStMapList () { initStMapList() {
this.$http({ this.$http({
url: this.$http.adornUrl(`/liStationMap/getId/${this.dataForm.tierId}`), url: this.$http.adornUrl(`/liStationMap/getId/${this.dataForm.tierId}`),
method: 'get', method: 'get',
params: this.$http.adornParams() params: this.$http.adornParams()
}).then(data => {
if (data && data.code === 0) {
this.tier = data.bean
this.tier.readPath = this.urlPath + this.tier.filePath
this.initMap(this.tier)
}
}).then(() => {
this.showResourceByMapId()
}) })
}, .then((data) => {
initSubSystemDicList () { if (data && data.code === 0) {
this.$http({ this.tier = data.bean
url: this.$http.adornUrl('/sysDictionary/getSubSystemDicList'), this.tier.readPath = this.urlPath + this.tier.filePath
method: 'get', this.initMap(this.tier)
params: this.$http.adornParams({
stationId: localStorage.getItem('stationId')
})
}).then(data => {
if (data && data.code === 0) {
this.systemList = data.list
if (!this.dataForm.subCode) {
this.dataForm.subCode = this.systemList[0].value
this.dataForm.subSystem = this.systemList[0].name
} }
} })
}) .then(() => {
this.showResourceByMapId()
})
}, },
initResourceTypeDicList () { initResourceTypeDicList() {
this.$http({ this.$http({
url: this.$http.adornUrl('/sysDictionary/getResourceTypeDicList'), url: this.$http.adornUrl('/sysDictionary/getResourceTypeDicList'),
method: 'get', method: 'get',
params: this.$http.adornParams({ params: this.$http.adornParams({
stationId: localStorage.getItem('stationId') stationId: localStorage.getItem('stationId')
}) })
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.typeList = data.list this.typeList = data.list
this.typeList.forEach(e => { this.typeList.forEach((e) => {
if (e.id === this.dataForm.type) { if (e.id === this.dataForm.type) {
this.$nextTick(() => { this.$nextTick(() => {
this.dataForm.dicTypeName = e.name this.dataForm.dicTypeName = e.name
...@@ -508,7 +438,7 @@ export default { ...@@ -508,7 +438,7 @@ export default {
} }
}) })
}, },
initBrandDicList () { initBrandDicList() {
this.brandList = [] this.brandList = []
this.$http({ this.$http({
url: this.$http.adornUrl('/sysDictionary/getBrandDicList'), url: this.$http.adornUrl('/sysDictionary/getBrandDicList'),
...@@ -516,42 +446,62 @@ export default { ...@@ -516,42 +446,62 @@ export default {
params: this.$http.adornParams({ params: this.$http.adornParams({
stationId: localStorage.getItem('stationId') stationId: localStorage.getItem('stationId')
}) })
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
// this.brandList = data.list // this.brandList = data.list
if (data.list !== null && data.list.length > 0) { if (data.list !== null && data.list.length > 0) {
// console.log(this.dataForm.type, '**********') // console.log(this.dataForm.type, '**********')
data.list.forEach((res, index) => { data.list.forEach((res, index) => {
if ((res.id === '6f43d870c0dd4327a38549d947b5cb6f' || if (
res.id === '66eb8a17b56f4ca5a8d422591b42cd36') && (res.id === '6f43d870c0dd4327a38549d947b5cb6f' ||
res.id === '66eb8a17b56f4ca5a8d422591b42cd36') &&
(this.dataForm.type === 'b6af764f2a6e454490a6b1b3c9057e57' || (this.dataForm.type === 'b6af764f2a6e454490a6b1b3c9057e57' ||
this.dataForm.type === 'ece0b8b2db27411886254e81134988a3')) { //大华、海康威视 球机、枪机 this.dataForm.type === 'ece0b8b2db27411886254e81134988a3')
) {
//大华、海康威视 球机、枪机
this.brandList.push(res) this.brandList.push(res)
} else if (res.id === '47b0724186c848f481fe0b12681308e8' && } else if (
res.id === '47b0724186c848f481fe0b12681308e8' &&
(this.dataForm.type === 'f4c840711eae4bcb9536a890cdfda493' || (this.dataForm.type === 'f4c840711eae4bcb9536a890cdfda493' ||
this.dataForm.type === '303310efddb34a2e9bf269bdff8a7dc5')) { //同方威视 炸探、安检机 this.dataForm.type === '303310efddb34a2e9bf269bdff8a7dc5')
) {
//同方威视 炸探、安检机
this.brandList.push(res) this.brandList.push(res)
} else if (res.id === '518be72e65d1441e8dab676cd2e2db89' && } else if (
this.dataForm.type === 'b47661ca1d454f9792ba5369f3cb2bc5') { //中泰通 液探 res.id === '518be72e65d1441e8dab676cd2e2db89' &&
this.dataForm.type === 'b47661ca1d454f9792ba5369f3cb2bc5'
) {
//中泰通 液探
this.brandList.push(res) this.brandList.push(res)
} else if (res.id === 'b9dbc73e04b94e9294f65b5c2109ff22' && } else if (
this.dataForm.type === '683393c31cf0497bb0f62d457cb1e81f') { //安天下 安检门 res.id === 'b9dbc73e04b94e9294f65b5c2109ff22' &&
this.dataForm.type === '683393c31cf0497bb0f62d457cb1e81f'
) {
//安天下 安检门
this.brandList.push(res) this.brandList.push(res)
} else if (res.id === 'ae588516d2094d5d828f39a44d9b2973' && } else if (
this.dataForm.type === 'b45827c068254695864ee3c1d42573cb') { //爱克信 门禁系统 res.id === 'ae588516d2094d5d828f39a44d9b2973' &&
this.dataForm.type === 'b45827c068254695864ee3c1d42573cb'
) {
//爱克信 门禁系统
this.brandList.push(res) this.brandList.push(res)
} else if (res.id === '52b93b5b105b48bd8679cef6babfb6ba' && } else if (
this.dataForm.type === 'b45827c068254695864ee3c1d42573cb') { //臻通 入侵检测系统 res.id === '52b93b5b105b48bd8679cef6babfb6ba' &&
this.dataForm.type === 'b45827c068254695864ee3c1d42573cb'
) {
//臻通 入侵检测系统
this.brandList.push(res) this.brandList.push(res)
} else if (res.id === 'bdc14bb5e54f4c7d98d928c6622004e2' && } else if (
res.id === 'bdc14bb5e54f4c7d98d928c6622004e2' &&
this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' && this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' &&
this.dataForm.type !== 'ece0b8b2db27411886254e81134988a3' && this.dataForm.type !== 'ece0b8b2db27411886254e81134988a3' &&
this.dataForm.type !== 'f4c840711eae4bcb9536a890cdfda493' && this.dataForm.type !== 'f4c840711eae4bcb9536a890cdfda493' &&
this.dataForm.type !== '303310efddb34a2e9bf269bdff8a7dc5' && this.dataForm.type !== '303310efddb34a2e9bf269bdff8a7dc5' &&
this.dataForm.type !== '683393c31cf0497bb0f62d457cb1e81f' && this.dataForm.type !== '683393c31cf0497bb0f62d457cb1e81f' &&
this.dataForm.type !== 'b45827c068254695864ee3c1d42573cb' && this.dataForm.type !== 'b45827c068254695864ee3c1d42573cb' &&
this.dataForm.type !== 'b45827c068254695864ee3c1d42573cb') { this.dataForm.type !== 'b45827c068254695864ee3c1d42573cb'
this.brandList.push(res)//国产 ) {
this.brandList.push(res) //国产
} }
}) })
// console.log(this.brandList, '==========') // console.log(this.brandList, '==========')
...@@ -559,33 +509,8 @@ export default { ...@@ -559,33 +509,8 @@ export default {
} }
}) })
}, },
lineChange (lineId) { tierChange(e) {
this.initStationList(lineId) this.tierList.forEach((a) => {
this.stationList.forEach(a => {
if (a.id === lineId) {
this.dataForm.lineName = a.name
}
})
},
stationChange (stationId) {
this.stationList.forEach(a => {
if (a.id === stationId) {
this.dataForm.stationName = a.stationName
}
})
},
subSystemChange (e) {
this.systemList.forEach(a => {
if (a.value === e) {
// Vue.set(this.dataForm, 'subCode', a.value)
// Vue.set(this.dataForm, 'subSystem', a.name)
this.dataForm.subCode = a.value
this.dataForm.subSystem = a.name
}
})
},
tierChange (e) {
this.tierList.forEach(a => {
if (a.name === e) { if (a.name === e) {
this.dataForm.tierId = a.id this.dataForm.tierId = a.id
this.dataForm.tierName = a.name this.dataForm.tierName = a.name
...@@ -593,16 +518,16 @@ export default { ...@@ -593,16 +518,16 @@ export default {
}) })
}, },
// 图标选中 // 图标选中
iconChange (icon) { iconChange(icon) {
// this.icon = icon // this.icon = icon
// this.dataForm.icon = icon.path // this.dataForm.icon = icon.path
}, },
checktable () { checktable() {
this.addVisible = true this.addVisible = true
this.initStMapList() this.initStMapList()
this.oldCheckCameraList = JSON.parse(JSON.stringify(this.checkCameraList)) this.oldCheckCameraList = JSON.parse(JSON.stringify(this.checkCameraList))
}, },
checkCamera () { checkCamera() {
this.addVisible = false this.addVisible = false
this.dataForm.cameraIds = null this.dataForm.cameraIds = null
this.dataForm.cameraNames = null this.dataForm.cameraNames = null
...@@ -617,13 +542,13 @@ export default { ...@@ -617,13 +542,13 @@ export default {
this.dataForm.cameraNames = cameraNames.join(',') this.dataForm.cameraNames = cameraNames.join(',')
} }
}, },
dialogClose () { dialogClose() {
this.addVisible = false this.addVisible = false
this.checkCameraList = JSON.parse(JSON.stringify(this.oldCheckCameraList)) this.checkCameraList = JSON.parse(JSON.stringify(this.oldCheckCameraList))
}, },
closeC () { closeC() {
this.addVisible = false this.addVisible = false
this.checkCameraList = JSON.parse(JSON.stringify(this.oldCheckCameraList)) this.checkCameraList = JSON.parse(JSON.stringify(this.oldCheckCameraList))
}, },
// checkC (res) { // checkC (res) {
// if (this.dataForm.id === res.id) { // if (this.dataForm.id === res.id) {
...@@ -646,7 +571,7 @@ export default { ...@@ -646,7 +571,7 @@ export default {
// } // }
// }, // },
//根据层级id查询所有的摄像头 //根据层级id查询所有的摄像头
showResourceByMapId () { showResourceByMapId() {
this.$http({ this.$http({
url: this.$http.adornUrl('/liResource/getStationMapCameraList'), url: this.$http.adornUrl('/liResource/getStationMapCameraList'),
method: 'post', method: 'post',
...@@ -656,25 +581,32 @@ export default { ...@@ -656,25 +581,32 @@ export default {
tierId: this.dataForm.tierId, tierId: this.dataForm.tierId,
myId: this.dataForm.id myId: this.dataForm.id
} }
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.list = data.resourceList this.list = data.resourceList
this.changeVectorLayer(this.list) this.changeVectorLayer(this.list)
let oldCheckCameraList = this.oldCheckCameraList let oldCheckCameraList = this.oldCheckCameraList
if (oldCheckCameraList.length) { if (oldCheckCameraList.length) {
oldCheckCameraList.forEach((el) => { oldCheckCameraList.forEach((el) => {
this.list.forEach((k) => { this.list.forEach((k) => {
if (el.id == k.id) { if (el.id == k.id) {
let style2 = this.getPointStyle(k.imageSrc + '2.png', k.name, 0.3) let style2 = this.getPointStyle(
this.vectorLayer.getSource().getFeatureById(k.id).setStyle(style2) k.imageSrc + '2.png',
} k.name,
}) 0.3
}) )
} this.vectorLayer
.getSource()
.getFeatureById(k.id)
.setStyle(style2)
}
})
})
}
} }
}) })
}, },
getCameraByResourceId () { getCameraByResourceId() {
if (this.dataForm.id) { if (this.dataForm.id) {
this.$http({ this.$http({
url: this.$http.adornUrl('/liResourceCamera/getByResourceId'), url: this.$http.adornUrl('/liResourceCamera/getByResourceId'),
...@@ -682,12 +614,15 @@ export default { ...@@ -682,12 +614,15 @@ export default {
params: { params: {
resourceId: this.dataForm.id resourceId: this.dataForm.id
} }
}).then(data => { }).then((data) => {
if (data && data.code === 0) { if (data && data.code === 0) {
this.checkCameraList = data.list.map(e => { this.checkCameraList = data.list.map((e) => {
return { id: e.cameraId, name: e.cameraName } return { id: e.cameraId, name: e.cameraName }
}) })
if (this.checkCameraList != null && this.checkCameraList.length > 0) { if (
this.checkCameraList != null &&
this.checkCameraList.length > 0
) {
var cameraIds = [] var cameraIds = []
var cameraNames = [] var cameraNames = []
for (var i = 0; i < this.checkCameraList.length; i++) { for (var i = 0; i < this.checkCameraList.length; i++) {
...@@ -702,17 +637,20 @@ export default { ...@@ -702,17 +637,20 @@ export default {
} }
}, },
// 表单提交 // 表单提交
dataFormSubmit (id) { dataFormSubmit(id) {
// if (this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' && this.dataForm.type !== 'ece0b8b2db27411886254e81134988a3') { // if (this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' && this.dataForm.type !== 'ece0b8b2db27411886254e81134988a3') {
// if (this.dataForm.cameraIds === null || this.dataForm.cameraIds === undefined || this.dataForm.cameraIds === '') { // if (this.dataForm.cameraIds === null || this.dataForm.cameraIds === undefined || this.dataForm.cameraIds === '') {
// this.$message.error('关联摄像头不能为空') // this.$message.error('关联摄像头不能为空')
// return // return
// } // }
// } // }
if (this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' || this.dataForm.subCode !== '04') { if (
this.dataForm.type !== 'b6af764f2a6e454490a6b1b3c9057e57' ||
this.dataForm.subCode !== '04'
) {
this.dataForm.parentName = null this.dataForm.parentName = null
} }
this.$refs['dataForm'].validate(valid => { this.$refs['dataForm'].validate((valid) => {
if (valid) { if (valid) {
this.$http({ this.$http({
url: this.$http.adornUrl( url: this.$http.adornUrl(
...@@ -720,7 +658,7 @@ export default { ...@@ -720,7 +658,7 @@ export default {
), ),
method: 'post', method: 'post',
data: this.dataForm data: this.dataForm
}).then(data => { }).then((data) => {
console.log(data) console.log(data)
if (data && data.code === 0) { if (data && data.code === 0) {
this.$message({ this.$message({
...@@ -741,7 +679,7 @@ export default { ...@@ -741,7 +679,7 @@ export default {
}) })
}, },
//关闭前 //关闭前
handleClose () { handleClose() {
this.visible = false this.visible = false
this.$refs.dataForm.resetFields() this.$refs.dataForm.resetFields()
} }
...@@ -942,8 +880,8 @@ export default { ...@@ -942,8 +880,8 @@ export default {
cursor: pointer; cursor: pointer;
} }
} }
.videoMap{ .videoMap {
/deep/ .el-dialog__body{ /deep/ .el-dialog__body {
padding: 0; padding: 0;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment