123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320 |
- <template>
- <div class='page-table-template' style='display: flex;flex-direction: column;flex-grow: 1;flex-shrink: 1;'>
- <div class="btn-box">
- <el-button type='danger' @click='someDel'>批量删除</el-button>
- </div>
- <el-table
- :data='tableData'
- style='width: 100%'
- border
- class='data-table'
- v-loading='loading'
- @selection-change='handleSelectionChange'
- >
- <el-table-column type='selection' width='55' align='center'></el-table-column>
- <el-table-column header-align='center' align='center' prop='BuildName' label='建筑' width='150'></el-table-column>、
- <el-table-column header-align='center' align='center' prop='floorName' label='楼层' width='80'></el-table-column>
- <el-table-column header-align='center' align='center' prop='FamilyName' label='设备族'></el-table-column>
- <el-table-column header-align='center' align='center' label='本地编码' width='250'>
- <template slot-scope='scope'>
- <span>{{scope.row.Infos.EquipLocalID || scope.row.Infos.EquipID || '--'}}</span>
- </template>
- </el-table-column>
- <el-table-column header-align='center' align='center' prop='FmName' label='本地名称'></el-table-column>
- <el-table-column header-align='center' align='center' prop='spaceName' label='所在元空间'></el-table-column>
- <el-table-column header-align='center' align='center' prop='eq' label='对应设备类'></el-table-column>
- <el-table-column header-align='center' align='center' prop='bimXY' label='BIM模型中坐标'></el-table-column>
- <el-table-column header-align='center' align='center' prop='PointName' label='对应的岗位' width='120'>
- <template slot-scope='scope'>
- <el-button v-if="scope.row.EquipmentId" type='primary' plain size='mini' @click='post(scope.row)'>查看岗位详情</el-button>
- </template>
- </el-table-column>
- <el-table-column header-align='center' align='center' prop='PointName' label='操作' width='150'>
- <template slot-scope='scope'>
- <el-button type='primary' plain size='mini' @click='look(scope.row)'>查看</el-button>
- <el-button type='danger' plain size='mini' @click='del(scope.row)'>删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <base-pagination
- class='data-table-pagination'
- :currentPages='pageNum'
- :total='total'
- @pageChanged='pageChanged'
- ></base-pagination>
- <saga-dialog ref='dialog' :iframeSrc='iframeSrc'></saga-dialog>
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex'
- import SagaDialog from './Frame'
- //api
- import {
- getErrAssets, //获取异常资产type不同不同tab
- delErrAssets,
- getSpaceId,
- getSpaceName
- } from '@/api/scan/request'
- export default {
- name: 'noverify',
- data() {
- return {
- loading: false,
- tableData: [],
- total: 0,
- pageNum: 1,
- pageSize: 10,
- iframeSrc: '',
- allChecked: [],
- //dict
- EquipmentObj: {}
- }
- },
- props: {
- buildVlaue: {
- default: ''
- },
- floorsObj: {
- default: {}
- },
- allFamilyObj: {},
- allEquipObj: {
- default: {}
- }
- },
- components: {
- SagaDialog
- },
- computed: {
- ...mapGetters('peojMess', ['projectId', 'userId', 'secret'])
- },
- methods: {
- look(row) {
- this.iframeSrc =
- process.env.BASE_URL +
- ':8889/#/details?perjectId=' +
- this.projectId +
- '&secret=' +
- this.secret +
- '&FmId=' +
- row.FmId +
- '&type=1&code=' +
- row.Family
- this.$refs['dialog'].show()
- },
- post(row) {
- this.iframeSrc =
- process.env.BASE_URL +
- ':8889/#/details?perjectId=' +
- this.projectId +
- '&secret=' +
- this.secret +
- '&FmId=' +
- row.FmId +
- '&type=1&code=' +
- row.eqCode
- this.$refs['dialog'].show()
- },
- handleSelectionChange(arr) {
- this.allChecked = arr.map(ele => ele.FmId)
- },
- someDel() {
- if (this.allChecked.length) {
- this.delOp(this.allChecked)
- } else {
- this.$message({
- message: '请至少选择一条',
- type: 'warning'
- })
- }
- },
- del(row) {
- let paramList = [row.FmId]
- this.delOp(paramList)
- },
- delOp(paramList) {
- this.$confirm('此操作将永久删除, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- })
- .then(() => {
- let param = {
- ProjId: this.projectId,
- UserId: this.userId
- }
- delErrAssets(param, paramList).then(result => {
- if (result.data.Result == 'success') {
- this.getAsset()
- this.$message({
- message: '删除成功',
- type: 'success'
- })
- }
- })
- })
- .catch(() => {
- this.$message({
- type: 'info',
- message: '已取消删除'
- })
- })
- },
- pageChanged(page, size) {
- this.pageNum = page
- this.pageSize = size
- this.getAsset()
- },
- getAsset() {
- this.loading = true
- let param = {
- BuildId: this.buildVlaue || undefined,
- PageNum: this.pageNum,
- PageSize: this.pageSize,
- Type: 4,
- ProjId: this.projectId,
- UserId: this.userId,
- CodeType: 1
- }
- getErrAssets(param).then( async res => {
- // this.tableData = list
- if (res.data.Result == 'success') {
- let list = res.data.FmList
- list.forEach((ele, index) => {
- ele.floorName = this.floorsObj[ele.FloorId] || '--'
- let x = ''
- let y = ''
- if (ele.X == 0) {
- x = '空'
- } else {
- x = ele.X || ''
- }
- if (ele.Y == 0) {
- y = '空'
- } else {
- y = ele.Y || ''
- }
- ele.bimXY = x + (x || y ? ',' : '-') + y
- })
- this.total = res.data.Count
- this.tableData = list
- await this.getEq(list)
- await this.getSp(list)
- this.loading = false
- }
- })
- },
- async getEq(list) {
- let param = {},
- idArr = [],
- i = 0,
- dataArr = list
- for (; i < dataArr.length; i++) {
- if (dataArr[i].EquipmentId) {
- idArr.push({
- id: dataArr[i].EquipmentId
- })
- }
- }
- param = {
- perjectId: this.projectId,
- secret: this.secret,
- list: idArr
- }
- let ret = await this.batchQuery(param)
- ret.forEach(ele => {
- this.EquipmentObj[ele.id] = ele.category.slice(2)
- })
- list.forEach(ele => {
- if (ele.EquipmentId) {
- ele.eq = this.allEquipObj[this.EquipmentObj[ele.EquipmentId]]
- ele.eqCode = this.EquipmentObj[ele.EquipmentId]
- } else {
- ele.eq = null
- }
- })
- },
- async getSp(list) {
- let param = {},
- idArr = [],
- i = 0,
- dataArr = list
- for (; i < dataArr.length; i++) {
- if (dataArr[i].EquipmentId) {
- idArr.push({
- from_id: dataArr[i].EquipmentId,
- graph_id: 'GtEquipinSpace001',
- rel_type: '1'
- })
- }
- }
- param = {
- perjectId: this.projectId,
- secret: this.secret,
- list: idArr
- }
- let ret = await this.getSpId(param)
- let arr = []
- let eqObj = {}
- ret.forEach(ele => {
- if (ele.Content.length > 0) {
- arr.push({ id: ele.Content[0].to_id })
- eqObj[ele.Content[0].from_id] = ele.Content[0].to_id
- }
- })
- list.forEach(list1 => {
- if (eqObj[list1.EquipmentId]) {
- list1.toSpace = eqObj[list1.EquipmentId]
- } else {
- list1.toSpace = null
- }
- })
- let params = {
- perjectId: this.projectId,
- secret: this.secret,
- list: arr
- }
- let retu = await this.batchQuery(params)
- let spObj = {}
- retu.forEach(retu1 => {
- spObj[retu1.id] = retu1.infos
- })
- list.forEach(list2 => {
- if (spObj[list2.toSpace]) {
- list2.spaceName = spObj[list2.toSpace].RoomLocalName
- } else {
- list2.spaceName = null
- }
- })
- },
- async batchQuery(param) {
- let res = await getSpaceName(param)
- let ret = res.data.Content
- if (res.data.Count > 0) {
- return ret
- }
- return []
- },
- async getSpId(param) {
- let res = await getSpaceId(param)
- let ret = res.data.Content
- if (res.data.Count > 0) {
- return ret
- }
- return []
- }
- },
- watch: {
- buildVlaue() {
- this.getAsset()
- }
- }
- }
- </script>
- <style scoped lang='less'>
- .btn-box {
- padding: 10px;
- }
- </style>
|