AllformModel.class.php 228 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author cy 2021-05-24
  12. * @desc 万能表单管理
  13. *
  14. */
  15. namespace Seller\Model;
  16. class AllformModel{
  17. /**
  18. * @author cy 2021-05-24
  19. * @desc 获取万能表单信息
  20. * @param $id
  21. * @return mixed
  22. */
  23. public function getFormsById($id){
  24. $forms_data = M('lionfish_comshop_forms')->where( array('id' => $id) )->find();
  25. return $forms_data;
  26. }
  27. /**
  28. * @author cy 2021-05-25
  29. * @desc 通过条件获取表单信息
  30. * @param $condition
  31. * @return mixed
  32. */
  33. public function getFormsByWhere($condition){
  34. $forms_data = M('lionfish_comshop_forms')->where($condition)->find();
  35. return $forms_data;
  36. }
  37. /**
  38. * @author cy 2021-04-30
  39. * @desc 表单类型名称
  40. * @param $form_type
  41. * @return string
  42. */
  43. public function getFormTypeName($form_type){
  44. $form_type_text = "";
  45. switch ($form_type){
  46. case 'goods':
  47. $form_type_text = '商品表单';
  48. break;
  49. case 'order':
  50. $form_type_text = '下单表单';
  51. break;
  52. case 'apply':
  53. $form_type_text = '申请表单';
  54. break;
  55. }
  56. return $form_type_text;
  57. }
  58. /**
  59. * @author cy 2021-05-19
  60. * @desc 获取已收集的表单数
  61. * @param $form_id
  62. * @return mixed
  63. */
  64. public function getFormInfoCountByFormId($form_id){
  65. $count = M('lionfish_comshop_form_info')->where( array('form_id' => $form_id) )->count();
  66. return $count;
  67. }
  68. /**
  69. * @author cy 2021-05-25
  70. * @desc 删除表单信息
  71. * @param $form_id
  72. * @return mixed
  73. */
  74. public function deleteForm($form_id){
  75. $result = [];
  76. $res = M('lionfish_comshop_forms')->where( array('id' => $form_id) )->delete();
  77. if($res !== false){
  78. $result['code'] = 1;
  79. }else{
  80. $result['code'] = 0;
  81. $result['message'] = '删除失败';
  82. }
  83. return $result;
  84. }
  85. public function queryList($gpc){
  86. $page = isset($gpc['page']) ? intval($gpc['page']) : 1;
  87. $page = max(1, $page);
  88. $page_size = 10;
  89. $keyword = $gpc['keyword'];
  90. $type = $gpc['type'];
  91. $is_ajax = $gpc['is_ajax'];
  92. $template = $gpc['template'];
  93. $is_ajax = !empty($is_ajax) ? intval($is_ajax) : 0;
  94. $condition = " ";
  95. if(!empty( $keyword )){
  96. $keyword = trim($keyword);
  97. $condition .= " and form_name like '%".$keyword."%'";
  98. }
  99. if(!empty($type)){
  100. $condition .= " and form_type = '".$type."'";
  101. }
  102. $sql = 'SELECT * FROM ' . C('DB_PREFIX') . 'lionfish_comshop_forms WHERE 1 ' . $condition .
  103. ' order by id desc' .' limit ' . (($page - 1) * $page_size) . ',' . $page_size;
  104. $list = M()->query($sql);
  105. $total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX').'lionfish_comshop_forms WHERE 1 ' . $condition );
  106. $total = $total_arr[0]['count'];
  107. $ret_html = "<tr>
  108. <th style=\"color:#000;\">表单名称</th>
  109. <th style=\"color:#000;\">表单类型</th>
  110. <th style=\"color:#000;\">操作</th>
  111. </tr>";
  112. foreach ($list as &$value) {
  113. $value['form_type_name'] = $this->getFormTypeName($value['form_type']);
  114. $ret_html .= '<tr>';
  115. $ret_html .= ' <td>'. $value['form_name'].'</td>';
  116. $ret_html .= ' <td>'.$this->getFormTypeName($value['form_type']).'</td>';
  117. if ( isset($template) && $template == 'mult' ) {
  118. $ret_html.=' <td style="width:80px;"><a href="javascript:;" class="choose_mult_link" data-json=\''.json_encode($value).'\'>选择</a></td>';
  119. }else{
  120. $ret_html.=' <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json=\''.json_encode($value).'\'>选择</a></td>';
  121. }
  122. $ret_html .= '</tr>';
  123. }
  124. $pager = pagination($total, $page, $page_size,'',$context = array('before' => 5, 'after' => 4, 'isajax' => 1));
  125. if( $is_ajax == 1 )
  126. {
  127. return ['html' => $ret_html, 'pager' => $pager ];
  128. }else{
  129. return ['list' => $list, 'pager' => $pager ];
  130. }
  131. }
  132. public function getDataList($gpc){
  133. $page = isset($gpc['page']) ? intval($gpc['page']) : 1;
  134. $page_size = 10;
  135. //会员昵称
  136. $keyword = $gpc['keyword'];
  137. //表单id
  138. $id = $gpc['id'];
  139. $condition = " and f.form_id = ".$id;
  140. $sqlcondition = "";
  141. if (!empty( $keyword )) {
  142. $keyword = trim($keyword);
  143. $condition .= ' AND (locate('.$keyword.',m.username) > 0 ) and f.user_id > 0 ';
  144. $sqlcondition .= ' left join ' . C('DB_PREFIX') . 'lionfish_comshop_member m on m.member_id = f.user_id ';
  145. }
  146. $sql = 'SELECT f.* FROM ' . C('DB_PREFIX') . 'lionfish_comshop_form_info as f '.$sqlcondition.' WHERE 1 ' . $condition .
  147. ' order by f.id desc' .' limit ' . (($page - 1) * $page_size) . ',' . $page_size;
  148. $list = M()->query($sql);
  149. $total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX').'lionfish_comshop_form_info as f '.$sqlcondition.' WHERE 1 ' . $condition );
  150. $total = $total_arr[0]['count'];
  151. if( !empty($list) )
  152. {
  153. foreach( $list as $k=>$item )
  154. {
  155. $member_info = M('lionfish_comshop_member')->where( array('member_id' => $item['user_id'] ) )->find();
  156. if(!empty($member_info)){
  157. $list[$k]['username'] = $member_info['username'];
  158. }
  159. $list[$k]['addtime'] = date('Y-m-d H:i:s',$item['addtime']);
  160. $list[$k]['form_type_name'] = $this->getFormTypeName($item['form_type']);
  161. }
  162. }
  163. $pager = pagination2($total, $page, $page_size);
  164. //表单信息
  165. $form_data = $this->getFormsById($id);
  166. $need_data = ['list' => $list, 'pager' => $pager, 'form_info'=>$form_data ];
  167. return $need_data;
  168. }
  169. /**
  170. * @author cy 2021-05-26
  171. * @desc 获取已收集的表单数据列表
  172. * @param $form_id
  173. * @return mixed
  174. */
  175. public function getFormInfoListByFormId($form_id){
  176. $form_info_list = M('lionfish_comshop_form_info')->where(array('form_id' => $form_id))->select();
  177. return $form_info_list;
  178. }
  179. /**
  180. * @author cy 2021-05-26
  181. * @desc 获取已收集的表单数据项列表
  182. * @param $form_id
  183. * @return mixed
  184. */
  185. public function getFormItemListByFormId($form_id){
  186. $form_item_list = M('lionfish_comshop_form_item')->where(array('form_id' => $form_id))->order('id asc')->select();
  187. return $form_item_list;
  188. }
  189. /**
  190. * @author cy 2021-05-26
  191. * @desc 获取导出表单数据列表
  192. * @param $form_id
  193. * @return array
  194. */
  195. public function getExportFormDataList($form_id){
  196. $need_data = [];
  197. //万能表单数据
  198. $form_data = $this->getFormsById($form_id);
  199. $title_list = [];
  200. $form_list = $this->getFormInfoListByFormId($form_id);
  201. if(!empty($form_list)){
  202. foreach($form_list as $k=>$v){
  203. $form_list[$k]['addtime'] = date('Y-m-d H:i:s',$v['addtime']);
  204. $form_item_list = $this->getFormItemListByFormId($v['id']);
  205. if(!empty($form_item_list)){
  206. foreach($form_item_list as $ik=>$iv){
  207. if(!in_array($iv['item_name'],$title_list) && $iv['type'] != 'image'){
  208. array_push($title_list,$iv['item_name']);
  209. }
  210. $form_list[$k][$iv['item_name']] = $iv['item_val'];
  211. }
  212. }
  213. $member_info = M('lionfish_comshop_member')->where( array('member_id' => $v['user_id'] ) )->find();
  214. if(!empty($member_info)){
  215. $form_list[$k]['username'] = $member_info['username'];
  216. }else{
  217. $form_list[$k]['username'] = "";
  218. }
  219. }
  220. }
  221. $need_data['form_list'] = $form_list;
  222. $need_data['title_list'] = $title_list;
  223. $need_data['form_data'] = $form_data;
  224. return $need_data;
  225. }
  226. /**
  227. * @author cy 2021-05-24
  228. * @desc 添加万能表单
  229. * @return array
  230. */
  231. public function addOrUpdateForm()
  232. {
  233. $_GPC = I('request.');
  234. $id = $_GPC['id'];
  235. //表单名称
  236. $form_name = trim($_GPC['form_name']);
  237. //表单类型
  238. $form_type = trim($_GPC['form_type']);
  239. if( empty($form_name))
  240. {
  241. return ['code' => 0, 'message' => '请填写表单名称'];
  242. }
  243. if( empty($form_type))
  244. {
  245. return ['code' => 0, 'message' => '请选择表单类型'];
  246. }
  247. $condition = " 1=1 ";
  248. if(!empty($id)){
  249. $condition .= " and id != ".$id;
  250. }
  251. $condition .= " and form_name = '".$form_name."' ";
  252. $forms_data = $this->getFormsByWhere($condition);
  253. if(!empty($forms_data)){
  254. return ['code' => 0, 'message' => '表单名称已存在,请修改'];
  255. }
  256. $title_array = [];
  257. $random_code_list = trim($_GPC['random_code']);
  258. if(!empty($random_code_list) && count($random_code_list) > 0){
  259. foreach($random_code_list as $k=>$v){
  260. $title = request()->input('title_'.$v, '');
  261. $title_array[] = trim($title);
  262. }
  263. }
  264. $title_list = array_unique($title_array);
  265. if(count($title_list) < count($title_array)){
  266. return ['code' => 0, 'message' => '标题不能重复'];
  267. }
  268. $form_content = $this->getFormContent();
  269. $form_data = array();
  270. $form_data['form_name'] = $form_name;
  271. $form_data['form_type'] = $form_type;
  272. $form_data['form_content'] = $form_content;
  273. if( $id > 0 )
  274. {
  275. M('lionfish_comshop_forms')->where( array('id' => $id) )->save($form_data);
  276. }else{
  277. $form_data['addtime'] = time();
  278. $id = M('lionfish_comshop_forms')->add($form_data);
  279. }
  280. return ['code' => 1];
  281. }
  282. /**
  283. * @author 获取万能表单项数据
  284. * @return string
  285. */
  286. public function getFormContent(){
  287. $content = "";
  288. $content_array = [];
  289. $random_code_list = I('request.random_code');
  290. if(!empty($random_code_list) && count($random_code_list) > 0){
  291. foreach($random_code_list as $k=>$v){
  292. $content_array[$k] = $this->getFormItemValue($v);
  293. }
  294. $content = serialize($content_array);
  295. }
  296. return $content;
  297. }
  298. /**
  299. * @author cy 2021-05-11
  300. * @desc 获取万能表单项信息
  301. * @param $random_code
  302. * @return array
  303. */
  304. public function getFormItemValue($random_code){
  305. $form_data = [];
  306. $_GPC = I('request.');
  307. $form_type = $_GPC['form_type_'.$random_code];
  308. $form_data['type'] = $form_type;
  309. $form_data['random_code'] = $random_code;
  310. if($form_type == 'image'){//图片
  311. //标题
  312. $title = $_GPC['title_'.$random_code];
  313. //说明
  314. $remark = $_GPC['remark_'.$random_code];
  315. //最大上传数量
  316. $max_count = $_GPC['max_count_'.$random_code];
  317. $form_data['title'] = $title;
  318. $form_data['remark'] = $remark;
  319. $form_data['max_count'] = $max_count;
  320. }else if($form_type == 'text'){//单行文本
  321. //标题
  322. $title = $_GPC['title_'.$random_code];
  323. //说明
  324. $remark = $_GPC['remark_'.$random_code];
  325. //提示
  326. $hint = $_GPC['hint_'.$random_code];
  327. $form_data['title'] = $title;
  328. $form_data['remark'] = $remark;
  329. $form_data['hint'] = $hint;
  330. }else if($form_type == 'textarea'){//多行文本
  331. //标题
  332. $title = $_GPC['title_'.$random_code];
  333. //说明
  334. $remark = $_GPC['remark_'.$random_code];
  335. //提示
  336. $hint = $_GPC['hint_'.$random_code];
  337. $form_data['title'] = $title;
  338. $form_data['remark'] = $remark;
  339. $form_data['hint'] = $hint;
  340. }else if($form_type == 'select'){//下拉选项
  341. //标题
  342. $title = $_GPC['title_'.$random_code];
  343. //说明
  344. $remark = $_GPC['remark_'.$random_code];
  345. //提示
  346. $hint = $_GPC['hint_'.$random_code];
  347. //选项
  348. $option_array = [];
  349. $option_vals = $_GPC['option_val_'.$random_code];
  350. if(!empty($option_vals) && count($option_vals) > 0){
  351. foreach($option_vals as $pk=>$pv){
  352. $option_array[$pk] = $pv;
  353. }
  354. }
  355. $form_data['title'] = $title;
  356. $form_data['remark'] = $remark;
  357. $form_data['hint'] = $hint;
  358. $form_data['option_val'] = $option_array;
  359. }else if($form_type == 'radio'){//单选
  360. //标题
  361. $title = $_GPC['title_'.$random_code];
  362. //说明
  363. $remark = $_GPC['remark_'.$random_code];
  364. //选项
  365. $option_array = [];
  366. $option_vals = $_GPC['option_val_'.$random_code];
  367. if(!empty($option_vals) && count($option_vals) > 0){
  368. foreach($option_vals as $pk=>$pv){
  369. $option_array[$pk] = $pv;
  370. }
  371. }
  372. $form_data['title'] = $title;
  373. $form_data['remark'] = $remark;
  374. $form_data['option_val'] = $option_array;
  375. }else if($form_type == 'checked'){//多选
  376. //标题
  377. $title = $_GPC['title_'.$random_code];
  378. //说明
  379. $remark = $_GPC['remark_'.$random_code];
  380. //选项
  381. $option_array = [];
  382. $option_vals = $_GPC['option_val_'.$random_code];
  383. if(!empty($option_vals) && count($option_vals) > 0){
  384. foreach($option_vals as $pk=>$pv){
  385. $option_array[$pk] = $pv;
  386. }
  387. }
  388. $form_data['title'] = $title;
  389. $form_data['remark'] = $remark;
  390. $form_data['option_val'] = $option_array;
  391. }else if($form_type == 'area'){//地区
  392. //标题
  393. $title = $_GPC['title_'.$random_code];
  394. //说明
  395. $remark = $_GPC['remark_'.$random_code];
  396. //提示语
  397. $hint = $_GPC['hint_'.$random_code];
  398. //填写条件
  399. $area_type = $_GPC['area_type_'.$random_code];
  400. //默认省份
  401. $province_id = $_GPC['province_id_'.$random_code];
  402. //默认城市
  403. $city_id = $_GPC['city_id_'.$random_code];
  404. //默认区
  405. $country_id = $_GPC['country_id_'.$random_code];
  406. $form_data['title'] = $title;
  407. $form_data['remark'] = $remark;
  408. $form_data['hint'] = $hint;
  409. $form_data['area_type'] = $area_type;
  410. $form_data['province_id'] = $province_id;
  411. $form_data['city_id'] = $city_id;
  412. $form_data['country_id'] = $country_id;
  413. }else if($form_type == 'date'){//日期
  414. //标题
  415. $title = $_GPC['title_'.$random_code];
  416. //说明
  417. $remark = $_GPC['remark_'.$random_code];
  418. //提示语
  419. $hint = $_GPC['hint_'.$random_code];
  420. //日期默认类型
  421. $date_type = $_GPC['date_type_'.$random_code];
  422. //指定日期
  423. $appoint_date = $_GPC['appoint_date_'.$random_code];
  424. $form_data['title'] = $title;
  425. $form_data['remark'] = $remark;
  426. $form_data['hint'] = $hint;
  427. $form_data['date_type'] = $date_type;
  428. $form_data['appoint_date'] = $appoint_date;
  429. }else if($form_type == 'date_range'){//日期范围
  430. //标题
  431. $title = $_GPC['title_'.$random_code];
  432. //说明
  433. $remark = $_GPC['remark_'.$random_code];
  434. //开始日期类型
  435. $begin_date_type = $_GPC['begin_date_type_'.$random_code];
  436. //开始日期提示语
  437. $begin_hint = $_GPC['begin_hint_'.$random_code];
  438. //开始日期指定日期
  439. $begin_appoint_date = $_GPC['begin_appoint_date_'.$random_code];
  440. //结束日期类型
  441. $end_date_type = $_GPC['end_date_type_'.$random_code];
  442. //结束日期提示语
  443. $end_hint = $_GPC['end_hint_'.$random_code];
  444. //结束日期指定日期
  445. $end_appoint_date = $_GPC['end_appoint_date_'.$random_code];
  446. $form_data['title'] = $title;
  447. $form_data['remark'] = $remark;
  448. $form_data['begin_date_type'] = $begin_date_type;
  449. $form_data['begin_hint'] = $begin_hint;
  450. $form_data['begin_appoint_date'] = $begin_appoint_date;
  451. $form_data['end_date_type'] = $end_date_type;
  452. $form_data['end_hint'] = $end_hint;
  453. $form_data['end_appoint_date'] = $end_appoint_date;
  454. }else if($form_type == 'idcard'){//身份证号码
  455. //标题
  456. $title = $_GPC['title_'.$random_code];
  457. //说明
  458. $remark = $_GPC['remark_'.$random_code];
  459. //提示
  460. $hint = $_GPC['hint_'.$random_code];
  461. $form_data['title'] = $title;
  462. $form_data['remark'] = $remark;
  463. $form_data['hint'] = $hint;
  464. }else if($form_type == 'time'){//时间
  465. //标题
  466. $title = $_GPC['title_'.$random_code];
  467. //说明
  468. $remark = $_GPC['remark_'.$random_code];
  469. //提示
  470. $hint = $_GPC['hint_'.$random_code];
  471. //时间类型
  472. $time_type = $_GPC['time_type_'.$random_code];
  473. //指定时间
  474. $appoint_time = $_GPC['appoint_time_'.$random_code];
  475. $form_data['title'] = $title;
  476. $form_data['remark'] = $remark;
  477. $form_data['hint'] = $hint;
  478. $form_data['time_type'] = $time_type;
  479. $form_data['appoint_time'] = $appoint_time;
  480. }else if($form_type == 'time_range'){//时间范围
  481. //标题
  482. $title = $_GPC['title_'.$random_code];
  483. //说明
  484. $remark = $_GPC['remark_'.$random_code];
  485. //开始时间类型
  486. $begin_time_type = $_GPC['begin_time_type_'.$random_code];
  487. //开始指定时间
  488. $begin_appoint_time = $_GPC['begin_appoint_time_'.$random_code];
  489. //开始时间提示语
  490. $begin_hint = $_GPC['begin_hint_'.$random_code];
  491. //开始时间类型
  492. $end_time_type = $_GPC['end_time_type_'.$random_code];
  493. //开始指定时间
  494. $end_appoint_time = $_GPC['end_appoint_time_'.$random_code];
  495. //开始时间提示语
  496. $end_hint = $_GPC['end_hint_'.$random_code];
  497. $form_data['title'] = $title;
  498. $form_data['remark'] = $remark;
  499. $form_data['begin_time_type'] = $begin_time_type;
  500. $form_data['begin_appoint_time'] = $begin_appoint_time;
  501. $form_data['begin_hint'] = $begin_hint;
  502. $form_data['end_time_type'] = $end_time_type;
  503. $form_data['end_appoint_time'] = $end_appoint_time;
  504. $form_data['end_hint'] = $end_hint;
  505. }else if($form_type == 'telephone'){//手机号码
  506. //标题
  507. $title = $_GPC['title_'.$random_code];
  508. //说明
  509. $remark = $_GPC['remark_'.$random_code];
  510. //提示
  511. $hint = $_GPC['hint_'.$random_code];
  512. $form_data['title'] = $title;
  513. $form_data['remark'] = $remark;
  514. $form_data['hint'] = $hint;
  515. }
  516. //是否必填
  517. $required = $_GPC['required_'.$random_code];
  518. if($required == 'on'){//必填
  519. $required = 1;
  520. }else{
  521. $required = 0;
  522. }
  523. $form_data['required'] = $required;
  524. return $form_data;
  525. }
  526. /**
  527. * @author cy 2021-05-24
  528. * @desc 获取表单项内容
  529. * @param $type
  530. * @return array
  531. */
  532. public function getFormItem($type){
  533. $need_data = [];
  534. $item_li = "";
  535. $phone_item = "";
  536. $random_code = random(10,false);
  537. if($type == 'image'){
  538. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  539. <div class="action-items">
  540. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  541. <input type="hidden" name="form_type_'.$random_code.'" value="image"/>
  542. <div class="action-title"><span class="title">图片</span></div>
  543. <div class="input-title">
  544. <div class="input-group">
  545. <div class="input-group-addon">标题</div>
  546. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="图片" update_id="#text_title_'.$random_code.'" update_type="html">
  547. </div>
  548. </div>
  549. <div class="input-remark">
  550. <div class="input-group">
  551. <div class="input-group-addon">说明</div>
  552. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  553. </div>
  554. </div>
  555. <div class="input-max">
  556. <div class="input-group">
  557. <div class="input-group-addon">最大上传数量</div>
  558. <input class="form-control" name="max_count_'.$random_code.'" type="text" placeholder="请输入最大上传数量" value="5">
  559. <div class="input-group-addon">张</div>
  560. </div>
  561. </div>
  562. <div class="input-required">
  563. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  564. </div>
  565. <div class="input-delete">
  566. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  567. <i class="layui-icon">&#xe640;</i>删除
  568. </a>
  569. </div>
  570. <script>
  571. layui.use("form", function() {
  572. var form = layui.form;
  573. form.on("switch(required_'.$random_code.')", function(data){
  574. var update_id = data.elem.attributes["update_id"].nodeValue;
  575. if(data.elem.checked){
  576. $(update_id).show();
  577. }else{
  578. $(update_id).hide();
  579. }
  580. });
  581. });
  582. </script>
  583. </div>
  584. </li>';
  585. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  586. <div class="template_item">
  587. <span class="item_title" id="text_title_'.$random_code.'">图片</span>
  588. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  589. </div>
  590. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  591. <div class="tempalte_content">
  592. <div class="image-add">
  593. <div class="add">
  594. <span class="iconfont-m- icon-m-jiahao">+</span>
  595. </div>
  596. <div class="add-text"> 添加图片 </div>
  597. <input type="file" style="display: none;">
  598. </div>
  599. </div>
  600. </div>';
  601. }else if($type == 'text'){
  602. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  603. <div class="action-items">
  604. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  605. <input type="hidden" name="form_type_'.$random_code.'" value="text"/>
  606. <div class="action-title"><span class="title">单行文本</span></div>
  607. <div class="input-title">
  608. <div class="input-group">
  609. <div class="input-group-addon">标题</div>
  610. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="单行文本" update_id="#text_title_'.$random_code.'" update_type="html">
  611. </div>
  612. </div>
  613. <div class="input-remark">
  614. <div class="input-group">
  615. <div class="input-group-addon">说明</div>
  616. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  617. </div>
  618. </div>
  619. <div class="input-max">
  620. <div class="input-group">
  621. <div class="input-group-addon">提示语</div>
  622. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请输入" update_id="#text_val_'.$random_code.'" update_type="tip">
  623. </div>
  624. </div>
  625. <div class="input-required">
  626. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  627. </div>
  628. <div class="input-delete">
  629. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  630. <i class="layui-icon">&#xe640;</i>删除
  631. </a>
  632. </div>
  633. <script>
  634. layui.use("form", function() {
  635. var form = layui.form;
  636. form.on("switch(required_'.$random_code.')", function(data){
  637. var update_id = data.elem.attributes["update_id"].nodeValue;
  638. if(data.elem.checked){
  639. $(update_id).show();
  640. }else{
  641. $(update_id).hide();
  642. }
  643. });
  644. });
  645. </script>
  646. </div>
  647. </li>';
  648. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  649. <div class="template_item">
  650. <span class="item_title" id="text_title_'.$random_code.'">单行文本</span>
  651. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  652. </div>
  653. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  654. <div class="tempalte_content">
  655. <input type="text" placeholder="请输入" id="text_val_'.$random_code.'" class="item-input">
  656. </div>
  657. </div>';
  658. }else if($type == 'textarea'){
  659. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  660. <div class="action-items">
  661. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  662. <input type="hidden" name="form_type_'.$random_code.'" value="textarea"/>
  663. <div class="action-title"><span class="title">多行文本</span></div>
  664. <div class="input-title">
  665. <div class="input-group">
  666. <div class="input-group-addon">标题</div>
  667. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="多行文本" update_id="#text_title_'.$random_code.'" update_type="html">
  668. </div>
  669. </div>
  670. <div class="input-remark">
  671. <div class="input-group">
  672. <div class="input-group-addon">说明</div>
  673. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  674. </div>
  675. </div>
  676. <div class="input-max">
  677. <div class="input-group">
  678. <div class="input-group-addon">提示语</div>
  679. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请输入" update_id="#text_val_'.$random_code.'" update_type="tip">
  680. </div>
  681. </div>
  682. <div class="input-required">
  683. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  684. </div>
  685. <div class="input-delete">
  686. <a class=\'layui-btn layui-btn-xs deleteBtn\' href="javascript:;" random_code="'.$random_code.'">
  687. <i class="layui-icon">&#xe640;</i>删除
  688. </a>
  689. </div>
  690. <script>
  691. layui.use("form", function() {
  692. var form = layui.form;
  693. form.on("switch(required_'.$random_code.')", function(data){
  694. var update_id = data.elem.attributes["update_id"].nodeValue;
  695. if(data.elem.checked){
  696. $(update_id).show();
  697. }else{
  698. $(update_id).hide();
  699. }
  700. });
  701. });
  702. </script>
  703. </div>
  704. </li>';
  705. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  706. <div class="template_item">
  707. <span class="item_title" id="text_title_'.$random_code.'">多行文本</span>
  708. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  709. </div>
  710. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  711. <div class="tempalte_content">
  712. <textarea type="text" placeholder="请输入" id="text_val_'.$random_code.'" class="item-input item-input-textarea"></textarea>
  713. </div>
  714. </div>';
  715. }else if($type == 'select'){
  716. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  717. <div class="action-items">
  718. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  719. <input type="hidden" name="form_type_'.$random_code.'" value="select"/>
  720. <div class="action-title"><span class="title">下拉选项</span></div>
  721. <div class="input-title">
  722. <div class="input-group">
  723. <div class="input-group-addon">标题</div>
  724. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="下拉选项" update_id="#text_title_'.$random_code.'" update_type="html">
  725. </div>
  726. </div>
  727. <div class="middle-content">
  728. <div class="input-middle-item flex">
  729. <div class="input-remark">
  730. <div class="input-group">
  731. <div class="input-group-addon">说明</div>
  732. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  733. </div>
  734. </div>
  735. <div class="input-max">
  736. <div class="input-group">
  737. <div class="input-group-addon">提示语</div>
  738. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请选择" update_id="#text_val_'.$random_code.'" update_type="select_tip">
  739. </div>
  740. </div>
  741. </div>
  742. <div class="input-middle-item">
  743. <div class="input-group">
  744. <div class="input-group-addon">选项<span class="sort">1</span></div>
  745. <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="选项1" style="width: 430px;">
  746. <a class=\'delOptionBtn\' href="javascript:;">
  747. &nbsp;删除
  748. </a>
  749. </div>
  750. </div>
  751. <div class="input-middle-item">
  752. <div class="input-group">
  753. <div class="input-group-addon">选项<span class="sort">2</span></div>
  754. <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="选项2" style="width: 430px;">
  755. <a class="delOptionBtn" href="javascript:;">
  756. &nbsp;删除
  757. </a>
  758. </div>
  759. </div>
  760. <div class="input-middle-item">
  761. <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="select">
  762. +添加选项
  763. </a>
  764. </div>
  765. </div>
  766. <div class="input-required">
  767. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  768. </div>
  769. <div class="input-delete">
  770. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  771. <i class="layui-icon">&#xe640;</i>删除
  772. </a>
  773. </div>
  774. <script>
  775. layui.use("form", function() {
  776. var form = layui.form;
  777. form.on("switch(required_'.$random_code.')", function(data){
  778. var update_id = data.elem.attributes["update_id"].nodeValue;
  779. if(data.elem.checked){
  780. $(update_id).show();
  781. }else{
  782. $(update_id).hide();
  783. }
  784. });
  785. });
  786. </script>
  787. </div>
  788. </li>';
  789. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  790. <div class="template_item">
  791. <span class="item_title" id="text_title_'.$random_code.'">下拉选项</span>
  792. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  793. </div>
  794. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  795. <div class="tempalte_content">
  796. <select class="item-input" placeholder="请选择" disabled id="text_val_'.$random_code.'"></select>
  797. </div>
  798. </div>';
  799. }else if($type == 'radiao'){
  800. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  801. <div class="action-items">
  802. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  803. <input type="hidden" name="form_type_'.$random_code.'" value="radio"/>
  804. <div class="action-title"><span class="title">单选</span></div>
  805. <div class="input-title">
  806. <div class="input-group">
  807. <div class="input-group-addon">标题</div>
  808. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="单选" update_id="#text_title_'.$random_code.'" update_type="html">
  809. </div>
  810. </div>
  811. <div class="middle-content">
  812. <div class="input-middle-item flex">
  813. <div class="input-remark" style="width: 600px;">
  814. <div class="input-group">
  815. <div class="input-group-addon">说明</div>
  816. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  817. </div>
  818. </div>
  819. </div>
  820. <div class="input-middle-item">
  821. <div class="input-group">
  822. <div class="input-group-addon">选项<span class="sort">1</span></div>
  823. <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="选项1" style="width: 430px;" update_id="#radio-item1_'.$random_code.'" update_type="radio">
  824. <a class="delOptionBtn" href="javascript:;" num="1" random_code="'.$random_code.'">
  825. &nbsp;删除
  826. </a>
  827. </div>
  828. </div>
  829. <div class="input-middle-item">
  830. <div class="input-group">
  831. <div class="input-group-addon">选项<span class="sort">2</span></div>
  832. <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="选项2" style="width: 430px;" update_id="#radio-item2_'.$random_code.'" update_type="radio">
  833. <a class="delOptionBtn" href="javascript:;" num="2" random_code="'.$random_code.'">
  834. &nbsp;删除
  835. </a>
  836. </div>
  837. </div>
  838. <div class="input-middle-item">
  839. <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="radio">
  840. +添加选项
  841. </a>
  842. </div>
  843. </div>
  844. <div class="input-required">
  845. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  846. </div>
  847. <div class="input-delete">
  848. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  849. <i class="layui-icon">&#xe640;</i>删除
  850. </a>
  851. </div>
  852. <script>
  853. layui.use("form", function() {
  854. var form = layui.form;
  855. form.on("switch(required_'.$random_code.')", function(data){
  856. var update_id = data.elem.attributes["update_id"].nodeValue;
  857. if(data.elem.checked){
  858. $(update_id).show();
  859. }else{
  860. $(update_id).hide();
  861. }
  862. });
  863. });
  864. </script>
  865. </div>
  866. </li>';
  867. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  868. <div class="template_item">
  869. <span class="item_title" id="text_title_'.$random_code.'">单选</span>
  870. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  871. </div>
  872. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  873. <div class="tempalte_content">
  874. <div class="m-radio-box" id="m-radio-box_'.$random_code.'">
  875. <div class="radio-item" id="radio-item1_'.$random_code.'">
  876. <input type="radio" class="radio_option" name="radio" value="选项1" title="选项1">
  877. </div>
  878. <div class="radio-item" id="radio-item2_'.$random_code.'">
  879. <input type="radio" class="radio_option" name="radio" value="选项2" title="选项2">
  880. </div>
  881. </div>
  882. </div>
  883. </div>';
  884. }else if($type == 'checked'){
  885. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  886. <div class="action-items">
  887. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  888. <input type="hidden" name="form_type_'.$random_code.'" value="checked"/>
  889. <div class="action-title"><span class="title">多选</span></div>
  890. <div class="input-title">
  891. <div class="input-group">
  892. <div class="input-group-addon">标题</div>
  893. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="多选" update_id="#text_title_'.$random_code.'" update_type="html">
  894. </div>
  895. </div>
  896. <div class="middle-content">
  897. <div class="input-middle-item flex">
  898. <div class="input-remark" style="width: 600px;">
  899. <div class="input-group">
  900. <div class="input-group-addon">说明</div>
  901. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  902. </div>
  903. </div>
  904. </div>
  905. <div class="input-middle-item">
  906. <div class="input-group">
  907. <div class="input-group-addon">选项<span class="sort">1</span></div>
  908. <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="选项1" style="width: 430px;" update_id="#radio-item1_'.$random_code.'" update_type="radio">
  909. <a class="delOptionBtn" href="javascript:;" num="1" random_code="'.$random_code.'">
  910. &nbsp;删除
  911. </a>
  912. </div>
  913. </div>
  914. <div class="input-middle-item">
  915. <div class="input-group">
  916. <div class="input-group-addon">选项<span class="sort">2</span></div>
  917. <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="选项2" style="width: 430px;" update_id="#radio-item2_'.$random_code.'" update_type="radio">
  918. <a class="delOptionBtn" href="javascript:;" num="2" random_code="'.$random_code.'">
  919. &nbsp;删除
  920. </a>
  921. </div>
  922. </div>
  923. <div class="input-middle-item">
  924. <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="checkbox">
  925. +添加选项
  926. </a>
  927. </div>
  928. </div>
  929. <div class="input-required">
  930. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  931. </div>
  932. <div class="input-delete">
  933. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  934. <i class="layui-icon">&#xe640;</i>删除
  935. </a>
  936. </div>
  937. <script>
  938. layui.use("form", function() {
  939. var form = layui.form;
  940. form.on("switch(required_'.$random_code.')", function(data){
  941. var update_id = data.elem.attributes["update_id"].nodeValue;
  942. if(data.elem.checked){
  943. $(update_id).show();
  944. }else{
  945. $(update_id).hide();
  946. }
  947. });
  948. });
  949. </script>
  950. </div>
  951. </li>';
  952. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  953. <div class="template_item">
  954. <span class="item_title" id="text_title_'.$random_code.'">多选</span>
  955. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  956. </div>
  957. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  958. <div class="tempalte_content">
  959. <div class="m-radio-box" id="m-radio-box_'.$random_code.'">
  960. <div class="radio-item" id="radio-item1_'.$random_code.'">
  961. <input type="checkbox" class="radio_option" name="checkbox" title="选项1" value="选项1" lay-skin="primary">
  962. </div>
  963. <div class="radio-item" id="radio-item2_'.$random_code.'">
  964. <input type="checkbox" class="radio_option" name="checkbox" title="选项2" value="选项2" lay-skin="primary">
  965. </div>
  966. </div>
  967. </div>
  968. </div>';
  969. }else if($type == 'area'){
  970. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  971. <div class="action-items">
  972. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  973. <input type="hidden" name="form_type_'.$random_code.'" value="area"/>
  974. <div class="action-title"><span class="title">地区</span></div>
  975. <div class="input-title">
  976. <div class="input-group">
  977. <div class="input-group-addon">标题</div>
  978. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="地区" update_id="#text_title_'.$random_code.'" update_type="html">
  979. </div>
  980. </div>
  981. <div class="middle-content">
  982. <div class="input-middle-item flex">
  983. <div class="input-remark">
  984. <div class="input-group">
  985. <div class="input-group-addon">说明</div>
  986. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  987. </div>
  988. </div>
  989. <div class="input-max">
  990. <div class="input-group">
  991. <div class="input-group-addon">提示语</div>
  992. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请选择地区" update_id="#address_'.$random_code.'" random_code="'.$random_code.'" update_type="select_area_tip">
  993. </div>
  994. </div>
  995. </div>
  996. <div class="input-middle-item">
  997. <div class="input-group">
  998. <label class="label_title">填写条件:</label>
  999. <label class="radio-inline">
  1000. <input type="radio" title="省份" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="province" checked="checked">
  1001. </label>
  1002. <label class="radio-inline">
  1003. <input type="radio" title="省市" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="city">
  1004. </label>
  1005. <label class="radio-inline">
  1006. <input type="radio" title="省市区" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="country">
  1007. </label>
  1008. </div>
  1009. </div>
  1010. <div class="input-middle-item flex" id="areaParent_'.$random_code.'">
  1011. <div class="input-group province_select">
  1012. <div class="input-group-addon">默认值&nbsp;省</div>
  1013. <select class="sel-province" lay-ignore name="province_id_'.$random_code.'" onChange="selectCity(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
  1014. <option value="" selected="true">请选择</option>
  1015. </select>
  1016. </div>
  1017. <div class="input-group city_select" style="display:none;">
  1018. <div class="input-group-addon">默认值&nbsp;市</div>
  1019. <select class="sel-city" lay-ignore name="city_id_'.$random_code.'" onChange="selectcounty(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
  1020. <option value="" selected="true">请选择</option>
  1021. </select>
  1022. </div>
  1023. <div class="input-group country_select" style="display:none;">
  1024. <div class="input-group-addon">默认值&nbsp;区</div>
  1025. <select class="sel-area" lay-ignore name="country_id_'.$random_code.'" onChange="updateArea(\''.$random_code.'\')" style="width: 130px;display:inline;">
  1026. <option value="" selected="true">请选择</option>
  1027. </select>
  1028. </div>
  1029. <script>
  1030. layui.use("form", function() {
  1031. var form = layui.form;
  1032. form.on("switch(required_'.$random_code.')", function(data){
  1033. var update_id = data.elem.attributes["update_id"].nodeValue;
  1034. if(data.elem.checked){
  1035. $(update_id).show();
  1036. }else{
  1037. $(update_id).hide();
  1038. }
  1039. });
  1040. });
  1041. cascdeInit("0","0","areaParent_'.$random_code.'","","","");
  1042. $(".area_type_'.$random_code.'").click(function(){
  1043. var type = $(this).val();
  1044. var obj = $(this).parent().parent().parent().parent();
  1045. if (type == "province") {
  1046. obj.find(".city_select").hide();
  1047. obj.find(".country_select").hide();
  1048. } else if(type == "city") {
  1049. obj.find(".city_select").show();
  1050. obj.find(".country_select").hide();
  1051. } else if(type == "country") {
  1052. obj.find(".city_select").show();
  1053. obj.find(".country_select").show();
  1054. }
  1055. updateArea("'.$random_code.'");
  1056. });
  1057. </script>
  1058. </div>
  1059. </div>
  1060. <div class="input-required">
  1061. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  1062. </div>
  1063. <div class="input-delete">
  1064. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1065. <i class="layui-icon">&#xe640;</i>删除
  1066. </a>
  1067. </div>
  1068. </div>
  1069. </li>';
  1070. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1071. <div class="template_item">
  1072. <span class="item_title" id="text_title_'.$random_code.'">地区</span>
  1073. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  1074. </div>
  1075. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  1076. <div class="tempalte_content">
  1077. <select class="item-input" id="address_'.$random_code.'">
  1078. <option value="" selected disabled style="display: none;">请选择地区</option>
  1079. </select>
  1080. </div>
  1081. </div>';
  1082. }else if($type == 'date'){
  1083. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  1084. <div class="action-items">
  1085. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1086. <input type="hidden" name="form_type_'.$random_code.'" value="date"/>
  1087. <div class="action-title"><span class="title">日期</span></div>
  1088. <div class="input-title">
  1089. <div class="input-group">
  1090. <div class="input-group-addon">标题</div>
  1091. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="日期" update_id="#text_title_'.$random_code.'" update_type="html">
  1092. </div>
  1093. </div>
  1094. <div class="middle-content">
  1095. <div class="input-middle-item flex">
  1096. <div class="input-remark">
  1097. <div class="input-group">
  1098. <div class="input-group-addon">说明</div>
  1099. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  1100. </div>
  1101. </div>
  1102. <div class="input-max">
  1103. <div class="input-group">
  1104. <div class="input-group-addon">提示语</div>
  1105. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="选择日期" update_id="#date_val_'.$random_code.'" random_code="'.$random_code.'" update_type="tip">
  1106. </div>
  1107. </div>
  1108. </div>
  1109. <div class="input-middle-item">
  1110. <div class="input-group">
  1111. <label style="font-size: 14px;font-weight: bold;line-height: 20px;">默认:</label>
  1112. <label class="radio-inline">
  1113. <input type="radio" title="不默认" name="date_type_'.$random_code.'" lay-filter="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="no_default" checked="checked">
  1114. </label>
  1115. <label class="radio-inline">
  1116. <input type="radio" title="填表当天" name="date_type_'.$random_code.'" lay-filter="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="same_day">
  1117. </label>
  1118. <label class="radio-inline">
  1119. <input type="radio" title="指定日期" name="date_type_'.$random_code.'" lay-filter="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="appoint_date">
  1120. </label>
  1121. <div class="radio-inline appoint_date_txt_'.$random_code.'" style="display:none;">
  1122. <input type="text" class="layui-input" id="appoint_date_'.$random_code.'" name="appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  1123. </div>
  1124. </div>
  1125. </div>
  1126. </div>
  1127. <div class="input-required">
  1128. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  1129. </div>
  1130. <div class="input-delete">
  1131. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1132. <i class="layui-icon">&#xe640;</i>删除
  1133. </a>
  1134. </div>
  1135. <script>
  1136. layui.use(["laydate","form"], function() {
  1137. var laydate = layui.laydate;
  1138. var form = layui.form;
  1139. //常规用法
  1140. laydate.render({
  1141. elem: "#appoint_date_'.$random_code.'",
  1142. done:function(value, date, endDate){
  1143. $("#date_val_'.$random_code.'").val(value);
  1144. }
  1145. });
  1146. form.on("switch(required_'.$random_code.')", function(data){
  1147. var update_id = data.elem.attributes["update_id"].nodeValue;
  1148. if(data.elem.checked){
  1149. $(update_id).show();
  1150. }else{
  1151. $(update_id).hide();
  1152. }
  1153. });
  1154. form.on("radio(date_type_'.$random_code.')", function (data) {
  1155. var obj = $(this).parent().parent();
  1156.    if(data.value == "no_default"){
  1157. $("#date_val_'.$random_code.'").val("");
  1158. obj.find(".appoint_date_txt_'.$random_code.'").hide();
  1159. }else if(data.value == "same_day"){
  1160. $("#date_val_'.$random_code.'").val("");
  1161. obj.find(".appoint_date_txt_'.$random_code.'").hide();
  1162. }else if(data.value == "appoint_date"){
  1163. obj.find(".appoint_date_txt_'.$random_code.'").show();
  1164. var appoint_date = $("#appoint_date_'.$random_code.'").val();
  1165. $("#date_val_'.$random_code.'").val(appoint_date);
  1166. }
  1167. });
  1168. });
  1169. </script>
  1170. </div>
  1171. </li>';
  1172. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1173. <div class="template_item">
  1174. <span class="item_title" id="text_title_'.$random_code.'">日期</span>
  1175. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  1176. </div>
  1177. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  1178. <div class="tempalte_content">
  1179. <div class="date_item">
  1180. <input type="text" placeholder="选择日期" id="date_val_'.$random_code.'" class="item-input" readonly value="">
  1181. <div class="date_icon"><i class="layui-icon layui-icon-date" style="font-size: 25px;"></i></div>
  1182. </div>
  1183. </div>
  1184. </div>';
  1185. }else if($type == 'date_range'){
  1186. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  1187. <div class="action-items">
  1188. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1189. <input type="hidden" name="form_type_'.$random_code.'" value="date_range"/>
  1190. <div class="action-title"><span class="title">日期范围</span></div>
  1191. <div class="input-title">
  1192. <div class="input-group">
  1193. <div class="input-group-addon">标题</div>
  1194. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="日期范围" update_id="#text_title_'.$random_code.'" update_type="html">
  1195. </div>
  1196. </div>
  1197. <div class="middle-content">
  1198. <div class="input-middle-item flex">
  1199. <div class="input-remark" style="width: 600px;">
  1200. <div class="input-group" style="margin-bottom: 5px;">
  1201. <div class="input-group-addon">说明</div>
  1202. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  1203. </div>
  1204. <div class="input-group">
  1205. <div class="input-group-addon">提示语</div>
  1206. <input class="form-control" name="begin_hint_'.$random_code.'" type="text" placeholder="请输入" value="请选择开始日期" style="width: 500px;" update_id="#begin_date_val_'.$random_code.'" random_code="'.$random_code.'" update_type="tip">
  1207. </div>
  1208. </div>
  1209. </div>
  1210. <div class="input-middle-item">
  1211. <div class="input-group"><label class="label_title">开始日期</label></div>
  1212. <div class="input-group" style="margin-bottom: 5px;">
  1213. <label class="label_title">默认:</label>
  1214. <label class="radio-inline">
  1215. <input type="radio" title="不默认" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="no_default" checked="checked">
  1216. </label>
  1217. <label class="radio-inline">
  1218. <input type="radio" title="填表当天" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="same_day">
  1219. </label>
  1220. <label class="radio-inline">
  1221. <input type="radio" title="指定日期" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="appoint_date">
  1222. </label>
  1223. <div class="radio-inline begin_appoint_date_txt_'.$random_code.'" style="display:none;">
  1224. <input type="text" class="layui-input" id="begin_appoint_date_'.$random_code.'" name="begin_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  1225. </div>
  1226. </div>
  1227. </div>
  1228. <div class="input-middle-item">
  1229. <div class="input-group"><label class="label_title">结束日期</label></div>
  1230. <div class="input-group" style="margin-bottom: 5px;">
  1231. <label class="label_title">默认:</label>
  1232. <label class="radio-inline">
  1233. <input type="radio" title="不默认" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="no_default" checked="checked">
  1234. </label>
  1235. <label class="radio-inline">
  1236. <input type="radio" title="填表当天" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="same_day">
  1237. </label>
  1238. <label class="radio-inline">
  1239. <input type="radio" title="指定日期" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="appoint_date">
  1240. </label>
  1241. <div class="radio-inline end_appoint_date_txt_'.$random_code.'" style="display:none;">
  1242. <input type="text" class="layui-input" id="end_appoint_date_'.$random_code.'" name="end_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  1243. </div>
  1244. </div>
  1245. </div>
  1246. </div>
  1247. <div class="input-required">
  1248. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  1249. </div>
  1250. <div class="input-delete">
  1251. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1252. <i class="layui-icon">&#xe640;</i>删除
  1253. </a>
  1254. </div>
  1255. <script>
  1256. layui.use(["laydate","form"], function() {
  1257. var laydate = layui.laydate;
  1258. var form = layui.form;
  1259. //常规用法
  1260. laydate.render({
  1261. elem: "#begin_appoint_date_'.$random_code.'",
  1262. done:function(value, date, endDate){
  1263. $("#begin_date_val_'.$random_code.'").val(value);
  1264. }
  1265. });
  1266. laydate.render({
  1267. elem: "#end_appoint_date_'.$random_code.'",
  1268. done:function(value, date, endDate){
  1269. $("#end_date_val_'.$random_code.'").val(value);
  1270. }
  1271. });
  1272. form.on("switch(required_'.$random_code.')", function(data){
  1273. var update_id = data.elem.attributes["update_id"].nodeValue;
  1274. if(data.elem.checked){
  1275. $(update_id).show();
  1276. }else{
  1277. $(update_id).hide();
  1278. }
  1279. });
  1280. });
  1281. $(".begin_date_type_'.$random_code.'").click(function(){
  1282. var date_type = $(this).val();
  1283. var obj = $(this).parent().parent();
  1284. if (date_type == "no_default") {
  1285. obj.find(".begin_appoint_date_txt_'.$random_code.'").hide();
  1286. $("#begin_date_val_'.$random_code.'").val("");
  1287. } else if(date_type == "same_day") {
  1288. obj.find(".begin_appoint_date_txt_'.$random_code.'").hide();
  1289. $("#begin_date_val_'.$random_code.'").val("");
  1290. } else if(date_type == "appoint_date") {
  1291. obj.find(".begin_appoint_date_txt_'.$random_code.'").show();
  1292. var begin_appoint_date = $("#begin_appoint_date_'.$random_code.'").val();
  1293. $("#begin_date_val_'.$random_code.'").val(begin_appoint_date);
  1294. }
  1295. });
  1296. $(".end_date_type_'.$random_code.'").click(function(){
  1297. var date_type = $(this).val();
  1298. var obj = $(this).parent().parent();
  1299. if (date_type == "no_default") {
  1300. obj.find(".end_appoint_date_txt_'.$random_code.'").hide();
  1301. $("#end_date_val_'.$random_code.'").val("");
  1302. } else if(date_type == "same_day") {
  1303. obj.find(".end_appoint_date_txt_'.$random_code.'").hide();
  1304. $("#end_date_val_'.$random_code.'").val("");
  1305. } else if(date_type == "appoint_date") {
  1306. obj.find(".end_appoint_date_txt_'.$random_code.'").show();
  1307. var end_appoint_date = $("#end_appoint_date_'.$random_code.'").val();
  1308. $("#end_date_val_'.$random_code.'").val(end_appoint_date);
  1309. }
  1310. });
  1311. </script>
  1312. </div>
  1313. </li>';
  1314. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1315. <div class="template_item">
  1316. <span class="item_title" id="text_title_'.$random_code.'">日期范围</span>
  1317. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  1318. </div>
  1319. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  1320. <div class="tempalte_content">
  1321. <div class="date_item">
  1322. <input type="text" placeholder="请选择日期范围" id="begin_date_val_'.$random_code.'" class="item-input" readonly value="">
  1323. <div class="date_icon"><i class="layui-icon layui-icon-date" style="font-size: 25px;"></i></div>
  1324. </div>
  1325. </div>
  1326. </div>';
  1327. }else if($type == 'idcard'){
  1328. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  1329. <div class="action-items">
  1330. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1331. <input type="hidden" name="form_type_'.$random_code.'" value="idcard"/>
  1332. <div class="action-title"><span class="title">身份证号码</span></div>
  1333. <div class="input-title">
  1334. <div class="input-group">
  1335. <div class="input-group-addon">标题</div>
  1336. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="身份证号码" update_id="#text_title_'.$random_code.'" update_type="html">
  1337. </div>
  1338. </div>
  1339. <div class="input-remark">
  1340. <div class="input-group">
  1341. <div class="input-group-addon">说明</div>
  1342. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  1343. </div>
  1344. </div>
  1345. <div class="input-max">
  1346. <div class="input-group">
  1347. <div class="input-group-addon">提示语</div>
  1348. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请填写18位身份证号码" update_id="#text_val_'.$random_code.'" update_type="tip">
  1349. </div>
  1350. </div>
  1351. <div class="input-required">
  1352. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  1353. </div>
  1354. <div class="input-delete">
  1355. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1356. <i class="layui-icon">&#xe640;</i>删除
  1357. </a>
  1358. </div>
  1359. <script>
  1360. layui.use("form", function() {
  1361. var form = layui.form;
  1362. form.on("switch(required_'.$random_code.')", function(data){
  1363. var update_id = data.elem.attributes["update_id"].nodeValue;
  1364. if(data.elem.checked){
  1365. $(update_id).show();
  1366. }else{
  1367. $(update_id).hide();
  1368. }
  1369. });
  1370. });
  1371. </script>
  1372. </div>
  1373. </li>';
  1374. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1375. <div class="template_item">
  1376. <span class="item_title" id="text_title_'.$random_code.'">身份证号码</span>
  1377. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  1378. </div>
  1379. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  1380. <div class="tempalte_content">
  1381. <input type="text" name="" placeholder="请填写18位身份证号码" id="text_val_'.$random_code.'" class="item-input">
  1382. </div>
  1383. </div>';
  1384. }else if($type == 'time'){
  1385. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  1386. <div class="action-items">
  1387. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1388. <input type="hidden" name="form_type_'.$random_code.'" value="time"/>
  1389. <div class="action-title"><span class="title">时间</span></div>
  1390. <div class="input-title">
  1391. <div class="input-group">
  1392. <div class="input-group-addon">标题</div>
  1393. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="时间" update_id="#text_title_'.$random_code.'" update_type="html">
  1394. </div>
  1395. </div>
  1396. <div class="middle-content">
  1397. <div class="input-middle-item flex">
  1398. <div class="input-remark">
  1399. <div class="input-group">
  1400. <div class="input-group-addon">说明</div>
  1401. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  1402. </div>
  1403. </div>
  1404. <div class="input-max">
  1405. <div class="input-group">
  1406. <div class="input-group-addon">提示语</div>
  1407. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请选择日期" update_id="#date_val_'.$random_code.'" update_type="tip">
  1408. </div>
  1409. </div>
  1410. </div>
  1411. <div class="input-middle-item">
  1412. <div class="input-group">
  1413. <label style="font-size: 14px;font-weight: bold;line-height: 20px;">默认:</label>
  1414. <label class="radio-inline">
  1415. <input type="radio" title="不默认" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="no_default" checked="checked">
  1416. </label>
  1417. <label class="radio-inline">
  1418. <input type="radio" title="填表当时" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="same_time">
  1419. </label>
  1420. <label class="radio-inline">
  1421. <input type="radio" title="指定时间" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="appoint_time">
  1422. </label>
  1423. <div class="radio-inline appoint_time_txt_'.$random_code.'" style="display:none;">
  1424. <input type="text" class="layui-input" id="appoint_time_'.$random_code.'" name="appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  1425. </div>
  1426. </div>
  1427. </div>
  1428. </div>
  1429. <div class="input-required">
  1430. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  1431. </div>
  1432. <div class="input-delete">
  1433. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1434. <i class="layui-icon">&#xe640;</i>删除
  1435. </a>
  1436. </div>
  1437. <script>
  1438. layui.use(["laydate","form"], function() {
  1439. var laydate = layui.laydate;
  1440. var form = layui.form;
  1441. //常规用法
  1442. laydate.render({
  1443. elem: "#appoint_time_' . $random_code . '"
  1444. ,type: "time"
  1445. ,done:function(value, date, endDate){
  1446. $("#date_val_' . $random_code . '").val(value);
  1447. }
  1448. });
  1449. form.on("switch(required_'.$random_code.')", function(data){
  1450. var update_id = data.elem.attributes["update_id"].nodeValue;
  1451. if(data.elem.checked){
  1452. $(update_id).show();
  1453. }else{
  1454. $(update_id).hide();
  1455. }
  1456. });
  1457. $(".time_type_'.$random_code.'").click(function(){
  1458. var date_type = $(this).val();
  1459. var obj = $(this).parent().parent();
  1460. if (date_type == "no_default") {
  1461. obj.find(".appoint_time_txt_'.$random_code.'").hide();
  1462. $("#date_val_'.$random_code.'").val("");
  1463. } else if(date_type == "same_time") {
  1464. obj.find(".appoint_time_txt_'.$random_code.'").hide();
  1465. $("#date_val_'.$random_code.'").val("");
  1466. } else if(date_type == "appoint_time") {
  1467. obj.find(".appoint_time_txt_'.$random_code.'").show();
  1468. var appoint_time = $("#appoint_time_'.$random_code.'").val();
  1469. $("#date_val_'.$random_code.'").val(appoint_time);
  1470. }
  1471. });
  1472. });
  1473. </script>
  1474. </div>
  1475. </li>';
  1476. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1477. <div class="template_item">
  1478. <span class="item_title" id="text_title_'.$random_code.'">时间</span>
  1479. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  1480. </div>
  1481. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  1482. <div class="tempalte_content">
  1483. <div class="date_item">
  1484. <input type="text" placeholder="请选择时间" id="date_val_'.$random_code.'" class="item-input" readonly>
  1485. <div class="date_icon"><i class="layui-icon layui-icon-time" style="font-size: 25px;"></i></div>
  1486. </div>
  1487. </div>
  1488. </div>';
  1489. }else if($type == 'time_range'){
  1490. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  1491. <div class="action-items">
  1492. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1493. <input type="hidden" name="form_type_'.$random_code.'" value="time_range"/>
  1494. <div class="action-title"><span class="title">时间范围</span></div>
  1495. <div class="input-title">
  1496. <div class="input-group">
  1497. <div class="input-group-addon">标题</div>
  1498. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="时间范围" update_id="#text_title_'.$random_code.'" update_type="html">
  1499. </div>
  1500. </div>
  1501. <div class="middle-content">
  1502. <div class="input-middle-item flex">
  1503. <div class="input-remark" style="width: 600px;">
  1504. <div class="input-group" style="margin-bottom: 5px;">
  1505. <div class="input-group-addon">说明</div>
  1506. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  1507. </div>
  1508. <div class="input-group">
  1509. <div class="input-group-addon">提示语</div>
  1510. <input class="form-control" name="begin_hint_'.$random_code.'" type="text" placeholder="请输入" value="选择开始时间" style="width: 500px;" update_id="#begin_time_val_'.$random_code.'" update_type="tip">
  1511. </div>
  1512. </div>
  1513. </div>
  1514. <div class="input-middle-item">
  1515. <div class="input-group"><label class="label_title">开始时间</label></div>
  1516. <div class="input-group" style="margin-bottom: 5px;">
  1517. <label class="label_title">默认:</label>
  1518. <label class="radio-inline">
  1519. <input type="radio" title="不默认" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="no_default" checked="checked">
  1520. </label>
  1521. <label class="radio-inline">
  1522. <input type="radio" title="填表当时" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="same_time">
  1523. </label>
  1524. <label class="radio-inline">
  1525. <input type="radio" title="指定时间" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="appoint_time">
  1526. </label>
  1527. <div class="radio-inline begin_appoint_time_txt_'.$random_code.'" style="display:none;">
  1528. <input type="text" class="layui-input" id="begin_appoint_time_'.$random_code.'" name="begin_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  1529. </div>
  1530. </div>
  1531. </div>
  1532. <div class="input-middle-item">
  1533. <div class="input-group"><label class="label_title">结束时间</label></div>
  1534. <div class="input-group" style="margin-bottom: 5px;">
  1535. <label class="label_title">默认:</label>
  1536. <label class="radio-inline">
  1537. <input type="radio" title="不默认" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="no_default" checked="checked">
  1538. </label>
  1539. <label class="radio-inline">
  1540. <input type="radio" title="填表当天" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="same_time">
  1541. </label>
  1542. <label class="radio-inline">
  1543. <input type="radio" title="指定日期" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="appoint_time">
  1544. </label>
  1545. <div class="radio-inline end_appoint_time_txt_'.$random_code.'" style="display:none;">
  1546. <input type="text" class="layui-input" id="end_appoint_time_'.$random_code.'" name="end_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  1547. </div>
  1548. </div>
  1549. </div>
  1550. </div>
  1551. <div class="input-required">
  1552. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  1553. </div>
  1554. <div class="input-delete">
  1555. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1556. <i class="layui-icon">&#xe640;</i>删除
  1557. </a>
  1558. </div>
  1559. <script>
  1560. layui.use(["laydate","form"], function() {
  1561. var laydate = layui.laydate;
  1562. var form = layui.form;
  1563. //常规用法
  1564. laydate.render({
  1565. elem: "#begin_appoint_time_'.$random_code.'"
  1566. ,type: "time"
  1567. ,done:function(value, date, endDate){
  1568. $("#begin_time_val_' . $random_code . '").val(value);
  1569. }
  1570. });
  1571. laydate.render({
  1572. elem: "#end_appoint_time_'.$random_code.'"
  1573. ,type: "time"
  1574. ,done:function(value, date, endDate){
  1575. $("#end_time_val_' . $random_code . '").val(value);
  1576. }
  1577. });
  1578. form.on("switch(required_'.$random_code.')", function(data){
  1579. var update_id = data.elem.attributes["update_id"].nodeValue;
  1580. if(data.elem.checked){
  1581. $(update_id).show();
  1582. }else{
  1583. $(update_id).hide();
  1584. }
  1585. });
  1586. });
  1587. $(".begin_time_type_'.$random_code.'").click(function(){
  1588. var date_type = $(this).val();
  1589. var obj = $(this).parent().parent();
  1590. if (date_type == "no_default") {
  1591. obj.find(".begin_appoint_time_txt_'.$random_code.'").hide();
  1592. $("#begin_time_val_'.$random_code.'").val("");
  1593. } else if(date_type == "same_time") {
  1594. obj.find(".begin_appoint_time_txt_'.$random_code.'").hide();
  1595. $("#begin_time_val_'.$random_code.'").val("");
  1596. } else if(date_type == "appoint_time") {
  1597. var appoint_time = $("#begin_appoint_time_'.$random_code.'").val();
  1598. obj.find(".begin_appoint_time_txt_'.$random_code.'").show();
  1599. $("#begin_time_val_'.$random_code.'").val(appoint_time);
  1600. }
  1601. });
  1602. $(".end_time_type_'.$random_code.'").click(function(){
  1603. var date_type = $(this).val();
  1604. var obj = $(this).parent().parent();
  1605. if (date_type == "no_default") {
  1606. obj.find(".end_appoint_time_txt_'.$random_code.'").hide();
  1607. $("#end_time_val_'.$random_code.'").val("");
  1608. } else if(date_type == "same_time") {
  1609. obj.find(".end_appoint_time_txt_'.$random_code.'").hide();
  1610. $("#end_time_val_'.$random_code.'").val("");
  1611. } else if(date_type == "appoint_time") {
  1612. obj.find(".end_appoint_time_txt_'.$random_code.'").show();
  1613. var appoint_time = $("#end_appoint_time_'.$random_code.'").val();
  1614. $("#end_time_val_'.$random_code.'").val(appoint_time);
  1615. }
  1616. });
  1617. </script>
  1618. </div>
  1619. </li>';
  1620. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1621. <div class="template_item">
  1622. <span class="item_title" id="text_title_'.$random_code.'">时间范围</span>
  1623. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  1624. </div>
  1625. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  1626. <div class="tempalte_content">
  1627. <div class="date_item">
  1628. <input type="text" placeholder="请选择时间范围" id="begin_time_val_'.$random_code.'" class="item-input" readonly>
  1629. <div class="date_icon"><i class="layui-icon layui-icon-time" style="font-size: 25px;"></i></div>
  1630. </div>
  1631. </div>
  1632. </div>';
  1633. }else if($type == 'telephone'){
  1634. $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  1635. <div class="action-items">
  1636. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1637. <input type="hidden" name="form_type_'.$random_code.'" value="telephone"/>
  1638. <div class="action-title"><span class="title">手机号码</span></div>
  1639. <div class="input-title">
  1640. <div class="input-group">
  1641. <div class="input-group-addon">标题</div>
  1642. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="手机号码" update_id="#text_title_'.$random_code.'" update_type="html">
  1643. </div>
  1644. </div>
  1645. <div class="input-remark">
  1646. <div class="input-group">
  1647. <div class="input-group-addon">说明</div>
  1648. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
  1649. </div>
  1650. </div>
  1651. <div class="input-max">
  1652. <div class="input-group">
  1653. <div class="input-group-addon">提示语</div>
  1654. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请填写11位手机号码" update_id="#text_val_'.$random_code.'" update_type="tip">
  1655. </div>
  1656. </div>
  1657. <div class="input-required">
  1658. <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">
  1659. </div>
  1660. <div class="input-delete">
  1661. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1662. <i class="layui-icon">&#xe640;</i>删除
  1663. </a>
  1664. </div>
  1665. <script>
  1666. layui.use(["form"], function() {
  1667. var form = layui.form;
  1668. form.on("switch(required_'.$random_code.')", function(data){
  1669. var update_id = data.elem.attributes["update_id"].nodeValue;
  1670. if(data.elem.checked){
  1671. $(update_id).show();
  1672. }else{
  1673. $(update_id).hide();
  1674. }
  1675. });
  1676. });
  1677. </script>
  1678. </div>
  1679. </li>';
  1680. $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1681. <div class="template_item">
  1682. <span class="item_title" id="text_title_'.$random_code.'">手机号码</span>
  1683. <span class="item_required" id="text_required_'.$random_code.'">*</span>
  1684. </div>
  1685. <div class="template_tip" id="text_tip_'.$random_code.'"></div>
  1686. <div class="tempalte_content">
  1687. <input type="text" placeholder="请填写11位手机号码" id="text_val_'.$random_code.'" class="item-input">
  1688. </div>
  1689. </div>';
  1690. }
  1691. $need_data['item_li'] = $item_li;
  1692. $need_data['phone_item'] = $phone_item;
  1693. $need_data['random_code'] = $random_code;
  1694. return $need_data;
  1695. }
  1696. /**
  1697. * @author cy 2021-05-24
  1698. * @desc 获取万能表单信息
  1699. * @param $item
  1700. * @return array
  1701. */
  1702. public function setFormsContent($item){
  1703. $form_content = unserialize( $item['form_content'] );
  1704. $item_li = "";
  1705. $phone_item = "";
  1706. if(!empty($form_content) && count($form_content) > 0){
  1707. foreach($form_content as $k=>$v){
  1708. $random_code = random(10,false);
  1709. $required = $v['required'];
  1710. $type = $v['type'];
  1711. if($type == 'image'){//图片
  1712. $title = $v['title'];
  1713. $remark = $v['remark'];
  1714. $max_count = $v['max_count'];
  1715. $item_li = $item_li. '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  1716. <div class="action-items">
  1717. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1718. <input type="hidden" name="form_type_'.$random_code.'" value="image"/>
  1719. <div class="action-title"><span class="title">图片</span></div>
  1720. <div class="input-title">
  1721. <div class="input-group">
  1722. <div class="input-group-addon">标题</div>
  1723. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  1724. </div>
  1725. </div>
  1726. <div class="input-remark">
  1727. <div class="input-group">
  1728. <div class="input-group-addon">说明</div>
  1729. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  1730. </div>
  1731. </div>
  1732. <div class="input-max">
  1733. <div class="input-group">
  1734. <div class="input-group-addon">最大上传数量</div>
  1735. <input class="form-control" name="max_count_'.$random_code.'" type="text" placeholder="请输入最大上传数量" value="'.$max_count.'">
  1736. <div class="input-group-addon">张</div>
  1737. </div>
  1738. </div>
  1739. <div class="input-required">';
  1740. if($required == 1){
  1741. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  1742. }else{
  1743. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  1744. }
  1745. $item_li = $item_li . '</div>
  1746. <div class="input-delete">
  1747. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1748. <i class="layui-icon">&#xe640;</i>删除
  1749. </a>
  1750. </div>
  1751. <script>
  1752. layui.use("form", function() {
  1753. var form = layui.form;
  1754. form.on("switch(required_'.$random_code.')", function(data){
  1755. var update_id = data.elem.attributes["update_id"].nodeValue;
  1756. if(data.elem.checked){
  1757. $(update_id).show();
  1758. }else{
  1759. $(update_id).hide();
  1760. }
  1761. });
  1762. });
  1763. </script>
  1764. </div>
  1765. </li>';
  1766. $phone_item = $phone_item . '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1767. <div class="template_item">
  1768. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  1769. if($required == 1){
  1770. $phone_item = $phone_item . '<span class="item_required" id="text_required_'.$random_code.'" >*</span>';
  1771. }else{
  1772. $phone_item = $phone_item . '<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  1773. }
  1774. $phone_item = $phone_item . '
  1775. </div>
  1776. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  1777. <div class="tempalte_content">
  1778. <div class="image-add">
  1779. <div class="add">
  1780. <span class="iconfont-m- icon-m-jiahao">+</span>
  1781. </div>
  1782. <div class="add-text"> 添加图片 </div>
  1783. <input type="file" style="display: none;">
  1784. </div>
  1785. </div>
  1786. </div>';
  1787. }else if($type == 'text'){//单行文本
  1788. $title = $v['title'];
  1789. $remark = $v['remark'];
  1790. $hint = $v['hint'];
  1791. $item_li = $item_li . '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  1792. <div class="action-items">
  1793. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1794. <input type="hidden" name="form_type_'.$random_code.'" value="text"/>
  1795. <div class="action-title"><span class="title">单行文本</span></div>
  1796. <div class="input-title">
  1797. <div class="input-group">
  1798. <div class="input-group-addon">标题</div>
  1799. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  1800. </div>
  1801. </div>
  1802. <div class="input-remark">
  1803. <div class="input-group">
  1804. <div class="input-group-addon">说明</div>
  1805. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  1806. </div>
  1807. </div>
  1808. <div class="input-max">
  1809. <div class="input-group">
  1810. <div class="input-group-addon">提示语</div>
  1811. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="tip">
  1812. </div>
  1813. </div>
  1814. <div class="input-required">';
  1815. if($required == 1){
  1816. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  1817. }else{
  1818. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  1819. }
  1820. $item_li = $item_li . '</div>
  1821. <div class="input-delete">
  1822. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1823. <i class="layui-icon">&#xe640;</i>删除
  1824. </a>
  1825. </div>
  1826. <script>
  1827. layui.use("form", function() {
  1828. var form = layui.form;
  1829. form.on("switch(required_'.$random_code.')", function(data){
  1830. var update_id = data.elem.attributes["update_id"].nodeValue;
  1831. if(data.elem.checked){
  1832. $(update_id).show();
  1833. }else{
  1834. $(update_id).hide();
  1835. }
  1836. });
  1837. });
  1838. </script>
  1839. </div>
  1840. </li>';
  1841. $phone_item = $phone_item. '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1842. <div class="template_item">
  1843. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  1844. if($required == 1) {
  1845. $phone_item = $phone_item . '<span class="item_required" id = "text_required_'.$random_code.'" >*</span >';
  1846. }else{
  1847. $phone_item = $phone_item . '<span class="item_required" id = "text_required_'.$random_code.'" style="display:none;">*</span >';
  1848. }
  1849. $phone_item = $phone_item . '</div>
  1850. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  1851. <div class="tempalte_content">
  1852. <input type="text" placeholder="'.$hint.'" id="text_val_'.$random_code.'" class="item-input">
  1853. </div>
  1854. </div>';
  1855. }else if($type == 'textarea'){//多行文本
  1856. $title = $v['title'];
  1857. $remark = $v['remark'];
  1858. $hint = $v['hint'];
  1859. $item_li = $item_li . '<li lay-filter="action_li_'.$random_code.'">
  1860. <div class="action-items">
  1861. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1862. <input type="hidden" name="form_type_'.$random_code.'" value="textarea"/>
  1863. <div class="action-title"><span class="title">多行文本</span></div>
  1864. <div class="input-title">
  1865. <div class="input-group">
  1866. <div class="input-group-addon">标题</div>
  1867. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  1868. </div>
  1869. </div>
  1870. <div class="input-remark">
  1871. <div class="input-group">
  1872. <div class="input-group-addon">说明</div>
  1873. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  1874. </div>
  1875. </div>
  1876. <div class="input-max">
  1877. <div class="input-group">
  1878. <div class="input-group-addon">提示语</div>
  1879. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="tip">
  1880. </div>
  1881. </div>
  1882. <div class="input-required">';
  1883. if($required == 1){
  1884. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  1885. }else{
  1886. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  1887. }
  1888. $item_li = $item_li . '</div>
  1889. <div class="input-delete">
  1890. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1891. <i class="layui-icon">&#xe640;</i>删除
  1892. </a>
  1893. </div>
  1894. <script>
  1895. layui.use("form", function() {
  1896. var form = layui.form;
  1897. form.on("switch(required_'.$random_code.')", function(data){
  1898. var update_id = data.elem.attributes["update_id"].nodeValue;
  1899. if(data.elem.checked){
  1900. $(update_id).show();
  1901. }else{
  1902. $(update_id).hide();
  1903. }
  1904. });
  1905. });
  1906. </script>
  1907. </div>
  1908. </li>';
  1909. $phone_item = $phone_item.'<div class="phone-item" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  1910. <div class="template_item">
  1911. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  1912. if($required == 1){
  1913. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  1914. }else{
  1915. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  1916. }
  1917. $phone_item = $phone_item.'</div>
  1918. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  1919. <div class="tempalte_content">
  1920. <textarea type="text" placeholder="'.$hint.'" id="text_val_'.$random_code.'" class="item-input item-input-textarea"></textarea>
  1921. </div>
  1922. </div>';
  1923. }else if($type == 'select'){//下拉选项
  1924. $title = $v['title'];
  1925. $remark = $v['remark'];
  1926. $hint = $v['hint'];
  1927. $option_val = $v['option_val'];
  1928. $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  1929. <div class="action-items">
  1930. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  1931. <input type="hidden" name="form_type_'.$random_code.'" value="select"/>
  1932. <div class="action-title"><span class="title">下拉选项</span></div>
  1933. <div class="input-title">
  1934. <div class="input-group">
  1935. <div class="input-group-addon">标题</div>
  1936. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  1937. </div>
  1938. </div>
  1939. <div class="middle-content">
  1940. <div class="input-middle-item flex">
  1941. <div class="input-remark">
  1942. <div class="input-group">
  1943. <div class="input-group-addon">说明</div>
  1944. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  1945. </div>
  1946. </div>
  1947. <div class="input-max" style="width: 250px;">
  1948. <div class="input-group">
  1949. <div class="input-group-addon">提示语</div>
  1950. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="select_tip">
  1951. </div>
  1952. </div>
  1953. </div>';
  1954. if(!empty($option_val) && count($option_val) > 0){
  1955. $num = 1;
  1956. foreach($option_val as $pk=>$pv){
  1957. $item_li = $item_li.'<div class="input-middle-item">
  1958. <div class="input-group">
  1959. <div class="input-group-addon">选项<span class="sort">'.$num.'</span></div>
  1960. <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="'.$pv.'" style="width: 430px;">
  1961. <a class="delOptionBtn" href="javascript:;">
  1962. &nbsp;删除
  1963. </a>
  1964. </div>
  1965. </div>';
  1966. $num++;
  1967. }
  1968. }
  1969. $item_li = $item_li.'<div class="input-middle-item">
  1970. <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="select">
  1971. +添加选项
  1972. </a>
  1973. </div>
  1974. </div>
  1975. <div class="input-required">';
  1976. if($required == 1){
  1977. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  1978. }else{
  1979. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  1980. }
  1981. $item_li = $item_li.'</div>
  1982. <div class="input-delete">
  1983. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  1984. <i class="layui-icon">&#xe640;</i>删除
  1985. </a>
  1986. </div>
  1987. <script>
  1988. layui.use("form", function() {
  1989. var form = layui.form;
  1990. form.on("switch(required_'.$random_code.')", function(data){
  1991. var update_id = data.elem.attributes["update_id"].nodeValue;
  1992. if(data.elem.checked){
  1993. $(update_id).show();
  1994. }else{
  1995. $(update_id).hide();
  1996. }
  1997. });
  1998. });
  1999. </script>
  2000. </div>
  2001. </li>';
  2002. $phone_item = $phone_item. '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  2003. <div class="template_item">
  2004. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  2005. if($required == 1){
  2006. $phone_item = $phone_item. '<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  2007. }else{
  2008. $phone_item = $phone_item. '<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  2009. }
  2010. $phone_item = $phone_item. '</div>
  2011. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  2012. <div class="tempalte_content">
  2013. <select class="item-input" disabled id="text_val_'.$random_code.'">
  2014. <option value="">'.$hint.'</option>
  2015. </select>
  2016. </div>
  2017. </div>';
  2018. }else if($type == 'radio'){//单选
  2019. $title = $v['title'];
  2020. $remark = $v['remark'];
  2021. $option_val = $v['option_val'];
  2022. $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  2023. <div class="action-items">
  2024. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  2025. <input type="hidden" name="form_type_'.$random_code.'" value="radio"/>
  2026. <div class="action-title"><span class="title">单选</span></div>
  2027. <div class="input-title">
  2028. <div class="input-group">
  2029. <div class="input-group-addon">标题</div>
  2030. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  2031. </div>
  2032. </div>
  2033. <div class="middle-content">
  2034. <div class="input-middle-item flex">
  2035. <div class="input-remark" style="width: 550px;">
  2036. <div class="input-group">
  2037. <div class="input-group-addon">说明</div>
  2038. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  2039. </div>
  2040. </div>
  2041. </div>';
  2042. if(!empty($option_val) && count($option_val) > 0){
  2043. $num = 1;
  2044. foreach($option_val as $pk=>$pv){
  2045. $item_li = $item_li.'<div class="input-middle-item">
  2046. <div class="input-group">
  2047. <div class="input-group-addon">选项<span class="sort">'.$num.'</span></div>
  2048. <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="'.$pv.'" style="width: 430px;" update_id="#radio-item'.$num.'_'.$random_code.'" update_type="radio">
  2049. <a class="delOptionBtn" href="javascript:;" num="'.$num.'" random_code="'.$random_code.'">
  2050. &nbsp;删除
  2051. </a>
  2052. </div>
  2053. </div>';
  2054. $num++;
  2055. }
  2056. }
  2057. $item_li = $item_li.'<div class="input-middle-item">
  2058. <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="radio">
  2059. +添加选项
  2060. </a>
  2061. </div>
  2062. </div>
  2063. <div class="input-required">';
  2064. if($required == 1){
  2065. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  2066. }else{
  2067. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  2068. }
  2069. $item_li = $item_li.'</div>
  2070. <div class="input-delete">
  2071. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  2072. <i class="layui-icon">&#xe640;</i>删除
  2073. </a>
  2074. </div>
  2075. <script>
  2076. layui.use("form", function() {
  2077. var form = layui.form;
  2078. form.on("switch(required_'.$random_code.')", function(data){
  2079. var update_id = data.elem.attributes["update_id"].nodeValue;
  2080. if(data.elem.checked){
  2081. $(update_id).show();
  2082. }else{
  2083. $(update_id).hide();
  2084. }
  2085. });
  2086. });
  2087. </script>
  2088. </div>
  2089. </li>';
  2090. $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  2091. <div class="template_item">
  2092. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  2093. if($required == 1){
  2094. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  2095. }else{
  2096. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  2097. }
  2098. $phone_item = $phone_item.'</div>
  2099. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  2100. <div class="tempalte_content">
  2101. <div class="m-radio-box" id="m-radio-box_'.$random_code.'">';
  2102. if(!empty($option_val) && count($option_val) > 0){
  2103. $num = 1;
  2104. foreach($option_val as $pk=>$pv){
  2105. $phone_item = $phone_item.'<div class="radio-item" id="radio-item'.$num.'_'.$random_code.'">
  2106. <input type="radio" class="radio_option" name="radio" value="'.$pv.'" title="'.$pv.'">
  2107. </div>';
  2108. $num++;
  2109. }
  2110. }
  2111. $phone_item = $phone_item.'</div>
  2112. </div>
  2113. </div>';
  2114. }else if($type == 'checked'){//多选
  2115. $title = $v['title'];
  2116. $remark = $v['remark'];
  2117. $option_val = $v['option_val'];
  2118. $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  2119. <div class="action-items">
  2120. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  2121. <input type="hidden" name="form_type_'.$random_code.'" value="checked"/>
  2122. <div class="action-title"><span class="title">多选</span></div>
  2123. <div class="input-title">
  2124. <div class="input-group">
  2125. <div class="input-group-addon">标题</div>
  2126. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  2127. </div>
  2128. </div>
  2129. <div class="middle-content">
  2130. <div class="input-middle-item flex">
  2131. <div class="input-remark" style="width: 550px;">
  2132. <div class="input-group">
  2133. <div class="input-group-addon">说明</div>
  2134. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  2135. </div>
  2136. </div>
  2137. </div>';
  2138. if(!empty($option_val) && count($option_val) > 0){
  2139. $num = 1;
  2140. foreach($option_val as $pk=>$pv){
  2141. $item_li = $item_li.'<div class="input-middle-item">
  2142. <div class="input-group">
  2143. <div class="input-group-addon">选项<span class="sort">'.$num.'</span></div>
  2144. <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="'.$pv.'" style="width: 430px;" update_id="#radio-item'.$num.'_'.$random_code.'" update_type="radio">
  2145. <a class="delOptionBtn" href="javascript:;" num="'.$num.'" random_code="'.$random_code.'">
  2146. &nbsp;删除
  2147. </a>
  2148. </div>
  2149. </div>';
  2150. $num++;
  2151. }
  2152. }
  2153. $item_li = $item_li.'<div class="input-middle-item">
  2154. <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="checkbox">
  2155. +添加选项
  2156. </a>
  2157. </div>
  2158. </div>
  2159. <div class="input-required">';
  2160. if($required == 1){
  2161. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  2162. }else{
  2163. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  2164. }
  2165. $item_li = $item_li.'</div>
  2166. <div class="input-delete">
  2167. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  2168. <i class="layui-icon">&#xe640;</i>删除
  2169. </a>
  2170. </div>
  2171. <script>
  2172. layui.use("form", function() {
  2173. var form = layui.form;
  2174. form.on("switch(required_'.$random_code.')", function(data){
  2175. var update_id = data.elem.attributes["update_id"].nodeValue;
  2176. if(data.elem.checked){
  2177. $(update_id).show();
  2178. }else{
  2179. $(update_id).hide();
  2180. }
  2181. });
  2182. });
  2183. </script>
  2184. </div>
  2185. </li>';
  2186. $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  2187. <div class="template_item">
  2188. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  2189. if($required == 1){
  2190. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  2191. }else{
  2192. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  2193. }
  2194. $phone_item = $phone_item.'</div>
  2195. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  2196. <div class="tempalte_content">
  2197. <div class="m-radio-box" id="m-radio-box_'.$random_code.'">';
  2198. if(!empty($option_val) && count($option_val) > 0){
  2199. $num = 1;
  2200. foreach($option_val as $pk=>$pv){
  2201. $phone_item = $phone_item.'<div class="radio-item" id="radio-item'.$num.'_'.$random_code.'">
  2202. <input type="checkbox" class="radio_option" name="checkbox" title="'.$pv.'" value="'.$pv.'" lay-skin="primary">
  2203. </div>';
  2204. $num++;
  2205. }
  2206. }
  2207. $phone_item = $phone_item.'</div>
  2208. </div>
  2209. </div>';
  2210. }else if($type == 'area'){//地区
  2211. $title = $v['title'];
  2212. $remark = $v['remark'];
  2213. $hint = $v['hint'];
  2214. $area_type = $v['area_type'];
  2215. $province_id = $v['province_id'];
  2216. $city_id = $v['city_id'];
  2217. $country_id = $v['country_id'];
  2218. $address = "";
  2219. if($province_id != '请选择省份'){
  2220. $address = $address . $province_id;
  2221. }
  2222. if($city_id != '请选择城市'){
  2223. $address = $address . $city_id;
  2224. }
  2225. if($country_id != '请选择区域'){
  2226. $address = $address . $country_id;
  2227. }
  2228. $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  2229. <div class="action-items">
  2230. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  2231. <input type="hidden" name="form_type_'.$random_code.'" value="area"/>
  2232. <div class="action-title"><span class="title">地区</span></div>
  2233. <div class="input-title">
  2234. <div class="input-group">
  2235. <div class="input-group-addon">标题</div>
  2236. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  2237. </div>
  2238. </div>
  2239. <div class="middle-content" style="width:560px">
  2240. <div class="input-middle-item flex">
  2241. <div class="input-remark">
  2242. <div class="input-group">
  2243. <div class="input-group-addon">说明</div>
  2244. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  2245. </div>
  2246. </div>
  2247. <div class="input-max">
  2248. <div class="input-group">
  2249. <div class="input-group-addon">提示语</div>
  2250. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#address_'.$random_code.'" random_code="'.$random_code.'" update_type="select_area_tip">
  2251. </div>
  2252. </div>
  2253. </div>
  2254. <div class="input-middle-item">
  2255. <div class="input-group">
  2256. <label class="label_title">填写条件:</label>';
  2257. if($area_type == 'province'){
  2258. $item_li = $item_li.'<label class="radio-inline">
  2259. <input type="radio" title="省份" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="province" checked="checked">
  2260. </label>
  2261. <label class="radio-inline">
  2262. <input type="radio" title="省市" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="city">
  2263. </label>
  2264. <label class="radio-inline">
  2265. <input type="radio" title="省市区" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="country">
  2266. </label>
  2267. </div>
  2268. </div>
  2269. <div class="input-middle-item flex" id="areaParent_'.$random_code.'">
  2270. <div class="input-group province_select">
  2271. <div class="input-group-addon">默认值&nbsp;省</div>
  2272. <select class="sel-province" lay-ignore name="province_id_'.$random_code.'" onChange="selectCity(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
  2273. <option value="" selected="true">请选择</option>
  2274. </select>
  2275. </div>
  2276. <div class="input-group city_select" style="display:none;">
  2277. <div class="input-group-addon">默认值&nbsp;市</div>
  2278. <select class="sel-city" lay-ignore name="city_id_'.$random_code.'" onChange="selectArea(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
  2279. <option value="" selected="true">请选择</option>
  2280. </select>
  2281. </div>
  2282. <div class="input-group country_select" style="display:none;">
  2283. <div class="input-group-addon">默认值&nbsp;区</div>
  2284. <select class="sel-area" lay-ignore name="country_id_'.$random_code.'" onChange="updateArea(\'' . $random_code . '\')" style="width: 130px;display:inline;">
  2285. <option value="" selected="true">请选择</option>
  2286. </select>
  2287. </div>';
  2288. }else if($area_type == 'city'){
  2289. $item_li = $item_li.' <label class="radio-inline">
  2290. <input type="radio" title="省份" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="province">
  2291. </label>
  2292. <label class="radio-inline">
  2293. <input type="radio" title="省市" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="city" checked="checked">
  2294. </label>
  2295. <label class="radio-inline">
  2296. <input type="radio" title="省市区" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="country">
  2297. </label>
  2298. </div>
  2299. </div>
  2300. <div class="input-middle-item flex" id="areaParent_'.$random_code.'">
  2301. <div class="input-group province_select">
  2302. <div class="input-group-addon">默认值&nbsp;省</div>
  2303. <select class="sel-province" lay-ignore name="province_id_'.$random_code.'" onChange="selectCity(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
  2304. <option value="" selected="true">请选择</option>
  2305. </select>
  2306. </div>
  2307. <div class="input-group city_select">
  2308. <div class="input-group-addon">默认值&nbsp;市</div>
  2309. <select class="sel-city" lay-ignore name="city_id_'.$random_code.'" onChange="selectArea(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
  2310. <option value="" selected="true">请选择</option>
  2311. </select>
  2312. </div>
  2313. <div class="input-group country_select" style="display:none;">
  2314. <div class="input-group-addon">默认值&nbsp;区</div>
  2315. <select class="sel-area" lay-ignore name="country_id_'.$random_code.'" onChange="updateArea(\'' . $random_code . '\')" style="width: 130px;display:inline;">
  2316. <option value="" selected="true">请选择</option>
  2317. </select>
  2318. </div>';
  2319. }else if($area_type == 'country'){
  2320. $item_li = $item_li.'<label class="radio-inline">
  2321. <input type="radio" title="省份" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="province">
  2322. </label>
  2323. <label class="radio-inline">
  2324. <input type="radio" title="省市" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="city">
  2325. </label>
  2326. <label class="radio-inline">
  2327. <input type="radio" title="省市区" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="country" checked="checked">
  2328. </label>
  2329. </div>
  2330. </div>
  2331. <div class="input-middle-item flex" id="areaParent_'.$random_code.'">
  2332. <div class="input-group province_select">
  2333. <div class="input-group-addon">默认值&nbsp;省</div>
  2334. <select class="sel-province" lay-ignore name="province_id_'.$random_code.'" onChange="selectCity(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
  2335. <option value="" selected="true">请选择</option>
  2336. </select>
  2337. </div>
  2338. <div class="input-group city_select">
  2339. <div class="input-group-addon">默认值&nbsp;市</div>
  2340. <select class="sel-city" lay-ignore name="city_id_'.$random_code.'" onChange="selectcounty(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
  2341. <option value="" selected="true">请选择</option>
  2342. </select>
  2343. </div>
  2344. <div class="input-group country_select">
  2345. <div class="input-group-addon">默认值&nbsp;区</div>
  2346. <select class="sel-area" lay-ignore name="country_id_'.$random_code.'" onChange="updateArea(\'' . $random_code . '\')" style="width: 130px;display:inline;">
  2347. <option value="" selected="true">请选择</option>
  2348. </select>
  2349. </div>';
  2350. }
  2351. $item_li = $item_li.'<script>
  2352. layui.use("form", function() {
  2353. var form = layui.form;
  2354. form.on("switch(required_'.$random_code.')", function(data){
  2355. var update_id = data.elem.attributes["update_id"].nodeValue;
  2356. if(data.elem.checked){
  2357. $(update_id).show();
  2358. }else{
  2359. $(update_id).hide();
  2360. }
  2361. });
  2362. cascdeInit(0,0,"areaParent_'.$random_code.'","'.$province_id.'","'.$city_id.'","'.$country_id.'");
  2363. $(".area_type_'.$random_code.'").click(function(){
  2364. var type = $(this).val();
  2365. var obj = $(this).parent().parent().parent().parent();
  2366. if (type == "province") {
  2367. obj.find(".city_select").hide();
  2368. obj.find(".country_select").hide();
  2369. } else if(type == "city") {
  2370. obj.find(".city_select").show();
  2371. obj.find(".country_select").hide();
  2372. } else if(type == "country") {
  2373. obj.find(".city_select").show();
  2374. obj.find(".country_select").show();
  2375. }
  2376. updateArea("'.$random_code.'");
  2377. });
  2378. });
  2379. </script>
  2380. </div>
  2381. </div>
  2382. <div class="input-required">';
  2383. if($required == 1){
  2384. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  2385. }else{
  2386. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  2387. }
  2388. $item_li = $item_li.'</div>
  2389. <div class="input-delete">
  2390. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  2391. <i class="layui-icon">&#xe640;</i>删除
  2392. </a>
  2393. </div>
  2394. </div>
  2395. </li>';
  2396. $phone_item = $phone_item. '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  2397. <div class="template_item">
  2398. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  2399. if($required == 1){
  2400. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  2401. }else{
  2402. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  2403. }
  2404. $phone_item = $phone_item. '
  2405. </div>
  2406. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  2407. <div class="tempalte_content">
  2408. <select class="item-input" id="address_'.$random_code.'" placeholder="'.$hint.'">
  2409. <option value="">'.$address.'</option>
  2410. </select>
  2411. </div>
  2412. </div>';
  2413. }else if($type == 'date'){//日期
  2414. $title = $v['title'];
  2415. $remark = $v['remark'];
  2416. $hint = $v['hint'];
  2417. $date_type = $v['date_type'];
  2418. $appoint_date = $v['appoint_date'];
  2419. $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  2420. <div class="action-items">
  2421. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  2422. <input type="hidden" name="form_type_'.$random_code.'" value="date"/>
  2423. <div class="action-title"><span class="title">日期</span></div>
  2424. <div class="input-title">
  2425. <div class="input-group">
  2426. <div class="input-group-addon">标题</div>
  2427. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  2428. </div>
  2429. </div>
  2430. <div class="middle-content" style="width: 570px;">
  2431. <div class="input-middle-item flex">
  2432. <div class="input-remark">
  2433. <div class="input-group">
  2434. <div class="input-group-addon">说明</div>
  2435. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  2436. </div>
  2437. </div>
  2438. <div class="input-max">
  2439. <div class="input-group" >
  2440. <div class="input-group-addon">提示语</div>
  2441. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#date_val_'.$random_code.'" random_code="'.$random_code.'" update_type="tip">
  2442. </div>
  2443. </div>
  2444. </div>
  2445. <div class="input-middle-item">
  2446. <div class="input-group">
  2447. <label style="font-size: 14px;font-weight: bold;line-height: 20px;">默认:</label>';
  2448. if($date_type == 'no_default'){
  2449. $item_li = $item_li.'<label class="radio-inline">
  2450. <input type="radio" title="不默认" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="no_default" checked="checked">
  2451. </label>
  2452. <label class="radio-inline">
  2453. <input type="radio" title="填表当天" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="same_day">
  2454. </label>
  2455. <label class="radio-inline">
  2456. <input type="radio" title="指定日期" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="appoint_date">
  2457. </label>
  2458. <div class="radio-inline appoint_date_txt_'.$random_code.'" style="display:none;">
  2459. <input type="text" class="layui-input" id="appoint_date_'.$random_code.'" name="appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  2460. </div>';
  2461. }else if($date_type == 'same_day'){
  2462. $item_li = $item_li.'<label class="radio-inline">
  2463. <input type="radio" title="不默认" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="no_default">
  2464. </label>
  2465. <label class="radio-inline">
  2466. <input type="radio" title="填表当天" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="same_day" checked="checked">
  2467. </label>
  2468. <label class="radio-inline">
  2469. <input type="radio" title="指定日期" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="appoint_date">
  2470. </label>
  2471. <div class="radio-inline appoint_date_txt_'.$random_code.'" style="display:none;">
  2472. <input type="text" class="layui-input" id="appoint_date_'.$random_code.'" name="appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  2473. </div>';
  2474. }else if($date_type == 'appoint_date'){
  2475. $item_li = $item_li.'<label class="radio-inline">
  2476. <input type="radio" title="不默认" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="no_default">
  2477. </label>
  2478. <label class="radio-inline">
  2479. <input type="radio" title="填表当天" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="same_day">
  2480. </label>
  2481. <label class="radio-inline">
  2482. <input type="radio" title="指定日期" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="appoint_date" checked="checked">
  2483. </label>
  2484. <div class="radio-inline appoint_date_txt_'.$random_code.'">
  2485. <input type="text" class="layui-input" id="appoint_date_'.$random_code.'" name="appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  2486. </div>';
  2487. }
  2488. $item_li = $item_li.'</div>
  2489. </div>
  2490. </div>
  2491. <div class="input-required">';
  2492. if($required == 1){
  2493. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  2494. }else{
  2495. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  2496. }
  2497. $item_li = $item_li.'</div>
  2498. <div class="input-delete">
  2499. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  2500. <i class="layui-icon">&#xe640;</i>删除
  2501. </a>
  2502. </div>
  2503. <script>
  2504. layui.use(["laydate","form"], function() {
  2505. var laydate = layui.laydate;
  2506. var form = layui.form;
  2507. //常规用法
  2508. laydate.render({
  2509. elem: "#appoint_date_'.$random_code.'",
  2510. value: "'.$appoint_date.'",
  2511. done:function(value, date, endDate){
  2512. $("#date_val_'.$random_code.'").val(value);
  2513. }
  2514. });
  2515. form.on("switch(required_'.$random_code.')", function(data){
  2516. var update_id = data.elem.attributes["update_id"].nodeValue;
  2517. if(data.elem.checked){
  2518. $(update_id).show();
  2519. }else{
  2520. $(update_id).hide();
  2521. }
  2522. });
  2523. });
  2524. $(".date_type_'.$random_code.'").click(function(){
  2525. var date_type = $(this).val();
  2526. var obj = $(this).parent().parent();
  2527. if (date_type == "no_default") {
  2528. obj.find(".appoint_date_txt_'.$random_code.'").hide();
  2529. $("#date_val_'.$random_code.'").val("");
  2530. } else if(date_type == "same_day") {
  2531. obj.find(".appoint_date_txt_'.$random_code.'").hide();
  2532. $("#date_val_'.$random_code.'").val("");
  2533. } else if(date_type == "appoint_date") {
  2534. obj.find(".appoint_date_txt_'.$random_code.'").show();
  2535. var appoint_date = $("#appoint_date_'.$random_code.'").val();
  2536. $("#date_val_'.$random_code.'").val(appoint_date);
  2537. }
  2538. });
  2539. </script>
  2540. </div>
  2541. </li>';
  2542. $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  2543. <div class="template_item">
  2544. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  2545. if($required == 1){
  2546. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  2547. }else{
  2548. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  2549. }
  2550. $moren_date = "";
  2551. if($date_type == 'appoint_date'){
  2552. $moren_date = $appoint_date;
  2553. }
  2554. $phone_item = $phone_item.'</div>
  2555. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  2556. <div class="tempalte_content">
  2557. <div class="date_item">
  2558. <input type="text" placeholder="'.$hint.'" id="date_val_'.$random_code.'" class="item-input" readonly value="'.$moren_date.'">
  2559. <div class="date_icon"><i class="layui-icon layui-icon-date" style="font-size: 25px;"></i></div>
  2560. </div>
  2561. </div>
  2562. </div>';
  2563. }else if($type == 'date_range'){
  2564. $title = $v['title'];
  2565. $remark = $v['remark'];
  2566. $begin_date_type = $v['begin_date_type'];
  2567. $begin_hint = $v['begin_hint'];
  2568. $begin_appoint_date = $v['begin_appoint_date'];
  2569. $end_date_type = $v['end_date_type'];
  2570. $end_hint = $v['end_hint'];
  2571. $end_appoint_date = $v['end_appoint_date'];
  2572. $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  2573. <div class="action-items">
  2574. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  2575. <input type="hidden" name="form_type_'.$random_code.'" value="date_range"/>
  2576. <div class="action-title"><span class="title">日期范围</span></div>
  2577. <div class="input-title">
  2578. <div class="input-group">
  2579. <div class="input-group-addon">标题</div>
  2580. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  2581. </div>
  2582. </div>
  2583. <div class="middle-content">
  2584. <div class="input-middle-item flex">
  2585. <div class="input-remark" style="width: 550px;">
  2586. <div class="input-group" style="margin-bottom: 5px;">
  2587. <div class="input-group-addon">说明</div>
  2588. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  2589. </div>
  2590. <div class="input-group">
  2591. <div class="input-group-addon">提示语</div>
  2592. <input class="form-control" name="begin_hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$begin_hint.'" style="width: 500px;" update_id="#begin_date_val_'.$random_code.'" random_code="'.$random_code.'" update_type="tip">
  2593. </div>
  2594. </div>
  2595. </div>
  2596. <div class="input-middle-item">
  2597. <div class="input-group"><label class="label_title">开始日期</label></div>
  2598. <div class="input-group" style="margin-bottom: 5px;">
  2599. <label class="label_title">默认:</label>';
  2600. if($begin_date_type == 'no_default'){
  2601. $item_li = $item_li.'<label class="radio-inline">
  2602. <input type="radio" title="不默认" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="no_default" checked="checked">
  2603. </label>
  2604. <label class="radio-inline">
  2605. <input type="radio" title="填表当天" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="same_day">
  2606. </label>
  2607. <label class="radio-inline">
  2608. <input type="radio" title="指定日期" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="appoint_date">
  2609. </label>
  2610. <div class="radio-inline begin_appoint_date_txt_'.$random_code.'" style="display:none;">
  2611. <input type="text" class="layui-input" id="begin_appoint_date_'.$random_code.'" name="begin_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  2612. </div>';
  2613. }else if($begin_date_type == 'same_day'){
  2614. $item_li = $item_li.'<label class="radio-inline">
  2615. <input type="radio" title="不默认" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="no_default">
  2616. </label>
  2617. <label class="radio-inline">
  2618. <input type="radio" title="填表当天" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="same_day" checked="checked">
  2619. </label>
  2620. <label class="radio-inline">
  2621. <input type="radio" title="指定日期" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="appoint_date">
  2622. </label>
  2623. <div class="radio-inline begin_appoint_date_txt_'.$random_code.'" style="display:none;">
  2624. <input type="text" class="layui-input" id="begin_appoint_date_'.$random_code.'" name="begin_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  2625. </div>';
  2626. }else if($begin_date_type == 'appoint_date'){
  2627. $item_li = $item_li.'<label class="radio-inline">
  2628. <input type="radio" title="不默认" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="no_default">
  2629. </label>
  2630. <label class="radio-inline">
  2631. <input type="radio" title="填表当天" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="same_day">
  2632. </label>
  2633. <label class="radio-inline">
  2634. <input type="radio" title="指定日期" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="appoint_date" checked="checked">
  2635. </label>
  2636. <div class="radio-inline begin_appoint_date_txt_'.$random_code.'">
  2637. <input type="text" class="layui-input" id="begin_appoint_date_'.$random_code.'" name="begin_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  2638. </div>';
  2639. }
  2640. $item_li = $item_li.'</div>
  2641. </div>
  2642. <div class="input-middle-item">
  2643. <div class="input-group"><label class="label_title">结束日期</label></div>
  2644. <div class="input-group" style="margin-bottom: 5px;">
  2645. <label class="label_title">默认:</label>';
  2646. if($end_date_type == 'no_default'){
  2647. $item_li = $item_li.'<label class="radio-inline">
  2648. <input type="radio" title="不默认" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="no_default" checked="checked">
  2649. </label>
  2650. <label class="radio-inline">
  2651. <input type="radio" title="填表当天" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="same_day">
  2652. </label>
  2653. <label class="radio-inline">
  2654. <input type="radio" title="指定日期" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="appoint_date">
  2655. </label>
  2656. <div class="radio-inline end_appoint_date_txt_'.$random_code.'" style="display:none;">
  2657. <input type="text" class="layui-input" id="end_appoint_date_'.$random_code.'" name="end_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  2658. </div>';
  2659. }else if($end_date_type == 'same_day'){
  2660. $item_li = $item_li.'<label class="radio-inline">
  2661. <input type="radio" title="不默认" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="no_default">
  2662. </label>
  2663. <label class="radio-inline">
  2664. <input type="radio" title="填表当天" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="same_day" checked="checked">
  2665. </label>
  2666. <label class="radio-inline">
  2667. <input type="radio" title="指定日期" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="appoint_date">
  2668. </label>
  2669. <div class="radio-inline end_appoint_date_txt_'.$random_code.'" style="display:none;">
  2670. <input type="text" class="layui-input" id="end_appoint_date_'.$random_code.'" name="end_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  2671. </div>';
  2672. }else if($end_date_type == 'appoint_date'){
  2673. $item_li = $item_li.'<label class="radio-inline">
  2674. <input type="radio" title="不默认" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="no_default">
  2675. </label>
  2676. <label class="radio-inline">
  2677. <input type="radio" title="填表当天" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="same_day">
  2678. </label>
  2679. <label class="radio-inline">
  2680. <input type="radio" title="指定日期" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="appoint_date" checked="checked">
  2681. </label>
  2682. <div class="radio-inline end_appoint_date_txt_'.$random_code.'">
  2683. <input type="text" class="layui-input" id="end_appoint_date_'.$random_code.'" name="end_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
  2684. </div>';
  2685. }
  2686. $item_li = $item_li.'</div>
  2687. </div>
  2688. </div>
  2689. <div class="input-required">';
  2690. if($required == 1){
  2691. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  2692. }else{
  2693. $item_li = $item_li.'<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  2694. }
  2695. $item_li = $item_li.'</div>
  2696. <div class="input-delete">
  2697. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  2698. <i class="layui-icon">&#xe640;</i>删除
  2699. </a>
  2700. </div>
  2701. <script>
  2702. layui.use(["laydate","form"], function() {
  2703. var laydate = layui.laydate;
  2704. var form = layui.form;
  2705. //常规用法
  2706. laydate.render({
  2707. elem: "#begin_appoint_date_'.$random_code.'",
  2708. value: "'.$begin_appoint_date.'",
  2709. done:function(value, date, endDate){
  2710. $("#begin_date_val_'.$random_code.'").val(value);
  2711. }
  2712. });
  2713. laydate.render({
  2714. elem: "#end_appoint_date_'.$random_code.'",
  2715. value: "'.$end_appoint_date.'",
  2716. done:function(value, date, endDate){
  2717. $("#end_date_val_'.$random_code.'").val(value);
  2718. }
  2719. });
  2720. form.on("switch(required_'.$random_code.')", function(data){
  2721. var update_id = data.elem.attributes["update_id"].nodeValue;
  2722. if(data.elem.checked){
  2723. $(update_id).show();
  2724. }else{
  2725. $(update_id).hide();
  2726. }
  2727. });
  2728. });
  2729. $(".begin_date_type_'.$random_code.'").click(function(){
  2730. var date_type = $(this).val();
  2731. var obj = $(this).parent().parent();
  2732. if (date_type == "no_default") {
  2733. $("#begin_date_val_'.$random_code.'").val("");
  2734. obj.find(".begin_appoint_date_txt_'.$random_code.'").hide();
  2735. } else if(date_type == "same_day") {
  2736. $("#begin_date_val_'.$random_code.'").val("");
  2737. obj.find(".begin_appoint_date_txt_'.$random_code.'").hide();
  2738. } else if(date_type == "appoint_date") {
  2739. obj.find(".begin_appoint_date_txt_'.$random_code.'").show();
  2740. var begin_appoint_date = $("#begin_appoint_date_'.$random_code.'").val();
  2741. $("#begin_date_val_'.$random_code.'").val(begin_appoint_date);
  2742. }
  2743. });
  2744. $(".end_date_type_'.$random_code.'").click(function(){
  2745. var date_type = $(this).val();
  2746. var obj = $(this).parent().parent();
  2747. if (date_type == "no_default") {
  2748. obj.find(".end_appoint_date_txt_'.$random_code.'").hide();
  2749. $("#end_date_val_'.$random_code.'").val("");
  2750. } else if(date_type == "same_day") {
  2751. obj.find(".end_appoint_date_txt_'.$random_code.'").hide();
  2752. $("#end_date_val_'.$random_code.'").val("");
  2753. } else if(date_type == "appoint_date") {
  2754. obj.find(".end_appoint_date_txt_'.$random_code.'").show();
  2755. var end_appoint_date = $("#end_appoint_date_'.$random_code.'").val();
  2756. $("#end_date_val_'.$random_code.'").val(end_appoint_date);
  2757. }
  2758. });
  2759. </script>
  2760. </div>
  2761. </li>';
  2762. $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  2763. <div class="template_item">
  2764. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  2765. if($required == 1){
  2766. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  2767. }else{
  2768. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  2769. }
  2770. $begin_moren_date = "";
  2771. if($begin_date_type == 'appoint_date'){
  2772. $begin_moren_date = $begin_appoint_date;
  2773. }
  2774. $end_moren_date = "";
  2775. if($end_date_type == 'appoint_date'){
  2776. $end_moren_date = $end_appoint_date;
  2777. }
  2778. $phone_item = $phone_item.'
  2779. </div>
  2780. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  2781. <div class="tempalte_content">
  2782. <div class="date_item">
  2783. <input type="text" placeholder="请选择日期范围" id="begin_date_val_'.$random_code.'" class="item-input" readonly value="'.$begin_moren_date.'~'.$end_moren_date.'">
  2784. <div class="date_icon"><i class="layui-icon layui-icon-date" style="font-size: 25px;"></i></div>
  2785. </div>
  2786. </div>
  2787. </div>';
  2788. }else if($type == 'idcard'){
  2789. $title = $v['title'];
  2790. $remark = $v['remark'];
  2791. $hint = $v['hint'];
  2792. $item_li = $item_li . '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  2793. <div class="action-items">
  2794. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  2795. <input type="hidden" name="form_type_'.$random_code.'" value="idcard"/>
  2796. <div class="action-title"><span class="title">身份证号码</span></div>
  2797. <div class="input-title">
  2798. <div class="input-group">
  2799. <div class="input-group-addon">标题</div>
  2800. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  2801. </div>
  2802. </div>
  2803. <div class="input-remark">
  2804. <div class="input-group">
  2805. <div class="input-group-addon">说明</div>
  2806. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  2807. </div>
  2808. </div>
  2809. <div class="input-max">
  2810. <div class="input-group">
  2811. <div class="input-group-addon">提示语</div>
  2812. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="tip">
  2813. </div>
  2814. </div>
  2815. <div class="input-required">';
  2816. if($required == 1){
  2817. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  2818. }else{
  2819. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  2820. }
  2821. $item_li = $item_li . '</div>
  2822. <div class="input-delete">
  2823. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  2824. <i class="layui-icon">&#xe640;</i>删除
  2825. </a>
  2826. </div>
  2827. <script>
  2828. layui.use("form", function() {
  2829. var form = layui.form;
  2830. form.on("switch(required_'.$random_code.')", function(data){
  2831. var update_id = data.elem.attributes["update_id"].nodeValue;
  2832. if(data.elem.checked){
  2833. $(update_id).show();
  2834. }else{
  2835. $(update_id).hide();
  2836. }
  2837. });
  2838. });
  2839. </script>
  2840. </div>
  2841. </li>';
  2842. $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  2843. <div class="template_item">
  2844. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  2845. if($required == 1){
  2846. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  2847. }else{
  2848. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  2849. }
  2850. $phone_item = $phone_item.'</div>
  2851. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  2852. <div class="tempalte_content">
  2853. <input type="text" name="" placeholder="'.$hint.'" id="text_val_'.$random_code.'" class="item-input">
  2854. </div>
  2855. </div>';
  2856. }else if($type == 'time'){
  2857. $title = $v['title'];
  2858. $remark = $v['remark'];
  2859. $hint = $v['hint'];
  2860. $time_type = $v['time_type'];
  2861. $appoint_time = $v['appoint_time'];
  2862. $item_li = $item_li. '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  2863. <div class="action-items">
  2864. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  2865. <input type="hidden" name="form_type_'.$random_code.'" value="time"/>
  2866. <div class="action-title"><span class="title">时间</span></div>
  2867. <div class="input-title">
  2868. <div class="input-group">
  2869. <div class="input-group-addon">标题</div>
  2870. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  2871. </div>
  2872. </div>
  2873. <div class="middle-content" style="width: 560px;">
  2874. <div class="input-middle-item flex">
  2875. <div class="input-remark">
  2876. <div class="input-group">
  2877. <div class="input-group-addon">说明</div>
  2878. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  2879. </div>
  2880. </div>
  2881. <div class="input-max">
  2882. <div class="input-group">
  2883. <div class="input-group-addon">提示语</div>
  2884. <input class="form-control" style="width: 180px;" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#date_val_'.$random_code.'" update_type="tip">
  2885. </div>
  2886. </div>
  2887. </div>
  2888. <div class="input-middle-item">
  2889. <div class="input-group">
  2890. <label style="font-size: 14px;font-weight: bold;line-height: 20px;">默认:</label>';
  2891. if($time_type == 'no_default'){
  2892. $item_li = $item_li. '<label class="radio-inline">
  2893. <input type="radio" title="不默认" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="no_default" checked="checked">
  2894. </label>
  2895. <label class="radio-inline">
  2896. <input type="radio" title="填表当时" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="same_time">
  2897. </label>
  2898. <label class="radio-inline">
  2899. <input type="radio" title="指定时间" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="appoint_time">
  2900. </label>
  2901. <div class="radio-inline appoint_time_txt_'.$random_code.'" style="display:none;">
  2902. <input type="text" class="layui-input" id="appoint_time_'.$random_code.'" name="appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  2903. </div>';
  2904. }else if($time_type == 'same_time'){
  2905. $item_li = $item_li. '<label class="radio-inline">
  2906. <input type="radio" title="不默认" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="no_default">
  2907. </label>
  2908. <label class="radio-inline">
  2909. <input type="radio" title="填表当时" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="same_time" checked="checked">
  2910. </label>
  2911. <label class="radio-inline">
  2912. <input type="radio" title="指定时间" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="appoint_time">
  2913. </label>
  2914. <div class="radio-inline appoint_time_txt_'.$random_code.'" style="display:none;">
  2915. <input type="text" class="layui-input" id="appoint_time_'.$random_code.'" name="appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  2916. </div>';
  2917. }else if($time_type == 'appoint_time'){
  2918. $item_li = $item_li. '<label class="radio-inline">
  2919. <input type="radio" title="不默认" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="no_default">
  2920. </label>
  2921. <label class="radio-inline">
  2922. <input type="radio" title="填表当时" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="same_time">
  2923. </label>
  2924. <label class="radio-inline">
  2925. <input type="radio" title="指定时间" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="appoint_time" checked="checked">
  2926. </label>
  2927. <div class="radio-inline appoint_time_txt_'.$random_code.'">
  2928. <input type="text" class="layui-input" style="width: 180px;" id="appoint_time_'.$random_code.'" name="appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  2929. </div>';
  2930. }
  2931. $item_li = $item_li. ' </div>
  2932. </div>
  2933. </div>
  2934. <div class="input-required">';
  2935. if($required == 1){
  2936. $item_li = $item_li. ' <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  2937. }else{
  2938. $item_li = $item_li. ' <input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  2939. }
  2940. $item_li = $item_li. '
  2941. </div>
  2942. <div class="input-delete">
  2943. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  2944. <i class="layui-icon">&#xe640;</i>删除
  2945. </a>
  2946. </div>
  2947. <script>
  2948. layui.use(["laydate","form"], function() {
  2949. var laydate = layui.laydate;
  2950. var form = layui.form;
  2951. //常规用法
  2952. laydate.render({
  2953. elem: "#appoint_time_' . $random_code . '"
  2954. ,value: "'.$appoint_time.'"
  2955. ,type: "time"
  2956. ,done:function(value, date, endDate){
  2957. $("#date_val_' . $random_code . '").val(value);
  2958. }
  2959. });
  2960. form.on("switch(required_'.$random_code.')", function(data){
  2961. var update_id = data.elem.attributes["update_id"].nodeValue;
  2962. if(data.elem.checked){
  2963. $(update_id).show();
  2964. }else{
  2965. $(update_id).hide();
  2966. }
  2967. });
  2968. });
  2969. $(".time_type_'.$random_code.'").click(function(){
  2970. var date_type = $(this).val();
  2971. var obj = $(this).parent().parent();
  2972. if (date_type == "no_default") {
  2973. $("#date_val_'.$random_code.'").val("");
  2974. obj.find(".appoint_time_txt_'.$random_code.'").hide();
  2975. } else if(date_type == "same_time") {
  2976. $("#date_val_'.$random_code.'").val("");
  2977. obj.find(".appoint_time_txt_'.$random_code.'").hide();
  2978. } else if(date_type == "appoint_time") {
  2979. obj.find(".appoint_time_txt_'.$random_code.'").show();
  2980. var appoint_time = $("#appoint_time_'.$random_code.'").val();
  2981. $("#date_val_'.$random_code.'").val(appoint_time);
  2982. }
  2983. });
  2984. </script>
  2985. </div>
  2986. </li>';
  2987. $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  2988. <div class="template_item">
  2989. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  2990. if($required == 1){
  2991. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  2992. }else{
  2993. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  2994. }
  2995. $appoint_type_time = "";
  2996. if($time_type == 'appoint_time'){
  2997. $appoint_type_time = $appoint_time;
  2998. }
  2999. $phone_item = $phone_item.'</div>
  3000. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  3001. <div class="tempalte_content">
  3002. <div class="date_item">
  3003. <input type="text" placeholder="'.$hint.'" id="date_val_'.$random_code.'" class="item-input" readonly value="'.$appoint_type_time.'">
  3004. <div class="date_icon"><i class="layui-icon layui-icon-time" style="font-size: 25px;"></i></div>
  3005. </div>
  3006. </div>
  3007. </div>';
  3008. }else if($type == 'time_range'){
  3009. $title = $v['title'];
  3010. $remark = $v['remark'];
  3011. $begin_time_type = $v['begin_time_type'];
  3012. $begin_hint = $v['begin_hint'];
  3013. $begin_appoint_time = $v['begin_appoint_time'];
  3014. $end_time_type = $v['end_time_type'];
  3015. $end_hint = $v['end_hint'];
  3016. $end_appoint_time = $v['end_appoint_time'];
  3017. $item_li = $item_li . '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  3018. <div class="action-items">
  3019. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  3020. <input type="hidden" name="form_type_'.$random_code.'" value="time_range"/>
  3021. <div class="action-title"><span class="title">时间范围</span></div>
  3022. <div class="input-title">
  3023. <div class="input-group">
  3024. <div class="input-group-addon">标题</div>
  3025. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  3026. </div>
  3027. </div>
  3028. <div class="middle-content">
  3029. <div class="input-middle-item flex">
  3030. <div class="input-remark" style="width: 550px;">
  3031. <div class="input-group" style="margin-bottom: 5px;">
  3032. <div class="input-group-addon">说明</div>
  3033. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  3034. </div>
  3035. <div class="input-group">
  3036. <div class="input-group-addon">提示语</div>
  3037. <input class="form-control" name="begin_hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$begin_hint.'" style="width: 500px;" update_id="#begin_time_val_'.$random_code.'" update_type="tip">
  3038. </div>
  3039. </div>
  3040. </div>
  3041. <div class="input-middle-item">
  3042. <div class="input-group"><label class="label_title">开始时间</label></div>
  3043. <div class="input-group" style="margin-bottom: 5px;">
  3044. <label class="label_title">默认:</label>';
  3045. if($begin_time_type == 'no_default'){
  3046. $item_li = $item_li . ' <label class="radio-inline">
  3047. <input type="radio" title="不默认" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="no_default" checked="checked">
  3048. </label>
  3049. <label class="radio-inline">
  3050. <input type="radio" title="填表当时" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="same_time">
  3051. </label>
  3052. <label class="radio-inline">
  3053. <input type="radio" title="指定时间" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="appoint_time">
  3054. </label>
  3055. <div class="radio-inline begin_appoint_time_txt_'.$random_code.'" style="display:none;">
  3056. <input type="text" class="layui-input" id="begin_appoint_time_'.$random_code.'" name="begin_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  3057. </div>';
  3058. }else if($begin_time_type == 'same_time'){
  3059. $item_li = $item_li . ' <label class="radio-inline">
  3060. <input type="radio" title="不默认" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="no_default">
  3061. </label>
  3062. <label class="radio-inline">
  3063. <input type="radio" title="填表当时" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="same_time" checked="checked">
  3064. </label>
  3065. <label class="radio-inline">
  3066. <input type="radio" title="指定时间" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="appoint_time">
  3067. </label>
  3068. <div class="radio-inline begin_appoint_time_txt_'.$random_code.'" style="display:none;">
  3069. <input type="text" class="layui-input" id="begin_appoint_time_'.$random_code.'" name="begin_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  3070. </div>';
  3071. }else if($begin_time_type == 'appoint_time'){
  3072. $item_li = $item_li . ' <label class="radio-inline">
  3073. <input type="radio" title="不默认" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="no_default">
  3074. </label>
  3075. <label class="radio-inline">
  3076. <input type="radio" title="填表当时" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="same_time">
  3077. </label>
  3078. <label class="radio-inline">
  3079. <input type="radio" title="指定时间" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="appoint_time" checked="checked">
  3080. </label>
  3081. <div class="radio-inline begin_appoint_time_txt_'.$random_code.'">
  3082. <input type="text" class="layui-input" id="begin_appoint_time_'.$random_code.'" name="begin_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  3083. </div>';
  3084. }
  3085. $item_li = $item_li . ' </div>
  3086. </div>
  3087. <div class="input-middle-item">
  3088. <div class="input-group"><label class="label_title">结束时间</label></div>
  3089. <div class="input-group" style="margin-bottom: 5px;">
  3090. <label class="label_title">默认:</label>';
  3091. if($end_time_type == 'no_default'){
  3092. $item_li = $item_li . ' <label class="radio-inline">
  3093. <input type="radio" title="不默认" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="no_default" checked="checked">
  3094. </label>
  3095. <label class="radio-inline">
  3096. <input type="radio" title="填表当天" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="same_time">
  3097. </label>
  3098. <label class="radio-inline">
  3099. <input type="radio" title="指定日期" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="appoint_time">
  3100. </label>
  3101. <div class="radio-inline end_appoint_time_txt_'.$random_code.'" style="display:none;">
  3102. <input type="text" class="layui-input" id="end_appoint_time_'.$random_code.'" name="end_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  3103. </div>';
  3104. }else if($end_time_type == 'same_time'){
  3105. $item_li = $item_li . ' <label class="radio-inline">
  3106. <input type="radio" title="不默认" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="no_default">
  3107. </label>
  3108. <label class="radio-inline">
  3109. <input type="radio" title="填表当天" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="same_time" checked="checked">
  3110. </label>
  3111. <label class="radio-inline">
  3112. <input type="radio" title="指定日期" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="appoint_time">
  3113. </label>
  3114. <div class="radio-inline end_appoint_time_txt_'.$random_code.'" style="display:none;">
  3115. <input type="text" class="layui-input" id="end_appoint_time_'.$random_code.'" name="end_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  3116. </div>';
  3117. }else if($end_time_type == 'appoint_time'){
  3118. $item_li = $item_li . ' <label class="radio-inline">
  3119. <input type="radio" title="不默认" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="no_default">
  3120. </label>
  3121. <label class="radio-inline">
  3122. <input type="radio" title="填表当天" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="same_time">
  3123. </label>
  3124. <label class="radio-inline">
  3125. <input type="radio" title="指定日期" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="appoint_time" checked="checked">
  3126. </label>
  3127. <div class="radio-inline end_appoint_time_txt_'.$random_code.'">
  3128. <input type="text" class="layui-input" id="end_appoint_time_'.$random_code.'" name="end_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
  3129. </div>';
  3130. }
  3131. $item_li = $item_li . '</div>
  3132. </div>
  3133. </div>
  3134. <div class="input-required">';
  3135. if($required == 1){
  3136. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  3137. }else{
  3138. $item_li = $item_li . '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  3139. }
  3140. $item_li = $item_li . '
  3141. </div>
  3142. <div class="input-delete">
  3143. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  3144. <i class="layui-icon">&#xe640;</i>删除
  3145. </a>
  3146. </div>
  3147. <script>
  3148. layui.use(["laydate","form"], function() {
  3149. var laydate = layui.laydate;
  3150. var form = layui.form;
  3151. //常规用法
  3152. laydate.render({
  3153. elem: "#begin_appoint_time_'.$random_code.'"
  3154. ,type: "time"
  3155. ,value: "'.$begin_appoint_time.'"
  3156. ,done:function(value, date, endDate){
  3157. $("#begin_time_val_' . $random_code . '").val(value);
  3158. }
  3159. });
  3160. laydate.render({
  3161. elem: "#end_appoint_time_'.$random_code.'"
  3162. ,type: "time"
  3163. ,value: "'.$begin_appoint_time.'"
  3164. ,done:function(value, date, endDate){
  3165. $("#end_time_val_' . $random_code . '").val(value);
  3166. }
  3167. });
  3168. form.on("switch(required_'.$random_code.')", function(data){
  3169. var update_id = data.elem.attributes["update_id"].nodeValue;
  3170. if(data.elem.checked){
  3171. $(update_id).show();
  3172. }else{
  3173. $(update_id).hide();
  3174. }
  3175. });
  3176. });
  3177. $(".begin_time_type_'.$random_code.'").click(function(){
  3178. var date_type = $(this).val();
  3179. var obj = $(this).parent().parent();
  3180. if (date_type == "no_default") {
  3181. obj.find(".begin_appoint_time_txt_'.$random_code.'").hide();
  3182. $("#begin_time_val_'.$random_code.'").val("");
  3183. } else if(date_type == "same_time") {
  3184. obj.find(".begin_appoint_time_txt_'.$random_code.'").hide();
  3185. $("#begin_time_val_'.$random_code.'").val("");
  3186. } else if(date_type == "appoint_time") {
  3187. obj.find(".begin_appoint_time_txt_'.$random_code.'").show();
  3188. var begin_appoint_time = $("#begin_appoint_time_'.$random_code.'").val();
  3189. $("#begin_time_val_'.$random_code.'").val(begin_appoint_time);
  3190. }
  3191. });
  3192. $(".end_time_type_'.$random_code.'").click(function(){
  3193. var date_type = $(this).val();
  3194. var obj = $(this).parent().parent();
  3195. if (date_type == "no_default") {
  3196. obj.find(".end_appoint_time_txt_'.$random_code.'").hide();
  3197. $("#end_time_val_'.$random_code.'").val("");
  3198. } else if(date_type == "same_time") {
  3199. obj.find(".end_appoint_time_txt_'.$random_code.'").hide();
  3200. $("#end_time_val_'.$random_code.'").val("");
  3201. } else if(date_type == "appoint_time") {
  3202. obj.find(".end_appoint_time_txt_'.$random_code.'").show();
  3203. var end_appoint_time = $("#end_appoint_time_'.$random_code.'").val();
  3204. $("#end_time_val_'.$random_code.'").val(end_appoint_time);
  3205. }
  3206. });
  3207. </script>
  3208. </div>
  3209. </li>';
  3210. $phone_item = $phone_item .'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  3211. <div class="template_item">
  3212. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  3213. if($required == 1){
  3214. $phone_item = $phone_item .'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  3215. }else{
  3216. $phone_item = $phone_item .'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  3217. }
  3218. $begin_appoint_type_time = "";
  3219. $end_appoint_type_time = "";
  3220. if($begin_time_type == 'appoint_time'){
  3221. $begin_appoint_type_time = $begin_appoint_time;
  3222. }
  3223. if($end_time_type == 'appoint_time'){
  3224. $end_appoint_type_time = $end_appoint_time;
  3225. }
  3226. $phone_item = $phone_item .'
  3227. </div>
  3228. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  3229. <div class="tempalte_content">
  3230. <div class="date_item">
  3231. <input type="text" placeholder="请选择时间范围" id="begin_time_val_'.$random_code.'" class="item-input" readonly value="'.$begin_appoint_type_time.'~'.$end_appoint_type_time.'">
  3232. <div class="date_icon"><i class="layui-icon layui-icon-time" style="font-size: 25px;"></i></div>
  3233. </div>
  3234. </div>
  3235. </div>';
  3236. }else if($type == 'telephone'){
  3237. $title = $v['title'];
  3238. $remark = $v['remark'];
  3239. $hint = $v['hint'];
  3240. $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
  3241. <div class="action-items">
  3242. <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
  3243. <input type="hidden" name="form_type_'.$random_code.'" value="telephone"/>
  3244. <div class="action-title"><span class="title">手机号码</span></div>
  3245. <div class="input-title">
  3246. <div class="input-group">
  3247. <div class="input-group-addon">标题</div>
  3248. <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
  3249. </div>
  3250. </div>
  3251. <div class="input-remark">
  3252. <div class="input-group">
  3253. <div class="input-group-addon">说明</div>
  3254. <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
  3255. </div>
  3256. </div>
  3257. <div class="input-max">
  3258. <div class="input-group">
  3259. <div class="input-group-addon">提示语</div>
  3260. <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="tip">
  3261. </div>
  3262. </div>
  3263. <div class="input-required">';
  3264. if($required == 1){
  3265. $item_li = $item_li. '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" checked="checked" lay-skin="switch" lay-text="必填|非必填">';
  3266. }else{
  3267. $item_li = $item_li. '<input type="checkbox" name="required_'.$random_code.'" lay-filter="required_'.$random_code.'" update_id="#text_required_'.$random_code.'" lay-skin="switch" lay-text="必填|非必填">';
  3268. }
  3269. $item_li = $item_li. '</div>
  3270. <div class="input-delete">
  3271. <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
  3272. <i class="layui-icon">&#xe640;</i>删除
  3273. </a>
  3274. </div>
  3275. <script>
  3276. layui.use("form", function() {
  3277. var form = layui.form;
  3278. form.on("switch(required_'.$random_code.')", function(data){
  3279. var update_id = data.elem.attributes["update_id"].nodeValue;
  3280. if(data.elem.checked){
  3281. $(update_id).show();
  3282. }else{
  3283. $(update_id).hide();
  3284. }
  3285. });
  3286. });
  3287. </script>
  3288. </div>
  3289. </li>';
  3290. $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
  3291. <div class="template_item">
  3292. <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
  3293. if($required == 1){
  3294. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
  3295. }else{
  3296. $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
  3297. }
  3298. $phone_item = $phone_item.'
  3299. </div>
  3300. <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
  3301. <div class="tempalte_content">
  3302. <input type="text" placeholder="'.$hint.'" id="text_val_'.$random_code.'" class="item-input">
  3303. </div>
  3304. </div>';
  3305. }
  3306. }
  3307. }
  3308. $item_li = $item_li . '
  3309. <script>
  3310. layui.use("form", function() {
  3311. var form = layui.form;
  3312. form.render();
  3313. });
  3314. </script>';
  3315. $need_data = ['item_li' => $item_li,'phone_item' => $phone_item];
  3316. return $need_data;
  3317. }
  3318. }
  3319. ?>