refactor: 优化项目创建相关代码
This commit is contained in:
parent
089db4d33d
commit
69b66bdacc
|
@ -23,7 +23,9 @@
|
|||
<div>
|
||||
<ms-table-operator :edit-permission="['ORGANIZATION_WORKSPACE:READ+EDIT']"
|
||||
:delete-permission="['ORGANIZATION_WORKSPACE:READ+DELETE']"
|
||||
@editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
|
||||
:show-delete="workspaceId !== scope.row.id"
|
||||
@editClick="edit(scope.row)"
|
||||
@deleteClick="handleDelete(scope.row)"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -224,6 +226,9 @@ export default {
|
|||
computed: {
|
||||
currentUser: () => {
|
||||
return getCurrentUser();
|
||||
},
|
||||
workspaceId() {
|
||||
return getCurrentWorkspaceId();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
<el-card class="table-card">
|
||||
<template v-slot:header>
|
||||
<ms-table-header :create-permission="['SYSTEM_ORGANIZATION:READ+CREATE']" :condition.sync="condition" @search="initTableData" @create="create"
|
||||
<ms-table-header :create-permission="['SYSTEM_ORGANIZATION:READ+CREATE']" :condition.sync="condition"
|
||||
@search="initTableData" @create="create"
|
||||
:create-tip="$t('organization.create')" :title="$t('commons.organization')"/>
|
||||
</template>
|
||||
<!-- system menu organization table-->
|
||||
|
@ -24,7 +25,9 @@
|
|||
<div>
|
||||
<ms-table-operator :edit-permission="['SYSTEM_ORGANIZATION:READ+EDIT']"
|
||||
:delete-permission="['SYSTEM_ORGANIZATION:READ+DELETE']"
|
||||
@editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>
|
||||
:show-delete="organizationId !== scope.row.id"
|
||||
@editClick="edit(scope.row)"
|
||||
@deleteClick="handleDelete(scope.row)"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -34,7 +37,8 @@
|
|||
</el-card>
|
||||
|
||||
<!-- dialog of organization member -->
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true" @close="closeFunc"
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="dialogOrgMemberVisible" width="70%" :destroy-on-close="true"
|
||||
@close="closeFunc"
|
||||
class="dialog-css">
|
||||
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
|
||||
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
|
||||
|
@ -64,7 +68,8 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- add organization form -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('organization.create')" :visible.sync="dialogOrgAddVisible" width="30%" @closed="closeFunc"
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('organization.create')" :visible.sync="dialogOrgAddVisible"
|
||||
width="30%" @closed="closeFunc"
|
||||
:destroy-on-close="true">
|
||||
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
||||
ref="createOrganization">
|
||||
|
@ -85,7 +90,8 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- update organization form -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('organization.modify')" :visible.sync="dialogOrgUpdateVisible" width="30%"
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('organization.modify')" :visible.sync="dialogOrgUpdateVisible"
|
||||
width="30%"
|
||||
:destroy-on-close="true"
|
||||
@close="closeFunc">
|
||||
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
||||
|
@ -105,7 +111,8 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- add organization member form -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogOrgMemberAddVisible" width="30%"
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogOrgMemberAddVisible"
|
||||
width="30%"
|
||||
:destroy-on-close="true"
|
||||
@close="closeFunc">
|
||||
<el-form :model="memberForm" ref="form" :rules="orgMemberRule" label-position="right" label-width="100px"
|
||||
|
@ -143,7 +150,8 @@
|
|||
</el-dialog>
|
||||
|
||||
<!-- update organization member form -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogOrgMemberUpdateVisible" width="30%"
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogOrgMemberUpdateVisible"
|
||||
width="30%"
|
||||
:destroy-on-close="true"
|
||||
@close="closeFunc">
|
||||
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
|
||||
|
@ -214,6 +222,11 @@ export default {
|
|||
MsDialogFooter,
|
||||
MsTableOperatorButton
|
||||
},
|
||||
computed: {
|
||||
organizationId() {
|
||||
return getCurrentOrganizationId();
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
queryPath: '/organization/list',
|
||||
|
@ -259,7 +272,7 @@ export default {
|
|||
]
|
||||
},
|
||||
orgId: ""
|
||||
}
|
||||
};
|
||||
},
|
||||
activated() {
|
||||
this.initTableData();
|
||||
|
@ -278,15 +291,15 @@ export default {
|
|||
});
|
||||
this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.orgId}, response => {
|
||||
this.$set(this.memberForm, "groups", response.data);
|
||||
})
|
||||
});
|
||||
},
|
||||
dataFilter(val) {
|
||||
if (val) {
|
||||
this.memberForm.userList = this.memberForm.copyUserList.filter((item) => {
|
||||
if (!!~item.id.indexOf(val) || !!~item.id.toUpperCase().indexOf(val.toUpperCase())) {
|
||||
return true
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
} else {
|
||||
this.memberForm.userList = this.memberForm.copyUserList;
|
||||
}
|
||||
|
@ -305,7 +318,7 @@ export default {
|
|||
// })
|
||||
this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.orgId}, response => {
|
||||
this.$set(this.memberForm, "allgroups", response.data);
|
||||
})
|
||||
});
|
||||
// 编辑时填充角色信息
|
||||
this.$set(this.memberForm, 'groupIds', groupIds);
|
||||
listenGoBack(this.closeFunc);
|
||||
|
@ -328,7 +341,7 @@ export default {
|
|||
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
||||
let groups = response.data;
|
||||
this.$set(this.memberLineData[i], "groups", groups);
|
||||
})
|
||||
});
|
||||
}
|
||||
this.dialogTotal = data.itemCount;
|
||||
});
|
||||
|
@ -345,9 +358,12 @@ export default {
|
|||
this.memberLineData = data.listObject;
|
||||
let url = "/userrole/list/org/" + row.id;
|
||||
for (let i = 0; i < this.memberLineData.length; i++) {
|
||||
this.result = this.$post('/user/group/list', {type: GROUP_ORGANIZATION, resourceId: this.memberLineData[i].id }, response => {
|
||||
this.result = this.$post('/user/group/list', {
|
||||
type: GROUP_ORGANIZATION,
|
||||
resourceId: this.memberLineData[i].id
|
||||
}, response => {
|
||||
this.$set(this.memberLineData[i], "groups", response.data);
|
||||
})
|
||||
});
|
||||
}
|
||||
this.dialogTotal = data.itemCount;
|
||||
});
|
||||
|
@ -390,7 +406,7 @@ export default {
|
|||
if (currentUser.id === userId) {
|
||||
refreshSessionAndCookies(ORGANIZATION, sourceId);
|
||||
}
|
||||
this.$success(this.$t('commons.remove_success'))
|
||||
this.$success(this.$t('commons.remove_success'));
|
||||
this.cellClick(this.currentRow);
|
||||
});
|
||||
}).catch(() => {
|
||||
|
@ -408,7 +424,7 @@ export default {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
updateOrganization(updateOrganizationForm) {
|
||||
this.$refs[updateOrganizationForm].validate(valid => {
|
||||
|
@ -421,7 +437,7 @@ export default {
|
|||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
initTableData() {
|
||||
this.result = this.$post(this.queryPath + "/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||
|
@ -431,15 +447,15 @@ export default {
|
|||
let param = {
|
||||
name: '',
|
||||
organizationId: this.tableData[i].id
|
||||
}
|
||||
};
|
||||
let path = "user/special/org/member/list/all";
|
||||
this.$post(path, param, res => {
|
||||
let member = res.data;
|
||||
this.$set(this.tableData[i], "memberSize", member.length);
|
||||
})
|
||||
});
|
||||
}
|
||||
this.total = data.itemCount;
|
||||
})
|
||||
});
|
||||
},
|
||||
closeFunc() {
|
||||
this.memberLineData = [];
|
||||
|
@ -469,7 +485,7 @@ export default {
|
|||
refreshSessionAndCookies(sign, sourceId);
|
||||
this.cellClick(this.currentRow);
|
||||
this.dialogOrgMemberAddVisible = false;
|
||||
})
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -483,7 +499,7 @@ export default {
|
|||
phone: this.memberForm.phone,
|
||||
groupIds: this.memberForm.groupIds,
|
||||
organizationId: this.currentRow.id
|
||||
}
|
||||
};
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
this.result = this.$post("/organization/member/update", param, () => {
|
||||
|
@ -496,7 +512,7 @@ export default {
|
|||
},
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
Loading…
Reference in New Issue