easybill-ui 1.2.24 → 1.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -276,7 +276,6 @@ const onItemChange = (prop: string, value: string, filter: FilterItem) => {
|
|
|
276
276
|
listQuery.pageIndex = 1
|
|
277
277
|
fetchData()
|
|
278
278
|
}
|
|
279
|
-
|
|
280
279
|
let hasInit = false
|
|
281
280
|
onActivated(() => {
|
|
282
281
|
// option?.customActivatedFetch为true时,参考/system/partner/account/vendor写法
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<el-table-column v-if="!
|
|
2
|
+
<el-table-column v-if="!getColumnHidden" :fixed="props.schema.fixed" v-bind="getColumnAttrs">
|
|
3
3
|
<template #header="scope">
|
|
4
4
|
<div class="header-td" :class="[props.schema.align]">
|
|
5
5
|
<slot :name="props.schema.prop + 'Header'" v-bind="scope"></slot>
|
|
@@ -94,16 +94,23 @@ const copyValue = async (value: unknown) => {
|
|
|
94
94
|
ElMessage.success(t("el.table.clickCopySuccess"))
|
|
95
95
|
}
|
|
96
96
|
const emits = defineEmits(["search"])
|
|
97
|
+
const search = inject("search")
|
|
98
|
+
const getColumnHidden = computed(() => {
|
|
99
|
+
if (props.schema.hidden && props.schema.hidden instanceof Function) {
|
|
100
|
+
return props.schema.hidden(props.schema, search)
|
|
101
|
+
}
|
|
102
|
+
return props.schema.hidden
|
|
103
|
+
})
|
|
97
104
|
const onChange = (prop: string, value: string) => {
|
|
98
105
|
emits("search", prop, value, filterSchema.value)
|
|
99
106
|
}
|
|
100
107
|
const tableItemFilterRef = ref<InstanceType<typeof STableItemFilter>>()
|
|
101
|
-
const
|
|
108
|
+
const onSearch = (opt: { listQuery: Record<string, unknown> }) => {
|
|
102
109
|
if (tableItemFilterRef.value) tableItemFilterRef.value.search(opt)
|
|
103
110
|
}
|
|
104
111
|
const tableItemRefs: Ref<Record<string, unknown>> = ref({})
|
|
105
112
|
const onItemChange = (prop: string, value: string) => {
|
|
106
113
|
emits("search", prop, value, filterSchema.value)
|
|
107
114
|
}
|
|
108
|
-
defineExpose({ search })
|
|
115
|
+
defineExpose({ search: onSearch })
|
|
109
116
|
</script>
|
|
@@ -24,7 +24,7 @@ export interface ColumnItemCtx<T> extends Partial<TableColumnCtx<T>> {
|
|
|
24
24
|
prop: string
|
|
25
25
|
label: string
|
|
26
26
|
type?: string
|
|
27
|
-
hidden?: boolean
|
|
27
|
+
hidden?: boolean | ((item: ColumnItemCtx<T>, search: (opt: { listQuery: Record<string, unknown> }) => void) => boolean)
|
|
28
28
|
neverShow?: boolean // 表示不在列控制器里
|
|
29
29
|
children?: ColumnItem<T>[]
|
|
30
30
|
options?: Array<OptionItem> //数据字典
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<component :is="componentName" v-bind="containerProps">
|
|
3
3
|
<el-steps v-if="stepSchemaList.length > 1" :active="step" align-center style="margin-bottom: 20px; position: sticky; top: 0; z-index: 2000; background: var(--el-bg-color)" v-bind="stepProps">
|
|
4
4
|
<el-step v-for="(item, i) in stepSchemaList" :key="i" :title="item.name" :description="item.description" />
|
|
5
5
|
</el-steps>
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
<el-button v-if="step >= stepSchemaList.length - 1" :disabled="confirmLoading" type="primary" :loading="confirmLoading" @click="onOk">{{ confirmBtnTextLabel }}</el-button>
|
|
17
17
|
</span>
|
|
18
18
|
</template>
|
|
19
|
-
</
|
|
19
|
+
</component>
|
|
20
20
|
</template>
|
|
21
21
|
|
|
22
22
|
<script lang="ts">
|
|
23
23
|
import { useLocale } from "easybill-ui"
|
|
24
|
-
import { computed, defineComponent, type PropType, provide, reactive, ref, type Ref, shallowRef, toRefs } from "vue"
|
|
24
|
+
import { computed, defineComponent, type PropType, provide, reactive, ref, type Ref, shallowRef, toRefs, useAttrs } from "vue"
|
|
25
25
|
import { type Fields, type FormSchema } from "../../CurdForm"
|
|
26
26
|
export default defineComponent({
|
|
27
27
|
name: "FormDialog",
|
|
@@ -79,8 +79,14 @@ export default defineComponent({
|
|
|
79
79
|
type: String,
|
|
80
80
|
default: "",
|
|
81
81
|
},
|
|
82
|
+
mode: {
|
|
83
|
+
// 容器组件类型: 'dialog' | 'drawer'
|
|
84
|
+
type: String as PropType<"dialog" | "drawer">,
|
|
85
|
+
default: "dialog",
|
|
86
|
+
},
|
|
82
87
|
},
|
|
83
88
|
setup(props) {
|
|
89
|
+
const attrs = useAttrs()
|
|
84
90
|
const curdFormRef = ref()
|
|
85
91
|
const form = ref<Fields>({})
|
|
86
92
|
const state = reactive({
|
|
@@ -156,6 +162,27 @@ export default defineComponent({
|
|
|
156
162
|
}
|
|
157
163
|
const confirmBtnTextLabel = computed(() => props.confirmBtnText || t("el.formDialog.confirm"))
|
|
158
164
|
const cancelBtnTextLabel = computed(() => props.cancelBtnText || t("el.formDialog.cancel"))
|
|
165
|
+
const componentName = computed(() => (props.mode === "drawer" ? "el-drawer" : "el-dialog"))
|
|
166
|
+
const containerProps = computed(() => {
|
|
167
|
+
const baseProps = {
|
|
168
|
+
modelValue: state.visible,
|
|
169
|
+
title: props.title,
|
|
170
|
+
"close-on-click-modal": false,
|
|
171
|
+
"before-close": onBeforeClose,
|
|
172
|
+
...attrs,
|
|
173
|
+
}
|
|
174
|
+
if (props.mode === "drawer") {
|
|
175
|
+
return {
|
|
176
|
+
...baseProps,
|
|
177
|
+
size: attrs.size || attrs.width || "60%",
|
|
178
|
+
direction: attrs.direction || "rtl",
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
...baseProps,
|
|
183
|
+
width: attrs.width || "60%",
|
|
184
|
+
}
|
|
185
|
+
})
|
|
159
186
|
const formDialogContext = reactive({
|
|
160
187
|
form,
|
|
161
188
|
state,
|
|
@@ -180,6 +207,8 @@ export default defineComponent({
|
|
|
180
207
|
extendContexts,
|
|
181
208
|
confirmBtnTextLabel,
|
|
182
209
|
cancelBtnTextLabel,
|
|
210
|
+
componentName,
|
|
211
|
+
containerProps,
|
|
183
212
|
}
|
|
184
213
|
},
|
|
185
214
|
})
|