123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <template>
- <div id="eqInSp">
- <el-row v-show="hidden">
- <el-button type="primary" @click="add">添加{{inSpaceType}}</el-button>
- <el-tooltip class="item" effect="dark" :content="`可前往“全部关系总览”中,按坐标计算${typeToTips[type]}`" placement="right">
- <el-button>按空间计算</el-button>
- </el-tooltip>
- </el-row>
- <div class="table-box">
- <el-table :data="tableData" style="width: 100%" height="100%" v-loading="loading" :header-cell-style="headerStyle">
- <el-table-column :label="`${inSpaceType}名称`" show-overflow-tooltip min-width="100">
- <template slot-scope="scope">
- <div>
- {{scope.row.SysLocalName||scope.row.SysName}}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="SysLocalID" :label="`${inSpaceType}本地编码`" show-overflow-tooltip min-width="100"></el-table-column>
- <el-table-column prop="action" label="操作" min-width="100">
- <template slot-scope="scope">
- <el-tooltip class="item" effect="dark" content="删除关系" placement="left">
- <el-button size="mini" @click="handleDelete(scope.$index, scope.row)" type="danger" plain icon="el-icon-delete"></el-button>
- </el-tooltip>
- </template>
- </el-table-column>
- <template slot="empty">
- <div style="height: 60%;transform: translateY(50%);lineHeight:20px;">
- <i class="icon-wushuju iconfont"></i>
- 可前往“全部关系总览”中,按坐标计算{{typeToTips[type]}}
- </div>
- </template>
- </el-table>
- </div>
- <addSystemDialog ref="addSyDialog" :type="type" :spaceId="params.RoomID" :zone="params.zone" @refresh='getTableData'></addSystemDialog>
- </div>
- </template>
- <script>
- import {
- queryZone,
- syInSpaceDelete
- } from "@/api/scan/request";
- import { mapGetters } from "vuex";
- import addSystemDialog from "@/components/business_space/newAddDialogs/addSystemDialog";
- export default {
- components: {
- addSystemDialog
- },
- computed: {
- ...mapGetters("layout", ["projectId"])
- },
- data() {
- return {
- inSpaceType: '系统',
- headerStyle: {
- backgroundColor: '#e1e4e5',
- color: '#2b2b2b',
- lineHeight: '30px'
- }, // 列表样式
- loading: false, // loading
- tableData: [], //列表数据
- typeToTips: {
- generalSystem: '空间内的系统',
- },
- hidden: true,
- loading: false
- };
- },
- props: {
- params: {},
- type: {}
- },
- created() {
- this.getTableData();
- this.changeContentStyle();
- },
- methods: {
- // 删除关系
- handleDelete(index, row) {
- this.$confirm("确认删除该关系?", "提示", {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- let pa = {
- data: [row],
- type: this.params.zone
- }
- this.deleteSyInSpace(pa)
- }).catch(() => {
- this.$message("取消删除")
- })
- },
- // 删除关系
- deleteSyInSpace(pa) {
- syInSpaceDelete(pa, res => {
- this.$message.success('删除成功');
- this.getTableData();
- })
- },
- // 获取列表数据
- getTableData() {
- this.loading = true;
- let pa = {
- data: {
- Cascade: [{ Name: "generalSystem" }],
- Filters: `RoomID="${this.params.RoomID}"`,
- },
- zone: this.params.zone
- }
- queryZone(pa, res => {
- this.loading = false;
- this.tableData = res.Content[0].GeneralSystem || [];
- this.tableData.map(t => {
- t.SpaceId = res.Content[0].RoomID;
- return t;
- })
- })
- },
- // 添加系统
- add() {
- this.$refs.addSyDialog.showDialog()
- },
- changeContentStyle() {
- // 在辅助屏不显示添加按钮,动态设置高度
- this.$route.name == "spaceLedger" ? this.hidden = false : this.hidden = true;
- }
- },
- watch: {
- type() {
- this.getTableData()
- },
- params() {
- this.getTableData()
- }
- }
- };
- </script>
- <style lang="less" scoped>
- #eqInSp {
- height: 100%;
- .table-box {
- margin-top: 10px;
- height: calc(100% - 50px);
- }
- }
- </style>
|