ソースを参照

Merge branch 'bind-all' of http://39.106.8.246:3003/web/wanda-editer into bind

haojianlong 4 年 前
コミット
5062d122d7
4 ファイル変更391 行追加112 行削除
  1. 10 0
      src/api/editer.js
  2. 1 1
      src/components/edit/attr_select.vue
  3. 369 110
      src/components/edit/edit-dialog.vue
  4. 11 1
      src/store/index.ts

+ 10 - 0
src/api/editer.js

@@ -112,4 +112,14 @@ export function deleteByCategory(params){
 // 推荐
 export function graphElementOrderInfoLocal(params){
     return httputils.getJson(`${testApi}/graphElement/orderInfoLocal`, params)
+}
+
+// 查询图例绑定的楼层
+export function queryFloorByNode(params) {
+    return httputils.getJson(`${testApi}/node/qfloor`, params)
+}
+
+// 批量绑定工程信息化数据
+export function bindAttachObject(params){
+    return httputils.postJson(`${testApi}/node/bindAttachObject`, params)
 }

+ 1 - 1
src/components/edit/attr_select.vue

@@ -349,7 +349,7 @@
         </a-collapse-panel>
       </a-collapse>
     </div>
-    <editDialog ref="dialog" :attrCards="attrCards" :GraphElementId="GraphElementId" :InfoLocal="InfoLocal" :sysNum="imageNum" :key="keys" />
+    <editDialog ref="dialog" :attrCards="attrCards" :lengedName="lengedName" :GraphElementId="GraphElementId" :InfoLocal="InfoLocal" :sysNum="imageNum" :key="keys" />
 <!--    <editDialog ref="dialog" :attrCards="attrCards" :getmajorId="getmajorId" :InfoLocal="InfoLocal" :sysNum="imageNum" :key="new Date().getTime()" />-->
     <!--    <editDialog ref="dialog" :typeEdit="2" :getmajorId="'1001'" :sysNum="5" />-->
   </div>

+ 369 - 110
src/components/edit/edit-dialog.vue

@@ -1,96 +1,135 @@
 <template>
-    <a-modal v-model="visible" title="选择编辑" width="1200px" class="edit-dialog" @cancel="handleCancel">
-        <template slot="footer">
-            <a-button key="back" @click="handleCancel">
-                取消
-            </a-button>
-            <a-button key="submit" type="primary" :loading="loading" @click="handleOk">
-                确认
-            </a-button>
-        </template>
-        <div class="dialog-content">
-            <div class="left">
-                <div class="header">
-                    <div class="select">
-                        <a-select style="width: 316px;margin: 0 10px" :default-value="'#'" :value="majorId">
-                            <a-select-option value="#"
-                                             @click="handleChange('#')">
-                               推荐
-                            </a-select-option>
-                            <a-select-opt-group>
-                                <span slot="label">位置区域</span>
-                                <a-select-option v-for="item in locationList" :value="item.id"
-                                                 @click="handleChange(item)">
-                                    {{item.name}}
-                            </a-select-option>
-                            <a-select-opt-group>
-                                <span slot="label">设备设施</span>
-                                <a-select-option v-for="item in majorList" :value="item.id" @click="handleChange(item)">
-                                    {{item.name}}
+    <div>
+        <a-modal v-model="visible" title="选择编辑" width="1200px" class="edit-dialog" @cancel="handleCancel">
+            <template slot="footer">
+                <a-button key="back" @click="handleCancel">
+                    取消
+                </a-button>
+                <a-button key="submit" type="primary" :loading="loading" @click="handleOk">
+                    确认
+                </a-button>
+            </template>
+            <div class="dialog-content">
+                <div class="left">
+                    <div class="header">
+                        <div class="select">
+                            <a-select style="width: 316px;margin: 0 10px" :default-value="'#'" :value="majorId">
+                                <a-select-option value="#"
+                                                @click="handleChange('#')">
+                                推荐
                                 </a-select-option>
-                            </a-select-opt-group>
-
-                            </a-select-opt-group>
-                        </a-select>
-                        <!--            <Select style="margin: 0 10px"-->
-                        <!--                    v-model="majorId"-->
-                        <!--                    @change="handleMajor"-->
-                        <!--                    :hideClear='true'-->
-                        <!--                    :selectdata="majorList"-->
-                        <!--                    :placeholder="'请选择'"-->
-                        <!--                    class="search-select"-->
-                        <!--                    width="236" isReadOnly-->
-                        <!--            />-->
-                    </div>
-                    <div class="search">
-                        <Select
-                                v-model="floorId"
-                                caption="所属楼层:"
-                                @change="chageFloor"
-                                :hideClear='false'
-                                :selectdata="dataFloor"
-                                :placeholder="'请选择'"
-                                class="search-select"
-                                width="236"
-                        />
-                        <a-input-search placeholder="搜索位置名称" class="press-enter" @search="onSearch" v-model="keyword"/>
+                                <a-select-opt-group>
+                                    <span slot="label">位置区域</span>
+                                    <a-select-option v-for="item in locationList" :value="item.id"
+                                                    @click="handleChange(item)">
+                                        {{item.name}}
+                                </a-select-option>
+                                <a-select-opt-group>
+                                    <span slot="label">设备设施</span>
+                                    <a-select-option v-for="item in majorList" :value="item.id" @click="handleChange(item)">
+                                        {{item.name}}
+                                    </a-select-option>
+                                </a-select-opt-group>
+
+                                </a-select-opt-group>
+                            </a-select>
+                            <!--            <Select style="margin: 0 10px"-->
+                            <!--                    v-model="majorId"-->
+                            <!--                    @change="handleMajor"-->
+                            <!--                    :hideClear='true'-->
+                            <!--                    :selectdata="majorList"-->
+                            <!--                    :placeholder="'请选择'"-->
+                            <!--                    class="search-select"-->
+                            <!--                    width="236" isReadOnly-->
+                            <!--            />-->
+                        </div>
+                        <div class="search">
+                            <Select
+                                    v-model="floorId"
+                                    caption="所属楼层:"
+                                    @change="chageFloor"
+                                    :hideClear='false'
+                                    :selectdata="dataFloor"
+                                    :placeholder="'请选择'"
+                                    class="search-select"
+                                    width="236"
+                            />
+                            <a-input-search placeholder="搜索位置名称" class="press-enter" @search="onSearch" v-model="keyword"/>
 
+                        </div>
+                    </div>
+                    <div class="tree" >
+                        <a-spin :spinning="spinning">
+                        <a-input-search placeholder="请输入关键字" v-if="selectVal ||treeData.length" style="width: 315px;margin: 10px 10px;"  v-model="selectVal"  @search="onSearchTree" />
+                    <div style="height: 385px;overflow-y: scroll;">
+                        <Tree v-if="treeData.length" @change="getTreeId" :data="treeData"/>
+                        <div v-else style="margin: 40px 70px;">暂无推荐数据</div>
+                    </div>
+                        </a-spin>
+                    </div>
+                    <div class="checkbox">
+                        <a-table :pagination="false" :row-key='typeEdit=="Zone"?"location":"assetnum"'
+                                :columns="typeEdit=='Image'?columnsSys:typeEdit=='Zone'?columnsLocal:objSys"
+                                :data-source="tableData"
+                                :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,onSelect:onSelect }"
+                                :scroll="{ y: 340 }" :loading="loading"/>
+                        <a-pagination v-if="total>0" v-model="page" :total="total" show-less-items
+                                    style="margin-left: auto;" @change="handleTableChange"/>
                     </div>
                 </div>
