seimin 9 月之前
父节点
当前提交
0b1ac2436f

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

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

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

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

+ 0 - 1
readme.md

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

+ 20 - 0
static/scss/common.scss

@@ -9,6 +9,26 @@ page{
9
   color:red!important;
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
 uni-toast,
32
 uni-toast,
13
 [longpressactions]{
33
 [longpressactions]{
14
   z-index: 99999!important;
34
   z-index: 99999!important;

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

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