1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243 |
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <meta name="format-detection"content="telephone=no">
- <title>添加记录</title>
- <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
- <link rel="stylesheet" href="../../css/select.css">
- <style media="screen">
- body,html{
- margin: 0;
- background: #fff;
- }
- *{
- box-sizing: border-box;
- }
- .recode-warp{
- margin-top: 10px;
- }
- .col>label{
- color: #333;
- font-size: 16px;
- padding: 15px 0 ;
- position: relative;
- padding-left: 15px;
- width: 100%;
- }
- .col>label:before{
- content: '';
- position: absolute;
- top: 13px;
- left: 0;
- width: 3px;
- height: 26px;
- background: #009fe8;
- }
- .col>label:after{
- content: '';
- position: absolute;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 1px;
- background: #ECF0F1;
- }
- .recode-warp{
- padding: 5px 10px;
- }
- .input-recode{
- position: relative;
- }
- .title{
- font-size: 16px;
- color: #333;
- font-weight: normal;
- margin-bottom: 10px;
- }
- .title span{
- color: red;
- }
- .input-recode .input{
- margin: 0;
- height: 45px;
- border: 1px solid #e1e5e9;
- background: #ffffff;
- font-size: 14px;
- width: 100%;
- -webkit-border-radius: 3px;
- border-radius: 3px;
- padding-left: 15px;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- color: #333;
- }
- .modula:not(:first-child){
- margin-top: 18px;
- }
- .ico{
- display: block;
- position: absolute;
- top: 16px;
- right: 8px;
- width: 18px;
- height: 13px;
- background: url(../../icon/ico.png) no-repeat;
- background-size: cover;
- }
- /*录音*/
- .input-recode audio{
- width: 100%;
- }
- .upload-btn{
- width: 100px;
- height: 33px;
- background: url(../../icon/mp3.jpg);
- background-size: cover;
- display: block;
- cursor: pointer;
- }
- .del-btn{
- display: none;
- width: 60px;
- height: 30px;
- line-height: 30px;
- text-align: center;
- color: #fff;
- background: #07c160;
- border-radius: 3px;
- font-size: 14px;
- margin-bottom: 10px;
- }
- /*文件*/
- .file-items{
- border: 1px dashed #D9D9D9;
- padding: 10px 10px 0 10px;
- display: flex;
- justify-content: flex-start;
- flex-wrap: wrap;
- box-sizing: border-box;
- }
- .file-width{
- width: 33.3333333%;
- box-sizing: border-box;
- font-size: 14px;
- color: #333;
- margin-bottom: 10px;
- }
- .file-item{
- text-align: center;
- }
- .file-item img{
- width: 35px;
- height: 35px;
- margin-bottom: 5px;
- }
- .file-item p{
- padding: 0 5px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 2;
- -webkit-box-orient: vertical;
- height: auto;
- }
- .upload img{
- width: 80px;
- height: 80px;
- margin-left: 15px;
- }
- /*图片*/
- .img-item{
- text-align: center;
- }
- .img-item img{
- width: 80px;
- height: 80px;
- border-radius: 3px;
- object-fit: cover;
- }
- .img-items .upload{
- text-align: center;
- }
- .img-items .upload img{
- width: 80px;
- height: 80px;
- margin: 0;
- }
- /*视频*/
- .upload-btn1{
- width: 100px;
- height: 33px;
- background: url(../../icon/vedio.png);
- background-size: cover;
- display: block;
- cursor: pointer;
- }
- .submit-btn{
- width: 100%;
- font-size: 18px;
- background: #009fe8;
- height: 55px;
- line-height: 55px;
- letter-spacing: 5px;
- color: #fff;
- border-radius: 3px;
- margin-top: 20px;
- margin-bottom: 20px;
- }
- /*检查项*/
- .radio-wrap{
- font-size: 14px;
- display: flex;
- justify-content: flex-start;
- flex-wrap: wrap;
- padding-top: 10px;
- }
- .radio-wrap label{
- margin-right: 10px;
- padding: 5px 0;
- }
- .radio-wrap label input{
- margin-right: 10px;
- }
- /*position*/
- .flex-start{
- display: flex;
- justify-content: space-between;
- white-space: nowrap;
- align-items: center;
- }
- .flex-space{
- display: flex;
- justify-content: space-between;
- white-space: nowrap;
- align-items: center;
- }
- .ico-map{
- width: 25px;
- height: 25px;
- background: url("../../icon/position.png") no-repeat;
- background-position: center;
- background-size: cover;
- }
- .position{
- padding: 5px 0;
- padding-left: 15px;
- padding-right: 10px;
- border-radius: 50px;
- background: #F0F0F0;
- font-size: 14px;
- margin-top:10px;
- }
- .map1{
- color: #009FE8;
- margin-bottom: 5px;
- }
- .again{
- color: #6C6F74;
- }
- .map-name {
- width: 78%;
- }
- .names{
- width: 85%;
- white-space: normal;
- }
- #position_warp{
- padding: 0 10px;
- }
- .textarea{
- height: 45px;
- line-height: 1.5;
- }
- .classSign img{
- width: 100%;
- height: auto;
- }
- </style>
- </head>
- <body>
- <div id="position_warp"></div>
- <div class="recode-warp" id="recode_warp"></div>
- </body>
- </html>
- <script type="text/template" id="recodeTemplate">
- <!-- 是否开启定位 -->
- {{?it.position == true}}
- {{=getLonLat(false)}}
- {{?}}
- <!-- 状态-->
- {{?it.recordStatusList != "" && it.recordStatusList != null}}
- {{ for(var i= 0;i<it.recordStatusList.length;i++) { }}
- <div class="modula state">
- <label class="title isOptionals" isOptional="true">
- <span>*</span>
- {{=it.recordStatusList[i].statusContent}}:
- </label>
- <div class="text-input input-recode">
- <input type="text" placeholder="请选择{{=it.recordStatusList[i].statusContent}}" statusId="{{=it.recordStatusList[i].statusId}}" class="isOptional input moreStatusA" id="moreStatus{{=it.recordStatusList[i].id}}" readonly>
- <i class="ico"></i>
- </div>
- </div>
- {{?it.recordStatusList[i].choseType === 'checkbox'}}
- {{=statusCheckbox('moreStatus'+it.recordStatusList[i].id,it.recordStatusList[i].statusItemList,it.recordStatusList[i].statusContent)}}
- {{??}}
- {{=statusRadio('moreStatus'+it.recordStatusList[i].id,it.recordStatusList[i].statusItemList,it.recordStatusList[i].statusContent)}}
- {{?}}
- {{ } }}
- {{??it.statusName !=""}}
- <div class="modula state">
- <label class="title isOptionals" isOptional="true">
- <span>*</span>
- {{=it.statusName}}:
- </label>
- <div class="text-input input-recode">
- <input type="text" placeholder="请输入{{=it.statusName}}" class="isOptional input statusContent">
- </div>
- </div>
- {{?}}
- <!-- 记录项 -->
- {{ for(var key in it.inputList) { }}
- <div class="col">
- <label style="display:{{=key==""?'none':'block'}}">{{=key}}</label>
- <div class="content" style="padding-top:15px;">
- {{ for(var i=0;i<it.inputList[key].length;i++) { }}
- {{?it.inputList[key][i].inputType === 'text'}}
- <div class="modula text">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <textarea oninput="Oninput(this)" placeholder="请输入{{=it.inputList[key][i].inputName}}" style="padding: 10px 15px" recordTrem-id="{{=it.inputList[key][i].id}}" class="isOptional input recordTrems textarea"></textarea>
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'name_auto'}}
- <div class="modula text">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="text" readonly value="{{=userNames}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'handrSign_auto'}}
- <div class="modula text">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode classSign" recordTrem-id="{{=it.inputList[key][i].id}}">
- {{? sign == ''}}
- <p>暂无手写签名,请去个人中心设置!</p>
- {{??}}
- <img src="{{=sign}}" alt="">
- {{?}}
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'date_auto'}}
- <div class="modula text">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="text" readonly value="{{=getYearMonthDate()}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'dateTime_auto'}}
- <div class="modula text">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="text" readonly value="{{=getYearMonthDateTime()}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'text_phone'}}
- <div class="modula text">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="tel" placeholder="请填写手机号" value="{{=JSON.parse($api.getStorage('data')).data.user.mobile == null?'':JSON.parse($api.getStorage('data')).data.user.mobile}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'text_id'}}
- <div class="modula text">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="text" placeholder="请填写身份证号" value="{{=JSON.parse($api.getStorage('data')).data.user.identity_card == null?'':JSON.parse($api.getStorage('data')).data.user.identity_card }}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'company_auto'}}
- <div class="modula text">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="text" readonly value="{{=JSON.parse($api.getStorage('data')).data.user.section}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'dateTime'}}
- <div class="modula date-time">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="datetime-local" data-datetime="true" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'date'}}
- <div class="modula date">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="date" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'file'}}
- <div class="modula file-warp">
- <label class="title" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode file-items fileList_warp" recordTrem-id="{{=it.inputList[key][i].id}}">
- <div class="upload file-width" onclick="browseFile(this,'file')">
- <img src="../../image/upload.png" alt="">
- </div>
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'mp3'}}
- <div class="modula audio-warp">
- <h4 class="title" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </h4>
- <div class="text-input input-recode mp3_wrap" recordTrem-id="{{=it.inputList[key][i].id}}">
- <div class="upload-audio">
- <span class="upload-btn" onclick="browseFile(this,'mp3')"></span>
- <button type="button" class="del-btn hide" onclick="delAudio(this)">删除</button>
- </div>
- <div class="audio-content">
- </div>
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'number'}}
- <div class="modula number">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="number" placeholder="请输入{{=it.inputList[key][i].inputName}}" recordTrem-id="{{=it.inputList[key][i].id}}" class="isOptional input recordTrems">
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'photo'}}
- <div class="modula img-warp">
- <label class="title" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode file-items img-items photoFile" isOptional="{{=it.inputList[key][i].isOptional}}" recordTrem-id="{{=it.inputList[key][i].id}}">
- <div class="upload file-width" onclick="uploadImg('{{=it.inputList[key][i].businessType}}',this)">
- <img src="../../image/upload.png" alt="">
- </div>
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'radio'}}
- <div class="modula radio">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="text" placeholder="请选择" class="isOptional input changeInput" recordTrem-id="{{=it.inputList[key][i].id}}" id="radio{{=i}}" readonly>
- <i class="ico"></i>
- </div>
- </div>
- {{=radioRecord('radio'+i,it.inputList[key][i].inputItemList)}}
- {{??it.inputList[key][i].inputType === 'video'}}
- <div class="modula vedio-warp">
- <h4 class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </h4>
- <div class="text-input input-recode mp4_wrap" recordTrem-id="{{=it.inputList[key][i].id}}">
- <div class="upload-audio">
- <span class="upload-btn1" onclick="browseFile(this,'mp4')"></span>
- <button type="button" class="del-btn hide" onclick="delVedio(this)">删除</button>
- </div>
- <div class="audio-content">
- </div>
- </div>
- </div>
- {{??it.inputList[key][i].inputType === 'checkbox'}}
- <div class="modula checkbox">
- <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
- <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
- {{=it.inputList[key][i].inputName}}:
- </label>
- <div class="text-input input-recode">
- <input type="text" placeholder="请选择" class="isOptional input changeInput" recordTrem-id="{{=it.inputList[key][i].id}}" id="checkbox{{=i}}" readonly>
- <i class="ico"></i>
- </div>
- </div>
- {{=checkboxRecord('checkbox'+i,it.inputList[key][i].inputItemList)}}
- {{?}}
- {{ } }}
- </div>
- </div>
- {{ } }}
- <!-- 检查项 -->
- {{?it.checkItemList != ""}}
- {{ for(var i= 0;i<it.checkItemList.length;i++) { }}
- <div class="modula checkbox-term">
- <label class="title" style="margin-bottom: 0">
- {{=it.checkItemList[i].group.groupName}}:
- </label>
- <div class="radio-wrap">
- {{?it.checkItemList[i].group.checkType == 'radio'}}
- {{ for(var t=0;t<it.checkItemList[i].checkItemList.length;t++) { }}
- <label>
- <input class="aui-radio checked" type="radio" value="{{=it.checkItemList[i].checkItemList[t].id}}" name="{{=it.checkItemList[i].group.groupName}}">
- {{=it.checkItemList[i].checkItemList[t].itemValue}}
- </label>
- {{ } }}
- {{??}}
- {{ for(var t=0;t<it.checkItemList[i].checkItemList.length;t++) { }}
- <label>
- <input class="aui-checkbox checked" type="checkbox" value="{{=it.checkItemList[i].checkItemList[t].id}}" name="{{=it.checkItemList[i].group.groupName}}">
- {{=it.checkItemList[i].checkItemList[t].itemValue}}
- </label>
- {{ } }}
- {{?}}
- </div>
- </div>
- {{ } }}
- {{?}}
- <button type="button" name="button" class="submit-btn" onclick="submitRecode()">提交记录</button>
- </script>
- <script type="text/template" id="mapTemplate">
- <div class="position flex-space">
- <div class="map-name flex-start">
- <i class="ico-map"></i>
- <div class="names">
- <p class="map1">{{=it.address}}</p>
- </div>
- </div>
- <p class="again" onclick="getLonLat(true)">重新定位</p>
- </div>
- </script>
- <script type="text/javascript" src="../../script/api.js"></script>
- <script type="text/javascript" src="../../script/doT.min.js"></script>
- <script type="text/javascript" src="../../script/zepto.js"></script>
- <script type="text/javascript" src="../../script/select.js"></script>
- <script src="../../script/config.js" charset="utf-8"></script>
- <script type="text/javascript">
- var imgarr = [], UIAlbumBrowser= "",sign ='';
- var pageId="", pageRecordParentId= "", recordParentId= "",
- templateId="", templateName="",departmentId="",userId= "",userName= "";
- var i = 0;
- apiready = function () {
- var info = $api.getStorage('data');
- userNames = name = JSON.parse(info).data.user.name;
- sign = JSON.parse(info).data.user.sign
- UIAlbumBrowser = api.require('UIAlbumBrowser');
- pageId = api.pageParam.pageId
- departmentId = api.pageParam.organizationIds
- userId= api.pageParam.createBy
- userName= api.pageParam.createName
- recordParentId= api.pageParam.recordTrueID
- recodeContent(api.pageParam.pageId, api.pageParam.pageRecordId)
- }
- // 记录模版内容
- function recodeContent(id,recodeId) {
- var param={
- pageId:id,
- pageRecordId:recodeId,
- recordParentId:recordParentId,
- }
- $http.requestShowProgress(UrlRouter.getInspection,'get',param)
- .then(ret=>{
- if (ret.code === '200') {
- pageRecordParentId = ret.data.parentId;
- templateId = ret.data.recordTemplate.id
- templateName = ret.data.recordTemplate.templateName
- $apis.html(recode_warp, '#recodeTemplate',ret.data.recordTemplate);
- }
- }).catch(err=>{})
- }
- // 录音
- // 删除录音
- function delAudio(that) {
- $(that).hide();
- $(that).parent().find('.upload-btn').show();
- $(that).parent().parent().find('audio').remove();
- }
- // 视频
- // 删除视频
- function delVedio(that) {
- $(that).hide();
- $(that).parent().find('.upload-btn1').show();
- $(that).parent().parent().find('video').remove();
- }
- // 状态
- function checkbox(el,list,titles) {
- var itmes = {title:'',value:''},itmesArray = [];
- for (var j= 0;j<list.length;j++) {
- itmes = {};
- itmes.title = list[j].statusContent;
- itmes.value = list[j].id;
- itmesArray.push(itmes)
- }
- setTimeout(function () {
- $('#'+el).select({
- title: titles,
- multi: true,
- items: itmesArray
- });
- },1000)
- return ''
- }
- // 记录项多选-单选
- function checkboxRecord(el,list) {
- var itmes = {title:'',value:''},itmesArray = [],idArray=[],titleArray=[];
- for (var j= 0;j<list.length;j++) {
- itmes = {};
- if (list[j].isDefault === true) {
- titleArray.push(list[j].itemValue)
- idArray.push(list[j].id)
- }
- itmes.title = list[j].itemValue;
- itmes.value = list[j].id;
- itmesArray.push(itmes)
- }
- setTimeout(function () {
- $("#"+el).select({
- multi: true,
- items: itmesArray
- });
- $("#"+el).attr("data-values",idArray.join(','))
- $("#"+el).attr("value",titleArray.join(','))
- },1000)
- return ''
- }
- function radioRecord(el,list) {
- var itmes = {title:'',value:''},itmesArray = [],idArray=[],titleArray=[];
- for (var j= 0;j<list.length;j++) {
- itmes = {};
- if (list[j].isDefault === true) {
- titleArray.push(list[j].itemValue)
- idArray.push(list[j].id)
- }
- itmes.title = list[j].itemValue;
- itmes.value = list[j].id;
- itmesArray.push(itmes)
- }
- setTimeout(function () {
- $("#"+el).select({
- multi: false,
- items: itmesArray
- });
- $("#"+el).attr("data-values",idArray.join(','))
- $("#"+el).attr("value",titleArray.join(','))
- },1000)
- return ''
- }
- //状态
- // 多选
- function statusCheckbox(el,list,titles) {
- var itmes = {title:'',value:''},itmesArray = [];
- for (var j= 0;j<list.length;j++) {
- itmes = {};
- itmes.title = list[j].statusContent;
- itmes.value = list[j].id;
- itmesArray.push(itmes)
- }
- setTimeout(function () {
- $("#"+el).select({
- title: titles,
- multi: true,
- items: itmesArray
- });
- },1000)
- return ''
- }
- // 单选
- function statusRadio(el,list,titles) {
- var itmes = {title:'',value:''},itmesArray = [];
- for (var j= 0;j<list.length;j++) {
- itmes = {};
- itmes.title = list[j].statusContent;
- itmes.value = list[j].id;
- itmesArray.push(itmes)
- }
- setTimeout(function () {
- $("#"+el).select({
- title: titles,
- multi: false,
- items: itmesArray
- });
- },1000)
- return ''
- }
- // 上传图片
- function uploadImg(type,that) {
- if (type == 'remote') {
- api.getPicture({
- sourceType: 'camera'
- }, function(ret, err){
- if(ret && ret.data!=""){
- uploadHead(ret.data,that);
- }
- });
- }else {
- api.actionSheet({
- title: '选择',
- cancelTitle: '取消',
- buttons: ['相机','相册']
- }, function(ret, err) {
- if (ret.buttonIndex !=3) {
- var type = 'camera';
- if(ret.buttonIndex == 1){
- type = 'camera';
- api.getPicture({
- sourceType: type
- }, function(ret, err){
- if(ret && ret.data!=""){
- uploadHead(ret.data,that);
- }
- });
- }else {
- type = 'album';
- // 支持多图片上传,UIAlbumBrowser模块获取图片路径
- changeImageUrl(that)
- }
- }
- });
- }
- }
- // upload img
- function uploadHead(imgUrl,that){
- $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:imgUrl})
- .then(ret=>{
- if(ret.code === '200'){
- var html = `<div class="img-item file-width" img-Url="${ret.data.fullURL}">
- <img src="${ret.data.fullURL}" alt="">
- </div>`;
- $api.append(that.parentNode,html);
- api.toast({
- msg: '上传成功',
- duration: 2000,
- location: 'top'
- });
- }else {
- api.toast({
- msg: '上传失败',
- duration: 2000,
- location: 'top'
- });
- }
- })
- .catch(err=>{
- api.toast({
- msg: '网络错误',
- duration: 2000,
- location: 'top'
- });
- })
- }
- // 获取相册图片路径
- function changeImageUrl(el) {
- UIAlbumBrowser.imagePicker({
- max: 9,
- styles: {
- bg: '#000000',
- //cameraImg: 'widget://res/cameraImg.png',
- mark: {
- position: 'top_right',
- size: 20
- },
- nav: {
- bg: '#000000',
- cancelColor: '#fff',
- cancelSize: 16,
- nextStepColor: '#7fff00',
- nextStepSize: 16
- },
- thumbnail: {
- w: 100,
- h: 100
- }
- },
- animation: true,
- }, function(ret) {
- if (ret.eventType == 'nextStep') {
- UIAlbumBrowser.closePicker();
- if (ret.list && ret.list.length > 0) {
- imgarr = ret.list;
- // 转换缩略图路径 ios
- UIAlbumBrowser_transPath(el);
- }
- }
- if (ret.originalPath && ret.originalPath.length > 0) {
- uploadHead(ret.originalPath,el)
- }
- });
- }
- // 转换缩略图路径 ios
- function UIAlbumBrowser_transPath(el) {
- UIAlbumBrowser.transPath({
- path: imgarr[i].path
- }, function(ret, err) {
- if (ret) {
- i++;
- if (i < imgarr.length) {
- UIAlbumBrowser_transPath(el);
- } else {
- i = 0;
- }
- uploadHead(ret.path,el)
- }
- });
- }
- // 上传文件
- // 浏览手机文件夹,获取文件路径
- function browseFile(el,type) {
- var fileBrowser = api.require('fileBrowser');
- fileBrowser.open(function(ret) {
- if (ret) {
- var type = ret.name.substring(ret.name.lastIndexOf('.'))
- if (
- type === '.xls' ||
- type === '.ppt' ||
- type === '.pptx' ||
- type === '.xlsx' ||
- type === '.doc' ||
- type === '.docx' ||
- type === '.zip' ||
- type === '.rar' ||
- type === '.pdf'
- ) {
- setTimeout(function () {
- uploadFile(el,ret.url)
- },500)
- }else if (type === '.mp3') {
- setTimeout(function () {
- uploadAudio(el,ret.url)
- },500)
- }else if(type === '.mp4'){
- setTimeout(function () {
- uploadVedio(el,ret.url)
- },500)
- }else {
- alert('选择文件格式不正确');
- }
- }
- });
- fileBrowser.skin({
- skin:1
- });
- }
- // 上传文件
- function uploadFile(el,fileUrl) {
- $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:fileUrl})
- .then(ret=>{
- if(ret.code === '200'){
- api.toast({
- msg: '上传成功',
- duration: 2000,
- location: 'top'
- });
- var fileType = ret.data.fileName.substr(ret.data.fileName.length-3,3);
- if (
- fileType == 'ppt' ||
- fileType == 'ptx' ||
- fileType == 'lsx' ||
- fileType == 'xls' ||
- fileType == 'doc' ||
- fileType == 'ocx' ||
- fileType == 'zip' ||
- fileType == 'rar' ||
- fileType == 'pdf'
- ){
- var html = `<div class="file-item file-width" file-Url="${ret.data.fullURL}" file-Name="${ret.data.fileName}">
- <img src="../../icon/${ret.data.fullURL.substr(ret.data.fullURL.length-3,3)}.png"/>
- <p>${ret.data.fileName}</p>
- </div>`;
- $api.append(el.parentNode,html);
- }else {
- api.toast({
- msg: '文件格式不对',
- duration: 2000,
- location: 'top'
- });
- }
- }else {
- api.toast({
- msg: '上传失败',
- duration: 2000,
- location: 'top'
- });
- }
- })
- .catch(err=>{
- api.toast({
- msg: '网络错误',
- duration: 2000,
- location: 'top'
- });
- })
- }
- // 上传音频
- function uploadAudio(el,fileUrl) {
- $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:fileUrl})
- .then(ret=>{
- if(ret.code === '200'){
- api.toast({
- msg: '上传成功',
- duration: 2000,
- location: 'top'
- });
- var fileType = ret.data.fileExt;
- if (
- fileType == 'm4a' ||
- fileType == 'mp3' ||
- fileType == 'amr' ||
- fileType == 'AMR' ||
- fileType == 'WAV' ||
- fileType == 'wav' ||
- fileType == 'AWB' ||
- fileType == 'awb'
- ){
- $(el).hide();
- $(el).parent().find('.del-btn').show();
- var html = `<audio src="${ret.data.fullURL}" controls></audio>`;
- $(el).parent().parent().find('.audio-content').html(html)
- }else {
- api.toast({
- msg: '音频格式不对',
- duration: 2000,
- location: 'top'
- });
- }
- }else {
- api.toast({
- msg: '上传失败',
- duration: 2000,
- location: 'top'
- });
- }
- })
- .catch(err=>{
- api.toast({
- msg: '网络错误',
- duration: 2000,
- location: 'top'
- });
- })
- }
- // 上传视频
- function uploadVedio(el,fileUrl) {
- $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:fileUrl})
- .then(ret=>{
- if(ret.code === '200'){
- api.toast({
- msg: '上传成功',
- duration: 2000,
- location: 'top'
- });
- var fileType = ret.data.fileExt;
- if (
- fileType == 'mp4' ||
- fileType == 'avi' ||
- fileType == 'wmv' ||
- fileType == '3gp' ||
- fileType == 'mkv' ||
- fileType == 'flv' ||
- fileType == 'rmvb'
- ){
- $(el).hide();
- $(el).parent().find('.del-btn').show();
- var html = `<video controls="controls" style="width: 100%;height: 200px;">
- <source src="${ret.data.fullURL}">
- 当前不支持播放该视频
- </video>`;
- $(el).parent().parent().find('.audio-content').html(html)
- }else {
- api.toast({
- msg: '视频格式不对',
- duration: 2000,
- location: 'top'
- });
- }
- }else {
- api.toast({
- msg: '上传失败',
- duration: 2000,
- location: 'top'
- });
- }
- })
- .catch(err=>{
- api.toast({
- msg: '网络错误',
- duration: 2000,
- location: 'top'
- });
- })
- }
- //提交
- function mvalidate() {
- var isOptionals = $('.isOptionals')
- var opnum=0,eachnum=0;
- isOptionals.each(function (index) {
- if ($(this).attr('isOptional') == 'true'){
- ++opnum;
- }
- if ($(this).attr('isOptional') == 'true' && $(this).parent().find('.isOptional').val() !== "") {
- ++eachnum
- }
- })
- if (opnum == eachnum) {
- return true;
- }else {
- return false;
- }
- }
- function submitRecode() {
- if (mvalidate()) {
- var inutItme =[],recordTrems = $('.recordTrems'),inputObj = {inputId:'',inputValue:''},changeInput = $('.changeInput');
- //6.图片
- var photoFile = $('.photoFile'),photoArray = [];
- var isOptional = true
- photoFile.each(function () {
- inputObj = {};
- photoArray =[];
- inputObj.inputId = $(this).attr('recordTrem-id');
- var photoList = $(this).find('.img-item');
- photoList.each(function () {
- photoArray.push($(this).attr('img-Url'));
- });
- inputObj.inputValue = photoArray.join(',');
- if ($(this).attr('isOptional') === "true" && inputObj.inputValue =="") {
- isOptional = false
- }
- inutItme.push(inputObj);
- });
- if (isOptional === false) {
- return api.toast({
- msg: '请上传带*号的图片',
- duration: 2000,
- location: 'bottom'
- });
- }
- api.showProgress({
- title: '',
- text: '提交中...',
- modal: true
- });
- // 检查项
- var inspectTremA = $('.checked'),checkItemArray = [];
- var obj = {checkItemId:'',instanceValue:''}
- for (var i = 0; i < inspectTremA.length; i++) {
- obj = {}
- if (inspectTremA[i].checked) {
- obj.checkItemId = inspectTremA[i].value
- obj.instanceValue = true;
- checkItemArray.push(obj)
- }
- }
- // 记录项
- //// 1.文本, 时间,日期,数字
- recordTrems.each(function () {
- inputObj = {};
- var inputValue = $(this).val(),
- inputId = $(this).attr('recordTrem-id'),
- datetime = $(this).attr('data-datetime');;
- if (datetime) {
- inputObj.inputId = inputId;
- inputObj.inputValue = inputValue.replace("T"," ");
- }else {
- inputObj.inputId = inputId;
- inputObj.inputValue = inputValue;
- }
- inutItme.push(inputObj);
- });
- var classSign = $('.classSign')
- // 记录项,手写签名
- classSign.each(function () {
- inputObj = {};
- $(this).attr('recordTrem-id')
- inputObj.inputId = $(this).attr('recordTrem-id')
- inputObj.inputValue = sign
- inutItme.push(inputObj);
- })
- //2.多选,单选
- changeInput.each(function () {
- inputObj = {};
- inputObj.inputId = $(this).attr('recordTrem-id');
- inputObj.inputValue = $(this).attr('data-values');
- inutItme.push(inputObj);
- });
- //3.录音
- var mp3_wrap = $('.mp3_wrap');
- mp3_wrap.each(function () {
- inputObj = {};
- inputObj.inputId = $(this).attr('recordTrem-id');
- inputObj.inputValue = $(this).find('audio').attr('src');
- inutItme.push(inputObj);
- });
- //4.视频
- var mp4_wrap = $('.mp4_wrap');
- mp4_wrap.each(function () {
- inputObj = {};
- inputObj.inputId = $(this).attr('recordTrem-id');
- inputObj.inputValue = $(this).find('video>source').attr('src');
- inutItme.push(inputObj);
- });
- //5.文件
- var fileList_warp = $('.fileList_warp'),fileArray = [],fileName = [],num = 0;
- fileList_warp.each(function (index) {
- inputObj = {};
- fileArray= [];
- inputObj.inputId = $(this).attr('recordTrem-id');
- var fileList = $(this).find('.file-item');
- fileList.each(function () {
- fileArray.push($(this).attr('file-Url')+"-"+$(this).attr('file-Name'));
- });
- inputObj.inputValue = fileArray.join(',');
- inutItme.push(inputObj);
- });
- // 状态项
- // 状态
- var moreStatusA = $('.moreStatusA'),statusA = [],statusObj = {statusId:"",statusValue:''};
- moreStatusA.each(function () {
- statusObj = {};
- statusObj.statusId = $(this).attr('statusId');
- statusObj.statusValue = $(this).attr('data-values');
- statusA.push(statusObj);
- });
- var filterl= inutItme.filter(function (item) {
- if (item.inputValue != undefined){
- return item.inputValue !=""
- }
- });
- var param= {
- checkItems: checkItemArray,
- createBy: userId,
- createName: userName,
- inputs:filterl,
- pageId:pageId,
- pageRecordParentId:pageRecordParentId,
- recordParentId:recordParentId,
- status:statusA.length !=0? statusA : [],
- statusContent:$('.statusContent').val(),
- templateId:templateId,
- templateName:templateName,
- departmentId:departmentId,
- spName:spName,
- lng:lon,
- lat:lat
- }
- console.log(JSON.stringify(param));
- $.ajax({
- url: UrlRouter.addRecordInstance,
- type: 'post',
- contentType:'application/json;charset=UTF-8',
- dataType: 'json',
- data: JSON.stringify(param),
- success: function (ret) {
- if(ret.code === '200') {
- $('.submit-btn').attr('disabled','disabled')
- api.hideProgress()
- $event.openTabLayout('recodeDetails'+Math.random(),'recodeDetails','记录详情',{recordParentId:ret.data});
- }else if (ret.code == 422) {
- api.hideProgress()
- api.alert({
- title: '提示',
- msg: '请填写记录项',
- });
- }
- },
- error:function (err) {
- api.hideProgress()
- api.toast({
- msg: err,
- duration: 3000,
- location: 'top'
- });
- }
- })
- }else {
- api.toast({
- msg: '请填写带*号的内容!',
- duration: 3000,
- location: 'top'
- });
- }
- }
- // 定位初始化
- var spName = '',lon='',lat='';
- function getLonLat(flag) {
- if (flag) {
- api.showProgress({
- title: '提示',
- text: '定位中...',
- });
- }
- var aMap = api.require('aMap');
- aMap.getLocation(function(ret, err) {
- if (ret.status) {
- api.hideProgress();
- lon= ret.lon; lat=ret.lat;
- aMap.getNameFromCoords({
- lon: ret.lon,
- lat: ret.lat
- }, function(ret, err) {
- if (ret.status) {
- spName = ret.address
- $apis.html(position_warp, '#mapTemplate',ret);
- } else {
- api.toast({
- msg: '请打开手机定位',
- duration: 2000,
- location: 'top'
- });
- }
- });
- } else {
- api.hideProgress();
- api.toast({
- msg: '定位失败请重新定位',
- duration: 2000,
- location: 'top'
- });
- }
- });
- return '';
- }
- // textarea根据文字多少自适应高度
- function Oninput(that) {
- $(that).height(that.scrollHeight);
- }
- </script>
|