123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <template>
- <el-dialog title="批量关联资产" :visible.sync="dialog.linkAssets" width="900px">
- <el-row>
- <device-parts></device-parts>
- </el-row>
- <el-row style="margin-top:30px;">
-
- <span class="condition-title">建筑楼层:</span>
- <el-cascader placeholder="请选择建筑楼层" :options="bfoptions" v-model="buildFloor" filterable size="small" @change="handleChangeBf"></el-cascader>
- </el-row>
- <el-row style="margin-top:30px;">
- <zone-space :isWidth="false"></zone-space>
- </el-row>
- <span slot="footer" class="dialog-footer">
- <el-button @click="handleClickClose">取 消</el-button>
- <el-button type="primary" @click="toAddDevice">确 认</el-button>
- </span>
- </el-dialog>
- </template>
- <script>
- import { floorQuery, buildingQuery } from '@/api/scan/request'
- import { mapGetters } from "vuex"
- import buildFloor from "@/components/ledger/lib/buildFloor"
- import zoneSpace from "@/components/ledger/lib/zoneSpace"
- import deviceParts from "@/components/ledger/lib/deviceParts"
- export default {
- components: {
- buildFloor,
- zoneSpace,
- deviceParts
- },
- props: {
- dialog: {
- type: Object,
- default: function () {
- return {
- linkAssets: false
- };
- }
- }
- },
- computed: {
- ...mapGetters("layout", ["projectId", "secret", "userId"])
- },
- data() {
- return {
- bfoptions: [],
- buildFloor: ['all'],
- };
- },
- created() {
- this.getData()
- },
- mounted() { },
- methods: {
-
- getData() {
- let data, buildParams = {
- PageNumber: 1,
- PageSize: 500,
- Projection: [
- "BuildID",
- "BuildLocalName"
- ]
- }, floorParams = {
- Orders: "FloorSequenceID desc",
- PageNumber: 1,
- PageSize: 500,
- Projection: [
- "BuildID",
- "FloorID",
- "FloorLocalName",
- "FloorSequenceID"
- ]
- }
- let promise1 = new Promise((resolve, reject) => {
- buildingQuery(buildParams, res => {
- resolve(res)
- })
- })
- let promise2 = new Promise((resolve, reject) => {
- floorQuery(floorParams, res => {
- resolve(res)
- })
- })
- Promise.all([promise1, promise2]).then(values => {
- let builData = values[0].Content, floorData = values[1].Content
- data = builData.map(build => {
- return {
- value: build.BuildID,
- label: build.BuildLocalName
- }
- })
- data.unshift({
- value: "all",
- label: "全部"
- }, {
- value: "noKnow",
- label: "不在建筑内"
- })
- data.forEach(build => {
- floorData.forEach(floor => {
- if (build.value == floor.BuildID && floor.FloorID && floor.FloorLocalName && this.type == "yes") {
- if (build.children) {
- build.children.push({
- value: floor.FloorID,
- label: floor.FloorLocalName,
- FloorSequenceID: floor.FloorSequenceID
- })
- } else {
- build.children = []
- build.children.push({
- value: "all",
- label: "全部"
- }, {
- value: 'noKnow',
- label: "不在楼层内"
- }, {
- value: floor.FloorID,
- label: floor.FloorLocalName,
- FloorSequenceID: floor.FloorSequenceID
- })
- }
- }
- })
- })
- this.bfoptions = data
- })
- },
-
- handleChangeBf() {
- },
- handleClickClose() {
- this.dialog.linkAssets = false
- }
- },
- watch: {
-
- }
- };
- </script>
- <style lang="less" scoped>
- .condition-title{
- margin-left: 10px;
- margin-right: 12px;
- color: #999999;
- font-size: 14px;
- }
- </style>
|