|
@@ -0,0 +1,138 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <nav-bar ifPunch ifProject />
|
|
|
+ <div class="place-project-style">
|
|
|
+ <van-sidebar class="place-style" v-model="activeKey">
|
|
|
+ <van-sidebar-item
|
|
|
+ v-for="(item, index) in araeList"
|
|
|
+ :key="index"
|
|
|
+ :title="item.areaName"
|
|
|
+ @click="changeArea(item.areaId)"
|
|
|
+ />
|
|
|
+ </van-sidebar>
|
|
|
+ <div class="project-style">
|
|
|
+ <van-search
|
|
|
+ style="height: 60px"
|
|
|
+ v-model="value"
|
|
|
+ show-action
|
|
|
+ action-text="清除"
|
|
|
+ placeholder=""
|
|
|
+ background="#eee"
|
|
|
+ @input="filterProject"
|
|
|
+ @clear="clearSearch"
|
|
|
+ @cancel="clearSearch"
|
|
|
+ />
|
|
|
+ <div class="project-item-list-style">
|
|
|
+ <div
|
|
|
+ class="project-item-style"
|
|
|
+ v-for="(iten, indey) in projectList"
|
|
|
+ :key="indey"
|
|
|
+ @click="chooseProject(iten.projectId, iten.projectName)"
|
|
|
+ >
|
|
|
+ {{ iten.projectName }}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import navBar from "@/components/navBar";
|
|
|
+import { setStore } from "@/utils/store";
|
|
|
+import { getProjectList } from "@/api";
|
|
|
+import { noRepeat,fuzzyQuery } from "@/utils/util";
|
|
|
+import debounce from "@/utils/debounce";
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ navBar,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ activeKey: 0,
|
|
|
+ value: "",
|
|
|
+ data: [],
|
|
|
+ araeList: [],
|
|
|
+ projectList: [],
|
|
|
+ projectMainList: [],
|
|
|
+ areaId: "",
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ getProjectList().then(res => {
|
|
|
+ let result = res.items;
|
|
|
+ this.data = result;
|
|
|
+ // 过滤获取区域id
|
|
|
+ this.araeList = noRepeat(result, "areaId");
|
|
|
+ // 获取第一个区域id
|
|
|
+ let areaId = result[0].areaId;
|
|
|
+ this.areaId = areaId;
|
|
|
+ // 获取第一个区域id的中项目
|
|
|
+ this.projectList = result.filter((item) => item.areaId == areaId);
|
|
|
+ this.projectMainList = this.projectList;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 切换区域
|
|
|
+ changeArea(id) {
|
|
|
+ this.areaId = id;
|
|
|
+ this.projectList = this.data.filter((item) => item.areaId == id);
|
|
|
+ this.projectMainList = this.projectList;
|
|
|
+ },
|
|
|
+ // 选择项目
|
|
|
+ chooseProject(id, name) {
|
|
|
+ this.$store.commit("changeProgect", { id: id, name: name });
|
|
|
+ setStore({ name: "projectName", content: name, type: "" });
|
|
|
+ setStore({ name: "projectId", content: id, type: "" });
|
|
|
+ this.$router.push("/peopleManage");
|
|
|
+ },
|
|
|
+ // 查询
|
|
|
+ filterProject() {
|
|
|
+ debounce(
|
|
|
+ () => (this.projectList = fuzzyQuery(this.projectMainList, this.value))
|
|
|
+ );
|
|
|
+ },
|
|
|
+ // 清除查询
|
|
|
+ clearSearch() {
|
|
|
+ this.projectList = this.data.filter((item) => item.areaId == this.areaId);
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.place-project-style {
|
|
|
+ display: flex;
|
|
|
+ width: 100%;
|
|
|
+ .place-style {
|
|
|
+ width: 25%;
|
|
|
+ height: calc(100vh - 46px);
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ .project-style {
|
|
|
+ width: 75%;
|
|
|
+ .project-item-list-style {
|
|
|
+ height: calc(100vh - 46px - 60px);
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ .project-item-style {
|
|
|
+ height: 5vh;
|
|
|
+ padding: 10px 0 10px 20px;
|
|
|
+ line-height: 5vh;
|
|
|
+ border-bottom: 1px solid #eee;
|
|
|
+ font-size: 15px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+/deep/ .van-sidebar-item {
|
|
|
+ background: #e4e4e4;
|
|
|
+ font-size: 15px;
|
|
|
+ color: #7b7778;
|
|
|
+}
|
|
|
+/deep/ .van-sidebar-item--select {
|
|
|
+ background: #dbd7d8;
|
|
|
+}
|
|
|
+/deep/ .van-sidebar-item--select::before {
|
|
|
+ background: transparent;
|
|
|
+}
|
|
|
+</style>
|