index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. <template>
  2. <div>
  3. <ul>
  4. <div class="rightTitle">
  5. <li>
  6. <el-select
  7. v-model="tagListNode"
  8. placeholder="请选择"
  9. @change="tagListChang"
  10. >
  11. <el-option
  12. v-show="item.flag"
  13. v-for="(item, indexe) in tagList"
  14. :key="indexe"
  15. :label="item.name"
  16. :value="item.type"
  17. >
  18. </el-option>
  19. </el-select>
  20. </li>
  21. <li>
  22. <el-select
  23. v-model="checkNode"
  24. :placeholder="parentNode?.aname"
  25. clearable
  26. :multiple="companyMultiple"
  27. collapse-tags
  28. @change="dataChang"
  29. >
  30. <el-option
  31. v-for="(item, indexe) in OrganizationLists"
  32. :key="indexe"
  33. :label="item.aname"
  34. :value="item.id"
  35. >
  36. </el-option>
  37. </el-select>
  38. </li>
  39. <li v-if="hiddenStation && stationList.length > 0">
  40. <el-select
  41. v-model="checkStation"
  42. placeholder="全部场站"
  43. clearable
  44. :multiple="stationMultiple"
  45. collapse-tags
  46. @change="dataChangs"
  47. >
  48. <el-option
  49. v-for="(item, index) in stationList"
  50. :key="index"
  51. :label="item.aname"
  52. :value="item.id"
  53. >
  54. </el-option>
  55. </el-select>
  56. </li>
  57. <li v-if="hiddenProject">
  58. <div class="station">
  59. 项目:
  60. <el-select
  61. size="mini"
  62. v-model="projectObj"
  63. placeholder="请选择"
  64. @change="handleProjectChange(projectObj)"
  65. clearable
  66. >
  67. <el-option
  68. v-for="item in projectList"
  69. :key="item.id"
  70. :label="item.aname"
  71. :value="item.id"
  72. >
  73. </el-option>
  74. </el-select>
  75. </div>
  76. </li>
  77. <li v-if="hiddenLine">
  78. <div class="station">
  79. 线路:
  80. <el-select
  81. size="mini"
  82. v-model="lineObj"
  83. placeholder="请选择"
  84. clearable
  85. @change="typeClick('1')"
  86. >
  87. <el-option
  88. v-for="item in lineList"
  89. :key="item.id"
  90. :label="item.aname"
  91. :value="item.id"
  92. >
  93. </el-option>
  94. </el-select>
  95. </div>
  96. </li>
  97. <li v-if="hiddenProject">
  98. <div class="but">
  99. <el-button
  100. round
  101. size="mini"
  102. class="buttons active"
  103. @click="getPerformance"
  104. >搜索</el-button
  105. >
  106. <el-button round size="mini" class="buttons" @click="mxClick"
  107. >明细</el-button
  108. >
  109. <!-- <el-button round size="mini" class="buttons">导出</el-button> -->
  110. </div>
  111. </li>
  112. </div>
  113. </ul>
  114. </div>
  115. </template>
  116. <script>
  117. import { GetOrganization, GetStationByCompany } from "@/api/headerNav.js";
  118. export default {
  119. name: "HomeNav", //首页标题栏
  120. props: {
  121. type: {
  122. type: Number,
  123. default: -2,
  124. },
  125. handType: String,
  126. codeRight: String,
  127. codeNums: String, // 公司Code
  128. stationCode: String, // 场站Code
  129. shangeColor: String,
  130. hiddenStation: {
  131. type: Boolean,
  132. default: true,
  133. },
  134. hiddenProject: {
  135. type: Boolean,
  136. default: false,
  137. },
  138. hiddenLine: {
  139. type: Boolean,
  140. default: false,
  141. },
  142. hiddenSearch: {
  143. type: Boolean,
  144. default: false,
  145. },
  146. stationMultiple: {
  147. type: Boolean,
  148. default: false,
  149. },
  150. companyMultiple: {
  151. type: Boolean,
  152. default: false,
  153. },
  154. intoCheckNode: {
  155. // 是否需要默认选中公司,将codeRight(公司code)传给checkNode,
  156. type: Boolean,
  157. default: false,
  158. },
  159. },
  160. data() {
  161. return {
  162. OrganizationLists: [{ id: "JS_RGN", aname: "江苏区域" }], //公司列表
  163. stationList: [], //场站列表
  164. checkStation: "", //场站值
  165. checkNode: "JS_RGN", //公司值
  166. tagList: [
  167. { type: -1, flag: true, id: "F", name: "风电" },
  168. { type: -2, flag: true, id: "G", name: "光伏" }, //类型
  169. ],
  170. tagListNode: -2, //类型值
  171. projectObj: "",
  172. projectList: [],
  173. lineObj: "",
  174. lineList: [],
  175. };
  176. },
  177. async created() {
  178. await this.getOrganizationLists(this.tagListNode, true);
  179. if (this.shangeColor != "") {
  180. this.s = this.shangeColor;
  181. } else {
  182. this.s = "all";
  183. }
  184. },
  185. methods: {
  186. //获取区域公司
  187. async getOrganizationLists(val, flag) {
  188. const { data } = await GetOrganization({ type: val });
  189. this.OrganizationLists = data;
  190. if (!flag) {
  191. this.tagList.forEach((item) => {
  192. if (item.id != val) {
  193. item.flag = false;
  194. }
  195. });
  196. }
  197. if (this.checkNode != "") {
  198. this.getPowerStation(this.checkNode);
  199. } else {
  200. this.stationList = "";
  201. }
  202. this.$emit("firstRender", this.tagListNode, this.checkNode);
  203. },
  204. deepClone(ob) {
  205. var obj = JSON.stringify(ob);
  206. var objClone = JSON.parse(obj);
  207. return objClone;
  208. },
  209. // 切换风光水
  210. tagListChang(val) {
  211. // this.tagListNode = val;
  212. // if (this.checkNode == "JS_RGN") {
  213. // this.getOrganizationLists(val, true);
  214. // } else {
  215. // this.getOrganizationLists(val);
  216. // }
  217. if (val == -1) {
  218. this.$router.push({ path: "/economicsOperation/homePage" });
  219. } else if (val == -2) {
  220. this.$router.push({ path: "/economicsOperation/homePageGf" });
  221. }
  222. },
  223. //区域切换
  224. dataChang(id) {
  225. //根据区域公司编码获取场站信息
  226. this.checkStation = "";
  227. this.checkNode = id;
  228. if (id != "JS_RGN") {
  229. let comp = this.OrganizationLists.find((item) => item.id == id);
  230. this.tagList.forEach((item) => {
  231. if (item.id != comp.eleType) {
  232. item.flag = false;
  233. } else {
  234. item.flag = true;
  235. }
  236. });
  237. this.tagListNode = comp.eleType == "F" ? -1 : -2;
  238. } else {
  239. this.tagList = [
  240. { type: -1, flag: true, id: "F", name: "风电" },
  241. { type: -2, flag: true, id: "G", name: "光伏" },
  242. ];
  243. this.tagListNode = this.tagList[0].type;
  244. }
  245. if (id.length > 0) {
  246. this.getPowerStation(id);
  247. } else {
  248. this.stationList = "";
  249. }
  250. this.$emit("firstRender", this.tagListNode, id, "");
  251. },
  252. //获取场站信息
  253. async getPowerStation(val) {
  254. const { data } = await GetStationByCompany({
  255. companyids: val,
  256. type: this.tagListNode,
  257. });
  258. this.stationList = data;
  259. },
  260. //区域切换
  261. async dataChangs(val) {
  262. //根据区域公司编码获取场站信息
  263. if (val.length == 0) {
  264. this.checkStation = "";
  265. }
  266. this.$emit("firstRender", this.tagListNode, this.checkNode, val);
  267. },
  268. },
  269. watch: {
  270. type: {
  271. handler(val) {
  272. if (val == -1) {
  273. this.tagListNode = -1;
  274. } else if (val == -2) {
  275. this.tagListNode = -2;
  276. }
  277. },
  278. immediate: true,
  279. },
  280. },
  281. };
  282. </script>
  283. <style lang="less" scoped>
  284. ::v-deep .el-input__suffix {
  285. display: inline-block;
  286. right: 0 !important;
  287. width: 80px !important;
  288. }
  289. ::v-deep .el-input__suffix .el-icon-circle-close {
  290. position: absolute;
  291. top: -7px !important;
  292. right: 18px !important;
  293. }
  294. ::v-deep .el-input__suffix .el-icon-arrow-up {
  295. display: block !important;
  296. right: -52px !important;
  297. }
  298. ul {
  299. user-select: none;
  300. display: flex;
  301. .headerRight {
  302. padding: 0 14px;
  303. height: 25px;
  304. line-height: 25px;
  305. background: rgba(0, 70, 199, 0.2);
  306. border-radius: 16px;
  307. text-align: center;
  308. margin-right: 15px;
  309. cursor: pointer;
  310. span {
  311. width: 29px;
  312. height: 12px;
  313. font-size: 14px;
  314. font-family: Microsoft YaHei;
  315. font-weight: 400;
  316. color: #b3b3b3;
  317. }
  318. i {
  319. font-size: 16px;
  320. color: #b3b3b3;
  321. position: relative;
  322. margin-right: 9px;
  323. vertical-align: -9%;
  324. }
  325. }
  326. .forbidden {
  327. background: #666666;
  328. opacity: 0.5;
  329. span {
  330. color: #b3b3b3;
  331. }
  332. }
  333. .active {
  334. background: rgba(0, 70, 199, 0.4);
  335. .active_icon {
  336. color: rgba(28, 153, 255, 1);
  337. }
  338. span {
  339. color: #ffffff;
  340. }
  341. }
  342. .nav_right {
  343. transition: 0.3s;
  344. }
  345. .nav_right:first-of-type {
  346. margin-left: 30px;
  347. }
  348. p {
  349. width: 60px;
  350. }
  351. .rightTitle {
  352. display: flex;
  353. }
  354. }
  355. .active.light {
  356. background: rgba(255, 131, 0, 0.2);
  357. i {
  358. color: rgba(255, 131, 0, 1);
  359. }
  360. }
  361. .active.wind {
  362. background-color: rgba(0, 70, 199, 0.4);
  363. i {
  364. color: #1c99ff;
  365. }
  366. }
  367. .active.hydraulic {
  368. background-color: rgba(0, 252, 255, 0.2);
  369. i {
  370. color: #00fcff;
  371. }
  372. }
  373. .active.energy {
  374. background-color: rgba(230, 59, 13, 0.2);
  375. i {
  376. color: #e63b0d;
  377. }
  378. }
  379. .station {
  380. display: flex;
  381. flex-direction: row;
  382. align-items: center;
  383. font-size: 14px;
  384. font-family: Microsoft YaHei;
  385. font-weight: 400;
  386. color: #b3b3b3;
  387. margin-right: 10px;
  388. }
  389. .but {
  390. display: flex;
  391. flex-direction: row;
  392. align-content: center;
  393. margin-left: 20px;
  394. }
  395. .buttons {
  396. background-color: rgba(0, 70, 199, 0.2);
  397. border: 1px solid #3b4c6c;
  398. color: #b3b3b3;
  399. font-size: 14px;
  400. &:hover,
  401. &.active {
  402. background-color: rgba(0, 70, 199, 0.5);
  403. color: #ffffff;
  404. }
  405. }
  406. </style>