property.vue 4.5 KB

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