zhangtao
laozt 1 year ago
parent 1701f748a4
commit 6ada751bb7

@ -338,7 +338,9 @@ export default {
},
//
quhuadizhi(district) {
this.option = district;
// console.log(">>>>>>>>");
// console.log(district);
// console.log(">>>>>>>>");
},
//
componendDistrict(district) {

@ -11,12 +11,14 @@
<el-cascader
size="small"
v-model="district"
:options="compartment"
:options="treeData"
:show-all-levels="false"
:disabled="isNoneDivision"
:props="props"
@change="getData"
v-if="isShow"
></el-cascader>
<el-input v-model="text" placeholder="" :disabled="!isShow" v-else />
</div>
</template>
<script>
@ -26,7 +28,10 @@ export default {
return {
//
district: "",
compartment: [],
treeData: [],
text: null,
compartment: [], //
isShow: true,
isNoneDivision: false,
props: {
checkStrictly: true,
@ -52,28 +57,48 @@ export default {
},
},
methods: {
onClear(){
this.district = ""
onClear() {
this.district = "";
},
treeList() {
// if (this.dept.parentId == 0 || this.dept.leader == "admin") {
let treeData = JSON.parse(localStorage.getItem("TREE_DATA"));
treeData.forEach((value, index) => {
this.compartment.push({
value: value.districtCode,
label: value.district,
children: [],
});
if (value.children.length > 0) {
value.children.forEach((value1, index1) => {
this.compartment[index].children.push({
value: value1.countyCode,
label: value1.county,
});
});
}
let treeData = JSON.parse(localStorage.getItem("TREE_DATA"));
treeData.forEach((value, index) => {
this.compartment.push({
value: value.districtCode,
label: value.district,
children: [],
});
// }
if (value.children.length > 0) {
value.children.forEach((value1, index1) => {
this.compartment[index].children.push({
value: value1.countyCode,
label: value1.county,
});
});
}
});
let userInfo = JSON.parse(sessionStorage.getItem("USER_INFO"));
// console.log(userInfo.lawLevel);
//
if (userInfo.lawLevel == "市级") {
this.treeData = this.compartment;
}
//
else if (userInfo.lawLevel == "县级") {
this.district = userInfo.permissionCode;
this.treeData = this.compartment.filter(
(item) => item.value === this.district
);
}
//
else if (userInfo.lawLevel == "镇级") {
this.isShow = false;
this.text = userInfo.permissionDescription;
}
// this.district = "320582403"
// console.log(JSON.stringify(this.compartment));
this.$emit("quhuadizhi", this.compartment);
},
getData(e) {

Loading…
Cancel
Save