-                <div class="tree" >
-                    <a-spin :spinning="spinning">
-                    <a-input-search placeholder="请输入关键字" v-if="selectVal ||treeData.length" style="width: 315px;margin: 10px 10px;"  v-model="selectVal"  @search="onSearchTree" />
-                   <div style="height: 385px;overflow-y: scroll;">
-                       <Tree v-if="treeData.length" @change="getTreeId" :data="treeData"/>
-                       <div v-else style="margin: 40px 70px;">暂无推荐数据</div>
-                   </div>
-                    </a-spin>
-                </div>
-                <div class="checkbox">
-                    <a-table :pagination="false" :row-key='typeEdit=="Zone"?"location":"assetnum"'
-                             :columns="typeEdit=='Image'?columnsSys:typeEdit=='Zone'?columnsLocal:objSys"
-                             :data-source="tableData"
-                             :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange,onSelect:onSelect }"
-                             :scroll="{ y: 340 }" :loading="loading"/>
-                    <a-pagination v-if="total>0" v-model="page" :total="total" show-less-items
-                                  style="margin-left: auto;" @change="handleTableChange"/>
+                <div class="right">
+                    <div class="header">
+                        <span class="select-number">已选择 <b>{{arrList.length}}</b>/{{sysNum}}</span>
+                        <a-button type="link" class="link" @click="clearArrList" :disabled="arrList.length==0">清空</a-button>
+                    </div>
+
+                    <div class="list-box">
+                        <p v-for="(item,index) in arrList" :key="index" class="list">{{item.sbjc||item.wzjc}}
+                            <a-icon type="close" class="icon" @click="deleteItem(item,index)"/>
+                        </p>
+                    </div>
+
                 </div>
             </div>
