import { Injectable } from '@angular/core'; import { QueryCondition } from '../entity/querycondition'; @Injectable() export class SolutionService { constructor() { } getGuid() { return (this.s4() + this.s4() + "-" + this.s4() + "-" + this.s4() + "-" + this.s4() + "-" + this.s4() + this.s4() + this.s4()); } private s4() { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); } /** * 根据字段获取Lable控件的Title * @param field */ getConditionItemTitle(field: QueryCondition) { if (field.id && field.id !== '') { return field.fieldName; } } /** * 数组克隆 也可使用JSON.Parse(JSON.Stringify([input])),前提类结构中没有借口 * @param input */ arrayClone(input: Array): Array { let result = new Array(); if (input && input.length > 0) { input.forEach(element => { result.push(Object.assign({}, element)); }); } return result; } }