|
|
|
@ -38,7 +38,7 @@ |
|
|
|
</el-tree> |
|
|
|
</div> |
|
|
|
</el-select> |
|
|
|
<el-card class="box-card shelf-bind-card"> |
|
|
|
<el-card v-if="bindAllRackList.length !== 0" class="box-card shelf-bind-card"> |
|
|
|
<ul class="shelf-bind-tab"> |
|
|
|
<li class="active">已绑定(136)</li> |
|
|
|
<li>未绑定(2)</li> |
|
|
|
@ -63,11 +63,10 @@ |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<!-- @change="changeShelfGetGrid" --> |
|
|
|
<el-select v-model="form.layerVal" size="small" placeholder="书架排列表" class="filter-item" style="width: 140px;" value-key="id"> |
|
|
|
<el-select v-model="form.layerVal" size="small" placeholder="书架排列表" class="filter-item" style="width: 140px;" value-key="id" @change="changeShelfGetGrid"> |
|
|
|
<el-option v-for="item in layerOptions" :key="item.id" :label="item.name" :value="item" /> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="form.toward" style="width: 80px;"> |
|
|
|
<el-select v-model="form.toward" style="width: 80px;" :disabled="towardDisabled"> |
|
|
|
<el-option |
|
|
|
v-for="(item,index) in abOptions" |
|
|
|
:key="index" |
|
|
|
@ -75,13 +74,8 @@ |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
</el-select> |
|
|
|
<el-select v-model="form.code4"> |
|
|
|
<el-option |
|
|
|
v-for="(item,index) in selectList" |
|
|
|
:key="index" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value" |
|
|
|
/> |
|
|
|
<el-select v-model="form.shelfVal" size="small" placeholder="架列表" class="filter-item" style="width: 100px;"> |
|
|
|
<el-option v-for="item in rackOptions" :key="item.id" :label="item.name" :value="item.id" /> |
|
|
|
</el-select> |
|
|
|
<el-button class="filter-item filter-search" size="mini" type="success" icon="el-icon-search" /> |
|
|
|
</el-form-item> |
|
|
|
@ -104,7 +98,7 @@ |
|
|
|
</el-card> |
|
|
|
</div> |
|
|
|
<div class="position-top-right"> |
|
|
|
<el-card class="box-card"> |
|
|
|
<el-card v-if="bindAllInquiryList.length !== 0" class="box-card"> |
|
|
|
<div class="inquiry-machine-bind-top"> |
|
|
|
<h4>查询机绑定</h4> |
|
|
|
<div class="inquiry-machine-bind-params"> |
|
|
|
@ -124,13 +118,15 @@ |
|
|
|
</el-card> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<PreviewMap ref="map" :map-data="mapData" :to-shlef="true" /> |
|
|
|
<PreviewMap v-if="is3DMap" ref="map" :map-data="mapData" :to-shlef="true" /> |
|
|
|
<el-empty v-else description="当前区域非3D模式的地图" style="height: 100%;" /> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { FetchRegionTree } from '@/api/deviceVI/index' |
|
|
|
import { FetchInitBookShelfList } from '@/api/shelf/index' |
|
|
|
import { FetchMapDetails } from '@/api/map/index' |
|
|
|
import { FetchInitBookShelfList, FetchBookShelfDetails } from '@/api/shelf/index' |
|
|
|
import PreviewMap from '../map3d/map' |
|
|
|
export default { |
|
|
|
name: 'Shelf3dPosition', |
|
|
|
@ -145,8 +141,8 @@ export default { |
|
|
|
form: { |
|
|
|
code1: 0, |
|
|
|
layerVal: null, |
|
|
|
toward: 0, |
|
|
|
code4: null |
|
|
|
toward: null, |
|
|
|
shelfVal: null |
|
|
|
}, |
|
|
|
selectList: [], |
|
|
|
options1: [ |
|
|
|
@ -156,65 +152,72 @@ export default { |
|
|
|
{ value: 3, label: '按 “排-双面” 筛选' } |
|
|
|
], |
|
|
|
layerOptions: [], |
|
|
|
abOptions: [ |
|
|
|
{ value: 0, name: '双面' }, |
|
|
|
{ value: 1, name: 'A面' }, |
|
|
|
{ value: 2, name: 'B面' } |
|
|
|
], |
|
|
|
mapData: {} |
|
|
|
abOptions: [], |
|
|
|
mapData: {}, |
|
|
|
towardDisabled: false, |
|
|
|
currentTreeNode: null, |
|
|
|
is3DMap: false, |
|
|
|
rackOptions: [], |
|
|
|
bindAllRackList: [], |
|
|
|
bindAllInquiryList: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
|
FetchRegionTree().then(res => { |
|
|
|
this.regionTreeData = [this.transformData(res)] |
|
|
|
console.log(this.regionTreeData) |
|
|
|
console.log('regionTreeData', this.regionTreeData) |
|
|
|
this.$nextTick(() => { |
|
|
|
if (!this.regionTreeData[0].children?.length) return |
|
|
|
const targetFloor = this.regionTreeData[0].children.find(floor => floor.children?.length > 0) |
|
|
|
if (targetFloor?.children?.length) { |
|
|
|
const firstRegion = targetFloor.children[0] |
|
|
|
this.$refs.treeRef.setCurrentKey(firstRegion.id) |
|
|
|
this.handleTreeNodeClick(firstRegion) |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
mounted() { |
|
|
|
// if(this.selectedValue){ |
|
|
|
|
|
|
|
// } |
|
|
|
this.mapData = { |
|
|
|
'id': 1, |
|
|
|
'libcode': '1201', |
|
|
|
'appName': '武汉东西湖图书馆', |
|
|
|
'appId': '1572162706543931393', |
|
|
|
'mapKey': 'd0ebc0507c72e6fb8598a3e58517f9d3', |
|
|
|
'isOnline': true |
|
|
|
} |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.map.level = 1 |
|
|
|
this.$refs.map.initMap() |
|
|
|
}) |
|
|
|
this.changeShelfToModel(this.options1[0]?.value) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// tree 数据转换 |
|
|
|
transformData(data) { |
|
|
|
return { |
|
|
|
const rootNode = { |
|
|
|
id: data.fondsId, |
|
|
|
fondsId: data.fondsId, |
|
|
|
label: data.fondsName, |
|
|
|
children: data.floors.map(floor => ({ |
|
|
|
id: floor.id, |
|
|
|
floorId: floor.id, |
|
|
|
label: floor.floorName, |
|
|
|
children: floor.regions.map(region => ({ |
|
|
|
id: region.id, |
|
|
|
regionId: region.id, |
|
|
|
label: region.regionName, |
|
|
|
parentFloorId: floor.id |
|
|
|
})) |
|
|
|
})) |
|
|
|
raw: { ...data }, |
|
|
|
children: data.floors.map(floor => { |
|
|
|
const floorNode = { |
|
|
|
id: floor.id, |
|
|
|
floorId: floor.id, |
|
|
|
label: floor.floorName, |
|
|
|
raw: { ...floor }, |
|
|
|
children: floor.regions.map(region => { |
|
|
|
return { |
|
|
|
id: region.id, |
|
|
|
regionId: region.id, |
|
|
|
label: region.regionName, |
|
|
|
parentFloorId: floor.id, |
|
|
|
raw: { ...region } |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
return floorNode |
|
|
|
}) |
|
|
|
} |
|
|
|
return rootNode |
|
|
|
}, |
|
|
|
handleTreeNodeClick(nodeData) { |
|
|
|
this.form.layerVal = null |
|
|
|
this.currentTreeNode = nodeData.raw |
|
|
|
console.log('handleTreeNodeClick', nodeData) |
|
|
|
const currentNode = this.$refs.treeRef.getNode(nodeData) |
|
|
|
|
|
|
|
console.log('currentNode', currentNode) |
|
|
|
if (currentNode.level === 1) { |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
const parentNode = currentNode.parent |
|
|
|
const parentLabel = parentNode && parentNode.data && parentNode.data.label |
|
|
|
? parentNode.data.label |
|
|
|
@ -224,14 +227,73 @@ export default { |
|
|
|
? `${parentLabel} - ${nodeData.label}` |
|
|
|
: nodeData.label |
|
|
|
this.$refs.selectRef.blur() |
|
|
|
|
|
|
|
this.getInitBookShelfList(currentNode.data) |
|
|
|
|
|
|
|
if (nodeData.raw.mapType === 1) { |
|
|
|
this.is3DMap = false |
|
|
|
} else { |
|
|
|
this.is3DMap = true |
|
|
|
this.getMapDetails(nodeData.raw.mapId) |
|
|
|
} |
|
|
|
}, |
|
|
|
getMapDetails(id) { |
|
|
|
const params = { |
|
|
|
'id': id |
|
|
|
} |
|
|
|
FetchMapDetails(params).then(res => { |
|
|
|
this.mapData = res |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.$refs.map) { |
|
|
|
this.$refs.map.dispose() |
|
|
|
} |
|
|
|
console.log('this.mapData', this.mapData) |
|
|
|
if (this.currentTreeNode.mapLevel) { |
|
|
|
this.$refs.map.level = Number(this.currentTreeNode.mapLevel) |
|
|
|
} else { |
|
|
|
this.$refs.map.level = 1 |
|
|
|
} |
|
|
|
if (this.currentTreeNode.fid) { |
|
|
|
this.$refs.map.areaFid = this.currentTreeNode.fid |
|
|
|
} else { |
|
|
|
this.$refs.map.areaFid = null |
|
|
|
} |
|
|
|
this.$refs.map.initMap() |
|
|
|
}) |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
changeShelfGetGrid(val) { |
|
|
|
FetchBookShelfDetails({ 'shelfId': val.id }).then(res => { |
|
|
|
this.rackOptions = [] |
|
|
|
const start = parseInt(res.startShelf) || 1 |
|
|
|
const end = start + res.shelfShelf - 1 |
|
|
|
for (let i = start; i <= end; i++) { |
|
|
|
this.rackOptions.push({ |
|
|
|
id: i, |
|
|
|
name: `${i.toString().padStart(2, '0')}架` |
|
|
|
}) |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
handleVisibleChange(visible) { |
|
|
|
// 下拉关闭时的额外逻辑(可选) |
|
|
|
}, |
|
|
|
changeShelfToModel(val) { |
|
|
|
console.log(val) |
|
|
|
if (val === 1 || val === 3) { |
|
|
|
this.towardDisabled = true |
|
|
|
this.abOptions = [ |
|
|
|
{ value: 0, name: '双面' } |
|
|
|
] |
|
|
|
} else { |
|
|
|
this.towardDisabled = false |
|
|
|
this.abOptions = [ |
|
|
|
{ value: 1, name: 'A面' }, |
|
|
|
{ value: 2, name: 'B面' } |
|
|
|
] |
|
|
|
} |
|
|
|
this.form.toward = this.abOptions[0]?.value |
|
|
|
}, |
|
|
|
getInitBookShelfList(data) { |
|
|
|
const params = { 'floorId': data.parentFloorId, 'regionId': data.regionId } |
|
|
|
@ -244,7 +306,6 @@ export default { |
|
|
|
rowType: item.rowType |
|
|
|
} |
|
|
|
}) |
|
|
|
this.layerVal = data |
|
|
|
}).catch(() => { |
|
|
|
}) |
|
|
|
} |
|
|
|
@ -328,7 +389,7 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
.position-top-middle{ |
|
|
|
width: 916px; |
|
|
|
width: 900px; |
|
|
|
.el-card{ |
|
|
|
padding:20px 0 10px 0; |
|
|
|
} |
|
|
|
|