簡介:
qtip是Jquery的一款提示插件,使用比較簡單,在Activiti工作流的流程追溯頁面使用到qtip插件。
使用步驟:
1、 下載qtip插件
http://qtip2.com/download
2、 下載的插件目錄
3、 一般情況下,將jquery.qtip.min.CSS和jquery.qtip.min.js放入項目中使用即可
4、 在頁面引入css和js
<link rel="stylesheet" href="${appName}/res/jquery.qtip.min.css"><script type="text/javascript" src="${appName}/res/jquery.qtip.min.js"></script>5、 需要加qtip提示的代碼片段(圖片映射代碼)<map id="imgHref" name="imgHref"><area id="usertask1" name="部門經理【審批】" type="userTask" shape="rect" coords="(97.0,167.0,233.0,222.0)" xposition="97.0px" yposition="167.0px" target="_blank" data-hasqtip="0" aria-describedby="qtip-0"><area id="exclusivegateway1" name="Exclusive Gateway" type="exclusiveGateway" shape="rect" coords="(144.0,249.0,184.0,289.0)" xposition="144.0px" yposition="249.0px" target="_blank"><area id="usertask2" name="人事【審批】" type="userTask" shape="rect" coords="(112.0,311.0,217.0,366.0)" xposition="112.0px" yposition="311.0px" target="_blank" data-hasqtip="1"><area id="exclusivegateway2" name="Exclusive Gateway" type="exclusiveGateway" shape="rect" coords="(144.0,391.0,184.0,431.0)" xposition="144.0px" yposition="391.0px" target="_blank"><area id="usertask3" name="經理聯合【審批】" type="userTask" shape="rect" coords="(96.0,465.0,234.0,520.0)" xposition="96.0px" yposition="465.0px" target="_blank" data-hasqtip="2"><area id="parallelgateway1_start" name="Parallel Gateway" type="parallelGateway" shape="rect" coords="(142.0,655.0,182.0,695.0)" xposition="142.0px" yposition="655.0px" target="_blank"><area id="usertask5" name="人事【報備】" type="userTask" shape="rect" coords="(5.0,711.0,110.0,766.0)" xposition="5.0px" yposition="711.0px" target="_blank" data-hasqtip="3"><area id="usertask6" name="部門【報備】" type="userTask" shape="rect" coords="(214.0,711.0,319.0,766.0)" xposition="214.0px" yposition="711.0px" target="_blank" data-hasqtip="4"><area id="usertask7" name="銷假" type="userTask" shape="rect" coords="(109.0,855.0,214.0,910.0)" xposition="109.0px" yposition="855.0px" target="_blank" data-hasqtip="5"><area id="exclusivegateway3" name="Exclusive Gateway" type="exclusiveGateway" shape="rect" coords="(144.0,575.0,184.0,615.0)" xposition="144.0px" yposition="575.0px" target="_blank"><area id="usertask8" name="提交申請" type="userTask" shape="rect" coords="(112.0,75.0,217.0,130.0)" xposition="112.0px" yposition="75.0px" target="_blank" data-hasqtip="6"><area id="parallelgateway1_end" name="Parallel Gateway" type="parallelGateway" shape="rect" coords="(144.0,775.0,184.0,815.0)" xposition="144.0px" yposition="775.0px" target="_blank"><area id="startevent1" name="Start" type="startEvent" shape="rect" coords="(147.0,5.0,182.0,40.0)" xposition="147.0px" yposition="5.0px" target="_blank"><area id="endevent1" name="End" type="endEvent" shape="rect" coords="(144.0,955.0,179.0,990.0)" xposition="144.0px" yposition="955.0px" target="_blank"></map>6、qtip在jquery內的使用$(function(){ $("area[type='userTask']").each(function (){ var nodeId=$(this).attr('id'); var PRocessInstanceId="${proc_inst_id_}"; $(this).qtip({ content:{ text:function (event,api){ $.Ajax({ url:'${appName}/workflow/workflowProcess/getActivityApprovalInfo.ajax', data:{proc_inst_id_:processInstanceId,task_def_key_:nodeId} }) .then(function(content) { if(content.length>0){ var content_text="<table border='1' width='260px;' height='50px;' style='text-align: center;font-size:12px;'>"; for(var i=0;i<content.length;i++){ content_text+="<tr><td width='115px;'>審批人:</td><td>"+content[i].assignee_+"</td></tr><tr><td>審批時間:</td><td>"+content[i].end_time_Disp+"</td></tr>" +"<tr><td>審批意見:</td><td>"+content[i].comment_message+"</td></tr>"; } content_text+="</table>"; api.set('content.text', content_text); }else{ api.set('content.text', "<div>暫無審批記錄</div>"); } }, function(xhr, status, error) { api.set('content.text', status + ': ' + error); }); return '正在加載...'; } }, position:{ target: 'mouse', adjust: { mouse: false } } }); }); });7、實現的效果
新聞熱點
疑難解答