/**
 *@author       叶章浩
 *@date          15:17
 *@Copyright    天源迪科信息技术股份有限公司
 *@Description
 */
/*
Note 注册四个公共的属性池，属性、扩展属性（校验、扩展校验 暂不需要，通过添加数组方式追加）;commonTool 用来处理数据公共方法
 */


export const commonProperty = [
    {
        field: 'property.label',
        text: '标签',
        type: 'string',
    },
    {
        field: 'property.prop',
        text: '属性名称',
        type: 'reqSelect'
    }
];
export const commonExtend = [


];
/*
export const commonValidate = [
    {
        field: 'validate.required',
        text: 'required',
        type: 'boolean'
    },
    {
        field: 'validate.message',
        text: 'message',
        type: 'string'
    }
];
export const commonValidate2 = [
    {
        field: 'validate2.type',
        text: 'type',
        type: 'string'
    },
    {
        field: 'validate2.message',
        text: 'message',
        type: 'string'
    },
    {
        field: 'validate2.trigger',
        text: 'trigger',
        type: 'string'
    }
];
*/

export const commonTool = {
    assembleData:function(editors){
        this.mergeArr(editors,"属性",commonProperty);
        this.mergeArr(editors,"扩展属性",commonExtend);
      /*  this.mergeArr(editors,"校验规则",commonValidate);
        this.mergeArr(editors,"扩展校验",commonValidate2);*/
    },
    mergeArr:function(originalArr,key,propertyArr){
        let propertyIndex= _.indexOf(originalArr,key)+1;
        if(propertyIndex>0){
            for(let i=0;i<propertyArr.length;i++){
                originalArr.splice(propertyIndex, 0, propertyArr[i]);
            }
        }
    }
};
