123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381 |
- <?php
- /**
- * lionfish 商城系统
- *
- *
- * @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;
- }
- }
- ?>
|