yili-apps/com.actionsoft.apps.coe.pal/method/product.normal/diagram.schema.tpl
2022-06-27 22:14:40 +08:00

153 lines
7.1 KiB
Smarty

Schema.addCategory({name:"product_normal", text:"产品/服务图", dataAttributes:[]});
/*Production 上三角矩形,中间为实线*/
Schema.addShape({name:"product", title:"产品",text:"产品", category:"product_normal", props:{w:120, h:70}, textBlock:{x:"0", y:"Math.min(h/2,w/6)", w:"w", h:"h*0.75-Math.min(h/2,w/6)"},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, path:[
{actions:[
{action:"move", x:"w*0.5", y:"0"},
{action:"line", x:"w", y:"Math.min(h/2,w/6)"},
{action:"line", x:"w", y:"h"},
{action:"line", x:"0", y:"h"},
{action:"line", x:"0", y:"Math.min(h/2,w/6)"},
{action:"line", x:"w*0.5", y:"0"},
{action:"close"}
]},
{actions:[
{action:"move", x:"0", y:"h*0.75"},
{action:"line", x:"w", y:"h*0.75"}
]},
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:[
{action:"move", x:"w*0.5", y:"0"},
{action:"line", x:"w", y:"Math.min(h/2,w/6)"},
{action:"line", x:"w", y:"h"},
{action:"line", x:"0", y:"h"},
{action:"line", x:"0", y:"Math.min(h/2,w/6)"},
{action:"line", x:"w*0.5", y:"0"},
{action:"close"}
]}
]});
/*Production 上三角矩形,中间为虚线*/
Schema.addShape({name:"service", title:"服务",text:"服务", category:"product_normal", props:{w:120, h:70}, textBlock:{x:"0", y:"Math.min(h/2,w/6)", w:"w", h:"h*0.75-Math.min(h/2,w/6)"},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, path:[
{actions:[
{action:"move", x:"w*0.5", y:"0"},
{action:"line", x:"w", y:"Math.min(h/2,w/6)"},
{action:"line", x:"w", y:"h"},
{action:"line", x:"0", y:"h"},
{action:"line", x:"0", y:"Math.min(h/2,w/6)"},
{action:"line", x:"w*0.5", y:"0"},
{action:"close"}
]},
{lineStyle:{lineStyle:"dashed"}, actions:[
{action:"move", x:"0", y:"h*0.75"},
{action:"line", x:"w", y:"h*0.75"}
]},
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:[
{action:"move", x:"w*0.5", y:"0"},
{action:"line", x:"w", y:"Math.min(h/2,w/6)"},
{action:"line", x:"w", y:"h"},
{action:"line", x:"0", y:"h"},
{action:"line", x:"0", y:"Math.min(h/2,w/6)"},
{action:"line", x:"w*0.5", y:"0"},
{action:"close"}
]}
],
drawIcon: function(w, h) {
if (w < 36) {
return [
{actions:[
{action:"move", x:w*0.5, y:0},
{action:"line", x:w, y:Math.min(h/2,w/6)},
{action:"line", x:w, y:h},
{action:"line", x:0, y:h},
{action:"line", x:0, y:Math.min(h/2,w/6)},
{action:"line", x:w*0.5, y:0},
{action:"close"}
]},
{lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:0, y:h*0.75},
{action:"line", x:4, y:h*0.75},
{action:"move", x:6, y:h*0.75},
{action:"line", x:10, y:h*0.75},
{action:"move", x:12, y:h*0.75},
{action:"line", x:16, y:h*0.75},
{action:"move", x:18, y:h*0.75},
{action:"line", x:22, y:h*0.75},
{action:"move", x:24, y:h*0.75},
{action:"line", x:26, y:h*0.75}
]},
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:[
{action:"move", x:w*0.5, y:0},
{action:"line", x:w, y:Math.min(h/2,w/6)},
{action:"line", x:w, y:h},
{action:"line", x:0, y:h},
{action:"line", x:0, y:Math.min(h/2,w/6)},
{action:"line", x:w*0.5, y:0},
{action:"close"}
]}
]
} else {
return [
{actions:[
{action:"move", x:w*0.5, y:0},
{action:"line", x:w, y:Math.min(h/2,w/6)},
{action:"line", x:w, y:h},
{action:"line", x:0, y:h},
{action:"line", x:0, y:Math.min(h/2,w/6)},
{action:"line", x:w*0.5, y:0},
{action:"close"}
]},
{lineStyle:{lineStyle:"dashed"}, actions:[
{action:"move", x:0, y:h*0.75},
{action:"line", x:w, y:h*0.75}
]},
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:[
{action:"move", x:w*0.5, y:0},
{action:"line", x:w, y:Math.min(h/2,w/6)},
{action:"line", x:w, y:h},
{action:"line", x:0, y:h},
{action:"line", x:0, y:Math.min(h/2,w/6)},
{action:"line", x:w*0.5, y:0},
{action:"close"}
]}
]
}
}
});
/*Target 三个圆形*/
Schema.addShape({name:"target", title:"目标",text:"目标", category:"product_normal", props:{w:70, h:70}, textBlock:{x:"-20", y:"h", w:"w+40", h:"30"},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, path:[
{lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:"0", y:"h/2"},
{action:"curve", x1:"0", y1:"-h/6", x2:"w", y2:"-h/6", x:"w", y:"h/2"},
{action:"curve", x1:"w", y1:"h+h/6", x2:"0", y2:"h+h/6", x:"0", y:"h/2"},
{action:"close"}
]},
{lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:"w/6", y:"h/2"},
{action:"curve", x1:"w/6", y1:"-(h*2/3)/6+h/6", x2:"w*5/6", y2:"-(h*2/3)/6+h/6", x:"w*5/6", y:"h/2"},
{action:"curve", x1:"w*5/6", y1:"(h*2/3)+(h*2/3)/6+h/6", x2:"w/6", y2:"(h*2/3)+(h*2/3)/6+h/6", x:"w/6", y:"h/2"},
{action:"close"}
]},
{lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:"w/3", y:"h/2"},
{action:"curve", x1:"w/3", y1:"-(h/3)/6+h/3", x2:"w*2/3", y2:"-(h/3)/6+h/3", x:"w*2/3", y:"h/2"},
{action:"curve", x1:"w*2/3", y1:"h/3+(h/3)/6+h/3", x2:"w/3", y2:"h/3+(h/3)/6+h/3", x:"w/3", y:"h/2"},
{action:"close"}
]},
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:{ref:"round"}}
]});
/*Consumer 小人*/
Schema.addShape({name:"consumer", title:"消费者",text:"消费者", category:"product_normal", props:{w:70, h:100}, textBlock:{x:"-20", y:"h", w:"w+40", h:"30"},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, path:[
{actions:[
{action:"move", x:"w*(4/12)", y:"h*(1/8)"},
{action:"curve", x1:"w*(4/12)", y1:"-h*(2/8)*(1/6)", x2:"w*(8/12)", y2:"-h*(2/8)*(1/6)", x:"w*(8/12)", y:"h*(1/8)"},
{action:"curve", x1:"w*(8/12)", y1:"h*(2/8)*1/6+h*(2/8)", x2:"w*(4/12)", y2:"h*(2/8)*1/6+h*(2/8)", x:"w*(4/12)", y:"h*(1/8)"},
{action:"move", x:"w*(6/12)", y:"h*(2/8)"},
{action:"line", x:"w*(6/12)", y:"h*(6/8)"},
{action:"move", x:"w*(6/12)", y:"h*(6/8)"},
{action:"line", x:"w*(1/12)", y:"h"},
{action:"move", x:"w*(6/12)", y:"h*(6/8)"},
{action:"line", x:"w*(11/12)", y:"h"},
{action:"move", x:"0", y:"h*(4/8)"},
{action:"line", x:"w", y:"h*(4/8)"}
]},
{lineStyle:{lineWidth:0}, fillStyle:{type:"none"}, actions:{ref:"rectangle"}}
]});