123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579 |
- <template>
- <div id="left_toolbar">
- <ul class="list-1">
- <li
- v-on:mouseout="mouseoutActive(item)"
- v-on:mouseover="mouseoverActive(item)"
- v-for="(item,i) in baseChoice"
- :key="i"
- @click="toolActionClick(item)"
- v-bind:class="{ actives:item.isChoice}"
- >
- <div class="item">
- <img
- v-show="!item.isHover && !item.isChoice"
- :src="require(`./../../assets/images/${item.img}`)"
- alt
- />
- <img
- v-show="item.isHover || item.isChoice "
- :src="require(`./../../assets/images/${item.hoverImg}`)"
- alt
- />
- </div>
- </li>
- </ul>
- <ul class="list-2">
- <li
- v-on:mouseout="mouseoutActive(item)"
- v-on:mouseover="mouseoverActive(item)"
- v-for="(item,i) in systemChoice"
- @click="showDrawer(item)"
- :key="i"
- v-bind:class="{ actives:item.isChoice}"
- >
- <div class="item">
- <img v-show="!item.isHover" :src="require(`./../../assets/images/${item.img}`)" alt />
- <img v-show="item.isHover" :src="require(`./../../assets/images/${item.hoverImg}`)" alt />
- <div>{{item.name}}</div>
- </div>
- </li>
- </ul>
- <!-- 提取-->
- <ul class="list-2 border-top">
- <li
- v-on:mouseout="mouseoutActive(item)"
- v-on:mouseover="mouseoverActive(item)"
- v-for="(item,i) in extractChoice"
- :key="i"
- @click="extractItem"
- >
- <div class="item">
- <img v-show="!item.isHover" :src="require(`./../../assets/images/${item.img}`)" alt />
- <img v-show="item.isHover" :src="require(`./../../assets/images/${item.hoverImg}`)" alt />
- <div>{{item.name}}</div>
- </div>
- </li>
- </ul>
- <a-popover trigger="click" placement="rightBottom">
- <template slot="content">
- <itemTree></itemTree>
- </template>
- <div class="bottom-item">
- <a-icon type="ellipsis" />
- <span>选择原件</span>
- </div>
- </a-popover>
- <!-- 打开弹窗 -->
- <transition name="fade">
- <div class="drawer-model" id="drawer-model" v-show="visible">
- <a-drawer
- placement="left"
- :closable="false"
- :visible="visible"
- :wrap-style="{ position: 'absolute',}"
- @close="onClose"
- :getContainer="false"
- >
- <div class="drawer-model-body" v-if="!isExtract">
- <div class="btn-list">
- <a-button-group>
- <a-button type="primary">绘制</a-button>
- <a-button>点选</a-button>
- </a-button-group>
- </div>
- <div class="list" v-for="(item,index) in itemList" :key="index">
- <div class="title">{{item.Name}}</div>
- <ul class="example">
- <li
- @click="getexampleItem(items)"
- v-for="(items,indexs) in item.GraphElements"
- :key="indexs"
- >
- <img
- :class="['item',`item-${items.Type}`]"
- :src="'/serve/topology-wanda/Picture/query/'+ items.Url"
- alt
- />
- <div class="text">{{items.Name}}</div>
- </li>
- </ul>
- </div>
- </div>
- <div v-else class="drawer-model-body drawer-model-body-extract">
- <a-table :columns="columns" :data-source="data" size="small" :pagination="false">
- <a-tag
- slot="address"
- slot-scope="text, record, index"
- :color="'geekblue'"
- @click="pickUp(text, record, index)"
- >{{ text }}</a-tag>
- </a-table>
- </div>
- </a-drawer>
- </div>
- </transition>
- </div>
- </template>
- <script>
- import itemTree from "./leftbar_components/itemTree";
- import { queryByGroup } from "@/api/editer.js";
- import bus from "@/bus";
- import { queryGroup } from "@/api/editer.js";
- import { mapState, mapActions } from "vuex";
- const columns = [
- {
- title: "名称",
- dataIndex: "name"
- },
- {
- title: "图例",
- dataIndex: "age"
- },
- {
- title: "数量",
- dataIndex: "number"
- },
- {
- title: "操作",
- dataIndex: "address",
- scopedSlots: { customRender: "address" }
- }
- ];
- const data = [
- {
- key: "1",
- name: "电梯",
- age: 32,
- number: 123,
- address: "提取"
- },
- {
- key: "2",
- name: "防火风区",
- age: 42,
- number: 123,
- address: "提取"
- }
- ];
- export default {
- components: { itemTree },
- props: {
- cmdType: {
- type: String,
- default: "",
- required: false
- }
- },
- data() {
- return {
-
- baseChoice: [
- {
- img: "t-select.png",
- hoverImg: "t-select-hover.png",
- isHover: true,
- isChoice: true,
- name: "选择",
- type: "choice"
- },
- {
- img: "t-line.png",
- hoverImg: "t-line-hover.png",
- isHover: false,
- isChoice: false,
- name: "画线",
- type: "baseLine"
- },
- {
- img: "t-text.png",
- hoverImg: "t-text-hover.png",
- isHover: false,
- isChoice: false,
- name: "画文字",
- type: "baseText"
- },
- {
- img: "t-img.png",
- hoverImg: "t-img-hover.png",
- isHover: false,
- isChoice: false,
- name: "画图片",
- type: "baseImage"
- }
- ],
-
- systemChoice: [
- {
- img: "t-position.png",
- hoverImg: "t-position-hover.png",
- isHover: false,
- isChoice: false,
- name: "位置区域",
- type: "Zone"
- },
- {
- img: "t-equipment.png",
- hoverImg: "t-equipment-hover.png",
- isHover: false,
- isChoice: false,
- name: "设备设施",
- type: "Image"
- },
- {
- img: "t-papeline.png",
- hoverImg: "t-papeline-hover.png",
- isHover: false,
- isChoice: false,
- name: "管线桥架",
- type: "Line"
- }
- ],
- visible: false,
-
- extractChoice: [
- {
- img: "t-slices.png",
- hoverImg: "t-slices-hover.png",
- isHover: false,
- name: "提取"
- }
- ],
- isExtract: false,
- data,
- columns,
- itemList: [],
- categoryId: ""
- };
- },
- computed: {
- ...mapState({
- GraphCategoryIds: "GraphCategoryIds",
- TypeIdToGraphElement: "TypeIdToGraphElement"
- })
- },
- methods: {
-
- mouseoverActive(item) {
- item.isHover = true;
- },
- mouseoutActive(item) {
- item.isHover = false;
- },
- toolActionClick(item) {
- this.visible = false;
- this.baseChoice.forEach(item => {
- item.isChoice = false;
- });
- this.systemChoice.forEach(a => {
- a.isChoice = false;
- });
- item.isChoice = true;
- this.$emit("setCmdType", item.type);
- },
- showDrawer(item) {
- this.isExtract = false;
- if (item.isChoice) {
- this.systemChoice.forEach(a => {
- a.isChoice = false;
- });
- this.visible = false;
- } else {
- this.systemChoice.forEach(a => {
- a.isChoice = false;
- });
- item.isChoice = true;
- if (this.visible) {
- this.visible = false;
- setTimeout(() => {
- this.visible = true;
- }, 300);
- } else {
- this.visible = true;
- }
-
-
- const arr = {
- GraphCategoryIds: this.categoryId,
-
- Type: item.type
- };
- queryGroup(arr).then(res => {
- this.itemList = res.Data;
- });
- }
- },
- onClose() {
- this.visible = false;
- this.systemChoice.forEach(a => {
- a.isChoice = false;
- });
- },
- getexampleItem(item) {
- this.visible = false;
- this.$emit("toolActionClick", item);
- },
-
- extractItem() {
-
- this.isExtract = true;
- this.visible = !this.visible;
- bus.$emit("extractItem");
- },
- getBus() {
- bus.$on("exportItem", data => {
- this.data = data.map(t => {
- (t.name = this.TypeIdToGraphElement[t.key].Name),
- (t.properties = this.TypeIdToGraphElement[t.key]);
- return t;
- });
- });
- },
- pickUp(text, record, index) {
- bus.$emit("exportByKey", record);
- }
- },
- watch: {
- cmdType(cmd) {
- this.baseChoice.forEach(item => {
- item.isChoice = false;
- if (item.cmd == cmd) {
- item.isChoice = true;
- }
- });
- }
- },
- mounted() {
- const ele = document.getElementById("drawer-model");
- ele.style.width = document.body.offsetWidth - 70 + "px";
- this.getBus();
- console.log(this.GraphCategoryIds);
- },
- created() {
- const href = window.location.href;
-
-
-
- let params = href.split("?")[1];
- if (!params) {
-
- return false;
- }
- params = decodeURIComponent(params);
-
- const paramsArr = params.split("&");
- console.log("paramsArr", paramsArr);
- const obj = {};
- paramsArr.map(item => {
- const arr = item.split("=");
- obj[arr[0]] = arr[1];
- });
- this.categoryId = obj.categoryId;
- }
- };
- </script>
- <style lang="less">
- #left_toolbar {
- min-width: 68px;
- height: 100%;
- background: rgba(255, 255, 255, 1);
- box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.11);
- padding: 0 0 12px 0;
- box-sizing: border-box;
- position: relative;
- ul,
- li {
- padding: 0;
- margin: 0;
- list-style: none;
- }
- .list-1 {
- padding-top: 1px;
- box-sizing: border-box;
- border-bottom: 1px solid #c3c7cb;
- li {
- width: 64px;
- min-height: 42px;
- margin: 6px auto;
- display: flex;
- align-items: center;
- justify-content: center;
- position: relative;
- .item {
- margin: 0 auto;
- display: flex;
- flex-direction: column;
- position: relative;
- cursor: pointer;
- font-size: 12px;
- img {
- width: 25px;
- height: 25px;
- }
- }
- &:hover {
- background: #e1f2ff;
- border-radius: 8px;
- opacity: 0.89;
- color: #fff;
- }
- .tooltip {
- position: absolute;
- left: 90px;
- top: 0;
- }
- }
- }
- .list-2 {
- padding-top: 1px;
- box-sizing: border-box;
- li {
- width: 64px;
- min-height: 42px;
- margin: 6px auto;
- display: flex;
- align-items: center;
- justify-content: center;
- position: relative;
- .item {
- margin: 0 auto;
- height: 54px;
- display: flex;
- flex-direction: column;
- position: relative;
- cursor: pointer;
- align-items: center;
- font-size: 12px;
- img {
- width: 25px;
- height: 25px;
- margin-top: 6px;
- }
- }
- &:hover {
- background: #e1f2ff;
- border-radius: 8px;
- opacity: 0.89;
- color: #0091ff;
- }
- .tooltip {
- position: absolute;
- left: 90px;
- top: 0;
- }
- }
- }
- .bottom-item {
- position: absolute;
- font-size: 18px;
- width: 100%;
- bottom: 12px;
- height: 54px;
- left: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-direction: column;
- cursor: pointer;
- span {
- font-size: 12px;
- }
- &:hover {
- background: #e1f2ff;
- border-radius: 8px;
- opacity: 0.89;
- color: #0091ff;
- height: 54px;
- }
- }
- .actives {
- background: #e1f2ff;
- border-radius: 8px;
- opacity: 0.89;
- color: #0091ff;
- }
- .fade-enter,
- .fade-leave-to {
- transition: all 0.3s ease;
- }
- .drawer-model {
- position: absolute;
- left: 70px;
- top: 0;
- overflow: hidden;
- width: 100%;
- height: 100%;
- .drawer-model-body {
- width: 100%;
- .btn-list {
- margin: 0 auto;
- }
- .list {
- .title {
- font-size: 18px;
- border-left: 4px solid #0091ff;
- margin-top: 20px;
- }
- .example {
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- li {
- width: 66px;
- height: 60px;
- display: flex;
- justify-content: center;
- flex-direction: column;
- cursor: pointer;
- &:hover {
- background: #e1f2ff;
- }
- .item {
- width: 54px;
- height: 32px;
- margin: 0 auto;
- }
- .item-Image {
- width: 28px;
- height: 28px;
- margin: 0 auto;
- }
- .item-Line {
- width: 40px;
- height: 30px;
- margin: 0 auto;
- }
- .item-pip {
- width: 28px;
- height: 16px;
- border: #0091ff solid 1px;
- margin: 0 auto;
- background: #fff;
- }
- .text {
- font-size: 12px;
- margin: 0 auto;
- }
- }
- }
- }
- }
- .drawer-model-body-extract {
- padding: 0;
- position: absolute;
- left: 0;
- right: 0;
- .ant-table-small {
- border: none !important;
- }
- }
- }
- .border-top {
- border-top: 1px solid #c3c7cb;
- }
- }
- </style>
|