|
|
@@ -59,6 +59,7 @@
|
|
|
v-if="current"
|
|
|
:organization-list="data"
|
|
|
:organization-id="current.id"
|
|
|
+ :institutionList="institutionList"
|
|
|
/>
|
|
|
</template>
|
|
|
</ele-split-layout>
|
|
|
@@ -75,111 +76,120 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import OrgUserList from './components/org-user-list.vue';
|
|
|
- import OrgEdit from './components/org-edit.vue';
|
|
|
- import {
|
|
|
- listOrganizations,
|
|
|
- removeOrganization
|
|
|
- } from '@/api/system/organization';
|
|
|
+import OrgUserList from './components/org-user-list.vue';
|
|
|
+import OrgEdit from './components/org-edit.vue';
|
|
|
+import {
|
|
|
+ listOrganizations,
|
|
|
+ removeOrganization
|
|
|
+} from '@/api/system/organization';
|
|
|
|
|
|
- export default {
|
|
|
- name: 'SystemOrganization',
|
|
|
- components: { OrgUserList, OrgEdit },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 加载状态
|
|
|
- loading: true,
|
|
|
- // 列表数据
|
|
|
- data: [],
|
|
|
- // 选中数据
|
|
|
- current: null,
|
|
|
- // 是否显示表单弹窗
|
|
|
- showEdit: false,
|
|
|
- // 编辑回显数据
|
|
|
- editData: null,
|
|
|
- // 上级id
|
|
|
- parentId: null
|
|
|
- };
|
|
|
+export default {
|
|
|
+ name: 'SystemOrganization',
|
|
|
+ components: {OrgUserList, OrgEdit},
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 加载状态
|
|
|
+ loading: true,
|
|
|
+ // 列表数据
|
|
|
+ data: [],
|
|
|
+ institutionList: [],
|
|
|
+ // 选中数据
|
|
|
+ current: null,
|
|
|
+ // 是否显示表单弹窗
|
|
|
+ showEdit: false,
|
|
|
+ // 编辑回显数据
|
|
|
+ editData: null,
|
|
|
+ // 上级id
|
|
|
+ parentId: null
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.query();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ /* 查询 */
|
|
|
+ query() {
|
|
|
+ this.loading = true;
|
|
|
+ listOrganizations()
|
|
|
+ .then((list) => {
|
|
|
+ let _list = list.filter((i) => i.name != '超级管理员')
|
|
|
+ let _institutionList = _list.filter((i) => [10, 20].includes(i.type));
|
|
|
+ console.log(this.institutionList);
|
|
|
+ this.loading = false;
|
|
|
+ this.data = this.$util.toTreeData({
|
|
|
+ data: _list,
|
|
|
+ idField: 'id',
|
|
|
+ parentIdField: 'parentId'
|
|
|
+ });
|
|
|
+ this.institutionList = this.$util.toTreeData({
|
|
|
+ data: _institutionList,
|
|
|
+ idField: 'id',
|
|
|
+ parentIdField: 'parentId'
|
|
|
+ });
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.onNodeClick(this.data[0]);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ this.loading = false;
|
|
|
+ // this.$message.error(e.message);
|
|
|
+ });
|
|
|
},
|
|
|
- created() {
|
|
|
- this.query();
|
|
|
+ /* 选择数据 */
|
|
|
+ onNodeClick(row) {
|
|
|
+ if (row) {
|
|
|
+ this.current = row;
|
|
|
+ this.parentId = row.id;
|
|
|
+ this.$refs.tree.setCurrentKey(row.id);
|
|
|
+ } else {
|
|
|
+ this.current = null;
|
|
|
+ this.parentId = null;
|
|
|
+ }
|
|
|
},
|
|
|
- methods: {
|
|
|
- /* 查询 */
|
|
|
- query() {
|
|
|
- this.loading = true;
|
|
|
- listOrganizations()
|
|
|
- .then((list) => {
|
|
|
- let _list = list.filter((i) => i.name != '超级管理员')
|
|
|
- this.loading = false;
|
|
|
- this.data = this.$util.toTreeData({
|
|
|
- data: _list,
|
|
|
- idField: 'id',
|
|
|
- parentIdField: 'parentId'
|
|
|
- });
|
|
|
- this.$nextTick(() => {
|
|
|
- this.onNodeClick(this.data[0]);
|
|
|
+ /* 显示编辑 */
|
|
|
+ openEdit(item) {
|
|
|
+ this.editData = item;
|
|
|
+ this.showEdit = true;
|
|
|
+ },
|
|
|
+ /* 删除 */
|
|
|
+ remove() {
|
|
|
+ this.$confirm('确定要删除选中的机构吗?', '提示', {
|
|
|
+ type: 'warning'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ const loading = this.$loading({lock: true});
|
|
|
+ removeOrganization([this.current.id])
|
|
|
+ .then((msg) => {
|
|
|
+ loading.close();
|
|
|
+ this.$message.success(msg);
|
|
|
+ this.query();
|
|
|
+ })
|
|
|
+ .catch((e) => {
|
|
|
+ loading.close();
|
|
|
+ // this.$message.error(e.message);
|
|
|
});
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- this.loading = false;
|
|
|
- // this.$message.error(e.message);
|
|
|
- });
|
|
|
- },
|
|
|
- /* 选择数据 */
|
|
|
- onNodeClick(row) {
|
|
|
- if (row) {
|
|
|
- this.current = row;
|
|
|
- this.parentId = row.id;
|
|
|
- this.$refs.tree.setCurrentKey(row.id);
|
|
|
- } else {
|
|
|
- this.current = null;
|
|
|
- this.parentId = null;
|
|
|
- }
|
|
|
- },
|
|
|
- /* 显示编辑 */
|
|
|
- openEdit(item) {
|
|
|
- this.editData = item;
|
|
|
- this.showEdit = true;
|
|
|
- },
|
|
|
- /* 删除 */
|
|
|
- remove() {
|
|
|
- this.$confirm('确定要删除选中的机构吗?', '提示', {
|
|
|
- type: 'warning'
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- const loading = this.$loading({ lock: true });
|
|
|
- removeOrganization([this.current.id])
|
|
|
- .then((msg) => {
|
|
|
- loading.close();
|
|
|
- this.$message.success(msg);
|
|
|
- this.query();
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- loading.close();
|
|
|
- // this.$message.error(e.message);
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(() => {});
|
|
|
- }
|
|
|
+ .catch(() => {
|
|
|
+ });
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
- .sys-organization-list {
|
|
|
- height: calc(100vh - 264px);
|
|
|
- box-sizing: border-box;
|
|
|
- border-width: 1px;
|
|
|
- border-style: solid;
|
|
|
- overflow: auto;
|
|
|
- }
|
|
|
+.sys-organization-list {
|
|
|
+ height: calc(100vh - 264px);
|
|
|
+ box-sizing: border-box;
|
|
|
+ border-width: 1px;
|
|
|
+ border-style: solid;
|
|
|
+ overflow: auto;
|
|
|
+}
|
|
|
|
|
|
- .sys-organization-list :deep(.el-tree-node__content) {
|
|
|
- height: 40px;
|
|
|
+.sys-organization-list :deep(.el-tree-node__content) {
|
|
|
+ height: 40px;
|
|
|
|
|
|
- & > .el-tree-node__expand-icon {
|
|
|
- margin-left: 10px;
|
|
|
- }
|
|
|
+ & > .el-tree-node__expand-icon {
|
|
|
+ margin-left: 10px;
|
|
|
}
|
|
|
+}
|
|
|
</style>
|