feat: 拉取代码

This commit is contained in:
duan
2025-02-18 18:47:15 +08:00
parent c9a88abade
commit dea89010e9
26 changed files with 1429 additions and 162 deletions

View File

@@ -415,7 +415,10 @@ function handleSelectionChange(selection: any[]) {
selectionData.value = selection;
removeIds.value = selection.map((item) => item[pk]);
}
// 获取选中的表格数据
function getselectTable() {
return selectionData.value;
}
// 刷新
function handleRefresh(isRestart = false) {
fetchPageData(lastFormData, isRestart);
@@ -560,6 +563,7 @@ function handleFileExceed(files: File[]) {
file.uid = genFileId();
uploadRef.value!.handleStart(file);
}
// 下载导入模板
function handleDownloadTemplate() {
const importTemplate = props.contentConfig.importTemplate;
@@ -725,6 +729,7 @@ function handleModify(field: string, value: boolean | string | number, row: Reco
if (props.contentConfig.modifyAction) {
props.contentConfig.modifyAction({
[pk]: row[pk],
...row,
field: field,
value: value,
});
@@ -847,7 +852,7 @@ function saveXlsx(fileData: BlobPart, fileName: string) {
}
// 暴露的属性和方法
defineExpose({ fetchPageData, exportPageData, getFilterParams });
defineExpose({ fetchPageData, exportPageData, getFilterParams, getselectTable });
</script>
<style lang="scss" scoped></style>

View File

@@ -1,20 +1,9 @@
<template>
<!-- drawer -->
<template v-if="modalConfig.component === 'drawer'">
<el-drawer
v-model="modalVisible"
:append-to-body="true"
v-bind="modalConfig.drawer"
@close="handleCloseModal"
>
<el-drawer v-model="modalVisible" :append-to-body="true" v-bind="modalConfig.drawer" @close="handleCloseModal">
<!-- 表单 -->
<el-form
ref="formRef"
label-width="auto"
v-bind="modalConfig.form"
:model="formData"
:rules="formRules"
>
<el-form ref="formRef" label-width="auto" v-bind="modalConfig.form" :model="formData" :rules="formRules">
<el-row :gutter="20">
<template v-for="item in formItems" :key="item.prop">
<template v-if="item.type === 'title'">
@@ -26,12 +15,7 @@
<template v-if="item.tips" #label>
<span>
{{ item.label }}
<el-tooltip
placement="bottom"
effect="light"
:content="item.tips"
:raw-content="true"
>
<el-tooltip placement="bottom" effect="light" :content="item.tips" :raw-content="true">
<el-icon style="vertical-align: -0.15em" size="16">
<QuestionFilled />
</el-icon>
@@ -103,12 +87,7 @@
</template>
<!-- 自定义 -->
<template v-else-if="item.type === 'custom'">
<slot
:name="item.slotName ?? item.prop"
:prop="item.prop"
:formData="formData"
:attrs="item.attrs"
/>
<slot :name="item.slotName ?? item.prop" :prop="item.prop" :formData="formData" :attrs="item.attrs" />
</template>
</el-form-item>
</el-col>
@@ -129,26 +108,13 @@
</template>
<!-- dialog -->
<template v-else>
<el-dialog
v-model="modalVisible"
:align-center="true"
:append-to-body="true"
width="70vw"
v-bind="modalConfig.dialog"
style="padding-right: 0"
@close="handleCloseModal"
>
<el-dialog v-model="modalVisible" :align-center="true" :append-to-body="true" width="70vw"
v-bind="modalConfig.dialog" style="padding-right: 0" @close="handleCloseModal">
<!-- 滚动 -->
<el-scrollbar max-height="60vh">
<!-- 表单 -->
<el-form
ref="formRef"
label-width="auto"
v-bind="modalConfig.form"
style="padding-right: var(--el-dialog-padding-primary)"
:model="formData"
:rules="formRules"
>
<el-form ref="formRef" label-width="auto" v-bind="modalConfig.form"
style="padding-right: var(--el-dialog-padding-primary)" :model="formData" :rules="formRules">
<el-row :gutter="20">
<template v-for="item in formItems" :key="item.prop">
<template v-if="item.type === 'title'">
@@ -162,12 +128,7 @@
<template v-if="item.tips" #label>
<span>
{{ item.label }}
<el-tooltip
placement="bottom"
effect="light"
:content="item.tips"
:raw-content="true"
>
<el-tooltip placement="bottom" effect="light" :content="item.tips" :raw-content="true">
<el-icon style="vertical-align: -0.15em" size="16">
<QuestionFilled />
</el-icon>
@@ -176,11 +137,7 @@
</template>
<!-- Input 输入框 -->
<template v-if="item.type === 'input' || item.type === undefined">
<el-input
v-model="formData[item.prop]"
v-bind="item.attrs"
:disabled="item.disabled"
/>
<el-input v-model="formData[item.prop]" v-bind="item.attrs" :disabled="item.disabled" />
</template>
<!-- textarea 输入框 -->
<template v-else-if="item.type === 'textarea'">
@@ -247,12 +204,8 @@
</template>
<!-- 自定义 -->
<template v-else-if="item.type === 'custom'">
<slot
:name="item.slotName ?? item.prop"
:prop="item.prop"
:formData="formData"
:attrs="item.attrs"
/>
<slot :name="item.slotName ?? item.prop" :prop="item.prop" :formData="formData"
:attrs="item.attrs" />
</template>
</el-form-item>
</el-col>
@@ -412,7 +365,7 @@ function handleDisabled(disable: boolean) {
}
// 暴露的属性和方法
defineExpose({ setModalVisible, getFormData, setFormData, setFormItemData, handleDisabled });
defineExpose({ setModalVisible, getFormData, setFormData, setFormItemData, handleDisabled, handleClose });
</script>
<style lang="scss" scoped>

View File

@@ -1,27 +1,13 @@
<template>
<el-card
v-show="visible"
v-hasPerm="[`${searchConfig.pageName}:query`]"
shadow="never"
class="mb-[10px]"
>
<el-card v-show="visible" v-hasPerm="[`${searchConfig.pageName}:query`]" shadow="never" class="mb-[10px]">
<el-form ref="queryFormRef" :model="queryParams" :inline="inline">
<template v-for="(item, index) in formItems" :key="item.prop">
<el-form-item
v-show="isExpand ? true : index < showNumber"
:label="item.label"
:prop="item.prop"
>
<el-form-item v-show="isExpand ? true : index < showNumber" :label="item.label" :prop="item.prop">
<!-- Label -->
<template v-if="item.tips" #label>
<span>
{{ item.label }}
<el-tooltip
placement="bottom"
effect="light"
:content="item.tips"
:raw-content="true"
>
<el-tooltip placement="bottom" effect="light" :content="item.tips" :raw-content="true">
<el-icon style="vertical-align: -0.15em" size="16">
<QuestionFilled />
</el-icon>
@@ -30,11 +16,7 @@
</template>
<!-- Input 输入框 -->
<template v-if="item.type === 'input' || item.type === undefined">
<el-input
v-model="queryParams[item.prop]"
v-bind="item.attrs"
@keyup.enter="handleQuery"
/>
<el-input v-model="queryParams[item.prop]" v-bind="item.attrs" @keyup.enter="handleQuery" />
</template>
<!-- radio-button radio按钮组 -->
<template v-if="item.type === 'radio-button'">
@@ -47,30 +29,17 @@
<!-- InputTag 标签输入框 -->
<template v-if="item.type === 'input-tag'">
<div class="flex-center">
<el-tag
v-for="tag in inputTagMap[item.prop].data"
:key="tag"
class="mr-2"
:closable="true"
v-bind="inputTagMap[item.prop].tagAttrs"
@close="handleCloseTag(item.prop, tag)"
>
<el-tag v-for="tag in inputTagMap[item.prop].data" :key="tag" class="mr-2" :closable="true"
v-bind="inputTagMap[item.prop].tagAttrs" @close="handleCloseTag(item.prop, tag)">
{{ tag }}
</el-tag>
<template v-if="inputTagMap[item.prop].inputVisible">
<el-input
:ref="(el: HTMLElement) => (inputTagMap[item.prop].inputRef = el)"
v-model="inputTagMap[item.prop].inputValue"
v-bind="inputTagMap[item.prop].inputAttrs"
@keyup.enter="handleInputConfirm(item.prop)"
@blur="handleInputConfirm(item.prop)"
/>
<el-input :ref="(el: HTMLElement) => (inputTagMap[item.prop].inputRef = el)"
v-model="inputTagMap[item.prop].inputValue" v-bind="inputTagMap[item.prop].inputAttrs"
@keyup.enter="handleInputConfirm(item.prop)" @blur="handleInputConfirm(item.prop)" />
</template>
<template v-else>
<el-button
v-bind="inputTagMap[item.prop].buttonAttrs"
@click="handleShowInput(item.prop)"
>
<el-button v-bind="inputTagMap[item.prop].buttonAttrs" @click="handleShowInput(item.prop)">
{{ inputTagMap[item.prop].buttonAttrs.btnText }}
</el-button>
</template>
@@ -80,7 +49,7 @@
<template v-else-if="item.type === 'select'">
<el-select v-model="queryParams[item.prop]" v-bind="item.attrs">
<template v-for="option in item.options" :key="option.value">
<el-option :label="option.label" :value="option.value" />
<el-option :label="option.label || option.name" :value="option.value || option.id" />
</template>
</el-select>
</template>
@@ -98,13 +67,8 @@
<el-button type="primary" icon="search" @click="handleQuery">搜索</el-button>
<el-button icon="refresh" @click="handleReset">重置</el-button>
<!-- 展开/收起 -->
<el-link
v-if="isExpandable && formItems.length > showNumber"
class="ml-2"
type="primary"
:underline="false"
@click="isExpand = !isExpand"
>
<el-link v-if="isExpandable && formItems.length > showNumber" class="ml-2" type="primary" :underline="false"
@click="isExpand = !isExpand">
<template v-if="isExpand">
收起
<el-icon>

View File

@@ -6,7 +6,6 @@ function usePage() {
const contentRef = ref<PageContentInstance>();
const addModalRef = ref<PageModalInstance>();
const editModalRef = ref<PageModalInstance>();
// 搜索
function handleQueryClick(queryParams: IObject) {
const filterParams = contentRef.value?.getFilterParams();

View File

@@ -0,0 +1,46 @@
<template>
<el-dialog v-model="dialogVisible" :title="props.title" :width="props.width">
<slot></slot>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="Confirm">
确定
</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { ElMessageBox } from 'element-plus'
let props = defineProps({
title: {
type: String,
default: 'Dialog'
},
width: {
type: String,
default: '30%'
}
})
const emit = defineEmits(['confirm'])
const dialogVisible = ref(false)
function open() {
dialogVisible.value = true
}
function Confirm() {
dialogVisible.value = false
emit('confirm')
}
defineExpose({ open })
</script>
<style scoped>
.dialog-footer button:first-child {
margin-right: 10px;
}
</style>