@zscreate/zhxy-app-component 1.0.73 → 1.0.76

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.
@@ -1,1475 +1,1504 @@
1
1
  <template>
2
- <view class="form-item"
3
- :class="{showFalse: showFalse, isScroll: isScroll, isCorrected: widget.options.isCorrected ? true : false}"
4
- @click="resetShowFalse">
5
- <view v-if="widget.options.isCorrected" class="correctedWrap">
6
- 原值是: {{ widget.options.oldValue }}
7
- </view>
8
- <view class="editCorrent"
9
- v-if="isCorrect && correntArray.includes(widget.type) && (widget.options.canCorrect !== false || widget.options.canCorrect === undefined)"
10
- @click="CorrentItem">
11
- <!-- ===undefined兼容老版本表单 -->
12
- <img src="./modules/edit.png" alt="">
13
- </view>
14
- <slot></slot>
15
-
16
- <view v-if="widget.type ==='custom'" class="evan-form-item-container" :class="'evan-form-item-container--' + labelPosition"
2
+ <view class="form-item"
3
+ :class="{showFalse: showFalse, isScroll: isScroll, isCorrected: widget.options.isCorrected ? true : false}"
4
+ @click="resetShowFalse">
5
+ <view v-if="widget.options.isCorrected" class="correctedWrap">
6
+ 原值是: {{ widget.options.oldValue }}
7
+ </view>
8
+ <view class="editCorrent"
9
+ v-if="isCorrect && correntArray.includes(widget.type) && (widget.options.canCorrect !== false || widget.options.canCorrect === undefined)"
10
+ @click="CorrentItem">
11
+ <!-- ===undefined兼容老版本表单 -->
12
+ <img src="./modules/edit.png" alt="">
13
+ </view>
14
+ <slot></slot>
15
+
16
+ <view v-if="widget.type ==='custom'" class="evan-form-item-container"
17
+ :class="'evan-form-item-container--' + labelPosition"
17
18
  :style="{borderWidth:border?'1upx':0}">
18
19
  <view class="evan-form-item-container__label"
19
20
  :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
20
- {{widget.name}}
21
+ {{ widget.name }}
21
22
  </view>
22
23
  <view class="evan-form-item-container__main" :style="mContentStyle">
23
24
  <slot name="custom"></slot>
24
25
  </view>
25
26
  </view>
26
- <!-- input -->
27
- <view v-if="widget.type ==='input'" class="evan-form-item-container" :class="'evan-form-item-container--' + labelPosition"
28
- :style="{borderWidth:border?'1upx':0}">
29
- <view class="evan-form-item-container__label"
30
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
31
- {{widget.name}}
32
- </view>
33
- <view class="evan-form-item-container__main" :style="mContentStyle">
34
- <input class="form-input" placeholder-class="form-input-placeholder" v-model="dataModel"
35
- :placeholder="widget.options.placeholder" :disabled="widget.options.disabled" />
36
- </view>
37
- </view>
38
-
39
- <!-- uploadModel -->
40
- <view v-else-if="widget.type ==='uploadModel'" class="evan-form-item-container"
41
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
42
- <view class="evan-form-item-container__label"
43
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
44
- {{widget.name}}
45
- </view>
46
- <view class="evan-form-item-container__main evan-form-item-container__textarea" :style="mContentStyle">
47
- <view @click.prevent="downLoadFile(item)" style="margin-right: 20px;color: #007AFF;"
48
- v-for="(item, index) in widget.options.defaultValue" :key="index"
49
- :class="{disabledClick: widget.options.disabled}">
50
- {{ item.name }}
51
- </view>
52
- <view v-if="widget.options.defaultValue.length === 0">暂无模板</view>
53
- </view>
54
- </view>
55
-
56
- <!-- textarea -->
57
- <view v-else-if="widget.type ==='textarea'" class="evan-form-item-container"
58
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
59
- <view class="evan-form-item-container__label"
60
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
61
- {{widget.name}}
62
- </view>
63
- <view class="evan-form-item-container__main evan-form-item-container__textarea" :style="mContentStyle">
27
+ <!-- input -->
28
+ <view v-if="widget.type ==='input'" class="evan-form-item-container"
29
+ :class="'evan-form-item-container--' + labelPosition"
30
+ :style="{borderWidth:border?'1upx':0}">
31
+ <view class="evan-form-item-container__label"
32
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
33
+ {{ widget.name }}
34
+ </view>
35
+ <view class="evan-form-item-container__main" :style="mContentStyle">
36
+ <input class="form-input" placeholder-class="form-input-placeholder" v-model="dataModel"
37
+ :placeholder="widget.options.placeholder" :disabled="widget.options.disabled"/>
38
+ </view>
39
+ </view>
40
+
41
+ <!-- uploadModel -->
42
+ <view v-else-if="widget.type ==='uploadModel'" class="evan-form-item-container"
43
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
44
+ <view class="evan-form-item-container__label"
45
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
46
+ {{ widget.name }}
47
+ </view>
48
+ <view class="evan-form-item-container__main evan-form-item-container__textarea" :style="mContentStyle">
49
+ <view @click.prevent="downLoadFile(item)" style="margin-right: 20px;color: #007AFF;"
50
+ v-for="(item, index) in widget.options.defaultValue" :key="index"
51
+ :class="{disabledClick: widget.options.disabled}">
52
+ {{ item.name }}
53
+ </view>
54
+ <view v-if="widget.options.defaultValue.length === 0">暂无模板</view>
55
+ </view>
56
+ </view>
57
+
58
+ <!-- textarea -->
59
+ <view v-else-if="widget.type ==='textarea'" class="evan-form-item-container"
60
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
61
+ <view class="evan-form-item-container__label"
62
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
63
+ {{ widget.name }}
64
+ </view>
65
+ <view class="evan-form-item-container__main evan-form-item-container__textarea" :style="mContentStyle">
64
66
  <textarea maxlength="300" class="form-input cover-text" v-model="dataModel"
65
- placeholder-style="line-height:60rpx" placeholder-class="form-input-placeholder"
66
- :placeholder="widget.options.placeholder" :disabled="widget.options.disabled">
67
+ placeholder-style="line-height:60rpx" placeholder-class="form-input-placeholder"
68
+ :placeholder="widget.options.placeholder" :disabled="widget.options.disabled">
67
69
  </textarea>
68
- </view>
69
- </view>
70
-
71
- <!-- rate -->
72
- <view v-else-if="widget.type ==='rate'" class="evan-form-item-container"
73
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
74
- <view class="evan-form-item-container__label"
75
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
76
- {{widget.name}}
77
- </view>
78
- <view class="evan-form-item-container__main" :style="mContentStyle">
79
- <uni-rate allow-half :min="widget.options.min ? widget.options.min : 0" size="18"
80
- :max="widget.options.max ? widget.options.max : 1000000" :value="dataModel" @change="changeRate"
81
- :disabled="widget.options.disabled">
82
- </uni-rate>
83
- <view class="u_close" v-if="!widget.options.disabled" @click="dataModel = 0">
84
- <u-icon name="close-circle" color="#999999" size="38"></u-icon>
85
- </view>
86
- </view>
87
- </view>
88
-
89
- <!-- radio -->
90
- <view v-else-if="widget.type ==='radio'" :class="'evan-form-item-container--' + labelPosition"
91
- :style="{borderWidth:border?'1upx':0}">
92
- <view class="radio-height evan-form-item-container__label"
93
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}"
94
- style="padding-left: 30rpx;" :style="mLabelStyle">{{widget.name}}</view>
95
- <view class="evan-form-item-container__main" :style="mContentStyle" style="padding: 0;">
96
- <view class="uni-list">
97
- <radio-group @change="radioChange" :disabled="widget.options.disabled">
98
- <!-- @change="radioChange" -->
99
- <label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in checkboxAndRadioOptions"
100
- :key="item.value">
101
- <view>
102
- <radio :value="item.value" :disabled="widget.options.disabled" :checked="item.checked"
103
- color="#007AFF" />
104
- </view>
105
- <view>{{item.label}}</view>
106
- </label>
107
- </radio-group>
108
- </view>
109
- </view>
110
- </view>
111
-
112
- <!-- switch -->
113
- <view v-else-if="widget.type ==='switch'" class="evan-form-item-container"
114
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
115
- <view class="evan-form-item-container__label"
116
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
117
- {{widget.name}}
118
- </view>
119
- <view class="evan-form-item-container__main" :style="mContentStyle">
70
+ </view>
71
+ </view>
72
+
73
+ <!-- rate -->
74
+ <view v-else-if="widget.type ==='rate'" class="evan-form-item-container"
75
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
76
+ <view class="evan-form-item-container__label"
77
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
78
+ {{ widget.name }}
79
+ </view>
80
+ <view class="evan-form-item-container__main" :style="mContentStyle">
81
+ <uni-rate allow-half :min="widget.options.min ? widget.options.min : 0" size="18"
82
+ :max="widget.options.max ? widget.options.max : 1000000" :value="dataModel" @change="changeRate"
83
+ :disabled="widget.options.disabled">
84
+ </uni-rate>
85
+ <view class="u_close" v-if="!widget.options.disabled" @click="dataModel = 0">
86
+ <u-icon name="close-circle" color="#999999" size="38"></u-icon>
87
+ </view>
88
+ </view>
89
+ </view>
90
+
91
+ <!-- radio -->
92
+ <view v-else-if="widget.type ==='radio'" :class="'evan-form-item-container--' + labelPosition"
93
+ :style="{borderWidth:border?'1upx':0}">
94
+ <view class="radio-height evan-form-item-container__label"
95
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}"
96
+ style="padding-left: 30rpx;" :style="mLabelStyle">{{ widget.name }}
97
+ </view>
98
+ <view class="evan-form-item-container__main" :style="mContentStyle" style="padding: 0;">
99
+ <view class="uni-list">
100
+ <radio-group @change="radioChange" :disabled="widget.options.disabled">
101
+ <!-- @change="radioChange" -->
102
+ <label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in checkboxAndRadioOptions"
103
+ :key="item.value">
104
+ <view>
105
+ <radio :value="item.value" :disabled="widget.options.disabled" :checked="item.checked"
106
+ color="#007AFF"/>
107
+ </view>
108
+ <view>{{ item.label }}</view>
109
+ </label>
110
+ </radio-group>
111
+ </view>
112
+ </view>
113
+ </view>
114
+
115
+ <!-- switch -->
116
+ <view v-else-if="widget.type ==='switch'" class="evan-form-item-container"
117
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
118
+ <view class="evan-form-item-container__label"
119
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
120
+ {{ widget.name }}
121
+ </view>
122
+ <view class="evan-form-item-container__main" :style="mContentStyle">
120
123
  <switch :checked="Boolean(dataModel)" @change="switch1Change" color="#007AFF" style="transform: scale(0.8,0.8)"
