project_feature_edit.js 3.7 KB

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