Bladeren bron

银农app 切换组织结构

wulanhaote
yujk 3 jaren geleden
bovenliggende
commit
e43c7e94b9
2 gewijzigde bestanden met toevoegingen van 92 en 7 verwijderingen
  1. +19
    -0
      src/api/onlineHome/done.js
  2. +73
    -7
      src/views/onlineHome/workbench.vue

+ 19
- 0
src/api/onlineHome/done.js Bestand weergeven

@@ -17,3 +17,22 @@ export function ListDone(query) {
params: query,
})
}


//获取区、镇、村地区
export function treeselectByUser(query) {
return request({
url: '/system/dept/treeselectByUser',
method: 'get',
params: query
})
}

// 切换部门
export function changeDept(query) {
return request({
url: '/system/user/changeDept',
method: 'get',
params: query
})
}

+ 73
- 7
src/views/onlineHome/workbench.vue Bestand weergeven

@@ -6,7 +6,18 @@
>
<template #left>
<van-icon name="location" color="3A80FB" size="16"/>
<p style="color: #878787;margin-left: 5px">{{deptName}}</p>
<p style="color: #878787;margin-left: 5px" @click="selectDept">{{deptName}}</p>
<van-popup v-model="villageVisbile" round position="bottom">
<van-cascader
v-model="villageValue"
title="请选择所在村"
:options="hcAreaInfoOption"
@close="hcAreaInfoClose"
@finish="hcAreaInfoFinish"
active-color="#1989fa"
:field-names="hcAreaInfoFieldName"
/>
</van-popup>
</template>
<template #right>
<van-icon name="wap-nav" color="#000" size="18"/>
@@ -462,7 +473,8 @@
<script>
import onlineHomeIndex from "../onlineHomeIndex";
import {getInfo} from "../../api/login";
import {ListTodo} from "../../api/onlineHome/done";
import {changeDept, ListTodo} from "../../api/onlineHome/done";
import {treeselectByUser} from "../../api/homestead";
export default {
components: {
onlineHomeIndex
@@ -478,18 +490,72 @@
pageSize: 100,
},
taskList:[],
//省市区区级list
hcAreaInfoOption: [],
//省市区区级显示
villageVisbile: false,
//选中的值
villageValue: "",
//选中村相关信息
villageDataObj: {
deptName: "  ", //村名
},
hcAreaInfoFieldName: {
text: "label",
value: "value",
children: "children",
},
};
},
created() {
getInfo().then(response => {
console.log(response)
this.deptName = response.user.deptName
});
// getInfo().then(response => {
// console.log(response)
// this.deptName = response.user.deptName
// });
treeselectByUser().then((res) => {
if (res.code == 200) {
let content = res.data;
this.hcAreaInfoOption = content;
if (
this.deptName == "" ||
this.deptName == undefined
) {
this.deptName = this.$store.state.user.deptName;
} else {
this.deptName = this.$store.state.user.allDeptName;
}
}
}),
ListTodo(this.queryParams).then((response) => {
this.taskList = response.rows
})
},

methods:{
villageVisbileFun() {
this.villageVisbile = true;
},
selectDept(){
this.villageVisbile = true;
},
//关闭选择地址弹窗
hcAreaInfoClose() {
this.villageVisbile = false;
},
hcAreaInfoFinish({ value, selectedOptions, tabIndex }) {
// 切换部门
let Depquery={"loginDeptID":value}
changeDept(Depquery).then((response) => {
console.log(response)
if (response.code === 200) {
this.$store.dispatch("GetInfo").then(() => {
// this.$router.go(0);
window.location.href = "/onlineHome/workbench";
});
}
});
this.villageVisbile = false;
},
}
}
</script>



Laden…
Annuleren
Opslaan