Commit a95694ae6b9fbdae28fddf2f0d188d53ee38bb65
1 parent
220e0316
perf: vxe demo
Showing
3 changed files
with
37 additions
and
21 deletions
yudao-ui-admin-vue3/src/plugins/vxeTable/index.ts
| @@ -55,12 +55,12 @@ VXETable.setup({ | @@ -55,12 +55,12 @@ VXETable.setup({ | ||
| 55 | loadingText: '加载中...', // 全局loading提示内容,如果为null则不显示文本 | 55 | loadingText: '加载中...', // 全局loading提示内容,如果为null则不显示文本 |
| 56 | height: 600, | 56 | height: 600, |
| 57 | table: { | 57 | table: { |
| 58 | - border: 'inner', | ||
| 59 | - // 自动监听父元素的变化去重新计算表格 | ||
| 60 | - autoResize: true, | ||
| 61 | - emptyText: '暂无数据', | ||
| 62 | - // 鼠标移到行是否要高亮显示 | ||
| 63 | - highlightHoverRow: true | 58 | + border: 'inner', // default(默认), full(完整边框), outer(外边框), inner(内边框), none(无边框) |
| 59 | + align: 'center', // eft(左对齐), center(居中对齐), right(右对齐) | ||
| 60 | + autoResize: true, // 自动监听父元素的变化去重新计算表格 | ||
| 61 | + resizable: true, // 列是否允许拖动列宽调整大小 | ||
| 62 | + emptyText: '暂无数据', // 空表单 | ||
| 63 | + highlightHoverRow: true // 自动监听父元素的变化去重新计算表格 | ||
| 64 | }, | 64 | }, |
| 65 | grid: { | 65 | grid: { |
| 66 | toolbarConfig: { | 66 | toolbarConfig: { |
| @@ -103,6 +103,21 @@ VXETable.setup({ | @@ -103,6 +103,21 @@ VXETable.setup({ | ||
| 103 | input: { | 103 | input: { |
| 104 | clearable: true | 104 | clearable: true |
| 105 | }, | 105 | }, |
| 106 | + modal: { | ||
| 107 | + width: 600, // 窗口的宽度 | ||
| 108 | + height: 400, // 窗口的高度 | ||
| 109 | + showZoom: true, // 标题是否标显示最大化与还原按钮 | ||
| 110 | + resize: true, // 是否允许窗口边缘拖动调整窗口大小 | ||
| 111 | + marginSize: 0, // 只对 resize 启用后有效,用于设置可拖动界限范围,如果为负数则允许拖动超出屏幕边界 | ||
| 112 | + remember: false, // 记忆功能,会记住最后操作状态,再次打开窗口时还原窗口状态 | ||
| 113 | + destroyOnClose: true, // 在窗口关闭时销毁内容 | ||
| 114 | + storage: false, // 是否启用 localStorage 本地保存,会将窗口拖动的状态保存到本地 | ||
| 115 | + transfer: true, // 是否将弹框容器插入于 body 内 | ||
| 116 | + showFooter: true, // 是否显示底部 | ||
| 117 | + mask: true, // 是否显示遮罩层 | ||
| 118 | + maskClosable: true, // 是否允许点击遮罩层关闭窗口 | ||
| 119 | + escClosable: true // 是否允许按 Esc 键关闭窗口 | ||
| 120 | + }, | ||
| 106 | i18n: (key, args) => { | 121 | i18n: (key, args) => { |
| 107 | return unref(i18n.global.locale) === 'zh-CN' | 122 | return unref(i18n.global.locale) === 'zh-CN' |
| 108 | ? XEUtils.toFormatString(XEUtils.get(zhCN, key), args) | 123 | ? XEUtils.toFormatString(XEUtils.get(zhCN, key), args) |
yudao-ui-admin-vue3/src/views/system/post/index.vue
| @@ -26,7 +26,10 @@ const gridOptions = reactive<VxeGridProps>({ | @@ -26,7 +26,10 @@ const gridOptions = reactive<VxeGridProps>({ | ||
| 26 | isHover: true | 26 | isHover: true |
| 27 | }, | 27 | }, |
| 28 | toolbarConfig: { | 28 | toolbarConfig: { |
| 29 | - buttons: [{ code: 'insert_actived', name: '新增' }] | 29 | + custom: true, |
| 30 | + slots: { | ||
| 31 | + buttons: 'toolbar_buttons' | ||
| 32 | + } | ||
| 30 | }, | 33 | }, |
| 31 | printConfig: { | 34 | printConfig: { |
| 32 | columns: [ | 35 | columns: [ |
| @@ -44,19 +47,19 @@ const gridOptions = reactive<VxeGridProps>({ | @@ -44,19 +47,19 @@ const gridOptions = reactive<VxeGridProps>({ | ||
| 44 | { | 47 | { |
| 45 | field: 'name', | 48 | field: 'name', |
| 46 | title: '岗位名称', | 49 | title: '岗位名称', |
| 47 | - span: 8, | 50 | + span: 6, |
| 48 | itemRender: { name: '$input', props: { placeholder: '请输入岗位名称' } } | 51 | itemRender: { name: '$input', props: { placeholder: '请输入岗位名称' } } |
| 49 | }, | 52 | }, |
| 50 | { | 53 | { |
| 51 | field: 'code', | 54 | field: 'code', |
| 52 | title: '岗位编码', | 55 | title: '岗位编码', |
| 53 | - span: 8, | 56 | + span: 6, |
| 54 | itemRender: { name: '$input', props: { placeholder: '请输入岗位编码' } } | 57 | itemRender: { name: '$input', props: { placeholder: '请输入岗位编码' } } |
| 55 | }, | 58 | }, |
| 56 | { | 59 | { |
| 57 | field: 'status', | 60 | field: 'status', |
| 58 | title: t('common.status'), | 61 | title: t('common.status'), |
| 59 | - span: 8, | 62 | + span: 6, |
| 60 | itemRender: { name: '$select', options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) } | 63 | itemRender: { name: '$select', options: getIntDictOptions(DICT_TYPE.COMMON_STATUS) } |
| 61 | }, | 64 | }, |
| 62 | { | 65 | { |
| @@ -139,7 +142,7 @@ const formData = ref<PostVO>({ | @@ -139,7 +142,7 @@ const formData = ref<PostVO>({ | ||
| 139 | remark: '', | 142 | remark: '', |
| 140 | createTime: '' | 143 | createTime: '' |
| 141 | }) | 144 | }) |
| 142 | -const formItems = reactive<VxeFormItemProps[]>([ | 145 | +const formItems = ref<VxeFormItemProps[]>([ |
| 143 | { | 146 | { |
| 144 | field: 'id', | 147 | field: 'id', |
| 145 | title: 'id', | 148 | title: 'id', |
| @@ -148,25 +151,25 @@ const formItems = reactive<VxeFormItemProps[]>([ | @@ -148,25 +151,25 @@ const formItems = reactive<VxeFormItemProps[]>([ | ||
| 148 | { | 151 | { |
| 149 | field: 'name', | 152 | field: 'name', |
| 150 | title: '岗位名称', | 153 | title: '岗位名称', |
| 151 | - span: 8, | 154 | + span: 12, |
| 152 | itemRender: { name: '$input', props: { placeholder: '请输入岗位名称' } } | 155 | itemRender: { name: '$input', props: { placeholder: '请输入岗位名称' } } |
| 153 | }, | 156 | }, |
| 154 | { | 157 | { |
| 155 | field: 'code', | 158 | field: 'code', |
| 156 | title: '岗位编码', | 159 | title: '岗位编码', |
| 157 | - span: 8, | 160 | + span: 12, |
| 158 | itemRender: { name: '$input', props: { placeholder: '请输入岗位编码' } } | 161 | itemRender: { name: '$input', props: { placeholder: '请输入岗位编码' } } |
| 159 | }, | 162 | }, |
| 160 | { | 163 | { |
| 161 | field: 'sort', | 164 | field: 'sort', |
| 162 | title: '岗位顺序', | 165 | title: '岗位顺序', |
| 163 | - span: 8, | 166 | + span: 12, |
| 164 | itemRender: { name: '$input', props: { type: 'number', placeholder: '请输入岗位顺序' } } | 167 | itemRender: { name: '$input', props: { type: 'number', placeholder: '请输入岗位顺序' } } |
| 165 | }, | 168 | }, |
| 166 | { | 169 | { |
| 167 | field: 'status', | 170 | field: 'status', |
| 168 | title: t('common.status'), | 171 | title: t('common.status'), |
| 169 | - span: 8, | 172 | + span: 12, |
| 170 | itemRender: { | 173 | itemRender: { |
| 171 | name: '$select', | 174 | name: '$select', |
| 172 | options: getIntDictOptions(DICT_TYPE.COMMON_STATUS), | 175 | options: getIntDictOptions(DICT_TYPE.COMMON_STATUS), |
| @@ -290,6 +293,7 @@ const submitForm: VxeFormEvents.Submit = async () => { | @@ -290,6 +293,7 @@ const submitForm: VxeFormEvents.Submit = async () => { | ||
| 290 | <vxe-modal | 293 | <vxe-modal |
| 291 | v-model="dialogVisible" | 294 | v-model="dialogVisible" |
| 292 | id="myModal6" | 295 | id="myModal6" |
| 296 | + :title="dialogTitle" | ||
| 293 | width="800" | 297 | width="800" |
| 294 | height="400" | 298 | height="400" |
| 295 | min-width="460" | 299 | min-width="460" |
| @@ -301,9 +305,6 @@ const submitForm: VxeFormEvents.Submit = async () => { | @@ -301,9 +305,6 @@ const submitForm: VxeFormEvents.Submit = async () => { | ||
| 301 | transfer | 305 | transfer |
| 302 | show-footer | 306 | show-footer |
| 303 | > | 307 | > |
| 304 | - <template #title> | ||
| 305 | - <span>{{ dialogTitle }}</span> | ||
| 306 | - </template> | ||
| 307 | <template #default> | 308 | <template #default> |
| 308 | <!-- 对话框(添加 / 修改) --> | 309 | <!-- 对话框(添加 / 修改) --> |
| 309 | <vxe-form | 310 | <vxe-form |
yudao-ui-admin-vue3/src/views/system/post/indexd.vue
| @@ -41,10 +41,10 @@ const handleCreate = () => { | @@ -41,10 +41,10 @@ const handleCreate = () => { | ||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | // 修改操作 | 43 | // 修改操作 |
| 44 | -const handleUpdate = async (row: PostVO) => { | 44 | +const handleUpdate = async (rowId: number) => { |
| 45 | setDialogTile('update') | 45 | setDialogTile('update') |
| 46 | // 设置数据 | 46 | // 设置数据 |
| 47 | - const res = await PostApi.getPostApi(row.id) | 47 | + const res = await PostApi.getPostApi(rowId) |
| 48 | unref(formRef)?.setValues(res) | 48 | unref(formRef)?.setValues(res) |
| 49 | } | 49 | } |
| 50 | 50 | ||
| @@ -133,7 +133,7 @@ getList() | @@ -133,7 +133,7 @@ getList() | ||
| 133 | link | 133 | link |
| 134 | type="primary" | 134 | type="primary" |
| 135 | v-hasPermi="['system:post:update']" | 135 | v-hasPermi="['system:post:update']" |
| 136 | - @click="handleUpdate(row)" | 136 | + @click="handleUpdate(row.id)" |
| 137 | > | 137 | > |
| 138 | <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} | 138 | <Icon icon="ep:edit" class="mr-1px" /> {{ t('action.edit') }} |
| 139 | </el-button> | 139 | </el-button> |