From 90e4076a8adf5dac4384f10d9ce22398580eaf34 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期三, 09 七月 2025 17:27:06 +0800 Subject: [PATCH] 5601列表页面中的内容变化处理,自定义表单的set_dlg_attr_show --- components/oi-form/index.vue | 48 ++++++++++++++++++++++++++++-------------------- 1 files changed, 28 insertions(+), 20 deletions(-) diff --git a/components/oi-form/index.vue b/components/oi-form/index.vue index fd8bbc0..a288a41 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,28 @@ 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