easybill-ui 0.1.8 → 0.1.10
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.
- package/components/CurdForm/src/CurdForm.vue +5 -2
- package/components/CurdForm/src/types.ts +1 -0
- package/components/CurdTable/src/CurdTable.vue +5 -2
- package/components/TableFilter/src/FilterExternal/FilterExternal.vue +18 -7
- package/components/TableFilter/src/components/FilterTags.vue +2 -1
- package/components/TableFilter/types.ts +1 -0
- package/package.json +2 -2
|
@@ -54,6 +54,10 @@ export default defineComponent({
|
|
|
54
54
|
type: Object as PropType<Fields>,
|
|
55
55
|
default: undefined,
|
|
56
56
|
},
|
|
57
|
+
extendContext: {
|
|
58
|
+
type: Object as PropType<Record<string, any>>,
|
|
59
|
+
default: undefined,
|
|
60
|
+
},
|
|
57
61
|
},
|
|
58
62
|
emits: ["update:modelValue", "change"],
|
|
59
63
|
setup(props, { emit, attrs }) {
|
|
@@ -78,7 +82,6 @@ export default defineComponent({
|
|
|
78
82
|
},
|
|
79
83
|
{ deep: true }
|
|
80
84
|
)
|
|
81
|
-
|
|
82
85
|
// 先从schema中读取默认值
|
|
83
86
|
const schemaValues = sFormSchema.value.formItem.reduce<Fields>((previousValue, currentValue) => {
|
|
84
87
|
currentValue.eventObject ??= {}
|
|
@@ -183,7 +186,7 @@ export default defineComponent({
|
|
|
183
186
|
curdFormContext.change = onChange
|
|
184
187
|
curdFormContext.formModel = formModel
|
|
185
188
|
curdFormContext.formRef = schemaFormRef
|
|
186
|
-
|
|
189
|
+
props.extendContext && Object.assign(curdFormContext, props.extendContext)
|
|
187
190
|
provide("curdFormContext", curdFormContext)
|
|
188
191
|
return {
|
|
189
192
|
formModel,
|
|
@@ -41,6 +41,7 @@ export interface FormContext {
|
|
|
41
41
|
change: (formModel: Fields, formItem: FormItem) => void
|
|
42
42
|
formModel: Fields
|
|
43
43
|
formRef: Ref<InstanceType<typeof ElForm> | undefined>
|
|
44
|
+
setValue: (prop: string, value?: any) => void
|
|
44
45
|
}
|
|
45
46
|
export interface Fields {
|
|
46
47
|
[key: string]: any
|
|
@@ -106,7 +106,7 @@ export default {
|
|
|
106
106
|
}
|
|
107
107
|
</script>
|
|
108
108
|
<script lang="ts" setup>
|
|
109
|
-
import { computed, ref, reactive, watch, onActivated, getCurrentInstance, provide, PropType, Ref } from "vue"
|
|
109
|
+
import { computed, ref, reactive, watch, onActivated, onMounted, getCurrentInstance, provide, PropType, Ref } from "vue"
|
|
110
110
|
import STableItem from "./STableItem.vue"
|
|
111
111
|
import STableFilter from "./STableFilter.vue"
|
|
112
112
|
import STableMenu from "./STableMenu.vue"
|
|
@@ -299,7 +299,10 @@ onActivated(() => {
|
|
|
299
299
|
hasInit = true
|
|
300
300
|
}
|
|
301
301
|
})
|
|
302
|
-
|
|
302
|
+
// filter内部有一些初始化的操作,比如操作value初始值,需要等子组件初始化后再执行列表数据fetch操作
|
|
303
|
+
onMounted(() => {
|
|
304
|
+
option.autoload && fetchData()
|
|
305
|
+
})
|
|
303
306
|
// 组装columns
|
|
304
307
|
const { columns, selectParams } = useColumnHook(props)
|
|
305
308
|
// 菜单点击事件
|
|
@@ -10,6 +10,7 @@ import { ref, watch, Ref, PropType } from "vue"
|
|
|
10
10
|
import CurdForm from "../../../CurdForm"
|
|
11
11
|
import { ParamsItem, ListQuery } from "../../types"
|
|
12
12
|
import { Fields, FormSchema, FormItem } from "../../../CurdForm"
|
|
13
|
+
import { deepClone } from "../../../CurdForm/src/utils/common"
|
|
13
14
|
const props = defineProps({
|
|
14
15
|
selectParams: {
|
|
15
16
|
type: Array as PropType<Array<ParamsItem>>,
|
|
@@ -40,9 +41,10 @@ const formSchema: Ref<FormSchema> = ref({
|
|
|
40
41
|
formItem: [...as, ...formItemRight],
|
|
41
42
|
})
|
|
42
43
|
const init = () => {
|
|
44
|
+
// const query = deepClone(listQuery.value)
|
|
43
45
|
for (let i in formSchema.value.formItem) {
|
|
44
46
|
const item = formSchema.value.formItem[i] as ParamsItem
|
|
45
|
-
if (item.tableKey) {
|
|
47
|
+
if (item.tableKey && props.listQuery[item.tableKey[0]]) {
|
|
46
48
|
listQuery.value[item.prop] = [props.listQuery[item.tableKey[0]], props.listQuery[item.tableKey[1]]]
|
|
47
49
|
}
|
|
48
50
|
}
|
|
@@ -54,28 +56,37 @@ const init = () => {
|
|
|
54
56
|
} else {
|
|
55
57
|
// const cur1 = formSchema.value.formItem.find((a) => a.tableKey && a.tableKey.includes(i))
|
|
56
58
|
// if (cur1 && cur1.tableKey) {
|
|
57
|
-
//
|
|
59
|
+
// query[i] = [l[cur1.tableKey[0]], l[cur1.tableKey[1]]]
|
|
58
60
|
// }
|
|
59
61
|
}
|
|
60
62
|
}
|
|
63
|
+
// listQuery.value = query
|
|
61
64
|
}
|
|
62
65
|
init()
|
|
66
|
+
|
|
63
67
|
const emit = defineEmits(["change"])
|
|
64
68
|
watch(
|
|
65
69
|
() => listQuery.value,
|
|
66
70
|
(val) => {
|
|
67
71
|
const l = props.listQuery
|
|
68
72
|
for (let i in val) {
|
|
69
|
-
|
|
73
|
+
const cur = formSchema.value.formItem.find((a) => a.prop == i)
|
|
74
|
+
if (cur && cur.tableKey) {
|
|
75
|
+
l[cur.tableKey[0]] = (val[i] && val[i][0]) || ""
|
|
76
|
+
l[cur.tableKey[1]] = (val[i] && val[i][1]) || ""
|
|
77
|
+
} else {
|
|
78
|
+
l[i] = val[i]
|
|
79
|
+
}
|
|
70
80
|
}
|
|
81
|
+
//
|
|
71
82
|
},
|
|
72
|
-
{ deep: true }
|
|
83
|
+
{ immediate: true, deep: true }
|
|
73
84
|
)
|
|
74
85
|
const onChange = (formModel: Fields, formItem: any) => {
|
|
75
86
|
const l = props.listQuery
|
|
76
|
-
if (formItem.tableKey
|
|
77
|
-
l[formItem.tableKey[0]] = formModel[formItem.prop][0]
|
|
78
|
-
l[formItem.tableKey[1]] = formModel[formItem.prop][1]
|
|
87
|
+
if (formItem.tableKey) {
|
|
88
|
+
l[formItem.tableKey[0]] = formModel[formItem.prop]?.length ? formModel[formItem.prop][0] : ""
|
|
89
|
+
l[formItem.tableKey[1]] = formModel[formItem.prop]?.length ? formModel[formItem.prop][1] : ""
|
|
79
90
|
}
|
|
80
91
|
if (!formItem.tableKey) {
|
|
81
92
|
l[formItem.prop] = formModel[formItem.prop]
|
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
</div>
|
|
21
21
|
</el-popover>
|
|
22
22
|
</div>
|
|
23
|
+
<div class="tag-clear"><el-button type="primary" link @click="clear">清空</el-button></div>
|
|
23
24
|
</div>
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
<slot></slot>
|
|
26
27
|
</div>
|
|
27
28
|
</template>
|
|
@@ -10,6 +10,7 @@ export interface ParamsItem extends FormItem {
|
|
|
10
10
|
export interface TableFilterContext {
|
|
11
11
|
loadOptions: (prop: string) => void
|
|
12
12
|
setValue: (prop: string, value: any) => void
|
|
13
|
+
search: () => void
|
|
13
14
|
}
|
|
14
15
|
export interface ListQuery {
|
|
15
16
|
[key: string]: any //string | boolean | number | Array<string> | Array<number>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "easybill-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "A component library for easybill",
|
|
5
5
|
"author": "tuchongyang <779311998@qq.com>",
|
|
6
6
|
"private": false,
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
"publishConfig": {
|
|
15
15
|
"access": "public"
|
|
16
16
|
},
|
|
17
|
-
"gitHead": "
|
|
17
|
+
"gitHead": "2733f8f19e6fa098d2dd73b572a94e75b5ef81a7"
|
|
18
18
|
}
|