Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 

521 řádky
15 KiB

  1. <template>
  2. <div class="avue-top">
  3. <div class="top-bar__left">
  4. <div
  5. v-if="showCollapse"
  6. :class="[{ 'avue-breadcrumb--active': isCollapse }]"
  7. class="avue-breadcrumb"
  8. >
  9. <i class="icon-navicon" @click="setCollapse" />
  10. </div>
  11. </div>
  12. <div class="top-bar__title" style="display: flex; align-items: center">
  13. <top-menu />
  14. <div
  15. style="
  16. line-height: 64px;
  17. cursor: pointer;
  18. display: flex;
  19. align-items: center;
  20. height: 64px;
  21. "
  22. >
  23. <!-- <div class="daili2">
  24. <img class="daili2img" src="/img/qh2.png" alt="" />
  25. </div> -->
  26. <div class="daili">
  27. {{
  28. orgType == 0
  29. ? "系统后台"
  30. : orgType == 1
  31. ? "代理商后台"
  32. : orgType == 2
  33. ? "公司后台"
  34. : "项目后台"
  35. }}
  36. </div>
  37. <el-button @click="goChange" class="avue-header" style="margin-left: 10px;color: #fff;padding: 10px;">切换后台</el-button>
  38. </div>
  39. <div
  40. v-if="companyName"
  41. @click="goBack"
  42. style="
  43. line-height: 64px;
  44. cursor: pointer;
  45. display: flex;
  46. align-items: center;
  47. height: 64px;
  48. margin-left: 20px;
  49. "
  50. >
  51. <!-- <div class="daili2">
  52. <img class="daili2img" src="/img/qh1.png" alt="" />
  53. </div> -->
  54. <div class="daili">
  55. {{ companyName }}
  56. </div>
  57. <el-button @click="goBack" class="avue-header" style="margin-left: 10px;color: #fff;padding: 10px;">切换项目</el-button>
  58. </div>
  59. </div>
  60. <div class="top-bar__right">
  61. <el-tooltip
  62. v-if="showColor"
  63. effect="dark"
  64. content="主题色"
  65. placement="bottom"
  66. >
  67. <div class="top-bar__item">
  68. <top-color />
  69. </div>
  70. </el-tooltip>
  71. <!-- <el-tooltip
  72. v-if="showDebug"
  73. :content="logsFlag ? '没有错误日志' : `${logsLen}条错误日志`"
  74. effect="dark"
  75. placement="bottom"
  76. >
  77. <div class="top-bar__item">
  78. <top-logs />
  79. </div>
  80. </el-tooltip> -->
  81. <el-tooltip
  82. v-if="showLock"
  83. effect="dark"
  84. content="锁屏"
  85. placement="bottom"
  86. >
  87. <div class="top-bar__item">
  88. <top-lock />
  89. </div>
  90. </el-tooltip>
  91. <!-- 暂时注释下一版本开发上线 -->
  92. <!-- <el-popover placement="bottom" trigger="hover" width="350">
  93. <el-table :data="gridData" @row-click="msgTap">
  94. <el-table-column
  95. width="324"
  96. property="date"
  97. :show-header="false"
  98. >
  99. <template slot-scope="scope">
  100. <div class="date">
  101. <span>{{ scope.row.dates }}</span>
  102. <span>{{ scope.row.date }}</span>
  103. </div>
  104. </template>
  105. </el-table-column>
  106. </el-table>
  107. <i slot="reference" class="el-icon-bell" style="font-size: 18px;color: #fff;"></i>
  108. </el-popover> -->
  109. <el-tooltip
  110. v-if="showTheme"
  111. effect="dark"
  112. content="特色主题"
  113. placement="bottom"
  114. >
  115. <div class="top-bar__item top-bar__item--show">
  116. <top-theme />
  117. </div>
  118. </el-tooltip>
  119. <el-tooltip
  120. v-if="showFullScreen"
  121. :content="isFullScreen ? '退出全屏' : '全屏'"
  122. effect="dark"
  123. placement="bottom"
  124. >
  125. <div class="top-bar__item">
  126. <i
  127. :class="isFullScreen ? 'icon-zuixiaohua' : 'icon-quanpingzuidahua'"
  128. @click="handleScreen"
  129. />
  130. </div>
  131. </el-tooltip>
  132. <el-tooltip
  133. v-if="userInfo.avatar"
  134. effect="dark"
  135. content="用户头像"
  136. placement="bottom"
  137. >
  138. </el-tooltip>
  139. <el-dropdown style="cursor: pointer">
  140. <span class="el-dropdown-link">
  141. {{ userInfo.username }}
  142. <i class="el-icon-arrow-down el-icon--right" />
  143. </span>
  144. <el-dropdown-menu slot="dropdown">
  145. <el-dropdown-item divided>
  146. <router-link to="/">首页</router-link>
  147. </el-dropdown-item>
  148. <el-dropdown-item divided>
  149. <router-link to="/info/index">个人信息</router-link>
  150. </el-dropdown-item>
  151. <el-dropdown-item divided @click.native="$refs.seting.open()"
  152. >界面设置
  153. </el-dropdown-item>
  154. <el-dropdown-item divided @click.native="logout"
  155. >退出系统
  156. </el-dropdown-item>
  157. </el-dropdown-menu>
  158. </el-dropdown>
  159. <top-setting ref="seting" />
  160. </div>
  161. </div>
  162. </template>
  163. <script>
  164. import { mapGetters, mapState } from "vuex";
  165. import { fullscreenToggel, handleImg, listenfullscreen } from "@/util/util";
  166. import topLock from "./top-lock";
  167. import topMenu from "./top-menu";
  168. import topTheme from "./top-theme";
  169. import topLogs from "./top-logs";
  170. import topColor from "./top-color";
  171. import topSetting from "./top-setting";
  172. import { getStore, setStore } from "@/util/store";
  173. export default {
  174. name: "Top",
  175. components: {
  176. topLock,
  177. topMenu,
  178. topTheme,
  179. topLogs,
  180. topColor,
  181. topSetting,
  182. },
  183. filters: {},
  184. data() {
  185. return {
  186. options: [],
  187. value: "",
  188. companyName: localStorage.getItem("topName"),
  189. orgType: localStorage.getItem("orgType"),
  190. info: {},
  191. gridData: [
  192. {
  193. date: '121',
  194. dates: '阿达萨达撒',
  195. },
  196. {
  197. dates: '阿达萨达撒',
  198. date: '122'
  199. },
  200. {
  201. dates: '阿达萨达撒',
  202. date: '132'
  203. },
  204. {
  205. dates: '阿达萨达撒',
  206. date: '125'
  207. },
  208. {
  209. dates: '阿达萨达撒',
  210. date: '126'
  211. },
  212. {
  213. dates: '阿达萨达撒',
  214. date: '172'
  215. },
  216. {
  217. dates: '阿达萨达撒',
  218. date: '182'
  219. },
  220. {
  221. dates: '阿达萨达撒',
  222. date: '120'
  223. },
  224. ]
  225. };
  226. },
  227. computed: {
  228. ...mapState({
  229. showDebug: (state) => state.common.showDebug,
  230. showTheme: (state) => state.common.showTheme,
  231. showLock: (state) => state.common.showLock,
  232. showFullScreen: (state) => state.common.showFullScreen,
  233. showCollapse: (state) => state.common.showCollapse,
  234. showMenu: (state) => state.common.showMenu,
  235. showColor: (state) => state.common.showColor,
  236. }),
  237. ...mapGetters([
  238. "userInfo",
  239. "isFullScreen",
  240. "tagWel",
  241. "tagList",
  242. "isCollapse",
  243. "tag",
  244. "logsLen",
  245. "logsFlag",
  246. ]),
  247. },
  248. created() {
  249. handleImg(this.userInfo.avatar, "thumbnail");
  250. // this.getHouseList() //获取当前人的所有项目
  251. },
  252. mounted() {
  253. listenfullscreen(this.setScreen);
  254. this.info = getStore({ name: "userInfo" });
  255. },
  256. methods: {
  257. // 弹窗消息点击触发事件
  258. msgTap(e) {
  259. console.log(e, 'asdjilksajl')
  260. this.$router.push('/message')
  261. },
  262. handleScreen() {
  263. fullscreenToggel();
  264. },
  265. selectChange(e) {
  266. console.log(e);
  267. this.$emit("selectChange"); //关闭所有
  268. localStorage.setItem("houseId", e);
  269. },
  270. // getHouseList(){
  271. // this.$api.api.queryHouseByUsername()
  272. // .then(res=>{
  273. // // console.log(res);
  274. // this.options=res.data
  275. // this.value=res.data[0].id
  276. // localStorage.setItem('houseId',this.value)
  277. // })
  278. // },
  279. goBack() {
  280. // 判断后退是否退回去选择页面
  281. let idx = localStorage.getItem("orgType");
  282. if (idx == 0) {
  283. // 质控管家后台
  284. // localStorage.setItem("topName", "");
  285. // localStorage.setItem("orgCode", "");
  286. // localStorage.setItem("houseId", "");
  287. // localStorage.setItem("agentId", "");
  288. return;
  289. }
  290. // 当他为其他时 先获取是否只有一个选项,然后在来进行判断
  291. if (idx == 1) {
  292. this.getAgentList();
  293. // 代理商
  294. }
  295. if (idx == 2) {
  296. this.getCompanyList();
  297. // 公司后台
  298. }
  299. if (idx == 3) {
  300. this.findByUserName();
  301. // 项目后台
  302. }
  303. },
  304. goChange() {
  305. let that = this;
  306. this.$api.api.getTab().then((res) => {
  307. // console.log(res)
  308. // 循环数组,给定各种标志
  309. if (res.data.length == 0) {
  310. // this.$message.warning("您已经被禁用");
  311. this.$message.warning("账号已禁止登录,请联系管理员恢复");
  312. } else if (res.data.length == 1) {
  313. let idx = res.data[0].orgType;
  314. localStorage.setItem("orgType", idx);
  315. // 给定一个判断是否可以跳转的东西
  316. localStorage.setItem("backFlag", false);
  317. // 当他只有质控后台时,不需要多余操作
  318. if (idx == 0) {
  319. // 质控管家后台
  320. localStorage.setItem("topName", "");
  321. localStorage.setItem("orgCode", "");
  322. localStorage.setItem("houseId", "");
  323. localStorage.setItem("agentId", "");
  324. // that.$router.push({ path: "/wel" });
  325. }
  326. // 当他为其他时 先获取是否只有一个选项,然后在来进行判断
  327. if (idx == 1) {
  328. this.getAgentList();
  329. // 代理商
  330. }
  331. if (idx == 2) {
  332. this.getCompanyList();
  333. // 公司后台
  334. }
  335. if (idx == 3) {
  336. this.findByUserName();
  337. // 项目后台
  338. }
  339. } else {
  340. this.$router.push({ path: "/check", query: { backFlag: true } });
  341. }
  342. });
  343. },
  344. // 获取代理商
  345. getAgentList() {
  346. this.$api.api
  347. .zkagentPage({
  348. current: 1,
  349. pageSize: 10,
  350. })
  351. .then((res) => {
  352. // console.log(res);
  353. // this.list = res.data.records;
  354. // this.total = res.data.total;
  355. if (res.data.total == 0) {
  356. this.$message.warning("您当前并未代理商");
  357. return;
  358. } else if (res.data.total > 1) {
  359. // 公司后台
  360. this.$router.push({ path: "/chose", query: { flag: 1 } });
  361. } else {
  362. this.$message.warning("您没有多余的代理商");
  363. return;
  364. this.$router.push({ path: "/wel" });
  365. localStorage.setItem("topName", res.data.records[0].agentName);
  366. localStorage.setItem("agentId", res.data.records[0].id);
  367. localStorage.setItem("orgCode", "");
  368. localStorage.setItem("houseId", "");
  369. }
  370. });
  371. },
  372. getCompanyList() {
  373. this.$api.api
  374. .zkorg({
  375. current: 1,
  376. size: 10,
  377. orgType: localStorage.getItem("orgType"),
  378. })
  379. .then((res) => {
  380. // console.log(res);
  381. // this.list = res.data.records;
  382. // this.total = res.data.total;
  383. if (res.data.total == 0) {
  384. this.$message.warning("您当前并未绑定公司");
  385. return;
  386. } else if (res.data.total > 1) {
  387. // 公司后台
  388. this.$router.push({ path: "/chose", query: { flag: 2 } });
  389. } else {
  390. this.$message.warning("您没有多余的公司");
  391. return;
  392. // this.$router.push({ path: "/wel" });
  393. localStorage.setItem("topName", res.data.records[0].name);
  394. localStorage.setItem("orgCode", res.data.records[0].orgCode);
  395. localStorage.setItem("agentId", "");
  396. localStorage.setItem("houseId", "");
  397. }
  398. });
  399. },
  400. findByUserName() {
  401. this.$api.api
  402. .findByUserName({
  403. username: this.info.username,
  404. })
  405. .then((res) => {
  406. // console.log(res);
  407. this.info.selectHouseType = res.selectHouseType;
  408. // 获取项目
  409. this.zkhousePage();
  410. });
  411. },
  412. zkhousePage() {
  413. let obj = {
  414. current: 1,
  415. size: 10,
  416. orgType: localStorage.getItem("orgType"),
  417. };
  418. if (this.info.selectHouseType == 1) {
  419. this.$api.api.zkhousePage(obj).then((res) => {
  420. // console.log(res)
  421. // this.list = res.data.records;
  422. // this.total = res.data.total;
  423. if (res.data.total == 0) {
  424. this.$message.warning("您当前并未绑定项目");
  425. return;
  426. } else if (res.data.total > 1) {
  427. // 公司后台
  428. this.$router.push({ path: "/chose", query: { flag: 3 } });
  429. } else {
  430. this.$message.warning("您没有多余的项目");
  431. return;
  432. // this.$router.push({ path: "/wel" });
  433. localStorage.setItem("topName", res.data.records[0].propertyName);
  434. localStorage.setItem("orgCode", res.data.records[0].orgCode);
  435. localStorage.setItem("agentId", "");
  436. localStorage.setItem("houseId", res.data.records[0].id);
  437. }
  438. });
  439. }
  440. if (this.info.selectHouseType == 2) {
  441. this.$api.api
  442. .findHouseByArea({
  443. id: null,
  444. ...obj,
  445. })
  446. .then((res) => {
  447. // console.log(res)
  448. // this.list = res.data.records;
  449. // this.total = res.data.total;
  450. if (res.data.total == 0) {
  451. this.$message.warning("您当前并未绑定项目");
  452. return;
  453. } else if (res.data.total > 1) {
  454. // 公司后台
  455. this.$router.push({ path: "/chose", query: { flag: 3 } });
  456. } else {
  457. this.$message.warning("您没有多余的项目");
  458. return;
  459. // this.$router.push({ path: "/wel" });
  460. localStorage.setItem("topName", res.data.records[0].propertyName);
  461. localStorage.setItem("orgCode", res.data.records[0].orgCode);
  462. localStorage.setItem("houseId", res.data.records[0].id);
  463. localStorage.setItem("agentId", "");
  464. }
  465. });
  466. }
  467. },
  468. setCollapse() {
  469. this.$store.commit("SET_COLLAPSE");
  470. },
  471. setScreen() {
  472. this.$store.commit("SET_FULLSCREEN");
  473. },
  474. logout() {
  475. this.$confirm("是否退出系统, 是否继续?", "提示", {
  476. confirmButtonText: "确定",
  477. cancelButtonText: "取消",
  478. type: "warning",
  479. }).then(() => {
  480. this.$store.dispatch("LogOut").then(() => {
  481. this.$router.push({ path: "/login" });
  482. });
  483. });
  484. },
  485. },
  486. };
  487. </script>
  488. <style lang="scss" scoped>
  489. .daili {
  490. color: #ffffff;
  491. font-size: 15px;
  492. margin-left: 4px;
  493. }
  494. .daili2 {
  495. height: 100%;
  496. line-height: 58px;
  497. .daili2img {
  498. width: 15px;
  499. height: 14px;
  500. }
  501. }
  502. .change {
  503. font-size: 16px;
  504. // color: #2671e2;
  505. color: white;
  506. margin-left: 10px;
  507. }
  508. .date {
  509. display: flex;
  510. flex-direction: column;
  511. }
  512. </style>