From 49dfdd3bf265db28d38167f34e9aabfdd3e8e5db Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 17 十月 2025 10:16:58 +0800
Subject: [PATCH] imagebutton
---
components/oi-form/index.vue | 49 +++++++++++++++++++++++++++++--------------------
1 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/components/oi-form/index.vue b/components/oi-form/index.vue
index fd8bbc0..3a9ca90 100644
--- a/components/oi-form/index.vue
+++ b/components/oi-form/index.vue
@@ -1,27 +1,32 @@
<template>
- <uni-forms class="oi-form" ref="baseForm" label-align="right">
- <template v-for="(item,index) in form.items">
- <OIFormLayout v-if="item.name == 'Layout'" v-show="!item.isHidden" :focusId="focusId" :viewMode="viewMode"
- :hiddenIds="hiddenIds" :data="item" @change="onChange" @focus="onFocus" @click="onClick"
- @click-prefix="onClickPrefix" @click-suffix="onClickSuffix">
- </OIFormLayout>
+ <uni-forms class="oi-form" ref="baseForm" :label-align="largeMode?'left':'right'" :label-position="largeMode?'top':'left'" >
+ <view v-for="(item,index) in form.items" :key="index">
+ <!-- 鏍呮牸甯冨眬 -->
+ <uni-row v-if="item.name == 'Layout'" v-show="!item.isHidden" :gutter="item.setting.gutter">
+ <uni-col
+ :span="item.setting.spanList && item.setting.spanList[key]? item.setting.spanList[key] : 24 / item.setting.col"
+ v-for="(col,key) in item.setting.colList" :key="key">
+ <OIFormItem v-if="col != null" :focusId="focusId" :viewMode="viewMode" :data="col"
+ :hiddenIds="hiddenIds" @on-change="onChange" @on-focus="onFocus" @on-click="onClick"
+ @on-click-prefix="onClickPrefix" @on-click-suffix="onClickSuffix"></OIFormItem>
+ <uni-forms-item v-else label=""></uni-forms-item>
+ </uni-col>
+ </uni-row>
<OIFormItem v-else :hiddenIds="hiddenIds" :focusId="focusId" :viewMode="viewMode" :data="item"
- @change="onChange" @focus="onFocus" @click="onClick" @click-prefix="onClickPrefix"
- @click-suffix="onClickSuffix">
+ @on-change="onChange" @on-focus="onFocus" @on-click="onClick" @on-click-prefix="onClickPrefix"
+ @on-click-suffix="onClickSuffix">
</OIFormItem>
- </template>
+ </view>
</uni-forms>
</template>
<script>
import OIFormItem from './list/index.vue'
- import OIFormLayout from './list/layout/index.vue'
export default {
name: "OIForm",
components: {
OIFormItem,
- OIFormLayout
},
props: {
form: {
@@ -43,11 +48,12 @@
},
data() {
return {
-
+ largeMode: getApp().globalData?.largeMode || false,
}
},
methods: {
setFormItemVisible(attrs) {
+ console.log(attrs)
attrs.forEach((attr) => {
let index = this.hiddenIds.findIndex((id) => id == attr.attr);
if (attr.show) {
@@ -56,6 +62,7 @@
if (index == -1) this.hiddenIds.push(attr.attr);
}
});
+ console.log(this.hiddenIds)
},
clearFormValues() {
if (!this.form.model) return;
@@ -73,27 +80,29 @@
onChange(item) {
var attr = item.fieldId;
this.form.model[attr] = item.value;
- this.$emit("change", item)
+ this.$emit("on-change", item)
},
+
onClick(item) {
- this.$emit("click", item)
+ this.$emit("on-click", item)
},
onFocus(item) {
- this.$emit("focus", item)
+ this.$emit("on-focus", item)
},
onClickPrefix(item) {
- this.$emit("click-prefix", item)
+ this.$emit("on-click-prefix", item)
},
onClickSuffix(item) {
- this.$emit("click-suffix", item)
+ this.$emit("on-click-suffix", item)
},
- }
+ },
};
</script>
<style lang="less">
.oi-form {
-
-
+
}
+
+
</style>
\ No newline at end of file
--
Gitblit v1.9.1