-            <div class="right">
-                <div class="header">
-                    <span class="select-number">已选择 <b>{{arrList.length}}</b>/{{sysNum}}</span>
-                    <a-button type="link" class="link" @click="clearArrList" :disabled="arrList.length==0">清空</a-button>
-                </div>
+        </a-modal>
 
-                <div class="list-box">
-                    <p v-for="(item,index) in arrList" :key="index" class="list">{{item.sbjc||item.wzjc}}
-                        <a-icon type="close" class="icon" @click="deleteItem(item,index)"/>
-                    </p>
+        <a-modal v-model="visibleBind" title="是否批量绑定图例" width="420px" class="edit-dialog" @cancel="handleClickCancel" centered>
+            <template slot="footer">
+                <a-checkbox @change="onChangeRemember" :checked="isRem" style="float: left;margin-top: 5px;">
+                    记住操作,不再提醒
+                </a-checkbox>
+                <a-button key="back" @click="handleClickUntreated">
+                    暂不处理
+                </a-button>
+                <a-button key="submit" type="primary" :loading="loading" @click="handleClickBind(true)">
+                    批量绑定
+                </a-button>
+            </template>
+            <div class="bind-content">
+                <p>{{`系统自动将其他平面图中的“${GraphElementName?GraphElementName:"图例"}”绑定相同台账,涉及以下平面图:`}}</p>
+                <div class="bind-box" v-for="(data, key) in bindData" :key="key" v-show="Object.keys(data).length">
+                    <h3 class="bind-title" v-if="Object.keys(data).length">{{key == "HasPub"?"已发布的平面图":"草稿箱中的平面图"}}</h3>
+                    <p v-if="data.floor">{{`${data.floor.Name}—${data.floor.FloorName.join('、')}`}}</p>
+                    <div class="bind-equip" v-if="data.equip && data.equip.length">
+                        <div class="bind-equip-title">设备设施—</div>
+                        <div class="bind-equip-list">
+                            <p class="bind-equip-item" v-for="equip in data.equip" :key="equip.Id" :title="`${equip.Name}—${equip.FloorName.join('、')}`">
+                                {{`${equip.Name}—${equip.FloorName.join('、')}`}}
+                            </p>
+                        </div>
+                    </div>
+                    <div class="bind-equip" v-if="data.system && data.system.length">
+                        <div class="bind-equip-title">系统原理图—</div>
+                        <div class="bind-equip-list">
+                            <p class="bind-equip-item" v-for="system in data.system" :key="system.Id" :title="`${system.Name}—${system.FloorName.join('、')}`">
+                                {{`${system.Name}—${system.FloorName.join('、')}`}}
+                            </p>
+                        </div>
+                    </div>
                 </div>
-
             </div>
-        </div>
-    </a-modal>
+        </a-modal>
+    </div>
 </template>
 
 <script>
@@ -103,10 +142,13 @@
         queryWzfldl,
         queryWzflByDl,
         queryGlsmsLocation,
