166 lines
3.1 KiB
Vue
166 lines
3.1 KiB
Vue
<template>
|
|
<u-popup mode="bottom" :show="show" @close="close">
|
|
<landItem ref="landItemRef" :data="data" @getLand="getLandListHandle" @select="selectLand" />
|
|
</u-popup>
|
|
</template>
|
|
|
|
<script>
|
|
import store from "@/store"
|
|
import {
|
|
companyTreeSelect
|
|
} from "@/api/system/company.js"
|
|
import {
|
|
getLandList
|
|
} from "@/api/system/land.js"
|
|
|
|
import landItem from './custom-select-land-item.vue'
|
|
|
|
export default {
|
|
name: 'custom-select-land',
|
|
components: {
|
|
landItem,
|
|
},
|
|
emits: ["select"],
|
|
props: {
|
|
data: {
|
|
type: Array,
|
|
default: () => [],
|
|
// required: true
|
|
},
|
|
selectLand: {
|
|
type: Object,
|
|
default: () => {},
|
|
// required: true
|
|
},
|
|
},
|
|
watch: {
|
|
data: function(a, b) {
|
|
console.error("data:", a);
|
|
console.error("data:", b);
|
|
}
|
|
// data: {
|
|
// deep: true,
|
|
// immediate: true,
|
|
// handler: function(v) {
|
|
// console.error("data:", v);
|
|
// },
|
|
// },
|
|
},
|
|
data() {
|
|
return {
|
|
show: false,
|
|
companyOptions: [],
|
|
}
|
|
},
|
|
created() {
|
|
this.getcompanyTree();
|
|
},
|
|
methods: {
|
|
/** 查询部门下拉树结构 */
|
|
getcompanyTree() {
|
|
let obj = {
|
|
status: 0,
|
|
delFlag: "0",
|
|
companyTypes: [1, 2, 3],
|
|
}
|
|
companyTreeSelect(obj).then(response => {
|
|
// console.error("response:", response);
|
|
// response.data.forEach(object => {
|
|
// this.addParentName(object);
|
|
// });
|
|
this.companyOptions = response.data;
|
|
if (this.selectFirst) {
|
|
|
|
}
|
|
// console.error("companyOptions:", this.companyOptions);
|
|
// this.setSelectKey(this.companyOptions[0].id);
|
|
|
|
// this.treeList = res.data;
|
|
// if (this.treeList && this.treeList.length) {
|
|
// let companyList = this.treeList[0].children.filter(x => x.id != 100);
|
|
// if (companyList && companyList.length) {
|
|
// this.defaultCheckedKeys = companyList[0].id + "";
|
|
// }
|
|
// }
|
|
});
|
|
},
|
|
getLandListHandle(e) {
|
|
console.error("getLandListHandle:", e);
|
|
getLandList({
|
|
companyGroupId: e.node.rootCompanyId,
|
|
companyId: e.node.companyId,
|
|
status: 0,
|
|
delFlag: 0,
|
|
}).then(res => {
|
|
console.error("res:", res);
|
|
if (res.data) {
|
|
this.$refs.landItemRef.addLand(e, res.data);
|
|
}
|
|
});
|
|
},
|
|
selectLand(e) {
|
|
console.error("selectLand:", e);
|
|
this.$emit('select', e);
|
|
this.close();
|
|
},
|
|
|
|
//打开弹窗
|
|
open() {
|
|
this.show = true;
|
|
// this.showIndex = this.indexData.showIndex;
|
|
// if (this.indexData.list.length > 0) {
|
|
// this.show = true;
|
|
// } else {
|
|
// this.$toast("无数据");
|
|
// }
|
|
},
|
|
//关闭弹窗
|
|
close() {
|
|
this.show = false;
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
$list-height: 100px;
|
|
|
|
::v-deep.u-popup__content {
|
|
min-width: 240px;
|
|
|
|
.u-collapse {
|
|
height: 100vh;
|
|
overflow-y: auto;
|
|
|
|
}
|
|
|
|
.u-cell__right-icon-wrap--down,
|
|
.u-cell__right-icon-wrap--up {
|
|
transform: none;
|
|
}
|
|
|
|
.u-collapse-item__content__text {
|
|
padding: 0;
|
|
}
|
|
|
|
.u-cell__body__content {
|
|
.icon {
|
|
color: #3c9cff;
|
|
font-size: 44rpx;
|
|
}
|
|
|
|
}
|
|
|
|
.u-collapse-content {
|
|
font-size: 28rpx;
|
|
|
|
.icon {
|
|
color: #39ac4f;
|
|
}
|
|
}
|
|
|
|
.checked {
|
|
border-bottom: 2px solid #66ccff;
|
|
}
|
|
}
|
|
</style> |