1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385 |
- <?php
- /**
- * lionfish 商城系统
- *
- * ==========================================================================
- * @link http://www.liofis.com/
- * @copyright Copyright (c) 2015 liofis.com.
- * @license http://www.liofis.com/license.html License
- * ==========================================================================
- *
- * @author cy 2021-05-24
- * @desc 万能表单管理
- *
- */
- namespace Seller\Model;
- class AllformModel{
- /**
- * @author cy 2021-05-24
- * @desc 获取万能表单信息
- * @param $id
- * @return mixed
- */
- public function getFormsById($id){
- $forms_data = M('lionfish_comshop_forms')->where( array('id' => $id) )->find();
- return $forms_data;
- }
- /**
- * @author cy 2021-05-25
- * @desc 通过条件获取表单信息
- * @param $condition
- * @return mixed
- */
- public function getFormsByWhere($condition){
- $forms_data = M('lionfish_comshop_forms')->where($condition)->find();
- return $forms_data;
- }
- /**
- * @author cy 2021-04-30
- * @desc 表单类型名称
- * @param $form_type
- * @return string
- */
- public function getFormTypeName($form_type){
- $form_type_text = "";
- switch ($form_type){
- case 'goods':
- $form_type_text = '商品表单';
- break;
- case 'order':
- $form_type_text = '下单表单';
- break;
- case 'apply':
- $form_type_text = '申请表单';
- break;
- }
- return $form_type_text;
- }
- /**
- * @author cy 2021-05-19
- * @desc 获取已收集的表单数
- * @param $form_id
- * @return mixed
- */
- public function getFormInfoCountByFormId($form_id){
- $count = M('lionfish_comshop_form_info')->where( array('form_id' => $form_id) )->count();
- return $count;
- }
- /**
- * @author cy 2021-05-25
- * @desc 删除表单信息
- * @param $form_id
- * @return mixed
- */
- public function deleteForm($form_id){
- $result = [];
- $res = M('lionfish_comshop_forms')->where( array('id' => $form_id) )->delete();
- if($res !== false){
- $result['code'] = 1;
- }else{
- $result['code'] = 0;
- $result['message'] = '删除失败';
- }
- return $result;
- }
- public function queryList($gpc){
- $page = isset($gpc['page']) ? intval($gpc['page']) : 1;
- $page = max(1, $page);
- $page_size = 10;
- $keyword = $gpc['keyword'];
- $type = $gpc['type'];
- $is_ajax = $gpc['is_ajax'];
- $template = $gpc['template'];
- $is_ajax = !empty($is_ajax) ? intval($is_ajax) : 0;
- $condition = " ";
- if(!empty( $keyword )){
- $keyword = trim($keyword);
- $condition .= " and form_name like '%".$keyword."%'";
- }
- if(!empty($type)){
- $condition .= " and form_type = '".$type."'";
- }
- $sql = 'SELECT * FROM ' . C('DB_PREFIX') . 'lionfish_comshop_forms WHERE 1 ' . $condition .
- ' order by id desc' .' limit ' . (($page - 1) * $page_size) . ',' . $page_size;
- $list = M()->query($sql);
- $total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX').'lionfish_comshop_forms WHERE 1 ' . $condition );
- $total = $total_arr[0]['count'];
- $ret_html = "<tr>
- <th style=\"color:#000;\">表单名称</th>
- <th style=\"color:#000;\">表单类型</th>
- <th style=\"color:#000;\">操作</th>
- </tr>";
- foreach ($list as &$value) {
- $value['form_type_name'] = $this->getFormTypeName($value['form_type']);
- $ret_html .= '<tr>';
- $ret_html .= ' <td>'. $value['form_name'].'</td>';
- $ret_html .= ' <td>'.$this->getFormTypeName($value['form_type']).'</td>';
- if ( isset($template) && $template == 'mult' ) {
- $ret_html.=' <td style="width:80px;"><a href="javascript:;" class="choose_mult_link" data-json=\''.json_encode($value).'\'>选择</a></td>';
- }else{
- $ret_html.=' <td style="width:80px;"><a href="javascript:;" class="choose_dan_link" data-json=\''.json_encode($value).'\'>选择</a></td>';
- }
- $ret_html .= '</tr>';
- }
- $pager = pagination($total, $page, $page_size,'',$context = array('before' => 5, 'after' => 4, 'isajax' => 1));
- if( $is_ajax == 1 )
- {
- return ['html' => $ret_html, 'pager' => $pager ];
- }else{
- return ['list' => $list, 'pager' => $pager ];
- }
- }
- public function getDataList($gpc){
- $page = isset($gpc['page']) ? intval($gpc['page']) : 1;
- $page_size = 10;
- //会员昵称
- $keyword = $gpc['keyword'];
- //表单id
- $id = $gpc['id'];
- $condition = " and f.form_id = ".$id;
- $sqlcondition = "";
- if (!empty( $keyword )) {
- $keyword = trim($keyword);
- $condition .= ' AND (locate('.$keyword.',m.username) > 0 ) and f.user_id > 0 ';
- $sqlcondition .= ' left join ' . C('DB_PREFIX') . 'lionfish_comshop_member m on m.member_id = f.user_id ';
- }
- $sql = 'SELECT f.* FROM ' . C('DB_PREFIX') . 'lionfish_comshop_form_info as f '.$sqlcondition.' WHERE 1 ' . $condition .
- ' order by f.id desc' .' limit ' . (($page - 1) * $page_size) . ',' . $page_size;
-
- $list = M()->query($sql);
- $total_arr = M()->query('SELECT count(1) as count FROM ' . C('DB_PREFIX').'lionfish_comshop_form_info as f '.$sqlcondition.' WHERE 1 ' . $condition );
- $total = $total_arr[0]['count'];
- if( !empty($list) )
- {
- foreach( $list as $k=>$item )
- {
- $member_info = M('lionfish_comshop_member')->where( array('member_id' => $item['user_id'] ) )->find();
- if(!empty($member_info)){
- $list[$k]['username'] = $member_info['username'];
- }
- $list[$k]['addtime'] = date('Y-m-d H:i:s',$item['addtime']);
- $list[$k]['form_type_name'] = $this->getFormTypeName($item['form_type']);
- }
- }
- $pager = pagination2($total, $page, $page_size);
- //表单信息
- $form_data = $this->getFormsById($id);
- $need_data = ['list' => $list, 'pager' => $pager, 'form_info'=>$form_data ];
- return $need_data;
- }
- /**
- * @author cy 2021-05-26
- * @desc 获取已收集的表单数据列表
- * @param $form_id
- * @return mixed
- */
- public function getFormInfoListByFormId($form_id){
- $form_info_list = M('lionfish_comshop_form_info')->where(array('form_id' => $form_id))->select();
- return $form_info_list;
- }
- /**
- * @author cy 2021-05-26
- * @desc 获取已收集的表单数据项列表
- * @param $form_id
- * @return mixed
- */
- public function getFormItemListByFormId($form_id){
- $form_item_list = M('lionfish_comshop_form_item')->where(array('form_id' => $form_id))->order('id asc')->select();
- return $form_item_list;
- }
- /**
- * @author cy 2021-05-26
- * @desc 获取导出表单数据列表
- * @param $form_id
- * @return array
- */
- public function getExportFormDataList($form_id){
- $need_data = [];
- //万能表单数据
- $form_data = $this->getFormsById($form_id);
- $title_list = [];
- $form_list = $this->getFormInfoListByFormId($form_id);
- if(!empty($form_list)){
- foreach($form_list as $k=>$v){
- $form_list[$k]['addtime'] = date('Y-m-d H:i:s',$v['addtime']);
- $form_item_list = $this->getFormItemListByFormId($v['id']);
- if(!empty($form_item_list)){
- foreach($form_item_list as $ik=>$iv){
- if(!in_array($iv['item_name'],$title_list) && $iv['type'] != 'image'){
- array_push($title_list,$iv['item_name']);
- }
- $form_list[$k][$iv['item_name']] = $iv['item_val'];
- }
- }
- $member_info = M('lionfish_comshop_member')->where( array('member_id' => $v['user_id'] ) )->find();
- if(!empty($member_info)){
- $form_list[$k]['username'] = $member_info['username'];
- }else{
- $form_list[$k]['username'] = "";
- }
- }
- }
- $need_data['form_list'] = $form_list;
- $need_data['title_list'] = $title_list;
- $need_data['form_data'] = $form_data;
- return $need_data;
- }
- /**
- * @author cy 2021-05-24
- * @desc 添加万能表单
- * @return array
- */
- public function addOrUpdateForm()
- {
- $_GPC = I('request.');
- $id = $_GPC['id'];
- //表单名称
- $form_name = trim($_GPC['form_name']);
- //表单类型
- $form_type = trim($_GPC['form_type']);
- if( empty($form_name))
- {
- return ['code' => 0, 'message' => '请填写表单名称'];
- }
- if( empty($form_type))
- {
- return ['code' => 0, 'message' => '请选择表单类型'];
- }
- $condition = " 1=1 ";
- if(!empty($id)){
- $condition .= " and id != ".$id;
- }
- $condition .= " and form_name = '".$form_name."' ";
- $forms_data = $this->getFormsByWhere($condition);
- if(!empty($forms_data)){
- return ['code' => 0, 'message' => '表单名称已存在,请修改'];
- }
- $title_array = [];
- $random_code_list = trim($_GPC['random_code']);
- if(!empty($random_code_list) && count($random_code_list) > 0){
- foreach($random_code_list as $k=>$v){
- $title = request()->input('title_'.$v, '');
- $title_array[] = trim($title);
- }
- }
- $title_list = array_unique($title_array);
- if(count($title_list) < count($title_array)){
- return ['code' => 0, 'message' => '标题不能重复'];
- }
- $form_content = $this->getFormContent();
- $form_data = array();
- $form_data['form_name'] = $form_name;
- $form_data['form_type'] = $form_type;
- $form_data['form_content'] = $form_content;
- if( $id > 0 )
- {
- M('lionfish_comshop_forms')->where( array('id' => $id) )->save($form_data);
- }else{
- $form_data['addtime'] = time();
- $id = M('lionfish_comshop_forms')->add($form_data);
- }
- return ['code' => 1];
- }
- /**
- * @author 获取万能表单项数据
- * @return string
- */
- public function getFormContent(){
- $content = "";
- $content_array = [];
- $random_code_list = I('request.random_code');
- if(!empty($random_code_list) && count($random_code_list) > 0){
- foreach($random_code_list as $k=>$v){
- $content_array[$k] = $this->getFormItemValue($v);
- }
- $content = serialize($content_array);
- }
- return $content;
- }
- /**
- * @author cy 2021-05-11
- * @desc 获取万能表单项信息
- * @param $random_code
- * @return array
- */
- public function getFormItemValue($random_code){
- $form_data = [];
- $_GPC = I('request.');
- $form_type = $_GPC['form_type_'.$random_code];
- $form_data['type'] = $form_type;
- $form_data['random_code'] = $random_code;
- if($form_type == 'image'){//图片
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //最大上传数量
- $max_count = $_GPC['max_count_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['max_count'] = $max_count;
- }else if($form_type == 'text'){//单行文本
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //提示
- $hint = $_GPC['hint_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['hint'] = $hint;
- }else if($form_type == 'textarea'){//多行文本
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //提示
- $hint = $_GPC['hint_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['hint'] = $hint;
- }else if($form_type == 'select'){//下拉选项
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //提示
- $hint = $_GPC['hint_'.$random_code];
- //选项
- $option_array = [];
- $option_vals = $_GPC['option_val_'.$random_code];
- if(!empty($option_vals) && count($option_vals) > 0){
- foreach($option_vals as $pk=>$pv){
- $option_array[$pk] = $pv;
- }
- }
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['hint'] = $hint;
- $form_data['option_val'] = $option_array;
- }else if($form_type == 'radio'){//单选
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //选项
- $option_array = [];
- $option_vals = $_GPC['option_val_'.$random_code];
- if(!empty($option_vals) && count($option_vals) > 0){
- foreach($option_vals as $pk=>$pv){
- $option_array[$pk] = $pv;
- }
- }
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['option_val'] = $option_array;
- }else if($form_type == 'checked'){//多选
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //选项
- $option_array = [];
- $option_vals = $_GPC['option_val_'.$random_code];
- if(!empty($option_vals) && count($option_vals) > 0){
- foreach($option_vals as $pk=>$pv){
- $option_array[$pk] = $pv;
- }
- }
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['option_val'] = $option_array;
- }else if($form_type == 'area'){//地区
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //提示语
- $hint = $_GPC['hint_'.$random_code];
- //填写条件
- $area_type = $_GPC['area_type_'.$random_code];
- //默认省份
- $province_id = $_GPC['province_id_'.$random_code];
- //默认城市
- $city_id = $_GPC['city_id_'.$random_code];
- //默认区
- $country_id = $_GPC['country_id_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['hint'] = $hint;
- $form_data['area_type'] = $area_type;
- $form_data['province_id'] = $province_id;
- $form_data['city_id'] = $city_id;
- $form_data['country_id'] = $country_id;
- }else if($form_type == 'date'){//日期
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //提示语
- $hint = $_GPC['hint_'.$random_code];
- //日期默认类型
- $date_type = $_GPC['date_type_'.$random_code];
- //指定日期
- $appoint_date = $_GPC['appoint_date_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['hint'] = $hint;
- $form_data['date_type'] = $date_type;
- $form_data['appoint_date'] = $appoint_date;
- }else if($form_type == 'date_range'){//日期范围
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //开始日期类型
- $begin_date_type = $_GPC['begin_date_type_'.$random_code];
- //开始日期提示语
- $begin_hint = $_GPC['begin_hint_'.$random_code];
- //开始日期指定日期
- $begin_appoint_date = $_GPC['begin_appoint_date_'.$random_code];
- //结束日期类型
- $end_date_type = $_GPC['end_date_type_'.$random_code];
- //结束日期提示语
- $end_hint = $_GPC['end_hint_'.$random_code];
- //结束日期指定日期
- $end_appoint_date = $_GPC['end_appoint_date_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['begin_date_type'] = $begin_date_type;
- $form_data['begin_hint'] = $begin_hint;
- $form_data['begin_appoint_date'] = $begin_appoint_date;
- $form_data['end_date_type'] = $end_date_type;
- $form_data['end_hint'] = $end_hint;
- $form_data['end_appoint_date'] = $end_appoint_date;
- }else if($form_type == 'idcard'){//身份证号码
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //提示
- $hint = $_GPC['hint_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['hint'] = $hint;
- }else if($form_type == 'time'){//时间
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //提示
- $hint = $_GPC['hint_'.$random_code];
- //时间类型
- $time_type = $_GPC['time_type_'.$random_code];
- //指定时间
- $appoint_time = $_GPC['appoint_time_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['hint'] = $hint;
- $form_data['time_type'] = $time_type;
- $form_data['appoint_time'] = $appoint_time;
- }else if($form_type == 'time_range'){//时间范围
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //开始时间类型
- $begin_time_type = $_GPC['begin_time_type_'.$random_code];
- //开始指定时间
- $begin_appoint_time = $_GPC['begin_appoint_time_'.$random_code];
- //开始时间提示语
- $begin_hint = $_GPC['begin_hint_'.$random_code];
- //开始时间类型
- $end_time_type = $_GPC['end_time_type_'.$random_code];
- //开始指定时间
- $end_appoint_time = $_GPC['end_appoint_time_'.$random_code];
- //开始时间提示语
- $end_hint = $_GPC['end_hint_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['begin_time_type'] = $begin_time_type;
- $form_data['begin_appoint_time'] = $begin_appoint_time;
- $form_data['begin_hint'] = $begin_hint;
- $form_data['end_time_type'] = $end_time_type;
- $form_data['end_appoint_time'] = $end_appoint_time;
- $form_data['end_hint'] = $end_hint;
- }else if($form_type == 'telephone'){//手机号码
- //标题
- $title = $_GPC['title_'.$random_code];
- //说明
- $remark = $_GPC['remark_'.$random_code];
- //提示
- $hint = $_GPC['hint_'.$random_code];
- $form_data['title'] = $title;
- $form_data['remark'] = $remark;
- $form_data['hint'] = $hint;
- }
- //是否必填
- $required = $_GPC['required_'.$random_code];
- if($required == 'on'){//必填
- $required = 1;
- }else{
- $required = 0;
- }
- $form_data['required'] = $required;
- return $form_data;
- }
- /**
- * @author cy 2021-05-24
- * @desc 获取表单项内容
- * @param $type
- * @return array
- */
- public function getFormItem($type){
- $need_data = [];
- $item_li = "";
- $phone_item = "";
- $random_code = random(10,false);
- if($type == 'image'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="image"/>
- <div class="action-title"><span class="title">图片</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="图片" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">最大上传数量</div>
- <input class="form-control" name="max_count_'.$random_code.'" type="text" placeholder="请输入最大上传数量" value="5">
- <div class="input-group-addon">张</div>
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">图片</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <div class="image-add">
- <div class="add">
- <span class="iconfont-m- icon-m-jiahao">+</span>
- </div>
- <div class="add-text"> 添加图片 </div>
- <input type="file" style="display: none;">
- </div>
- </div>
- </div>';
- }else if($type == 'text'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="text"/>
- <div class="action-title"><span class="title">单行文本</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="单行文本" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请输入" update_id="#text_val_'.$random_code.'" update_type="tip">
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">单行文本</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <input type="text" placeholder="请输入" id="text_val_'.$random_code.'" class="item-input">
- </div>
- </div>';
- }else if($type == 'textarea'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="textarea"/>
- <div class="action-title"><span class="title">多行文本</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="多行文本" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请输入" update_id="#text_val_'.$random_code.'" update_type="tip">
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class=\'layui-btn layui-btn-xs deleteBtn\' href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">多行文本</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <textarea type="text" placeholder="请输入" id="text_val_'.$random_code.'" class="item-input item-input-textarea"></textarea>
- </div>
- </div>';
- }else if($type == 'select'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="select"/>
- <div class="action-title"><span class="title">下拉选项</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="下拉选项" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请选择" update_id="#text_val_'.$random_code.'" update_type="select_tip">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <div class="input-group-addon">选项<span class="sort">1</span></div>
- <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="选项1" style="width: 430px;">
- <a class=\'delOptionBtn\' href="javascript:;">
- 删除
- </a>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <div class="input-group-addon">选项<span class="sort">2</span></div>
- <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="选项2" style="width: 430px;">
- <a class="delOptionBtn" href="javascript:;">
- 删除
- </a>
- </div>
- </div>
- <div class="input-middle-item">
- <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="select">
- +添加选项
- </a>
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">下拉选项</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <select class="item-input" placeholder="请选择" disabled id="text_val_'.$random_code.'"></select>
- </div>
- </div>';
- }else if($type == 'radiao'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="radio"/>
- <div class="action-title"><span class="title">单选</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="单选" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark" style="width: 600px;">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <div class="input-group-addon">选项<span class="sort">1</span></div>
- <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">
- <a class="delOptionBtn" href="javascript:;" num="1" random_code="'.$random_code.'">
- 删除
- </a>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <div class="input-group-addon">选项<span class="sort">2</span></div>
- <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">
- <a class="delOptionBtn" href="javascript:;" num="2" random_code="'.$random_code.'">
- 删除
- </a>
- </div>
- </div>
- <div class="input-middle-item">
- <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="radio">
- +添加选项
- </a>
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">单选</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <div class="m-radio-box" id="m-radio-box_'.$random_code.'">
- <div class="radio-item" id="radio-item1_'.$random_code.'">
- <input type="radio" class="radio_option" name="radio" value="选项1" title="选项1">
- </div>
- <div class="radio-item" id="radio-item2_'.$random_code.'">
- <input type="radio" class="radio_option" name="radio" value="选项2" title="选项2">
- </div>
- </div>
- </div>
- </div>';
- }else if($type == 'checked'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="checked"/>
- <div class="action-title"><span class="title">多选</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="多选" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark" style="width: 600px;">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <div class="input-group-addon">选项<span class="sort">1</span></div>
- <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">
- <a class="delOptionBtn" href="javascript:;" num="1" random_code="'.$random_code.'">
- 删除
- </a>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <div class="input-group-addon">选项<span class="sort">2</span></div>
- <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">
- <a class="delOptionBtn" href="javascript:;" num="2" random_code="'.$random_code.'">
- 删除
- </a>
- </div>
- </div>
- <div class="input-middle-item">
- <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="checkbox">
- +添加选项
- </a>
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">多选</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <div class="m-radio-box" id="m-radio-box_'.$random_code.'">
- <div class="radio-item" id="radio-item1_'.$random_code.'">
- <input type="checkbox" class="radio_option" name="checkbox" title="选项1" value="选项1" lay-skin="primary">
- </div>
- <div class="radio-item" id="radio-item2_'.$random_code.'">
- <input type="checkbox" class="radio_option" name="checkbox" title="选项2" value="选项2" lay-skin="primary">
- </div>
- </div>
- </div>
- </div>';
- }else if($type == 'area'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="area"/>
- <div class="action-title"><span class="title">地区</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="地区" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <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">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <label class="label_title">填写条件:</label>
- <label class="radio-inline">
- <input type="radio" title="省份" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="province" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="省市" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="city">
- </label>
- <label class="radio-inline">
- <input type="radio" title="省市区" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="country">
- </label>
- </div>
- </div>
- <div class="input-middle-item flex" id="areaParent_'.$random_code.'">
- <div class="input-group province_select">
- <div class="input-group-addon">默认值 省</div>
- <select class="sel-province" lay-ignore name="province_id_'.$random_code.'" onChange="selectCity(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- <div class="input-group city_select" style="display:none;">
- <div class="input-group-addon">默认值 市</div>
- <select class="sel-city" lay-ignore name="city_id_'.$random_code.'" onChange="selectcounty(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- <div class="input-group country_select" style="display:none;">
- <div class="input-group-addon">默认值 区</div>
- <select class="sel-area" lay-ignore name="country_id_'.$random_code.'" onChange="updateArea(\''.$random_code.'\')" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- cascdeInit("0","0","areaParent_'.$random_code.'","","","");
- $(".area_type_'.$random_code.'").click(function(){
- var type = $(this).val();
- var obj = $(this).parent().parent().parent().parent();
- if (type == "province") {
- obj.find(".city_select").hide();
- obj.find(".country_select").hide();
- } else if(type == "city") {
- obj.find(".city_select").show();
- obj.find(".country_select").hide();
- } else if(type == "country") {
- obj.find(".city_select").show();
- obj.find(".country_select").show();
- }
- updateArea("'.$random_code.'");
- });
- </script>
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">地区</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <select class="item-input" id="address_'.$random_code.'">
- <option value="" selected disabled style="display: none;">请选择地区</option>
- </select>
- </div>
- </div>';
- }else if($type == 'date'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="date"/>
- <div class="action-title"><span class="title">日期</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="日期" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <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">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <label style="font-size: 14px;font-weight: bold;line-height: 20px;">默认:</label>
- <label class="radio-inline">
- <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">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="date_type_'.$random_code.'" lay-filter="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="same_day">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="date_type_'.$random_code.'" lay-filter="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="appoint_date">
- </label>
- <div class="radio-inline appoint_date_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="appoint_date_'.$random_code.'" name="appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>
- </div>
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use(["laydate","form"], function() {
- var laydate = layui.laydate;
- var form = layui.form;
- //常规用法
- laydate.render({
- elem: "#appoint_date_'.$random_code.'",
- done:function(value, date, endDate){
- $("#date_val_'.$random_code.'").val(value);
- }
- });
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- form.on("radio(date_type_'.$random_code.')", function (data) {
- var obj = $(this).parent().parent();
- if(data.value == "no_default"){
- $("#date_val_'.$random_code.'").val("");
- obj.find(".appoint_date_txt_'.$random_code.'").hide();
- }else if(data.value == "same_day"){
- $("#date_val_'.$random_code.'").val("");
- obj.find(".appoint_date_txt_'.$random_code.'").hide();
- }else if(data.value == "appoint_date"){
- obj.find(".appoint_date_txt_'.$random_code.'").show();
- var appoint_date = $("#appoint_date_'.$random_code.'").val();
- $("#date_val_'.$random_code.'").val(appoint_date);
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">日期</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <div class="date_item">
- <input type="text" placeholder="选择日期" id="date_val_'.$random_code.'" class="item-input" readonly value="">
- <div class="date_icon"><i class="layui-icon layui-icon-date" style="font-size: 25px;"></i></div>
- </div>
- </div>
- </div>';
- }else if($type == 'date_range'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="date_range"/>
- <div class="action-title"><span class="title">日期范围</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="日期范围" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark" style="width: 600px;">
- <div class="input-group" style="margin-bottom: 5px;">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <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">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group"><label class="label_title">开始日期</label></div>
- <div class="input-group" style="margin-bottom: 5px;">
- <label class="label_title">默认:</label>
- <label class="radio-inline">
- <input type="radio" title="不默认" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="same_day">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="appoint_date">
- </label>
- <div class="radio-inline begin_appoint_date_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="begin_appoint_date_'.$random_code.'" name="begin_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group"><label class="label_title">结束日期</label></div>
- <div class="input-group" style="margin-bottom: 5px;">
- <label class="label_title">默认:</label>
- <label class="radio-inline">
- <input type="radio" title="不默认" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="same_day">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="appoint_date">
- </label>
- <div class="radio-inline end_appoint_date_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="end_appoint_date_'.$random_code.'" name="end_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>
- </div>
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use(["laydate","form"], function() {
- var laydate = layui.laydate;
- var form = layui.form;
- //常规用法
- laydate.render({
- elem: "#begin_appoint_date_'.$random_code.'",
- done:function(value, date, endDate){
- $("#begin_date_val_'.$random_code.'").val(value);
- }
- });
- laydate.render({
- elem: "#end_appoint_date_'.$random_code.'",
- done:function(value, date, endDate){
- $("#end_date_val_'.$random_code.'").val(value);
- }
- });
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- $(".begin_date_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- obj.find(".begin_appoint_date_txt_'.$random_code.'").hide();
- $("#begin_date_val_'.$random_code.'").val("");
- } else if(date_type == "same_day") {
- obj.find(".begin_appoint_date_txt_'.$random_code.'").hide();
- $("#begin_date_val_'.$random_code.'").val("");
- } else if(date_type == "appoint_date") {
- obj.find(".begin_appoint_date_txt_'.$random_code.'").show();
- var begin_appoint_date = $("#begin_appoint_date_'.$random_code.'").val();
- $("#begin_date_val_'.$random_code.'").val(begin_appoint_date);
- }
- });
- $(".end_date_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- obj.find(".end_appoint_date_txt_'.$random_code.'").hide();
- $("#end_date_val_'.$random_code.'").val("");
- } else if(date_type == "same_day") {
- obj.find(".end_appoint_date_txt_'.$random_code.'").hide();
- $("#end_date_val_'.$random_code.'").val("");
- } else if(date_type == "appoint_date") {
- obj.find(".end_appoint_date_txt_'.$random_code.'").show();
- var end_appoint_date = $("#end_appoint_date_'.$random_code.'").val();
- $("#end_date_val_'.$random_code.'").val(end_appoint_date);
- }
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">日期范围</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <div class="date_item">
- <input type="text" placeholder="请选择日期范围" id="begin_date_val_'.$random_code.'" class="item-input" readonly value="">
- <div class="date_icon"><i class="layui-icon layui-icon-date" style="font-size: 25px;"></i></div>
- </div>
- </div>
- </div>';
- }else if($type == 'idcard'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="idcard"/>
- <div class="action-title"><span class="title">身份证号码</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="身份证号码" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请填写18位身份证号码" update_id="#text_val_'.$random_code.'" update_type="tip">
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">身份证号码</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <input type="text" name="" placeholder="请填写18位身份证号码" id="text_val_'.$random_code.'" class="item-input">
- </div>
- </div>';
- }else if($type == 'time'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="time"/>
- <div class="action-title"><span class="title">时间</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="时间" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请选择日期" update_id="#date_val_'.$random_code.'" update_type="tip">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <label style="font-size: 14px;font-weight: bold;line-height: 20px;">默认:</label>
- <label class="radio-inline">
- <input type="radio" title="不默认" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当时" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="same_time">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定时间" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="appoint_time">
- </label>
- <div class="radio-inline appoint_time_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="appoint_time_'.$random_code.'" name="appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>
- </div>
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use(["laydate","form"], function() {
- var laydate = layui.laydate;
- var form = layui.form;
- //常规用法
- laydate.render({
- elem: "#appoint_time_' . $random_code . '"
- ,type: "time"
- ,done:function(value, date, endDate){
- $("#date_val_' . $random_code . '").val(value);
- }
- });
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- $(".time_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- obj.find(".appoint_time_txt_'.$random_code.'").hide();
- $("#date_val_'.$random_code.'").val("");
- } else if(date_type == "same_time") {
- obj.find(".appoint_time_txt_'.$random_code.'").hide();
- $("#date_val_'.$random_code.'").val("");
- } else if(date_type == "appoint_time") {
- obj.find(".appoint_time_txt_'.$random_code.'").show();
- var appoint_time = $("#appoint_time_'.$random_code.'").val();
- $("#date_val_'.$random_code.'").val(appoint_time);
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">时间</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <div class="date_item">
- <input type="text" placeholder="请选择时间" id="date_val_'.$random_code.'" class="item-input" readonly>
- <div class="date_icon"><i class="layui-icon layui-icon-time" style="font-size: 25px;"></i></div>
- </div>
- </div>
- </div>';
- }else if($type == 'time_range'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="time_range"/>
- <div class="action-title"><span class="title">时间范围</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="时间范围" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark" style="width: 600px;">
- <div class="input-group" style="margin-bottom: 5px;">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <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">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group"><label class="label_title">开始时间</label></div>
- <div class="input-group" style="margin-bottom: 5px;">
- <label class="label_title">默认:</label>
- <label class="radio-inline">
- <input type="radio" title="不默认" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当时" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="same_time">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定时间" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="appoint_time">
- </label>
- <div class="radio-inline begin_appoint_time_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="begin_appoint_time_'.$random_code.'" name="begin_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group"><label class="label_title">结束时间</label></div>
- <div class="input-group" style="margin-bottom: 5px;">
- <label class="label_title">默认:</label>
- <label class="radio-inline">
- <input type="radio" title="不默认" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="same_time">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="appoint_time">
- </label>
- <div class="radio-inline end_appoint_time_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="end_appoint_time_'.$random_code.'" name="end_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>
- </div>
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use(["laydate","form"], function() {
- var laydate = layui.laydate;
- var form = layui.form;
- //常规用法
- laydate.render({
- elem: "#begin_appoint_time_'.$random_code.'"
- ,type: "time"
- ,done:function(value, date, endDate){
- $("#begin_time_val_' . $random_code . '").val(value);
- }
- });
- laydate.render({
- elem: "#end_appoint_time_'.$random_code.'"
- ,type: "time"
- ,done:function(value, date, endDate){
- $("#end_time_val_' . $random_code . '").val(value);
- }
- });
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- $(".begin_time_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- obj.find(".begin_appoint_time_txt_'.$random_code.'").hide();
- $("#begin_time_val_'.$random_code.'").val("");
- } else if(date_type == "same_time") {
- obj.find(".begin_appoint_time_txt_'.$random_code.'").hide();
- $("#begin_time_val_'.$random_code.'").val("");
- } else if(date_type == "appoint_time") {
- var appoint_time = $("#begin_appoint_time_'.$random_code.'").val();
- obj.find(".begin_appoint_time_txt_'.$random_code.'").show();
- $("#begin_time_val_'.$random_code.'").val(appoint_time);
- }
- });
- $(".end_time_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- obj.find(".end_appoint_time_txt_'.$random_code.'").hide();
- $("#end_time_val_'.$random_code.'").val("");
- } else if(date_type == "same_time") {
- obj.find(".end_appoint_time_txt_'.$random_code.'").hide();
- $("#end_time_val_'.$random_code.'").val("");
- } else if(date_type == "appoint_time") {
- obj.find(".end_appoint_time_txt_'.$random_code.'").show();
- var appoint_time = $("#end_appoint_time_'.$random_code.'").val();
- $("#end_time_val_'.$random_code.'").val(appoint_time);
- }
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">时间范围</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <div class="date_item">
- <input type="text" placeholder="请选择时间范围" id="begin_time_val_'.$random_code.'" class="item-input" readonly>
- <div class="date_icon"><i class="layui-icon layui-icon-time" style="font-size: 25px;"></i></div>
- </div>
- </div>
- </div>';
- }else if($type == 'telephone'){
- $item_li = '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="telephone"/>
- <div class="action-title"><span class="title">手机号码</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="手机号码" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="请填写11位手机号码" update_id="#text_val_'.$random_code.'" update_type="tip">
- </div>
- </div>
- <div class="input-required">
- <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="必填|非必填">
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use(["form"], function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">手机号码</span>
- <span class="item_required" id="text_required_'.$random_code.'">*</span>
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'"></div>
- <div class="tempalte_content">
- <input type="text" placeholder="请填写11位手机号码" id="text_val_'.$random_code.'" class="item-input">
- </div>
- </div>';
- }
- $need_data['item_li'] = $item_li;
- $need_data['phone_item'] = $phone_item;
- $need_data['random_code'] = $random_code;
- return $need_data;
- }
- /**
- * @author cy 2021-05-24
- * @desc 获取万能表单信息
- * @param $item
- * @return array
- */
- public function setFormsContent($item){
- $form_content = unserialize( $item['form_content'] );
- $item_li = "";
- $phone_item = "";
- if(!empty($form_content) && count($form_content) > 0){
- foreach($form_content as $k=>$v){
- $random_code = random(10,false);
- $required = $v['required'];
- $type = $v['type'];
- if($type == 'image'){//图片
- $title = $v['title'];
- $remark = $v['remark'];
- $max_count = $v['max_count'];
- $item_li = $item_li. '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="image"/>
- <div class="action-title"><span class="title">图片</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">最大上传数量</div>
- <input class="form-control" name="max_count_'.$random_code.'" type="text" placeholder="请输入最大上传数量" value="'.$max_count.'">
- <div class="input-group-addon">张</div>
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li . '</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item . '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item . '<span class="item_required" id="text_required_'.$random_code.'" >*</span>';
- }else{
- $phone_item = $phone_item . '<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $phone_item = $phone_item . '
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <div class="image-add">
- <div class="add">
- <span class="iconfont-m- icon-m-jiahao">+</span>
- </div>
- <div class="add-text"> 添加图片 </div>
- <input type="file" style="display: none;">
- </div>
- </div>
- </div>';
- }else if($type == 'text'){//单行文本
- $title = $v['title'];
- $remark = $v['remark'];
- $hint = $v['hint'];
- $item_li = $item_li . '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="text"/>
- <div class="action-title"><span class="title">单行文本</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="tip">
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li . '</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item. '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1) {
- $phone_item = $phone_item . '<span class="item_required" id = "text_required_'.$random_code.'" >*</span >';
- }else{
- $phone_item = $phone_item . '<span class="item_required" id = "text_required_'.$random_code.'" style="display:none;">*</span >';
- }
- $phone_item = $phone_item . '</div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <input type="text" placeholder="'.$hint.'" id="text_val_'.$random_code.'" class="item-input">
- </div>
- </div>';
- }else if($type == 'textarea'){//多行文本
- $title = $v['title'];
- $remark = $v['remark'];
- $hint = $v['hint'];
- $item_li = $item_li . '<li lay-filter="action_li_'.$random_code.'">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="textarea"/>
- <div class="action-title"><span class="title">多行文本</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="tip">
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li . '</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item.'<div class="phone-item" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $phone_item = $phone_item.'</div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <textarea type="text" placeholder="'.$hint.'" id="text_val_'.$random_code.'" class="item-input item-input-textarea"></textarea>
- </div>
- </div>';
- }else if($type == 'select'){//下拉选项
- $title = $v['title'];
- $remark = $v['remark'];
- $hint = $v['hint'];
- $option_val = $v['option_val'];
- $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="select"/>
- <div class="action-title"><span class="title">下拉选项</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max" style="width: 250px;">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="select_tip">
- </div>
- </div>
- </div>';
- if(!empty($option_val) && count($option_val) > 0){
- $num = 1;
- foreach($option_val as $pk=>$pv){
- $item_li = $item_li.'<div class="input-middle-item">
- <div class="input-group">
- <div class="input-group-addon">选项<span class="sort">'.$num.'</span></div>
- <input class="form-control" name="option_val_'.$random_code.'[]" type="text" placeholder="请输入" value="'.$pv.'" style="width: 430px;">
- <a class="delOptionBtn" href="javascript:;">
- 删除
- </a>
- </div>
- </div>';
- $num++;
- }
- }
- $item_li = $item_li.'<div class="input-middle-item">
- <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="select">
- +添加选项
- </a>
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li.'</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item. '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item. '<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item. '<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $phone_item = $phone_item. '</div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <select class="item-input" disabled id="text_val_'.$random_code.'">
- <option value="">'.$hint.'</option>
- </select>
- </div>
- </div>';
- }else if($type == 'radio'){//单选
- $title = $v['title'];
- $remark = $v['remark'];
- $option_val = $v['option_val'];
- $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="radio"/>
- <div class="action-title"><span class="title">单选</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark" style="width: 550px;">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- </div>';
- if(!empty($option_val) && count($option_val) > 0){
- $num = 1;
- foreach($option_val as $pk=>$pv){
- $item_li = $item_li.'<div class="input-middle-item">
- <div class="input-group">
- <div class="input-group-addon">选项<span class="sort">'.$num.'</span></div>
- <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">
- <a class="delOptionBtn" href="javascript:;" num="'.$num.'" random_code="'.$random_code.'">
- 删除
- </a>
- </div>
- </div>';
- $num++;
- }
- }
- $item_li = $item_li.'<div class="input-middle-item">
- <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="radio">
- +添加选项
- </a>
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li.'</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $phone_item = $phone_item.'</div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <div class="m-radio-box" id="m-radio-box_'.$random_code.'">';
- if(!empty($option_val) && count($option_val) > 0){
- $num = 1;
- foreach($option_val as $pk=>$pv){
- $phone_item = $phone_item.'<div class="radio-item" id="radio-item'.$num.'_'.$random_code.'">
- <input type="radio" class="radio_option" name="radio" value="'.$pv.'" title="'.$pv.'">
- </div>';
- $num++;
- }
- }
- $phone_item = $phone_item.'</div>
- </div>
- </div>';
- }else if($type == 'checked'){//多选
- $title = $v['title'];
- $remark = $v['remark'];
- $option_val = $v['option_val'];
- $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="checked"/>
- <div class="action-title"><span class="title">多选</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark" style="width: 550px;">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- </div>';
- if(!empty($option_val) && count($option_val) > 0){
- $num = 1;
- foreach($option_val as $pk=>$pv){
- $item_li = $item_li.'<div class="input-middle-item">
- <div class="input-group">
- <div class="input-group-addon">选项<span class="sort">'.$num.'</span></div>
- <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">
- <a class="delOptionBtn" href="javascript:;" num="'.$num.'" random_code="'.$random_code.'">
- 删除
- </a>
- </div>
- </div>';
- $num++;
- }
- }
- $item_li = $item_li.'<div class="input-middle-item">
- <a class="addOptionBtn" href="javascript:;" random_code="'.$random_code.'" type="checkbox">
- +添加选项
- </a>
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li.'</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $phone_item = $phone_item.'</div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <div class="m-radio-box" id="m-radio-box_'.$random_code.'">';
- if(!empty($option_val) && count($option_val) > 0){
- $num = 1;
- foreach($option_val as $pk=>$pv){
- $phone_item = $phone_item.'<div class="radio-item" id="radio-item'.$num.'_'.$random_code.'">
- <input type="checkbox" class="radio_option" name="checkbox" title="'.$pv.'" value="'.$pv.'" lay-skin="primary">
- </div>';
- $num++;
- }
- }
- $phone_item = $phone_item.'</div>
- </div>
- </div>';
- }else if($type == 'area'){//地区
- $title = $v['title'];
- $remark = $v['remark'];
- $hint = $v['hint'];
- $area_type = $v['area_type'];
- $province_id = $v['province_id'];
- $city_id = $v['city_id'];
- $country_id = $v['country_id'];
- $address = "";
- if($province_id != '请选择省份'){
- $address = $address . $province_id;
- }
- if($city_id != '请选择城市'){
- $address = $address . $city_id;
- }
- if($country_id != '请选择区域'){
- $address = $address . $country_id;
- }
- $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="area"/>
- <div class="action-title"><span class="title">地区</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content" style="width:560px">
- <div class="input-middle-item flex">
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <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">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <label class="label_title">填写条件:</label>';
- if($area_type == 'province'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="省份" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="province" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="省市" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="city">
- </label>
- <label class="radio-inline">
- <input type="radio" title="省市区" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="country">
- </label>
- </div>
- </div>
- <div class="input-middle-item flex" id="areaParent_'.$random_code.'">
- <div class="input-group province_select">
- <div class="input-group-addon">默认值 省</div>
- <select class="sel-province" lay-ignore name="province_id_'.$random_code.'" onChange="selectCity(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- <div class="input-group city_select" style="display:none;">
- <div class="input-group-addon">默认值 市</div>
- <select class="sel-city" lay-ignore name="city_id_'.$random_code.'" onChange="selectArea(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- <div class="input-group country_select" style="display:none;">
- <div class="input-group-addon">默认值 区</div>
- <select class="sel-area" lay-ignore name="country_id_'.$random_code.'" onChange="updateArea(\'' . $random_code . '\')" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>';
- }else if($area_type == 'city'){
- $item_li = $item_li.' <label class="radio-inline">
- <input type="radio" title="省份" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="province">
- </label>
- <label class="radio-inline">
- <input type="radio" title="省市" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="city" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="省市区" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="country">
- </label>
- </div>
- </div>
- <div class="input-middle-item flex" id="areaParent_'.$random_code.'">
- <div class="input-group province_select">
- <div class="input-group-addon">默认值 省</div>
- <select class="sel-province" lay-ignore name="province_id_'.$random_code.'" onChange="selectCity(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- <div class="input-group city_select">
- <div class="input-group-addon">默认值 市</div>
- <select class="sel-city" lay-ignore name="city_id_'.$random_code.'" onChange="selectArea(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- <div class="input-group country_select" style="display:none;">
- <div class="input-group-addon">默认值 区</div>
- <select class="sel-area" lay-ignore name="country_id_'.$random_code.'" onChange="updateArea(\'' . $random_code . '\')" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>';
- }else if($area_type == 'country'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="省份" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="province">
- </label>
- <label class="radio-inline">
- <input type="radio" title="省市" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="city">
- </label>
- <label class="radio-inline">
- <input type="radio" title="省市区" name="area_type_'.$random_code.'" class="area_type_'.$random_code.'" value="country" checked="checked">
- </label>
- </div>
- </div>
- <div class="input-middle-item flex" id="areaParent_'.$random_code.'">
- <div class="input-group province_select">
- <div class="input-group-addon">默认值 省</div>
- <select class="sel-province" lay-ignore name="province_id_'.$random_code.'" onChange="selectCity(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- <div class="input-group city_select">
- <div class="input-group-addon">默认值 市</div>
- <select class="sel-city" lay-ignore name="city_id_'.$random_code.'" onChange="selectcounty(\'areaParent_'.$random_code.'\');updateArea(\''.$random_code.'\');" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>
- <div class="input-group country_select">
- <div class="input-group-addon">默认值 区</div>
- <select class="sel-area" lay-ignore name="country_id_'.$random_code.'" onChange="updateArea(\'' . $random_code . '\')" style="width: 130px;display:inline;">
- <option value="" selected="true">请选择</option>
- </select>
- </div>';
- }
- $item_li = $item_li.'<script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- cascdeInit(0,0,"areaParent_'.$random_code.'","'.$province_id.'","'.$city_id.'","'.$country_id.'");
- $(".area_type_'.$random_code.'").click(function(){
- var type = $(this).val();
- var obj = $(this).parent().parent().parent().parent();
- if (type == "province") {
- obj.find(".city_select").hide();
- obj.find(".country_select").hide();
- } else if(type == "city") {
- obj.find(".city_select").show();
- obj.find(".country_select").hide();
- } else if(type == "country") {
- obj.find(".city_select").show();
- obj.find(".country_select").show();
- }
- updateArea("'.$random_code.'");
- });
- });
- </script>
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li.'</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- </div>
- </li>';
- $phone_item = $phone_item. '<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $phone_item = $phone_item. '
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <select class="item-input" id="address_'.$random_code.'" placeholder="'.$hint.'">
- <option value="">'.$address.'</option>
- </select>
- </div>
- </div>';
- }else if($type == 'date'){//日期
- $title = $v['title'];
- $remark = $v['remark'];
- $hint = $v['hint'];
- $date_type = $v['date_type'];
- $appoint_date = $v['appoint_date'];
- $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="date"/>
- <div class="action-title"><span class="title">日期</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content" style="width: 570px;">
- <div class="input-middle-item flex">
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group" >
- <div class="input-group-addon">提示语</div>
- <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">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <label style="font-size: 14px;font-weight: bold;line-height: 20px;">默认:</label>';
- if($date_type == 'no_default'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="不默认" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="same_day">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="appoint_date">
- </label>
- <div class="radio-inline appoint_date_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="appoint_date_'.$random_code.'" name="appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>';
- }else if($date_type == 'same_day'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="不默认" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="same_day" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="appoint_date">
- </label>
- <div class="radio-inline appoint_date_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="appoint_date_'.$random_code.'" name="appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>';
- }else if($date_type == 'appoint_date'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="不默认" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="same_day">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="date_type_'.$random_code.'" class="date_type_'.$random_code.'" value="appoint_date" checked="checked">
- </label>
- <div class="radio-inline appoint_date_txt_'.$random_code.'">
- <input type="text" class="layui-input" id="appoint_date_'.$random_code.'" name="appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>';
- }
- $item_li = $item_li.'</div>
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li.'</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use(["laydate","form"], function() {
- var laydate = layui.laydate;
- var form = layui.form;
- //常规用法
- laydate.render({
- elem: "#appoint_date_'.$random_code.'",
- value: "'.$appoint_date.'",
- done:function(value, date, endDate){
- $("#date_val_'.$random_code.'").val(value);
- }
- });
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- $(".date_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- obj.find(".appoint_date_txt_'.$random_code.'").hide();
- $("#date_val_'.$random_code.'").val("");
- } else if(date_type == "same_day") {
- obj.find(".appoint_date_txt_'.$random_code.'").hide();
- $("#date_val_'.$random_code.'").val("");
- } else if(date_type == "appoint_date") {
- obj.find(".appoint_date_txt_'.$random_code.'").show();
- var appoint_date = $("#appoint_date_'.$random_code.'").val();
- $("#date_val_'.$random_code.'").val(appoint_date);
- }
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $moren_date = "";
- if($date_type == 'appoint_date'){
- $moren_date = $appoint_date;
- }
- $phone_item = $phone_item.'</div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <div class="date_item">
- <input type="text" placeholder="'.$hint.'" id="date_val_'.$random_code.'" class="item-input" readonly value="'.$moren_date.'">
- <div class="date_icon"><i class="layui-icon layui-icon-date" style="font-size: 25px;"></i></div>
- </div>
- </div>
- </div>';
- }else if($type == 'date_range'){
- $title = $v['title'];
- $remark = $v['remark'];
- $begin_date_type = $v['begin_date_type'];
- $begin_hint = $v['begin_hint'];
- $begin_appoint_date = $v['begin_appoint_date'];
- $end_date_type = $v['end_date_type'];
- $end_hint = $v['end_hint'];
- $end_appoint_date = $v['end_appoint_date'];
- $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="date_range"/>
- <div class="action-title"><span class="title">日期范围</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark" style="width: 550px;">
- <div class="input-group" style="margin-bottom: 5px;">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <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">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group"><label class="label_title">开始日期</label></div>
- <div class="input-group" style="margin-bottom: 5px;">
- <label class="label_title">默认:</label>';
- if($begin_date_type == 'no_default'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="不默认" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="same_day">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="appoint_date">
- </label>
- <div class="radio-inline begin_appoint_date_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="begin_appoint_date_'.$random_code.'" name="begin_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>';
- }else if($begin_date_type == 'same_day'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="不默认" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="same_day" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="appoint_date">
- </label>
- <div class="radio-inline begin_appoint_date_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="begin_appoint_date_'.$random_code.'" name="begin_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>';
- }else if($begin_date_type == 'appoint_date'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="不默认" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="same_day">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="begin_date_type_'.$random_code.'" class="begin_date_type_'.$random_code.'" value="appoint_date" checked="checked">
- </label>
- <div class="radio-inline begin_appoint_date_txt_'.$random_code.'">
- <input type="text" class="layui-input" id="begin_appoint_date_'.$random_code.'" name="begin_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>';
- }
- $item_li = $item_li.'</div>
- </div>
- <div class="input-middle-item">
- <div class="input-group"><label class="label_title">结束日期</label></div>
- <div class="input-group" style="margin-bottom: 5px;">
- <label class="label_title">默认:</label>';
- if($end_date_type == 'no_default'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="不默认" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="same_day">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="appoint_date">
- </label>
- <div class="radio-inline end_appoint_date_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="end_appoint_date_'.$random_code.'" name="end_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>';
- }else if($end_date_type == 'same_day'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="不默认" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="same_day" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="appoint_date">
- </label>
- <div class="radio-inline end_appoint_date_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="end_appoint_date_'.$random_code.'" name="end_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>';
- }else if($end_date_type == 'appoint_date'){
- $item_li = $item_li.'<label class="radio-inline">
- <input type="radio" title="不默认" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="same_day">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="end_date_type_'.$random_code.'" class="end_date_type_'.$random_code.'" value="appoint_date" checked="checked">
- </label>
- <div class="radio-inline end_appoint_date_txt_'.$random_code.'">
- <input type="text" class="layui-input" id="end_appoint_date_'.$random_code.'" name="end_appoint_date_'.$random_code.'" placeholder="请选择指定日期">
- </div>';
- }
- $item_li = $item_li.'</div>
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li.'</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use(["laydate","form"], function() {
- var laydate = layui.laydate;
- var form = layui.form;
- //常规用法
- laydate.render({
- elem: "#begin_appoint_date_'.$random_code.'",
- value: "'.$begin_appoint_date.'",
- done:function(value, date, endDate){
- $("#begin_date_val_'.$random_code.'").val(value);
- }
- });
- laydate.render({
- elem: "#end_appoint_date_'.$random_code.'",
- value: "'.$end_appoint_date.'",
- done:function(value, date, endDate){
- $("#end_date_val_'.$random_code.'").val(value);
- }
- });
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- $(".begin_date_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- $("#begin_date_val_'.$random_code.'").val("");
- obj.find(".begin_appoint_date_txt_'.$random_code.'").hide();
- } else if(date_type == "same_day") {
- $("#begin_date_val_'.$random_code.'").val("");
- obj.find(".begin_appoint_date_txt_'.$random_code.'").hide();
- } else if(date_type == "appoint_date") {
- obj.find(".begin_appoint_date_txt_'.$random_code.'").show();
- var begin_appoint_date = $("#begin_appoint_date_'.$random_code.'").val();
- $("#begin_date_val_'.$random_code.'").val(begin_appoint_date);
- }
- });
- $(".end_date_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- obj.find(".end_appoint_date_txt_'.$random_code.'").hide();
- $("#end_date_val_'.$random_code.'").val("");
- } else if(date_type == "same_day") {
- obj.find(".end_appoint_date_txt_'.$random_code.'").hide();
- $("#end_date_val_'.$random_code.'").val("");
- } else if(date_type == "appoint_date") {
- obj.find(".end_appoint_date_txt_'.$random_code.'").show();
- var end_appoint_date = $("#end_appoint_date_'.$random_code.'").val();
- $("#end_date_val_'.$random_code.'").val(end_appoint_date);
- }
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $begin_moren_date = "";
- if($begin_date_type == 'appoint_date'){
- $begin_moren_date = $begin_appoint_date;
- }
- $end_moren_date = "";
- if($end_date_type == 'appoint_date'){
- $end_moren_date = $end_appoint_date;
- }
- $phone_item = $phone_item.'
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <div class="date_item">
- <input type="text" placeholder="请选择日期范围" id="begin_date_val_'.$random_code.'" class="item-input" readonly value="'.$begin_moren_date.'~'.$end_moren_date.'">
- <div class="date_icon"><i class="layui-icon layui-icon-date" style="font-size: 25px;"></i></div>
- </div>
- </div>
- </div>';
- }else if($type == 'idcard'){
- $title = $v['title'];
- $remark = $v['remark'];
- $hint = $v['hint'];
- $item_li = $item_li . '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="idcard"/>
- <div class="action-title"><span class="title">身份证号码</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="tip">
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li . '</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $phone_item = $phone_item.'</div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <input type="text" name="" placeholder="'.$hint.'" id="text_val_'.$random_code.'" class="item-input">
- </div>
- </div>';
- }else if($type == 'time'){
- $title = $v['title'];
- $remark = $v['remark'];
- $hint = $v['hint'];
- $time_type = $v['time_type'];
- $appoint_time = $v['appoint_time'];
- $item_li = $item_li. '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="time"/>
- <div class="action-title"><span class="title">时间</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content" style="width: 560px;">
- <div class="input-middle-item flex">
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <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">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group">
- <label style="font-size: 14px;font-weight: bold;line-height: 20px;">默认:</label>';
- if($time_type == 'no_default'){
- $item_li = $item_li. '<label class="radio-inline">
- <input type="radio" title="不默认" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当时" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="same_time">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定时间" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="appoint_time">
- </label>
- <div class="radio-inline appoint_time_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="appoint_time_'.$random_code.'" name="appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>';
- }else if($time_type == 'same_time'){
- $item_li = $item_li. '<label class="radio-inline">
- <input type="radio" title="不默认" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当时" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="same_time" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定时间" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="appoint_time">
- </label>
- <div class="radio-inline appoint_time_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="appoint_time_'.$random_code.'" name="appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>';
- }else if($time_type == 'appoint_time'){
- $item_li = $item_li. '<label class="radio-inline">
- <input type="radio" title="不默认" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当时" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="same_time">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定时间" name="time_type_'.$random_code.'" class="time_type_'.$random_code.'" value="appoint_time" checked="checked">
- </label>
- <div class="radio-inline appoint_time_txt_'.$random_code.'">
- <input type="text" class="layui-input" style="width: 180px;" id="appoint_time_'.$random_code.'" name="appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>';
- }
- $item_li = $item_li. ' </div>
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li. '
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use(["laydate","form"], function() {
- var laydate = layui.laydate;
- var form = layui.form;
- //常规用法
- laydate.render({
- elem: "#appoint_time_' . $random_code . '"
- ,value: "'.$appoint_time.'"
- ,type: "time"
- ,done:function(value, date, endDate){
- $("#date_val_' . $random_code . '").val(value);
- }
- });
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- $(".time_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- $("#date_val_'.$random_code.'").val("");
- obj.find(".appoint_time_txt_'.$random_code.'").hide();
- } else if(date_type == "same_time") {
- $("#date_val_'.$random_code.'").val("");
- obj.find(".appoint_time_txt_'.$random_code.'").hide();
- } else if(date_type == "appoint_time") {
- obj.find(".appoint_time_txt_'.$random_code.'").show();
- var appoint_time = $("#appoint_time_'.$random_code.'").val();
- $("#date_val_'.$random_code.'").val(appoint_time);
- }
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $appoint_type_time = "";
- if($time_type == 'appoint_time'){
- $appoint_type_time = $appoint_time;
- }
- $phone_item = $phone_item.'</div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <div class="date_item">
- <input type="text" placeholder="'.$hint.'" id="date_val_'.$random_code.'" class="item-input" readonly value="'.$appoint_type_time.'">
- <div class="date_icon"><i class="layui-icon layui-icon-time" style="font-size: 25px;"></i></div>
- </div>
- </div>
- </div>';
- }else if($type == 'time_range'){
- $title = $v['title'];
- $remark = $v['remark'];
- $begin_time_type = $v['begin_time_type'];
- $begin_hint = $v['begin_hint'];
- $begin_appoint_time = $v['begin_appoint_time'];
- $end_time_type = $v['end_time_type'];
- $end_hint = $v['end_hint'];
- $end_appoint_time = $v['end_appoint_time'];
- $item_li = $item_li . '<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="time_range"/>
- <div class="action-title"><span class="title">时间范围</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="middle-content">
- <div class="input-middle-item flex">
- <div class="input-remark" style="width: 550px;">
- <div class="input-group" style="margin-bottom: 5px;">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <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">
- </div>
- </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group"><label class="label_title">开始时间</label></div>
- <div class="input-group" style="margin-bottom: 5px;">
- <label class="label_title">默认:</label>';
- if($begin_time_type == 'no_default'){
- $item_li = $item_li . ' <label class="radio-inline">
- <input type="radio" title="不默认" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当时" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="same_time">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定时间" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="appoint_time">
- </label>
- <div class="radio-inline begin_appoint_time_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="begin_appoint_time_'.$random_code.'" name="begin_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>';
- }else if($begin_time_type == 'same_time'){
- $item_li = $item_li . ' <label class="radio-inline">
- <input type="radio" title="不默认" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当时" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="same_time" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定时间" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="appoint_time">
- </label>
- <div class="radio-inline begin_appoint_time_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="begin_appoint_time_'.$random_code.'" name="begin_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>';
- }else if($begin_time_type == 'appoint_time'){
- $item_li = $item_li . ' <label class="radio-inline">
- <input type="radio" title="不默认" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当时" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="same_time">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定时间" name="begin_time_type_'.$random_code.'" class="begin_time_type_'.$random_code.'" value="appoint_time" checked="checked">
- </label>
- <div class="radio-inline begin_appoint_time_txt_'.$random_code.'">
- <input type="text" class="layui-input" id="begin_appoint_time_'.$random_code.'" name="begin_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>';
- }
- $item_li = $item_li . ' </div>
- </div>
- <div class="input-middle-item">
- <div class="input-group"><label class="label_title">结束时间</label></div>
- <div class="input-group" style="margin-bottom: 5px;">
- <label class="label_title">默认:</label>';
- if($end_time_type == 'no_default'){
- $item_li = $item_li . ' <label class="radio-inline">
- <input type="radio" title="不默认" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="no_default" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="same_time">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="appoint_time">
- </label>
- <div class="radio-inline end_appoint_time_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="end_appoint_time_'.$random_code.'" name="end_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>';
- }else if($end_time_type == 'same_time'){
- $item_li = $item_li . ' <label class="radio-inline">
- <input type="radio" title="不默认" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="same_time" checked="checked">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="appoint_time">
- </label>
- <div class="radio-inline end_appoint_time_txt_'.$random_code.'" style="display:none;">
- <input type="text" class="layui-input" id="end_appoint_time_'.$random_code.'" name="end_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>';
- }else if($end_time_type == 'appoint_time'){
- $item_li = $item_li . ' <label class="radio-inline">
- <input type="radio" title="不默认" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="no_default">
- </label>
- <label class="radio-inline">
- <input type="radio" title="填表当天" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="same_time">
- </label>
- <label class="radio-inline">
- <input type="radio" title="指定日期" name="end_time_type_'.$random_code.'" class="end_time_type_'.$random_code.'" value="appoint_time" checked="checked">
- </label>
- <div class="radio-inline end_appoint_time_txt_'.$random_code.'">
- <input type="text" class="layui-input" id="end_appoint_time_'.$random_code.'" name="end_appoint_time_'.$random_code.'" placeholder="请选择指定时间">
- </div>';
- }
- $item_li = $item_li . '</div>
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li . '
- </div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use(["laydate","form"], function() {
- var laydate = layui.laydate;
- var form = layui.form;
- //常规用法
- laydate.render({
- elem: "#begin_appoint_time_'.$random_code.'"
- ,type: "time"
- ,value: "'.$begin_appoint_time.'"
- ,done:function(value, date, endDate){
- $("#begin_time_val_' . $random_code . '").val(value);
- }
- });
- laydate.render({
- elem: "#end_appoint_time_'.$random_code.'"
- ,type: "time"
- ,value: "'.$begin_appoint_time.'"
- ,done:function(value, date, endDate){
- $("#end_time_val_' . $random_code . '").val(value);
- }
- });
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- $(".begin_time_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- obj.find(".begin_appoint_time_txt_'.$random_code.'").hide();
- $("#begin_time_val_'.$random_code.'").val("");
- } else if(date_type == "same_time") {
- obj.find(".begin_appoint_time_txt_'.$random_code.'").hide();
- $("#begin_time_val_'.$random_code.'").val("");
- } else if(date_type == "appoint_time") {
- obj.find(".begin_appoint_time_txt_'.$random_code.'").show();
- var begin_appoint_time = $("#begin_appoint_time_'.$random_code.'").val();
- $("#begin_time_val_'.$random_code.'").val(begin_appoint_time);
- }
- });
- $(".end_time_type_'.$random_code.'").click(function(){
- var date_type = $(this).val();
- var obj = $(this).parent().parent();
- if (date_type == "no_default") {
- obj.find(".end_appoint_time_txt_'.$random_code.'").hide();
- $("#end_time_val_'.$random_code.'").val("");
- } else if(date_type == "same_time") {
- obj.find(".end_appoint_time_txt_'.$random_code.'").hide();
- $("#end_time_val_'.$random_code.'").val("");
- } else if(date_type == "appoint_time") {
- obj.find(".end_appoint_time_txt_'.$random_code.'").show();
- var end_appoint_time = $("#end_appoint_time_'.$random_code.'").val();
- $("#end_time_val_'.$random_code.'").val(end_appoint_time);
- }
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item .'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item .'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item .'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $begin_appoint_type_time = "";
- $end_appoint_type_time = "";
- if($begin_time_type == 'appoint_time'){
- $begin_appoint_type_time = $begin_appoint_time;
- }
- if($end_time_type == 'appoint_time'){
- $end_appoint_type_time = $end_appoint_time;
- }
- $phone_item = $phone_item .'
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <div class="date_item">
- <input type="text" placeholder="请选择时间范围" id="begin_time_val_'.$random_code.'" class="item-input" readonly value="'.$begin_appoint_type_time.'~'.$end_appoint_type_time.'">
- <div class="date_icon"><i class="layui-icon layui-icon-time" style="font-size: 25px;"></i></div>
- </div>
- </div>
- </div>';
- }else if($type == 'telephone'){
- $title = $v['title'];
- $remark = $v['remark'];
- $hint = $v['hint'];
- $item_li = $item_li.'<li lay-filter="action_li_'.$random_code.'" class="layui-form">
- <div class="action-items">
- <input type="hidden" name="random_code[]" value="'.$random_code.'"/>
- <input type="hidden" name="form_type_'.$random_code.'" value="telephone"/>
- <div class="action-title"><span class="title">手机号码</span></div>
- <div class="input-title">
- <div class="input-group">
- <div class="input-group-addon">标题</div>
- <input class="form-control" name="title_'.$random_code.'" type="text" placeholder="请输入" value="'.$title.'" update_id="#text_title_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-remark">
- <div class="input-group">
- <div class="input-group-addon">说明</div>
- <input class="form-control" name="remark_'.$random_code.'" type="text" placeholder="请输入说明文字" value="'.$remark.'" update_id="#text_tip_'.$random_code.'" update_type="html">
- </div>
- </div>
- <div class="input-max">
- <div class="input-group">
- <div class="input-group-addon">提示语</div>
- <input class="form-control" name="hint_'.$random_code.'" type="text" placeholder="请输入" value="'.$hint.'" update_id="#text_val_'.$random_code.'" update_type="tip">
- </div>
- </div>
- <div class="input-required">';
- if($required == 1){
- $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="必填|非必填">';
- }else{
- $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="必填|非必填">';
- }
- $item_li = $item_li. '</div>
- <div class="input-delete">
- <a class="layui-btn layui-btn-xs deleteBtn" href="javascript:;" random_code="'.$random_code.'">
- <i class="layui-icon"></i>删除
- </a>
- </div>
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.on("switch(required_'.$random_code.')", function(data){
- var update_id = data.elem.attributes["update_id"].nodeValue;
- if(data.elem.checked){
- $(update_id).show();
- }else{
- $(update_id).hide();
- }
- });
- });
- </script>
- </div>
- </li>';
- $phone_item = $phone_item.'<div class="phone-item layui-form" id="phone_item_'.$random_code.'" lay-filter="phone_item_'.$random_code.'">
- <div class="template_item">
- <span class="item_title" id="text_title_'.$random_code.'">'.$title.'</span>';
- if($required == 1){
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'">*</span>';
- }else{
- $phone_item = $phone_item.'<span class="item_required" id="text_required_'.$random_code.'" style="display:none;">*</span>';
- }
- $phone_item = $phone_item.'
- </div>
- <div class="template_tip" id="text_tip_'.$random_code.'">'.$remark.'</div>
- <div class="tempalte_content">
- <input type="text" placeholder="'.$hint.'" id="text_val_'.$random_code.'" class="item-input">
- </div>
- </div>';
- }
- }
- }
- $item_li = $item_li . '
- <script>
- layui.use("form", function() {
- var form = layui.form;
- form.render();
- });
- </script>';
- $need_data = ['item_li' => $item_li,'phone_item' => $phone_item];
- return $need_data;
- }
- }
- ?>
|