seimin 9 달 전
부모
커밋
0b1ac2436f

+ 1 - 1
pages/inspection/inspectionExecute/inspectionExecute.vue

@@ -110,7 +110,7 @@
110 110
     });
111 111
     // 'inspection|$|1bd0c704-0962-4ed4-b5a6-b5bda3d78231'
112 112
     // 'inspection|$|bc9f61af-99c8-4c86-88f9-f29dd3fc43c0'
113
-    SM('inspection|$|bc9f61af-99c8-4c86-88f9-f29dd3fc43c0').then((ress1) => {
113
+    SM().then((ress1) => {
114 114
       let postData = {
115 115
         code: ress1,
116 116
         taskId: data.id,

+ 46 - 26
pages/inspection/inspectionValue/inspectionValue.vue

@@ -4,20 +4,40 @@
4 4
       <uni-forms ref="baseForm" :model="formValues" :rules="rules" class="form" label-position="top">
5 5
         <template v-for="(item, index) of baseFormData" :key="index">
6 6
           <!-- 下拉 -->
7
-          <uni-forms-item v-if="item.type === '1'" class="formItem" :label="item.name" :exception="item.isException" :required="item.required" :name="item.key">
7
+          <uni-forms-item v-if="item.type === '1'" class="formItem" :required="item.required" :name="item.key">
8
+            <template v-slot:label>
9
+              <view class="customLabelWrap">
10
+                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
11
+              </view>
12
+            </template>
8 13
             <uni-data-picker :placeholder="'请选择' + item.name" :popup-title="'请选择' + item.name" :localdata="item.list" v-model="formValues[item.key]" @change="changeForm()">
9 14
             </uni-data-picker>
10 15
           </uni-forms-item>
11 16
           <!-- 单选 -->
12
-          <uni-forms-item v-if="item.type === '2'" class="formItem" :label="item.name" :exception="item.isException" :required="item.required" :name="item.key">
17
+          <uni-forms-item v-if="item.type === '2'" class="formItem" :required="item.required" :name="item.key">
18
+            <template v-slot:label>
19
+              <view class="customLabelWrap">
20
+                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
21
+              </view>
22
+            </template>
13 23
             <uni-data-checkbox v-model="formValues[item.key]" @change="changeForm()" :localdata="item.list" />
14 24
           </uni-forms-item>
15 25
           <!-- 多选 -->
16
-          <uni-forms-item v-if="item.type === '3'" class="formItem" :label="item.name" :exception="item.isException" :required="item.required" :name="item.key">
26
+          <uni-forms-item v-if="item.type === '3'" class="formItem" :required="item.required" :name="item.key">
27
+            <template v-slot:label>
28
+              <view class="customLabelWrap">
29
+                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
30
+              </view>
31
+            </template>
17 32
             <uni-data-checkbox v-model="formValues[item.key]" @change="changeForm()" multiple :localdata="item.list" />
18 33
           </uni-forms-item>
19 34
           <!-- 数字 -->
20
-          <uni-forms-item v-if="item.type === '4'" class="formItem" :label="item.name" :exception="item.isException" :required="item.required" :name="item.key">
35
+          <uni-forms-item v-if="item.type === '4'" class="formItem" :required="item.required" :name="item.key">
36
+            <template v-slot:label>
37
+              <view class="customLabelWrap">
38
+                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
39
+              </view>
40
+            </template>
21 41
             <uni-number-box v-model="formValues[item.key]" @change="changeForm()" :min="-9999" :max="9999" :placeholder="'请输入' + item.name"></uni-number-box>
22 42
           </uni-forms-item>
23 43
           <!-- 单行 -->
@@ -68,24 +88,24 @@ import { forIn } from 'lodash-es';
68 88
 
69 89
   // 主题颜色
70 90
   const primaryColor = ref(defaultColor)
71
-  
91
+
72 92
   // 所有页码数据
73 93
   const formPageList = reactive([]);
74
-  
94
+
75 95
   // 表单
76 96
   const baseForm = ref()
77
-  
97
+
78 98
   const inspectionExecuteId = ref()
79 99
 
80 100
   // 数据-原始
81 101
   const dataInfo = reactive({})
82
-  
102
+
83 103
   // 数据-检验
84 104
   const rules = reactive({})
85
-  
105
+
86 106
   // 数据-填写值
87 107
   const formValues = reactive({})
88
-  
108
+
89 109
   // 表单数据-渲染
90 110
   // 下拉框	1
91 111
   // 单选	2
@@ -104,12 +124,12 @@ import { forIn } from 'lodash-es';
104 124
     // { type: 6, name: '', value: '', list: [], required: false, checkType: 0, valueMin: '', valueMax: '', },
105 125
     // { type: 7, name: '', value: [], list: [], required: false, checkType: 0, valueMin: '', valueMax: '', },
106 126
   ])
107
-  
127
+
108 128
   // 修改
109 129
   function changeForm(){
110 130
     handleData(true);
111 131
   }
112
-  
132
+
113 133
   // 保存
114 134
   function submit(){
115 135
     baseForm.value.validate().then(res => {
@@ -165,18 +185,18 @@ import { forIn } from 'lodash-es';
165 185
       console.log('err', err);
166 186
     })
167 187
   }
168
-  
188
+
169 189
   // 处理数据
170 190
   function handleData(isException = false){
171 191
     // 目前只取第一页
172 192
     let firstPage = formPageList[0]?.formItemList || [];
173
-    
193
+
174 194
     firstPage = firstPage.filter( v => v.display === 1);
175
-    
195
+
176 196
     firstPage = firstPage.map((v, i) => {
177 197
       let value = '';
178 198
       v.formItemConfigList = v.formItemConfigList || [];
179
-      
199
+
180 200
       // value
181 201
       if(v.type.value === '3'){
182 202
         // 多选
@@ -195,7 +215,7 @@ import { forIn } from 'lodash-es';
195 215
         // 其他
196 216
         value = v.defaultValue;
197 217
       }
198
-      
218
+
199 219
       return {
200 220
         id: v.id,
201 221
         key: `field${i}`,
@@ -211,10 +231,10 @@ import { forIn } from 'lodash-es';
211 231
         valueMax: v.checkType === 2 ? v.valueUp : ( v.checkType === 1 ? (v.valuex + v.valueGap) : undefined),
212 232
       }
213 233
     });
214
-    
234
+
215 235
     let firstPageBottom = firstPage.filter(v => v.type === '5' || v.type === '6');
216 236
     firstPage = firstPage.filter(v => v.type !== '5' && v.type !== '6' && v.type !== '7');
217
-    
237
+
218 238
     // 其他项
219 239
     if(isException){
220 240
       firstPage.forEach(v => {
@@ -256,7 +276,7 @@ import { forIn } from 'lodash-es';
256 276
         }
257 277
       })
258 278
     }
259
-    
279
+
260 280
     // 单行|多行|图片上传
261 281
     let someIsException = firstPage.filter(v => v.type !== '8').some(v => v.isException);
262 282
     console.log('someIsException=>', someIsException)
@@ -264,19 +284,19 @@ import { forIn } from 'lodash-es';
264 284
       console.log('v.showError=>', v.showError)
265 285
       v.isException = (v.showError === 1 && someIsException) || v.showError === 0;
266 286
     })
267
-    
287
+
268 288
     firstPage = firstPage.concat(firstPageBottom).sort((a, b) => a.orders - b.orders);
269 289
     console.log('firstPage=>', firstPage);
270
-    
290
+
271 291
     Object.assign(baseFormData, firstPage);
272 292
     console.log('baseFormData=>', baseFormData);
273
-    
293
+
274 294
     Object.assign(formValues, fromPairs(firstPage.filter(v => v.type !== '8').map(v => ([v.key, v.value]))));
275 295
     console.log('formValues=>', formValues);
276
-    
296
+
277 297
     let rulesObj = keyBy(firstPage.filter(v => v.type !== '8'), 'key');
278 298
     console.log(rulesObj)
279
-    
299
+
280 300
     for(let key in rulesObj){
281 301
       rulesObj[key] = {
282 302
         rules: [
@@ -287,7 +307,7 @@ import { forIn } from 'lodash-es';
287 307
     Object.assign(rules, rulesObj);
288 308
     console.log('rules=>', rules);
289 309
   }
290
-  
310
+
291 311
   onLoad((option) => {
292 312
     inspectionExecuteId.value = +option.inspectionExecuteId;
293 313
     // 巡检项

+ 0 - 1
readme.md

@@ -9,4 +9,3 @@
9 9
 - filters      存放过滤器
10 10
 
11 11
 # uni-ui源码修改记录
12
-- uni-forms-item.vue增加exception参数

+ 20 - 0
static/scss/common.scss

@@ -9,6 +9,26 @@ page{
9 9
   color:red!important;
10 10
 }
11 11
 
12
+.customLabelWrap{
13
+  display: flex;
14
+}
15
+
16
+.customLabel{
17
+  display: flex;
18
+  flex-direction: row;
19
+  align-items: center;
20
+  text-align: left;
21
+  font-size: 14px;
22
+  color: #606266;
23
+  height: 36px;
24
+  padding: 0 12px 0 0;
25
+  vertical-align: middle;
26
+  flex-shrink: 0;
27
+  box-sizing: border-box;
28
+  padding: 0 0 8px;
29
+  line-height: 1.5715;
30
+}
31
+
12 32
 uni-toast,
13 33
 [longpressactions]{
14 34
   z-index: 99999!important;

+ 0 - 6
uni_modules/uni-forms/components/uni-forms-item/uni-forms-item.vue

@@ -6,7 +6,6 @@
6 6
 				:style="{width:localLabelWidth,justifyContent: localLabelAlign}">
7 7
 				<text v-if="required" class="is-required">*</text>
8 8
 				<text>{{label}}</text>
9
-				<text v-if="exception">&nbsp;<text class="red">异</text></text>
10 9
 			</view>
11 10
 		</slot>
12 11
 		<!-- #ifndef APP-NVUE -->
@@ -37,7 +36,6 @@
37 36
 	 * @tutorial https://ext.dcloud.net.cn/plugin?id=2773
38 37
 	 * @property {Boolean} required 是否必填,左边显示红色"*"号
39 38
 	 * @property {String } 	label 				输入框左边的文字提示
40
-	 * @property {Boolean } exception 		是否异常
41 39
 	 * @property {Number } 	labelWidth 			label的宽度,单位px(默认70)
42 40
 	 * @property {String } 	labelAlign = [left|center|right] label的文字对齐方式(默认left)
43 41
 	 * 	@value left		label 左侧显示
@@ -93,10 +91,6 @@
93 91
 				type: String,
94 92
 				default: ''
95 93
 			},
96
-      exception: {
97
-      	type: Boolean,
98
-      	default: false
99
-      },
100 94
 			// label的宽度
101 95
 			labelWidth: {
102 96
 				type: [String, Number],