-        graphElementOrderInfoLocal
+        graphElementOrderInfoLocal,
+        queryFloorByNode,
+        bindAttachObject
     } from "@/api/editer";
     import bus from "@/bus";
-    import {getUrlMsg} from '@/components/urlMsg.js'
+    import {getUrlMsg} from '@/components/urlMsg.js';
+    import { mapGetters } from 'vuex';
 
     export default {
         name: "edit-dialog",
@@ -116,9 +158,11 @@
             attrCards: Array,
             // getmajorId: String,
             InfoLocal: Array,
-            GraphElementId:String
+            GraphElementId:String,
+            lengedName: String
         },
         computed: {
+            ...mapGetters(["isRemember","rememberBtn"])
             // majorId() {
             //     return ''
             // }
@@ -131,6 +175,7 @@
                 model: 'test1',
                 searchName: '',
                 floorId: "",//所属楼层
+                projectId: "",//所属项目
                 dataFloor: [],
                 plainOptions: ['福建三明万达-供电系统-6楼-工程信息化中的区域编码ND182472e83742', '福建三明万达-供电系统-6楼-工程信息化中的区域编码ND18247283742'],
                 majorList: [],
@@ -223,7 +268,15 @@
                 typeEdit: '',
                 selectVal:'',
                 sysId:'',
-                majorId:'#'
+                majorId:'#',
+                GraphElementName: "",
+                visibleBind: false, // 是否显示批量绑定弹窗
+                isRem: false, // 是否记住操作
+                bindData: {
+                    HasPub: {},
+                    NotPub: {}
+                },
+                GraphsIdList: []
             }
         },
         watch: {
@@ -252,30 +305,136 @@
                 this.visible = true;
             },
             handleOk(e) {
-                this.loading = true;
-                setTimeout(() => {
+                // this.loading = true;
+                // this.visible = false;
+                // this.loading = false;
+                const lists = [];
+                let arr = [];
+                arr = JSON.parse(JSON.stringify(this.arrList))
+                arr.map(item => {
+                    if (item.type=='Zone') {
+                        lists.push({id: item.location, name: item.wzjc , type: 'Zone'})
+                    }
+                    if (item.type=='Image') {
+                        lists.push({
+                            id: item.assetnum,
+                            name: item.sbjc,
+                            type: 'Image'
+                        })
+                    }
+                })
+                bus.$emit('changeAttachObjectIds', lists, true)
+                bus.$emit('updateAttachMsg', lists)
+                if (this.isRem && this.rememberBtn == "bind" && this.GraphElementName) { // 记住批量绑定并且图例名不为空
+                    // 直接绑定接口
+                    this.handleClickBind(false);
+                } else if (!this.isRem && this.GraphElementName) { // 没有记住操作并且图例名不为空
+                    // 打开批量绑定弹窗并查询相关楼层
+                    this.getBindGraphs();
+                } else {
                     this.visible = false;
-                    this.loading = false;
-                    const lists = [];
-                    let arr = [];
-                    arr = JSON.parse(JSON.stringify(this.arrList))
-                    console.log(arr);
-                    arr.map(item => {
-                        if (item.type=='Zone') {
-                            lists.push({id: item.location, name: item.wzjc , type: 'Zone'})
-                        }
-                        if (item.type=='Image') {
-                            lists.push({
-                                id: item.assetnum,
-                                name: item.sbjc,
-                                type: 'Image'
-                            })
-                        }
-                    })
-                    console.log(lists);
-                    bus.$emit('changeAttachObjectIds', lists, true)
-                    bus.$emit('updateAttachMsg', lists)
-                }, 1000);
+                }
+                // setTimeout(() => {
+                //     this.visible = false;
+                //     this.loading = false;
+                //     const lists = [];
+                //     let arr = [];
+                //     arr = JSON.parse(JSON.stringify(this.arrList))
+                //     console.log(arr);
+                //     arr.map(item => {
+                //         if (item.type=='Zone') {
+                //             lists.push({id: item.location, name: item.wzjc , type: 'Zone'})
+                //         }
+                //         if (item.type=='Image') {
+                //             lists.push({
+                //                 id: item.assetnum,
+                //                 name: item.sbjc,
+                //                 type: 'Image'
+                //             })
+                //         }
+                //     })
+                //     console.log(lists);
+                //     bus.$emit('changeAttachObjectIds', lists)
+                //     bus.$emit('updateAttachMsg', lists)
+                // }, 1000);
+            },
+            // 查询相关图并打开批量绑定弹窗
+            getBindGraphs() {
+                // 初始化数据
+                this.bindData = {HasPub: {}, NotPub: {}};
+                this.GraphsIdList = [];
+                queryFloorByNode({graphElementId: this.GraphElementId,graphElementName: this.GraphElementName,projectId: this.projectId}).then(res => {
+                    if (res.Data && ((res.Data.HasPub && res.Data.HasPub.length) || (res.Data.NotPub && res.Data.NotPub.length))) {
+                        const data = res.Data;
+                        Object.keys(data).forEach(key => {
+                            if (data[key].length) {
+                                data[key].forEach(item => {
+                                    if (item.Id == "LCGN") { // 楼层功能
+                                        this.bindData[key].floor = {
+                                            Id: item.Id,
+                                            Name: item.Name,
+                                            FloorName: []
+                                        }
+                                        const floor = this.bindData[key].floor;
+                                        if (item.Graphs.length) {
+                                            item.Graphs.forEach(graph => {
+                                                floor.FloorName.push(graph.Floor.Code);
+                                                this.GraphsIdList.push(graph.Id);
+                                            })
+                                        }
+                                    } else if (item.Id == "XFBFYCFL" || item.Id == "FZQZL") { // 系统原理图
+                                        if (this.bindData[key].system) {
+                                            this.bindData[key].system.push({
+                                                Id: item.Id,
+                                                Name: item.Name,
+                                                FloorName: []
+                                            })
+                                        } else {
+                                            this.bindData[key].system = [{
+                                                Id: item.Id,
+                                                Name: item.Name,
+                                                FloorName: []
+                                            }]
+                                        }
+                                        const systemLast = this.bindData[key].system[this.bindData[key].system.length - 1];
+                                        if (item.Graphs.length) {
+                                            item.Graphs.forEach(graph => {
+                                                systemLast.FloorName.push(graph.Floor.Code);
+                                                this.GraphsIdList.push(graph.Id);
+                                            })
+                                        }
+                                    } else { // 设备设施
+                                        if (this.bindData[key].equip) {
+                                            this.bindData[key].equip.push({
+                                                Id: item.Id,
+                                                Name: item.Name,
+                                                FloorName: []
+                                            })
+                                        } else {
+                                            this.bindData[key].equip = [{
+                                                Id: item.Id,
+                                                Name: item.Name,
+                                                FloorName: []
+                                            }]
+                                        }
+                                        const equipLast = this.bindData[key].equip[this.bindData[key].equip.length - 1];
+                                        if (item.Graphs.length) {
+                                            item.Graphs.forEach(graph => {
+                                                equipLast.FloorName.push(graph.Floor.Code);
+                                                this.GraphsIdList.push(graph.Id);
+                                            })
+                                        }
+                                    }
+                                })
+                            }
+                        })
+                        this.visibleBind = true;
+                    } else {
+                        this.visible = false;
+                    }
+                })
+                console.log("bindData+++++++++++++++++++++++",this.bindData);
+                console.log("GraphsIdList++++++++++++++++++++",this.GraphsIdList);
             },
             handleCancel(e) {
                 this.visible = false;
@@ -295,6 +454,65 @@
                 console.log(lists);
                 bus.$emit('changeAttachObjectIds', lists, false)
             },
