123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669 |
- <template>
- <div id="attr-select">
- <!--选中-->
- <div class="attr-select" v-if="type==='baseLine'">
- <span class="grid-title">外观</span>
- <div class="row">
- <div class="row-tit">线宽</div>
- <div class="grid-content">
- <a-input-number
- v-model="lineWidth"
- :min="1"
- @change="changeLineWidth"
- style="width: 168px"
- />
- </div>
- <div class="color-choice">
- <swatches v-model="borderColor" popover-x="left" @close="changeBorderColor" />
- </div>
- </div>
- <div class="row">
- <div class="row-tit">线型</div>
- <a-select
- style="width: 208px"
- v-model="borderStyle"
- :default-value="borderLineOption[0].id"
- @change="changeBorder"
- >
- <a-select-option
- v-for="item in borderLineOption"
- :key="item.id"
- :label="item.src"
- :value="item.id"
- >
- <img :src="item.src" alt />
- </a-select-option>
- </a-select>
- </div>
- </div>
- <!--文字内容-->
- <div class="attr-select" v-if="type==='baseText'">
- <span class="grid-title">文字内容</span>
- <div class="grid-content">
- <a-textarea
- placeholder="请在此处输入文字!"
- v-model="textMsg"
- allow-clear
- @change="changeTextArea"
- :rows="4"
- />
- </div>
- <span class="grid-title">外观</span>
- <div class="row">
- <div class="row-tit">字号</div>
- <div class="grid-content">
- <a-input-number v-model="fontSize" :min="1" @change="changeFont" style="width: 168px" />
- </div>
- <div class="color-choice">
- <swatches v-model="fontColor" popover-x="left" @close="changeFontColor" />
- </div>
- </div>
- <div class="row">
- <div class="row-tit">背景色</div>
- <div class="color-choice">
- <swatches v-model="backColor" :swatches="swatches" popover-x="left" @close="changebackColor" />
- </div>
- </div>
- </div>
- <!--图片-->
- <div class="attr-select" v-if="type=='baseImage'">
- <span class="grid-title">文字内容</span>
- <section class="grid">
- <div class="grid-content">
- <a-upload-dragger
- name="file"
- :customRequest="customRequest"
- :showUploadList="false"
- action="https://jsonplaceholder.typicode.com/posts/"
- @change="changeImage"
- >
- <p class="icon-image">
- <a-icon type="cloud-upload" />
- </p>
- <p class="ant-upload-text">将图片拖动到这里替换</p>
- <p class="ant-upload-hint">本地上传</p>
- </a-upload-dragger>
- </div>
- </section>
- <span class="grid-title">外观</span>
- <div class="row">
- <div class="row-tit">边框</div>
- <div class="grid-content">
- <a-input-number
- v-model="lineWidth"
- :min="1"
- @change="changeLineWidth"
- style="width: 168px"
- />
- </div>
- <div class="color-choice">
- <swatches v-model="color" popover-x="left" />
- </div>
- </div>
- </div>
- <!--针对“设备/位置/管线/分区”属性示例-->
- <div class="attr-select" v-show="type =='Image'|| type == 'Line' || type == 'Zone'">
- <div v-if="type =='Image'|| type == 'Line'">
- <div class="row">
- <div class="row-tit">名称显示</div>
- <a-button type="link" class="edit-option-btn" @click="OpenEditStatus">{{editStatus[type]}}</a-button>
- </div>
- <div class="row">
- <a-input v-model="lengedName" @change="changeLengedName" />
- </div>
- <div class="row">
- <div class="row-tit">字号</div>
- <div class="grid-content">
- <a-input-number v-model="fontSize" :min="1" @change="changeFont" style="width: 168px" />
- </div>
- <div class="color-choice">
- <swatches v-model="fontColor" @close="changeFontColor" popover-x="left" />
- </div>
- </div>
- <!-- 当为设备状态时 -->
- <div class="row" v-if="type =='Image'">
- <div class="row-tit">数量</div>
- <div class="grid-content">
- <a-input-number
- v-model="imageNum"
- :min="attrCards.length==imageNum?imageNum:1"
- @change="changeImageNum"
- style="width: 208px"
- />
- </div>
- </div>
- <!-- 当为管道状态时 -->
- <div class="row" v-if="type =='Line'">
- <div class="row-tit">线宽</div>
- <div class="grid-content">
- <a-input-number
- v-model="lineWidth"
- :min="1"
- @change="changeLineWidth"
- style="width: 208px"
- />
- </div>
- </div>
- </div>
- <div v-if="type == 'Zone'">
- <div v-if="SubType=='FHFQ'">
- <!-- 防火分区 -->
- <div class="row-tit">颜色</div>
- <div class="row">
- <swatches @input="changefillColor" :swatches="swatchess" v-model="fillColor" inline></swatches>
- </div>
- <div class="row">
- <div class="row-tit">名称显示</div>
- <a-button
- type="link"
- class="edit-option-btn"
- @click="OpenEditStatus"
- >{{editStatus[type]}}</a-button>
- </div>
- <div class="row">
- <a-input v-model="lengedName" @change="changeLengedName" />
- </div>
- <div class="row">
- <div class="row-tit">字号</div>
- <div class="grid-content">
- <a-input-number
- v-model="fontSize"
- :min="1"
- @change="changeFont"
- style="width: 168px"
- />
- </div>
- <div class="color-choice">
- <swatches v-model="fontColor" @close="changeFontColor" popover-x="left" />
- </div>
- </div>
- </div>
- <div v-if="SubType=='SCPZ'">
- <!-- 石材铺装 -->
- <div class="row">
- <div class="row-tit">图例说明</div>
- <a-button type="link" class="edit-option-btn" @click="OpenEditStatus">编辑区域</a-button>
- </div>
- <div class="row">
- <a-textarea @change="changeitemExplain" v-model="itemExplain" :auto-size="{ minRows: 4, maxRows: 6 }" />
- </div>
- <div class="row">
- <div class="row-tit">描边</div>
- <div class="grid-content">
- <a-input-number
- v-model="lineWidth"
- :min="1"
- @change="changeLineWidth"
- style="width: 168px"
- />
- </div>
- <div class="color-choice">
- <swatches v-model="borderColor" @close="changeBorderColor" popover-x="left" />
- </div>
- </div>
- <div class="row">
- <div class="row-tit">填充</div>
- <div class="color-choice">
- <swatches v-model="fillColor" @close="changefillColor" popover-x="left" />
- </div>
- </div>
- </div>
- <div v-if="!SubType">
- <!-- 普通分区 -->
- <div class="row">
- <div class="row-tit">名称显示</div>
- <a-button
- type="link"
- class="edit-option-btn"
- @click="OpenEditStatus"
- >{{editStatus[type]}}</a-button>
- </div>
- <div class="row">
- <a-input v-model="lengedName" @change="changeLengedName" />
- </div>
- <div class="row">
- <div class="row-tit">字号</div>
- <div class="grid-content">
- <a-input-number
- v-model="fontSize"
- :min="1"
- @change="changeFont"
- style="width: 168px"
- />
- </div>
- <div class="color-choice">
- <swatches v-model="fontColor" @close="changeFontColor" popover-x="left" />
- </div>
- </div>
- </div>
- </div>
- </div>
- <!--设备/工程信息化ID/工程信息化中的位置类型-->
- <div
- class="attr-select attr-select-bottom"
- v-if="type =='Zone' || type =='Image'||type == 'Line'"
- >
- <a-spin :spinning="spinning">
- <div class="row">
- <span>{{type =='Zone'?`工程信息化中的位置类型`:'工程信息化中的设备类型'}}</span>
- <a-button type="link" class="edit-option-btn" @click="handleEdit">选择编辑</a-button>
- </div>
- <div class="grid-content">
- <a-card class="attr-card" v-for="(item,index) in attrCards" :key="index">{{item.sbjc ||item.wzjc}}</a-card>
- </div>
- </a-spin>
- </div>
- <!-- 快捷操作提示-->
- <div style="position: fixed;bottom: 0;width: 280px;" class="key-boards">
- <a-collapse :bordered="false" expand-icon-position="right">
- <template #expandIcon="props">
- <a-icon type="caret-up" :rotate="props.isActive ? 180 : 0" />
- </template>
- <a-collapse-panel key="1" :style="customStyle">
- <template slot="header">
- <div style="font-size: 12px;color: #8D9399;">
- <a-icon type="exclamation-circle" />
- <span style="margin-left: 5px;">键盘操作提示</span>
- </div>
- </template>
- <p
- v-for="item in keyboardOperation"
- :key="item.value"
- style="display: flex;margin-top: 13px;"
- >
- <span>{{item.value}}</span>
- <span class="key-board">{{item.keys}}</span>
- <span v-if="item.events" style="margin: 0 5px;">+ <img style="width:13px;height:18px;" src="./../../assets/images/shubiao.png" alt=""></span>
- <span> {{item.events}}</span>
- </p>
- </a-collapse-panel>
- </a-collapse>
- </div>
- <editDialog ref="dialog" :attrCards="attrCards" :typeEdit="type" :getmajorId="getmajorId" :sysNum="imageNum" :key="new Date().getTime()"/>
- <!-- <editDialog ref="dialog" :typeEdit="2" :getmajorId="'1001'" :sysNum="5" />-->
- </div>
- </template>
- <script>
- import editDialog from "./edit-dialog";
- import Swatches from "vue-swatches";
- import bus from "@/bus";
- import "vue-swatches/dist/vue-swatches.css";
- import { SLineStyle } from "@saga-web/graph/lib";
- import { uploadImg, queryGlsmsLocation,queryGlsmsAsset } from "@/api/editer.js";
- import {getUrlMsg} from '@/components/urlMsg.js'
- export default {
- name: "attr_select",
- props: ["type", "focusItemList"],
- components: { editDialog, Swatches },
- data() {
- return {
- precisionList: [{ value: 10 }, { value: 20 }, { value: 30 }],
- precision: true,
- customStyle:
- "background: #fff;overflow: hidden; box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.11);border:0",
- keyboardOperation: [
- { value: "拖动画布:", keys: "Space", events: "Click" },
- { value: "加选对象:", keys: "Ctrl", events: "Press" },
- { value: "确认操作:", keys: "Enter" },
- { value: "取消对象:", keys: "Enter" }
- ],
- numberValue: 3,
- fontSize: 12, //字体大小
- lineWidth: 0,
- textMsg: "", //
- color: "#1CA085",
- fontColor: "#1CA085", //文字颜色
- borderColor: "", // 边框颜色 直线,折线,多边形等
- backColor: "", //背景色 用于text文字
- borderStyle: "solid",
- borderLineOption: [
- {
- id: "solid",
- src: require("@/assets/images/1pxline.jpg")
- },
- {
- id: "dashed",
- src: require("@/assets/images/dashedLine.jpg")
- },
- {
- id: "dotted",
- src: require("@/assets/images/dotLine.jpg")
- }
- ],
- linepxOption: [
- {
- id: 1,
- src: require("@/assets/images/1pxline.jpg")
- },
- {
- id: 2,
- src: require("@/assets/images/2pxline.jpg")
- },
- {
- id: 3,
- src: require("@/assets/images/3pxline.jpg")
- }
- ],
- editStatus: {
- Image: "编辑设备",
- Line: "管道编辑",
- Zone: "编辑区域"
- },
- swatchess: ["#69C5FC", "#656EDF", "#58AF6F", "#2D8FAA"],
- swatches: [
- "#00000000",
- "#1FBC9C",
- "#1CA085",
- "#2ECC70",
- "#27AF60",
- "#3398DB",
- "#2980B9",
- "#A463BF",
- "#8E43AD",
- "#3D556E",
- "#222F3D",
- ],
- lengedName: "", // 图例名称
- imageNum: 1, //设备数量
- fillColor: "", //修改填充色 (主要针对防火风区以及石材铺装)
- SubType: "", //空间类型,区分石材铺装
- itemExplain:'', //图例说明 只针对石材铺装
- attrCards:[],
- spinning:false,
- getmajorId:''
- };
- },
- methods: {
- onChange(e) {
- this.precision = e.target.checked === true ? false : true;
- },
- changeBorder(value) {
- bus.$emit("changeBorder", value);
- },
- changeNumber() {
- bus.$emit("changeFont", this.fontSize);
- },
- // 改变字体大小
- changeFont() {
- bus.$emit("changeFont", this.fontSize);
- },
- // 改变线宽
- changeLineWidth() {
- bus.$emit("changeLineWidth", this.lineWidth);
- },
- // 改变文案
- changeTextArea() {
- bus.$emit("changeText", this.textMsg);
- },
- // 改变线的颜色
- changeBorderColor() {
- if (this.borderColor) {
- bus.$emit("changeBorderColor", this.borderColor);
- }
- },
- // 改变字体颜色
- changeFontColor(color) {
- if (color) {
- bus.$emit("changeFontColor", color);
- }
- },
- changebackColor(color) {
- if (color) {
- bus.$emit("changebackColor", color);
- }
- },
- customRequest(info) {
- const formData = new FormData();
- formData.append("file", info.file);
- const postParams = formData;
- uploadImg({ postParams }).then(res => {
- if (res.Result == "success") {
- bus.$emit("upadataImageUrl", res.EntityList[0]);
- this.$message.success(
- `${info.file.name} file uploaded successfully.`
- );
- } else {
- this.$message.error(`${info.file.name} file upload failed.`);
- }
- });
- },
- //更改图例名称
- changeLengedName() {
- bus.$emit("changeLengedName", this.lengedName);
- },
- changeImage(info) {
- const status = info.file.status;
- console.log(status);
- if (status !== "uploading") {
- console.log(info.file, info.fileList);
- }
- if (status === "done") {
- this.$message.success(`${info.file.name} file uploaded successfully.`);
- } else if (status === "error") {
- this.$message.error(`${info.file.name} file upload failed.`);
- }
- },
- handleEdit() {
- this.$refs.dialog.showModal();
- },
- // 修改设备数量
- changeImageNum() {
- if (!this.imageNum) {
- this.imageNum = 1;
- }
- bus.$emit("changeImageNum", this.imageNum);
- },
- changefillColor() {
- if (this.fillColor) {
- bus.$emit("changefillColor", this.fillColor);
- }
- },
- //设置缩小item为编辑状态
- OpenEditStatus() {
- bus.$emit("OpenEditStatus");
- },
- // 编辑图例说明
- changeitemExplain(){
- bus.$emit("changeitemExplain",this.itemExplain);
- },
- // 更改工程信息化数据
- changeAttachObjectIds(arr){
- bus.$emit('changeAttachObjectIds',arr)
- }
- },
- watch: {
- focusItemList: function(newval) {
- console.log('xxxxxxxxxxxxxxx',newval)
- const Item = newval.itemList[0];
- this.getmajorId = Item.data.Properties.GraphCategoryId;
- if (Item.data && Item.data.SubType) {
- this.SubType = Item.data.SubType;
- }else{
- this.SubType = '';
- }
- if (newval.itemList.length == 1) {
- if (newval.itemType == "baseText") {
- this.textMsg = Item.text;
- this.fontSize = Item.font.size;
- this.fontColor = Item.color.value;
- this.backColor = Item.backgroundColor.value;
- } else if (newval.itemType == "baseLine") {
- this.lineWidth = Item.lineWidth;
- this.borderColor = Item.strokeColor.value;
- if (Item.lineStyle == SLineStyle.Soild) {
- this.borderStyle = "solid";
- } else if (Item.lineStyle == SLineStyle.Dashed) {
- this.borderStyle = "dashed";
- } else if (Item.lineStyle == SLineStyle.Dotted) {
- this.borderStyle = "dotted";
- }
- } else if (
- newval.itemType == "Zone" ||
- newval.itemType == "Line" ||
- newval.itemType == "Image"
- ) {
- this.lengedName = Item.data.Name;
- this.itemExplain = '';
- if(Item.data.Properties.ItemExplain){
- this.itemExplain = Item.data.Properties.ItemExplain ? Item.data.Properties.ItemExplain : '';
- }
- if (newval.itemType == "Image") {
- this.imageNum = Item.num;
- this.color = Item.color.value;
- this.fontSize = Item.font.size;
- } else if (newval.itemType == "Line") {
- this.color = Item.color.value;
- this.fillColor = Item.fillColor.value;
- this.borderColor = Item.strokeColor.value;
- this.lineWidth = Item.lineWidth;
- }
- }
- }
- const location =[];
- let params ={};
- Item.data.AttachObjectIds.map(item=>{
- location.push(item.id)
- })
- if(newval.itemType == 'Zone'){
- this.spinning = true;
- if(location.length){
- params = {locationList:location}
- }else{
- params = {locationList:['']};
- }
- queryGlsmsLocation({plazaId: getUrlMsg().projectId},params).then(res=>{
- this.spinning = false;
- if(res.data.result =='success'){
- this.attrCards = res.data.data||[];
- }else{
- this.$message.error('工程信息化中的位置信息获取失败')
- }
- })
- }else if(newval.itemType == 'Image'){
- this.spinning = true;
- if(location.length){
- params = {assetnumList:location}
- }else{
- params = {assetnumList:['']};
- }
- queryGlsmsAsset({plazaId: getUrlMsg().projectId},params).then(res=>{
- this.spinning = false;
- if(res.data.result =='success'){
- this.attrCards = res.data.data||[];
- }else{
- this.$message.error('工程信息化中的设备信息获取失败')
- }
- })
- }
- }
- }
- };
- </script>
- <style scoped lang="less">
- /deep/ .ant-spin-nested-loading{
- height: 100% !important;
- .ant-spin-container{
- height: 100% !important;
- }
- }
- .attr-select {
- padding: 12px 16px;
- box-sizing: border-box;
- .grid-title {
- font-size: 12px;
- color: #8d9399;
- }
- .row {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 12px;
- .color-choice {
- & /deep/ .vue-swatches__trigger {
- width: 26px !important;
- height: 26px !important;
- border-radius: 0px !important;
- }
- }
- .row-tit {
- color: #1f2429;
- font-size: 14px;
- }
- }
- .grid {
- margin: 10px 15px;
- .grid-title {
- font-size: 12px;
- color: #8d9399;
- }
- }
- .grid-content {
- // margin-top: 10px;
- position: relative;
- }
- .icon-image {
- font-size: 25px;
- }
- .edit-option-btn {
- float: right;
- margin-top: -5px;
- }
- .attr-card {
- width: 250px;
- margin-bottom: 10px;
- white-space: normal;
- box-shadow: 0px 2px 6px 0px rgba(31, 36, 41, 0.05);
- border-radius: 4px;
- }
- .ant-upload.ant-upload-drag p.ant-upload-text {
- font-size: 14px;
- color: #c3c7cb;
- }
- .ant-upload.ant-upload-drag p.ant-upload-hint {
- color: #0091ff;
- }
- }
- .key-boards {
- .key-board {
- width: 52px;
- height: 24px;
- border-radius: 3px;
- border: 1px solid rgba(195, 199, 203, 1);
- font-size: 14px;
- color: #646a73;
- text-align: center;
- }
- /deep/ .ant-collapse-content {
- border-top: 1px solid #eff0f1;
- }
- }
- #attr-select {
- width: 100%;
- height: 100%;
- .attr-select-bottom {
- height: 100%;
- width: 100%;
- position: absolute;
- overflow-y: auto;
- padding-bottom: 400px;
- }
- }
- </style>
|