| | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.code.BaseGenerator; |
| | | import com.java110.code.back.BaseGenerator; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | public class GeneratorEditComponent extends BaseGenerator { |
| | |
| | | JSONArray columns = data.getJSONArray("columns"); |
| | | for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) { |
| | | JSONObject column = columns.getJSONObject(columnIndex); |
| | | if (column.getBoolean("hasDefaultValue")) { |
| | | if ("none".equals(column.getString("inputType"))) { |
| | | continue; |
| | | } |
| | | String required = column.getBoolean("required") ? "必填" : "选填"; |
| | |
| | | " <option selected disabled value=\"\">"+ required + ",请选择" + column.getString("cnCode") + "</option>\n" + |
| | | " " +option+ |
| | | " </select>"; |
| | | } else { |
| | | } else if("textarea".equals(column.getString("inputType"))){ |
| | | inputStr = "<textarea placeholder=\"" + required + ",请填写" + column.getString("cnCode") + "\" class=\"form-control\""+ |
| | | " v-model=\"edit" + toUpperCaseFirstOne(data.getString("templateCode")) + "Info."+column.getString("code")+"\">"+ |
| | | "</textarea>"; |
| | | }else { |
| | | inputStr = " <input v-model=\"edit" + toUpperCaseFirstOne(data.getString("templateCode")) + "Info."+column.getString("code")+"\" " + |
| | | " type=\"text\" placeholder=\"" + required + ",请填写" + column.getString("cnCode") + "\" class=\"form-control\">\n"; |
| | | } |
| | |
| | | |
| | | |
| | | String writePath = this.getClass().getResource("/").getPath() |
| | | + "out/web/component/edit-" + data.getString("templateCode") + "/edit" + toUpperCaseFirstOne(data.getString("templateCode")) + ".html"; |
| | | + "out/web/component/"+data.getString("templateCode")+"Package/edit-" + data.getString("templateCode") + "/edit" + toUpperCaseFirstOne(data.getString("templateCode")) + ".html"; |
| | | System.out.printf("writePath: " + writePath); |
| | | writeFile(writePath, |
| | | fileContext); |
| | |
| | | |
| | | |
| | | String writePath = this.getClass().getResource("/").getPath() |
| | | + "out/web/component/edit-" + data.getString("templateCode") + "/edit" + toUpperCaseFirstOne(data.getString("templateCode")) + ".js"; |
| | | + "out/web/component/"+data.getString("templateCode")+"Package/edit-" + data.getString("templateCode") + "/edit" + toUpperCaseFirstOne(data.getString("templateCode")) + ".js"; |
| | | System.out.printf("writePath: " + writePath); |
| | | writeFile(writePath, |
| | | fileContext); |