package com.hzya.frame.sys.entity;


import com.alibaba.fastjson.JSONObject;

public class TemplateSaveFieldsOption {

	// id 唯一值 与后端沟通字段
	private String id;
	//type：select=下拉框 treeselect=树下拉框 radio=单选 input:输入框  datepick=日期输入  textrea =文本框（备注）
	private String type;
	// 前端显示字段
	private String title;
	// 搜索框排序
	private String searchSort;
	// 表格列排序
	private String tableSort;
	//// 是否禁用二次编辑 true为禁用
	private boolean disabled;
	//// 是否必填（新建、编辑）
	private boolean required;
	//// 正则校验 （没有这个属性即无正则）
	private String pattern;
	//// 正则校验不通过时提示语
	private String message;
	//宽度：一行一共24。例：一行两个为row:12 一行四个为row:6
	private int row;
	private String service;
	private String value;
	private String label;
	private String upId;
	private String maxlength;
	private String up;
	private String low;

	public  String getOptions(){
		JSONObject jsonObject = new JSONObject();
		if(this.id != null && !"".equals(this.id)) {
            jsonObject.put("id",this.id);
        }
		if(this.type != null && !"".equals(this.type)) {
            jsonObject.put("type",this.type);
        }
		if("treeselect".equals(this.type)){
			jsonObject.put("tooltip","true");
		}
		if("select".equals(this.type)){
			jsonObject.put("tooltip","true");
		}
		if(this.title != null && !"".equals(this.title)) {
            jsonObject.put("title",this.title);
        }
		if(this.searchSort != null && !"".equals(this.searchSort)) {
            jsonObject.put("searchSort",this.searchSort);
        }
		if(this.tableSort != null && !"".equals(this.tableSort)) {
            jsonObject.put("tableSort",this.tableSort);
        }
		jsonObject.put("maxlength",this.maxlength);
		jsonObject.put("disabled",this.disabled);
		jsonObject.put("required",this.required);
		if(this.pattern != null && !"".equals(this.pattern)) {
            jsonObject.put("pattern",this.pattern);
        }
		if(this.up != null && !"".equals(this.up)) {
            jsonObject.put("up",this.up);
        }
		if(this.low != null && !"".equals(this.low)) {
            jsonObject.put("low",this.low);
        }
		if(this.message != null && !"".equals(this.message)) {
            jsonObject.put("message",this.message);
        }
		jsonObject.put("row",this.row);
		if(this.service != null && !"".equals(this.service)) {
			jsonObject.put("service",this.service);
		}
		if(this.value != null && !"".equals(this.value)) {
			jsonObject.put("value",this.value);
		}
		if(this.label != null && !"".equals(this.label)) {
			jsonObject.put("label",this.label);
		}
		if(this.upId != null && !"".equals(this.upId)) {
			jsonObject.put("upId",this.upId);
		}
		return jsonObject.toJSONString();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getSearchSort() {
		return searchSort;
	}

	public void setSearchSort(String searchSort) {
		this.searchSort = searchSort;
	}

	public String getTableSort() {
		return tableSort;
	}

	public void setTableSort(String tableSort) {
		this.tableSort = tableSort;
	}

	public boolean isDisabled() {
		return disabled;
	}

	public void setDisabled(boolean disabled) {
		this.disabled = disabled;
	}

	public boolean isRequired() {
		return required;
	}

	public void setRequired(boolean required) {
		this.required = required;
	}

	public String getPattern() {
		return pattern;
	}

	public void setPattern(String pattern) {
		this.pattern = pattern;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public int getRow() {
		return row;
	}

	public void setRow(int row) {
		this.row = row;
	}

	public TemplateSaveFieldsOption() {
	}

	public String getService() {
		return service;
	}

	public void setService(String service) {
		this.service = service;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getLabel() {
		return label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getUpId() {
		return upId;
	}

	public void setUpId(String upId) {
		this.upId = upId;
	}

	public String getMaxlength() {
		return maxlength;
	}

	public void setMaxlength(String maxlength) {
		this.maxlength = maxlength;
	}

	public String getUp() {
		return up;
	}

	public void setUp(String up) {
		this.up = up;
	}

	public String getLow() {
		return low;
	}

	public void setLow(String low) {
		this.low = low;
	}

	public TemplateSaveFieldsOption(String up,String low,String maxlength, String id, String type, String title, String searchSort, String tableSort, boolean disabled, boolean required, String pattern, String message, int row, String service, String value, String label, String upId) {
		this.id = id;
		this.type = type;
		this.title = title;
		this.searchSort = searchSort;
		this.tableSort = tableSort;
		this.disabled = disabled;
		this.required = required;
		this.pattern = pattern;
		this.message = message;
		this.row = row;
		this.service = service;
		this.value = value;
		this.label = label;
		this.upId = upId;
		this.maxlength = maxlength;
		this.up = up;
		this.low = low;
	}
}
