1 | const utils = require('./varies/utils');
|
2 | let vArray = [];
|
3 | let v1 = require('./varies/v1.js');
|
4 | let v2 = require('./varies/v2.js');
|
5 | let v3 = require('./varies/v3.js');
|
6 | let v4 = require('./varies/v4.js');
|
7 | let v5 = require('./varies/v5.js');
|
8 | let v6 = require('./varies/v6.js');
|
9 | let v7 = require('./varies/v7.js');
|
10 | let v8 = require('./varies/v8.js');
|
11 | let v9 = require('./varies/v9.js');
|
12 | vArray.push(v1);
|
13 | vArray.push(v2);
|
14 | vArray.push(v3);
|
15 | vArray.push(v4);
|
16 | vArray.push(v5);
|
17 | vArray.push(v6);
|
18 | vArray.push(v7);
|
19 | vArray.push(v8);
|
20 | vArray.push(v9);
|
21 | (function(f) {
|
22 | module.exports = f;
|
23 | if(typeof(window) != 'undefined') window.ecomps = {actionFun: f}
|
24 | })(function(row, plant) {
|
25 | if(!plant) plant = 1;
|
26 | let funMap = {
|
27 | validate: function (newforms) {
|
28 | let realForms = newforms || this.forms;
|
29 |
|
30 | let formData = {};
|
31 | for (let i = 0; i < realForms.length; i++) {
|
32 | let rone = realForms[i];
|
33 | formData[rone.key] = rone.value;
|
34 | }
|
35 | let errorMsg = '';
|
36 | for (let i = 0; i < realForms.length; i++) {
|
37 | let rone = realForms[i];
|
38 | errorMsg = this.validateMap[rone.key+'_valid'](rone.value, formData, rone);
|
39 | if (errorMsg) break
|
40 | }
|
41 | return {
|
42 | errorMsg: errorMsg,
|
43 | formData: formData
|
44 | }
|
45 | }
|
46 | }
|
47 | vArray.map(function(v) {
|
48 | let utilsScope = v.prototype.utils = new utils(plant);
|
49 |
|
50 | let itemMap = new v(row);
|
51 | if(itemMap.codes.indexOf(row[utilsScope.getKey('三级分类')]) != -1) {
|
52 | Object.assign(funMap, itemMap);
|
53 | funMap.forms.map(function(item) {
|
54 | Object.assign(item, {disabled: false});
|
55 | })
|
56 | }
|
57 | })
|
58 | return funMap;
|
59 | })
|