From b515fae43490ab20977d559e19d4e5f63a4fd96d Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期五, 25 四月 2025 16:42:39 +0800
Subject: [PATCH] 应急线索模块
---
components/form/index.wxml | 153 ++++++++++++++++++++++++++++++--------------------
1 files changed, 92 insertions(+), 61 deletions(-)
diff --git a/components/form/index.wxml b/components/form/index.wxml
index aa1c372..7073cb5 100644
--- a/components/form/index.wxml
+++ b/components/form/index.wxml
@@ -1,67 +1,98 @@
<block wx:for="{{formArray}}" wx:key="index">
- <block wx:if="{{item.inputType == 'text'}}">
- <t-input
- label="{{item.label}}"
- placeholder="{{item.placeholder}}"
- value="{{item.value}}"
- data-index="{{index}}"
- bind:change="onInputChange"
- />
- </block>
- <block wx:elif="{{item.inputType == 'switch'}}">
- <t-cell title="{{item.label}}">
- <t-switch
- label="{{['鏄�', '鍚�']}}"
- slot="note"
+ <block wx:if="{{!item.hide}}">
+ <block wx:if="{{item.inputType == 'text'}}">
+ <t-input
+ label="{{item.label}}"
+ placeholder="{{item.placeholder}}"
+ value="{{item.value}}"
data-index="{{index}}"
- bind:change="onSwitchChange"
+ bind:change="onInputChange"
/>
- </t-cell>
- </block>
- <block wx:elif="{{item.inputType == 'picker'}}">
- <t-cell
- title="{{item.label}}"
- arrow
- hover
- note="{{item.value.label || item.placeholder}}"
- data-index="{{index}}"
- bind:click="showPicker"
- ></t-cell>
- <t-picker
- visible="{{item.visible}}"
- value="{{item._value}}"
- data-index="{{index}}"
- title="{{'閫夋嫨' + item.label}}"
- cancelBtn="鍙栨秷"
- confirmBtn="纭"
- bindchange="onPickerChange"
- bindcancel="onPickerCancel"
- >
- <t-picker-item options="{{item.options}}"></t-picker-item>
- </t-picker>
- </block>
- <block wx:elif="{{item.inputType == 'cascader'}}">
- <t-cell
- title="{{item.label}}"
- arrow
- hover
- note="{{item.note || item.placeholder}}"
- data-index="{{index}}"
- bind:click="showCascader"
- ></t-cell>
- <t-cascader
- visible="{{item.visible}}"
- value="{{item._value}}"
- options="{{item.options}}"
- sub-titles="{{item.cascaderTitles}}"
- title="{{'閫夋嫨' + item.label}}"
- data-index="{{index}}"
- bind:change="onCascaderChange"
- />
+ </block>
+ <block wx:elif="{{item.inputType == 'textarea'}}">
+ <t-textarea
+ label="{{item.label}}"
+ model:value="{{item.value}}"
+ bordered
+ autofocus
+ autosize
+ confirm-type="next"
+ data-index="{{index}}"
+ placeholder="{{item.placeholder}}"
+ bind:change="onInputChange"
+ ></t-textarea>
+ </block>
+ <block wx:elif="{{item.inputType == 'switch'}}">
+ <t-cell title="{{item.label}}">
+ <t-switch
+ defaultValue="{{item.value}}"
+ label="{{['鏄�', '鍚�']}}"
+ slot="note"
+ data-index="{{index}}"
+ bind:change="onSwitchChange"
+ />
+ </t-cell>
+ </block>
+ <block wx:elif="{{item.inputType == 'picker'}}">
+ <t-cell
+ title="{{item.label}}"
+ arrow
+ hover
+ note="{{item._label || item.placeholder}}"
+ data-index="{{index}}"
+ bind:click="showPicker"
+ ></t-cell>
+ <t-picker
+ visible="{{item.visible}}"
+ value="{{item._value}}"
+ data-index="{{index}}"
+ title="{{'閫夋嫨' + item.label}}"
+ cancelBtn="鍙栨秷"
+ confirmBtn="纭"
+ bindchange="onPickerChange"
+ bindcancel="onPickerCancel"
+ >
+ <t-picker-item options="{{item.options}}"></t-picker-item>
+ </t-picker>
+ </block>
+ <block wx:elif="{{item.inputType == 'cascader'}}">
+ <t-cell
+ title="{{item.label}}"
+ arrow
+ hover
+ note="{{item.note || item.placeholder}}"
+ data-index="{{index}}"
+ bind:click="showCascader"
+ ></t-cell>
+ <t-cascader
+ visible="{{item.visible}}"
+ value="{{item._value}}"
+ options="{{item.options}}"
+ sub-titles="{{item.cascaderTitles}}"
+ title="{{'閫夋嫨' + item.label}}"
+ data-index="{{index}}"
+ bind:change="onCascaderChange"
+ />
+ </block>
+ <block wx:if="{{validated && item.required && !item.value}}">
+ <view class="tips">{{item.tips}}</view>
+ </block>
</block>
</block>
-
-<view class="btn-group">
- <t-button block theme="light" content="鍙栨秷" size="small" bind:tap="onCancel"></t-button>
- <t-button block theme="primary" content="淇濆瓨" size="small" bind:tap="onSubmit"></t-button>
+<slot></slot>
+<view wx:if="editable" class="btn-group">
+ <t-button
+ block
+ theme="light"
+ content="{{cancelText}}"
+ size="small"
+ bind:tap="onCancel"
+ ></t-button>
+ <t-button
+ block
+ theme="primary"
+ content="{{submitText}}"
+ size="small"
+ bind:tap="onSubmit"
+ ></t-button>
</view>
--
Gitblit v1.9.3