AllformModel.class.php 228 KB

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