project_feature_edit.js 958 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Created by zhang on 2018/9/3.
  3. */
  4. featureObj = {
  5. };
  6. $(document).ready(function () {
  7. $("#featureList").val(JSON.stringify(JSON.parse(featureList),null,4));
  8. $("#format").click( function() {
  9. try {
  10. let jsonText = $("#featureList").val();
  11. $("#featureList").val(JSON.stringify(JSON.parse(jsonText),null,4));
  12. }catch (err){
  13. console.log(err);
  14. alert("输入的JSON格式有误,请重新输入!");
  15. }
  16. })
  17. $("#save").click(async function() {
  18. try {
  19. let libID = $("#libID").val();
  20. let jsonText = $("#featureList").val();
  21. let newFeature = await ajaxPost("/projectFeature/saveLib",{query:{ID:libID},data:{feature:JSON.parse(jsonText)}});
  22. console.log(newFeature);
  23. }catch (err){
  24. console.log(err);
  25. alert("保存失败,请查看输入数据");
  26. }
  27. })
  28. });
  29. //featureObj.initSpread();