@@ -54,9 +71,9 @@
@@ -110,65 +145,85 @@ import { useRouter } from 'vue-router';
import tree from './tree.vue';
import directoryForm from './directory-form.vue';
import orgForm from './org-form.vue';
+
+ const { proxy } = getCurrentInstance()
+ const { $axios,$message } = proxy
const baseInfo = reactive(
[
{
name: "机构类型",
- value: "政务机构",
+ value: "",
nameWidth: 130
},
{
name: "组织机构代码",
- value: "0000001",
+ value: "",
nameWidth: 130
},
{
name: "机构名称",
- value: "科技局",
+ value: "",
nameWidth: 130
},
{
name: "创建时间",
- value: "2022-10-10 10:10:10",
+ value: "",
nameWidth: 130
},
{
name: "组织管理员数量",
- value: "10",
+ value: "",
nameWidth: 130
},
{
name: "业务系统数量",
- value: "22",
+ value: "",
+ nameWidth: 130
+ },
+ ])
+ const baseInfo2 = reactive(
+ [{
+ name: "机构名称",
+ value: "",
nameWidth: 130
},
- ]
- )
+ {
+ name: "组织机构代码",
+ value: "",
+ nameWidth: 130
+ },
+ {
+ name: "用户数",
+ value: "",
+ nameWidth: 130,
+ full: true
+ },
+ ])
const headers = reactive([
{
label: "账号",
- prop: "account",
+ prop: "system_account",
width: 180
},
{
label: "手机号",
- prop: "phone",
- minWidth: 180
+ prop: "contact_phone",
+ minWidth: 120
},
{
label: "角色",
- prop: "role",
+ prop: "system_role",
width: 150
},
{
label: "创建时间",
- prop: "create_time",
+ prop: "created_time",
width: 150
},
{
label: "是否启用",
- prop: "is_use",
+ prop: "state",
width: 80
},
{
@@ -177,38 +232,42 @@ import orgForm from './org-form.vue';
width: 220,
fixed: "right",
},
- ])
+ ]);
- const tableRows = reactive([
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- {account: "admin",phone: "15625364536",role: "管理员",create_time: "2022-01-01 00:00",is_use: "是"},
- ])
- const search=ref("");
-
+ const tableRows = ref([]);
+ const tableTotal = ref(0);
+ const search = ref("");
+ const orgTree = ref(null);
+ const selectTreeData = ref(null)
+ const selectTreeDataType = ref(2);
+ const dialogDel = ref(false)
const router = useRouter();
+ const filter = reactive({
+ organization_id: '',
+ data_type: '',
+ state: '',
+ key_word: "",
+ page: 1,
+ limit: 10,
+ });
const addAccount = (params) => {
- router.push({
+ if(selectTreeDataType.value === 1) {
+ router.push({
path: "/system/organization/system-user",
query: {
type: params
}
})
+ }else {
+ router.push({
+ path: "/system/organization/platform-user",
+ query: {
+ type: params
+ }
+ })
+ }
+
}
const treeSelected = ref(null);
const handleNodeClick = (data) => {
@@ -225,7 +284,9 @@ import orgForm from './org-form.vue';
}
- const dialogDirectory = ref(false)
+ const dialogDirectory = ref(false)
+ const directoryFormType = ref('create')
+ const orgFormType = ref('create')
const handleCloseDirectory = () => {
dialogDirectory.value = false;
}
@@ -235,9 +296,42 @@ import orgForm from './org-form.vue';
directoryFormRef.value.submitForm();
}
+ //新增/编剧目录
const getDirectoryFromData = (data) => {
- console.log(111111)
- console.log(data)
+
+ if(directoryFormType.value === 'create') {
+ const params = {
+ p_organization_id: data.level ? "" : data.p_organization_id,
+ name: data.name,
+ data_type: 0
+ }
+ $axios.post(`/apaas/system/v5/org/add`, params)
+ .then((res) => {
+ if (res.data.code == 200) {
+ $message.success(res.data.msg)
+ orgTree.value.getOrgTree();
+ }else {
+ $message.error(res.data.msg)
+ }
+ handleCloseDirectory()
+ })
+ }else if(directoryFormType.value === 'edit') {
+ const params = {
+ name: data.name,
+ data_type: 0
+ }
+ $axios.put(`/apaas/system/v5/org/${selectTreeData.value.id}`, params)
+ .then((res) => {
+ if (res.data.code == 200) {
+ $message.success(res.data.msg)
+ orgTree.value.getOrgTree();
+ }else {
+ $message.error(res.data.msg)
+ }
+ handleCloseDirectory()
+ })
+ }
+
}
const dialogOrg = ref(false)
@@ -250,34 +344,170 @@ import orgForm from './org-form.vue';
orgFormRef.value.submitForm();
}
- const getOrgFromData = (data) => {
- console.log(111111)
- console.log(data)
+ //新增/编辑组织
+ const getOrgFormData = (data) => {
+ if(orgFormType.value === 'create') {
+ const params = {
+ p_organization_id: data.level ? "" : data.p_organization_id,
+ name: data.name,
+ organization_code: data.organization_code,
+ description: data.description,
+ attachment: data.attachment && data.attachment.length > 0 ? data.attachment[0].url : '',
+ data_type: 1
+ }
+ $axios.post(`/apaas/system/v5/org/add`, params)
+ .then((res) => {
+ if (res.data.code == 200) {
+ $message.success(res.data.msg)
+ orgTree.value.getOrgTree();
+ }else {
+ $message.error(res.data.msg)
+ }
+ handleCloseOrg()
+ })
+ }else if(orgFormType.value === 'edit') {
+ const params = {
+ // p_organization_id: data.level ? "" : data.p_organization_id,
+ name: data.name,
+ organization_code: data.organization_code,
+ description: data.description,
+ attachment: data.attachment && data.attachment.length > 0 ? data.attachment[0].url : '',
+ data_type: 1
+ }
+ $axios.put(`/apaas/system/v5/org/${selectTreeData.value.id}`, params)
+ .then((res) => {
+ if (res.data.code == 200) {
+ $message.success(res.data.msg)
+ orgTree.value.getOrgTree();
+ }else {
+ $message.error(res.data.msg)
+ }
+ handleCloseOrg()
+ })
+ }
+
+ }
+
+ const handleCloseDel = () => {
+ dialogDel.value = false;
+ }
+
+ //删除目录/组织
+ const confirmDel = () => {
+ $axios.delete(`/apaas/system/v5/org/${selectTreeData.value.id}`)
+ .then((res) => {
+ if (res.data.code == 200) {
+ $message.success(res.data.msg)
+ orgTree.value.getOrgTree();
+ }else {
+ $message.error(res.data.msg)
+ }
+ handleCloseDel()
+ })
}
+
+ const moveOrg = (params) => {
+ $axios.put(`/apaas/system/v5/org/sort`,params)
+ .then((res) => {
+ if (res.data.code == 200) {
+ $message.success(res.data.msg)
+ orgTree.value.getOrgTree();
+ }else {
+ $message.error(res.data.msg)
+ }
+ })
+ }
+
const action = ref('create')
- const treeCreate = (data) => {
+ const treeAction = (data) => {
action.value = data.action
if(data.action === 'create' || data.action === 'edit') {
if(data.type === 'org') {
+ orgFormType.value = data.action;
dialogOrg.value = true;
-
- if(data.data.value) {
- orgFormRef.value.setForm({parent: data.data.value.dept});
- }
-
+ nextTick(() => {
+ if(data.data) {
+ if(data.action === 'edit') {
+ orgFormRef.value.setForm({
+ name: data.data.value.name,
+ p_organization_id: data.data.value.p_organization_id,
+ level: data.data.value.p_organization_id ? false : true,
+ organization_code: data.data.value.organization_code,
+ description: data.data.value.description,
+ attachment: [{url: data.data.value.attachment}]
+ });
+ }else if(data.action === 'create') {
+ orgFormRef.value.setForm({p_organization_id: data.data.value.organization_id});
+ }
+
+ }
+ })
}else {
+ directoryFormType.value = data.action;
dialogDirectory.value = true;
nextTick(()=> {
- if(data.data.value) {
- directoryFormRef.value.setForm({parent: data.data.value.dept});
+ if(data.data) {
+ if(data.action === 'edit') {
+ directoryFormRef.value.setForm({name: data.data.value.name});
+ }else if(data.action === 'create') {
+ directoryFormRef.value.setForm({p_organization_id: data.data.value.organization_id});
+ }
+
}
})
}
- }else {
- console.log(data.action)
+ }else if(data.action === 'delete'){
+ dialogDel.value = true;
+ }else if(data.action === 'mvup' || data.action === 'mvdown') {
+ moveOrg(data.data);
}
}
+ const treeSelect = (data) => {
+ selectTreeData.value = data.value;
+ if(data.value.data_type === 1 || data.value.data_type === 2) {
+ selectTreeDataType.value = data.value.data_type;
+
+ getTableRows();
+ }
+ }
+
+ const getTableRows = () => {
+ let params = {...filter, organization_id: selectTreeData.value.organization_id,data_type: selectTreeData.value.data_type}
+ $axios.get(
+ `/apaas/system/v5/org/detail`,
+ {
+ params
+ }
+ )
+ .then((res) => {
+ if (res.data.code == 200) {
+ tableRows.value = (res.data.data.org_users.data || []).map(item => {
+
+ item.system_role = item.system_role ? item.system_role.join('、') : '';
+ return item;
+ });
+ tableTotal.value = res.data.data.org_users.total;
+ if(params.data_type === 1) {
+ baseInfo[0].value = res.data.data.org_info.organization_type;
+ baseInfo[1].value = res.data.data.org_info.organization_code;
+ baseInfo[2].value = res.data.data.org_info.name;
+ baseInfo[3].value = res.data.data.org_info.created_time;
+ baseInfo[4].value = res.data.data.org_info.org_admin_number;
+ baseInfo[5].value = res.data.data.org_info.business_system_number;
+ }else {
+ baseInfo2[0].value = res.data.data.org_info.name;
+ baseInfo2[1].value = res.data.data.org_info.organization_code;
+ baseInfo2[2].value = res.data.data.org_info.platform_users_number;
+ }
+ console.log(baseInfo)
+
+ }else {
+ $message.error(res.data.msg)
+ }
+ })
+ }
+
const goDetail = (params) => {
router.push({
path: "/system/organization/user-detail",
@@ -287,6 +517,10 @@ import orgForm from './org-form.vue';
})
}
+ const searchChange = (val) => {
+ orgTree.value.filterTree(val);
+ }
+
onBeforeMount(() => {
})
diff --git a/src/page/main/system/organization/org-form.vue b/src/page/main/system/organization/org-form.vue
index dd18bc3c632f99a0536d321b706ba9d1c49804f6..2ef2fbcf4c76af17263bdba3894645b7907c481e 100644
--- a/src/page/main/system/organization/org-form.vue
+++ b/src/page/main/system/organization/org-form.vue
@@ -7,23 +7,23 @@
ref="orgRef"
style="max-width: 80%"
>
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
将文件拖到此处,或 点击上传
@@ -31,56 +31,95 @@
\ No newline at end of file
diff --git a/src/page/main/system/organization/platform-user/index.vue b/src/page/main/system/organization/platform-user/index.vue
index 252df2728b87e65a2179c1d5166c4f8b13fd03c8..c36f61be96c9966b63e9abefe966d92568f91cd9 100644
--- a/src/page/main/system/organization/platform-user/index.vue
+++ b/src/page/main/system/organization/platform-user/index.vue
@@ -48,8 +48,11 @@
-
-
平台用户新增成功
+
+

+

+
+
{{route.query.id ? (successFlag ? '平台用户编辑成功' : '平台用户编辑失败') : (successFlag ? '平台用户新增成功' : '平台用户新增失败')}}
返回列表
继续创建
@@ -78,8 +81,10 @@
import { useRoute, useRouter } from 'vue-router';
import platformAccountForm from './platform-account-form.vue';
import platformPersonForm from './platform-person-form.vue';
-import { reactive, ref,onBeforeMount,toRefs,computed, onBeforeUnmount, onMounted } from 'vue';
-
+import CryptoJS from "crypto-js";
+import { reactive, ref,onBeforeMount,toRefs,computed, onMounted, getCurrentInstance } from 'vue';
+const { proxy } = getCurrentInstance()
+const { $axios,$message } = proxy
const route = useRoute();
const router = useRouter();
const step = ref(1);
@@ -87,18 +92,21 @@ const platformAccountFormRef = ref(null);
const plplatformPersonFormRef = ref(null);
const formData = reactive({
logo: '',
- account: '',
- phone: '',
+ system_account: '',
+ contact_phone: '',
password: '',
confirm_password: '',
- role: '',
- is_use: 1,
+ select_role: '',
+ state: '',
- name: '',
- email: '',
+ contact_name: '',
+ contact_email: '',
remark: '',
}); //账号信息表单+个人信息表单
+const orgId = ref(null);
+const successFlag = ref(false)
+
// 下一步
const nextStep = () => {
@@ -107,7 +115,7 @@ const nextStep = () => {
//账号信息表单检验触发事件 data为null 校验失败
const getPlatformAccountFormData = (data) => {
if(data) {
- formData.value = Object.assign(formData,data);
+ Object.assign(formData,data);
step.value = 2;
}else {
@@ -115,10 +123,40 @@ const getPlatformAccountFormData = (data) => {
}
//个人信息表单检验触发事件 data为null 校验失败
const getPlatformPersonFormData = (data) => {
- if(data) {
- formData.value = Object.assign(formData,data);
- console.log(formData);
- step.value = 3;
+ if(data) {
+ Object.assign(formData,data);
+ if(route.query.id) {
+ console.log(formData)
+ let params = {
+
+ }
+ $axios.post(`/apaas/system/v5/user/update`,params)
+ .then((res) => {
+ if (res.data.code == 200) {
+ successFlag.value = true;
+ step.value = 3;
+ }else {
+ $message.error(res.data.msg)
+ }
+ })
+
+ }else {
+ const params = {...formData,
+ organization_id: orgId.value,
+ logo: formData.logo && formData.logo.length > 0 ? formData.logo[0].url : '',
+ is_admin: 3,
+ password: CryptoJS.AES.encrypt(formData.password,"swuE9cmCZQwrkYRV").toString()
+ };
+ $axios.post(`/apaas/system/v5/org/add/user`,params)
+ .then((res) => {
+ if (res.data.code == 200) {
+ successFlag.value = true;
+ step.value = 3;
+ }else {
+ $message.error(res.data.msg)
+ }
+ })
+ }
}
}
//上一步
@@ -134,40 +172,30 @@ const continueCreate = () => {
platformAccountFormRef.value.clearForm();
plplatformPersonFormRef.value.clearForm();
step.value = 1;
+ successFlag.value = false;
}
//取消
const cancel = () => {
router.go(-1);
}
-onBeforeUnmount(()=>{
-
+const getOrgTree = () => {
+ $axios.get(`/apaas/system/v5/org/tree`)
+ .then((res) => {
+ if (res.data.code == 200) {
+ orgId.value = res.data.data[0].organization_id;
+ }else {
+ $message.error(res.data.msg)
+ }
+ })
+ }
+
+onBeforeMount(() => {
+ getOrgTree()
})
onMounted(() => {
if(route.query.type === "1") {
- setTimeout(()=> {
- platformAccountFormRef.value.setForm({
- org: 'a',
- code: 'b',
- name: 'b',
- desc: 'b',
- logo: ['b'],
- role: 'b',
- account: 'b',
- password: 'b',
- confirm_password: 'b',
- url: 'b',
- firm_name: 'b',
- is_use: 'b',
-
- })
- plplatformPersonFormRef.value.setForm({
- contact_user: 'c',
- phone: 'c',
- email: 'c',
- remark: 'c',
- })
- },500)
+
}
})
diff --git a/src/page/main/system/organization/platform-user/platform-account-form.vue b/src/page/main/system/organization/platform-user/platform-account-form.vue
index d4521d993e83f43ee0adaa940d45366ad41af4bd..bc2e6edd077688fc54d08b2ac861ab371d787b19 100644
--- a/src/page/main/system/organization/platform-user/platform-account-form.vue
+++ b/src/page/main/system/organization/platform-user/platform-account-form.vue
@@ -10,11 +10,11 @@
-
-
+
+
-
-
+
+
@@ -22,27 +22,35 @@
-
-
+
+
+
+
-
-
+
+