0703
This commit is contained in:
@@ -83,105 +83,105 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listOrganizations } from '@/api/organization/manage';
|
||||
import { groupTypeUsers, centerUsers } from '@/api/organization/user';
|
||||
import { listOrganizations } from '@/api/organization/manage';
|
||||
import { groupTypeUsers, centerUsers } from '@/api/organization/user';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
// 默认表单数据
|
||||
const defaultWhere = {
|
||||
username: '',
|
||||
mobile: '',
|
||||
orgId: '',
|
||||
teamId: '',
|
||||
groupType: '',
|
||||
centerNumber: ''
|
||||
};
|
||||
return {
|
||||
// 表单数据
|
||||
where: { ...defaultWhere },
|
||||
teamList: [],
|
||||
groupList: [],
|
||||
centerList: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initData();
|
||||
},
|
||||
methods: {
|
||||
async initData() {
|
||||
try {
|
||||
await this.loadOrg();
|
||||
await this.loadOrgTeam();
|
||||
await Promise.all([
|
||||
groupTypeUsers()
|
||||
.then((data) => {
|
||||
this.groupList = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
}),
|
||||
centerUsers()
|
||||
.then((data) => {
|
||||
this.centerList = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
})
|
||||
]);
|
||||
} catch (e) {
|
||||
this.$message.error(e.message);
|
||||
export default {
|
||||
data() {
|
||||
// 默认表单数据
|
||||
const defaultWhere = {
|
||||
username: '',
|
||||
mobile: '',
|
||||
orgId: '',
|
||||
teamId: '',
|
||||
groupType: '',
|
||||
centerNumber: ''
|
||||
};
|
||||
return {
|
||||
// 表单数据
|
||||
where: { ...defaultWhere },
|
||||
teamList: [],
|
||||
groupList: [],
|
||||
centerList: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 是否开启响应式布局
|
||||
styleResponsive() {
|
||||
return this.$store.state.theme.styleResponsive;
|
||||
}
|
||||
},
|
||||
loadOrg() {
|
||||
return new Promise((resolve, reject) => {
|
||||
listOrganizations({ pid: 0 })
|
||||
.then((data) => {
|
||||
this.where.orgId = data[0]?.id || '';
|
||||
console.log('Set orgId:', this.where.orgId);
|
||||
resolve();
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
created() {
|
||||
this.initData();
|
||||
},
|
||||
loadOrgTeam() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.teamList = [];
|
||||
this.where.teamId = '';
|
||||
|
||||
if (!this.where.orgId) {
|
||||
return resolve();
|
||||
methods: {
|
||||
async initData() {
|
||||
try {
|
||||
await this.loadOrg();
|
||||
await this.loadOrgTeam();
|
||||
await Promise.all([
|
||||
groupTypeUsers()
|
||||
.then((data) => {
|
||||
this.groupList = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
}),
|
||||
centerUsers()
|
||||
.then((data) => {
|
||||
this.centerList = data;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
})
|
||||
]);
|
||||
} catch (e) {
|
||||
this.$message.error(e.message);
|
||||
}
|
||||
},
|
||||
loadOrg() {
|
||||
return new Promise((resolve, reject) => {
|
||||
listOrganizations({ pid: 0 })
|
||||
.then((data) => {
|
||||
this.where.orgId = data[0]?.id || '';
|
||||
console.log('Set orgId:', this.where.orgId);
|
||||
resolve();
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
},
|
||||
loadOrgTeam() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.teamList = [];
|
||||
this.where.teamId = '';
|
||||
|
||||
listOrganizations({ pid: this.where.orgId })
|
||||
.then((data) => {
|
||||
this.teamList = data;
|
||||
resolve();
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
},
|
||||
/* 搜索 */
|
||||
search() {
|
||||
this.$emit('search', this.where);
|
||||
},
|
||||
/* 重置 */
|
||||
reset() {
|
||||
this.where = { ...this.defaultWhere };
|
||||
this.search();
|
||||
if (!this.where.orgId) {
|
||||
return resolve();
|
||||
}
|
||||
|
||||
listOrganizations({ pid: this.where.orgId })
|
||||
.then((data) => {
|
||||
this.teamList = data;
|
||||
resolve();
|
||||
})
|
||||
.catch((e) => {
|
||||
this.$message.error(e.message);
|
||||
reject(e);
|
||||
});
|
||||
});
|
||||
},
|
||||
/* 搜索 */
|
||||
search() {
|
||||
this.$emit('search', this.where);
|
||||
},
|
||||
/* 重置 */
|
||||
reset() {
|
||||
this.where = { ...this.defaultWhere };
|
||||
this.search();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user