| | |
| | | import com.java110.code.BaseGenerator; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class GeneratorViewComponent extends BaseGenerator { |
| | | |
| | | public void generator(JSONObject data) { |
| | |
| | | StringBuffer thSb = new StringBuffer(); |
| | | |
| | | JSONArray columns = data.getJSONArray("columns"); |
| | | for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) { |
| | | JSONObject column = columns.getJSONObject(columnIndex); |
| | | |
| | | JSONArray cols = new JSONArray(); |
| | | JSONObject col = new JSONObject(); |
| | | col.put("cnCode", data.getString("templateKeyName")); |
| | | col.put("code", data.getString("templateKey")); |
| | | cols.addAll(columns); |
| | | for (int columnIndex = 0; columnIndex < cols.size(); columnIndex++) { |
| | | JSONObject column = cols.getJSONObject(columnIndex); |
| | | if(columnIndex % 3 == 0){ |
| | | thSb.append("<div class=\"row\">\n"); |
| | | } |
| | |
| | | thSb.append("<div class=\"col-sm-4\">\n" + |
| | | " <div class=\"form-group\">\n" + |
| | | " <label class=\"col-form-label\" >"+column.getString("cnCode")+":</label>\n" + |
| | | " <label class=\"\">{{view"+toUpperCaseFirstOne(column.getString("code"))+"Info."+column.getString("code")+"Id}}</label>\n" + |
| | | " <label class=\"\">{{view"+toUpperCaseFirstOne(data.getString("templateCode"))+"Info."+column.getString("code")+"}}</label>\n" + |
| | | " </div>\n" + |
| | | "</div>\n"); |
| | | |