project_feature_edit.js 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /**
  2. * Created by zhang on 2018/9/3.
  3. */
  4. $(document).ready(function () {
  5. try {
  6. let tem = sortJson(JSON.parse($("#originalFeature").val()));
  7. $("#featureList").val(JSON.stringify(tem,null,4));
  8. }catch (err){
  9. console.log(err);
  10. }
  11. $("#format").click( function() {
  12. try {
  13. let jsonText = $("#featureList").val();
  14. $("#featureList").val(JSON.stringify(JSON.parse(jsonText),null,4));
  15. }catch (err){
  16. console.log(err);
  17. alert("输入的JSON格式有误,请重新输入!");
  18. }
  19. })
  20. $("#save").click(async function() {
  21. try {
  22. let libID = $("#libID").val();
  23. let jsonText = $("#featureList").val();
  24. if(jsonText.indexOf("'")!=-1){
  25. alert("输入的格式不能包含 ' 位于:"+jsonText.substr(jsonText.indexOf("'")-15,18));
  26. return;
  27. }
  28. let newFeature = await ajaxPost("/projectFeature/saveLib",{query:{ID:libID},data:{feature:JSON.parse(jsonText)}});
  29. }catch (err){
  30. console.log(err);
  31. alert("保存失败,请查看输入数据");
  32. }
  33. })
  34. $("#createNormal").click(async function() {
  35. let projectFeature = [
  36. {dispName: '工程专业', key: 'engineering', value: ''},//只读,用户新建单位工程时选择的值
  37. {dispName: '工程类型', key: 'projType', value: '',cellType:'comboBox',options:"住宅@公共建筑@厂房@办公"},
  38. {dispName: '结构类型', key: 'structureType', value: '',cellType:'comboBox',options:"排架结构@框架结构@现浇、框架结构@预制、砖混结构@外砖内模@内浇外挂@钢结构"},
  39. {dispName: '基础类型', key: 'baseType', value: '',cellType:'comboBox',options:"带基@框排架柱距6m以内@框排架柱距6m以外@满基筏式@满基板式@满基箱式@独立基础"},
  40. {dispName: '建筑特征', key: 'buildingFeature', value: '',cellType:'comboBox',options:"点式@凹式@凸式@Y式@其他"},
  41. {dispName: '建筑面积(m2)', key: 'buildingArea', value: '',cellType:'number'},
  42. {dispName: '其中地下室建筑面积(m2)', key: 'basementBuildingArea', value: '',cellType:'number'},
  43. {dispName: '总层数', key: 'totalFloors', value: '',cellType:'number'},
  44. {dispName: '地下室层数(+/-0.00以下)', key: 'basementFloors', value: '',cellType:'number'},
  45. {dispName: '建筑层数(+/-0.00以下)', key: 'buildingFloors', value: '',cellType:'number'},
  46. {dispName: '建筑物总高度(m)', key: 'buildingHeight', value: '',cellType:'number'},
  47. {dispName: '地下室总高度(m)', key: 'basementHeight', value: '',cellType:'number'},
  48. {dispName: '首层高度(m)', key: 'firstFloorHeight', value: '',cellType:'number'},
  49. {dispName: '裙楼高度(m)', key: 'podiumBuildingHeight', value: '',cellType:'number'},
  50. {dispName: '标准层高度(m)', key: 'standardFloorHeight', value: '',cellType:'number'},
  51. {dispName: '基础材料及装饰', key: 'baseMaterial', value: ''},
  52. {dispName: '楼地面材料及装饰', key: 'flooringMaterial', value: ''},
  53. {dispName: '外墙材料及装饰', key: 'exteriorWallMaterial', value: ''},
  54. {dispName: '屋面材料及装饰', key: 'roofingMaterial', value: ''},
  55. {dispName: '门窗材料及装饰', key: 'doorsWindowsMaterial', value: ''}
  56. ];
  57. try {
  58. let jsonText = JSON.stringify(projectFeature);
  59. $("#featureList").val(JSON.stringify(JSON.parse(jsonText),null,4));
  60. }catch (err){
  61. console.log(err);
  62. }
  63. })
  64. });