feat: 分组管理
This commit is contained in:
@@ -6,22 +6,27 @@
|
||||
<slot :name="item" v-bind="data || {}"></slot>
|
||||
</template>
|
||||
<template #footer>
|
||||
<a-button>取消</a-button>
|
||||
<a-space>
|
||||
<a-button v-if="cancel" @click="cancel">取消</a-button>
|
||||
<a-button type="primary" @click="ok">确定</a-button>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, toRefs } from 'vue';
|
||||
import { computed, defineComponent, getCurrentInstance, toRefs } from 'vue';
|
||||
import { drawerProps } from 'ant-design-vue/es/drawer';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NsDrawer',
|
||||
props: {
|
||||
...drawerProps(),
|
||||
ok: Function,
|
||||
cancel: Function,
|
||||
},
|
||||
setup(props, { attrs, emit, slots }) {
|
||||
console.log(props, slots);
|
||||
console.log(props, getCurrentInstance());
|
||||
|
||||
const getBindValue = computed(() => ({
|
||||
...attrs,
|
||||
|
@@ -110,7 +110,7 @@
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 24px;
|
||||
padding: 32px 0 24px 0;
|
||||
padding: 16px 0;
|
||||
}
|
||||
.ns-child-form-divider {
|
||||
margin: 8px 0 0 0;
|
||||
|
@@ -99,7 +99,7 @@
|
||||
|
||||
const formItemProps = computed(() => {
|
||||
const {
|
||||
schema: { field, rules, label, component, autoLink, formItemProps, extra },
|
||||
schema: { field, rules, label, component, autoLink, formItemProps, extra, style },
|
||||
} = props;
|
||||
const tableComponent = ['nsTable'];
|
||||
let nsClass = '';
|
||||
@@ -111,6 +111,7 @@
|
||||
label: label,
|
||||
autoLink: autoLink || true,
|
||||
extra: extra,
|
||||
style,
|
||||
...formItemProps,
|
||||
...validateRef.value,
|
||||
};
|
||||
|
4
lib/component/form/form/form.d.ts
vendored
4
lib/component/form/form/form.d.ts
vendored
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
import type { RuleObject } from 'ant-design-vue/es/form/interface';
|
||||
declare global {
|
||||
type Rule = RuleObject & {
|
||||
@@ -33,5 +31,7 @@ declare global {
|
||||
class?: String; //添加额外样式
|
||||
autoSubmit: Boolean; //是否操作后提交表单
|
||||
format: Function;
|
||||
extra: string;
|
||||
style: Object;
|
||||
}
|
||||
}
|
||||
|
@@ -332,7 +332,7 @@
|
||||
tableState.selectedRows = selectedRows;
|
||||
},
|
||||
},
|
||||
rowSelection,
|
||||
isFunction(rowSelection) ? rowSelection(tableState) : rowSelection,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -392,6 +392,8 @@
|
||||
}
|
||||
return total;
|
||||
}
|
||||
console.log('current', (current >= 0 ? current : 0) + props.pageFieldOffset);
|
||||
|
||||
return {
|
||||
showQuickJumper: true,
|
||||
showLessItems: true,
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<ns-tree v-if="treeData.length" v-bind="getBindValue">
|
||||
<ns-tree v-if="treeData?.length" v-bind="getBindValue" v-model:selectedKeys="selectedKeys">
|
||||
<template #[item]="data" v-for="item in Object.keys($slots)" :key="item">
|
||||
<slot :name="item" v-bind="data || {}"></slot>
|
||||
</template>
|
||||
@@ -20,6 +20,7 @@
|
||||
resultField?: string;
|
||||
defaultExpandAll?: boolean;
|
||||
blockNode?: boolean;
|
||||
defaultSelectedKeys?: Array<string>;
|
||||
}
|
||||
defineOptions({
|
||||
name: 'NsTreeApi',
|
||||
@@ -31,6 +32,7 @@
|
||||
transform: (data) => data,
|
||||
});
|
||||
const treeData = ref<TreeDataItem[]>([]);
|
||||
const selectedKeys = ref(props.defaultSelectedKeys || []);
|
||||
const { httpRequest } = useApi();
|
||||
const requestConfig: AxiosRequestConfig = { method: 'get' };
|
||||
const route = useRoute();
|
||||
@@ -55,6 +57,8 @@
|
||||
}).then((res) => {
|
||||
let data = [];
|
||||
data = get(res, resultField);
|
||||
console.log('sdfasfasf', res);
|
||||
|
||||
treeData.value = transform(data);
|
||||
});
|
||||
};
|
||||
|
@@ -5,7 +5,7 @@ export const tableConfig = {
|
||||
listField: 'data.records', // 数据集合
|
||||
totalField: 'data.total', // 数据总数
|
||||
|
||||
pageFieldOffset: 0, //前端页码1开始,后端0 偏移量 1
|
||||
pageFieldOffset: 1, //前端页码1开始,后端0 偏移量 1
|
||||
pageSizeOptions: ['10', '20', '40'], // 分页设置种类
|
||||
defaultPageSize: 10, // 默认每页数量
|
||||
paramsPageSizeField: 'pageSize',
|
||||
|
Reference in New Issue
Block a user