Commit 09b9c2b9 by Sweet Zhang

Merge branch 'test' into sw

parents dbcd9f18 375ff2e5
......@@ -13,7 +13,10 @@
<template #header>
<div class="titleBox">{{ dialogTitle }}</div>
</template>
<slot class="content"></slot>
<div class="content">
<slot></slot>
</div>
<template #footer>
<div class="dialog-footer">
<!-- 取消按钮 -->
......@@ -107,7 +110,9 @@ watch(
align-items: center;
padding: 15px 0;
}
.content {
padding: 0 15px;
}
.dialog-footer {
width: 100%;
display: flex;
......
......@@ -42,11 +42,11 @@
{{ btn.label }}
</el-button>
</template>
<!-- 左侧插槽 -->
<slot name="leftButtons"></slot>
</div>
<div class="operationRight">
<!-- 右侧按钮 -->
<template v-for="btn in rightButtons" :key="btn.key || btn.label">
......@@ -62,7 +62,7 @@
{{ btn.label }}
</el-button>
</template>
<!-- 右侧插槽 -->
<slot name="rightButtons"></slot>
</div>
......@@ -72,7 +72,7 @@
<el-col :span="24">
<slot name="table"></slot>
</el-col>
<!-- 分页区域 -->
<el-col :span="24" v-if="showPagination">
<div class="pagination-container">
......@@ -93,7 +93,7 @@
</template>
<script setup lang="ts">
import { ref, computed, watch, nextTick, onMounted, defineExpose } from 'vue'
import { ref, computed, watch, nextTick, onMounted } from 'vue'
// 按钮类型定义
export interface OperationButton {
......@@ -172,11 +172,11 @@ const emit = defineEmits<{
// 搜索展开/收起
'search-toggle': [expanded: boolean]
// 默认按钮事件(为方便使用保留)
'add': []
'import': []
'export': []
'reset': []
'query': []
add: []
import: []
export: []
reset: []
query: []
}>()
// 响应式数据
......@@ -233,7 +233,7 @@ const defaultButtonConfigs = {
// 计算最终按钮配置
const computedButtons = computed(() => {
const result: OperationButton[] = []
// 1. 添加默认按钮(如果开启)
if (props.showDefaultButtons) {
props.visibleDefaultButtons.forEach(key => {
......@@ -249,35 +249,33 @@ const computedButtons = computed(() => {
}
})
}
// 2. 添加没有匹配到默认按钮的自定义按钮
props.operationBtnList.forEach(customBtn => {
// 如果这个按钮已经有默认配置了,就跳过(已经在上面处理了)
const isDefaultBtn = customBtn.key && props.visibleDefaultButtons.includes(customBtn.key as any)
const alreadyAdded = result.some(btn => btn.key === customBtn.key)
if (!isDefaultBtn && !alreadyAdded) {
result.push(customBtn)
}
})
return result
})
// 计算左侧按钮
const leftButtons = computed(() => {
return computedButtons.value.filter(btn =>
(btn.direction === 'left' || (!btn.direction && props.showDefaultButtons)) &&
(btn.visible !== false)
return computedButtons.value.filter(
btn =>
(btn.direction === 'left' || (!btn.direction && props.showDefaultButtons)) &&
btn.visible !== false
)
})
// 计算右侧按钮
const rightButtons = computed(() => {
return computedButtons.value.filter(btn =>
btn.direction === 'right' &&
(btn.visible !== false)
)
return computedButtons.value.filter(btn => btn.direction === 'right' && btn.visible !== false)
})
// 方法
......@@ -289,25 +287,25 @@ const toggleExpand = () => {
const checkConditions = () => {
if (!searchFormRef.value || !props.showSearchForm) return
nextTick(() => {
const formItems = Array.from(
searchFormRef.value!.querySelectorAll('.el-form-item, .el-button-group')
)
hasMoreCondition.value = formItems.length > props.defaultVisibleConditions
if (!isExpanded.value && hasMoreCondition.value) {
formItems.forEach((item, index) => {
if (index >= props.defaultVisibleConditions) {
(item as HTMLElement).style.display = 'none'
;(item as HTMLElement).style.display = 'none'
} else {
(item as HTMLElement).style.display = ''
;(item as HTMLElement).style.display = ''
}
})
} else {
formItems.forEach(item => {
(item as HTMLElement).style.display = ''
;(item as HTMLElement).style.display = ''
})
}
})
......@@ -317,7 +315,7 @@ const checkConditions = () => {
const handleButtonClick = async (btn: OperationButton) => {
// 触发通用按钮点击事件
emit('btn-click', btn)
// 触发默认按钮的特定事件(保持向后兼容)
if (btn.key) {
switch (btn.key) {
......@@ -338,7 +336,7 @@ const handleButtonClick = async (btn: OperationButton) => {
break
}
}
// 执行父组件传入的click函数
if (btn.click && typeof btn.click === 'function') {
try {
......@@ -466,7 +464,7 @@ onMounted(() => {
.search-form-container {
width: 100%;
transition: all 0.3s ease;
&.expanded {
.el-form-item {
display: flex !important;
......@@ -481,19 +479,19 @@ onMounted(() => {
align-items: stretch;
gap: 12px;
}
.operationLeft,
.operationRight {
width: 100%;
justify-content: center;
}
.cardStyle {
margin-bottom: 8px;
}
.pagination-container {
justify-content: center;
}
}
</style>
\ No newline at end of file
</style>
......@@ -286,7 +286,8 @@ import {
getCustomerDetail,
editCustomer,
getCustomerList,
addFna
addFna,
calculateFieldValue,
} from '@/api/sign/fna'
import useDictStore from '@/store/modules/dict'
const dictStore = useDictStore() //获取字典数据
......
......@@ -2,8 +2,14 @@
<div class="app-container">
<CommonPage
:operationBtnList="operationBtnList"
:visibleDefaultButtons="visibleDefaultButtons"
:showSearchForm="true"
:show-pagination="false"
:show-pagination="true"
:currentPage="queryParams.pageNo"
:total="total"
:pageSize="queryParams.pageSize"
@current-change="changePageNo"
@size-change="changePageSize"
>
<!-- 查询条件插槽 -->
<template #searchForm>
......@@ -124,7 +130,7 @@
</template>
</el-table-column>
</el-table>
<div style="width: 100%; display: flex; justify-content: flex-end; margin-bottom: 30px">
<!-- <div style="width: 100%; display: flex; justify-content: flex-end; margin-bottom: 30px">
<pagination
v-show="total >= 0"
:total="total"
......@@ -133,7 +139,7 @@
@pagination="getList"
style="text-align: right"
/>
</div>
</div> -->
</template>
</CommonPage>
<!-- 下一步到预约 -->
......@@ -170,38 +176,39 @@ const data = reactive({
})
const { queryParams, form, rules } = toRefs(data)
// 控制要显示的默认按钮
const visibleDefaultButtons = ref(['add', 'query', 'reset']) // 只显示新增和查询两个默认按钮
// 按钮配置
const operationBtnList = ref([
{
key: 'add',
label: '新建流程',
icon: 'Plus',
type: 'primary',
direction: 'left',
size: 'large',
click: handleAdd
},
{
label: '搜索',
icon: 'Search',
type: 'primary',
key: 'reset',
direction: 'right',
size: 'large',
click: handleQuery
click: resetQuery
},
{
label: '重置',
icon: 'Refresh',
type: 'info',
key: 'query',
direction: 'right',
size: 'large',
click: resetQuery
click: handleQuery
}
])
const changePageNo = val => {
queryParams.value.pageNo = val
getList()
}
const changePageSize = val => {
queryParams.value.pageSize = val
getList()
}
const clearDateRange = () => {
dateRange.value = []
}
const handleCopy = row => {
// { fnaBizId: row.fnaBizId }
subProcess({ fnaBizId: row.fnaBizId }).then(response => {
if (response.code === 200) {
getList()
......@@ -262,7 +269,7 @@ function resetQuery() {
proxy.resetForm('queryRef')
queryParams.value = {
pageNo: 1,
pageSize: 8,
pageSize: 10,
startTime: '',
endTime: ''
}
......@@ -283,15 +290,6 @@ function handleDelete(row) {
.catch(() => {})
}
/** 重置操作表单 */
function reset() {
form.value = {
pageNo: 1,
pageSize: 8
}
proxy.resetForm('tenantRef')
}
/** 新增按钮操作 */
function handleAdd() {
router.push('/sign/FnaList/edit?type=add')
......
......@@ -2,8 +2,14 @@
<div class="app-container">
<CommonPage
:operationBtnList="operationBtnList"
:visibleDefaultButtons="visibleDefaultButtons"
:showSearchForm="true"
:show-pagination="false"
:show-pagination="true"
:currentPage="queryParams.pageNo"
:total="total"
:pageSize="queryParams.pageSize"
@current-change="changePageNo"
@size-change="changePageSize"
>
<!-- 查询条件插槽 -->
<template #searchForm>
......@@ -139,15 +145,6 @@
</template>
</el-table-column>
</el-table>
<div style="width: 100%; display: flex; justify-content: flex-end; margin-bottom: 30px">
<pagination
v-show="total >= 0"
:total="total"
v-model:page="queryParams.pageNo"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
</div>
</template>
</CommonPage>
<!-- 下一步到预约 -->
......@@ -210,30 +207,34 @@ const dialogVisible = ref(false)
const appointmentSummeryInfo = ref({})
const tenantList = ref([])
const loading = ref(true)
const showSearch = ref(true)
const ids = ref([])
const total = ref(0)
const dateRange = ref([])
const detailData = ref([]) //行程单-行程信息
const exportLoading = ref(false)
// 控制要显示的默认按钮
const visibleDefaultButtons = ref(['query', 'reset']) // 只显示新增和查询两个默认按钮
// 按钮配置
const operationBtnList = ref([
{
label: '搜索',
icon: 'Search',
type: 'primary',
key: 'reset',
direction: 'right',
size: 'small',
click: handleQuery
click: resetQuery
},
{
label: '重置',
icon: 'Refresh',
type: 'info',
key: 'query',
direction: 'right',
size: 'small',
click: resetQuery
click: handleQuery
}
])
const changePageNo = val => {
queryParams.value.pageNo = val
getList()
}
const changePageSize = val => {
queryParams.value.pageSize = val
getList()
}
const data = reactive({
form: {},
queryParams: {
......@@ -530,7 +531,6 @@ getList()
padding: 10px 20px; */
}
.dialogBox {
padding: 0 15px;
.dialogTitle {
display: flex;
align-items: center;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment