123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136 |
- /**
- * Created by zhang on 2018/9/3.
- */
- $(document).ready(function () {
- const locked = lockUtil.getLocked();
- lockUtil.lockTools($(document.body), locked);
- try {
- let tem = sortJson(JSON.parse($("#originalFeature").val()));
- $("#templateLibs").val(JSON.stringify(tem.data,null,4));
- }catch (err){
- console.log(err);
- }
- $("#format").click( function() {
- try {
- let jsonText = $("#templateLibs").val();
- $("#templateLibs").val(JSON.stringify(JSON.parse(jsonText),null,4));
- }catch (err){
- console.log(err);
- alert("输入的JSON格式有误,请重新输入!");
- }
- });
- $("#save").click(async function() {
- try {
- let libID = $("#libID").val();
- let jsonText = $("#templateLibs").val();
- if(jsonText.indexOf("'")!=-1){
- alert("输入的格式不能包含 ' 位于:"+jsonText.substr(jsonText.indexOf("'")-15,18));
- return;
- }
- let newFeature = await ajaxPost("/monomerTemplate/saveLib",{query:{ID:libID},data:{data:JSON.parse(jsonText)}});
- }catch (err){
- console.log(err);
- alert("保存失败,请查看输入数据");
- }
- });
- $("#createNormal").click(()=>{
- $("#createNormal").click(async function() {
- let explorer =[
- {
- "dispName": "学校",
- "items": [
- {
- "dispName": "教学楼",
- "isHaveStructuralSegment": "true",
- "key": "academicBuilding",
- "monomerType": "building"
- },
- {
- "dispName": "体育馆",
- "isHaveStructuralSegment": "true",
- "key": "gymnasium",
- "monomerType": "building"
- },
- {
- "dispName": "食堂",
- "isHaveStructuralSegment": "true",
- "key": "Canteen",
- "monomerType": "building"
- },
- {
- "dispName": "集体宿舍",
- "isHaveStructuralSegment": "true",
- "key": "collectiveDormitory",
- "monomerType": "building"
- }
- ],
- "key": "school"
- },
- {
- "dispName": "医院",
- "items": [
- {
- "dispName": "门诊楼",
- "isHaveStructuralSegment": "true",
- "key": "outpatientBuilding",
- "monomerType": "building"
- },
- {
- "dispName": "住院楼",
- "isHaveStructuralSegment": "true",
- "key": "inpatientBuilding",
- "monomerType": "building"
- },
- {
- "dispName": "集体宿舍",
- "isHaveStructuralSegment": "true",
- "key": "collectiveDormitory",
- "monomerType": "building"
- }
- ],
- "key": "hospital"
- },
- {
- "dispName": "市政工程",
- "items": [
- {
- "dispName": "新建改建扩建",
- "isHaveStructuralSegment": "true",
- "key": "newConstruction",
- "monomerType": "civil"
- },
- {
- "dispName": "景观提升",
- "isHaveStructuralSegment": "true",
- "key": "landscapeImprovement",
- "monomerType": "civil"
- },
- {
- "dispName": "养护大中修",
- "isHaveStructuralSegment": "true",
- "key": "curing",
- "monomerType": "civil"
- },
- {
- "dispName": "小修保养",
- "isHaveStructuralSegment": "true",
- "key": "routineMaintenance",
- "monomerType": "civil"
- }
- ],
- "key": "municipalConstruction"
- }
- ];
- try {
- let jsonText = JSON.stringify(explorer);
- $("#templateLibs").val(JSON.stringify(JSON.parse(jsonText),null,4));
- }catch (err){
- console.log(err);
- }
- })
- })
- });
|