index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. <template>
  2. <!-- <div>
  3. <ul>
  4. <li
  5. @click="headerCheck(0)"
  6. :class="{ active: headerIndex == 0 }"
  7. :style="remove ? 'margin-top: 16px;' : ''"
  8. >
  9. <i class="active_icon icon-menu"></i>
  10. <span>全部</span>
  11. </li>
  12. <li
  13. @click="headerCheck(-1)"
  14. class="wind"
  15. :class="{
  16. active: headerIndex == -1,
  17. forbidden: parentNode?.ZFJTS == 0,
  18. }"
  19. :style="remove ? 'margin-top: 16px;' : ''"
  20. >
  21. <i class="icon-wind-logo1"></i>
  22. <span>风电</span>
  23. </li>
  24. <li
  25. @click="headerCheck(-2)"
  26. class="light"
  27. :class="{
  28. active: headerIndex == -2,
  29. forbidden: parentNode?.ZGFTS == 0,
  30. }"
  31. :style="remove ? 'margin-top: 16px;' : ''"
  32. >
  33. <i class="icon-photovoltaic"></i>
  34. <span>光伏</span>
  35. </li>
  36. <div class="rightTitle">
  37. <li
  38. class="nav_right"
  39. :class="{ active: headerIndexs == -1 }"
  40. @click="headerChecks(-1, parentNode.code)"
  41. @dblclick="hideChild()"
  42. :style="remove ? 'margin-top: 16px;' : ''"
  43. >
  44. <i class="active_icon icon-enterprise"></i>
  45. <span>{{ parentNode && parentNode.aname }}</span>
  46. </li>
  47. <li
  48. v-for="(item, index) in childNode"
  49. :key="index"
  50. class="nav_right"
  51. @click="headerChecks(index, item.code)"
  52. :class="{ active: headerIndexs === index }"
  53. v-show="isShows"
  54. :style="remove ? 'margin-top: 16px;' : ''"
  55. >
  56. <span>{{ parentNode && item.aname }}</span>
  57. </li>
  58. </div>
  59. </ul>
  60. </div> -->
  61. <div class="heeaderNav">
  62. <div class="tab-box">
  63. <div
  64. class="tab-item"
  65. v-for="(tab, index) of tabs"
  66. :key="index"
  67. :class="{ active1: activeTab == tab.id }"
  68. @click.stop="headerCheck(tab.id, tab.show)"
  69. >
  70. <span
  71. class="svg-icon svg-icon-sm"
  72. :class="activeTab == tab.id ? 'svg-icon-green' : 'svg-icon-write'"
  73. >
  74. <SvgIcon :svgid="tab.icon"></SvgIcon>
  75. </span>
  76. <span>{{ tab.text }}</span>
  77. </div>
  78. </div>
  79. <div class="rightTitle" v-if="wpId != 'KGDL_FGS'">
  80. <div
  81. class="all-enterprise"
  82. :class="{ active1: enterpriseIndex == 'all' }"
  83. @click="handleClickEnterprise('all', '清洁能源')"
  84. >
  85. <i
  86. class="svg-icon svg-icon-sm"
  87. :class="
  88. $store.state.themeName === 'dark'
  89. ? enterpriseIndex == 'all'
  90. ? 'svg-icon-green'
  91. : 'svg-icon-write'
  92. : 'svg-icon-black'
  93. "
  94. >
  95. <SvgIcon svgid="svg-enterprise"></SvgIcon>
  96. </i>
  97. <span>清洁能源</span>
  98. </div>
  99. <div
  100. :class="{ active1: enterpriseIndex == item.nemCode }"
  101. class="enterprise-item"
  102. v-for="(item, index) in childNode"
  103. :key="index"
  104. @click="handleClickEnterprise(item.nemCode, item.aname)"
  105. >
  106. <span>{{ item.aname }}</span>
  107. </div>
  108. <!-- <div
  109. :class="{ active: enterpriseIndex == 0 }"
  110. class="enterprise-item"
  111. @click="handleClickEnterprise(0)"
  112. >
  113. <span>清洁能源111</span>
  114. </div>
  115. <div
  116. :class="{ active: enterpriseIndex == 1 }"
  117. class="enterprise-item"
  118. @click="handleClickEnterprise(1)"
  119. >
  120. <span>清洁能源222</span>
  121. </div> -->
  122. </div>
  123. </div>
  124. </template>
  125. <script>
  126. // import {getOrganization} from "@api/home";
  127. import SvgIcon from "@/components/coms/icon/svg-icon.vue";
  128. import { headerCompany } from "@/api/headerNav/header.js";
  129. import store from "@store/index.js";
  130. export default {
  131. name: "HomeNav", //首页标题栏
  132. props: {
  133. remove: {
  134. type: Boolean,
  135. default: true,
  136. },
  137. isShows: {
  138. type: Boolean,
  139. default: true,
  140. },
  141. wpId: {
  142. type: String,
  143. default: "",
  144. },
  145. companyid: { type: String, default: "SXJ_RGN" },
  146. },
  147. components: { SvgIcon },
  148. data() {
  149. return {
  150. OrganizationList: [],
  151. activeTab: 0,
  152. headerIndexs: -1,
  153. isShow: true,
  154. // isShows: true,
  155. nodeCode: "",
  156. activeNode: "",
  157. currentMode: "QG",
  158. wpIds: "",
  159. tabs: [
  160. {
  161. icon: "svg-all",
  162. text: "全部",
  163. show: "all",
  164. id: 0,
  165. },
  166. {
  167. icon: "svg-wind-site",
  168. text: "风电",
  169. show: "fc",
  170. id: -1,
  171. },
  172. {
  173. icon: "svg-photovoltaic",
  174. text: "光伏",
  175. show: "gf",
  176. id: -2,
  177. },
  178. ],
  179. enterpriseIndex: "all",
  180. companyName: "清洁能源",
  181. showType: "all",
  182. safeDay: "",
  183. childNode: [],
  184. };
  185. },
  186. created() {
  187. this.getOrganizationList();
  188. this.$nextTick(() => {
  189. this.$emit("firstRender", this.activeTab, this.showType, this.wpId);
  190. });
  191. },
  192. methods: {
  193. getOrganizationList() {
  194. headerCompany().then(({ data }) => {
  195. this.childNode = data.data;
  196. });
  197. // this.OrganizationList = data;
  198. // this.nodeCode = data[0].code;
  199. // this.activeNode = this.nodeCode + this.headerIndex;
  200. },
  201. handleClickEnterprise(enterprise, name) {
  202. this.companyName = name;
  203. this.enterpriseIndex = enterprise;
  204. this.$emit("typeFlag", this.showType, this.enterpriseIndex);
  205. this.$emit(
  206. "firstRender",
  207. this.activeTab,
  208. this.showType,
  209. enterprise == "all" ? "SXJ_RGN" : enterprise,
  210. enterprise == "all" ? "清洁能源" : name
  211. );
  212. },
  213. headerCheck(index, showType) {
  214. // let wpId =
  215. // this.wpId.includes("FDC") || this.wpId.includes("GDC")
  216. // ? "SXJ_RGN"
  217. // : this.wpId;
  218. // let flag = wpId == "SXJ_RGN" ? true : false;
  219. this.activeTab = index;
  220. this.showType = showType;
  221. this.$emit(
  222. "firstRender",
  223. this.activeTab,
  224. this.showType,
  225. this.wpId,
  226. this.companyName
  227. );
  228. this.$emit("typeFlag", this.showType, this.enterpriseIndex);
  229. },
  230. hideChild() {
  231. // this.isShows = !this.isShows;
  232. },
  233. },
  234. watch: {
  235. wpId(val) {
  236. if (val) {
  237. if (this.companyidval == "") {
  238. this.wpIds = val;
  239. } else {
  240. this.wpIds = this.companyidval;
  241. }
  242. }
  243. },
  244. },
  245. computed: {
  246. parentNode() {
  247. const datas = this.OrganizationList.filter((item) => {
  248. return item.preCode == "";
  249. });
  250. return datas[0];
  251. },
  252. // childNode() {
  253. // const datas = this.OrganizationList.filter((item) => {
  254. // return item.preCode != "";
  255. // });
  256. // return datas;
  257. // },
  258. },
  259. };
  260. </script>
  261. <style lang="less" scoped>
  262. .heeaderNav {
  263. height: 35px;
  264. display: flex;
  265. align-items: center;
  266. margin: 16px 0 16px 20px;
  267. }
  268. .tab-box {
  269. // margin: 1.852vh 2.778vh;
  270. display: inline-block;
  271. z-index: 2;
  272. // position: absolute;
  273. display: flex;
  274. // flex-direction: row;
  275. .tab-item {
  276. display: flex;
  277. align-items: center;
  278. justify-content: center;
  279. font-size: 14px;
  280. font-family: Microsoft YaHei;
  281. cursor: pointer;
  282. // width: 9vh;
  283. padding: 3px 14px;
  284. // margin-bottom: 1.4815vh;
  285. margin-right: 5px;
  286. &.active1 {
  287. color: @green;
  288. position: relative;
  289. background: rgba(84, 183, 90, 0.16);
  290. border-radius: 16px;
  291. &::after {
  292. content: "";
  293. position: absolute;
  294. width: 100%;
  295. height: 0.463vh;
  296. border-top: 0;
  297. left: 0;
  298. bottom: 0;
  299. box-sizing: border-box;
  300. }
  301. }
  302. .svg-icon {
  303. margin-right: 12px;
  304. margin-top: 2px;
  305. }
  306. }
  307. }
  308. .rightTitle {
  309. display: flex;
  310. margin-left: 72px;
  311. z-index: 5;
  312. .active1 {
  313. // background: rgba(84, 183, 90, 0.4);
  314. color: #05bb4c;
  315. }
  316. div {
  317. display: flex;
  318. padding: 0 14px;
  319. align-items: center;
  320. height: 25px;
  321. line-height: 25px;
  322. font-size: 15px;
  323. font-family: Microsoft YaHei;
  324. background: rgba(84, 183, 90, 0.16);
  325. border-radius: 16px;
  326. text-align: center;
  327. margin-right: 15px;
  328. cursor: pointer;
  329. .svg-icon {
  330. margin-right: 12px;
  331. }
  332. }
  333. }
  334. </style>