+            // 关闭批量绑定弹窗(疑问,点击取消按钮是否要关闭第一个弹窗)
+            handleClickCancel() {
+                this.visibleBind = false;
+                this.isRem = false;
+                this.$store.commit("setIsRemember", this.isRem);
+            },
+            // 勾选记住选择复选框
+            onChangeRemember(e) {
+                this.isRem = e.target.checked;
+                this.$store.commit("setIsRemember", this.isRem);
+            },
+            // 点击暂不处理按钮
+            handleClickUntreated() {
+                this.$store.commit("setRememberBtn", "untreated");
+                this.visibleBind = false;
+                this.visible = false;
+            },
+            // 点击批量绑定按钮
+            handleClickBind(Marked) {
+                const lists = [];
+                let params = {};
+                let arr = [];
+                arr = JSON.parse(JSON.stringify(this.arrList))
+                arr.map(item => {
+                    if (item.type=='Zone') {
+                        lists.push({id: item.location, name: item.wzjc , type: 'Zone'})
+                    }
+                    if (item.type=='Image') {
+                        lists.push({
+                            id: item.assetnum,
+                            name: item.sbjc,
+                            type: 'Image'
+                        })
+                    }
+                })
+                if (Marked) {
+                    this.$store.commit("setRememberBtn", "bind");
+                    params = {
+                        ProjectId: this.projectId,
+                        Marked: true, // Marked为true时传GraphIds字段,
+                        GraphIds: this.GraphsIdList,
+                        GraphElementName: this.GraphElementName,
+                        AttachObject: lists
+                    }
+                } else {
+                    params = {
+                        ProjectId: this.projectId,
+                        Marked: false, // Marked为false时不传GraphIds字段,
+                        GraphElementName: this.GraphElementName,
+                        AttachObject: lists
+                    }
+                }
+
+                bindAttachObject(params).then(res => {
+                    this.visibleBind = false;
+                    this.visible = false;
+                    this.$message.success("绑定成功!");
+                })
+            },
             onSearch(value) {
                 this.queryGlsmsasset()
             },
