123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <template>
- <div id="top_toolbar">
- <!-- 顶部编辑器 -->
- <div class="tit">
- <a-icon type="left" />消防系统-4F
- </div>
- <div class="tool">
- <ul>
- <li @click="saveMsg">
- <img class="lock" :src="require(`./../../assets/images/t-save.png`)" alt />
- <span>保存</span>
- </li>
- <li>
- <a-icon type="edit" />
- <span>撤销</span>
- </li>
- <li>
- <a-icon type="edit" />
- <span>重做</span>
- </li>
- <li class="zoom-window">
- <div>
- <img class="lock" :src="require(`./../../assets/images/缩小.png`)" alt />
- <span class="percentage">100%</span>
- <img class="lock" :src="require(`./../../assets/images/放大 amplification.png`)" alt />
- </div>
- <span>缩放窗口</span>
- </li>
- <li>
- <a-dropdown :trigger="['click']">
- <div class="ant-dropdown-link dropdown-flex" @click="e => e.preventDefault()">
- <div>
- <img class="lock" :src="require(`./../../assets/images/t-format.png`)" alt />
- <div>对齐</div>
- </div>
- <a-icon type="caret-down" class="down-icon" />
- </div>
- <a-menu slot="overlay">
- <a-menu-item
- v-for="item in alignmentOptions"
- :key="item.value"
- @click="changeAlignItem(item.value)"
- >
- <img
- style="width: 16px;margin-right: 5px;"
- :src="require(`./../../assets/images/`+item.img+`.png`)"
- alt
- />
- <span>{{item.label}}</span>
- </a-menu-item>
- </a-menu>
- </a-dropdown>
- </li>
- <!-- <li>
- <a-icon type="edit" />
- <span>图层</span>
- </li>
- <li>
- <a-icon type="edit" />
- <span>组合</span>
- </li>
- <li>
- <a-icon type="edit" />
- <span>打散</span>
- </li>-->
- <li @click="lockItem">
- <Icon :name="!isLock?'lock':'unlock'" />
- <span>{{isLock?"锁定":"解锁"}}</span>
- </li>
- <li @click="deleteItem">
- <a-icon type="delete" />
- <span>删除</span>
- </li>
- </ul>
- </div>
- <div class="btn-list">
- <div class="btn-list-item">
- <Icon name="release" />
- <span>发布</span>
- </div>
- </div>
- </div>
- </template>
- <script>
- import bus from "@/bus";
- import { SGraphLayoutType } from "@saga-web/graph/lib";
- export default {
- data() {
- return {
- isLock: false, //是否锁定
- focusItem: null,
- alignmentOptions: [
- //对齐数据
- {
- value: SGraphLayoutType.Left,
- label: "左对齐",
- img: "t-left"
- },
- {
- value: SGraphLayoutType.Right,
- label: "右对齐",
- img: "t-right"
- },
- {
- value: SGraphLayoutType.Top,
- label: "顶对齐",
- img: "t-top"
- },
- {
- value: SGraphLayoutType.Bottom,
- label: "底对齐",
- img: "t-bottom"
- },
- {
- value: SGraphLayoutType.Center,
- label: "水平居中对齐",
- img: "t-center"
- },
- {
- value: SGraphLayoutType.Middle,
- label: "垂直居中对齐",
- img: "t-topandbottm"
- },
- {
- value: SGraphLayoutType.Vertical,
- label: "垂直分布",
- img: "t-vertical"
- },
- {
- value: SGraphLayoutType.Horizontal,
- label: "水平分布",
- img: "t-level"
- }
- ]
- };
- },
- methods: {
- FocusItemChanged(itemMsg) {
- this.focusItem = null;
- if (itemMsg.itemList.length == 1) {
- this.isLock = itemMsg.itemList[0].moveable;
- this.focusItem = itemMsg.itemList[0];
- }
- },
- lockItem() {
- if (this.focusItem) {
- this.isLock = !this.isLock;
- this.focusItem.moveable = this.isLock;
- } else {
- this.$message.error("请选择指定对象!", 1);
- }
- },
- saveMsg() {
- // this.$message.success("保存成功!", 1);
- bus.$emit("saveMsgItem");
- },
- // 删除item
- deleteItem() {
- console.log(this.focusItem);
- if (this.focusItem) {
- bus.$emit("deleiteItem");
- this.focusItem = null;
- this.$message.success("删除成功", 1);
- } else {
- this.$message.error("请选择指定对象!", 1);
- }
- },
- // 对齐item
- changeAlignItem(val) {
- bus.$emit("changeAlignItem", val);
- }
- },
- mounted() {
- bus.$on("FocusItemChanged", itemMsg => {
- console.log("itemMsg", itemMsg);
- this.FocusItemChanged(itemMsg);
- });
- }
- };
- </script>
- <style lang="less" scoped>
- ul,
- li {
- /*margin: 0;*/
- /*padding: 0;*/
- list-style: none;
- }
- #top_toolbar {
- width: 100%;
- height: 60px;
- background: rgba(255, 255, 255, 1);
- box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 24px 0 24px;
- .tit {
- // flex: 1;
- font-size: 18px;
- font-weight: bold;
- color: #1f2429;
- }
- .tool {
- ul {
- display: flex;
- li {
- display: flex;
- justify-content: center;
- flex-direction: column;
- /*width: 62px;*/
- padding: 0 7px;
- margin-left: 7px;
- font-size: 12px;
- align-items: center;
- text-align: center;
- cursor: pointer;
- img {
- width: 16px;
- height: 16px;
- }
- .percentage {
- border-bottom: 1px solid #c3c7cb;
- margin: 0 13px;
- font-size: 14px;
- }
- .dropdown-flex {
- display: flex;
- align-items: center;
- .down-icon {
- margin-left: 12px;
- }
- }
- }
- li:hover {
- background: #f5f6f7;
- }
- .zoom-window {
- border-left: 1px solid #8d9399;
- border-right: 1px solid #8d9399;
- }
- }
- }
- .btn-list {
- display: flex;
- align-items: center;
- justify-content: center;
- width: 72px;
- .btn-list-item {
- display: flex;
- justify-content: center;
- flex-direction: column;
- span {
- font-size: 12px;
- }
- cursor: pointer;
- }
- }
- }
- /deep/ .ant-dropdown-menu-item {
- display: flex;
- align-items: center;
- }
- </style>
|