1 | module.exports = function (row, plant) {
|
2 | |
3 |
|
4 |
|
5 | const codes = [
|
6 | '024',
|
7 | '082'
|
8 | ]
|
9 |
|
10 |
|
11 | var forms = [{
|
12 | key: this.utils.getKey('门洞宽'),
|
13 | label: '门洞宽',
|
14 | type:'txt',
|
15 | tip: `范围应在${row[this.utils.getKey('门洞宽最小值')]}~${row[this.utils.getKey('门洞宽极限值')]}之间`,
|
16 | value: ""
|
17 | },
|
18 | {
|
19 | key: this.utils.getKey('门洞高'),
|
20 | label: '门洞高',
|
21 | type:'txt',
|
22 | tip: `范围应在${row[this.utils.getKey('门洞高最小值')]}~${row[this.utils.getKey('门洞高极限值')]}之间`,
|
23 | value: ""
|
24 | },
|
25 | {
|
26 | key: this.utils.getKey('门洞深'),
|
27 | label: '门洞深',
|
28 | type:'txt',
|
29 | tip: `范围应在${row[this.utils.getKey('门洞深最小值')]}~${row[this.utils.getKey('门洞深极限值')]}之间`,
|
30 | value: ""
|
31 | },
|
32 | {
|
33 | key: this.utils.getKey('是否开孔'),
|
34 | label: '是否开孔',
|
35 | type:'select',
|
36 | value: "",
|
37 | collections: [{
|
38 | label: '是',
|
39 | value: '是'
|
40 | }, {
|
41 | label: '否',
|
42 | value: '否'
|
43 | }]
|
44 | },
|
45 | {
|
46 | key: this.utils.getKey('合页'),
|
47 | label: '合页',
|
48 | type:'select',
|
49 | value: "",
|
50 | collections: row[this.utils.getKey('合页集合')] || []
|
51 | },
|
52 | {
|
53 | key: this.utils.getKey('门锁'),
|
54 | label: '门锁',
|
55 | type:'select',
|
56 | value: "",
|
57 | collections: row[this.utils.getKey('门锁集合')] || []
|
58 | },
|
59 | {
|
60 | key: this.utils.getKey('开启方向'),
|
61 | label: '开启方向',
|
62 | value: "",
|
63 | type:'select',
|
64 | collections: [{
|
65 | label: '左开',
|
66 | value: '左开'
|
67 | }, {
|
68 | label: '右开',
|
69 | value: '右开'
|
70 | }]
|
71 | }
|
72 | ]
|
73 |
|
74 | var validateMap = {
|
75 | [`${this.utils.getKey('门洞宽')}_valid`]: (value, fd, fo) => {
|
76 | let errorMsg = '';
|
77 | errorMsg = this.utils.staValidFun('门洞宽', value);
|
78 | errorMsg = this.utils.runAction([
|
79 | {condition : () => {return errorMsg}, msg: errorMsg},
|
80 | {condition : () => {return (value * 1 < row[this.utils.getKey('门洞宽最小值')] || value * 1 > row[this.utils.getKey('门洞宽极限值')])}, msg: `门洞宽${fo.tip}`}
|
81 | ]);
|
82 | return errorMsg;
|
83 | },
|
84 | [`${this.utils.getKey('门洞高')}_valid`]: (value, fd, fo) => {
|
85 | let errorMsg = '';
|
86 | errorMsg = this.utils.staValidFun('门洞高', value);
|
87 | errorMsg = this.utils.runAction([
|
88 | {condition : () => {return errorMsg}, msg: errorMsg},
|
89 | {condition : () => {return (value * 1 < row[this.utils.getKey('门洞高最小值')] || value * 1 > row[this.utils.getKey('门洞高极限值')])}, msg: `门洞高${fo.tip}`}
|
90 | ]);
|
91 | return errorMsg;
|
92 | },
|
93 | [`${this.utils.getKey('门洞深')}_valid`]: (value, fd, fo)=> {
|
94 | let errorMsg = '';
|
95 | errorMsg = this.utils.staValidFun('门洞深', value);
|
96 | errorMsg = this.utils.runAction([
|
97 | {condition : () => {return errorMsg}, msg: errorMsg},
|
98 | {condition : () => {return (value * 1 < row[this.utils.getKey('门洞深最小值')] || value * 1 > row[this.utils.getKey('门洞深极限值')])}, msg: `门洞深${fo.tip}`}
|
99 | ]);
|
100 | return errorMsg;
|
101 | },
|
102 | [`${this.utils.getKey('是否开孔')}_valid`]: (value) => {
|
103 |
|
104 | },
|
105 | [`${this.utils.getKey('合页')}_valid`]: (value, fd)=> {
|
106 | if (fd[this.utils.getKey('是否开孔')] == '否') {
|
107 | fd[this.utils.getKey('合页')] = '';
|
108 | return '';
|
109 | } else {
|
110 | let errorMsg = '';
|
111 | errorMsg = this.utils.staValidFun('合页', value);
|
112 | return errorMsg;
|
113 | }
|
114 | },
|
115 | [`${this.utils.getKey('门锁')}_valid`]: (value, fd) => {
|
116 | if (fd[this.utils.getKey('是否开孔')] == '否') {
|
117 | fd[this.utils.getKey('门锁')] = '';
|
118 | return '';
|
119 | } else {
|
120 | let errorMsg = '';
|
121 | errorMsg = this.utils.staValidFun('门锁', value);
|
122 | return errorMsg;
|
123 | }
|
124 | },
|
125 | [`${this.utils.getKey('开启方向')}_valid`]: (value, fd)=> {
|
126 | if (fd[this.utils.getKey('是否开孔')] == '否') {
|
127 | fd[this.utils.getKey('开启方向')] = '';
|
128 | return '';
|
129 | } else {
|
130 | let errorMsg = '';
|
131 | errorMsg = this.utils.staValidFun('开启方向', value);
|
132 | return errorMsg;
|
133 | }
|
134 | }
|
135 | }
|
136 | var self = this;
|
137 | return {
|
138 | validateMap: validateMap,
|
139 |
|
140 | refreshForm: function() {
|
141 | let formData = {};
|
142 | for (let i = 0; i < this.forms.length; i++) {
|
143 | let rone = this.forms[i];
|
144 | formData[rone.key] = rone.value;
|
145 | }
|
146 | this.forms.map((item) => {
|
147 |
|
148 | if(formData[self.utils.getKey('是否开孔')] == '否') {
|
149 |
|
150 | if([self.utils.getKey('合页'), self.utils.getKey('门锁'), self.utils.getKey('开启方向')].indexOf(item.key) != -1) Object.assign(item, {disabled: true});
|
151 | else Object.assign(item, {disabled: false});
|
152 | }
|
153 | else {
|
154 | Object.assign(item, {disabled: false});
|
155 | }
|
156 | })
|
157 | },
|
158 | codes: codes,
|
159 | forms: forms
|
160 |
|
161 | }
|
162 | } |
\ | No newline at end of file |