121
- :disabled="widget.options.disabled" />
122
- </view>
123
- </view>
124
-
125
- <!-- slider -->
126
- <view v-else-if="widget.type ==='slider'" class="evan-form-item-container"
127
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
128
- <view class="evan-form-item-container__label"
129
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
130
- {{widget.name}}
131
- </view>
132
- <view class="evan-form-item-container__main" :style="mContentStyle" style="padding: 0;">
133
- <slider style="width: 100%;" :value="dataModel" :show-value="true" @change="sliderChange"
134
- activeColor="#007AFF" backgroundColor="#E4E7ED" block-size="20"
135
- :disabled="widget.options.disabled" />
136
- </view>
137
- </view>
138
-
139
- <!-- checkbox -->
140
- <view v-else-if="widget.type ==='checkbox'" @click.native="isClickByUser = true"
141
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
142
- <view class="radio-height evan-form-item-container__label"
143
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}"
144
- style="padding-left: 30rpx;" :style="mLabelStyle">{{widget.name}}</view>
145
- <view class="evan-form-item-container__main" :style="mContentStyle" style="padding: 0;">
146
- <view class="uni-list">
147
- <checkbox-group @change="checkboxChange" :disabled="widget.options.disabled">
148
- <label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in checkboxAndRadioOptions"
149
- :key="item.value">
150
- <view>
151
- <label>
152
- <checkbox :value="item.value" :disabled="widget.options.disabled"
153
- :checked="item.checked" color="#007AFF" style="transform: scale(0.8,0.8);" />
154
- <text></text>
155
- </label>
156
- </view>
157
- <view>{{item.label ? item.label : item.value}}</view>
158
- </label>
159
- </checkbox-group>
160
- </view>
161
- </view>
162
- </view>
163
-
164
- <!-- date -->
165
- <view v-else-if="widget.type ==='date'" class="evan-form-item-container"
166
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
167
- <view class="evan-form-item-container__label"
168
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
169
- {{widget.name}}
170
- </view>
171
- <view class="evan-form-item-container__main" :style="mContentStyle">
172
- <view style="width: 100%;">
173
- <!-- <xp-picker
174
- :year-range="[1996, 2040]"
175
- style="width: 100%;"
176
- :ref="widget.model"
177
- :mode="getMode(widget.options.format)"
178
- @confirm="changeTime"
179
- @cancel="cancel"
180
- /> -->
181
-
182
- <view class="evan-form-item-container__main--body">
183
- <uni-datetime-picker @change="dateChange" @click.native="isClickByUser = true"
184
- :type="widget.options.type" :format="widget.options.format"
185
- :clearIcon="widget.options.clearable" v-model="dataModel" @maskClick="maskClick"
186
- :border="false" :disabled="widget.options.disabled">
187
- <view class="option-font-size">
188
- {{dataModel | filterDataModel(widget)}}
189
- </view>
190
- </uni-datetime-picker>
191
- </view>
192
- </view>
193
- <!-- <view class="option-font-size" @tap="showTime(widget.model)">
194
- {{dataModel ? dataModel : widget.options.placeholder?widget.options.placeholder: '请选择'}}
195
- </view>
196
- <view class="u_close" v-if="widget.options.clearable && dataModel && !widget.options.disabled"
197
- @click="handleClose">
198
- <u-icon name="close-circle" color="#999999" size="38"></u-icon>
199
- </view> -->
200
- </view>
201
- </view>
202
-
203
- <!-- time -->
204
- <view v-else-if="widget.type ==='time'" class="evan-form-item-container"
205
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
206
- <view class="evan-form-item-container__label"
207
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
208
- {{widget.name}}
209
- </view>
210
- <view class="evan-form-item-container__main" :style="mContentStyle">
211
- <!-- <picker class="" mode="time" style="width: 100%;" :value="dataModel" @change="changedate" @cancel="cancel"
212
- :disabled="widget.options.disabled">
213
- <view class="option-font-size">{{dataModel ? dataModel : widget.options.placeholder?widget.options.placeholder: '请选择'}}</view>
214
- </picker> -->
215
- <view>
216
- <xp-picker :ref="widget.model" :mode="getMode(widget.options.format)" @confirm="changeTime"
217
- @cancel="cancel" />
218
- </view>
219
- <view class="option-font-size" @tap="showTime(widget.model,0)">
220
- {{showTimeStr(dataModel,0) ? showTimeStr(dataModel, 0) : widget.options.placeholder ? widget.options.placeholder :'请选择'}}
221
- </view>
222
- <view class="option-time-icon" v-if="widget.options.isRange">
223
- ~
224
- </view>
225
- <view v-if="widget.options.isRange" class="option-font-size" @tap="showTime(widget.model,1)">
226
- {{showTimeStr(dataModel,1) ? showTimeStr(dataModel, 1) : widget.options.placeholder ? widget.options.placeholder :'请选择'}}
227
- </view>
228
- <view class="u_close" v-if="widget.options.clearable && getTime(dataModel) && !widget.options.disabled"
229
- @click="handleClose">
230
- <u-icon name="close-circle" color="#999999" size="38"></u-icon>
231
- </view>
232
- </view>
233
- </view>
234
-
235
- <!-- color -->
236
- <view v-else-if="widget.type ==='color'" class="evan-form-item-container"
237
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
238
- <view class="evan-form-item-container__label"
239
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
240
- {{widget.name}}
241
- </view>
242
- <view class="evan-form-item-container__main" :style="mContentStyle">
243
- <tColorPicker ref="colorPicker" @confirm="confirm" :disabled="widget.options.disabled"></tColorPicker>
244
- <view class="opencolor" @click="open" :style="{background: dataModel}"></view>
245
- </view>
246
- </view>
247
-
248
- <!-- imgupload -->
249
- <view v-else-if="widget.type ==='imgupload'" class="evan-form-item-container"
250
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
251
- <view class="evan-form-item-container__label"
252
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
253
- {{widget.name}}
254
- </view>
255
- <view class="evan-form-item-container__main" :style="mContentStyle">
256
- <unploadFile :widget="widget" @imgUrlPost="imgUrlPost" :defaultImg="dataModel"></unploadFile>
257
- </view>
258
- </view>
259
-
260
- <!-- fileupload -->
261
- <view v-else-if="widget.type ==='fileupload'" class="evan-form-item-container"
262
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
263
- <view class="evan-form-item-container__label"
264
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
265
- {{widget.name}}
266
- </view>
267
- <view class="evan-form-item-container__main" :style="mContentStyle">
268
- <l-file :url="actionUrl + widget.options.action" :disabled="widget.options.disabled"
269
- @filePost="filePost" @fileDelete="fileDelete" :defaultFile="dataModel" :widget="widget.options">
270
- </l-file>
271
- </view>
272
- </view>
273
-
274
- <!-- editor -->
275
- <!-- <view v-else-if="widget.type ==='editor'" class="evan-form-item-container"
276
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
277
- <view class="evan-form-item-container__label"
278
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
279
- {{widget.name}}
280
- </view>
281
- <view class="evan-form-item-container__main" :style="mContentStyle">
282
- <jinEdit @editOk="editOk" :disabled="widget.options.disabled" :html="dataModel"></jinEdit>
283
- </view>
284
- </view> -->
285
-
286
-
287
-
288
- <!-- cascader -->
289
- <view v-else-if="widget.type ==='cascader'" class="evan-form-item-container"
290
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
291
- <view class="evan-form-item-container__label"
292
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
293
- {{widget.name}}
294
- </view>
295
- <view class="evan-form-item-container__main" :style="mContentStyle">
296
- <lb-picker ref="picker" v-model="dataModel" @change="cityChecked" :value="widget.options.defaultValue"
297
- :disabled="widget.options.disabled">
298
- </lb-picker>
299
- </view>
300
- </view>
301
-
302
- <!-- number -->
303
- <view v-else-if="widget.type ==='number'" class="evan-form-item-container"
304
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
305
- <view class="evan-form-item-container__label"
306
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
307
- {{widget.name}}
308
- </view>
309
- <view class="evan-form-item-container__main" :style="mContentStyle">
310
- <u-number-box v-model="dataModel" @numberBoxClick="numberBoxClick"
311
- :step="widget.options.step ? widget.options.step:1"
312
- :min="widget.options.min ? widget.options.min : 0"
313
- :max="widget.options.max ? widget.options.max : 100000000" :disabled="widget.options.disabled">
314
- </u-number-box>
315
- </view>
316
- </view>
317
-
318
- <!-- codeControl -->
319
- <view v-else-if="widget.type ==='codeControl'" class="evan-form-item-container"
320
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
321
- <view class="evan-form-item-container__label"
322
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
323
- {{widget.name}}
324
- </view>
325
- <view class="evan-form-item-container__main" :style="mContentStyle">
326
- <view>{{widget.key}}</view>
327
- </view>
328
- </view>
329
-
330
- <!-- superLink -->
331
- <view v-else-if="widget.type ==='superLink'" class="evan-form-item-container"
332
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
333
- <view class="evan-form-item-container__label"
334
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
335
- {{widget.name}}
336
- </view>
337
- <view class="evan-form-item-container__main" :style="mContentStyle">
338
- <uni-link :href="widget.options.defaultValue" :text="widget.options.title"
339
- :disabled="widget.options.disabled">
340
- </uni-link>
341
- </view>
342
- </view>
343
-
344
- <!-- placeholder -->
345
- <view v-else-if="widget.type ==='placeholder'" class="evan-form-item-container"
346
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
347
- <view class="evan-form-item-container__label"
348
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
349
- {{widget.name}}
350
- </view>
351
- <!-- <view class="evan-form-item-container__main" :style="mContentStyle">
352
- <view>{{widget.options.placeholder}}</view>
353
- </view> -->
354
- </view>
355
-
356
- <!-- hidden -->
357
- <view v-else-if="widget.type ==='hidden'"></view>
358
-
359
- <!-- signature-write -->
360
- <view v-else-if="widget.type ==='signature-write'" class="evan-form-item-container"
361
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
362
- <view class="evan-form-item-container__label"
363
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
364
- {{widget.name}}
365
- </view>
366
- <view class="evan-form-item-container__main" :style="mContentStyle">
367
- <view style="float: left;">
368
- <button v-show="!widget.options.disabled" size="mini" type="primary" @click="signatrueFlag = true"
369
- style="white-space: nowrap;">签名</button>
370
- </view>
371
- <image v-if="dataModel || signatrueImage" :src="dataModel ? dataModel : signatrueImage"
372
- style="width:640rpx;height:174rpx;"></image>
373
- <!-- 签名弹框 -->
374
- <view v-if="signatrueFlag" class="signatrue-view" @click="signatrueFlag = false">
375
- <view class="signatrue-box">
376
- <signatrue-write @getBase64="getBase64" style="width: 100%;height: 100%;"></signatrue-write>
377
- </view>
378
- </view>
379
- </view>
380
- </view>
381
-
382
- <!-- select -->
383
- <view v-else-if="widget.type ==='select'" class="evan-form-item-container"
384
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
385
- <view class="evan-form-item-container__label"
386
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
387
- {{widget.name}}
388
- </view>
389
- <view class="evan-form-item-container__main" :style="mContentStyle"
390
- @click="handleSeclet(widget.options.multiple)">
391
- <div class="option-font-size">{{dataModelShow ? dataModelShow : widget.options.placeholder }}</div>
392
- </view>
393
- <!-- <icon type="clear" size="14" v-if="widget.options.canView" />-->
394
- </view>
395
-
396
- <!-- userSelector -->
397
- <view v-else-if="widget.type ==='userSelector'" @click.native="isClickByUser = true"
398
- class="evan-form-item-container" :class="'evan-form-item-container--' + labelPosition"
399
- :style="{borderWidth:border?'1upx':0}">
400
- <view class="evan-form-item-container__label"
401
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
402
- {{widget.name}}
403
- </view>
404
- <view class="evan-form-item-container__main" :style="mContentStyle"
405
- @click.stop="selectUser(widget.options.multiple)">
406
- <!-- <input class="form-input" placeholder-class="form-input-placeholder" v-model="dataModelShow"
407
- :placeholder="widget.options.placeholder" :disabled="widget.options.disabled" /> -->
408
- <view class="form-input">{{dataModelShow?dataModelShow:widget.options.placeholder}}</view>
409
- </view>
410
- </view>
411
-
412
- <!-- deptSelector -->
413
- <view v-else-if="widget.type ==='deptSelector'" class="evan-form-item-container"
414
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
415
- <view class="evan-form-item-container__label"
416
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
417
- {{widget.name}}
418
- </view>
419
- <view class="evan-form-item-container__main" :style="mContentStyle"
420
- @click.stop="selectdept(widget.options.multiple)">
421
- <!-- <input class="form-input" placeholder-class="form-input-placeholder" v-model="dataModelShow"
422
- :placeholder="widget.options.placeholder" :disabled="widget.options.disabled"
423
- :departvalue="widget.options.defaultValue" /> -->
424
- <view class="form-input">{{dataModelShow?dataModelShow:widget.options.placeholder}}</view>
425
- </view>
426
- </view>
427
-
428
- <!-- relateSub -->
429
- <view v-else-if="widget.type ==='relateSub'" class="evan-form-item-container"
430
- :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
431
- <view class="evan-form-item-container__label"
432
- :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
433
- {{widget.name}}
434
- </view>
435
- <view class="evan-form-item-container__main" :style="mContentStyle" @click="relateSub(widget.options)">
436
- <view class="form-input" placeholder-class="form-input-placeholder">
437
- {{dataModelShow?dataModelShow:widget.options.placeholder}}
438
- </view>
439
- </view>
440
- </view>
441
- <view class="error-message" v-if="showFalse">{{showFalseMsg}}</view>
442
- </view>
124
+ :disabled="widget.options.disabled"/>
125
+ </view>
126
+ </view>
127
+
128
+ <!-- slider -->
129
+ <view v-else-if="widget.type ==='slider'" class="evan-form-item-container"
130
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
131
+ <view class="evan-form-item-container__label"
132
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
133
+ {{ widget.name }}
134
+ </view>
135
+ <view class="evan-form-item-container__main" :style="mContentStyle" style="padding: 0;">
136
+ <slider style="width: 100%;" :value="dataModel" :show-value="true" @change="sliderChange"
137
+ activeColor="#007AFF" backgroundColor="#E4E7ED" block-size="20"
138
+ :disabled="widget.options.disabled"/>
139
+ </view>
140
+ </view>
141
+
142
+ <!-- checkbox -->
143
+ <view v-else-if="widget.type ==='checkbox'" @click.native="isClickByUser = true"
144
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
145
+ <view class="radio-height evan-form-item-container__label"
146
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}"
147
+ style="padding-left: 30rpx;" :style="mLabelStyle">{{ widget.name }}
148
+ </view>
149
+ <view class="evan-form-item-container__main" :style="mContentStyle" style="padding: 0;">
150
+ <view class="uni-list">
151
+ <checkbox-group @change="checkboxChange" :disabled="widget.options.disabled">
152
+ <label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in checkboxAndRadioOptions"
153
+ :key="item.value">
154
+ <view>
155
+ <label>
156
+ <checkbox :value="item.value" :disabled="widget.options.disabled"
157
+ :checked="item.checked" color="#007AFF" style="transform: scale(0.8,0.8);"/>
158
+ <text></text>
159
+ </label>
160
+ </view>
161
+ <view>{{ item.label ? item.label : item.value }}</view>
162
+ </label>
163
+ </checkbox-group>
164
+ </view>
165
+ </view>
166
+ </view>
167
+
168
+ <!-- date -->
169
+ <view v-else-if="widget.type ==='date'" class="evan-form-item-container"
170
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
171
+ <view class="evan-form-item-container__label"
172
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
173
+ {{ widget.name }}
174
+ </view>
175
+ <view class="evan-form-item-container__main" :style="mContentStyle">
176
+ <view style="width: 100%;">
177
+ <!-- <xp-picker
178
+ :year-range="[1996, 2040]"
179
+ style="width: 100%;"
180
+ :ref="widget.model"
181
+ :mode="getMode(widget.options.format)"
182
+ @confirm="changeTime"
183
+ @cancel="cancel"
184
+ /> -->
185
+
186
+ <view class="evan-form-item-container__main--body">
187
+ <uni-datetime-picker @change="dateChange" @click.native="isClickByUser = true"
188
+ :type="widget.options.type" :format="widget.options.format"
189
+ :clearIcon="widget.options.clearable" v-model="dataModel" @maskClick="maskClick"
190
+ :border="false" :disabled="widget.options.disabled">
191
+ <view class="option-font-size">
192
+ {{ dataModel | filterDataModel(widget) }}
193
+ </view>
194
+ </uni-datetime-picker>
195
+ </view>
196
+ </view>
197
+ <!-- <view class="option-font-size" @tap="showTime(widget.model)">
198
+ {{dataModel ? dataModel : widget.options.placeholder?widget.options.placeholder: '请选择'}}
199
+ </view>
200
+ <view class="u_close" v-if="widget.options.clearable && dataModel && !widget.options.disabled"
201
+ @click="handleClose">
202
+ <u-icon name="close-circle" color="#999999" size="38"></u-icon>
203
+ </view> -->
204
+ </view>
205
+ </view>
206
+
207
+ <!-- time -->
208
+ <view v-else-if="widget.type ==='time'" class="evan-form-item-container"
209
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
210
+ <view class="evan-form-item-container__label"
211
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
212
+ {{ widget.name }}
213
+ </view>
214
+ <view class="evan-form-item-container__main" :style="mContentStyle">
215
+ <!-- <picker class="" mode="time" style="width: 100%;" :value="dataModel" @change="changedate" @cancel="cancel"
216
+ :disabled="widget.options.disabled">
217
+ <view class="option-font-size">{{dataModel ? dataModel : widget.options.placeholder?widget.options.placeholder: '请选择'}}</view>
218
+ </picker> -->
219
+ <view>
220
+ <xp-picker :ref="widget.model" :mode="getMode(widget.options.format)" @confirm="changeTime"
221
+ @cancel="cancel"/>
222
+ </view>
223
+ <view class="option-font-size" @tap="showTime(widget.model,0)">
224
+ {{
225
+ showTimeStr(dataModel, 0) ? showTimeStr(dataModel, 0) : widget.options.placeholder ? widget.options.placeholder : '请选择'
226
+ }}
227
+ </view>
228
+ <view class="option-time-icon" v-if="widget.options.isRange">
229
+ ~
230
+ </view>
231
+ <view v-if="widget.options.isRange" class="option-font-size" @tap="showTime(widget.model,1)">
232
+ {{
233
+ showTimeStr(dataModel, 1) ? showTimeStr(dataModel, 1) : widget.options.placeholder ? widget.options.placeholder : '请选择'
234
+ }}
235
+ </view>
236
+ <view class="u_close" v-if="widget.options.clearable && getTime(dataModel) && !widget.options.disabled"
237
+ @click="handleClose">
238
+ <u-icon name="close-circle" color="#999999" size="38"></u-icon>
239
+ </view>
240
+ </view>
241
+ </view>
242
+
243
+ <!-- color -->
244
+ <view v-else-if="widget.type ==='color'" class="evan-form-item-container"
245
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
246
+ <view class="evan-form-item-container__label"
247
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
248
+ {{ widget.name }}
249
+ </view>
250
+ <view class="evan-form-item-container__main" :style="mContentStyle">
251
+ <tColorPicker ref="colorPicker" @confirm="confirm" :disabled="widget.options.disabled"></tColorPicker>
252
+ <view class="opencolor" @click="open" :style="{background: dataModel}"></view>
253
+ </view>
254
+ </view>
255
+
256
+ <!-- imgupload -->
257
+ <view v-else-if="widget.type ==='imgupload'" class="evan-form-item-container"
258
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
259
+ <view class="evan-form-item-container__label"
260
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
261
+ {{ widget.name }}
262
+ </view>
263
+ <view class="evan-form-item-container__main" :style="mContentStyle">
264
+ <unploadFile :widget="widget" @imgUrlPost="imgUrlPost" :defaultImg="dataModel"></unploadFile>
265
+ </view>
266
+ </view>
267
+
268
+ <!-- fileupload -->
269
+ <view v-else-if="widget.type ==='fileupload'" class="evan-form-item-container"
270
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
271
+ <view class="evan-form-item-container__label"
272
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
273
+ {{ widget.name }}
274
+ </view>
275
+ <view class="evan-form-item-container__main" :style="mContentStyle">
276
+ <l-file :url="actionUrl + widget.options.action" :disabled="widget.options.disabled"
277
+ @filePost="filePost" @fileDelete="fileDelete" :defaultFile="dataModel" :widget="widget.options">
278
+ </l-file>
279
+ </view>
280
+ </view>
281
+
282
+ <!-- editor -->
283
+ <!-- <view v-else-if="widget.type ==='editor'" class="evan-form-item-container"
284
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
285
+ <view class="evan-form-item-container__label"
286
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
287
+ {{widget.name}}
288
+ </view>
289
+ <view class="evan-form-item-container__main" :style="mContentStyle">
290
+ <jinEdit @editOk="editOk" :disabled="widget.options.disabled" :html="dataModel"></jinEdit>
291
+ </view>
292
+ </view> -->
293
+
294
+
295
+ <!-- cascader -->
296
+ <view v-else-if="widget.type ==='cascader'" class="evan-form-item-container"
297
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
298
+ <view class="evan-form-item-container__label"
299
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
300
+ {{ widget.name }}
301
+ </view>
302
+ <view class="evan-form-item-container__main" :style="mContentStyle">
303
+ <lb-picker ref="picker" v-model="dataModel" @change="cityChecked" :value="widget.options.defaultValue"
304
+ :disabled="widget.options.disabled">
305
+ </lb-picker>
306
+ </view>
307
+ </view>
308
+
309
+ <!-- number -->
310
+ <view v-else-if="widget.type ==='number'" class="evan-form-item-container"
311
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
312
+ <view class="evan-form-item-container__label"
313
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
314
+ {{ widget.name }}
315
+ </view>
316
+ <view class="evan-form-item-container__main" :style="mContentStyle">
317
+ <u-number-box v-model="dataModel" @numberBoxClick="numberBoxClick"
318
+ :step="widget.options.step ? widget.options.step:1"
319
+ :min="widget.options.min ? widget.options.min : 0"
320
+ :max="widget.options.max ? widget.options.max : 100000000" :disabled="widget.options.disabled">
321
+ </u-number-box>
322
+ </view>
323
+ </view>
324
+
325
+ <!-- codeControl -->
326
+ <view v-else-if="widget.type ==='codeControl'" class="evan-form-item-container"
327
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
328
+ <view class="evan-form-item-container__label"
329
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
330
+ {{ widget.name }}
331
+ </view>
332
+ <view class="evan-form-item-container__main" :style="mContentStyle">
333
+ <view>{{ widget.key }}</view>
334
+ </view>
335
+ </view>
336
+
337
+ <!-- superLink -->
338
+ <view v-else-if="widget.type ==='superLink'" class="evan-form-item-container"
339
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
340
+ <view class="evan-form-item-container__label"
341
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
342
+ {{ widget.name }}
343
+ </view>
344
+ <view class="evan-form-item-container__main" :style="mContentStyle">
345
+ <uni-link :href="widget.options.defaultValue" :text="widget.options.title"
346
+ :disabled="widget.options.disabled">
347
+ </uni-link>
348
+ </view>
349
+ </view>
350
+
351
+ <!-- placeholder -->
352
+ <view v-else-if="widget.type ==='placeholder'" class="evan-form-item-container"
353
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
354
+ <view class="evan-form-item-container__label"
355
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
356
+ {{ widget.name }}
357
+ </view>
358
+ <!-- <view class="evan-form-item-container__main" :style="mContentStyle">
359
+ <view>{{widget.options.placeholder}}</view>
360
+ </view> -->
361
+ </view>
362
+
363
+ <!-- hidden -->
364
+ <view v-else-if="widget.type ==='hidden'"></view>
365
+
366
+ <!-- signature-write -->
367
+ <view v-else-if="widget.type ==='signature-write'" class="evan-form-item-container"
368
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
369
+ <view class="evan-form-item-container__label"
370
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
371
+ {{ widget.name }}
372
+ </view>
373
+ <view class="evan-form-item-container__main" :style="mContentStyle">
374
+ <view style="float: left;">
375
+ <button v-show="!widget.options.disabled" size="mini" type="primary" @click="signatrueFlag = true"
376
+ style="white-space: nowrap;">签名
377
+ </button>
378
+ </view>
379
+ <image v-if="dataModel || signatrueImage" :src="dataModel ? dataModel : signatrueImage"
380
+ style="width:640rpx;height:174rpx;"></image>
381
+ <!-- 签名弹框 -->
382
+ <view v-if="signatrueFlag" class="signatrue-view" @click="signatrueFlag = false">
383
+ <view class="signatrue-box">
384
+ <signatrue-write @getBase64="getBase64" style="width: 100%;height: 100%;"></signatrue-write>
385
+ </view>
386
+ </view>
387
+ </view>
388
+ </view>
389
+
390
+ <!-- select -->
391
+ <view v-else-if="widget.type ==='select'" class="evan-form-item-container"
392
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
393
+ <view class="evan-form-item-container__label"
394
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
395
+ {{ widget.name }}
396
+ </view>
397
+ <view class="evan-form-item-container__main" :style="mContentStyle"
398
+ @click="handleSeclet(widget.options.multiple)">
399
+ <div class="option-font-size">{{ dataModelShow ? dataModelShow : widget.options.placeholder }}</div>
400
+ </view>
401
+ <!-- <icon type="clear" size="14" v-if="widget.options.canView" />-->
402
+ </view>
403
+
404
+ <!-- userSelector -->
405
+ <view v-else-if="widget.type ==='userSelector'" @click.native="isClickByUser = true"
406
+ class="evan-form-item-container" :class="'evan-form-item-container--' + labelPosition"
407
+ :style="{borderWidth:border?'1upx':0}">
408
+ <view class="evan-form-item-container__label"
409
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
410
+ {{ widget.name }}
411
+ </view>
412
+ <view class="evan-form-item-container__main" :style="mContentStyle"
413
+ @click.stop="selectUser(widget.options.multiple)">
414
+ <!-- <input class="form-input" placeholder-class="form-input-placeholder" v-model="dataModelShow"
415
+ :placeholder="widget.options.placeholder" :disabled="widget.options.disabled" /> -->
416
+ <view class="form-input">{{ dataModelShow ? dataModelShow : widget.options.placeholder }}</view>
417
+ </view>
418
+ </view>
419
+
420
+ <!-- deptSelector -->
421
+ <view v-else-if="widget.type ==='deptSelector'" class="evan-form-item-container"
422
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
423
+ <view class="evan-form-item-container__label"
424
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
425
+ {{ widget.name }}
426
+ </view>
427
+ <view class="evan-form-item-container__main" :style="mContentStyle"
428
+ @click.stop="selectdept(widget.options.multiple)">
429
+ <!-- <input class="form-input" placeholder-class="form-input-placeholder" v-model="dataModelShow"
430
+ :placeholder="widget.options.placeholder" :disabled="widget.options.disabled"
431
+ :departvalue="widget.options.defaultValue" /> -->
432
+ <view class="form-input">{{ dataModelShow ? dataModelShow : widget.options.placeholder }}</view>
433
+ </view>
434
+ </view>
435
+
436
+ <!-- relateSub -->
437
+ <view v-else-if="widget.type ==='relateSub'" class="evan-form-item-container"
438
+ :class="'evan-form-item-container--' + labelPosition" :style="{borderWidth:border?'1upx':0}">
439
+ <view class="evan-form-item-container__label"
440
+ :class="{showAsteriskRect:hasRequiredAsterisk,isRequired:showRequiredAsterisk}" :style="mLabelStyle">
441
+ {{ widget.name }}
442
+ </view>
443
+ <view class="evan-form-item-container__main" :style="mContentStyle" @click="relateSub(widget.options)">
444
+ <view class="form-input" placeholder-class="form-input-placeholder">
445
+ {{ dataModelShow ? dataModelShow : widget.options.placeholder }}
446
+ </view>
447
+ </view>
448
+ </view>
449
+ <view class="error-message" v-if="showFalse">{{ showFalseMsg }}</view>
450
+ </view>
443
451
  </template>
