index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div class="heeaderNav">
  3. <div class="tab-box">
  4. <div
  5. class="tab-item"
  6. :data-type="$store.state.moreSty"
  7. v-for="(tab, index) of tabs"
  8. :key="index"
  9. :class="{ active1: activeTab == tab.id }"
  10. @click.stop="headerCheck(tab.id, tab.show)"
  11. >
  12. <span
  13. class="svg-icon svg-icon-sm"
  14. :class="activeTab == tab.id ? 'svg-icon-green' : 'svg-icon-write'"
  15. >
  16. <SvgIcon :svgid="tab.icon"></SvgIcon>
  17. </span>
  18. <span>{{ tab.text }}</span>
  19. </div>
  20. </div>
  21. <!-- <div class="rightTitle" v-if="wpId != 'KGDL_FGS'">
  22. <div
  23. class="all-enterprise"
  24. :class="{ active1: enterpriseIndex == 'all' }"
  25. @click="handleClickEnterprise('all', '清洁能源')"
  26. >
  27. <i
  28. class="svg-icon svg-icon-sm"
  29. :class="
  30. $store.state.themeName === 'dark'
  31. ? enterpriseIndex == 'all'
  32. ? 'svg-icon-green'
  33. : 'svg-icon-write'
  34. : 'svg-icon-black'
  35. "
  36. >
  37. <SvgIcon svgid="svg-enterprise"></SvgIcon>
  38. </i>
  39. <span>清洁能源</span>
  40. </div>
  41. <div
  42. :class="{ active1: enterpriseIndex == item.nemCode }"
  43. class="enterprise-item"
  44. v-for="(item, index) in childNode"
  45. :key="index"
  46. @click="handleClickEnterprise(item.nemCode, item.aname)"
  47. >
  48. <span>{{ item.aname }}</span>
  49. </div>
  50. </div> -->
  51. </div>
  52. </template>
  53. <script>
  54. import SvgIcon from "@/components/coms/icon/svg-icon.vue";
  55. import { headerCompany } from "@/api/headerNav/header.js";
  56. export default {
  57. name: "HeaderNavSta", //全景监视标题栏
  58. props: {
  59. isAll: {
  60. type: Boolean,
  61. default: false,
  62. },
  63. wpId: {
  64. type: String,
  65. default: "",
  66. },
  67. companyid: { type: String, default: "SXJ_RGN" },
  68. currents: { type: Number, default: 0 },
  69. },
  70. components: { SvgIcon },
  71. data() {
  72. return {
  73. OrganizationList: [],
  74. activeTab: -1,
  75. headerIndexs: -1,
  76. wpIds: "",
  77. tabs: [
  78. // {
  79. // icon: "svg-all",
  80. // text: "全部",
  81. // show: "all",
  82. // id: 0,
  83. // },
  84. {
  85. icon: "svg-wind-site",
  86. text: "风电",
  87. show: "fc",
  88. id: -1,
  89. },
  90. {
  91. icon: "svg-photovoltaic",
  92. text: "光伏",
  93. show: "gf",
  94. id: -2,
  95. },
  96. ],
  97. enterpriseIndex: "all",
  98. companyName: "山西",
  99. showType: "all",
  100. childNode: [],
  101. regionList: [
  102. { name: "全国", key: "KGDL_FGS" },
  103. { name: "山西", key: "SXJ_RGN" },
  104. { name: "内蒙", key: "NMM_RGN" },
  105. ],
  106. };
  107. },
  108. created() {
  109. this.$nextTick(() => {
  110. this.$emit("firstRender", this.activeTab, this.showType, this.wpId);
  111. });
  112. },
  113. watch: {
  114. wpId: {
  115. handler(val) {
  116. let region = this.regionList.find((item) => item.key == val);
  117. if ((val && (region || this.currents == 1)) || this.isAll) {
  118. this.getOrganizationList();
  119. }
  120. },
  121. immediate: true,
  122. },
  123. },
  124. methods: {
  125. getOrganizationList() {
  126. if (this.currents == 1 && this.wpId.includes("SXJ")) {
  127. headerCompany({ regionid: "SXJ_RGN" }).then(({ data }) => {
  128. this.childNode = data.data;
  129. });
  130. } else {
  131. headerCompany({ regionid: this.wpId }).then(({ data }) => {
  132. this.childNode = data.data;
  133. });
  134. }
  135. },
  136. handleClickEnterprise(enterprise, name) {
  137. this.companyName = name;
  138. this.enterpriseIndex = enterprise;
  139. this.$emit("typeFlag", this.showType, this.enterpriseIndex);
  140. this.$emit(
  141. "firstRender",
  142. this.activeTab,
  143. this.showType,
  144. enterprise == "all" ? "SXJ_RGN" : enterprise,
  145. enterprise == "all" ? "清洁能源" : name
  146. );
  147. },
  148. headerCheck(index, showType) {
  149. this.activeTab = index;
  150. this.showType = showType;
  151. this.$emit(
  152. "firstRender",
  153. this.activeTab,
  154. this.showType,
  155. this.wpId,
  156. this.wpId == "KGDL_FGS" ? "" : this.companyName
  157. );
  158. this.$emit("typeFlag", this.showType, this.enterpriseIndex);
  159. },
  160. },
  161. };
  162. </script>
  163. <style lang="less" scoped>
  164. .heeaderNav {
  165. height: 35px;
  166. display: flex;
  167. align-items: center;
  168. margin: 16px 0 16px 20px;
  169. }
  170. .tab-box {
  171. display: inline-block;
  172. z-index: 2;
  173. display: flex;
  174. .tab-item[data-type~="greenSty"] {
  175. &.active1 {
  176. color: @green;
  177. background: rgba(84, 183, 90, 0.16);
  178. }
  179. }
  180. .tab-item[data-type~="blueSty"] {
  181. &.active1 {
  182. color: @darkBlue !important;
  183. background: rgba(84, 130, 183, 0.16);
  184. }
  185. }
  186. .tab-item {
  187. display: flex;
  188. align-items: center;
  189. justify-content: center;
  190. font-size: 14px;
  191. font-family: Microsoft YaHei;
  192. cursor: pointer;
  193. padding: 3px 14px;
  194. margin-right: 5px;
  195. &.active1 {
  196. position: relative;
  197. border-radius: 16px;
  198. &::after {
  199. content: "";
  200. position: absolute;
  201. width: 100%;
  202. height: 0.463vh;
  203. border-top: 0;
  204. left: 0;
  205. bottom: 0;
  206. box-sizing: border-box;
  207. }
  208. }
  209. .svg-icon {
  210. margin-right: 12px;
  211. margin-top: 2px;
  212. }
  213. }
  214. }
  215. .rightTitle {
  216. display: flex;
  217. margin-left: 72px;
  218. z-index: 5;
  219. .active1 {
  220. // background: rgba(84, 183, 90, 0.4);
  221. color: #05bb4c;
  222. }
  223. div {
  224. display: flex;
  225. padding: 0 14px;
  226. align-items: center;
  227. height: 25px;
  228. line-height: 25px;
  229. font-size: 15px;
  230. font-family: Microsoft YaHei;
  231. background: rgba(84, 183, 90, 0.16);
  232. border-radius: 16px;
  233. text-align: center;
  234. margin-right: 15px;
  235. cursor: pointer;
  236. .svg-icon {
  237. margin-right: 12px;
  238. }
  239. }
  240. }
  241. </style>