1 | module.exports = function (row) {
|
2 | |
3 |
|
4 |
|
5 | const codes = {
|
6 |
|
7 | types1: [
|
8 | '029',
|
9 | '091',
|
10 | '093',
|
11 | '084',
|
12 | '028'
|
13 | ],
|
14 |
|
15 | types2: [
|
16 | '026',
|
17 | '027'
|
18 | ],
|
19 |
|
20 | types3: [
|
21 | '098',
|
22 | '099'
|
23 | ]
|
24 | }
|
25 |
|
26 | const allCodes = [...codes.types1, ...codes.types2, ...codes.types3]
|
27 |
|
28 |
|
29 | var form1 = [{
|
30 | key: this.utils.getKey('门洞宽'),
|
31 | label: '门洞宽',
|
32 | type:'txt',
|
33 | tip: `范围应在${row[this.utils.getKey('门洞宽最小值')]}~${row[this.utils.getKey('门洞宽极限值')]}之间`,
|
34 | value: ""
|
35 | },
|
36 | {
|
37 | key: this.utils.getKey('门洞高'),
|
38 | label: '门洞高',
|
39 | type:'txt',
|
40 | tip: `范围应在${row[this.utils.getKey('门洞高最小值')]}~${row[this.utils.getKey('门洞高极限值')]}之间`,
|
41 | value: ""
|
42 | },
|
43 | {
|
44 | key: this.utils.getKey('门洞深'),
|
45 | label: '门洞深',
|
46 | type:'txt',
|
47 | tip: `范围应在${row[this.utils.getKey('门洞深最小值')]}~${row[this.utils.getKey('门洞深极限值')]}之间`,
|
48 | value: ""
|
49 | }
|
50 | ]
|
51 | var form2 = [
|
52 | {
|
53 | key: this.utils.getKey('门洞深'),
|
54 | label: '门洞深',
|
55 | type:'txt',
|
56 | tip: `范围应在${row[this.utils.getKey('门洞深最小值')]}~${row[this.utils.getKey('门洞深极限值')]}之间`,
|
57 | value: ""
|
58 | }
|
59 | ];
|
60 | var validateMap = {
|
61 | [`${this.utils.getKey('门洞宽')}_valid`]: (value, fd, fo) => {
|
62 | let errorMsg = '';
|
63 |
|
64 | if(codes.types1.indexOf(row.Code) != -1) {
|
65 | if(!value || value == '') return '';
|
66 | }
|
67 | errorMsg = this.utils.staValidFun('门洞宽', value);
|
68 | errorMsg = this.utils.runAction([
|
69 | {condition: () => {return errorMsg}, msg: errorMsg},
|
70 | {condition: () => {return (value * 1 < row[this.utils.getKey('门洞宽最小值')] || value * 1 > row[this.utils.getKey('门洞宽极限值')])}, msg: `门洞宽${fo.tip}`}
|
71 | ]);
|
72 | return errorMsg;
|
73 | },
|
74 | [`${this.utils.getKey('门洞高')}_valid`]: (value, fd, fo) => {
|
75 | let errorMsg = '';
|
76 |
|
77 | if(codes.types1.indexOf(row.Code) != -1) {
|
78 | if(!value || value == '') return '';
|
79 | }
|
80 | errorMsg = this.utils.staValidFun('门洞高', value);
|
81 | errorMsg = this.utils.runAction([
|
82 | {condition: () => {return errorMsg}, msg: errorMsg},
|
83 | {condition: () => {return (value * 1 < row[this.utils.getKey('门洞高最小值')] || value * 1 > row[this.utils.getKey('门洞高极限值')])}, msg: `门洞高${fo.tip}`}
|
84 | ]);
|
85 | return errorMsg;
|
86 | },
|
87 | [`${this.utils.getKey('门洞深')}_valid`]: function (value, fd, fo) {
|
88 | let errorMsg = '';
|
89 | errorMsg = this.utils.staValidFun('门洞深', value);
|
90 | errorMsg = this.utils.runAction([
|
91 | {condition: ()=> {return errorMsg}, msg: errorMsg},
|
92 | {condition: ()=> {return (value * 1 < row[this.utils.getKey('门洞深最小值')] || value * 1 > row[this.utils.getKey('门洞深极限值')])}, msg: `门洞深${fo.tip}`}
|
93 | ]);
|
94 | return errorMsg;
|
95 | }
|
96 | }
|
97 | var self= this;
|
98 | return {
|
99 | validateMap: validateMap,
|
100 | codes: allCodes,
|
101 | forms: codes.types3.indexOf(row[self.utils.getKey('三级分类')])==-1?form1:form2
|
102 | }
|
103 | } |
\ | No newline at end of file |