tooth.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. (function($){
  2. $.fn.tooth = function(options){
  3. let toothId = this.initToothHtml(options);
  4. this.initPopup(toothId,options ? options.success : function(){});
  5. }
  6. $.fn.initToothHtml = function(options){
  7. let toothId = this.attr("id");
  8. let settings = $.extend({
  9. 'width': 192,
  10. 'height': 40,
  11. success: function(){}
  12. }, options);
  13. let tdWidth = Math.round(parseInt(settings.width-1)/2-1)-2;
  14. let tdHeight = Math.round(parseInt(settings.height)/2-1);
  15. let html ='<span class="tooth-all" id="tooth_all_'+toothId+'" contenteditable="false" style="width: '+settings.width+'px;">';
  16. html += '<span id="tooth_value_'+toothId+'" class="content" style="width: '+settings.width+'px;height: '+settings.height+'px;">';
  17. html += '<span class="div_td right_up" style="width: '+tdWidth+'px;height: '+tdHeight+'px;line-height: '+tdHeight+'px;"></span>';
  18. html += '<span class="div_td left_up" style="width: '+tdWidth+'px;height: '+tdHeight+'px;line-height: '+tdHeight+'px;"></span>';
  19. html += '<span class="div_td right_down" style="width: '+tdWidth+'px;height: '+tdHeight+'px;line-height: '+tdHeight+'px;"></span>';
  20. html += '<span class="div_td left_down" style="width: '+tdWidth+'px;height: '+tdHeight+'px;line-height: '+tdHeight+'px;"></span>';
  21. html += '</span>';
  22. html += '</span>';
  23. this.html(html);
  24. return toothId;
  25. }
  26. /**
  27. * 电子病历选择牙位使用
  28. */
  29. $.fn.initPopupByEmr = function(toothId,ele,callback,cancelCallback){
  30. //点击时弹出牙位选择
  31. if ($("#tooth_popup_div").length > 0) {
  32. // 存在删除
  33. $("#tooth_popup_div").remove();
  34. }
  35. $("#"+toothId).append(getPopupHtml());
  36. initPopupEvent(toothId,callback,cancelCallback);
  37. // 初始化
  38. // 右上
  39. setValueStyle($(ele).find(".right_up").html(),'rght_up');
  40. // 左上
  41. setValueStyle($(ele).find(".left_up").html(),'left_up');
  42. // 右下
  43. setValueStyle($(ele).find(".right_down").html(),'rght_down');
  44. // 左下
  45. setValueStyle($(ele).find(".left_down").html(),'left_down');
  46. }
  47. initPopupEvent = function(toothId,callback,cancelCallback){
  48. //关闭弹出窗口
  49. $("#tooth_popup_div .close_label").on("click",function(){
  50. $("#tooth_popup_div").remove();
  51. });
  52. //鼠标悬浮事件
  53. $(".wisdom-select span>label, .num-select span>label").hover(function(){
  54. $(this).toggleClass("num-select-hover");
  55. let classNm = "tooth_"+$(this).attr("position")+$(this).attr("value");
  56. $("."+classNm).toggleClass("drop-shadow");
  57. },function(){
  58. $(this).toggleClass("num-select-hover");
  59. let classNm = "tooth_"+$(this).attr("position")+$(this).attr("value");
  60. $("."+classNm).toggleClass("drop-shadow");
  61. });
  62. //选择效果
  63. $(".wisdom-select span>label, .num-select span>label").on("click",function(e){
  64. if(e){
  65. let target = e.currentTarget;
  66. //选择数字字母,有样式删除,无样式添加
  67. $(target).toggleClass("num-select-confirm");
  68. setToothClass($(target));
  69. }
  70. });
  71. //添加按钮事件
  72. setPopupButton();
  73. //确定
  74. $("#btnSure").on("click",function(){
  75. let allSelects = $(".num-select-confirm");
  76. if(!allSelects || allSelects.length == 0){
  77. return false;
  78. }
  79. // console.log(allSelects)
  80. let toothResult = {};
  81. // toothResult = [];
  82. allSelects.each(function(index,ele){
  83. let jele = $(ele)
  84. // console.log(ele,jele.attr("position"));
  85. let position = jele.attr("position");
  86. let type = jele.attr("type");
  87. let value = jele.attr("value");
  88. let obj = {
  89. position: position,
  90. type: type,
  91. value: value
  92. }
  93. // toothResult.push(obj);
  94. if(type == "letter"){
  95. //乳牙
  96. toothResult[position+"-"+type+"-"+value] = obj;
  97. } else {
  98. //恒牙
  99. toothResult[position+"-pmnt-"+value] = obj;
  100. }
  101. });
  102. //设置显示
  103. // id="tooth_value_'+toothId+'"
  104. //98765E4D3C2B1A
  105. let result = setResultHtml(toothResult,toothId)
  106. // console.log(toothResult);
  107. callback(result);
  108. $("#tooth_popup_div").remove();
  109. });
  110. //取消
  111. $("#btnCancel").on("click",function(){
  112. $("#tooth_popup_div").remove();
  113. if(cancelCallback){
  114. cancelCallback();
  115. }
  116. });
  117. //初始化
  118. initPopupValue(toothId);
  119. }
  120. $.fn.initPopup = function(toothId,callback){
  121. //点击时弹出牙位选择
  122. $("#tooth_value_"+toothId).on("click",function(){
  123. if ($("#tooth_popup_div").length > 0) {
  124. // 存在删除
  125. $("#tooth_popup_div").remove();
  126. }
  127. $("#tooth_all_"+toothId).append(getPopupHtml());
  128. initPopupEvent(toothId,callback);
  129. });
  130. }
  131. // 初始化
  132. function initPopupValue(toothId){
  133. // 右上
  134. setValueStyle($("#tooth_all_"+toothId+" .right_up").html(),'rght_up');
  135. // 左上
  136. setValueStyle($("#tooth_all_"+toothId+" .left_up").html(),'left_up');
  137. // 右下
  138. setValueStyle($("#tooth_all_"+toothId+" .right_down").html(),'rght_down');
  139. // 左下
  140. setValueStyle($("#tooth_all_"+toothId+" .left_down").html(),'left_down');
  141. }
  142. function setValueStyle(html,positionVal){
  143. if(html){
  144. let list = html.split("");
  145. list.forEach(value => {
  146. let type = "pmnt";
  147. if("ABCDE".indexOf(value) >= 0){
  148. type = "letter";
  149. }
  150. let position = positionVal;
  151. if(value == "9"){
  152. position = 'wisdom_'+positionVal;
  153. type = "wisdom";
  154. }
  155. let target = $("label[position='"+position+"'][type='"+type+"'][value='"+value+"']");
  156. if(target && target.length != 0){
  157. target.addClass("num-select-confirm");
  158. setToothClass(target);
  159. }
  160. });
  161. }
  162. }
  163. function setResultHtml(toothResult,toothId){
  164. let result = {};
  165. // 右上
  166. let rghtUpHtml = fmtVal(toothResult["wisdom_rght_up-pmnt-9"]);
  167. rghtUpHtml += fmtVal(toothResult["rght_up-pmnt-8"]);
  168. rghtUpHtml += fmtVal(toothResult["rght_up-pmnt-7"]);
  169. rghtUpHtml += fmtVal(toothResult["rght_up-pmnt-6"]);
  170. rghtUpHtml += fmtVal(toothResult["rght_up-pmnt-5"]);
  171. rghtUpHtml += fmtVal(toothResult["rght_up-letter-E"]);
  172. rghtUpHtml += fmtVal(toothResult["rght_up-pmnt-4"]);
  173. rghtUpHtml += fmtVal(toothResult["rght_up-letter-D"]);
  174. rghtUpHtml += fmtVal(toothResult["rght_up-pmnt-3"]);
  175. rghtUpHtml += fmtVal(toothResult["rght_up-letter-C"]);
  176. rghtUpHtml += fmtVal(toothResult["rght_up-pmnt-2"]);
  177. rghtUpHtml += fmtVal(toothResult["rght_up-letter-B"]);
  178. rghtUpHtml += fmtVal(toothResult["rght_up-pmnt-1"]);
  179. rghtUpHtml += fmtVal(toothResult["rght_up-letter-A"]);
  180. $("#tooth_all_"+toothId+" .right_up").html(rghtUpHtml);
  181. result["rght_up"] = rghtUpHtml;
  182. //左上
  183. let leftUpHtml = fmtVal(toothResult["left_up-pmnt-1"]);
  184. leftUpHtml += fmtVal(toothResult["left_up-letter-A"]);
  185. leftUpHtml += fmtVal(toothResult["left_up-pmnt-2"]);
  186. leftUpHtml += fmtVal(toothResult["left_up-letter-B"]);
  187. leftUpHtml += fmtVal(toothResult["left_up-pmnt-3"]);
  188. leftUpHtml += fmtVal(toothResult["left_up-letter-C"]);
  189. leftUpHtml += fmtVal(toothResult["left_up-pmnt-4"]);
  190. leftUpHtml += fmtVal(toothResult["left_up-letter-D"]);
  191. leftUpHtml += fmtVal(toothResult["left_up-pmnt-5"]);
  192. leftUpHtml += fmtVal(toothResult["left_up-letter-E"]);
  193. leftUpHtml += fmtVal(toothResult["left_up-pmnt-6"]);
  194. leftUpHtml += fmtVal(toothResult["left_up-pmnt-7"]);
  195. leftUpHtml += fmtVal(toothResult["left_up-pmnt-8"]);
  196. leftUpHtml += fmtVal(toothResult["wisdom_left_up-pmnt-9"]);
  197. $("#tooth_all_"+toothId+" .left_up").html(leftUpHtml);
  198. result["left_up"] = leftUpHtml;
  199. // 右下
  200. let rghtDownHtml = fmtVal(toothResult["wisdom_rght_down-pmnt-9"]);
  201. rghtDownHtml += fmtVal(toothResult["rght_down-pmnt-8"]);
  202. rghtDownHtml += fmtVal(toothResult["rght_down-pmnt-7"]);
  203. rghtDownHtml += fmtVal(toothResult["rght_down-pmnt-6"]);
  204. rghtDownHtml += fmtVal(toothResult["rght_down-pmnt-5"]);
  205. rghtDownHtml += fmtVal(toothResult["rght_down-letter-E"]);
  206. rghtDownHtml += fmtVal(toothResult["rght_down-pmnt-4"]);
  207. rghtDownHtml += fmtVal(toothResult["rght_down-letter-D"]);
  208. rghtDownHtml += fmtVal(toothResult["rght_down-pmnt-3"]);
  209. rghtDownHtml += fmtVal(toothResult["rght_down-letter-C"]);
  210. rghtDownHtml += fmtVal(toothResult["rght_down-pmnt-2"]);
  211. rghtDownHtml += fmtVal(toothResult["rght_down-letter-B"]);
  212. rghtDownHtml += fmtVal(toothResult["rght_down-pmnt-1"]);
  213. rghtDownHtml += fmtVal(toothResult["rght_down-letter-A"]);
  214. $("#tooth_all_"+toothId+" .right_down").html(rghtDownHtml);
  215. result["rght_down"] = rghtDownHtml;
  216. //左下
  217. let leftDownHtml = fmtVal(toothResult["left_down-pmnt-1"]);
  218. leftDownHtml += fmtVal(toothResult["left_down-letter-A"]);
  219. leftDownHtml += fmtVal(toothResult["left_down-pmnt-2"]);
  220. leftDownHtml += fmtVal(toothResult["left_down-letter-B"]);
  221. leftDownHtml += fmtVal(toothResult["left_down-pmnt-3"]);
  222. leftDownHtml += fmtVal(toothResult["left_down-letter-C"]);
  223. leftDownHtml += fmtVal(toothResult["left_down-pmnt-4"]);
  224. leftDownHtml += fmtVal(toothResult["left_down-letter-D"]);
  225. leftDownHtml += fmtVal(toothResult["left_down-pmnt-5"]);
  226. leftDownHtml += fmtVal(toothResult["left_down-letter-E"]);
  227. leftDownHtml += fmtVal(toothResult["left_down-pmnt-6"]);
  228. leftDownHtml += fmtVal(toothResult["left_down-pmnt-7"]);
  229. leftDownHtml += fmtVal(toothResult["left_down-pmnt-8"]);
  230. leftDownHtml += fmtVal(toothResult["wisdom_left_down-pmnt-9"]);
  231. $("#tooth_all_"+toothId+" .left_down").html(leftDownHtml);
  232. result["left_down"] = leftDownHtml;
  233. return result;
  234. }
  235. function fmtVal(value){
  236. if(value){
  237. return value.value;
  238. }
  239. return "";
  240. }
  241. // 选中数字 或者字母时,设置牙齿的样式
  242. function setToothClass(ele){
  243. let key = ele.attr("value");
  244. let isSelect1 = ele.hasClass("num-select-confirm");
  245. let isSelect2 = null;
  246. if(ele.attr("type") == "letter"){
  247. switch (key) {
  248. case "A":
  249. key = "1";
  250. break;
  251. case "B":
  252. key = "2";
  253. break;
  254. case "C":
  255. key = "3";
  256. break;
  257. case "D":
  258. key = "4";
  259. break;
  260. case "E":
  261. key = "5";
  262. break;
  263. default:
  264. break;
  265. }
  266. isSelect2 = $("label[position='"+ele.attr("position")+"'][type='pmnt'][value='"+key+"']").hasClass("num-select-confirm");
  267. } else {
  268. switch (key) {
  269. case "1":
  270. key = "A";
  271. break;
  272. case "2":
  273. key = "B";
  274. break;
  275. case "3":
  276. key = "C";
  277. break;
  278. case "4":
  279. key = "D";
  280. break;
  281. case "5":
  282. key = "E";
  283. break;
  284. default:
  285. break;
  286. }
  287. isSelect2 = $("label[position='"+ele.attr("position")+"'][type='letter'][value='"+key+"']").hasClass("num-select-confirm");
  288. }
  289. // console.log("isSelect1="+isSelect1,"isSelect2="+isSelect2)
  290. //数字或者字母有一天选择,则牙齿选中
  291. let classNm = "tooth_"+ele.attr("position")+key;
  292. // console.log("classNm=",classNm)
  293. if(isSelect1 || isSelect2){
  294. //选择牙齿
  295. $("."+classNm).addClass("drop-shadow-confirm");
  296. } else {
  297. $("."+classNm).removeClass("drop-shadow-confirm");
  298. }
  299. }
  300. function getPopupHtml(){
  301. let html = '<div id="tooth_popup_div">';
  302. html += '<div class="title">选择牙位<label class="close_label" title="关闭"><span class="close"></span></label></div>';
  303. html += '<div class="header">';
  304. html += '<button type="button" id="btnMilkTeeth">乳牙</button>';
  305. html += '<button type="button" id="btnAllTeeth">全口</button>';
  306. html += '<button type="button" id="btnLeftUpTeeth">左上</button>';
  307. html += '<button type="button" id="btnLeftDownTeeth">左下</button>';
  308. html += '<button type="button" id="btnRghtUpTeeth">右上</button>';
  309. html += '<button type="button" id="btnRghtDownTeeth">右下</button>';
  310. html += '<button type="button" id="btnUpHalfTeeth">上半口</button>';
  311. html += '<button type="button" id="btnDownHalfTeeth">下半口</button>';
  312. html += '<button type="button" id="btnClearTeeth">清除</button>';
  313. html += '</div>';
  314. html += '<div class="content">';
  315. //右上牙图
  316. html += '<div class="div_td tooth-image" id="tooth_rght_up">';
  317. html += '<span class="tooth_rght_up8"></span>';
  318. html += '<span class="tooth_rght_up7"></span>';
  319. html += '<span class="tooth_rght_up6"></span>';
  320. html += '<span class="tooth_rght_up5 tooth_rght_upE"></span>';
  321. html += '<span class="tooth_rght_up4 tooth_rght_upD"></span>';
  322. html += '<span class="tooth_rght_up3 tooth_rght_upC"></span>';
  323. html += '<span class="tooth_rght_up2 tooth_rght_upB"></span>';
  324. html += '<span class="tooth_rght_up1 tooth_rght_upA"></span>';
  325. html += '</div>';
  326. //左上牙图
  327. html += '<div class="div_td tooth-image" id="tooth_left_up">';
  328. html += '<span class="tooth_left_up1 tooth_left_upA"></span>';
  329. html += '<span class="tooth_left_up2 tooth_left_upB"></span>';
  330. html += '<span class="tooth_left_up3 tooth_left_upC"></span>';
  331. html += '<span class="tooth_left_up4 tooth_left_upD"></span>';
  332. html += '<span class="tooth_left_up5 tooth_left_upE"></span>';
  333. html += '<span class="tooth_left_up6"></span>';
  334. html += '<span class="tooth_left_up7"></span>';
  335. html += '<span class="tooth_left_up8"></span>';
  336. html += '</div>';
  337. //右上选择
  338. html += '<div class="div_td right_up" style="height:60px;line-height: 60px;padding-bottom: 10px;">';
  339. //数字选择
  340. html += '<div class="num-select">'
  341. html += '<span><label position="rght_up" type="pmnt" value="8">8</label></span>';
  342. html += '<span><label position="rght_up" type="pmnt" value="7">7</label></span>';
  343. html += '<span><label position="rght_up" type="pmnt" value="6">6</label></span>';
  344. html += '<span><label position="rght_up" type="pmnt" value="5">5</label></span>';
  345. html += '<span><label position="rght_up" type="pmnt" value="4">4</label></span>';
  346. html += '<span><label position="rght_up" type="pmnt" value="3">3</label></span>';
  347. html += '<span><label position="rght_up" type="pmnt" value="2">2</label></span>';
  348. html += '<span><label position="rght_up" type="pmnt" value="1">1</label></span>';
  349. html += '</div>';
  350. //字母选择
  351. html += '<div class="num-select">'
  352. html += '<span></span>';
  353. html += '<span></span>';
  354. html += '<span></span>';
  355. html += '<span><label position="rght_up" type="letter" value="E">E</label></span>';
  356. html += '<span><label position="rght_up" type="letter" value="D">D</label></span>';
  357. html += '<span><label position="rght_up" type="letter" value="C">C</label></span>';
  358. html += '<span><label position="rght_up" type="letter" value="B">B</label></span>';
  359. html += '<span><label position="rght_up" type="letter" value="A">A</label></span>';
  360. html += '</div>';
  361. html += '</div>';
  362. //左上选择
  363. html += '<div class="div_td left_up" style="height:60px;line-height: 60px;padding-bottom: 10px;">';
  364. //数字选择
  365. html += '<div class="num-select">'
  366. html += '<span><label position="left_up" type="pmnt" value="1">1</label></span>';
  367. html += '<span><label position="left_up" type="pmnt" value="2">2</label></span>';
  368. html += '<span><label position="left_up" type="pmnt" value="3">3</label></span>';
  369. html += '<span><label position="left_up" type="pmnt" value="4">4</label></span>';
  370. html += '<span><label position="left_up" type="pmnt" value="5">5</label></span>';
  371. html += '<span><label position="left_up" type="pmnt" value="6">6</label></span>';
  372. html += '<span><label position="left_up" type="pmnt" value="7">7</label></span>';
  373. html += '<span><label position="left_up" type="pmnt" value="8">8</label></span>';
  374. html += '</div>';
  375. //字母选择
  376. html += '<div class="num-select">'
  377. html += '<span><label position="left_up" type="letter" value="A">A</label></span>';
  378. html += '<span><label position="left_up" type="letter" value="B">B</label></span>';
  379. html += '<span><label position="left_up" type="letter" value="C">C</label></span>';
  380. html += '<span><label position="left_up" type="letter" value="D">D</label></span>';
  381. html += '<span><label position="left_up" type="letter" value="E">E</label></span>';
  382. html += '<span></span>';
  383. html += '<span></span>';
  384. html += '<span></span>';
  385. html += '</div>';
  386. html += '</div>';
  387. // 右下选择
  388. html += '<div class="div_td right_down" style="height:60px;line-height: 60px;padding-top: 10px;">';
  389. //字母选择
  390. html += '<div class="num-select">'
  391. html += '<span></span>';
  392. html += '<span></span>';
  393. html += '<span></span>';
  394. html += '<span><label position="rght_down" type="letter" value="E">E</label></span>';
  395. html += '<span><label position="rght_down" type="letter" value="D">D</label></span>';
  396. html += '<span><label position="rght_down" type="letter" value="C">C</label></span>';
  397. html += '<span><label position="rght_down" type="letter" value="B">B</label></span>';
  398. html += '<span><label position="rght_down" type="letter" value="A">A</label></span>';
  399. html += '</div>';
  400. //数字选择
  401. html += '<div class="num-select">'
  402. html += '<span><label position="rght_down" type="pmnt" value="8">8</label></span>';
  403. html += '<span><label position="rght_down" type="pmnt" value="7">7</label></span>';
  404. html += '<span><label position="rght_down" type="pmnt" value="6">6</label></span>';
  405. html += '<span><label position="rght_down" type="pmnt" value="5">5</label></span>';
  406. html += '<span><label position="rght_down" type="pmnt" value="4">4</label></span>';
  407. html += '<span><label position="rght_down" type="pmnt" value="3">3</label></span>';
  408. html += '<span><label position="rght_down" type="pmnt" value="2">2</label></span>';
  409. html += '<span><label position="rght_down" type="pmnt" value="1">1</label></span>';
  410. html += '</div>';
  411. html += '</div>';
  412. // 左下选择
  413. html += '<div class="div_td left_down" style="height:60px;line-height: 60px;padding-top: 10px;">';
  414. //字母选择
  415. html += '<div class="num-select">'
  416. html += '<span><label position="left_down" type="letter" value="A">A</label></span>';
  417. html += '<span><label position="left_down" type="letter" value="B">B</label></span>';
  418. html += '<span><label position="left_down" type="letter" value="C">C</label></span>';
  419. html += '<span><label position="left_down" type="letter" value="D">D</label></span>';
  420. html += '<span><label position="left_down" type="letter" value="E">E</label></span>';
  421. html += '<span></span>';
  422. html += '<span></span>';
  423. html += '<span></span>';
  424. html += '</div>';
  425. //数字选择
  426. html += '<div class="num-select">'
  427. html += '<span><label position="left_down" type="pmnt" value="1">1</label></span>';
  428. html += '<span><label position="left_down" type="pmnt" value="2">2</label></span>';
  429. html += '<span><label position="left_down" type="pmnt" value="3">3</label></span>';
  430. html += '<span><label position="left_down" type="pmnt" value="4">4</label></span>';
  431. html += '<span><label position="left_down" type="pmnt" value="5">5</label></span>';
  432. html += '<span><label position="left_down" type="pmnt" value="6">6</label></span>';
  433. html += '<span><label position="left_down" type="pmnt" value="7">7</label></span>';
  434. html += '<span><label position="left_down" type="pmnt" value="8">8</label></span>';
  435. html += '</div>';
  436. html += '</div>';
  437. //右下牙图
  438. html += '<div class="div_td tooth-image" id="tooth_rght_down">';
  439. html += '<span class="tooth_rght_down8"></span>';
  440. html += '<span class="tooth_rght_down7"></span>';
  441. html += '<span class="tooth_rght_down6"></span>';
  442. html += '<span class="tooth_rght_down5 tooth_rght_downE"></span>';
  443. html += '<span class="tooth_rght_down4 tooth_rght_downD"></span>';
  444. html += '<span class="tooth_rght_down3 tooth_rght_downC"></span>';
  445. html += '<span class="tooth_rght_down2 tooth_rght_downB"></span>';
  446. html += '<span class="tooth_rght_down1 tooth_rght_downA"></span>';
  447. html += '</div>';
  448. //左下牙图
  449. html += '<div class="div_td tooth-image" id="tooth_left_down">';
  450. html += '<span class="tooth_left_down1 tooth_left_downA"></span>';
  451. html += '<span class="tooth_left_down2 tooth_left_downB"></span>';
  452. html += '<span class="tooth_left_down3 tooth_left_downC"></span>';
  453. html += '<span class="tooth_left_down4 tooth_left_downD"></span>';
  454. html += '<span class="tooth_left_down5 tooth_left_downE"></span>';
  455. html += '<span class="tooth_left_down6"></span>';
  456. html += '<span class="tooth_left_down7"></span>';
  457. html += '<span class="tooth_left_down8"></span>';
  458. html += '</div>';
  459. //智齿
  460. html += '<div class="wisdom-select" id="wisdom_tooth">';
  461. html += '<span><label position="wisdom_rght_up" type="wisdom" value="9">19</label></span>';
  462. html += '<span><label position="wisdom_left_up" type="wisdom" value="9">29</label></span>';
  463. html += '<span><label position="wisdom_left_down" type="wisdom" value="9">39</label></span>';
  464. html += '<span><label position="wisdom_rght_down" type="wisdom" value="9">49</label></span>';
  465. html += '</div>';
  466. html += '</div>';
  467. //按钮
  468. html += '<div class="footer">';
  469. html += '<button type="button" id="btnSure">确定</button>';
  470. html += '<button type="button" id="btnCancel">取消</button>';
  471. html += '</div>';
  472. html += '</div>';
  473. return html;
  474. }
  475. function setPopupButton(){
  476. // 左上
  477. function setLeftUpTeeth(){
  478. //数字
  479. $("label[position='left_up'][type='pmnt']").addClass("num-select-confirm");
  480. //牙齿
  481. $("#tooth_left_up span").addClass("drop-shadow-confirm");
  482. }
  483. // 左下
  484. function setLeftDownTeeth(){
  485. //数字
  486. $("label[position='left_down'][type='pmnt']").addClass("num-select-confirm");
  487. //牙齿
  488. $("#tooth_left_down span").addClass("drop-shadow-confirm");
  489. }
  490. // 右上
  491. function setRghtUpTeeth(){
  492. //数字
  493. $("label[position='rght_up'][type='pmnt']").addClass("num-select-confirm");
  494. //牙齿
  495. $("#tooth_rght_up span").addClass("drop-shadow-confirm");
  496. }
  497. // 右下
  498. function setRghtDownTeeth(){
  499. //数字
  500. $("label[position='rght_down'][type='pmnt']").addClass("num-select-confirm");
  501. //牙齿
  502. $("#tooth_rght_down span").addClass("drop-shadow-confirm");
  503. }
  504. function clearSelect(){
  505. $(".drop-shadow-confirm").removeClass("drop-shadow-confirm");
  506. $(".num-select-confirm").removeClass("num-select-confirm");
  507. }
  508. //乳牙
  509. $("#btnMilkTeeth").on("click",function(){
  510. clearSelect();
  511. //字母
  512. $("label[position='left_up'][type='letter']").addClass("num-select-confirm");
  513. $("label[position='left_down'][type='letter']").addClass("num-select-confirm");
  514. $("label[position='rght_up'][type='letter']").addClass("num-select-confirm");
  515. $("label[position='rght_down'][type='letter']").addClass("num-select-confirm");
  516. for(let i=1;i<=5;i++){
  517. //数字
  518. // $("label[position='left_up'][value='"+i+"']").addClass("num-select-confirm");
  519. // $("label[position='left_down'][value='"+i+"']").addClass("num-select-confirm");
  520. // $("label[position='rght_up'][value='"+i+"']").addClass("num-select-confirm");
  521. // $("label[position='rght_down'][value='"+i+"']").addClass("num-select-confirm");
  522. //牙齿
  523. $(".tooth_left_up"+i).addClass("drop-shadow-confirm");
  524. $(".tooth_left_down"+i).addClass("drop-shadow-confirm");
  525. $(".tooth_rght_up"+i).addClass("drop-shadow-confirm");
  526. $(".tooth_rght_down"+i).addClass("drop-shadow-confirm");
  527. }
  528. });
  529. //全口
  530. $("#btnAllTeeth").on("click",function(){
  531. clearSelect();
  532. setLeftUpTeeth();
  533. setLeftDownTeeth();
  534. setRghtUpTeeth();
  535. setRghtDownTeeth();
  536. });
  537. //左上
  538. $("#btnLeftUpTeeth").on("click",function(){
  539. clearSelect()
  540. setLeftUpTeeth();
  541. });
  542. //左下
  543. $("#btnLeftDownTeeth").on("click",function(){
  544. clearSelect()
  545. setLeftDownTeeth();
  546. });
  547. //右上
  548. $("#btnRghtUpTeeth").on("click",function(){
  549. clearSelect()
  550. setRghtUpTeeth();
  551. });
  552. //右下
  553. $("#btnRghtDownTeeth").on("click",function(){
  554. clearSelect()
  555. setRghtDownTeeth();
  556. });
  557. //上半口
  558. $("#btnUpHalfTeeth").on("click",function(){
  559. clearSelect()
  560. setLeftUpTeeth();
  561. setRghtUpTeeth();
  562. });
  563. //下半口
  564. $("#btnDownHalfTeeth").on("click",function(){
  565. clearSelect()
  566. setLeftDownTeeth();
  567. setRghtDownTeeth();
  568. });
  569. //清除
  570. $("#btnClearTeeth").on("click",function(){
  571. clearSelect();
  572. });
  573. }
  574. })(jQuery);