Browse Source

feat: 用户管理样式调整

main
xuziqiang 3 months ago
parent
commit
d654588e65
  1. 4
      hx-ai-intelligent/src/icon/deptLink.svg
  2. 4
      hx-ai-intelligent/src/icon/orgLink.svg
  3. 152
      hx-ai-intelligent/src/view/organizationManage/usermanage/index.vue
  4. 1
      lib/component/tree/props.ts
  5. 51
      lib/component/tree/tree-api.vue
  6. 10
      lib/saas/asset/icon/noResource.svg
  7. 3
      lib/saas/view/service/error-403.vue
  8. 1
      lib/util/http/axios.ts

4
hx-ai-intelligent/src/icon/deptLink.svg

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="11.989990234375" height="11.1085205078125" viewBox="0 0 11.989990234375 11.1085205078125" fill="none">
<path d="M11.4607 7.93429L10.704 7.93429L10.704 6.36826C10.704 5.93552 10.3055 5.58339 9.81754 5.58339L6.4082 5.58339L6.4082 3.96776L7.62086 3.96776C7.91499 3.96776 8.15565 3.74458 8.15565 3.47179L8.15565 0.495972C8.15565 0.223183 7.91499 0 7.62086 0L4.41207 0C4.11794 0 3.87727 0.223183 3.87727 0.495972L3.87727 3.47179C3.87727 3.74458 4.11794 3.96776 4.41207 3.96776L5.57927 3.96776L5.57927 5.58339L2.18999 5.58339C1.70065 5.58339 1.30357 5.93552 1.30357 6.36826L1.30357 7.93429L0.534798 7.93429C0.240654 7.93429 0 8.15747 0 8.43025L0 10.6125C0 10.8853 0.240654 11.1085 0.534798 11.1085L2.8879 11.1085C3.18204 11.1085 3.4227 10.8853 3.4227 10.6125L3.4227 8.43025C3.4227 8.15747 3.18204 7.93429 2.8879 7.93429L2.13116 7.93429L2.13116 6.37321C2.13651 6.36578 2.15657 6.35213 2.18865 6.35213L5.57793 6.35213L5.57793 7.93429L4.8252 7.93429C4.53107 7.93429 4.29041 8.15747 4.29041 8.43025L4.29041 10.6125C4.29041 10.8853 4.53107 11.1085 4.8252 11.1085L7.17831 11.1085C7.47245 11.1085 7.7131 10.8853 7.7131 10.6125L7.7131 8.43025C7.7131 8.15747 7.47245 7.93429 7.17831 7.93429L6.40553 7.93429L6.40553 6.35213L9.81352 6.35213C9.84561 6.35213 9.86566 6.36578 9.87102 6.37321L9.87102 7.93429L9.10224 7.93429C8.80811 7.93429 8.56744 8.15747 8.56744 8.43026L8.56744 10.6125C8.56744 10.8853 8.80811 11.1085 9.10224 11.1085L11.4553 11.1085C11.7495 11.1085 11.9901 10.8853 11.9901 10.6125L11.9901 8.43026C11.9955 8.15747 11.7548 7.93429 11.4607 7.93429Z" fill="#4388FB" >
</path>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

4
hx-ai-intelligent/src/icon/orgLink.svg