@@ -694,6 +912,10 @@
         created() {
             // 取gcname
             this.floorId = getUrlMsg().FloorID;
+            this.projectId = getUrlMsg().projectId;
+            // 获取vuex的isRemember赋值给isRem
+            this.isRem = this.isRemember;
+            this.GraphElementName = this.lengedName;
             //如果有专业就带过来
             if (this.GraphElementId) {
               this.tuijian();
@@ -835,6 +1057,43 @@
             }
         }
 
+        .bind-content {
+            max-height: 250px;
+            overflow-y: auto;
+            overflow-x: hidden;
+            .bind-box {
+                margin-top: 20px;
+                .bind-title {
+                    padding: 0 8px;
+                    height: 16px;
+                    line-height: 16px;
+                    border-left: 3px solid #0091FF;
+                    margin-bottom: 8px;
+                    font-size: 16px;
+                    font-family: MicrosoftYaHeiSemibold;
+                    color: #1f2429;
+                    font-weight: bold;
+                }
+                .bind-equip{
+                    display: flex;
+                    .bind-equip-title {
+                        white-space: nowrap;
+                    }
+                    .bind-equip-list {
+                        flex: 1;
+                        overflow: hidden;
+                        .bind-equip-item {
+                            cursor: pointer;
+                            white-space: nowrap;
+                            overflow: hidden;
+                            text-overflow: ellipsis;
+                        }
+                    }
+
+                }
+            }
+        }
+
         /deep/ .ant-input-affix-wrapper .ant-input-suffix {
             /*left: 12px;*/
             /*padding-right: 12px;*/

+ 11 - 1
src/store/index.ts

@@ -9,7 +9,9 @@ export default new Vuex.Store({
     GraphCategoryIds: ['NTXT'], //系统类型
     TypeIdToGraphElement: {}, //typeid到图例元素的映射
     token: null,
-    GraphElement:[]
+    GraphElement:[],
+    isRemember: false,
+    rememberBtn: "bind"
   },
   mutations: {
     TypeIdToGraphElement(state, data) {
@@ -32,6 +34,12 @@ export default new Vuex.Store({
     SETSSOTOKEN(state, data) {
       state.token = data
     },
+    setIsRemember(state, data) {
+      state.isRemember = data
+    },
+    setRememberBtn(state, data) {
+      state.rememberBtn = data
+    },
   },
   actions: {
     getElementType({ commit }, params) {
@@ -47,6 +55,8 @@ export default new Vuex.Store({
   },
   getters: {
     token: (state) => state.token,
+    isRemember: (state) => state.isRemember,
+    rememberBtn: (state) => state.rememberBtn,
   },
   modules: {
   }