Browse Source

fix: bug修改

main
xuziqiang 3 months ago
parent
commit
40d93e74aa
  1. 1
      hx-ai-intelligent/src/router/organizationManage.ts
  2. 1
      hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts
  3. 86
      hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue
  4. 1
      hx-ai-intelligent/src/view/organizationManage/usermanage/config.ts
  5. 71
      hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
  6. 1
      lib/component/tree/props.ts
  7. 19
      lib/component/tree/tree-api.vue
  8. 20
      lib/saas/view/system/login.vue

1
hx-ai-intelligent/src/router/organizationManage.ts

@ -19,7 +19,6 @@ const organizationManage = {
meta: {
title: '用户管理',
keepAlive: true,
isCheck: false,
operates: [
{ title: '新增', code: 'userAdd' },
{ title: '导入', code: 'userImport' },

1
hx-ai-intelligent/src/view/organizationManage/departmentManage/config.ts

@ -131,6 +131,7 @@ export const formConfig2 = (disabled2: Boolean) => {
label: '是否部门领导',
field: 'isLeader',
component: 'NsRadioGroup',
defaultValue: 1,
componentProps: {
disabled: disabled2,
radioType: 'radio',

86
hx-ai-intelligent/src/view/organizationManage/departmentManage/index.vue

@ -65,10 +65,10 @@
</a-tabs>
<a-space v-if="activeKey === 1 || deptPermissionTreeData?.length">
<ns-button type="primary" @click="CancelApartment">取消 </ns-button>
<ns-button v-show="disabled" type="primary" @click="pipe(deptEdit, true, false)">
<ns-button v-if="disabled" type="primary" @click="pipe(deptEdit, true, false)">
编辑
</ns-button>
<ns-button v-show="!disabled" type="primary" @click="deptSure">确定</ns-button>
<ns-button v-else type="primary" @click="deptSure">确定</ns-button>
</a-space>
</div>
</a-col>
@ -79,11 +79,11 @@
<a-row>
<a-col :span="8" class="tree">
<a-space wrap style="margin-bottom: 16px; justify-content: flex-start">
<ns-button v-auth="'userAdd'" type="primary" @click="rolePipe(addUser, true)">
<!-- <ns-button v-auth="'userAdd'" type="primary" @click="rolePipe(addUser, true)">
新增角色
</ns-button>
<ns-button type="primary" @click="rolePipe(addUserSon)">新增子角色</ns-button>
<ns-button type="primary" @click="rolePipe(deleteUser)"> 删除 </ns-button>
<ns-button type="primary" @click="rolePipe(deleteUser)"> 删除 </ns-button> -->
</a-space>
<a-tree
v-if="roleTreeData.length"
@ -95,19 +95,19 @@
<template #title="data">
<div style="display: flex; justify-content: space-between; align-items: center">
<span> {{ data.zhName }}</span>
<!-- <a-dropdown>
<a-dropdown>
<ns-icon name="actionMore" size="14" class="actionMore" />
<template #overlay>
<a-menu>
<a-menu-item
v-for="(action, index) in dropRoleActions"
v-for="(action, index) in filterAction(data, dropRoleActions, 'addUser')"
:key="index"
@click="action.func(data)">
<span>{{ action.title }}</span>
</a-menu-item>
</a-menu>
</template>
</a-dropdown> -->
</a-dropdown>
</div>
</template>
</a-tree>
@ -139,20 +139,16 @@
<a-empty style="margin-top: 120px" v-else />
</a-tab-pane>
</a-tabs>
<a-space>
<a-space v-if="roleActiveKey === 1 || rolePermissionTreeData?.length">
<ns-button type="primary" @click="CancelUser">取消</ns-button>
<ns-button
v-show="roleDisabled"
v-if="roleDisabled"
:disabled="!roleTreeData?.length"
type="primary"
@click="rolePipe(roleEdit, false, false)">
编辑
</ns-button>
<ns-button
v-show="!roleDisabled"
:disabled="!roleTreeData?.length"
type="primary"
@click="roleSure">
<ns-button v-else :disabled="!roleTreeData?.length" type="primary" @click="roleSure">
确定
</ns-button>
</a-space>
@ -167,7 +163,7 @@
import { Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { http } from '/nerv-lib/util/http';
import { cloneDeep, get } from 'lodash-es';
import { cloneDeep, get, isEmpty } from 'lodash-es';
import { formConfig, formConfig2 } from './config';
import { department } from '/@/api/origanizemanage';
import { permission } from '/@/api/origanizemanage';
@ -180,7 +176,7 @@
const formRef = ref();
const formRoleRef = ref();
let formData = ref({});
let roleFormData = ref({});
let roleFormData = ref({ isLeader: 1 });
const activeKey = ref(1);
const roleActiveKey = ref(1);
const disabled = ref(true);
@ -224,7 +220,7 @@
/**操作拦截 */
const pipe = (func: Function, flag = false, toggle = true) => {
if (toggle) activeKey.value = 1;
// if (toggle) activeKey.value = 1;
if (flag) {
//
if (selectRef.value?.hasOwnProperty('orgInfo') || !selectRef.value?.deptInfo) {
@ -243,13 +239,15 @@
const rolePipe = (func: Function, linkDept = false, toggle = true) => {
console.log(selectRoleRef.value);
if (toggle) roleActiveKey.value = 1;
// if (toggle) roleActiveKey.value = 1;
//
if ((linkDept && !selectRef.value?.deptInfo) || selectRef.value?.hasOwnProperty('own')) {
NsMessage.error('请先选择相关部门');
return;
}
if (!linkDept && !selectRoleRef.value) {
console.log(123);
if (!linkDept && isEmpty(selectRoleRef.value)) {
NsMessage.error('请先选择相关角色');
return;
}
@ -302,6 +300,7 @@
item['deptInfo'] = item.orgInfo;
item['deptInfo']['deptName'] = item?.orgInfo?.orgName;
item['own'] = !index;
item['selectable'] = false;
item['children'] = item.deptTrees;
return item;
});
@ -325,7 +324,7 @@
//
const getUserTree = (params = { deptId: selectRef.value?.deptInfo?.deptId }) => {
return http.post(department.queryRoleTree, params).then((res) => {
roleTreeData.value = res.data;
roleTreeData.value = [{ zhName: '全部', selectable: false, orgInfo: {}, children: res.data }];
});
};
//
@ -334,12 +333,12 @@
getUserTree().then(() => {
if (!roleTreeData.value?.length) {
selectRoleRef.value = {};
roleFormData.value = {};
roleFormData.value = { isLeader: 1 };
}
const info = {
node: { key: '0-0', dataRef: { ...roleTreeData.value[0] } },
node: { key: '0-0-0', dataRef: { ...roleTreeData.value[0].children[0] } },
};
SelectUserTree(['0-0'], info);
SelectUserTree(['0-0-0'], info);
});
}
});
@ -351,8 +350,10 @@
callback: null,
};
//
const addApartment = (data) => {
const { deptInfo } = data;
activeKey.value = 1;
disabled.value = false;
opMap.type = 'addDept';
@ -369,23 +370,17 @@
orgId: deptInfo?.orgId,
sourceOrgId,
projectId,
pdeptId: deptInfo.pdeptId || '',
orgName,
});
});
};
};
const getParent = (data) => {
if (data?.parent) {
getParent(data.parent);
} else {
data;
}
};
//
const addApartmentSon = (data) => {
const { deptInfo } = data;
activeKey.value = 1;
disabled.value = false;
opMap.type = 'addson';
formData.value = {};
@ -410,7 +405,8 @@
const addUser = () => {
roleDisabled.value = false;
opMap.type = 'addUser';
roleFormData.value = {};
roleFormData.value = { isLeader: 1 };
roleActiveKey.value = 1;
opMap.fuc = (params) => {
delete params.roleId;
return formRoleRef.value.triggerSubmit().then(() => {
@ -428,7 +424,8 @@
const addUserSon = () => {
roleDisabled.value = false;
opMap.type = 'addUserSon';
roleFormData.value = {};
roleActiveKey.value = 1;
roleFormData.value = { isLeader: 1 };
opMap.fuc = (params) => {
delete params.roleId;
return formRoleRef.value.triggerSubmit().then(() => {
@ -444,8 +441,6 @@
};
};
const deleteDept = (data) => {
console.log(data);
//
Modal.confirm({
title: '是否确认删除',
@ -458,6 +453,7 @@
//
deptTreeSelectedKeys.value = [];
selectRef.value = '';
roleTreeData.value = [{ zhName: '全部', selectable: false, orgInfo: {}, children: [] }];
}
});
},
@ -467,16 +463,20 @@
});
};
const deleteUser = () => {
const deleteUser = (data) => {
Modal.confirm({
title: '是否确认删除',
onOk() {
http.post(department.delRole, { roleId: selectRoleRef.value.roleId }).then(() => {
http.post(department.delRole, { roleId: data.roleId }).then(() => {
getUserTree({ deptId: selectRef.value.deptInfo.deptId });
clearRoleData();
// select
roleTreeSelectedKeys.value = [];
selectRoleRef.value = '';
if (data.selected) {
//
roleTreeSelectedKeys.value = [];
selectRoleRef.value = '';
}
NsMessage.success('操作成功');
});
},
@ -554,6 +554,7 @@
};
//
const rolePermission = () => {
if (!roleTotalCheckedKeys.value?.length) return;
http
.post(department.addRolePermission, {
// deptId: selectRef.value?.deptInfo.deptId,
@ -645,6 +646,7 @@
rolePermissionTreeData.value = [];
roleCheckedKeys.value = [];
roleTreeSelectedKeys.value = [];
roleDisabled.value = true;
};
/**
@ -739,10 +741,10 @@
// { title: '', func: addUser, key: 'addUser' },
]);
const filterAction = (data, actions) => {
const filterAction = (data, actions, keyV = 'addDept') => {
if (data.hasOwnProperty('orgInfo')) {
//
return actions.filter(({ key }) => key === 'addDept');
return actions.filter(({ key }) => key === keyV);
}
return actions;
};

1
hx-ai-intelligent/src/view/organizationManage/usermanage/config.ts

@ -44,6 +44,7 @@ export const formConfig = (disabled) => {
label: '性别',
field: 'sex',
component: 'NsRadioGroup',
defaultValue: '男',
componentProps: {
radioType: 'radio',
options: [

71
hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue

@ -4,30 +4,17 @@
<div class="main">
<div class="left">
<div class="top">
<ns-tree-api v-bind="orgTreeConfig" @select="handleSelect">
<ns-tree-api v-bind="orgTreeConfig" @select="handleSelect" v-model:treeData="treeData">
<template #title="data">
{{ data.orgInfo?.orgName }}
</template>
</ns-tree-api>
</div>
<div class="top">
<!-- <div class="ns-table-title">关联部门</div>
<a-input-search
v-model:value="searchValue2"
style="margin-bottom: 8px"
placeholder="请输入关联部门"
@search="onSearch2" />
<a-tree
v-if="treeData2?.length"
:tree-data="treeData2"
defaultExpandAll
@select="handleSelect2">
<template #title="data">
{{ data.deptInfo?.deptName }}
</template>
</a-tree> -->
<ns-tree-api v-bind="deptTreeConfig" @select="handleSelect2">
<ns-tree-api
v-bind="deptTreeConfig"
@select="handleSelect2"
v-model:treeData="treeDataDept">
<template #title="data">
{{ data.deptInfo?.deptName }}
</template>
@ -87,7 +74,7 @@
import { formConfig, formConfig2 } from './config';
import { origanizemanage } from '/@/api/origanizemanage';
defineOptions({ name: 'OrderListIndex' });
defineOptions({ name: 'UserManageIndex' });
const mainRef = ref();
const data = reactive({});
@ -113,19 +100,21 @@
const casData = ref([]);
const formSchema2 = formConfig2(casData);
const treeData = ref([]);
const treeDataDept = ref([]);
const treeData2 = ref([]);
const userAuthList = ref([]);
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
// const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
const orgId = JSON.parse(sessionStorage.getItem('ORGID')!);
const orgTreeConfig = ref({
selectedKeys: ['0-0'],
defaultExpandAll: true,
api: origanizemanage.queryOrgTree,
defaultParams: { orgId },
params: { orgId },
transform: (data) => {
const otherOrg = data[0].listOrg;
const otherOrg = data[0]?.listOrg;
let treeData = [];
//
if (data[0].orgInfo) {
if (data[0]?.orgInfo) {
treeData = data;
}
otherOrg?.map((item) => {
@ -153,7 +142,7 @@
const deptTreeConfig = ref({
defaultExpandAll: true,
api: origanizemanage.queryDeptTree,
defaultParams: { orgId },
params: { orgId },
header: {
title: '关联部门',
@ -192,11 +181,11 @@
});
});
};
getOrgTree();
// getOrgTree();
//
fetch(origanizemanage.queryDeptTree).then((res) => {
treeData2.value = res.data;
});
// fetch(origanizemanage.queryDeptTree).then((res) => {
// treeData2.value = res.data;
// });
const onSearch = () => {
console.log(searchValue.value);
@ -225,8 +214,10 @@
};
const handleSelect = (selectedKeys: any, info: any) => {
console.log(info);
fetch(origanizemanage.queryDeptTree, { orgId: info.node?.orgInfo.orgId }).then((res) => {
treeData2.value = res.data;
treeDataDept.value = res.data;
});
tableFetch({ orgId: info.node?.orgInfo.orgId });
};
@ -298,6 +289,7 @@
opMap.value.type = 'add';
setTimeout(() => {
formData.value = {
sex: '男',
orgName: JSON.parse(sessionStorage.getItem('userInfo')).orgName,
};
userAuthList.value.splice(0);
@ -350,30 +342,23 @@
customRender: (text: any) => {
return text.index + 1;
},
sorter: {
compare: (a, b) => a.address - b.address,
},
sorter: true,
},
{
title: '账号',
dataIndex: 'accountNo',
sorter: {
compare: (a, b) => a.accountNo - b.accountNo,
},
sorter: true,
},
{
title: '姓名',
dataIndex: 'realName',
sorter: {
compare: (a, b) => a.realName - b.realName,
},
sorter: true,
},
{
title: '性别',
dataIndex: 'sex',
sorter: {
compare: (a, b) => a.name - b.name,
},
sorter: true,
textNumber: 4,
},
{
title: '手机号',
@ -381,11 +366,15 @@
},
{
title: '邮箱',
textNumber: 5,
textEllipsis: true,
dataIndex: 'email',
},
{
title: '组织关系',
dataIndex: 'orgName',
// textNumber: 9,
// textEllipsis: true,
},
{
title: '部门/角色',

1
lib/component/tree/props.ts

@ -14,6 +14,7 @@ export const treeProps = {
type: [String, Object, Function] as PropType<string | Function | AxiosRequestConfig>,
default: undefined,
},
treeData: PropTypes.array.def([]),
params: PropTypes.object.def(() => ({})),
dynamicParams: PropTypes.oneOfType([
PropTypes.string,

19
lib/component/tree/tree-api.vue

@ -21,7 +21,7 @@
</a-spin>
</template>
<script lang="ts" setup>
import { computed, nextTick, reactive, ref, unref, useAttrs } from 'vue';
import { computed, nextTick, reactive, ref, unref, useAttrs, watch } from 'vue';
import { TreeDataItem } from 'ant-design-vue/es/tree/Tree';
import { useApi } from '/nerv-lib/use/use-api';
import { AxiosRequestConfig } from 'axios';
@ -33,16 +33,28 @@
defineOptions({
name: 'NsTreeApi',
});
const emit = defineEmits(['update:treeData']);
// const model = defineModel('treeData');
const formElRef = ref();
const props = defineProps(treeProps);
const treeData = ref<TreeDataItem[]>([]);
const treeData = ref(props.treeData);
const selectedKeys = ref(props.selectedKeys || []);
const { httpRequest } = useApi();
const requestConfig: AxiosRequestConfig = { method: 'get' };
const route = useRoute();
const attrs = useAttrs();
const formModel = reactive({});
watch(
() => props.treeData,
(val) => {
treeData.value = val;
},
{
deep: true,
},
);
const treeState = reactive({
loading: false,
});
@ -56,6 +68,7 @@
return props.isSticky ? 'sticky' : 'static';
});
const formFinish = debounce((data: object) => {
selectedKeys.value = [];
getData(data);
}, 200);
const getBindValue = computed(() => ({
@ -83,6 +96,8 @@
})
.then((res) => {
treeData.value = transform(get(res, resultField));
emit('update:treeData', treeData.value);
// model.value = treeData.value;
})
.finally(() => {
setLoading(false);

20
lib/saas/view/system/login.vue

@ -110,16 +110,16 @@
errorShow.value = true;
return;
}
// if (!code.value) {
// errorMsg.value = '';
// errorShow.value = true;
// return;
// }
// if (code.value.toLocaleLowerCase() !== verifyCode.value.toLocaleLowerCase()) {
// errorMsg.value = '';
// errorShow.value = true;
// return;
// }
if (!code.value) {
errorMsg.value = '请输入验证码';
errorShow.value = true;
return;
}
if (code.value.toLocaleLowerCase() !== verifyCode.value.toLocaleLowerCase()) {
errorMsg.value = '请输入正确的验证码';
errorShow.value = true;
return;
}
if (userName.value !== '' && password.value !== '') {
errorShow.value = false;
let data = JSON.stringify({

Loading…
Cancel
Save