@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12.0859375" height="10.474609375" viewBox="0 0 12.0859375 10.474609375" fill="none">
<path d="M11.6831 9.66875L11.2802 9.66875L11.2802 4.02865C11.2802 3.14235 10.5551 2.41719 9.66875 2.41719L7.25156 2.41719L7.25156 9.26588C7.25156 9.49149 7.0743 9.66875 6.8487 9.66875C6.62309 9.66875 6.44583 9.49149 6.44583 9.26588L6.44583 1.61147C6.44583 0.725159 5.72068 0 4.83437 0L2.41719 0C1.53089 0 0.805729 0.725159 0.805729 1.61147L0.805729 9.66875L0.402865 9.66875C0.17726 9.66875 0 9.84601 0 10.0716C0 10.2972 0.17726 10.4745 0.402865 10.4745L11.6831 10.4745C11.9087 10.4745 12.0859 10.2972 12.0859 10.0716C12.0859 9.84601 11.9087 9.66875 11.6831 9.66875ZM4.43151 8.0573L2.82005 8.0573C2.59445 8.0573 2.41719 7.88004 2.41719 7.65443C2.41719 7.42883 2.59445 7.25156 2.82005 7.25156L4.43151 7.25156C4.65711 7.25156 4.83437 7.42883 4.83437 7.65443C4.83437 7.88004 4.65711 8.0573 4.43151 8.0573ZM4.43151 5.64011L2.82005 5.64011C2.59445 5.64011 2.41719 5.46284 2.41719 5.23724C2.41719 5.01164 2.59445 4.83438 2.82005 4.83438L4.43151 4.83438C4.65711 4.83438 4.83437 5.01164 4.83437 5.23724C4.83437 5.46284 4.65711 5.64011 4.43151 5.64011ZM4.43151 3.22292L2.82005 3.22292C2.59445 3.22292 2.41719 3.04565 2.41719 2.82005C2.41719 2.59445 2.59445 2.41719 2.82005 2.41719L4.43151 2.41719C4.65711 2.41719 4.83437 2.59445 4.83437 2.82005C4.83437 3.04565 4.65711 3.22292 4.43151 3.22292ZM10.0716 8.0573L8.46016 8.0573C8.23455 8.0573 8.05729 7.88004 8.05729 7.65443C8.05729 7.42883 8.23455 7.25156 8.46016 7.25156L10.0716 7.25156C10.2972 7.25156 10.4745 7.42883 10.4745 7.65443C10.4745 7.88004 10.2972 8.0573 10.0716 8.0573ZM10.0716 5.64011L8.46016 5.64011C8.23455 5.64011 8.05729 5.46284 8.05729 5.23724C8.05729 5.01164 8.23455 4.83438 8.46016 4.83438L10.0716 4.83438C10.2972 4.83438 10.4745 5.01164 10.4745 5.23724C10.4745 5.46284 10.2972 5.64011 10.0716 5.64011Z" fill="#4388FB" >
</path>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

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

