Browse Source

feat: ns-tree-api补充粘性定位

main
xuziqiang 3 months ago
parent
commit
ef782e90b6
  1. 10
      hx-op/src/enum/http-enum.ts
  2. 1
      lib/component/tree/props.ts
  3. 24
      lib/component/tree/tree-api.vue
  4. 2
      lib/saas/theme/global.less

10
hx-op/src/enum/http-enum.ts

@ -1,3 +1,5 @@
import { routerConfig } from '/nerv-lib/saas/config/router.config';
export enum ResultEnum {
SUCCESS = 0,
ERROR = 1,
@ -20,3 +22,11 @@ export enum ContentTypeEnum {
// form-data upload
FORM_DATA = 'multipart/form-data;charset=UTF-8',
}
export const errCodeMap = new Map<number, any>([
[13, ''],
[1, ''],
[11, ''],
[3005, ''],
[10086, () => routerConfig.logout()],
]);

1
lib/component/tree/props.ts

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

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

@ -1,5 +1,6 @@
<template>
<a-spin :spinning="treeState.loading">
<div class="ns-tree-form">
<div v-if="header" class="ns-tree-title">
<ns-icon :name="header.icon" size="14" />
<span>{{ header.title }}</span>
@ -7,6 +8,7 @@
<div v-if="!formConfig?.schema">
<ns-form ref="formElRef" v-bind="formConfig" :model="formModel" @finish="formFinish" />
</div>
</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">
@ -49,6 +51,9 @@
...props.formConfig,
};
});
const isSticky: any = computed(() => {
return props.isSticky ? 'sticky' : 'static';
});
const formFinish = debounce((data: object) => {
getData(data);
}, 200);
@ -87,26 +92,37 @@
getData();
</script>
<style lang="less" scoped>
@gap: 16px;
:deep(.ant-form-item) {
margin-bottom: 16px;
margin-bottom: @gap;
}
:deep(.ns-form::after) {
display: none;
}
.ns-tree-form {
position: v-bind(isSticky);
top: 0;
background-color: @white;
z-index: 2;
& ~ div {
padding: 0 @gap !important;
}
}
.ns-tree-title {
font-weight: bold;
user-select: text;
padding: 16px;
margin-bottom: 16px;
padding: @gap;
margin-bottom: @gap;
padding-bottom: 10px;
border-bottom: 1px solid #e9e9e9;
> span {
padding-left: 6px;
}
& ~ div {
padding: 0 16px !important;
padding: 0 @gap !important;
}
}
</style>

2
lib/saas/theme/global.less

@ -77,7 +77,7 @@
::-webkit-scrollbar {
width: 6px;
height: 8px;
height: 6px;
}
::-webkit-scrollbar-track {

Loading…
Cancel
Save