addRecode.html 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <meta name="format-detection"content="telephone=no">
  8. <title>添加记录</title>
  9. <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
  10. <link rel="stylesheet" href="../../css/select.css">
  11. <style media="screen">
  12. body,html{
  13. margin: 0;
  14. background: #fff;
  15. }
  16. *{
  17. box-sizing: border-box;
  18. }
  19. .recode-warp{
  20. margin-top: 10px;
  21. }
  22. .col>label{
  23. color: #333;
  24. font-size: 16px;
  25. padding: 15px 0 ;
  26. position: relative;
  27. padding-left: 15px;
  28. width: 100%;
  29. }
  30. .col>label:before{
  31. content: '';
  32. position: absolute;
  33. top: 13px;
  34. left: 0;
  35. width: 3px;
  36. height: 26px;
  37. background: #009fe8;
  38. }
  39. .col>label:after{
  40. content: '';
  41. position: absolute;
  42. bottom: 0;
  43. left: 0;
  44. width: 100%;
  45. height: 1px;
  46. background: #ECF0F1;
  47. }
  48. .recode-warp{
  49. padding: 5px 10px;
  50. }
  51. .input-recode{
  52. position: relative;
  53. }
  54. .title{
  55. font-size: 16px;
  56. color: #333;
  57. font-weight: normal;
  58. margin-bottom: 10px;
  59. }
  60. .title span{
  61. color: red;
  62. }
  63. .input-recode .input{
  64. margin: 0;
  65. height: 45px;
  66. border: 1px solid #e1e5e9;
  67. background: #ffffff;
  68. font-size: 14px;
  69. width: 100%;
  70. -webkit-border-radius: 3px;
  71. border-radius: 3px;
  72. padding-left: 15px;
  73. -webkit-box-sizing: border-box;
  74. box-sizing: border-box;
  75. color: #333;
  76. }
  77. .modula:not(:first-child){
  78. margin-top: 18px;
  79. }
  80. .ico{
  81. display: block;
  82. position: absolute;
  83. top: 16px;
  84. right: 8px;
  85. width: 18px;
  86. height: 13px;
  87. background: url(../../icon/ico.png) no-repeat;
  88. background-size: cover;
  89. }
  90. /*录音*/
  91. .input-recode audio{
  92. width: 100%;
  93. }
  94. .upload-btn{
  95. width: 100px;
  96. height: 33px;
  97. background: url(../../icon/mp3.jpg);
  98. background-size: cover;
  99. display: block;
  100. cursor: pointer;
  101. }
  102. .del-btn{
  103. display: none;
  104. width: 60px;
  105. height: 30px;
  106. line-height: 30px;
  107. text-align: center;
  108. color: #fff;
  109. background: #07c160;
  110. border-radius: 3px;
  111. font-size: 14px;
  112. margin-bottom: 10px;
  113. }
  114. /*文件*/
  115. .file-items{
  116. border: 1px dashed #D9D9D9;
  117. padding: 10px 10px 0 10px;
  118. display: flex;
  119. justify-content: flex-start;
  120. flex-wrap: wrap;
  121. box-sizing: border-box;
  122. }
  123. .file-width{
  124. width: 33.3333333%;
  125. box-sizing: border-box;
  126. font-size: 14px;
  127. color: #333;
  128. margin-bottom: 10px;
  129. }
  130. .file-item{
  131. text-align: center;
  132. }
  133. .file-item img{
  134. width: 35px;
  135. height: 35px;
  136. margin-bottom: 5px;
  137. }
  138. .file-item p{
  139. padding: 0 5px;
  140. overflow: hidden;
  141. text-overflow: ellipsis;
  142. display: -webkit-box;
  143. -webkit-line-clamp: 2;
  144. -webkit-box-orient: vertical;
  145. height: auto;
  146. }
  147. .upload img{
  148. width: 80px;
  149. height: 80px;
  150. margin-left: 15px;
  151. }
  152. /*图片*/
  153. .img-item{
  154. text-align: center;
  155. }
  156. .img-item img{
  157. width: 80px;
  158. height: 80px;
  159. border-radius: 3px;
  160. object-fit: cover;
  161. }
  162. .img-items .upload{
  163. text-align: center;
  164. }
  165. .img-items .upload img{
  166. width: 80px;
  167. height: 80px;
  168. margin: 0;
  169. }
  170. /*视频*/
  171. .upload-btn1{
  172. width: 100px;
  173. height: 33px;
  174. background: url(../../icon/vedio.png);
  175. background-size: cover;
  176. display: block;
  177. cursor: pointer;
  178. }
  179. .submit-btn{
  180. width: 100%;
  181. font-size: 18px;
  182. background: #009fe8;
  183. height: 55px;
  184. line-height: 55px;
  185. letter-spacing: 5px;
  186. color: #fff;
  187. border-radius: 3px;
  188. margin-top: 20px;
  189. margin-bottom: 20px;
  190. }
  191. /*检查项*/
  192. .radio-wrap{
  193. font-size: 14px;
  194. display: flex;
  195. justify-content: flex-start;
  196. flex-wrap: wrap;
  197. padding-top: 10px;
  198. }
  199. .radio-wrap label{
  200. margin-right: 10px;
  201. padding: 5px 0;
  202. }
  203. .radio-wrap label input{
  204. margin-right: 10px;
  205. }
  206. /*position*/
  207. .flex-start{
  208. display: flex;
  209. justify-content: space-between;
  210. white-space: nowrap;
  211. align-items: center;
  212. }
  213. .flex-space{
  214. display: flex;
  215. justify-content: space-between;
  216. white-space: nowrap;
  217. align-items: center;
  218. }
  219. .ico-map{
  220. width: 25px;
  221. height: 25px;
  222. background: url("../../icon/position.png") no-repeat;
  223. background-position: center;
  224. background-size: cover;
  225. }
  226. .position{
  227. padding: 5px 0;
  228. padding-left: 15px;
  229. padding-right: 10px;
  230. border-radius: 50px;
  231. background: #F0F0F0;
  232. font-size: 14px;
  233. margin-top:10px;
  234. }
  235. .map1{
  236. color: #009FE8;
  237. margin-bottom: 5px;
  238. }
  239. .again{
  240. color: #6C6F74;
  241. }
  242. .map-name {
  243. width: 78%;
  244. }
  245. .names{
  246. width: 85%;
  247. white-space: normal;
  248. }
  249. #position_warp{
  250. padding: 0 10px;
  251. }
  252. .textarea{
  253. height: 45px;
  254. line-height: 1.5;
  255. }
  256. .classSign img{
  257. width: 100%;
  258. height: auto;
  259. }
  260. </style>
  261. </head>
  262. <body>
  263. <div id="position_warp"></div>
  264. <div class="recode-warp" id="recode_warp"></div>
  265. </body>
  266. </html>
  267. <script type="text/template" id="recodeTemplate">
  268. <!-- 是否开启定位 -->
  269. {{?it.position == true}}
  270. {{=getLonLat(false)}}
  271. {{?}}
  272. <!-- 状态-->
  273. {{?it.recordStatusList != "" && it.recordStatusList != null}}
  274. {{ for(var i= 0;i<it.recordStatusList.length;i++) { }}
  275. <div class="modula state">
  276. <label class="title isOptionals" isOptional="true">
  277. <span>*</span>
  278. {{=it.recordStatusList[i].statusContent}}:
  279. </label>
  280. <div class="text-input input-recode">
  281. <input type="text" placeholder="请选择{{=it.recordStatusList[i].statusContent}}" statusId="{{=it.recordStatusList[i].statusId}}" class="isOptional input moreStatusA" id="moreStatus{{=it.recordStatusList[i].id}}" readonly>
  282. <i class="ico"></i>
  283. </div>
  284. </div>
  285. {{?it.recordStatusList[i].choseType === 'checkbox'}}
  286. {{=statusCheckbox('moreStatus'+it.recordStatusList[i].id,it.recordStatusList[i].statusItemList,it.recordStatusList[i].statusContent)}}
  287. {{??}}
  288. {{=statusRadio('moreStatus'+it.recordStatusList[i].id,it.recordStatusList[i].statusItemList,it.recordStatusList[i].statusContent)}}
  289. {{?}}
  290. {{ } }}
  291. {{??it.statusName !=""}}
  292. <div class="modula state">
  293. <label class="title isOptionals" isOptional="true">
  294. <span>*</span>
  295. {{=it.statusName}}:
  296. </label>
  297. <div class="text-input input-recode">
  298. <input type="text" placeholder="请输入{{=it.statusName}}" class="isOptional input statusContent">
  299. </div>
  300. </div>
  301. {{?}}
  302. <!-- 记录项 -->
  303. {{ for(var key in it.inputList) { }}
  304. <div class="col">
  305. <label style="display:{{=key==""?'none':'block'}}">{{=key}}</label>
  306. <div class="content" style="padding-top:15px;">
  307. {{ for(var i=0;i<it.inputList[key].length;i++) { }}
  308. {{?it.inputList[key][i].inputType === 'text'}}
  309. <div class="modula text">
  310. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  311. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  312. {{=it.inputList[key][i].inputName}}:
  313. </label>
  314. <div class="text-input input-recode">
  315. <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>
  316. </div>
  317. </div>
  318. {{??it.inputList[key][i].inputType === 'name_auto'}}
  319. <div class="modula text">
  320. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  321. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  322. {{=it.inputList[key][i].inputName}}:
  323. </label>
  324. <div class="text-input input-recode">
  325. <input type="text" readonly value="{{=userNames}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  326. </div>
  327. </div>
  328. {{??it.inputList[key][i].inputType === 'handrSign_auto'}}
  329. <div class="modula text">
  330. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  331. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  332. {{=it.inputList[key][i].inputName}}:
  333. </label>
  334. <div class="text-input input-recode classSign" recordTrem-id="{{=it.inputList[key][i].id}}">
  335. {{? sign == ''}}
  336. <p>暂无手写签名,请去个人中心设置!</p>
  337. {{??}}
  338. <img src="{{=sign}}" alt="">
  339. {{?}}
  340. </div>
  341. </div>
  342. {{??it.inputList[key][i].inputType === 'date_auto'}}
  343. <div class="modula text">
  344. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  345. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  346. {{=it.inputList[key][i].inputName}}:
  347. </label>
  348. <div class="text-input input-recode">
  349. <input type="text" readonly value="{{=getYearMonthDate()}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  350. </div>
  351. </div>
  352. {{??it.inputList[key][i].inputType === 'dateTime_auto'}}
  353. <div class="modula text">
  354. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  355. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  356. {{=it.inputList[key][i].inputName}}:
  357. </label>
  358. <div class="text-input input-recode">
  359. <input type="text" readonly value="{{=getYearMonthDateTime()}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  360. </div>
  361. </div>
  362. {{??it.inputList[key][i].inputType === 'text_phone'}}
  363. <div class="modula text">
  364. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  365. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  366. {{=it.inputList[key][i].inputName}}:
  367. </label>
  368. <div class="text-input input-recode">
  369. <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}}">
  370. </div>
  371. </div>
  372. {{??it.inputList[key][i].inputType === 'text_id'}}
  373. <div class="modula text">
  374. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  375. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  376. {{=it.inputList[key][i].inputName}}:
  377. </label>
  378. <div class="text-input input-recode">
  379. <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}}">
  380. </div>
  381. </div>
  382. {{??it.inputList[key][i].inputType === 'company_auto'}}
  383. <div class="modula text">
  384. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  385. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  386. {{=it.inputList[key][i].inputName}}:
  387. </label>
  388. <div class="text-input input-recode">
  389. <input type="text" readonly value="{{=JSON.parse($api.getStorage('data')).data.user.section}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  390. </div>
  391. </div>
  392. {{??it.inputList[key][i].inputType === 'dateTime'}}
  393. <div class="modula date-time">
  394. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  395. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  396. {{=it.inputList[key][i].inputName}}:
  397. </label>
  398. <div class="text-input input-recode">
  399. <input type="datetime-local" data-datetime="true" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  400. </div>
  401. </div>
  402. {{??it.inputList[key][i].inputType === 'date'}}
  403. <div class="modula date">
  404. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  405. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  406. {{=it.inputList[key][i].inputName}}:
  407. </label>
  408. <div class="text-input input-recode">
  409. <input type="date" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  410. </div>
  411. </div>
  412. {{??it.inputList[key][i].inputType === 'file'}}
  413. <div class="modula file-warp">
  414. <label class="title" isOptional="{{=it.inputList[key][i].isOptional}}">
  415. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  416. {{=it.inputList[key][i].inputName}}:
  417. </label>
  418. <div class="text-input input-recode file-items fileList_warp" recordTrem-id="{{=it.inputList[key][i].id}}">
  419. <div class="upload file-width" onclick="browseFile(this,'file')">
  420. <img src="../../image/upload.png" alt="">
  421. </div>
  422. </div>
  423. </div>
  424. {{??it.inputList[key][i].inputType === 'mp3'}}
  425. <div class="modula audio-warp">
  426. <h4 class="title" isOptional="{{=it.inputList[key][i].isOptional}}">
  427. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  428. {{=it.inputList[key][i].inputName}}:
  429. </h4>
  430. <div class="text-input input-recode mp3_wrap" recordTrem-id="{{=it.inputList[key][i].id}}">
  431. <div class="upload-audio">
  432. <span class="upload-btn" onclick="browseFile(this,'mp3')"></span>
  433. <button type="button" class="del-btn hide" onclick="delAudio(this)">删除</button>
  434. </div>
  435. <div class="audio-content">
  436. </div>
  437. </div>
  438. </div>
  439. {{??it.inputList[key][i].inputType === 'number'}}
  440. <div class="modula number">
  441. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  442. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  443. {{=it.inputList[key][i].inputName}}:
  444. </label>
  445. <div class="text-input input-recode">
  446. <input type="number" placeholder="请输入{{=it.inputList[key][i].inputName}}" recordTrem-id="{{=it.inputList[key][i].id}}" class="isOptional input recordTrems">
  447. </div>
  448. </div>
  449. {{??it.inputList[key][i].inputType === 'photo'}}
  450. <div class="modula img-warp">
  451. <label class="title" isOptional="{{=it.inputList[key][i].isOptional}}">
  452. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  453. {{=it.inputList[key][i].inputName}}:
  454. </label>
  455. <div class="text-input input-recode file-items img-items photoFile" isOptional="{{=it.inputList[key][i].isOptional}}" recordTrem-id="{{=it.inputList[key][i].id}}">
  456. <div class="upload file-width" onclick="uploadImg('{{=it.inputList[key][i].businessType}}',this)">
  457. <img src="../../image/upload.png" alt="">
  458. </div>
  459. </div>
  460. </div>
  461. {{??it.inputList[key][i].inputType === 'radio'}}
  462. <div class="modula radio">
  463. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  464. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  465. {{=it.inputList[key][i].inputName}}:
  466. </label>
  467. <div class="text-input input-recode">
  468. <input type="text" placeholder="请选择" class="isOptional input changeInput" recordTrem-id="{{=it.inputList[key][i].id}}" id="radio{{=i}}" readonly>
  469. <i class="ico"></i>
  470. </div>
  471. </div>
  472. {{=radioRecord('radio'+i,it.inputList[key][i].inputItemList)}}
  473. {{??it.inputList[key][i].inputType === 'video'}}
  474. <div class="modula vedio-warp">
  475. <h4 class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  476. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  477. {{=it.inputList[key][i].inputName}}:
  478. </h4>
  479. <div class="text-input input-recode mp4_wrap" recordTrem-id="{{=it.inputList[key][i].id}}">
  480. <div class="upload-audio">
  481. <span class="upload-btn1" onclick="browseFile(this,'mp4')"></span>
  482. <button type="button" class="del-btn hide" onclick="delVedio(this)">删除</button>
  483. </div>
  484. <div class="audio-content">
  485. </div>
  486. </div>
  487. </div>
  488. {{??it.inputList[key][i].inputType === 'checkbox'}}
  489. <div class="modula checkbox">
  490. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  491. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  492. {{=it.inputList[key][i].inputName}}:
  493. </label>
  494. <div class="text-input input-recode">
  495. <input type="text" placeholder="请选择" class="isOptional input changeInput" recordTrem-id="{{=it.inputList[key][i].id}}" id="checkbox{{=i}}" readonly>
  496. <i class="ico"></i>
  497. </div>
  498. </div>
  499. {{=checkboxRecord('checkbox'+i,it.inputList[key][i].inputItemList)}}
  500. {{?}}
  501. {{ } }}
  502. </div>
  503. </div>
  504. {{ } }}
  505. <!-- 检查项 -->
  506. {{?it.checkItemList != ""}}
  507. {{ for(var i= 0;i<it.checkItemList.length;i++) { }}
  508. <div class="modula checkbox-term">
  509. <label class="title" style="margin-bottom: 0">
  510. {{=it.checkItemList[i].group.groupName}}:
  511. </label>
  512. <div class="radio-wrap">
  513. {{?it.checkItemList[i].group.checkType == 'radio'}}
  514. {{ for(var t=0;t<it.checkItemList[i].checkItemList.length;t++) { }}
  515. <label>
  516. <input class="aui-radio checked" type="radio" value="{{=it.checkItemList[i].checkItemList[t].id}}" name="{{=it.checkItemList[i].group.groupName}}">
  517. {{=it.checkItemList[i].checkItemList[t].itemValue}}
  518. </label>
  519. {{ } }}
  520. {{??}}
  521. {{ for(var t=0;t<it.checkItemList[i].checkItemList.length;t++) { }}
  522. <label>
  523. <input class="aui-checkbox checked" type="checkbox" value="{{=it.checkItemList[i].checkItemList[t].id}}" name="{{=it.checkItemList[i].group.groupName}}">
  524. {{=it.checkItemList[i].checkItemList[t].itemValue}}
  525. </label>
  526. {{ } }}
  527. {{?}}
  528. </div>
  529. </div>
  530. {{ } }}
  531. {{?}}
  532. <button type="button" name="button" class="submit-btn" onclick="submitRecode()">提交记录</button>
  533. </script>
  534. <script type="text/template" id="mapTemplate">
  535. <div class="position flex-space">
  536. <div class="map-name flex-start">
  537. <i class="ico-map"></i>
  538. <div class="names">
  539. <p class="map1">{{=it.address}}</p>
  540. </div>
  541. </div>
  542. <p class="again" onclick="getLonLat(true)">重新定位</p>
  543. </div>
  544. </script>
  545. <script type="text/javascript" src="../../script/api.js"></script>
  546. <script type="text/javascript" src="../../script/doT.min.js"></script>
  547. <script type="text/javascript" src="../../script/zepto.js"></script>
  548. <script type="text/javascript" src="../../script/select.js"></script>
  549. <script src="../../script/config.js" charset="utf-8"></script>
  550. <script type="text/javascript">
  551. var imgarr = [], UIAlbumBrowser= "",sign ='';
  552. var pageId="", pageRecordParentId= "", recordParentId= "",
  553. templateId="", templateName="",departmentId="",userId= "",userName= "";
  554. var i = 0;
  555. apiready = function () {
  556. var info = $api.getStorage('data');
  557. userNames = name = JSON.parse(info).data.user.name;
  558. sign = JSON.parse(info).data.user.sign
  559. UIAlbumBrowser = api.require('UIAlbumBrowser');
  560. pageId = api.pageParam.pageId
  561. departmentId = api.pageParam.organizationIds
  562. userId= api.pageParam.createBy
  563. userName= api.pageParam.createName
  564. recordParentId= api.pageParam.recordTrueID
  565. recodeContent(api.pageParam.pageId, api.pageParam.pageRecordId)
  566. }
  567. // 记录模版内容
  568. function recodeContent(id,recodeId) {
  569. var param={
  570. pageId:id,
  571. pageRecordId:recodeId,
  572. recordParentId:recordParentId,
  573. }
  574. $http.requestShowProgress(UrlRouter.getInspection,'get',param)
  575. .then(ret=>{
  576. if (ret.code === '200') {
  577. pageRecordParentId = ret.data.parentId;
  578. templateId = ret.data.recordTemplate.id
  579. templateName = ret.data.recordTemplate.templateName
  580. $apis.html(recode_warp, '#recodeTemplate',ret.data.recordTemplate);
  581. }
  582. }).catch(err=>{})
  583. }
  584. // 录音
  585. // 删除录音
  586. function delAudio(that) {
  587. $(that).hide();
  588. $(that).parent().find('.upload-btn').show();
  589. $(that).parent().parent().find('audio').remove();
  590. }
  591. // 视频
  592. // 删除视频
  593. function delVedio(that) {
  594. $(that).hide();
  595. $(that).parent().find('.upload-btn1').show();
  596. $(that).parent().parent().find('video').remove();
  597. }
  598. // 状态
  599. function checkbox(el,list,titles) {
  600. var itmes = {title:'',value:''},itmesArray = [];
  601. for (var j= 0;j<list.length;j++) {
  602. itmes = {};
  603. itmes.title = list[j].statusContent;
  604. itmes.value = list[j].id;
  605. itmesArray.push(itmes)
  606. }
  607. setTimeout(function () {
  608. $('#'+el).select({
  609. title: titles,
  610. multi: true,
  611. items: itmesArray
  612. });
  613. },1000)
  614. return ''
  615. }
  616. // 记录项多选-单选
  617. function checkboxRecord(el,list) {
  618. var itmes = {title:'',value:''},itmesArray = [],idArray=[],titleArray=[];
  619. for (var j= 0;j<list.length;j++) {
  620. itmes = {};
  621. if (list[j].isDefault === true) {
  622. titleArray.push(list[j].itemValue)
  623. idArray.push(list[j].id)
  624. }
  625. itmes.title = list[j].itemValue;
  626. itmes.value = list[j].id;
  627. itmesArray.push(itmes)
  628. }
  629. setTimeout(function () {
  630. $("#"+el).select({
  631. multi: true,
  632. items: itmesArray
  633. });
  634. $("#"+el).attr("data-values",idArray.join(','))
  635. $("#"+el).attr("value",titleArray.join(','))
  636. },1000)
  637. return ''
  638. }
  639. function radioRecord(el,list) {
  640. var itmes = {title:'',value:''},itmesArray = [],idArray=[],titleArray=[];
  641. for (var j= 0;j<list.length;j++) {
  642. itmes = {};
  643. if (list[j].isDefault === true) {
  644. titleArray.push(list[j].itemValue)
  645. idArray.push(list[j].id)
  646. }
  647. itmes.title = list[j].itemValue;
  648. itmes.value = list[j].id;
  649. itmesArray.push(itmes)
  650. }
  651. setTimeout(function () {
  652. $("#"+el).select({
  653. multi: false,
  654. items: itmesArray
  655. });
  656. $("#"+el).attr("data-values",idArray.join(','))
  657. $("#"+el).attr("value",titleArray.join(','))
  658. },1000)
  659. return ''
  660. }
  661. //状态
  662. // 多选
  663. function statusCheckbox(el,list,titles) {
  664. var itmes = {title:'',value:''},itmesArray = [];
  665. for (var j= 0;j<list.length;j++) {
  666. itmes = {};
  667. itmes.title = list[j].statusContent;
  668. itmes.value = list[j].id;
  669. itmesArray.push(itmes)
  670. }
  671. setTimeout(function () {
  672. $("#"+el).select({
  673. title: titles,
  674. multi: true,
  675. items: itmesArray
  676. });
  677. },1000)
  678. return ''
  679. }
  680. // 单选
  681. function statusRadio(el,list,titles) {
  682. var itmes = {title:'',value:''},itmesArray = [];
  683. for (var j= 0;j<list.length;j++) {
  684. itmes = {};
  685. itmes.title = list[j].statusContent;
  686. itmes.value = list[j].id;
  687. itmesArray.push(itmes)
  688. }
  689. setTimeout(function () {
  690. $("#"+el).select({
  691. title: titles,
  692. multi: false,
  693. items: itmesArray
  694. });
  695. },1000)
  696. return ''
  697. }
  698. // 上传图片
  699. function uploadImg(type,that) {
  700. if (type == 'remote') {
  701. api.getPicture({
  702. sourceType: 'camera'
  703. }, function(ret, err){
  704. if(ret && ret.data!=""){
  705. uploadHead(ret.data,that);
  706. }
  707. });
  708. }else {
  709. api.actionSheet({
  710. title: '选择',
  711. cancelTitle: '取消',
  712. buttons: ['相机','相册']
  713. }, function(ret, err) {
  714. if (ret.buttonIndex !=3) {
  715. var type = 'camera';
  716. if(ret.buttonIndex == 1){
  717. type = 'camera';
  718. api.getPicture({
  719. sourceType: type
  720. }, function(ret, err){
  721. if(ret && ret.data!=""){
  722. uploadHead(ret.data,that);
  723. }
  724. });
  725. }else {
  726. type = 'album';
  727. // 支持多图片上传,UIAlbumBrowser模块获取图片路径
  728. changeImageUrl(that)
  729. }
  730. }
  731. });
  732. }
  733. }
  734. // upload img
  735. function uploadHead(imgUrl,that){
  736. $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:imgUrl})
  737. .then(ret=>{
  738. if(ret.code === '200'){
  739. var html = `<div class="img-item file-width" img-Url="${ret.data.fullURL}">
  740. <img src="${ret.data.fullURL}" alt="">
  741. </div>`;
  742. $api.append(that.parentNode,html);
  743. api.toast({
  744. msg: '上传成功',
  745. duration: 2000,
  746. location: 'top'
  747. });
  748. }else {
  749. api.toast({
  750. msg: '上传失败',
  751. duration: 2000,
  752. location: 'top'
  753. });
  754. }
  755. })
  756. .catch(err=>{
  757. api.toast({
  758. msg: '网络错误',
  759. duration: 2000,
  760. location: 'top'
  761. });
  762. })
  763. }
  764. // 获取相册图片路径
  765. function changeImageUrl(el) {
  766. UIAlbumBrowser.imagePicker({
  767. max: 9,
  768. styles: {
  769. bg: '#000000',
  770. //cameraImg: 'widget://res/cameraImg.png',
  771. mark: {
  772. position: 'top_right',
  773. size: 20
  774. },
  775. nav: {
  776. bg: '#000000',
  777. cancelColor: '#fff',
  778. cancelSize: 16,
  779. nextStepColor: '#7fff00',
  780. nextStepSize: 16
  781. },
  782. thumbnail: {
  783. w: 100,
  784. h: 100
  785. }
  786. },
  787. animation: true,
  788. }, function(ret) {
  789. if (ret.eventType == 'nextStep') {
  790. UIAlbumBrowser.closePicker();
  791. if (ret.list && ret.list.length > 0) {
  792. imgarr = ret.list;
  793. // 转换缩略图路径 ios
  794. UIAlbumBrowser_transPath(el);
  795. }
  796. }
  797. if (ret.originalPath && ret.originalPath.length > 0) {
  798. uploadHead(ret.originalPath,el)
  799. }
  800. });
  801. }
  802. // 转换缩略图路径 ios
  803. function UIAlbumBrowser_transPath(el) {
  804. UIAlbumBrowser.transPath({
  805. path: imgarr[i].path
  806. }, function(ret, err) {
  807. if (ret) {
  808. i++;
  809. if (i < imgarr.length) {
  810. UIAlbumBrowser_transPath(el);
  811. } else {
  812. i = 0;
  813. }
  814. uploadHead(ret.path,el)
  815. }
  816. });
  817. }
  818. // 上传文件
  819. // 浏览手机文件夹,获取文件路径
  820. function browseFile(el,type) {
  821. var fileBrowser = api.require('fileBrowser');
  822. fileBrowser.open(function(ret) {
  823. if (ret) {
  824. var type = ret.name.substring(ret.name.lastIndexOf('.'))
  825. if (
  826. type === '.xls' ||
  827. type === '.ppt' ||
  828. type === '.pptx' ||
  829. type === '.xlsx' ||
  830. type === '.doc' ||
  831. type === '.docx' ||
  832. type === '.zip' ||
  833. type === '.rar' ||
  834. type === '.pdf'
  835. ) {
  836. setTimeout(function () {
  837. uploadFile(el,ret.url)
  838. },500)
  839. }else if (type === '.mp3') {
  840. setTimeout(function () {
  841. uploadAudio(el,ret.url)
  842. },500)
  843. }else if(type === '.mp4'){
  844. setTimeout(function () {
  845. uploadVedio(el,ret.url)
  846. },500)
  847. }else {
  848. alert('选择文件格式不正确');
  849. }
  850. }
  851. });
  852. fileBrowser.skin({
  853. skin:1
  854. });
  855. }
  856. // 上传文件
  857. function uploadFile(el,fileUrl) {
  858. $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:fileUrl})
  859. .then(ret=>{
  860. if(ret.code === '200'){
  861. api.toast({
  862. msg: '上传成功',
  863. duration: 2000,
  864. location: 'top'
  865. });
  866. var fileType = ret.data.fileName.substr(ret.data.fileName.length-3,3);
  867. if (
  868. fileType == 'ppt' ||
  869. fileType == 'ptx' ||
  870. fileType == 'lsx' ||
  871. fileType == 'xls' ||
  872. fileType == 'doc' ||
  873. fileType == 'ocx' ||
  874. fileType == 'zip' ||
  875. fileType == 'rar' ||
  876. fileType == 'pdf'
  877. ){
  878. var html = `<div class="file-item file-width" file-Url="${ret.data.fullURL}" file-Name="${ret.data.fileName}">
  879. <img src="../../icon/${ret.data.fullURL.substr(ret.data.fullURL.length-3,3)}.png"/>
  880. <p>${ret.data.fileName}</p>
  881. </div>`;
  882. $api.append(el.parentNode,html);
  883. }else {
  884. api.toast({
  885. msg: '文件格式不对',
  886. duration: 2000,
  887. location: 'top'
  888. });
  889. }
  890. }else {
  891. api.toast({
  892. msg: '上传失败',
  893. duration: 2000,
  894. location: 'top'
  895. });
  896. }
  897. })
  898. .catch(err=>{
  899. api.toast({
  900. msg: '网络错误',
  901. duration: 2000,
  902. location: 'top'
  903. });
  904. })
  905. }
  906. // 上传音频
  907. function uploadAudio(el,fileUrl) {
  908. $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:fileUrl})
  909. .then(ret=>{
  910. if(ret.code === '200'){
  911. api.toast({
  912. msg: '上传成功',
  913. duration: 2000,
  914. location: 'top'
  915. });
  916. var fileType = ret.data.fileExt;
  917. if (
  918. fileType == 'm4a' ||
  919. fileType == 'mp3' ||
  920. fileType == 'amr' ||
  921. fileType == 'AMR' ||
  922. fileType == 'WAV' ||
  923. fileType == 'wav' ||
  924. fileType == 'AWB' ||
  925. fileType == 'awb'
  926. ){
  927. $(el).hide();
  928. $(el).parent().find('.del-btn').show();
  929. var html = `<audio src="${ret.data.fullURL}" controls></audio>`;
  930. $(el).parent().parent().find('.audio-content').html(html)
  931. }else {
  932. api.toast({
  933. msg: '音频格式不对',
  934. duration: 2000,
  935. location: 'top'
  936. });
  937. }
  938. }else {
  939. api.toast({
  940. msg: '上传失败',
  941. duration: 2000,
  942. location: 'top'
  943. });
  944. }
  945. })
  946. .catch(err=>{
  947. api.toast({
  948. msg: '网络错误',
  949. duration: 2000,
  950. location: 'top'
  951. });
  952. })
  953. }
  954. // 上传视频
  955. function uploadVedio(el,fileUrl) {
  956. $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:fileUrl})
  957. .then(ret=>{
  958. if(ret.code === '200'){
  959. api.toast({
  960. msg: '上传成功',
  961. duration: 2000,
  962. location: 'top'
  963. });
  964. var fileType = ret.data.fileExt;
  965. if (
  966. fileType == 'mp4' ||
  967. fileType == 'avi' ||
  968. fileType == 'wmv' ||
  969. fileType == '3gp' ||
  970. fileType == 'mkv' ||
  971. fileType == 'flv' ||
  972. fileType == 'rmvb'
  973. ){
  974. $(el).hide();
  975. $(el).parent().find('.del-btn').show();
  976. var html = `<video controls="controls" style="width: 100%;height: 200px;">
  977. <source src="${ret.data.fullURL}">
  978. 当前不支持播放该视频
  979. </video>`;
  980. $(el).parent().parent().find('.audio-content').html(html)
  981. }else {
  982. api.toast({
  983. msg: '视频格式不对',
  984. duration: 2000,
  985. location: 'top'
  986. });
  987. }
  988. }else {
  989. api.toast({
  990. msg: '上传失败',
  991. duration: 2000,
  992. location: 'top'
  993. });
  994. }
  995. })
  996. .catch(err=>{
  997. api.toast({
  998. msg: '网络错误',
  999. duration: 2000,
  1000. location: 'top'
  1001. });
  1002. })
  1003. }
  1004. //提交
  1005. function mvalidate() {
  1006. var isOptionals = $('.isOptionals')
  1007. var opnum=0,eachnum=0;
  1008. isOptionals.each(function (index) {
  1009. if ($(this).attr('isOptional') == 'true'){
  1010. ++opnum;
  1011. }
  1012. if ($(this).attr('isOptional') == 'true' && $(this).parent().find('.isOptional').val() !== "") {
  1013. ++eachnum
  1014. }
  1015. })
  1016. if (opnum == eachnum) {
  1017. return true;
  1018. }else {
  1019. return false;
  1020. }
  1021. }
  1022. function submitRecode() {
  1023. if (mvalidate()) {
  1024. var inutItme =[],recordTrems = $('.recordTrems'),inputObj = {inputId:'',inputValue:''},changeInput = $('.changeInput');
  1025. //6.图片
  1026. var photoFile = $('.photoFile'),photoArray = [];
  1027. var isOptional = true
  1028. photoFile.each(function () {
  1029. inputObj = {};
  1030. photoArray =[];
  1031. inputObj.inputId = $(this).attr('recordTrem-id');
  1032. var photoList = $(this).find('.img-item');
  1033. photoList.each(function () {
  1034. photoArray.push($(this).attr('img-Url'));
  1035. });
  1036. inputObj.inputValue = photoArray.join(',');
  1037. if ($(this).attr('isOptional') === "true" && inputObj.inputValue =="") {
  1038. isOptional = false
  1039. }
  1040. inutItme.push(inputObj);
  1041. });
  1042. if (isOptional === false) {
  1043. return api.toast({
  1044. msg: '请上传带*号的图片',
  1045. duration: 2000,
  1046. location: 'bottom'
  1047. });
  1048. }
  1049. api.showProgress({
  1050. title: '',
  1051. text: '提交中...',
  1052. modal: true
  1053. });
  1054. // 检查项
  1055. var inspectTremA = $('.checked'),checkItemArray = [];
  1056. var obj = {checkItemId:'',instanceValue:''}
  1057. for (var i = 0; i < inspectTremA.length; i++) {
  1058. obj = {}
  1059. if (inspectTremA[i].checked) {
  1060. obj.checkItemId = inspectTremA[i].value
  1061. obj.instanceValue = true;
  1062. checkItemArray.push(obj)
  1063. }
  1064. }
  1065. // 记录项
  1066. //// 1.文本, 时间,日期,数字
  1067. recordTrems.each(function () {
  1068. inputObj = {};
  1069. var inputValue = $(this).val(),
  1070. inputId = $(this).attr('recordTrem-id'),
  1071. datetime = $(this).attr('data-datetime');;
  1072. if (datetime) {
  1073. inputObj.inputId = inputId;
  1074. inputObj.inputValue = inputValue.replace("T"," ");
  1075. }else {
  1076. inputObj.inputId = inputId;
  1077. inputObj.inputValue = inputValue;
  1078. }
  1079. inutItme.push(inputObj);
  1080. });
  1081. var classSign = $('.classSign')
  1082. // 记录项,手写签名
  1083. classSign.each(function () {
  1084. inputObj = {};
  1085. $(this).attr('recordTrem-id')
  1086. inputObj.inputId = $(this).attr('recordTrem-id')
  1087. inputObj.inputValue = sign
  1088. inutItme.push(inputObj);
  1089. })
  1090. //2.多选,单选
  1091. changeInput.each(function () {
  1092. inputObj = {};
  1093. inputObj.inputId = $(this).attr('recordTrem-id');
  1094. inputObj.inputValue = $(this).attr('data-values');
  1095. inutItme.push(inputObj);
  1096. });
  1097. //3.录音
  1098. var mp3_wrap = $('.mp3_wrap');
  1099. mp3_wrap.each(function () {
  1100. inputObj = {};
  1101. inputObj.inputId = $(this).attr('recordTrem-id');
  1102. inputObj.inputValue = $(this).find('audio').attr('src');
  1103. inutItme.push(inputObj);
  1104. });
  1105. //4.视频
  1106. var mp4_wrap = $('.mp4_wrap');
  1107. mp4_wrap.each(function () {
  1108. inputObj = {};
  1109. inputObj.inputId = $(this).attr('recordTrem-id');
  1110. inputObj.inputValue = $(this).find('video>source').attr('src');
  1111. inutItme.push(inputObj);
  1112. });
  1113. //5.文件
  1114. var fileList_warp = $('.fileList_warp'),fileArray = [],fileName = [],num = 0;
  1115. fileList_warp.each(function (index) {
  1116. inputObj = {};
  1117. fileArray= [];
  1118. inputObj.inputId = $(this).attr('recordTrem-id');
  1119. var fileList = $(this).find('.file-item');
  1120. fileList.each(function () {
  1121. fileArray.push($(this).attr('file-Url')+"-"+$(this).attr('file-Name'));
  1122. });
  1123. inputObj.inputValue = fileArray.join(',');
  1124. inutItme.push(inputObj);
  1125. });
  1126. // 状态项
  1127. // 状态
  1128. var moreStatusA = $('.moreStatusA'),statusA = [],statusObj = {statusId:"",statusValue:''};
  1129. moreStatusA.each(function () {
  1130. statusObj = {};
  1131. statusObj.statusId = $(this).attr('statusId');
  1132. statusObj.statusValue = $(this).attr('data-values');
  1133. statusA.push(statusObj);
  1134. });
  1135. var filterl= inutItme.filter(function (item) {
  1136. if (item.inputValue != undefined){
  1137. return item.inputValue !=""
  1138. }
  1139. });
  1140. var param= {
  1141. checkItems: checkItemArray,
  1142. createBy: userId,
  1143. createName: userName,
  1144. inputs:filterl,
  1145. pageId:pageId,
  1146. pageRecordParentId:pageRecordParentId,
  1147. recordParentId:recordParentId,
  1148. status:statusA.length !=0? statusA : [],
  1149. statusContent:$('.statusContent').val(),
  1150. templateId:templateId,
  1151. templateName:templateName,
  1152. departmentId:departmentId,
  1153. spName:spName,
  1154. lng:lon,
  1155. lat:lat
  1156. }
  1157. console.log(JSON.stringify(param));
  1158. $.ajax({
  1159. url: UrlRouter.addRecordInstance,
  1160. type: 'post',
  1161. contentType:'application/json;charset=UTF-8',
  1162. dataType: 'json',
  1163. data: JSON.stringify(param),
  1164. success: function (ret) {
  1165. if(ret.code === '200') {
  1166. $('.submit-btn').attr('disabled','disabled')
  1167. api.hideProgress()
  1168. $event.openTabLayout('recodeDetails'+Math.random(),'recodeDetails','记录详情',{recordParentId:ret.data});
  1169. }else if (ret.code == 422) {
  1170. api.hideProgress()
  1171. api.alert({
  1172. title: '提示',
  1173. msg: '请填写记录项',
  1174. });
  1175. }
  1176. },
  1177. error:function (err) {
  1178. api.hideProgress()
  1179. api.toast({
  1180. msg: err,
  1181. duration: 3000,
  1182. location: 'top'
  1183. });
  1184. }
  1185. })
  1186. }else {
  1187. api.toast({
  1188. msg: '请填写带*号的内容!',
  1189. duration: 3000,
  1190. location: 'top'
  1191. });
  1192. }
  1193. }
  1194. // 定位初始化
  1195. var spName = '',lon='',lat='';
  1196. function getLonLat(flag) {
  1197. if (flag) {
  1198. api.showProgress({
  1199. title: '提示',
  1200. text: '定位中...',
  1201. });
  1202. }
  1203. var aMap = api.require('aMap');
  1204. aMap.getLocation(function(ret, err) {
  1205. if (ret.status) {
  1206. api.hideProgress();
  1207. lon= ret.lon; lat=ret.lat;
  1208. aMap.getNameFromCoords({
  1209. lon: ret.lon,
  1210. lat: ret.lat
  1211. }, function(ret, err) {
  1212. if (ret.status) {
  1213. spName = ret.address
  1214. $apis.html(position_warp, '#mapTemplate',ret);
  1215. } else {
  1216. api.toast({
  1217. msg: '请打开手机定位',
  1218. duration: 2000,
  1219. location: 'top'
  1220. });
  1221. }
  1222. });
  1223. } else {
  1224. api.hideProgress();
  1225. api.toast({
  1226. msg: '定位失败请重新定位',
  1227. duration: 2000,
  1228. location: 'top'
  1229. });
  1230. }
  1231. });
  1232. return '';
  1233. }
  1234. // textarea根据文字多少自适应高度
  1235. function Oninput(that) {
  1236. $(that).height(that.scrollHeight);
  1237. }
  1238. </script>