@ -4,26 +4,14 @@
<div class="main">
<div class="left">
<div class="top">
<div class="ns-table-title">关联企业</div>
<div>
<a-input-search
v-model:value="searchValue"
style="margin-bottom: 8px"
placeholder="请输入关联企业"
@search="onSearch" />
<a-tree
v-if="treeData?.length"
:tree-data="treeData"
defaultExpandAll
@select="handleSelect">
<ns-tree-api v-bind="orgTreeConfig" @select="handleSelect">
<template #title="data">
{{ data.orgInfo?.orgName }}
</template>
</a-tree>
</div>
</ns-tree-api>
</div>
<div class="top">
<div class="ns-table-title">关联部门</div>
<!-- <div class="ns-table-title">关联部门</div>
<a-input-search
v-model:value="searchValue2"
@ -38,7 +26,12 @@
<template #title="data">
{{ data.deptInfo?.deptName }}
</template>
</a-tree>
</a-tree> -->
<ns-tree-api v-bind="deptTreeConfig" @select="handleSelect2">
<template #title="data">
{{ data.deptInfo?.deptName }}
</template>
</ns-tree-api>
</div>
</div>
<div class="right">
@ -87,16 +80,15 @@
</a-modal>
</div>
</template>
<script lang="ts">
<script lang="ts" setup>
import { computed, createVNode, defineComponent, reactive, ref, watchEffect } from 'vue';
import { http } from '/nerv-lib/util/http';
import { NsMessage, NsModal } from '/nerv-lib/component';
import { formConfig, formConfig2 } from './config';
import { origanizemanage } from '/@/api/origanizemanage';
export default defineComponent({
name: 'OrderListIndex',
setup() {
defineOptions({ name: 'OrderListIndex' });
const mainRef = ref();
const data = reactive({});
let formData = ref({});
@ -124,7 +116,61 @@
const treeData2 = ref([]);
const userAuthList = ref([]);
const orgId = JSON.parse(sessionStorage.getItem('userInfo')).orgId;
const orgTreeConfig = ref({
defaultExpandAll: true,
api: origanizemanage.queryOrgTree,
defaultParams: { orgId },
transform: (data) => {
const otherOrg = data[0].listOrg;
let treeData = [];
//
if (data[0].orgInfo) {
treeData = data;
}
otherOrg?.map((item) => {
treeData.push({ orgInfo: item } as never);
});
return treeData;
},
header: {
title: '关联企业',
icon: 'orgLink',
},
formConfig: {
schemas: [
{
field: 'orgName',
component: 'NsInput',
autoSubmit: true,
componentProps: {
placeholder: '请输入企业名称',
},
},
],
},
});
const deptTreeConfig = ref({
defaultExpandAll: true,
api: origanizemanage.queryDeptTree,
defaultParams: { orgId },
header: {
title: '关联部门',
icon: 'deptLink',
},
formConfig: {
schemas: [
{
field: 'deptName',
component: 'NsInput',
autoSubmit: true,
componentProps: {
placeholder: '请输入部门名称',
},
},
],
},
});
const dynamicDisabled = computed(() => {
return formRef.value?.validateResult && userAuthList.value?.length;
});
@ -157,11 +203,9 @@
};
const onSearch2 = () => {
console.log(searchValue2.value);
fetch(origanizemanage.queryDeptTree, { deptName: searchValue2.value, orgId }).then(
(res) => {
fetch(origanizemanage.queryDeptTree, { deptName: searchValue2.value, orgId }).then((res) => {
treeData2.value = res.data;
},
);
});
};
const tableFetch = (params) => {
@ -439,7 +483,7 @@
label: '账号名',
component: 'NsInput',
componentProps: {
// placeholder: '',
placeholder: '请输入账号名',
maxLength: 30,
},
},
@ -448,7 +492,7 @@
label: '姓名',
component: 'NsInput',
componentProps: {
// placeholder: '',
placeholder: '请输入姓名',
maxLength: 30,
},
},
@ -457,7 +501,7 @@
label: '手机号',
component: 'NsInput',
componentProps: {
// placeholder: '',
placeholder: '请输入手机号',
maxLength: 11,
},
},
@ -476,6 +520,7 @@
component: 'NsSelect',
componentProps: {
allowClear: true,
placeholder: '请选择用户状态',
options: [
{
label: '正常',
@ -548,59 +593,38 @@
],
},
};
return {
formRef,
tableConfig,
tableConfig2,
data,
mainRef,
visible,
addformvisible,
formSchema,
formSchema2,
formData,
formData2,
treeData,
treeData2,
searchValue,
searchValue2,
handleSelect,
handleSelect2,
onClose,
onEdit,
onSearch,
onSearch2,
handleOk,
handleClose,
dynamicDisabled,
modalFormRef,
};
},
});
</script>
<style lang="less" scoped>
.main {
background-color: @ns-content-bg;
display: flex;
}
.left {
width: 350px;
max-height: calc(100vh - 96px);
overflow: hidden;
border-right: 16px solid rgb(229, 235, 240);
width: 300px;
// max-height: calc(100vh - 96px);
margin-right: @ns-gap;
min-width: fit-content;
> div {
border-radius: @ns-border-radius;
background-color: @white;
box-shadow: @ns-content-box-shadow;
flex: 1;
}
.top:first-child {
border-bottom: 16px solid #e5ebf0;
margin-bottom: @ns-gap;
}
display: flex;
flex-direction: column;
}
.right {
flex: 1;
min-width: 0;
}
.top {
height: 50%;
// height: 50%;
// border-bottom: 5px solid rgb(229, 235, 240);
overflow-y: auto;
// overflow-y: auto;
}
.ns-table-title {
text-align: left;

1
lib/component/tree/props.ts

@ -38,6 +38,7 @@ export const treeProps = {
blockNode: PropTypes.bool.def(true),
defaultExpandAll: PropTypes.bool.def(true),
resultField: PropTypes.string.def('data'),
header: PropTypes.object,
transform: {
type: Function,
default: (data: any) => data,

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

@ -1,13 +1,19 @@
<template>
<a-spin :spinning="treeState.loading">
<div v-if="header" class="ns-tree-title">
<ns-icon :name="header.icon" size="14" />
<span>{{ header.title }}</span>
</div>
<div v-if="!formConfig?.schema">
<ns-form ref="formElRef" v-bind="formConfig" :model="formModel" @finish="formFinish" />
</div>
<div>
<ns-tree v-if="treeData?.length" v-bind="getBindValue" v-model:selectedKeys="selectedKeys">
<template #[item]="data" v-for="(item, index) in Object.keys($slots)" :key="index">
<slot :name="item" v-bind="data || {}"></slot>
</template>
</ns-tree>
</div>
</a-spin>
</template>
<script lang="ts" setup>
@ -17,13 +23,14 @@
import { AxiosRequestConfig } from 'axios';
import { get } from 'lodash-es';
import { useRoute } from 'vue-router';
import { isEmpty } from 'lodash-es';
import { debounce } from 'lodash-es';
import { treeProps, treeFormProps } from '/nerv-lib/component/tree/props';
const formElRef = ref();
defineOptions({
name: 'NsTreeApi',
});
const props = defineProps(treeProps);
const treeData = ref<TreeDataItem[]>([]);
const selectedKeys = ref(props.defaultSelectedKeys || []);
const { httpRequest } = useApi();
@ -32,7 +39,7 @@
const attrs = useAttrs();
const formModel = reactive({});
const treeState = reactive({
loading: true,
loading: false,
});
const formConfig = computed(() => {
return {
@ -40,9 +47,9 @@
...props.formConfig,
};
});
const formFinish = () => {
getData();
};
const formFinish = debounce((data: object) => {
getData(data);
}, 200);
const getBindValue = computed(() => ({
...attrs,
...props,
@ -55,19 +62,20 @@
return { ...route.params, ...route.query, ...props.defaultParams };
});
const getData = () => {
const getData = (params = {}) => {
const { api, transform, resultField } = props;
treeData.value = [];
if (!api) return;
setLoading(true);
httpRequest({
api,
params: httpPrams,
pathParams: { ...route.params, ...route.query },
requestConfig,
params: { ...httpPrams.value, ...params },
pathParams: { ...route.params, ...route.query, ...params },
requestConfig: { ...requestConfig, data: { ...httpPrams.value, ...params } },
})
.then((res) => {
treeData.value = transform(get(res, resultField));
console.log(treeData.value, 'treeData.value');
})
.finally(() => {
setLoading(false);
@ -76,4 +84,27 @@
getData();
</script>
<style lang="less" scoped></style>
<style lang="less" scoped>
:deep(.ant-form-item) {
margin-bottom: 16px;
}
:deep(.ns-form::after) {
display: none;
}
.ns-tree-title {
font-weight: bold;
user-select: text;
padding: 16px;
margin-bottom: 16px;
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
> span {
padding-left: 6px;
}
& ~ div {
padding: 0 16px !important;
}
}
</style>

10
lib/saas/asset/icon/noResource.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 18 KiB

3
lib/saas/view/service/error-403.vue

@ -3,7 +3,7 @@
<a-layout class="ns-application" style="height: 100%">
<ns-header class="ns-header-menu" />
<a-layout>
<ns-sider class="ns-left-menu" />
<!-- <ns-sider class="ns-left-menu" /> -->
<a-layout>
<a-layout-content class="content" :style="{ minHeight: '400px', overflow: 'auto' }">
<div>
@ -43,6 +43,7 @@
display: flex;
align-items: center;
justify-content: center;
padding-top: 200px;
img {
width: 240px;
height: 240px;

1
lib/util/http/axios.ts

@ -78,6 +78,7 @@ export class NSAxios {
const errCodeMap = new Map<number, any>([
[13, ''],
[1, ''],
[3005, ''],
[10086, () => routerConfig.logout()],
]);

Loading…
Cancel
Save