Browse Source

逻辑处理 tree网格 新增小区 为新增网格上一级id和label

kersd
井乐禹 2 years ago
parent
commit
a57993550f
  1. 72
      src/views/modules/base/community/community.vue

72
src/views/modules/base/community/community.vue

@ -250,18 +250,18 @@
</template> </template>
<script> <script>
import CDialog from '@c/CDialog'
import communityTable from './communityTable'
import buildTable from './buildTable'
import roomTable from './roomTable'
import { requestPost } from "@/js/dai/request"; import { requestPost } from "@/js/dai/request";
import { mapGetters } from 'vuex' import CDialog from '@c/CDialog';
import { Loading } from 'element-ui' // Loading import nextTick from 'dai-js/tools/nextTick';
import nextTick from 'dai-js/tools/nextTick' import { Loading } from 'element-ui'; // Loading
import { mapGetters } from 'vuex';
import buildTable from './buildTable';
import communityTable from './communityTable';
import roomTable from './roomTable';
let loading // let loading //
export default { export default {
data () { data() {
let endDisabledDate = (time) => {//datareturn let endDisabledDate = (time) => {//datareturn
let nowData = Date.now() let nowData = Date.now()
if (this.updateStartDate) { if (this.updateStartDate) {
@ -353,7 +353,7 @@ export default {
components: { components: {
CDialog CDialog
}, },
async mounted () { async mounted() {
this.treeLoading = true this.treeLoading = true
await this.loadOrgData() await this.loadOrgData()
@ -372,12 +372,12 @@ export default {
}, },
computed: { computed: {
rowHeight () { rowHeight() {
return this.$store.state.inIframe ? this.clientHeight - 140 + this.iframeHeight + 'px' : this.clientHeight - 140 + 'px' return this.$store.state.inIframe ? this.clientHeight - 140 + this.iframeHeight + 'px' : this.clientHeight - 140 + 'px'
}, },
treeHeight () { treeHeight() {
return this.$store.state.inIframe ? this.clientHeight - 200 + this.iframeHeight + 'px' : this.clientHeight - 200 + 'px' return this.$store.state.inIframe ? this.clientHeight - 200 + this.iframeHeight + 'px' : this.clientHeight - 200 + 'px'
}, },
@ -385,7 +385,7 @@ export default {
...mapGetters(['clientHeight', 'iframeHeight']) ...mapGetters(['clientHeight', 'iframeHeight'])
}, },
methods: { methods: {
handleChangeV (val) { handleChangeV(val) {
this.buildingId = ""; this.buildingId = "";
this.buildingUnitId = ""; this.buildingUnitId = "";
@ -394,19 +394,19 @@ export default {
// this.getUniList(); // this.getUniList();
// this.getHouseList(); // this.getHouseList();
}, },
handleChangeB (val) { handleChangeB(val) {
this.buildingUnitId = ""; this.buildingUnitId = "";
this.houseId = ""; this.houseId = "";
this.getUniList(); this.getUniList();
// this.getHouseList(); // this.getHouseList();
}, },
handleChangeD () { handleChangeD() {
this.houseId = ""; this.houseId = "";
this.getHouseList(); this.getHouseList();
}, },
async getValiheList () { async getValiheList() {
const { user } = this.$store.state; const { user } = this.$store.state;
if (!this.selGridId) { if (!this.selGridId) {
this.selAgencyId = this.selAgencyId ? this.selAgencyId : user.agencyId this.selAgencyId = this.selAgencyId ? this.selAgencyId : user.agencyId
@ -436,7 +436,7 @@ export default {
}, },
async getBuildList () { async getBuildList() {
const url = "/gov/org/icbuilding/buildingoption"; const url = "/gov/org/icbuilding/buildingoption";
// const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/epidemicPrevention/page" // const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/epidemicPrevention/page"
let params = { let params = {
@ -456,7 +456,7 @@ export default {
}, },
async getUniList () { async getUniList() {
const url = "/gov/org/icbuildingunit/unitoption"; const url = "/gov/org/icbuildingunit/unitoption";
// const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/epidemicPrevention/page" // const url = "http://yapi.elinkservice.cn/mock/245/epmetuser/epidemicPrevention/page"
@ -476,7 +476,7 @@ export default {
}, },
getHouseList () { getHouseList() {
this.$http this.$http
.post("/gov/org/ichouse/houseoption", { unitId: this.buildingUnitId }) .post("/gov/org/ichouse/houseoption", { unitId: this.buildingUnitId })
.then(({ data: res }) => { .then(({ data: res }) => {
@ -493,7 +493,7 @@ export default {
}); });
}, },
handleSearch () { handleSearch() {
// if (this.ownerName || this.ownerPhone || this.rentFlag || this.purpose || this.remark) { // if (this.ownerName || this.ownerPhone || this.rentFlag || this.purpose || this.remark) {
this.showRoomTable = true this.showRoomTable = true
@ -508,7 +508,7 @@ export default {
}, },
// //
resetSearch () { resetSearch() {
this.ownerName = '' this.ownerName = ''
this.ownerPhone = '' this.ownerPhone = ''
this.rentFlag = '' this.rentFlag = ''
@ -527,7 +527,7 @@ export default {
// this.loadTable() // this.loadTable()
}, },
async loadOpenNode () { async loadOpenNode() {
const url = "/gov/org/building/tree-ids" const url = "/gov/org/building/tree-ids"
let params = {} let params = {}
@ -541,7 +541,7 @@ export default {
this.$message.error(msg) this.$message.error(msg)
} }
}, },
async loadTree (isRefresh) { async loadTree(isRefresh) {
const url = "/gov/org/building/treelist" const url = "/gov/org/building/treelist"
let params = {} let params = {}
@ -570,7 +570,7 @@ export default {
}, },
// //
async loadOrgData () { async loadOrgData() {
const url = "/gov/org/agency/maporg" const url = "/gov/org/agency/maporg"
// const url = "http://yapi.elinkservice.cn/mock/245/gov/org/agency/maporg" // const url = "http://yapi.elinkservice.cn/mock/245/gov/org/agency/maporg"
let params = {} let params = {}
@ -589,7 +589,17 @@ export default {
}, },
async handleNodeClick (obj) { async handleNodeClick(obj) {
if (obj.level == "grid") {
obj.id = obj.pid
this.treeData[0]['children'].forEach(f => {
f['children'].forEach(item => {
if (item.id == obj.id) {
obj.label = item.label
}
})
})
}
this.ownerName = '' this.ownerName = ''
this.ownerPhone = '' this.ownerPhone = ''
this.rentFlag = '' this.rentFlag = ''
@ -643,7 +653,7 @@ export default {
}, },
// //
async refreshTree () { async refreshTree() {
this.treeLoading = true this.treeLoading = true
await this.loadTree(this.selTreeObj.id) await this.loadTree(this.selTreeObj.id)
this.$nextTick(() => { this.$nextTick(() => {
@ -654,7 +664,7 @@ export default {
}, },
// //
toNextLevel (row, level) { toNextLevel(row, level) {
if (level === 'community') { if (level === 'community') {
this.selTreeObj = this.$refs.ref_tree.getNode(row.neighborHoodId).data this.selTreeObj = this.$refs.ref_tree.getNode(row.neighborHoodId).data
@ -683,7 +693,7 @@ export default {
}, },
// //
getTreeObj (obj) { getTreeObj(obj) {
// //
// idtype // idtype
// idtypeidid // idtypeidid
@ -734,13 +744,13 @@ export default {
}, },
filterNode (value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.label.indexOf(value) !== -1; return data.label.indexOf(value) !== -1;
}, },
// //
startLoading () { startLoading() {
loading = Loading.service({ loading = Loading.service({
lock: true, // lock: true, //
text: '正在加载……', // text: '正在加载……', //
@ -748,7 +758,7 @@ export default {
}) })
}, },
// //
endLoading () { endLoading() {
// clearTimeout(timer); // clearTimeout(timer);
if (loading) { if (loading) {
loading.close() loading.close()
@ -756,7 +766,7 @@ export default {
} }
}, },
watch: { watch: {
filterText (val) { filterText(val) {
this.$refs.ref_tree.filter(val); this.$refs.ref_tree.filter(val);
} }
}, },

Loading…
Cancel
Save