444
452
 
445
453
  <script>
446
- import moment from "../../utils/moment.js";
447
- import uniDatetimePicker from '../../components/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
448
- // import utils from './utils.js'
449
- import tColorPicker from '../../components/t-color-picker/t-color-picker.vue'
450
- import unploadFile from '../../components/uploadFile/uploadFile.vue'
451
- import lFile from '../../components/l-file/l-file.vue'
452
- import jinEdit from '../../components/jin-edit/jin-edit.vue';
453
- import LbPicker from '../../components/lb-picker/index.vue';
454
- import MyPicker from '../../components/dying318-picker/Pickers.vue';
455
- import UniRate from '../../components/uni-rate/uni-rate.vue';
456
- import Pubsub from 'pubsub-js'
457
- import {
458
- computedMixin
459
- } from './mixins/computedMixin'
460
- import {
461
- validateFormMixin
462
- } from './mixins/validateFormMixin'
463
- import {
464
- pubSubMixin
465
- } from './mixins/pubSubMixin'
466
- import {
467
- valueChangeMixin
468
- } from './mixins/valueChangeMixin'
469
- import {
470
- getMode
471
- } from './utilForForm'
472
- export default {
473
- mixins: [computedMixin, validateFormMixin, pubSubMixin, valueChangeMixin],
474
- components: {
475
- UniRate,
476
- tColorPicker,
477
- unploadFile,
478
- lFile,
479
- LbPicker,
480
- MyPicker,
481
- jinEdit,
482
- uniDatetimePicker
483
- },
484
- name: 'EvanFormItem',
485
- props: {
486
- linkage: Object,
487
- formId: String,
488
- itemkey: [Number, String],
489
- models: [Object],
490
- isCorrect: [Number, String, null],
491
- widget: Object,
492
- labelStyle: Object,
493
- rules: [Object, Array],
494
- label: String,
495
- contentStyle: {
496
- type: Object,
497
- default: () => {
498
- return {}
499
- }
500
- },
501
- isApply: {
502
- type: [Boolean, undefined],
503
- default: false,
504
- },
505
- isDraft: {
506
- type: [Boolean, undefined],
507
- default: false
508
- },
509
- prop: String,
510
- tableKey: String,
511
- tableIndex: Number,
512
- model: Object,
513
- border: {
514
- type: Boolean,
515
- default: true
516
- },
517
- labelPosition: {
518
- validator: function(value) {
519
- if (!value) {
520
- return true
521
- }
522
- return ['top', 'left'].indexOf(value) !== -1
523
- },
524
- default: 'top'
525
- }
526
- },
527
- filters: {
528
- filterDataModel(dataModel, widget) {
529
- if (dataModel) {
530
- if (Array.isArray(dataModel)) {
531
- if (dataModel.length > 0) {
532
- return dataModel.join(' ~ ')
533
- }
534
- return '请选择'
535
- }
536
- if (widget.type === 'date' && widget.options.format) {
537
- return moment(dataModel).format(widget.options.format)
454
+ import moment from "../../utils/moment.js";
455
+ import uniDatetimePicker
456
+ from '../../components/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
457
+ // import utils from './utils.js'
458
+ import tColorPicker from '../../components/t-color-picker/t-color-picker.vue'
459
+ import unploadFile from '../../components/uploadFile/uploadFile.vue'
460
+ import lFile from '../../components/l-file/l-file.vue'
461
+ import jinEdit from '../../components/jin-edit/jin-edit.vue';
462
+ import LbPicker from '../../components/lb-picker/index.vue';
463
+ import MyPicker from '../../components/dying318-picker/Pickers.vue';
464
+ import UniRate from '../../components/uni-rate/uni-rate.vue';
465
+ import Pubsub from 'pubsub-js'
466
+ import {
467
+ computedMixin
468
+ } from './mixins/computedMixin'
469
+ import {
470
+ validateFormMixin
471
+ } from './mixins/validateFormMixin'
472
+ import {
473
+ pubSubMixin
474
+ } from './mixins/pubSubMixin'
475
+ import {
476
+ valueChangeMixin
477
+ } from './mixins/valueChangeMixin'
478
+ import {
479
+ getMode
480
+ } from './utilForForm'
481
+
482
+ export default {
483
+ mixins: [computedMixin, validateFormMixin, pubSubMixin, valueChangeMixin],
484
+ components: {
485
+ UniRate,
486
+ tColorPicker,
487
+ unploadFile,
488
+ lFile,
489
+ LbPicker,
490
+ MyPicker,
491
+ jinEdit,
492
+ uniDatetimePicker
493
+ },
494
+ name: 'EvanFormItem',
495
+ props: {
496
+ linkage: Object,
497
+ formId: String,
498
+ itemkey: [Number, String],
499
+ models: [Object],
500
+ isCorrect: [Number, String, null],
501
+ widget: Object,
502
+ labelStyle: Object,
503
+ rules: [Object, Array],
504
+ label: String,
505
+ contentStyle: {
506
+ type: Object,
507
+ default: () => {
508
+ return {}
509
+ }
510
+ },
511
+ isApply: {
512
+ type: [Boolean, undefined],
513
+ default: false,
514
+ },
515
+ isDraft: {
516
+ type: [Boolean, undefined],
517
+ default: false
518
+ },
519
+ prop: String,
520
+ tableKey: String,
521
+ tableIndex: Number,
522
+ model: Object,
523
+ border: {
524
+ type: Boolean,
525
+ default: true
526
+ },
527
+ labelPosition: {
528
+ validator: function (value) {
529
+ if (!value) {
530
+ return true
531
+ }
532
+ return ['top', 'left'].indexOf(value) !== -1
533
+ },
534
+ default: 'top'
535
+ }
536
+ },
537
+ filters: {
538
+ filterDataModel(dataModel, widget) {
539
+ if (dataModel) {
540
+ if (Array.isArray(dataModel)) {
541
+ if (dataModel.length > 0) {
542
+ return dataModel.join(' ~ ')
543
+ }
544
+ return '请选择'
545
+ }
546
+ if (widget.type === 'date' && widget.options.format) {
547
+ return moment(dataModel).format(widget.options.format)
548
+ }
549
+ return dataModel
550
+ }
551
+ if (widget.options.placeholder) {
552
+ return widget.options.placeholder
553
+ }
554
+ if (widget.options.endPlaceholder) {
555
+ return widget.options.endPlaceholder[0]
556
+ }
557
+ return '请选择'
558
+ }
559
+ },
560
+ data() {
561
+ return {
562
+ isClickByUser: false, //是否用户点击
563
+ single: null,
564
+ showFalse: false,
565
+ showFalseMsg: '',
566
+ signatrueFlag: false,
567
+ signatrueImage: '',
568
+ dataModel: '',
569
+ // firstValidateField: true,//第一次校验
570
+ isScroll: false,
571
+ dataModelShow: '',
572
+ actionUrl: this.uniEnv.uploadUrl,
573
+ correntArray: ['input', 'textarea'],
574
+ checkboxAndRadioOptions: [],
575
+ selectedData: []
576
+ }
577
+ },
578
+ mounted() {
579
+ },
580
+ created() {
581
+ this.updateDataModel();
582
+ this.pubsubScribe();
583
+ this.showFormData(); //非 v-model值回显
584
+ //下拉框联动的时候重新选择清空联动的数据
585
+ if (this.widget.type == 'select') {
586
+ uni.$on(this.widget.model, item => {
587
+ this.dataModel = ''
588
+ this.dataModelShow = ''
589
+ });
590
+ }
591
+ },
592
+ // 时间检验
593
+ beforeMount() {
594
+ let widget = this.widget;
595
+ let model = widget.model;
596
+ if (!widget.options) return
597
+ // 时间比较增加校验规则
598
+ if (widget.options.condition && widget.options.conditionValue) {
599
+ let model = widget.model;
600
+ let rule = {
601
+ validator: this.validateTime,
602
+ trigger: ['date', 'time'].includes(this.widget.type) ? 'change' : "blur",
603
+ }
604
+ let rules = this.tableKey ? this.rules[this.tableKey] : this.rules;
605
+ rules[model].isvalidator ? '' : rules[model].push(rule) && (rules[model].isvalidator = true)
606
+ }
607
+ if (widget.options.onlyvalue && widget.options.onlyvalue === true) {
608
+ let rule = {
609
+ validator: this.validateonly,
610
+ trigger: ['date', 'time'].includes(widget.type) ? 'change' : "blur",
611
+ }
612
+ let tableKey = this.tableKey
613
+ if (tableKey) {
614
+ //防止重复添加 (可优化)
615
+ if (this.rules[tableKey][model].isonlyvalue)
616
+ return false;
617
+ this.rules[tableKey][model].push(rule);
618
+ this.rules[tableKey][model].isonlyvalue = true;
619
+ } else {
620
+ if (this.rules[model].isonlyvalue)
621
+ return false;
622
+ this.rules[model].push(rule);
623
+ this.rules[model].isonlyvalue = true;
624
+ }
625
+ }
626
+ },
627
+ destroyed() {
628
+ if (this.pubsubSign) {
629
+ console.log("销毁")
630
+ Pubsub.unsubscribe(this.pubsubSign);
631
+ }
632
+ uni.$off(this.widget.model);
633
+ },
634
+ methods: {
635
+ //文件删除
636
+ fileDelete(idx) {
637
+ this.dataModel.splice(idx, 1)
638
+ },
639
+ //切换时间
640
+ dateChange(val) {
641
+ if (this.tableKey) {
642
+ this.models[this.tableKey][this.tableIndex][this.widget.model] = val;
643
+ } else {
644
+ this.models[this.widget.model] = val;
645
+ }
646
+ let rule = this.rules[this.widget.model]
647
+ if (rule.length > 0) {
648
+ this.validateInit()
649
+ }
650
+ },
651
+ //时间比较
652
+ validateTime(rule, value, callback) {
653
+ let options = this.widget.options
654
+ let time = this.tableKey ?
655
+ this.models[this.tableKey][this.tableIndex][options.conditionValue] : this.models[options
656
+ .conditionValue]
657
+ if (!value || !time) {
658
+ callback()
659
+ }
660
+ if (options.condition == '小于') {
661
+ if (moment(value).unix() < moment(time).unix()) {
662
+ callback()
663
+ } else {
664
+ callback("开始时间必须小于结束时间");
665
+ }
666
+ } else {
667
+ if (moment(value).unix() > moment(time).unix()) {
668
+ callback()
669
+ } else {
670
+ callback("开始时间必须小于结束时间");
671
+ }
672
+ }
673
+ },
674
+ //唯一值校验
675
+ validateonly(rule, value, callback) {
676
+ if (value) {
677
+ let params = {
678
+ formId: this.formId,
679
+ model: this.widget.model,
680
+ value: this.models,
681
+ };
682
+ // if (typeof(this.formDataId) == 'object' && this.formDataId.id) {
683
+ // params.formDataId = this.formDataId.id
684
+ // } else if (typeof(this.formDataId) == 'string') {
685
+ // params.formDataId = this.formDataId
686
+ // } else {
687
+ // params.formDataId = ''
688
+ // }
689
+ this.$u.get(this.widget.options.onlyurl, params).then((res) => {
690
+ if (res.result) {
691
+ callback(res.message);
692
+ } else {
693
+ callback();
694
+ }
695
+ });
696
+ } else {
697
+ callback();
698
+ }
699
+ },
700
+ maskClick(e) {
701
+ this.isClickByUser = true;
702
+ },
703
+ getMode,
704
+ showTimeStr(dataModel, index) {
705
+ if (this.widget.options.isRange) { // 时间段
706
+ return dataModel && dataModel[index] ? dataModel[index] : false
707
+ } else {
708
+ return dataModel && JSON.stringify(dataModel) != "[]" ? dataModel : false
709
+ }
710
+ },
711
+ //处理时间类型是数组还是字符串
712
+ getTime(datamodal) {
713
+ if (typeof (datamodal) == 'object') {
714
+ if (datamodal.length > 0) {
715
+ return true
716
+ } else {
717
+ return false
718
+ }
719
+ } else {
720
+ return datamodal
721
+ }
722
+ },
723
+ showTime(picker, index) {
724
+ if (!picker || this.widget.options.disabled) return;
725
+ this.$refs[picker].show(index);
726
+ },
727
+ //时间 日期清除
728
+ handleClose() {
729
+ if (this.widget.options.isRange) {
730
+ this.dataModel = []
731
+ } else {
732
+ this.dataModel = ''
733
+ }
734
+ },
735
+ //关联表单根据展示字段展示
736
+ showLabels(values) {
737
+ if (values.length == 0 || !this.widget.options.labels) return false;
738
+ let labels = this.widget.options.labels.split(",");
739
+ let labelsStr = "";
740
+ let splitSign = labels.length > 0 ? "/" : "";
741
+ values.forEach((item) => {
742
+ let _labelStr = "";
743
+ labels.forEach((i) => {
744
+ _labelStr += splitSign + item[i];
745
+ });
746
+ if (splitSign) {
747
+ _labelStr = _labelStr.substring(1);
748
+ }
749
+ labelsStr += "," + _labelStr;
750
+ });
751
+ this.dataModelShow = labelsStr.substring(1);
752
+ },
753
+ // 关联表单
754
+ relateSub(widget) {
755
+ if (this.widget.options.disabled) return;
756
+ let params = {
757
+ SQL: widget.SQL,
758
+ columnName: widget.columnName,
759
+ columnCode: widget.columnCode,
760
+ apiUrl: widget.apiUrl
761
+ }
762
+ var PubsubSign = String(Math.random()).split('.')[1];
763
+ Pubsub.subscribe(PubsubSign, (msg, data) => {
764
+ this.isClickByUser = true;
765
+ this.showLabels(data)
766
+ this.dataModel = data;
767
+ // console.log('发布')
768
+ // this.pulishMsg(data,true);//true代表用户点击
769
+ })
770
+ uni.navigateTo({
771
+ url: '/pages/picker/relateSub?params=' + JSON.stringify(params) + '&sign=' + PubsubSign +
772
+ '&selectedData=' + JSON.stringify(this.dataModel ? this.dataModel : [])
773
+ });
774
+
775
+ },
776
+ //rate value chage
777
+ showFormData() {
778
+ if (this.widget.type === 'userSelector' || this.widget.type == 'relateSub') {
779
+ this.updateUserSelectorModal()
780
+ }
781
+ if (this.widget.type === 'deptSelector') {
782
+ this.updatedeptSelectorModal()
783
+ }
784
+ if (this.widget.type === 'select' || this.widget.type == 'radio' || this.widget.type == 'checkbox') {
785
+ this.updatedSelectModal()
786
+ }
787
+ if (this.widget.type === 'relateSub') {
788
+ this.showLabels(this.dataModel)
789
+ }
790
+ },
791
+
792
+ updateRadioOrCheckboxModel(arr) {
793
+ if (!arr) return;
794
+ this.checkboxAndRadioOptions = JSON.parse(JSON.stringify(arr));
795
+ if (!this.dataModel) return false;
796
+ this.checkboxAndRadioOptions.forEach(item => {
797
+ if (this.dataModel.includes(item.value)) {
798
+ this.$set(item, 'checked', true)
799
+ } else {
800
+ this.$set(item, 'checked', false)
801
+ }
802
+ })
803
+ // console.log('this.checkboxAndRadioOptions', this.checkboxAndRadioOptions)
804
+ },
805
+
806
+ downLoadFile(path) {
807
+ // console.log(process.uniEnv.uploadUrl)
808
+ // console.log(path)
809
+ // #ifdef H5
810
+ window.open(this.uniEnv.imgUrl + path.url)
811
+ return
812
+ // #endif
813
+ uni.downloadFile({
814
+ // url: this.downLoadUrl + path, //下载地址接口返回
815
+ url: this.uniEnv.imgUrl + path.url,
816
+ filePath: wx.env.USER_DATA_PATH + "/" + path.name,
817
+ success: (data) => {
818
+ if (data.statusCode === 200) {
819
+ //文件保存到本地
820
+ uni.openDocument({
821
+ filePath: data.filePath,
822
+ showMenu: true,
823
+ success: function (res) {
824
+ // console.log('打开文档成功');
825
+ },
826
+ fail(res) {
827
+ console.log(res)
828
+ uni.showToast({
829
+ icon: 'none',
830
+ mask: true,
831
+ title: '下载失败',
832
+ duration: 3000,
833
+ });
834
+ },
835
+ });
836
+ // uni.saveFile({
837
+ // tempFilePath: data.tempFilePath, //临时路径
838
+ // success: function(res) {
839
+ // uni.showToast({
840
+ // icon: 'none',
841
+ // mask: true,
842
+ // title: '文件已保存:' + res.savedFilePath, //保存路径
843
+ // duration: 3000,
844
+ // });
845
+ // setTimeout(() => {
846
+ // //打开文档查看
847
+ // uni.openDocument({
848
+ // filePath: res.savedFilePath,
849
+ // success: function(res) {
850
+ // // console.log('打开文档成功');
851
+ // },
852
+ // complete: function(res) {}
853
+ // });
854
+ // }, 3000)
855
+ // }
856
+ // });
857
+ }
858
+ },
859
+ complete: function (res) {
860
+ // console.log(res)
861
+ }
862
+ })
863
+ },
864
+
865
+ /**纠错**/
866
+ CorrentItem() {
867
+ getApp().globalData.correntFormData
868
+ getApp().globalData.correntWidget = {
869
+ ...this.widget,
870
+ dataModel: this.dataModel
871
+ }
872
+ uni.navigateTo({
873
+ url: '/pagesA/Correction/Correction'
874
+ });
875
+
876
+ },
877
+ /****更新*userSelector**/
878
+ updateUserSelectorModal() {
879
+ if (!this.dataModel || !Array.isArray(this.dataModel) || this.dataModel.length == 0) return;
880
+ var str = '';
881
+ //是否展示详情信息
882
+ if (this.widget.options.showfield) {
883
+ this.dataModel.forEach(item => {
884
+ // str += ',' + item.realname + (item.departname,item.phone);
885
+ str +=
886
+ `,${item.realname || item.username || ""} (${item.departname ? item.departname : ""}${item.departName ? item.departName : ""}${item.phone ? "," + item.phone : ""})`
887
+ })
888
+ } else {
889
+ this.dataModel.forEach(item => {
890
+ str += ',' + (item.realname || item.username);
891
+ })
892
+ }
893
+ this.dataModelShow = str.substr(1);
894
+ },
895
+ updatedeptSelectorModal() {
896
+ if (!this.dataModel || !(Object.prototype.toString.call(this.dataModel) === '[object Array]') || this
897
+ .dataModel.length ==
898
+ 0) return;
899
+ var str = '';
900
+ this.dataModel.forEach(item => {
901
+ str += ',' + item.departName;
902
+ })
903
+ this.dataModelShow = str.substr(1);
904
+ },
905
+ updatedSelectModal() {
906
+ let options = this.widget.options
907
+ if (this.widget.options.dictCode || this.widget.options.dictName) {
908
+ //根据字典Code, 初始化字典数组
909
+ this.$u.get(
910
+ `/sys/dict/getDictItems/${this.widget.options.dictCode ? this.widget.options.dictCode : this.widget.options.dictName}`,
911
+ ).then(res => {
912
+ if (res.success) {
913
+ if (this.widget.type == 'select') {
914
+ this.arrFindOptionLabel(res.result)
915
+ } else if (this.widget.type == 'radio' || this.widget.type == 'checkbox') {
916
+ this.updateRadioOrCheckboxModel(this.arrFindDictOrTable(res.result, 'dictCode'))
917
+ }
918
+ }
919
+ })
920
+ } else if (this.widget.options.dictTable) {
921
+ let params = {
922
+ tableName: this.widget.options.dictTable
923
+ };
924
+ this.$u.get(`/form/formdesiger/getDataCenterDict`, params).then(res => {
925
+ if (res.success) {
926
+ if (this.widget.type == 'select') {
927
+ this.arrFindOptionLabel(res.result)
928
+ } else if (this.widget.type == 'radio' || this.widget.type == 'checkbox') {
929
+ this.updateRadioOrCheckboxModel(this.arrFindDictOrTable(res.result, 'dictTable'))
930
+ }
931
+ }
932
+ })
933
+ } else if (this.widget.options.dictUrl) {
934
+ console.log(this.linkage)
935
+ //判断下拉框是否是被联动 linkage是整个表单下拉框联动的合集
936
+ if (this.linkage != null && this.linkage.hasOwnProperty(this.widget.model)) {
937
+ let params = {
938
+ id: this.linkage[this.widget.model]
939
+ }
940
+ this.getSelectUrl(options.dictUrl, params)
941
+ } else if (options.dictUrl.indexOf("?") != -1) {
942
+ let list = options.dictUrl.split("?");
943
+ let url = list[0];
944
+ let params = this.getparams(list[1])
945
+ this.getSelectUrl(url, params)
946
+ } else {
947
+ this.getSelectUrl(options.dictUrl)
948
+ }
949
+ } else {
950
+ if (this.widget.type == 'select') {
951
+ this.arrFindOptionLabel(this.widget.options.options)
952
+ } else if (this.widget.type == 'radio' || this.widget.type == 'checkbox') {
953
+ this.updateRadioOrCheckboxModel(this.widget.options.options)
954
+ }
955
+
956
+ }
957
+ },
958
+ //处理下拉框接口地址数据
959
+ getSelectUrl(url, params) {
960
+ this.$u.get(url, params).then(res => {
961
+ if (res.success) {
962
+ if (this.widget.type == 'select') {
963
+ let arr = res.result
964
+ if (!Array.isArray(arr)) return;
965
+ for (let i = 0; i < arr.length; i++) {
966
+ if (arr[i].dataKey == this.dataModel) {
967
+ this.dataModelShow = arr[i].dataValue
968
+ return
969
+ }
970
+ }
971
+ } else if (this.widget.type == 'radio' || this.widget.type == 'checkbox') {
972
+ this.updateRadioOrCheckboxModel(this.arrFindDictOrTable(res.result, 'dictTable'))
973
+ }
974
+ }
975
+ })
976
+ },
977
+ //截取参数
978
+ getparams(url) {
979
+ let obj = {};
980
+ let strs = url.split("&");
981
+ for (var i = 0; i < strs.length; i++) {
982
+ obj[strs[i].split("=")[0]] = strs[i].split("=")[1];
983
+ }
984
+ return obj;
985
+ },
986
+ //checkbox radio dictTable And dictCode ====> options
987
+ arrFindDictOrTable(arr, type) {
988
+ var newArr = []
989
+ if (type == 'dictTable') {
990
+ newArr = arr.map(item => {
991
+ return {
992
+ value: item.dictValue,
993
+ label: item.dictLabel
538
994
  }
539
- return dataModel
540
- }
541
- if (widget.options.placeholder) {
542
- return widget.options.placeholder
543
- }
544
- if (widget.options.endPlaceholder) {
545
- return widget.options.endPlaceholder[0]
546
- }
547
- return '请选择'
548
- }
549
- },
550
- data() {
551
- return {
552
- isClickByUser: false, //是否用户点击
553
- single: null,
554
- showFalse: false,
555
- showFalseMsg: '',
556
- signatrueFlag: false,
557
- signatrueImage: '',
558
- dataModel: '',
559
- // firstValidateField: true,//第一次校验
560
- isScroll: false,
561
- dataModelShow: '',
562
- actionUrl: this.uniEnv.uploadUrl,
563
- correntArray: ['input', 'textarea'],
564
- checkboxAndRadioOptions: [],
565
- selectedData: []
566
- }
567
- },
568
- mounted() {},
569
- created() {
570
- this.updateDataModel();
571
- this.pubsubScribe();
572
- this.showFormData(); //非 v-model值回显
573
- //下拉框联动的时候重新选择清空联动的数据
574
- if (this.widget.type == 'select') {
575
- uni.$on(this.widget.model, item => {
576
- this.dataModel = ''
577
- this.dataModelShow = ''
578
- });
579
- }
580
- },
581
- // 时间检验
582
- beforeMount() {
583
- let widget = this.widget;
584
- let model = widget.model;
585
- if (!widget.options) return
586
- // 时间比较增加校验规则
587
- if (widget.options.condition && widget.options.conditionValue) {
588
- let model = widget.model;
589
- let rule = {
590
- validator: this.validateTime,
591
- trigger: ['date', 'time'].includes(this.widget.type) ? 'change' : "blur",
592
- }
593
- let rules = this.tableKey ? this.rules[this.tableKey] : this.rules;
594
- rules[model].isvalidator ? '' : rules[model].push(rule) && (rules[model].isvalidator = true)
595
- }
596
- if (widget.options.onlyvalue && widget.options.onlyvalue === true) {
597
- let rule = {
598
- validator: this.validateonly,
599
- trigger: ['date', 'time'].includes(widget.type) ? 'change' : "blur",
600
- }
601
- let tableKey = this.tableKey
602
- if (tableKey) {
603
- //防止重复添加 (可优化)
604
- if (this.rules[tableKey][model].isonlyvalue)
605
- return false;
606
- this.rules[tableKey][model].push(rule);
607
- this.rules[tableKey][model].isonlyvalue = true;
608
- } else {
609
- if (this.rules[model].isonlyvalue)
610
- return false;
611
- this.rules[model].push(rule);
612
- this.rules[model].isonlyvalue = true;
613
- }
614
- }
615
- },
616
- destroyed() {
617
- if (this.pubsubSign) {
618
- console.log("销毁")
619
- Pubsub.unsubscribe(this.pubsubSign);
620
- }
621
- uni.$off(this.widget.model);
622
- },
623
- methods: {
624
- //文件删除
625
- fileDelete(idx) {
626
- this.dataModel.splice(idx, 1)
627
- },
628
- //切换时间
629
- dateChange(val) {
630
- if (this.tableKey) {
631
- this.models[this.tableKey][this.tableIndex][this.widget.model] = val;
632
- } else {
633
- this.models[this.widget.model] = val;
634
- }
635
- let rule = this.rules[this.widget.model]
636
- if (rule.length > 0) {
637
- this.validateInit()
638
- }
639
- },
640
- //时间比较
641
- validateTime(rule, value, callback) {
642
- let options = this.widget.options
643
- let time = this.tableKey ?
644
- this.models[this.tableKey][this.tableIndex][options.conditionValue] : this.models[options
645
- .conditionValue]
646
- if (!value || !time) {
647
- callback()
648
- }
649
- if (options.condition == '小于') {
650
- if (moment(value).unix() < moment(time).unix()) {
651
- callback()
652
- } else {
653
- callback("开始时间必须小于结束时间");
654
- }
655
- } else {
656
- if (moment(value).unix() > moment(time).unix()) {
657
- callback()
658
- } else {
659
- callback("开始时间必须小于结束时间");
660
- }
661
- }
662
- },
663
- //唯一值校验
664
- validateonly(rule, value, callback) {
665
- if (value) {
666
- let params = {
667
- formId: this.formId,
668
- model: this.widget.model,
669
- value: this.models,
670
- };
671
- // if (typeof(this.formDataId) == 'object' && this.formDataId.id) {
672
- // params.formDataId = this.formDataId.id
673
- // } else if (typeof(this.formDataId) == 'string') {
674
- // params.formDataId = this.formDataId
675
- // } else {
676
- // params.formDataId = ''
677
- // }
678
- this.$u.get(this.widget.options.onlyurl, params).then((res) => {
679
- if (res.result) {
680
- callback(res.message);
681
- } else {
682
- callback();
683
- }
684
- });
685
- } else {
686
- callback();
687
- }
688
- },
689
- maskClick(e) {
690
- this.isClickByUser = true;
691
- },
692
- getMode,
693
- showTimeStr(dataModel, index) {
694
- if (this.widget.options.isRange) { // 时间段
695
- return dataModel && dataModel[index] ? dataModel[index] : false
696
- } else {
697
- return dataModel && JSON.stringify(dataModel) != "[]" ? dataModel : false
698
- }
699
- },
700
- //处理时间类型是数组还是字符串
701
- getTime(datamodal) {
702
- if (typeof(datamodal) == 'object') {
703
- if (datamodal.length > 0) {
704
- return true
705
- } else {
706
- return false
707
- }
708
- } else {
709
- return datamodal
710
- }
711
- },
712
- showTime(picker, index) {
713
- if (!picker || this.widget.options.disabled) return;
714
- this.$refs[picker].show(index);
715
- },
716
- //时间 日期清除
717
- handleClose() {
718
- if (this.widget.options.isRange) {
719
- this.dataModel = []
720
- } else {
721
- this.dataModel = ''
722
- }
723
- },
724
- //关联表单根据展示字段展示
725
- showLabels(values) {
726
- if (values.length == 0 || !this.widget.options.labels) return false;
727
- let labels = this.widget.options.labels.split(",");
728
- let labelsStr = "";
729
- let splitSign = labels.length > 0 ? "/" : "";
730
- values.forEach((item) => {
731
- let _labelStr = "";
732
- labels.forEach((i) => {
733
- _labelStr += splitSign + item[i];
734
- });
735
- if (splitSign) {
736
- _labelStr = _labelStr.substring(1);
737
- }
738
- labelsStr += "," + _labelStr;
739
- });
740
- this.dataModelShow = labelsStr.substring(1);
741
- },
742
- // 关联表单
743
- relateSub(widget) {
744
- if (this.widget.options.disabled) return;
745
- let params = {
746
- SQL: widget.SQL,
747
- columnName: widget.columnName,
748
- columnCode: widget.columnCode,
749
- apiUrl: widget.apiUrl
750
- }
751
- var PubsubSign = String(Math.random()).split('.')[1];
752
- Pubsub.subscribe(PubsubSign, (msg, data) => {
753
- this.isClickByUser = true;
754
- this.showLabels(data)
755
- this.dataModel = data;
756
- // console.log('发布')
757
- // this.pulishMsg(data,true);//true代表用户点击
758
- })
759
- uni.navigateTo({
760
- url: '/pages/picker/relateSub?params=' + JSON.stringify(params) + '&sign=' + PubsubSign +
761
- '&selectedData=' + JSON.stringify(this.dataModel ? this.dataModel : [])
762
- });
763
-
764
- },
765
- //rate value chage
766
- showFormData() {
767
- if (this.widget.type === 'userSelector' || this.widget.type == 'relateSub') {
768
- this.updateUserSelectorModal()
769
- }
770
- if (this.widget.type === 'deptSelector') {
771
- this.updatedeptSelectorModal()
772
- }
773
- if (this.widget.type === 'select' || this.widget.type == 'radio' || this.widget.type == 'checkbox') {
774
- this.updatedSelectModal()
775
- }
776
- if (this.widget.type === 'relateSub') {
777
- this.showLabels(this.dataModel)
778
- }
779
- },
780
-
781
- updateRadioOrCheckboxModel(arr) {
782
- if (!arr) return;
783
- this.checkboxAndRadioOptions = JSON.parse(JSON.stringify(arr));
784
- if (!this.dataModel) return false;
785
- this.checkboxAndRadioOptions.forEach(item => {
786
- if (this.dataModel.includes(item.value)) {
787
- this.$set(item, 'checked', true)
788
- } else {
789
- this.$set(item, 'checked', false)
790
- }
791
- })
792
- // console.log('this.checkboxAndRadioOptions', this.checkboxAndRadioOptions)
793
- },
794
-
795
- downLoadFile(path) {
796
- // console.log(process.uniEnv.uploadUrl)
797
- // console.log(path)
798
- // #ifdef H5
799
- window.open(this.uniEnv.imgUrl + path.url)
800
- return
801
- // #endif
802
- uni.downloadFile({
803
- // url: this.downLoadUrl + path, //下载地址接口返回
804
- url: this.uniEnv.imgUrl + path.url,
805
- filePath: wx.env.USER_DATA_PATH + "/" + path.name,
806
- success: (data) => {
807
- if (data.statusCode === 200) {
808
- //文件保存到本地
809
- uni.openDocument({
810
- filePath: data.filePath,
811
- showMenu: true,
812
- success: function(res) {
813
- // console.log('打开文档成功');
814
- },
815
- fail(res) {
816
- console.log(res)
817
- uni.showToast({
818
- icon: 'none',
819
- mask: true,
820
- title: '下载失败',
821
- duration: 3000,
822
- });
823
- },
824
- });
825
- // uni.saveFile({
826
- // tempFilePath: data.tempFilePath, //临时路径
827
- // success: function(res) {
828
- // uni.showToast({
829
- // icon: 'none',
830
- // mask: true,
831
- // title: '文件已保存:' + res.savedFilePath, //保存路径
832
- // duration: 3000,
833
- // });
834
- // setTimeout(() => {
835
- // //打开文档查看
836
- // uni.openDocument({
837
- // filePath: res.savedFilePath,
838
- // success: function(res) {
839
- // // console.log('打开文档成功');
840
- // },
841
- // complete: function(res) {}
842
- // });
843
- // }, 3000)
844
- // }
845
- // });
846
- }
847
- },
848
- complete: function(res) {
849
- // console.log(res)
850
- }
851
- })
852
- },
853
-
854
- /**纠错**/
855
- CorrentItem() {
856
- getApp().globalData.correntFormData
857
- getApp().globalData.correntWidget = {
858
- ...this.widget,
859
- dataModel: this.dataModel
860
- }
861
- uni.navigateTo({
862
- url: '/pagesA/Correction/Correction'
863
- });
864
-
865
- },
866
- /****更新*userSelector**/
867
- updateUserSelectorModal() {
868
- if (!this.dataModel || !Array.isArray(this.dataModel) || this.dataModel.length == 0) return;
869
- var str = '';
870
- //是否展示详情信息
871
- if (this.widget.options.showfield) {
872
- this.dataModel.forEach(item => {
873
- // str += ',' + item.realname + (item.departname,item.phone);
874
- str +=
875
- `,${item.realname || item.username || ""} (${item.departname ? item.departname : ""}${item.departName ? item.departName : ""}${item.phone ? ","+item.phone : ""})`
876
- })
877
- } else {
878
- this.dataModel.forEach(item => {
879
- str += ',' + (item.realname || item.username);
880
- })
881
- }
882
- this.dataModelShow = str.substr(1);
883
- },
884
- updatedeptSelectorModal() {
885
- if (!this.dataModel || !(Object.prototype.toString.call(this.dataModel) === '[object Array]') || this
886
- .dataModel.length ==
887
- 0) return;
888
- var str = '';
889
- this.dataModel.forEach(item => {
890
- str += ',' + item.departName;
891
- })
892
- this.dataModelShow = str.substr(1);
893
- },
894
- updatedSelectModal() {
895
- let options = this.widget.options
896
- if (this.widget.options.dictCode || this.widget.options.dictName) {
897
- //根据字典Code, 初始化字典数组
898
- this.$u.get(
899
- `/sys/dict/getDictItems/${this.widget.options.dictCode ? this.widget.options.dictCode : this.widget.options.dictName}`,
900
- ).then(res => {
901
- if (res.success) {
902
- if (this.widget.type == 'select') {
903
- this.arrFindOptionLabel(res.result)
904
- } else if (this.widget.type == 'radio' || this.widget.type == 'checkbox') {
905
- this.updateRadioOrCheckboxModel(this.arrFindDictOrTable(res.result, 'dictCode'))
906
- }
907
- }
908
- })
909
- } else if (this.widget.options.dictTable) {
910
- let params = {
911
- tableName: this.widget.options.dictTable
912
- };
913
- this.$u.get(`/form/formdesiger/getDataCenterDict`, params).then(res => {
914
- if (res.success) {
915
- if (this.widget.type == 'select') {
916
- this.arrFindOptionLabel(res.result)
917
- } else if (this.widget.type == 'radio' || this.widget.type == 'checkbox') {
918
- this.updateRadioOrCheckboxModel(this.arrFindDictOrTable(res.result, 'dictTable'))
919
- }
920
- }
921
- })
922
- } else if (this.widget.options.dictUrl) {
923
- console.log(this.linkage)
924
- //判断下拉框是否是被联动 linkage是整个表单下拉框联动的合集
925
- if (this.linkage != null && this.linkage.hasOwnProperty(this.widget.model)) {
926
- let params = {
927
- id: this.linkage[this.widget.model]
928
- }
929
- this.getSelectUrl(options.dictUrl, params)
930
- } else if (options.dictUrl.indexOf("?") != -1) {
931
- let list = options.dictUrl.split("?");
932
- let url = list[0];
933
- let params = this.getparams(list[1])
934
- this.getSelectUrl(url, params)
935
- } else {
936
- this.getSelectUrl(options.dictUrl)
937
- }
938
- } else {
939
- if (this.widget.type == 'select') {
940
- this.arrFindOptionLabel(this.widget.options.options)
941
- } else if (this.widget.type == 'radio' || this.widget.type == 'checkbox') {
942
- this.updateRadioOrCheckboxModel(this.widget.options.options)
943
- }
944
-
945
- }
946
- },
947
- //处理下拉框接口地址数据
948
- getSelectUrl(url, params) {
949
- this.$u.get(url, params).then(res => {
950
- if (res.success) {
951
- if (this.widget.type == 'select') {
952
- let arr = res.result
953
- if (!Array.isArray(arr)) return;
954
- for (let i = 0; i < arr.length; i++) {
955
- if (arr[i].dataKey == this.dataModel) {
956
- this.dataModelShow = arr[i].dataValue
957
- return
958
- }
959
- }
960
- } else if (this.widget.type == 'radio' || this.widget.type == 'checkbox') {
961
- this.updateRadioOrCheckboxModel(this.arrFindDictOrTable(res.result, 'dictTable'))
962
- }
963
- }
964
- })
965
- },
966
- //截取参数
967
- getparams(url) {
968
- let obj = {};
969
- let strs = url.split("&");
970
- for (var i = 0; i < strs.length; i++) {
971
- obj[strs[i].split("=")[0]] = strs[i].split("=")[1];
972
- }
973
- return obj;
974
- },
975
- //checkbox radio dictTable And dictCode ====> options
976
- arrFindDictOrTable(arr, type) {
977
- var newArr = []
978
- if (type == 'dictTable') {
979
- newArr = arr.map(item => {
980
- return {
981
- value: item.dictValue,
982
- label: item.dictLabel
983
- }
984
- })
985
- } else {
986
- newArr = arr.map(item => {
987
- return {
988
- value: item.value,
989
- label: item.text
990
- }
991
- })
992
- }
993
- // console.log(newArr)
994
- return newArr;
995
- },
996
- arrFindOptionLabel(arr) {
997
- if (!Array.isArray(arr)) return false;
998
- let that = this;
999
- arr.forEach(item => {
1000
- if (item.dictValue == this.dataModel) {
1001
- this.dataModelShow = item.dictLabel
1002
- } else if (item.value == this.dataModel) {
1003
- if (item.text) {
1004
- this.dataModelShow = item.text
1005
- } else {
1006
- this.dataModelShow = item.value
1007
- }
1008
- }
1009
- })
1010
- },
1011
- /**点击表单后 代表确认已知晓验证不通过**/
1012
- resetShowFalse() {
1013
- this.showFalse = false;
1014
- this.$emit("update:models", {
1015
- ...this.models
1016
- })
1017
- },
1018
- updateDataModel() {
1019
- if (this.tableKey) {
1020
- this.dataModel = this.models[this.tableKey][this.tableIndex][this.widget.model]
1021
- } else {
1022
- if (this.widget.type === 'number') {
1023
- if (this.models[this.widget.model]) {
1024
- this.dataModel = this.models[this.widget.model]
1025
- } else {
1026
- this.dataModel = this.widget.options.min
1027
- }
1028
- } else {
1029
- this.dataModel = this.models[this.widget.model]
1030
- }
1031
- }
1032
- },
1033
- tableValueSet(val) {
1034
- var cloneArr = this.models[this.tableKey];
1035
- if (!(typeof cloneArr[this.tableIndex] == "object")) {
1036
- cloneArr[this.tableIndex] = {};
1037
- }
1038
- cloneArr[this.tableIndex][this.widget.model] = val;
1039
- this.$emit("update:models", {
1040
- ...this.models,
1041
- [this.tableKey]: cloneArr
1042
- });
1043
- this.$emit("input-change", val, this.widget.model);
1044
- },
1045
- /****/
1046
- // getParentModels(){
1047
- // Pubsub.subscribe('randomObserve',(msg,data) => {
1048
- // // console.log('fu传递model',msg, data)
1049
- // // this.dataModel = data[this.widget.model];//dataModel
1050
- // })
1051
- // },
1052
- // 当前formItem是否显示*号
1053
- showRequiredAsteriskFun() {
1054
- // console.log(this.rules, '----')
1055
- const rules = this.rules[this.widget.model];
1056
- // console.log('rules', rules)
1057
- if (rules && rules.length > 0) {
1058
- if (rules.find((rule) => rule.required === true)) {
1059
- return true
1060
- }
1061
- }
1062
- return false
1063
- },
1064
- /****选择人员****/
1065
- selectUser(flag) {
1066
- if (this.widget.options.disabled) return
1067
- this.isClickByUser = true
1068
- var PubsubSign = 'SelectUser' + String(Math.random()).split('.')[1];
1069
- Pubsub.subscribe(PubsubSign, (msg, data) => {
1070
- this.dataModel = data;
1071
- this.updateUserSelectorModal()
1072
- })
1073
- let departId = -1
1074
- let departName = ""
1075
- if (this.widget.options.departRelation) {
1076
- const userInfo = uni.getStorageSync('userinfo')
1077
- console.log("userInfo: ", userInfo)
1078
- departId = userInfo.departId || userInfo.depart_id
1079
- departName = userInfo.departName || userInfo.depart_name
995
+ })
996
+ } else {
997
+ newArr = arr.map(item => {
998
+ return {
999
+ value: item.value,
1000
+ label: item.text
1001
+ }
1002
+ })
1003
+ }
1004
+ // console.log(newArr)
1005
+ return newArr;
1006
+ },
1007
+ arrFindOptionLabel(arr) {
1008
+ if (!Array.isArray(arr)) return false;
1009
+ let that = this;
1010
+ let str = ''
1011
+ arr.forEach(item => {
1012
+ if (item.dictValue == this.dataModel || this.dataModel.includes(item.dictValue)) {
1013
+ str += ',' + item.dictLabel
1014
+ } else if (item.value == this.dataModel || this.dataModel.includes(item.value)) {
1015
+ if (item.text) {
1016
+ str += ',' + item.text;
1017
+
1018
+ } else {
1019
+ str += ',' + item.value
1020
+ }
1021
+ }
1022
+ })
1023
+ this.dataModelShow = str.substring(1)
1024
+ },
1025
+ /**点击表单后 代表确认已知晓验证不通过**/
1026
+ resetShowFalse() {
1027
+ this.showFalse = false;
1028
+ this.$emit("update:models", {
1029
+ ...this.models
1030
+ })
1031
+ },
1032
+ updateDataModel() {
1033
+ if (this.tableKey) {
1034
+ this.dataModel = this.models[this.tableKey][this.tableIndex][this.widget.model]
1035
+ } else {
1036
+ if (this.widget.type === 'number') {
1037
+ if (this.models[this.widget.model]) {
1038
+ this.dataModel = this.models[this.widget.model]
1039
+ } else {
1040
+ this.dataModel = this.widget.options.min
1041
+ }
1042
+ if (!this.dataModel) this.dataModel = 0
1043
+ } else {
1044
+ this.dataModel = this.models[this.widget.model]
1045
+ }
1046
+ }
1047
+ },
1048
+ tableValueSet(val) {
1049
+ var cloneArr = this.models[this.tableKey];
1050
+ if (!(typeof cloneArr[this.tableIndex] == "object")) {
1051
+ cloneArr[this.tableIndex] = {};
1052
+ }
1053
+ cloneArr[this.tableIndex][this.widget.model] = val;
1054
+ this.$emit("update:models", {
1055
+ ...this.models,
1056
+ [this.tableKey]: cloneArr
1057
+ });
1058
+ this.$emit("input-change", val, this.widget.model);
1059
+ },
1060
+ /****/
1061
+ // getParentModels(){
1062
+ // Pubsub.subscribe('randomObserve',(msg,data) => {
1063
+ // // console.log('fu传递model',msg, data)
1064
+ // // this.dataModel = data[this.widget.model];//dataModel
1065
+ // })
1066
+ // },
1067
+ // 当前formItem是否显示*号
1068
+ showRequiredAsteriskFun() {
1069
+ // console.log(this.rules, '----')
1070
+ const rules = this.rules[this.widget.model];
1071
+ // console.log('rules', rules)
1072
+ if (rules && rules.length > 0) {
1073
+ if (rules.find((rule) => rule.required === true)) {
1074
+ return true
1075
+ }
1076
+ }
1077
+ return false
1078
+ },
1079
+ /****选择人员****/
1080
+ selectUser(flag) {
1081
+ if (this.widget.options.disabled) return
1082
+ this.isClickByUser = true
1083
+ var PubsubSign = 'SelectUser' + String(Math.random()).split('.')[1];
1084
+ Pubsub.subscribe(PubsubSign, (msg, data) => {
1085
+ this.dataModel = data;
1086
+ this.updateUserSelectorModal()
1087
+ })
1088
+ let departId = -1
1089
+ let departName = ""
1090
+ if (this.widget.options.departRelation) {
1091
+ const userInfo = uni.getStorageSync('userinfo')
1092
+ console.log("userInfo: ", userInfo)
1093
+ departId = userInfo.departId || userInfo.depart_id
1094
+ departName = userInfo.departName || userInfo.depart_name
1095
+ }
1096
+ uni.navigateTo({
1097
+ url: '/pages/picker/picker?departRelation=' + (this.widget.options.departRelation ? 1 : 0) + '&departId=' + departId + '&departName=' + departName + '&sign=' + PubsubSign + '&multiple=' + flag + '&roleId=' + (this
1098
+ .widget.options.role ? this.widget.options.role : '') + '&selectedData=' + JSON
1099
+ .stringify(this.dataModel ? this.dataModel : [])
1100
+ });
1101
+ },
1102
+ // select报修人员
1103
+ handleSeclet(flag) {
1104
+ // uni.hideKeyboard()
1105
+ // console.log(this.widget)
1106
+ if (this.widget.options.disabled) {
1107
+ return false
1108
+ } else {
1109
+ var optionsData = JSON.stringify(this.widget.options)
1110
+ var PubsubSign = String(Math.random()).split('.')[1];
1111
+ Pubsub.subscribe(PubsubSign, (msg, data) => {
1112
+ console.log(data)
1113
+ this.dataModel = data.map(item => item.value)
1114
+
1115
+ if (!data || !Array.isArray(data) || data.length == 0) {
1116
+ this.dataModel = ''
1117
+ this.dataModelShow = ''
1118
+ return;
1119
+ }
1120
+ let str = '';
1121
+ data.forEach(item => {
1122
+ str += ',' + item.label;
1123
+ })
1124
+ this.dataModelShow = str.substr(1);
1125
+
1126
+ // this.dataModel = data[0].value;
1127
+ // this.dataModelShow = data[0].label;
1128
+ // console.log('this.dataModelShow', this.dataModelShow)
1129
+ })
1130
+ console.log(this.linkage)
1131
+ let model = this.widget.model
1132
+ let arr = Object.keys(this.linkage)
1133
+ let id = ''
1134
+ if (arr.length > 0 && this.linkage.hasOwnProperty(model)) {
1135
+ id = this.linkage[model]
1136
+ }
1137
+ uni.navigateTo({
1138
+ url: '/pages/picker/service?sign=' + PubsubSign + '&multiple=' + flag + '&optionsData=' +
1139
+ encodeURIComponent(optionsData) + '&dataModel=' + JSON.stringify(this.dataModel) + '&id=' + id
1140
+ });
1141
+ }
1142
+ },
1143
+ /****选择部门****/
1144
+ selectdept(flag) {
1145
+ if (this.widget.options.disabled) return;
1146
+ // uni.hideKeyboard()
1147
+ let departRela = ''
1148
+ if (this.widget.options.departRelation) {
1149
+ departRela = this.widget.options.departRelation
1150
+ }
1151
+ var PubsubSign = String(Math.random()).split('.')[1];
1152
+ Pubsub.subscribe(PubsubSign, (msg, data) => {
1153
+ this.dataModel = data;
1154
+ })
1155
+ var departType = this.widget.options.departType ? this.widget.options.departType : ''
1156
+ uni.navigateTo({
1157
+ url: '/pages/picker/depart?sign=' + PubsubSign + '&multiple=' + flag + '&departRela=' +
1158
+ departRela + '&selectedDepart=' + JSON.stringify(this.dataModel ? this.dataModel : []) + '&departType=' +
1159
+ departType
1160
+ });
1161
+ },
1162
+ // 获取EvanForm组件
1163
+ getParent() {
1164
+ let parent = this.$parent
1165
+ let parentName = parent.$options.name
1166
+ while (parentName !== 'EvanForm') {
1167
+ parent = parent.$parent
1168
+ parentName = parent.$options.name
1169
+ }
1170
+ return parent
1171
+ },
1172
+ getRules() {
1173
+ let form = this.getParent()
1174
+ let formRules = form.mRules;
1175
+ formRules = formRules ? formRules[this.prop] : [];
1176
+ return [].concat(formRules || []);
1177
+ },
1178
+ validateField(props, callback) {
1179
+ // console.log('---p', props)
1180
+ utils.validateField(this.model, this.mRules, props, callback, {
1181
+ showMessage: this.showMessage
1182
+ })
1183
+ },
1184
+ //打开级联选择器
1185
+ openCascdar() {
1186
+ this.$refs.picker.show()
1187
+ },
1188
+ cancel(e) {
1189
+ console.log(e)
1190
+ },
1191
+ open(item) {
1192
+ // 打开颜色选择器
1193
+ this.$refs.colorPicker.open();
1194
+ },
1195
+ confirm(event) {
1196
+ this.dataModel = event.hex
1197
+ },
1198
+ editOk(res) {
1199
+ this.dataModel = res.html
1200
+ console.log(this.dataModel);
1201
+ },
1202
+ //开关
1203
+ switch1Change: function (e) {
1204
+ this.dataModel = e.target.value
1205
+ },
1206
+ getBase64(base64) {
1207
+ this.signatrueImage = this.dataModel = base64
1208
+ this.signatrueFlag = false
1209
+ }
1210
+ },
1211
+ watch: {
1212
+ models: {
1213
+ deep: true,
1214
+ handler(v) {
1215
+ // this.updateDataModel(); // 当脚本文件里面 改动 models值后 需要更新 对应的
1216
+ // this.showFormData();
1217
+ if (this.tableKey) { //处理子表单删除行的时候 值未更新
1218
+ this.updateDataModel();
1219
+ this.showFormData();
1220
+ }
1221
+ }
1222
+ },
1223
+ dataModel(v) {
1224
+ if (this.tableKey) {
1225
+ this.tableValueSet(v);
1226
+ } else {
1227
+ this.models[this.widget.model] = v
1228
+ if (this.widget.type === 'userSelector') {
1229
+ this.updateUserSelectorModal()
1080
1230
  }
1081
- uni.navigateTo({
1082
- url: '/pages/picker/picker?departRelation=' + (this.widget.options.departRelation ? 1 : 0) + '&departId=' + departId + '&departName=' + departName +'&sign=' + PubsubSign + '&multiple=' + flag + '&roleId=' + (this
1083
- .widget.options.role ? this.widget.options.role : '') + '&selectedData=' + JSON
1084
- .stringify(this.dataModel ? this.dataModel : [])
1085
- });
1086
- },
1087
- // select报修人员
1088
- handleSeclet(flag) {
1089
- // uni.hideKeyboard()
1090
- // console.log(this.widget)
1091
- if (this.widget.options.disabled) {
1092
- return false
1093
- } else {
1094
- var optionsData = JSON.stringify(this.widget.options)
1095
- var PubsubSign = String(Math.random()).split('.')[1];
1096
- Pubsub.subscribe(PubsubSign, (msg, data) => {
1097
- console.log(data)
1098
- this.dataModel = data[0].value;
1099
- this.dataModelShow = data[0].label;
1100
- // console.log('this.dataModelShow', this.dataModelShow)
1101
- })
1102
- console.log(this.linkage)
1103
- let model = this.widget.model
1104
- let arr = Object.keys(this.linkage)
1105
- let id = ''
1106
- if (arr.length > 0 && this.linkage.hasOwnProperty(model)) {
1107
- id = this.linkage[model]
1108
- }
1109
- uni.navigateTo({
1110
- url: '/pages/picker/service?sign=' + PubsubSign + '&multiple=' + flag + '&optionsData=' +
1111
- encodeURIComponent(optionsData) + '&dataModel=' + this.dataModel + '&id=' + id
1112
- });
1113
- }
1114
- },
1115
- /****选择部门****/
1116
- selectdept(flag) {
1117
- if (this.widget.options.disabled) return;
1118
- // uni.hideKeyboard()
1119
- let departRela = ''
1120
- if (this.widget.options.departRelation) {
1121
- departRela = this.widget.options.departRelation
1122
- }
1123
- var PubsubSign = String(Math.random()).split('.')[1];
1124
- Pubsub.subscribe(PubsubSign, (msg, data) => {
1125
- this.dataModel = data;
1126
- })
1127
- var departType = this.widget.options.departType ? this.widget.options.departType : ''
1128
- uni.navigateTo({
1129
- url: '/pages/picker/depart?sign=' + PubsubSign + '&multiple=' + flag + '&departRela=' +
1130
- departRela + '&selectedDepart=' + JSON.stringify(this.dataModel ? this.dataModel : []) + '&departType=' +
1131
- departType
1132
- });
1133
- },
1134
- // 获取EvanForm组件
1135
- getParent() {
1136
- let parent = this.$parent
1137
- let parentName = parent.$options.name
1138
- while (parentName !== 'EvanForm') {
1139
- parent = parent.$parent
1140
- parentName = parent.$options.name
1141
- }
1142
- return parent
1143
- },
1144
- getRules() {
1145
- let form = this.getParent()
1146
- let formRules = form.mRules;
1147
- formRules = formRules ? formRules[this.prop] : [];
1148
- return [].concat(formRules || []);
1149
- },
1150
- validateField(props, callback) {
1151
- // console.log('---p', props)
1152
- utils.validateField(this.model, this.mRules, props, callback, {
1153
- showMessage: this.showMessage
1154
- })
1155
- },
1156
- //打开级联选择器
1157
- openCascdar() {
1158
- this.$refs.picker.show()
1159
- },
1160
- cancel(e) {
1161
- console.log(e)
1162
- },
1163
- open(item) {
1164
- // 打开颜色选择器
1165
- this.$refs.colorPicker.open();
1166
- },
1167
- confirm(event) {
1168
- this.dataModel = event.hex
1169
- },
1170
- editOk(res) {
1171
- this.dataModel = res.html
1172
- console.log(this.dataModel);
1173
- },
1174
- //开关
1175
- switch1Change: function(e) {
1176
- this.dataModel = e.target.value
1177
- },
1178
- getBase64(base64) {
1179
- this.signatrueImage = this.dataModel = base64
1180
- this.signatrueFlag = false
1181
- }
1182
- },
1183
- watch: {
1184
- models: {
1185
- deep: true,
1186
- handler(v) {
1187
- // this.updateDataModel(); // 当脚本文件里面 改动 models值后 需要更新 对应的
1188
- // this.showFormData();
1189
- if (this.tableKey) { //处理子表单删除行的时候 值未更新
1190
- this.updateDataModel();
1191
- this.showFormData();
1192
- }
1193
- }
1194
- },
1195
- dataModel(v) {
1196
- if (this.tableKey) {
1197
- this.tableValueSet(v);
1198
- } else {
1199
- this.models[this.widget.model] = v
1200
- if (this.widget.type === 'userSelector') {
1201
- this.updateUserSelectorModal()
1202
- }
1203
- if (this.widget.type === 'deptSelector') {
1204
- this.updatedeptSelectorModal()
1205
- }
1206
- this.$emit("update:models", {
1207
- ...this.models,
1208
- [this.widget.model]: v
1209
- });
1210
- }
1211
- this.pulishMsg(v, this.isClickByUser);
1212
- this.isClickByUser = false;
1213
- /**表单未校验前 不允许 次次校验,校验后实时监听校验*/
1214
- if (!this.firstValidateField) {
1215
- // this.init()
1216
- }
1217
- }
1218
- }
1219
- }
1231
+ if (this.widget.type === 'deptSelector') {
1232
+ this.updatedeptSelectorModal()
1233
+ }
1234
+ this.$emit("update:models", {
1235
+ ...this.models,
1236
+ [this.widget.model]: v
1237
+ });
1238
+ }
1239
+ this.pulishMsg(v, this.isClickByUser);
1240
+ this.isClickByUser = false;
1241
+ /**表单未校验前 不允许 次次校验,校验后实时监听校验*/
1242
+ if (!this.firstValidateField) {
1243
+ // this.init()
1244
+ }
1245
+ }
1246
+ }
1247
+ }
1220
1248
  </script>
1221
1249
 
1222
1250
 
1223
1251
  <style lang="scss" scoped>
1224
- @import "../../static/uni.css";
1225
- $form-item-bottom-padding:20rpx; // 每个组件底部间隔
1226
-
1227
- icon {
1228
- position: absolute;
1229
- bottom: 10px;
1230
- right: 10px;
1231
- z-index: 999;
1232
- }
1233
-
1234
- .u_close {
1235
- padding: 20rpx 20rpx;
1236
- position: absolute;
1237
- right: 0;
1238
- top: 72%;
1239
- transform: translateY(-50%);
1240
- }
1241
-
1242
- .disabledClick {
1243
- pointer-events: none;
1244
- }
1245
-
1246
- .cover-text {
1247
- position: relative;
1248
- }
1249
-
1250
- radio {
1251
- padding-left: $uni-form-padding-left;
1252
- }
1253
-
1254
- radio-group label {
1255
- margin-left: -30rpx;
1256
- }
1257
-
1258
- checkbox-group label {
1259
- padding-left: 60rpx;
1260
- margin-left: -30rpx;
1261
-
1262
- }
1263
-
1264
- .form-item {
1265
- background-color: #fff;
1266
- position: relative;
1267
- margin-bottom: $form-item-bottom-padding;
1268
-
1269
- .editCorrent {
1270
- position: absolute;
1271
- right: 20upx;
1272
- top: 10upx;
1273
- width: 50upx;
1274
- height: 50upx;
1275
-
1276
- img {
1277
- width: 30upx;
1278
- height: 30upx;
1279
- }
1280
- }
1281
-
1282
- .correctedWrap {
1283
- position: absolute;
1284
- top: 0;
1285
- right: 0;
1286
- padding: 0 10upx;
1287
- background-color: #539DFA;
1288
- color: #FFFFFF;
1289
- }
1290
- }
1291
-
1292
- .isCorrected {
1293
- border-top: 2upx solid #ff0000;
1294
- border-bottom: 2upx solid #ff0000;
1295
- }
1296
-
1297
- .showFalse {
1298
- // border-left: 1px dashed rgba(255,0,0,0.4);
1299
- // border-right: 1px dashed rgba(255,0,0,0.4);
1300
- // background-color: rgba(255, 0, 0, 0.1);
1301
- // border-bottom: 1upx dashed rgba(255, 0, 0, 0.4);
1302
-
1303
- }
1304
-
1305
- .evan-form-item-container {
1306
- // border-bottom: 1upx solid #eee;
1307
- position: relative;
1308
- padding: 0;
1309
-
1310
- &__label {
1311
- font-size: $uni-form-title-font-size;
1312
- color: #666;
1313
- height: 70upx;
1314
- line-height: 70upx;
1315
- // padding: 12upx 0 0 0;
1316
- display: inline-block;
1317
- padding-left: $uni-form-padding-left;
1318
-
1319
- &.showAsteriskRect::after {
1320
- content: '';
1321
- color: #FF3333;
1322
- width: 30upx;
1323
- display: inline-block;
1324
- padding-left: 10upx;
1325
- }
1326
-
1327
- &.isRequired::before {
1328
- padding-right: 10upx;
1329
- content: '*';
1330
- color: red;
1331
- }
1332
- }
1333
-
1334
- &__main {
1335
- flex: 1;
1336
- min-height: 84upx;
1337
- display: flex;
1338
- align-items: center;
1339
- overflow: hidden;
1340
- justify-content: flex-start;
1341
- padding-left: $uni-form-padding-left;
1342
-
1343
- .form-input {
1344
- font-size: $uni-form-content-font-size;
1345
- width: 100%;
1346
- color: #555555 // padding-left: 28upx;
1347
- }
1348
-
1349
- &--body {
1350
- position: relative;
1351
- }
1352
- }
1353
-
1354
- &__main textarea {
1355
- padding-top: 12upx;
1356
- }
1357
-
1358
- &--left {
1359
- display: flex;
1360
- flex-direction: row;
1361
- align-items: center;
1362
- justify-content: flex-end;
1363
- }
1364
-
1365
- &--top {
1366
- .evan-form-item-container__label {
1367
- // padding-bottom: 10upx;
1368
- color: #000000;
1369
- }
1370
- }
1371
- }
1372
-
1373
- /deep/ .form-input-placeholder {
1374
- // line-height: 90upx;
1375
- color: #555;
1376
- }
1377
-
1378
- .form-textarea-placeholder {
1379
- padding-top: 28upx;
1380
- font-size: 34upx;
1381
- width: 100%;
1382
- }
1383
-
1384
- .evan-form-item-container--top .radio-height {
1385
- font-size: $uni-form-title-font-size;
1386
- // font-weight: bold;
1387
- // line-height: 40upx;
1388
- padding: 25upx 0 25upx 30rpx;
1389
- display: inline-block;
1390
- }
1391
-
1392
- /deep/.wx-picker-container .wx-picker-action.wx-picker-action-confirm {
1393
- color: #007AFF !important;
1394
- }
1395
-
1396
- .opencolor {
1397
- width: 50upx;
1398
- height: 20upx;
1399
- padding: 5upx;
1400
- background: #000007;
1401
- margin-right: 15upx;
1402
- }
1403
-
1404
- .with-fun {
1405
- width: 100%;
1406
- }
1407
-
1408
- .no-index {
1409
- position: relative;
1410
- z-index: 0;
1411
- }
1412
-
1413
- .option-font-size {
1414
- font-size: $uni-form-content-font-size;
1415
- color: #555555;
1416
- width: 100%;
1417
- min-width: 100rpx;
1418
- height: 100%;
1252
+ @import "../../static/uni.css";
1253
+
1254
+ $form-item-bottom-padding: 20 rpx; // 每个组件底部间隔
1255
+
1256
+ icon {
1257
+ position: absolute;
1258
+ bottom: 10px;
1259
+ right: 10px;
1260
+ z-index: 999;
1261
+ }
1262
+
1263
+ .u_close {
1264
+ padding: 20 rpx 20 rpx;
1265
+ position: absolute;
1266
+ right: 0;
1267
+ top: 72%;
1268
+ transform: translateY(-50%);
1269
+ }
1270
+
1271
+ .disabledClick {
1272
+ pointer-events: none;
1273
+ }
1274
+
1275
+ .cover-text {
1276
+ position: relative;
1277
+ }
1278
+
1279
+ radio {
1280
+ padding-left: $uni-form-padding-left;
1281
+ }
1282
+
1283
+ radio-group label {
1284
+ margin-left: -30rpx;
1285
+ }
1286
+
1287
+ checkbox-group label {
1288
+ padding-left: 60 rpx;
1289
+ margin-left: -30rpx;
1290
+
1291
+ }
1292
+
1293
+ .form-item {
1294
+ background-color: #fff;
1295
+ position: relative;
1296
+ margin-bottom: $form-item-bottom-padding;
1297
+
1298
+ .editCorrent {
1299
+ position: absolute;
1300
+ right: 20 upx;
1301
+ top: 10 upx;
1302
+ width: 50 upx;
1303
+ height: 50 upx;
1304
+
1305
+ img {
1306
+ width: 30 upx;
1307
+ height: 30 upx;
1308
+ }
1309
+ }
1310
+
1311
+ .correctedWrap {
1312
+ position: absolute;
1313
+ top: 0;
1314
+ right: 0;
1315
+ padding: 0 10 upx;
1316
+ background-color: #539DFA;
1317
+ color: #FFFFFF;
1318
+ }
1319
+ }
1320
+
1321
+ .isCorrected {
1322
+ border-top: 2 upx solid #ff0000;
1323
+ border-bottom: 2 upx solid #ff0000;
1324
+ }
1325
+
1326
+ .showFalse {
1327
+ // border-left: 1px dashed rgba(255,0,0,0.4);
1328
+ // border-right: 1px dashed rgba(255,0,0,0.4);
1329
+ // background-color: rgba(255, 0, 0, 0.1);
1330
+ // border-bottom: 1upx dashed rgba(255, 0, 0, 0.4);
1331
+
1332
+ }
1333
+
1334
+ .evan-form-item-container {
1335
+ // border-bottom: 1upx solid #eee;
1336
+ position: relative;
1337
+ padding: 0;
1338
+
1339
+ &__label {
1340
+ font-size: $uni-form-title-font-size;
1341
+ color: #666;
1342
+ height: 70 upx;
1343
+ line-height: 70 upx;
1344
+ // padding: 12upx 0 0 0;
1345
+ display: inline-block;
1346
+ padding-left: $uni-form-padding-left;
1347
+
1348
+ &.showAsteriskRect::after {
1349
+ content: '';
1350
+ color: #FF3333;
1351
+ width: 30 upx;
1352
+ display: inline-block;
1353
+ padding-left: 10 upx;
1354
+ }
1355
+
1356
+ &.isRequired::before {
1357
+ padding-right: 10 upx;
1358
+ content: '*';
1359
+ color: red;
1360
+ }
1361
+ }
1362
+
1363
+ &__main {
1364
+ flex: 1;
1365
+ min-height: 84 upx;
1366
+ display: flex;
1367
+ align-items: center;
1368
+ overflow: hidden;
1369
+ justify-content: flex-start;
1370
+ padding-left: $uni-form-padding-left;
1371
+
1372
+ .form-input {
1373
+ font-size: $uni-form-content-font-size;
1374
+ width: 100%;
1375
+ color: #555555 // padding-left: 28upx;
1376
+ }
1377
+
1378
+ &--body {
1379
+ position: relative;
1380
+ }
1381
+ }
1382
+
1383
+ &__main textarea {
1384
+ padding-top: 12 upx;
1385
+ }
1386
+
1387
+ &--left {
1419
1388
  display: flex;
1389
+ flex-direction: row;
1420
1390
  align-items: center;
1421
- }
1422
-
1423
- /**checkbox radio*/
1424
- .uni-list::before {
1425
- height: 0px;
1426
- }
1427
-
1428
- .uni-list::after {
1429
- height: 0px;
1430
- }
1431
-
1432
- .uni-list .uni-list-cell:last-child::after {
1433
- height: 0rpx;
1434
- }
1435
-
1436
- .uni-list-cell-last.uni-list-cell::after {
1437
- height: 0rpx;
1438
- }
1439
-
1440
- /**checkbox radio*/
1441
-
1442
- /***error-message 错误信息展示 **/
1443
- .error-message {
1444
- color: red;
1445
- padding-left: $uni-form-padding-left;
1446
- font-size: 24upx;
1447
- background-color: #efefef;
1448
- padding-top: $form-item-bottom-padding;
1449
- }
1450
-
1451
- .signatrue-view {
1452
- position: fixed;
1453
- top: 0;
1454
- left: 0;
1455
- bottom: 0;
1456
- right: 0;
1457
- background: rgba(0, 0, 0, .6);
1458
- z-index: 999;
1459
- }
1460
-
1461
- .signatrue-box {
1462
- position: fixed;
1463
- top: 50%;
1464
- left: 0;
1465
- // height: 50vh;
1466
- height: 400rpx;
1467
- transform: translateY(-50%);
1468
- background: #fff;
1469
- z-index: 999;
1470
- }
1471
-
1472
- .option-time-icon {
1473
- width: 150rpx;
1474
- }
1391
+ justify-content: flex-end;
1392
+ }
1393
+
1394
+ &--top {
1395
+ .evan-form-item-container__label {
1396
+ // padding-bottom: 10upx;
1397
+ color: #000000;
1398
+ }
1399
+ }
1400
+ }
1401
+
1402
+ /deep/ .form-input-placeholder {
1403
+ // line-height: 90upx;
1404
+ color: #555;
1405
+ }
1406
+
1407
+ .form-textarea-placeholder {
1408
+ padding-top: 28 upx;
1409
+ font-size: 34 upx;
1410
+ width: 100%;
1411
+ }
1412
+
1413
+ .evan-form-item-container--top .radio-height {
1414
+ font-size: $uni-form-title-font-size;
1415
+ // font-weight: bold;
1416
+ // line-height: 40upx;
1417
+ padding: 25 upx 0 25 upx 30 rpx;
1418
+ display: inline-block;
1419
+ }
1420
+
1421
+ /deep/ .wx-picker-container .wx-picker-action.wx-picker-action-confirm {
1422
+ color: #007AFF !important;
1423
+ }
1424
+
1425
+ .opencolor {
1426
+ width: 50 upx;
1427
+ height: 20 upx;
1428
+ padding: 5 upx;
1429
+ background: #000007;
1430
+ margin-right: 15 upx;
1431
+ }
1432
+
1433
+ .with-fun {
1434
+ width: 100%;
1435
+ }
1436
+
1437
+ .no-index {
1438
+ position: relative;
1439
+ z-index: 0;
1440
+ }
1441
+
1442
+ .option-font-size {
1443
+ font-size: $uni-form-content-font-size;
1444
+ color: #555555;
1445
+ width: 100%;
1446
+ min-width: 100 rpx;
1447
+ height: 100%;
1448
+ display: flex;
1449
+ align-items: center;
1450
+ }
1451
+
1452
+ /**checkbox radio*/
1453
+ .uni-list::before {
1454
+ height: 0px;
1455
+ }
1456
+
1457
+ .uni-list::after {
1458
+ height: 0px;
1459
+ }
1460
+
1461
+ .uni-list .uni-list-cell:last-child::after {
1462
+ height: 0 rpx;
1463
+ }
1464
+
1465
+ .uni-list-cell-last.uni-list-cell::after {
1466
+ height: 0 rpx;
1467
+ }
1468
+
1469
+ /**checkbox radio*/
1470
+
1471
+ /***error-message 错误信息展示 **/
1472
+ .error-message {
1473
+ color: red;
1474
+ padding-left: $uni-form-padding-left;
1475
+ font-size: 24 upx;
1476
+ background-color: #efefef;
1477
+ padding-top: $form-item-bottom-padding;
1478
+ }
1479
+
1480
+ .signatrue-view {
1481
+ position: fixed;
1482
+ top: 0;
1483
+ left: 0;
1484
+ bottom: 0;
1485
+ right: 0;
1486
+ background: rgba(0, 0, 0, .6);
1487
+ z-index: 999;
1488
+ }
1489
+
1490
+ .signatrue-box {
1491
+ position: fixed;
1492
+ top: 50%;
1493
+ left: 0;
1494
+ // height: 50vh;
1495
+ height: 400 rpx;
1496
+ transform: translateY(-50%);
1497
+ background: #fff;
1498
+ z-index: 999;
1499
+ }
1500
+
1501
+ .option-time-icon {
1502
+ width: 150 rpx;
1503
+ }
1475
1504
  </style>