property.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <!--属性栏-->
  2. <template>
  3. <div class="propertys">
  4. <baseTextPro
  5. :strokeColor="strokeColor"
  6. :fontSize="fontSize"
  7. :textMsg="textMsg"
  8. :backgroundColor="backgroundColor"
  9. v-show="itemType == 'BaseText' || itemType == 'BaseExplain'"
  10. ></baseTextPro>
  11. <baseLinePro
  12. v-show="itemType == 'BaseArrow'"
  13. :strokeColor="strokeColor"
  14. :lineStyle="lineStyle"
  15. :lineWidth="lineWidth"
  16. :Begin="begin"
  17. :End="end"
  18. ></baseLinePro>
  19. <BaseGraphy
  20. :lineStyle="lineStyle"
  21. :lineWidth="lineWidth"
  22. :strokeColor="strokeColor"
  23. :fillColor="fillColor"
  24. :Url="Url"
  25. :Width="Width"
  26. :Height="Height"
  27. v-show="
  28. itemType == 'BaseRect' ||
  29. itemType == 'BaseTriangle' ||
  30. itemType == 'BaseCircle' ||
  31. itemType == 'BasePolygon' ||
  32. itemType == 'BaseArrowPolygon'
  33. "
  34. ></BaseGraphy>
  35. <BaseImagePro
  36. :lineStyle="lineStyle"
  37. :lineWidth="lineWidth"
  38. :strokeColor="strokeColor"
  39. :Url="Url"
  40. :Width="Width"
  41. :Height="Height"
  42. v-show="itemType == 'BaseImage'"
  43. ></BaseImagePro>
  44. <BaseEquipment
  45. :InfoPointList="infoPointList"
  46. :EquipData="EquipData"
  47. v-show="itemType == 'BaseEquipment'"
  48. ></BaseEquipment>
  49. </div>
  50. </template>
  51. <script>
  52. import baseTextPro from "./baseTextPro.vue";
  53. import baseLinePro from "./baseLinePro.vue";
  54. import BaseGraphy from "./BaseGraphy";
  55. import BaseImagePro from "./BaseImagePro";
  56. import BaseEquipment from "./BaseEquipment";
  57. import bus from "@/bus/bus";
  58. const lineStyle = {
  59. 0: "Solid",
  60. 1: "Dashed",
  61. /** 点线 */
  62. 2: "Dotted",
  63. /** 无 */
  64. 3: "None",
  65. };
  66. const arrowType = {
  67. 0: "None",
  68. 1: "Basic",
  69. /** 点线 */
  70. 2: "Triangle",
  71. /** 无 */
  72. 3: "Diamond",
  73. 4: "Square",
  74. 5: "Circle",
  75. };
  76. export default {
  77. components: {
  78. baseTextPro,
  79. baseLinePro,
  80. BaseGraphy,
  81. BaseImagePro,
  82. BaseEquipment,
  83. },
  84. data() {
  85. return {
  86. itemType: "", // item 类型
  87. strokeColor: "", //线条颜色
  88. lineStyle: "solid", //线条样式
  89. lineWidth: 1, //线宽
  90. fontSize: 0, //字体大小
  91. textMsg: "", // 文本
  92. backgroundColor: "", // 背景色
  93. Width: 0, //item 宽
  94. Height: 0, //item 高
  95. Url: "", // 路径
  96. fillColor: "", //填充色
  97. begin: "", //开头样式
  98. end: "", //结尾样式
  99. infoPointList: [], //设备--信息点数组
  100. EquipData: {}, //设备 id
  101. };
  102. },
  103. mounted() {
  104. bus.$on("emitChoice", this.emitChoice);
  105. },
  106. methods: {
  107. emitChoice(itemList) {
  108. if (itemList.length == 1) {
  109. const data = itemList[0].data
  110. ? itemList[0].data
  111. : itemList[0].legendData
  112. ? itemList[0].legendData
  113. : itemList[0].relationData
  114. ? itemList[0].relationData
  115. : null;
  116. this.itemType = data.properties.type ? data.properties.type : "";
  117. } else {
  118. this.itemType = "";
  119. }
  120. // 同步联动样式
  121. this.linkStyle(itemList);
  122. console.log("itemList", itemList);
  123. },
  124. // 同步样式
  125. linkStyle(itemList) {
  126. const item = itemList[0];
  127. if (this.itemType == "BaseArrow") {
  128. this.strokeColor = item.strokeColor.toRgba();
  129. this.lineStyle = lineStyle[item.lineStyle];
  130. this.lineWidth = item.lineWidth;
  131. this.begin = arrowType[item.begin];
  132. this.end = arrowType[item.end];
  133. console.log(this.begin, this.end);
  134. } else if (
  135. this.itemType == "BaseText" ||
  136. this.itemType == "BaseExplain"
  137. ) {
  138. this.strokeColor = item.strokeColor.toRgba();
  139. this.backgroundColor = item.backgroundColor.toRgba();
  140. this.textMsg = item.text;
  141. this.fontSize = item.font.size;
  142. } else if (
  143. this.itemType == "BaseImage" ||
  144. this.itemType == "BasePipeUninTool"
  145. ) {
  146. this.Width = item.width; //item 宽
  147. this.Height = item.height; //item 高
  148. this.Url = item.url; // 路径
  149. this.lineStyle = lineStyle[item.lineStyle];
  150. this.lineWidth = item.lineWidth;
  151. this.strokeColor = item.strokeColor.toRgba();
  152. } else if (
  153. this.itemType == "BaseRect" ||
  154. this.itemType == "BaseTriangle" ||
  155. this.itemType == "BaseCircle" ||
  156. this.itemType == "BasePolygon"
  157. ) {
  158. this.Width = item.width; //item 宽
  159. this.Height = item.height; //item 高
  160. this.lineStyle = lineStyle[item.lineStyle];
  161. this.lineWidth = item.lineWidth;
  162. this.strokeColor = item.strokeColor.toRgba();
  163. this.fillColor = item.fillColor.toRgba();
  164. // 填充色
  165. } else if (this.itemType == "BaseEquipment") {
  166. if (
  167. item.legendData.properties &&
  168. item.legendData.properties.infoPointList
  169. ) {
  170. this.infoPointList = item.legendData.properties.infoPointList;
  171. } else {
  172. this.infoPointList = [];
  173. }
  174. this.EquipData = item.legendData;
  175. }
  176. },
  177. },
  178. };
  179. </script>
  180. <style lang="less" scoped>
  181. .propertys {
  182. }
  183. </style>