12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358 |
- <template>
- <div id="divGraphEdit" v-loading.fullscreen.lock="fullscreenLoading">
- <div class="firstRow">
- <div class="firstOperDivContainer">
- <img
- class="imgBar"
- src="../../assets/images/systemGraph/editLogo.svg"
- />
- <span class="headerTitle">系统图编辑器</span>
- <div class="operBtnDiv" v-if="operState === 0">
-
- <span @click="intoEditState">编辑系统图</span>
- <span
- v-if="(graphInfo.extraProps || {}).state == 'Draft'"
- @click="publishGraph"
- >上架系统图</span
- >
- <span
- v-if="(graphInfo.extraProps || {}).state == 'Publish'"
- @click="draftGraph"
- >下架系统图</span
- >
- </div>
- <div class="operBtnDiv" v-if="operState === 1">
- <span @click="saveGraph">保存图纸</span>
- <span @click="cancelClick">放弃编辑</span>
- </div>
- <span class="delBtn" @click="delGraph">删除图纸</span>
- </div>
- <div class="secondOperDivContainer">
- <img
- @click="toggleLeft"
- class="imgBar"
- src="../../assets/images/systemGraph/barController.svg"
- />
- <span
- class="sanjiaoBar"
- :class="{
- 'el-icon-caret-bottom': isVisibleLeft,
- 'el-icon-caret-top': !isVisibleLeft,
- }"
- @click="toggleLeft"
- ></span>
- <hr class="splitLine" />
- <el-select
- v-model="selectScale"
- value-key="value"
- @change="selScaleChange"
- >
- <el-option
- v-for="item in scaleArr"
- :key="item.value"
- :label="item.name"
- :value="item"
- >
- </el-option>
- </el-select>
- <span class="el-icon-zoom-in zoomin" @click="scaleZoomin"></span>
- <span class="el-icon-zoom-out zoomout" @click="scaleZoomout"></span>
-
- <span class="resetBtn" v-if="operState == 1" @click="resetGraph"
- >重置为自动出图样式</span
- >
- </div>
- </div>
- <div class="secondRow">
- <div
- class="graphInfoContainer"
- v-if="(operState === 0 || operState === 1) && isVisibleLeft"
- >
- <div class="graphInfoFirst">
- <span class="graphInfoName">系统图名称</span>
- <span
- class="graphInfoFirstEdit"
- @click="intoGraphNameEditState"
- v-if="!isEditGraphName"
- >编辑</span
- >
- <span
- class="graphInfoFirstEdit"
- @click="saveGraphName"
- v-if="isEditGraphName"
- >保存</span
- >
- <span
- class="graphInfoFirstEdit"
- @click="cancelSaveGraphName"
- v-if="isEditGraphName"
- >取消</span
- >
- </div>
- <div class="graphInfoContent">
- <span v-text="graphInfo.name" v-if="!isEditGraphName"
- >高压系统1#系统图</span
- >
- <el-input
- v-model="graphInfo.name"
- v-if="isEditGraphName"
- @change="graphNameChange"
- ></el-input>
- </div>
- <div class="graphInfoName">
- <span>系统图类型</span>
- </div>
- <div class="graphInfoContent">
- <span v-text="graphInfo.graphTypeName">高压配电</span>
- </div>
- <div class="graphInfoName">
- <span>系统实例</span>
- </div>
- <div class="graphInfoContent">
- <span v-text="graphInfo.systemInstanceName">实例1</span>
- </div>
- <div class="graphInfoName">
- <span>系统图模版</span>
- </div>
- <div class="graphInfoContent">
- <span v-text="graphInfo.templateName">模版1</span>
- </div>
- <div class="graphInfoName">
- <span>所属项目</span>
- </div>
- <div class="graphInfoContent">
- <span v-text="project.name">银泰中心</span>
- </div>
- <div class="graphInfoName">
- <span>当前状态</span>
- </div>
- <div class="graphInfoContent">
- <span v-text="graphInfo.stateName">草稿</span>
- </div>
- </div>
- <div class="graphRegion">
- <graph
- ref="graphc"
- @click="graphClickCall"
- @closeright="closeRight"
- ></graph>
- </div>
- <div class="rightDetail" v-if="selGraphPartType != -1">
- <div v-if="selGraphPartType == 1">
- <div class="title titleMargin">设备类</div>
- <div class="titleText eqName" v-text="selEquip.name">进线柜</div>
- <div class="detailSplitLine"></div>
- <div class="title titleMargin">
- <span>x</span>
- <span
- class="coridTitleText titleText"
- v-text="(selEquip.absolutePosition || {}).x"
- >100</span
- >
- <span class="coridTitle2">y</span>
- <span
- class="coridTitleText titleText"
- v-text="(selEquip.absolutePosition || {}).y"
- >100</span
- >
- </div>
- <div class="title titleMargin">
- <span>比例</span>
- <span class="scaleTitleText titleText">100%</span>
- </div>
- <div class="detailSplitLine"></div>
- <div class="title titleMargin">锚点</div>
- <div
- class="anchorContainer"
- v-for="anchor in selEquip.anchorArr"
- :key="anchor.name"
- >
- <span v-text="anchor.name">T3</span>
- <span>已连接</span>
- </div>
- </div>
- <div v-if="selGraphPartType == 2">
- <div class="title titleMargin">连线</div>
- <div class="detailSplitLine"></div>
- <div
- v-for="(linePoint, _index) in selLine.path || []"
- :key="_index.toString()"
- >
- <div
- class="title titleMargin"
- v-text="
- _index == 0
- ? '起点'
- : _index == selLine.path.length - 1
- ? '终点'
- : '拐点' + _index
- "
- >
- 起点
- </div>
- <div class="coridGroup title">
- <span>x</span>
- <span class="coridTitleText titleText" v-text="linePoint.x"
- >100</span
- >
- <span class="coridTitle2">y</span>
- <span class="coridTitleText titleText" v-text="linePoint.y"
- >100</span
- >
- </div>
- </div>
-
- </div>
- <div v-if="selGraphPartType == 3">
- <div class="title titleMargin">文字</div>
- <div class="titleText eqName">
- <span v-text="selText.text" v-if="operState == 0"></span>
- <el-input
- v-model="selText.text"
- v-if="operState == 1"
- @change="textContentChange"
- ></el-input>
- </div>
- <div class="detailSplitLine"></div>
- <div class="title titleMargin" v-if="operState == 0">
- <span>x</span>
- <span
- class="coridTitleText titleText"
- v-text="(selText.absolutePosition || {}).x"
- >100</span
- >
- <span class="coridTitle2">y</span>
- <span
- class="coridTitleText titleText"
- v-text="(selText.absolutePosition || {}).y"
- >100</span
- >
- </div>
- <div class="title titleMargin" v-if="operState == 1">
- <div>
- <span>x</span>
- <div class="textCrodDiv" v-if="operState == 1">
- <el-input
- v-model="(selText.absolutePosition || {}).x"
- @change="textXChange"
- >
- </el-input>
- </div>
- </div>
- <div style="margin-top: 10px">
- <span>y</span>
- <div class="textCrodDiv" v-if="operState == 1">
- <el-input
- v-model="(selText.absolutePosition || {}).y"
- @change="textYChange"
- >
- </el-input>
- </div>
- </div>
- </div>
- <div class="detailSplitLine"></div>
- <div class="title titleMargin">字体样式</div>
- <div class="titleMargin fontSizeContainer">
- <img
- src="@/assets/images/systemGraph/fontStyle.svg"
- class="fontStyleSvg"
- />
- <el-select
- v-model="selFontSize"
- value-key="id"
- @change="selFontSizeChange"
- placeholder=""
- >
- <el-option
- v-for="item in fontSizeArr"
- :key="item.id"
- :label="item.name"
- :value="item"
- >
- </el-option>
- </el-select>
- </div>
- <div class="title titleMargin">字体颜色</div>
- <div class="titleMargin fontColor">
- <input
- v-if="operState == 1"
- type="color"
- v-model="fontColor"
- @change="selFontColorChange"
- />
- <div v-text="fontColor"></div>
- <div>100%</div>
- </div>
- <div class="title titleMargin">背景颜色</div>
- <div class="titleMargin fontColor">
- <input
- v-if="operState == 1"
- type="color"
- v-model="fontBackColor"
- @change="selFontBackColorChange"
- />
- <div v-text="fontBackColor"></div>
- <div>100%</div>
- </div>
- </div>
- <div
- class="delBtn"
- v-if="selGraphPartType == 1 && operState == 1"
- @click="delEquip"
- >
- 删除设备
- </div>
- <div
- class="delBtn"
- v-if="selGraphPartType == 2 && operState == 1"
- @click="delLine"
- >
- 删除管线
- </div>
- <div
- class="delBtn"
- v-if="selGraphPartType == 3 && operState == 1"
- @click="delText"
- >
- 删除文字
- </div>
- </div>
- </div>
- <addGraph
- :isVisible="operState == 2"
- v-if="operState == 2"
- @graphCreated="createSuccessed"
- ></addGraph>
- </div>
- </template>
- <script>
- import { graphStateEnum } from "@/controller/systemGraph/graphStateEnum";
- import { sysGraphController } from "@/controller/systemGraph/sysGraphController";
- import addGraph from "./addGraph.vue";
- import graph from "./graph.vue";
- import { logicConfig } from "@/logicConfig";
- import { Message } from "element-ui";
- import Vue from "vue";
- import vueStore from "@/store";
- import { mapState } from "vuex";
- export default {
- props: [],
- data() {
- return {
- fullscreenLoading: false,
-
- scaleArr: [
- {
- name: "25%",
- value: 25,
- },
- {
- name: "50%",
- value: 50,
- },
- {
- name: "75%",
- value: 75,
- },
- {
- name: "100%",
- value: 100,
- },
- {
- name: "150%",
- value: 150,
- },
- ],
-
- selectScale: {},
-
- operState: -1,
-
- diagramId: "",
-
- project: {},
-
- selGraphPartType: -1,
-
- lineStartPointArr: [
- {
- id: "111",
- name: "1#设备-B1",
- },
- {
- id: "222",
- name: "1#设备-B2",
- },
- ],
-
- selLineStartPoint: {
- id: "111",
- name: "1#设备-B1",
- },
-
- lineEndPointArr: [
- {
- id: "111",
- name: "2#设备-B1",
- },
- {
- id: "222",
- name: "2#设备-B2",
- },
- ],
-
- selLineEndPoint: {
- id: "111",
- name: "2#设备-B1",
- },
-
- fontSizeArr: [
- {
- id: 12,
- name: "12px",
- },
- {
- id: 14,
- name: "14px",
- },
- {
- id: 16,
- name: "16px",
- },
- ],
-
- selFontSize: {},
-
- fontColor: "#eb5757",
-
- fontBackColor: "#ffffff",
-
- graphOriginInfo: {},
-
- graphInfo: {},
-
- selEquip: {},
-
- selText: {},
-
- selLine: {},
-
- isVisibleLeft: true,
-
- isEditGraphName: false,
- };
- },
- computed: {
- ...mapState(["projects"]),
- },
- methods: {
-
- createSuccessed: function (graphInfo) {
-
- this.operState = 1;
- this.graphOriginInfo = JSON.parse(JSON.stringify(graphInfo));
- this.graphInfo = graphInfo;
- this.diagramId = graphInfo.id;
- this.$refs.graphc.drawEntry(graphInfo);
- for (let i = 0; i < this.projects.length; i++) {
- let currProject = this.projects[i];
- if (currProject.id == graphInfo.projectId) {
- this.project = {
- id: currProject.id,
- name: currProject.name,
- groupCode: currProject.groupCode,
- };
- vueStore.commit("updateSelectProject", this.project);
- break;
- }
- }
- },
-
- selStartPointChange: function () {
- console.log(this.selLineStartPoint);
- },
-
- selEndPointChange: function () {
- console.log(this.selLineEndPoint);
- },
-
- selFontSizeChange: function () {
-
- this.updateGraphInfo(3, 2, { id: this.selText.id });
-
- this.$refs.graphc.updateDataAndGraph(3, 2, {
- id: this.selText.id,
- fontSize: this.selFontSize.id,
- });
- },
-
- selFontColorChange: function () {
-
- this.updateGraphInfo(3, 3, { id: this.selText.id });
-
- this.$refs.graphc.updateDataAndGraph(3, 3, {
- id: this.selText.id,
- fontColor: this.fontColor,
- });
- },
-
- selFontBackColorChange: function () {
-
- this.updateGraphInfo(3, 4, { id: this.selText.id });
-
- this.$refs.graphc.updateDataAndGraph(3, 4, {
- id: this.selText.id,
- fontBackColor: this.fontBackColor,
- });
- },
-
- textXChange: function () {
- this.selText.absolutePosition.x = parseFloat(
- this.selText.absolutePosition.x
- );
- this.selText.oldAbsolutePosition.x = parseFloat(
- this.selText.oldAbsolutePosition.x
- );
- var xChange =
- this.selText.absolutePosition.x - this.selText.oldAbsolutePosition.x;
- this.selText.oldAbsolutePosition.x = this.selText.absolutePosition.x;
-
- this.updateGraphInfo(3, 6, {
- id: this.selText.id,
- text: { xChange: xChange, yChange: 0 },
- });
-
- this.$refs.graphc.updateDataAndGraph(3, 6, {
- id: this.selText.id,
- text: { xChange: xChange, yChange: 0 },
- });
- },
-
- textYChange: function () {
- this.selText.absolutePosition.y = parseFloat(
- this.selText.absolutePosition.y
- );
- this.selText.oldAbsolutePosition.y = parseFloat(
- this.selText.oldAbsolutePosition.y
- );
- var yChange =
- this.selText.absolutePosition.y - this.selText.oldAbsolutePosition.y;
- this.selText.oldAbsolutePosition.y = this.selText.absolutePosition.y;
-
- this.updateGraphInfo(3, 6, {
- id: this.selText.id,
- text: { xChange: 0, yChange: yChange },
- });
-
- this.$refs.graphc.updateDataAndGraph(3, 6, {
- id: this.selText.id,
- text: { xChange: 0, yChange: yChange },
- });
- },
-
- textContentChange: function () {
-
- this.updateGraphInfo(3, 7, {
- id: this.selText.id,
- text: { content: this.selText.text },
- });
-
- this.$refs.graphc.updateDataAndGraph(3, 7, {
- id: this.selText.id,
- text: { content: this.selText.text },
- });
- },
-
- delText: function () {
- this.$refs.graphc.updateDataAndGraph(3, 5, { id: this.selText.id });
- this.updateGraphInfo(3, 5, { id: this.selText.id });
- },
-
- getDiagramById: async function () {
- this.fullscreenLoading = true;
- var resultObj = await sysGraphController.getDiagramById(
- this.diagramId,
- this.project.groupCode,
- this.project.id
- );
- if (resultObj.result != logicConfig.resultObj.success) {
- this.fullscreenLoading = false;
- Message.error(resultObj.message);
- return;
- }
- this.graphOriginInfo = JSON.parse(JSON.stringify(resultObj.data));
- this.graphInfo = resultObj.data;
- this.fullscreenLoading = false;
- },
-
- intoEditState: function () {
- this.operState = 1;
- },
-
- graphClickCall: function (dataObj, type) {
- var _this = this;
- var oldPartType = this.selGraphPartType;
- this.selGraphPartType = type;
- switch (type) {
-
- case 1:
- this.selEquip = dataObj || {};
- break;
-
- case 2:
- this.selLine = dataObj || {};
- break;
-
- case 3:
- this.selText = dataObj || {};
- this.selFontSize =
- _this.fontSizeArr.filter((_c) => {
- return _c.id == _this.selText.style.fontSize;
- })[0] || {};
- this.fontColor = this.selText.style.fontColor;
- this.fontBackColor = this.selText.style.backColor;
- break;
- }
- var _this = this;
-
- if (oldPartType == -1) {
- Vue.nextTick(function () {
- _this.$refs.graphc.resetDraw();
- });
- }
- },
-
- closeRight: function () {
- var _this = this;
- this.selGraphPartType = -1;
- Vue.nextTick(function () {
- _this.$refs.graphc.resetDraw();
- });
- },
-
- saveGraph: async function () {
- this.fullscreenLoading = true;
- var saveResultObj = await sysGraphController.saveSysGraph(
- this.graphInfo,
- this.project.id,
- this.project.groupCode
- );
- switch (saveResultObj.result) {
- case logicConfig.resultObj.failure:
- this.fullscreenLoading = false;
- Message.error("保存失败:" + (saveResultObj.message || ""));
- return;
- case logicConfig.resultObj.success:
- this.graphOriginInfo = JSON.parse(JSON.stringify(this.graphInfo));
-
- var draftResultObj = await sysGraphController.draftGraph(
- this.diagramId
- );
- this.fullscreenLoading = false;
- switch (draftResultObj.result) {
- case logicConfig.resultObj.success:
- Message.success("保存成功");
- break;
- case logicConfig.resultObj.failure:
- Message.error(
- "保存成功,更新状态失败,原因:" + (resultObj.message || "")
- );
- break;
- }
- break;
- }
- },
-
- cancelClick: function () {
- var _this = this;
- this.graphInfo = JSON.parse(JSON.stringify(this.graphOriginInfo));
- this.operState = 0;
- this.selGraphPartType = -1;
- Vue.nextTick(function () {
- _this.$refs.graphc.drawEntry(_this.graphInfo);
- });
- },
-
- publishGraph: async function () {
- this.fullscreenLoading = true;
- var resultObj = await sysGraphController.publishSysGraph(this.diagramId);
- this.fullscreenLoading = false;
- switch (resultObj.result) {
- case logicConfig.resultObj.success:
- this.graphOriginInfo.extraProps.state = graphStateEnum.Publish;
- this.graphInfo.extraProps.state = graphStateEnum.Publish;
- return Message.success("上架成功");
- case logicConfig.resultObj.failure:
- return Message.error("上架失败,原因:" + (resultObj.message || ""));
- }
- },
-
- draftGraph: async function () {
- this.fullscreenLoading = true;
- var resultObj = await sysGraphController.draftGraph(this.diagramId);
- this.fullscreenLoading = false;
- switch (resultObj.result) {
- case logicConfig.resultObj.success:
- this.graphOriginInfo.extraProps.state = graphStateEnum.Draft;
- this.graphInfo.extraProps.state = graphStateEnum.Draft;
- return Message.success("下架成功");
- case logicConfig.resultObj.failure:
- return Message.error("下架失败,原因:" + (resultObj.message || ""));
- }
- },
-
- delGraph: function () {
- this.$confirm("图纸删除后将不可进行查看和编辑, 是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(async () => {
- this.fullscreenLoading = true;
- var resultObj = await sysGraphController.delSysGraph(this.diagramId);
- this.fullscreenLoading = false;
- switch (resultObj.result) {
- case logicConfig.resultObj.success:
- this.$confirm("删除成功,页面将关闭", "提示", {
- confirmButtonText: "确定",
- type: "success",
- showCancelButton: false,
- closeOnClickModal: false,
- showClose: false,
- closeOnPressEscape: false,
- }).then(async () => {
- window.close();
- });
- return;
- case logicConfig.resultObj.failure:
- return Message.error(
- "删除图纸失败,原因:" + (resultObj.message || "")
- );
- }
- })
- .catch(() => {});
- },
-
- toggleLeft: function () {
- var _this = this;
- this.isVisibleLeft = !this.isVisibleLeft;
- Vue.nextTick(function () {
- _this.$refs.graphc.resetDraw();
- });
- },
-
- selScaleChange: function () {
- this.$refs.graphc.graphScale(this.selectScale.value / 100);
- },
-
- scaleZoomin: function () {
- var newScale = this.$refs.graphc.graphScaleCompute(0.25);
- this.$refs.graphc.graphScale(newScale);
- },
-
- scaleZoomout: function () {
- var newScale = this.$refs.graphc.graphScaleCompute(-0.25);
- this.$refs.graphc.graphScale(newScale);
- },
-
- delEquip: function () {
- this.$refs.graphc.updateDataAndGraph(1, 1, { id: this.selEquip.id });
- this.updateGraphInfo(1, 1, { id: this.selEquip.id });
- },
-
- delLine: function () {
- this.$refs.graphc.updateDataAndGraph(2, 8, { id: this.selLine.id });
- this.updateGraphInfo(2, 8, { id: this.selLine.id });
- },
-
- removeFromData: function (id) {
- this.graphInfo.template.frame.children = remove(
- this.graphInfo.template.frame.children
- );
- function remove(dataArr) {
- for (let i = 0; i < dataArr.length; i++) {
- let _dataObj = dataArr[i];
- if (_dataObj.id == id) {
- dataArr.splice(i, 1);
- return dataArr;
- }
- if (_dataObj.compType == "container") {
- var result = remove(_dataObj.children);
- if (result) {
- _dataObj.children = result;
- return dataArr;
- }
- }
- }
- return null;
- }
- },
-
- updateGraphInfo: function (dataType, operType, exprObj) {
- var _this = this;
- switch (dataType) {
- case 2:
- operLine();
- break;
- default:
- _each(this.graphInfo.template.frame.children);
- break;
- }
- function operLine() {
- var arr = _this.graphInfo.lines;
- for (let i = 0; i < arr.length; i++) {
- if (arr[i].id == exprObj.id) {
- switch (operType) {
- case 8:
- arr.splice(i, 1);
- break;
- }
- break;
- }
- }
- }
- function _each(dataArr) {
- for (let i = 0; i < dataArr.length; i++) {
- let _dataObj = dataArr[i];
- var _id =
- dataType == 1
- ? _dataObj.id
- : dataType == 3
- ? (_dataObj.label || {}).id
- : "";
- if (_id == exprObj.id) {
- switch (operType) {
- case 1:
- dataArr.splice(i, 1);
- break;
- case 2:
- _dataObj.label.style.fontSize = _this.selFontSize.id;
- break;
- case 3:
- _dataObj.label.style.color = _this.fontColor;
- break;
- case 4:
- _dataObj.label.style.backColor = _this.fontBackColor;
- break;
- case 5:
- _dataObj.label.content = "";
- break;
- case 6:
- _dataObj.label.location.x =
- _dataObj.label.location.x + exprObj.text.xChange;
- _dataObj.label.location.y =
- _dataObj.label.location.y + exprObj.text.yChange;
- break;
- case 7:
- _dataObj.label.content = exprObj.text.content;
- break;
- }
- return dataArr;
- }
- if (_dataObj.compType == "container") {
- var result = _each(_dataObj.children);
- if (result) {
- _dataObj.children = result;
- return dataArr;
- }
- }
- }
- return null;
- }
- },
-
- resetGraph: async function () {
- this.$confirm("重置后将不可进行恢复, 是否继续?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(async () => {
- this.fullscreenLoading = true;
- this.selGraphPartType = -1;
- var resultObj = await sysGraphController.resetData({
- id: this.diagramId,
- groupCode: this.project.groupCode,
- projectId: this.project.id,
- });
- if (resultObj.result != logicConfig.resultObj.success) {
- this.fullscreenLoading = false;
- Message.error("重置失败:" + resultObj.message);
- return;
- }
- this.graphOriginInfo = JSON.parse(JSON.stringify(resultObj.data));
- this.graphInfo = resultObj.data;
- this.$refs.graphc.drawEntry(this.graphInfo);
- this.fullscreenLoading = false;
- Message.success("重置成功");
- })
- .catch(() => {});
- },
-
- intoGraphNameEditState: function () {
- this.isEditGraphName = true;
- },
-
- saveGraphName: async function () {
- this.fullscreenLoading = true;
- var resultObj = await sysGraphController.saveGraphName({
- id: this.diagramId,
- name: this.graphInfo.name,
- });
- if (resultObj.result != logicConfig.resultObj.success) {
- this.fullscreenLoading = false;
- Message.error("保存失败");
- return;
- }
- this.graphOriginInfo.name = this.graphInfo.name;
- this.isEditGraphName = false;
- this.fullscreenLoading = false;
- Message.success("保存成功");
- },
-
- cancelSaveGraphName: function () {
- this.graphInfo.name = this.graphOriginInfo.name;
- this.isEditGraphName = false;
- },
- },
- created() {
- this.operState = !this.$route.query.ost
- ? -1
- : parseInt(this.$route.query.ost);
- this.diagramId = !this.$route.query.did ? -1 : this.$route.query.did;
- this.selectScale = this.scaleArr[3];
- this.project = {
- id: this.$route.query.pri,
- groupCode: this.$route.query.gc,
- name: this.$route.query.prn,
- };
- if (this.operState === 0 || this.operState === 1) {
- vueStore.commit("updateSelectProject", this.project);
- }
- },
- mounted() {
- var _this = this;
- (async function () {
-
- if (_this.operState === 0 || _this.operState === 1) {
- await _this.getDiagramById();
- _this.$refs.graphc.drawEntry(_this.graphInfo);
- }
- })();
- },
- components: {
- addGraph,
- graph,
- },
- };
- </script>
- <style>
- #divGraphEdit {
- height: 100%;
- display: flex;
- flex-direction: column;
- }
- #divGraphEdit .firstRow {
- height: 96px;
- background: #ffffff;
- box-shadow: 0px 2px 10px rgb(31 36 41 / 10%);
- display: flex;
- flex-direction: column;
- z-index: 2;
- }
- #divGraphEdit .firstOperDivContainer {
- flex: 1;
- border-bottom: solid 1px #f2f2f2;
- line-height: 48px;
- }
- #divGraphEdit .firstOperDivContainer > span:not(:first-child),
- #divGraphEdit .operBtnDiv span {
- cursor: pointer;
- }
- #divGraphEdit .secondOperDivContainer {
- flex: 1;
- }
- #divGraphEdit .headerTitle {
- font-weight: 600;
- margin-left: 15px;
- }
- #divGraphEdit .operBtnDiv {
- display: inline-block;
- margin-left: 52px;
- font-weight: 500;
- }
- #divGraphEdit .operBtnDiv span {
- margin-left: 20px;
- }
- #divGraphEdit .delBtn {
- float: right;
- margin-right: 49px;
- cursor: pointer;
- }
- #divGraphEdit .imgBar {
- margin-left: 33px;
- }
- #divGraphEdit .sanjiaoBar {
- vertical-align: middle;
- }
- #divGraphEdit .splitLine {
- display: inline-block;
- height: 30px;
- border-left: solid 1px #d8d8d8;
- vertical-align: middle;
- margin-left: 26px;
- border-top: none;
- }
- #divGraphEdit .secondOperDivContainer input {
- border: none !important;
- width: 66px;
- padding: 0;
- }
- #divGraphEdit .secondOperDivContainer .el-select {
- margin-left: 26px;
- }
- #divGraphEdit .zoomin {
- margin-left: 20px;
- }
- #divGraphEdit .zoomout {
- margin-left: 14px;
- }
- #divGraphEdit .imgLeftTop {
- margin-left: 26px;
- }
- #divGraphEdit .rightLeftTop {
- margin-left: 22px;
- }
- #divGraphEdit .resetBtn {
- float: right;
- margin-right: 49px;
- line-height: 48px;
- cursor: pointer;
- }
- #divGraphEdit .secondRow {
- flex: 1;
- display: flex;
- flex-direction: row;
- }
- #divGraphEdit .graphInfoContainer {
- background: #fafafa;
- width: 200px;
- height: 100%;
- box-shadow: 0px 0px 1px rgb(0 0 0 / 25%);
- }
- #divGraphEdit .graphInfoFirst {
- margin-top: 31px;
- }
- #divGraphEdit .graphInfoName {
- margin-left: 12px;
- margin-top: 21px;
- font-size: 12px;
- color:#6F777F;
- }
- #divGraphEdit .graphInfoFirstEdit {
- margin-right: 12px;
- float: right;
- color: #0091ff;
- cursor: pointer;
- }
- #divGraphEdit .graphInfoContent {
- margin-top: 12px;
- margin-left: 36px;
- font-weight: normal;
- }
- #divGraphEdit .graphRegion {
- flex: 1;
- height: 100%;
- overflow: hidden;
- }
- #divGraphEdit .rightDetail {
- width: 200px;
- height: 100%;
- background: #fafafa;
- box-shadow: -1px 0px 1px rgb(0 0 0 / 25%);
- box-sizing: border-box;
- padding: 6px 12px 12px 12px;
- }
- #divGraphEdit .rightDetail > div:first-child {
- height: 100%;
- }
- #divGraphEdit .rightDetail .title {
- color: #6f777f;
- font-size: 12px;
- }
- #divGraphEdit .rightDetail .titleMargin {
- margin-top: 19px;
- }
- #divGraphEdit .rightDetail .coridGroup {
- margin-top: 9px;
- }
- #divGraphEdit .rightDetail .titleText {
- font-size: 14px;
- color: #000000;
- }
- #divGraphEdit .rightDetail .eqName {
- margin-top: 11px;
- }
- #divGraphEdit .rightDetail .detailSplitLine {
- width: 100%;
- height: 0;
- margin-top: 19px;
- border-bottom: 1px solid #979797;
- }
- #divGraphEdit .rightDetail .coridTitle2 {
- margin-left: 45px;
- }
- #divGraphEdit .rightDetail .coridTitleText {
- margin-left: 23px;
- }
- #divGraphEdit .rightDetail .textCrodDiv {
- display: inline-block;
- width: 158px;
- margin-left: 10px;
- }
- #divGraphEdit .rightDetail .textCrodDiv .el-input__inner {
- padding-left: 20px;
- }
- #divGraphEdit .rightDetail .scaleTitleText {
- margin-left: 6px;
- }
- #divGraphEdit .rightDetail .anchorContainer {
- margin-top: 15px;
- }
- #divGraphEdit .rightDetail .anchorContainer > span:last-child {
- margin-left: 22px;
- }
- #divGraphEdit .rightDetail .delBtn {
- color: #eb5757;
- position: absolute;
- bottom: 16px;
- margin-left: 62px;
- cursor: pointer;
- }
- #divGraphEdit .rightDetail .selectPrefix {
- color: #000000;
- font-size: 14px;
- height: 100%;
- line-height: 32px;
- }
- #divGraphEdit .rightDetail .lianjieguanxi .el-input__inner {
- padding-left: 42px;
- }
- #divGraphEdit .rightDetail .fontSizeContainer .el-input__inner {
- padding: 0 15px;
- width: 80px;
- }
- #divGraphEdit .rightDetail .fontSizeContainer .el-select {
- margin-left: 42px;
- }
- #divGraphEdit .rightDetail .fontColor {
- position: relative;
- }
- #divGraphEdit .rightDetail .fontColor input {
- border: none;
- background: none;
- width: 30px;
- height: 31px;
- padding: 0;
- top: 0;
- bottom: 0;
- position: absolute;
- }
- #divGraphEdit .rightDetail .fontColor > div {
- line-height: 31px;
- display: inline-block;
- }
- #divGraphEdit .rightDetail .fontColor div:nth-child(2) {
- margin-left: 43px;
- }
- #divGraphEdit .rightDetail .fontColor div:nth-child(3) {
- margin-left: 16px;
- }
- #divGraphEdit img {
- vertical-align: middle;
- }
- </style>
|