Merge branch 'main' of http://39.101.188.84:8000/suzhou-jichuang-lanhai/suzhouyingjiPC
commit
1ff9d3ddb7
@ -0,0 +1,78 @@
|
||||
<template>
|
||||
<div >
|
||||
<el-cascader
|
||||
size="small"
|
||||
v-model="district"
|
||||
:options="compartment"
|
||||
:show-all-levels="false"
|
||||
:disabled="isNoneDivision"
|
||||
:props="props"
|
||||
@change="getData"
|
||||
></el-cascader>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { xzTree } from "@/api/yingji/keyEnterprise.js";
|
||||
import { mapState } from "vuex";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
//区划的禁用
|
||||
district: "",
|
||||
compartment: [],
|
||||
isNoneDivision: false,
|
||||
props: {
|
||||
checkStrictly: true,
|
||||
value: "value",
|
||||
label: "label",
|
||||
children: "children",
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.xzList();
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
//根据存储的dept.parentId判断是哪个等级
|
||||
dept: (state) => state.user.dept,
|
||||
}),
|
||||
},
|
||||
methods: {
|
||||
xzList() {
|
||||
xzTree().then((res) => {
|
||||
// console.log(this.dept.parentId);
|
||||
if (this.dept.parentId == 0) {
|
||||
res.data.forEach((value, index) => {
|
||||
this.compartment.push({
|
||||
value: value.county,
|
||||
label: value.institutionName,
|
||||
children: [],
|
||||
});
|
||||
if (value.children.length > 0) {
|
||||
value.children.forEach((value1, index1) => {
|
||||
this.compartment[index].children.push({
|
||||
value: value1.subdistrict,
|
||||
label: value1.institutionName,
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
getData(e) {
|
||||
if (e.length == 1) {
|
||||
this.$emit("quhua", e[0].slice(0, 8));
|
||||
} else if (e.length == 2 && e[0] == e[1]) {
|
||||
this.$emit("quhua", e[0].slice(0, 8));
|
||||
} else {
|
||||
this.$emit("quhua", e[1].slice(0, 11));
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
||||
</style>
|
Loading…
Reference in new issue