123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <el-dialog title='添加对应岗位' :visible.sync='dialogVisible' width='500px'>
- <div class='add-box'>
- <el-select v-model='value' placeholder='资产设备族对应的设备类' clearable style="width: 300px">
- <el-option v-for='item in options' :key='item.code' :label='item.name' :value='item.code'></el-option>
- </el-select>
- </div>
- <span slot='footer' class='dialog-footer'>
- <el-button type='primary' @click='save'>确定创建对应岗位</el-button>
- </span>
- </el-dialog>
- </template>
- <script>
- import {
- createEquip, //数据中心创建设备
- createPart, //数据中心创建部件
- updateProperty, //数据中心更新资产
- } from '@/api/scan/request'
- import { mapGetters } from 'vuex'
- export default {
- name: 'saga-station',
- data() {
- return {
- dialogVisible: false,
- value: ''
- }
- },
- computed: {
- ...mapGetters('layout', ['projectId', 'secret', 'userId'])
- },
- props: {
- options: {
- default: []
- },
- itemObj: {
- default: {}
- }
- },
- methods: {
- show() {
- this.dialogVisible = true
- },
- save() {
- if (this.value) {
- let pa = {
- Content:[{
- BuildingId: this.itemObj.BuildingId,
- Category: this.value,
- BIMID: this.itemObj.BIMID || '',
- BIMLocation: this.itemObj.BIMLocation || '',
- FloorId: this.itemObj.FloorId || ''
- }]
- }
- if (pa.Content[0].Category.length == 6) {
- createPart(pa, res => {
- this.upDateTableMain(res.EntityList[0].EquipID)
- })
- } else {
- createEquip(pa, res => {
- this.upDateTableMain(res.EntityList[0].EquipID)
- })
- }
- } else {
- this.$message({
- message: '请选择设备类后再进行关联',
- type: 'warning'
- })
- }
- },
- //关联资产
- upDateTableMain(id) {
- let pa = {
- Content:[this.itemObj]
- };
- let that = this
- pa.Content[0].EquipmentId = id
- updateProperty(pa, res => {
- that.dialogVisible = false;
- that.$emit('refresh')
- })
- }
- },
- watch: {
- options: {
- deep: true,
- handler(val) {
- this.value = ''
- }
- }
- }
- }
- </script>
- <style scoped lang='less'>
- .add-box {
- height: 100px;
- }
- </style>
|