addRecode.html 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202
  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. </style>
  257. </head>
  258. <body>
  259. <div id="position_warp"></div>
  260. <div class="recode-warp" id="recode_warp"></div>
  261. </body>
  262. </html>
  263. <script type="text/template" id="recodeTemplate">
  264. <!-- 是否开启定位 -->
  265. {{?it.position == true}}
  266. {{=getLonLat(false)}}
  267. {{?}}
  268. <!-- 状态-->
  269. {{?it.recordStatusList != "" && it.recordStatusList != null}}
  270. {{ for(var i= 0;i<it.recordStatusList.length;i++) { }}
  271. <div class="modula state">
  272. <label class="title isOptionals" isOptional="true">
  273. <span>*</span>
  274. {{=it.recordStatusList[i].statusContent}}:
  275. </label>
  276. <div class="text-input input-recode">
  277. <input type="text" placeholder="请选择{{=it.recordStatusList[i].statusContent}}" statusId="{{=it.recordStatusList[i].statusId}}" class="isOptional input moreStatusA" id="moreStatus{{=it.recordStatusList[i].id}}" readonly>
  278. <i class="ico"></i>
  279. </div>
  280. </div>
  281. {{?it.recordStatusList[i].choseType === 'checkbox'}}
  282. {{=statusCheckbox('moreStatus'+it.recordStatusList[i].id,it.recordStatusList[i].statusItemList,it.recordStatusList[i].statusContent)}}
  283. {{??}}
  284. {{=statusRadio('moreStatus'+it.recordStatusList[i].id,it.recordStatusList[i].statusItemList,it.recordStatusList[i].statusContent)}}
  285. {{?}}
  286. {{ } }}
  287. {{??it.statusName !=""}}
  288. <div class="modula state">
  289. <label class="title isOptionals" isOptional="true">
  290. <span>*</span>
  291. {{=it.statusName}}:
  292. </label>
  293. <div class="text-input input-recode">
  294. <input type="text" placeholder="请输入{{=it.statusName}}" class="isOptional input statusContent">
  295. </div>
  296. </div>
  297. {{?}}
  298. <!-- 记录项 -->
  299. {{ for(var key in it.inputList) { }}
  300. <div class="col">
  301. <label style="display:{{=key==""?'none':'block'}}">{{=key}}</label>
  302. <div class="content" style="padding-top:15px;">
  303. {{ for(var i=0;i<it.inputList[key].length;i++) { }}
  304. {{?it.inputList[key][i].inputType === 'text'}}
  305. <div class="modula text">
  306. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  307. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  308. {{=it.inputList[key][i].inputName}}:
  309. </label>
  310. <div class="text-input input-recode">
  311. <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>
  312. </div>
  313. </div>
  314. {{??it.inputList[key][i].inputType === 'date_auto'}}
  315. <div class="modula text">
  316. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  317. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  318. {{=it.inputList[key][i].inputName}}:
  319. </label>
  320. <div class="text-input input-recode">
  321. <input type="text" readonly value="{{=getYearMonthDate()}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  322. </div>
  323. </div>
  324. {{??it.inputList[key][i].inputType === 'dateTime_auto'}}
  325. <div class="modula text">
  326. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  327. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  328. {{=it.inputList[key][i].inputName}}:
  329. </label>
  330. <div class="text-input input-recode">
  331. <input type="text" readonly value="{{=getYearMonthDateTime()}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  332. </div>
  333. </div>
  334. {{??it.inputList[key][i].inputType === 'text_phone'}}
  335. <div class="modula text">
  336. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  337. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  338. {{=it.inputList[key][i].inputName}}:
  339. </label>
  340. <div class="text-input input-recode">
  341. <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}}">
  342. </div>
  343. </div>
  344. {{??it.inputList[key][i].inputType === 'text_id'}}
  345. <div class="modula text">
  346. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  347. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  348. {{=it.inputList[key][i].inputName}}:
  349. </label>
  350. <div class="text-input input-recode">
  351. <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}}">
  352. </div>
  353. </div>
  354. {{??it.inputList[key][i].inputType === 'company_auto'}}
  355. <div class="modula text">
  356. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  357. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  358. {{=it.inputList[key][i].inputName}}:
  359. </label>
  360. <div class="text-input input-recode">
  361. <input type="text" readonly value="{{=JSON.parse($api.getStorage('data')).data.user.section}}" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  362. </div>
  363. </div>
  364. {{??it.inputList[key][i].inputType === 'dateTime'}}
  365. <div class="modula date-time">
  366. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  367. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  368. {{=it.inputList[key][i].inputName}}:
  369. </label>
  370. <div class="text-input input-recode">
  371. <input type="datetime-local" data-datetime="true" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  372. </div>
  373. </div>
  374. {{??it.inputList[key][i].inputType === 'date'}}
  375. <div class="modula date">
  376. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  377. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  378. {{=it.inputList[key][i].inputName}}:
  379. </label>
  380. <div class="text-input input-recode">
  381. <input type="date" class="isOptional input recordTrems" recordTrem-id="{{=it.inputList[key][i].id}}">
  382. </div>
  383. </div>
  384. {{??it.inputList[key][i].inputType === 'file'}}
  385. <div class="modula file-warp">
  386. <label class="title" isOptional="{{=it.inputList[key][i].isOptional}}">
  387. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  388. {{=it.inputList[key][i].inputName}}:
  389. </label>
  390. <div class="text-input input-recode file-items fileList_warp" recordTrem-id="{{=it.inputList[key][i].id}}">
  391. <div class="upload file-width" onclick="browseFile(this,'file')">
  392. <img src="../../image/upload.png" alt="">
  393. </div>
  394. </div>
  395. </div>
  396. {{??it.inputList[key][i].inputType === 'mp3'}}
  397. <div class="modula audio-warp">
  398. <h4 class="title" isOptional="{{=it.inputList[key][i].isOptional}}">
  399. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  400. {{=it.inputList[key][i].inputName}}:
  401. </h4>
  402. <div class="text-input input-recode mp3_wrap" recordTrem-id="{{=it.inputList[key][i].id}}">
  403. <div class="upload-audio">
  404. <span class="upload-btn" onclick="browseFile(this,'mp3')"></span>
  405. <button type="button" class="del-btn hide" onclick="delAudio(this)">删除</button>
  406. </div>
  407. <div class="audio-content">
  408. </div>
  409. </div>
  410. </div>
  411. {{??it.inputList[key][i].inputType === 'number'}}
  412. <div class="modula number">
  413. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  414. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  415. {{=it.inputList[key][i].inputName}}:
  416. </label>
  417. <div class="text-input input-recode">
  418. <input type="number" placeholder="请输入{{=it.inputList[key][i].inputName}}" recordTrem-id="{{=it.inputList[key][i].id}}" class="isOptional input recordTrems">
  419. </div>
  420. </div>
  421. {{??it.inputList[key][i].inputType === 'photo'}}
  422. <div class="modula img-warp">
  423. <label class="title" isOptional="{{=it.inputList[key][i].isOptional}}">
  424. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  425. {{=it.inputList[key][i].inputName}}:
  426. </label>
  427. <div class="text-input input-recode file-items img-items photoFile" isOptional="{{=it.inputList[key][i].isOptional}}" recordTrem-id="{{=it.inputList[key][i].id}}">
  428. <div class="upload file-width" onclick="uploadImg('{{=it.inputList[key][i].businessType}}',this)">
  429. <img src="../../image/upload.png" alt="">
  430. </div>
  431. </div>
  432. </div>
  433. {{??it.inputList[key][i].inputType === 'radio'}}
  434. <div class="modula radio">
  435. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  436. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  437. {{=it.inputList[key][i].inputName}}:
  438. </label>
  439. <div class="text-input input-recode">
  440. <input type="text" placeholder="请选择" class="isOptional input changeInput" recordTrem-id="{{=it.inputList[key][i].id}}" id="radio{{=i}}" readonly>
  441. <i class="ico"></i>
  442. </div>
  443. </div>
  444. {{=radioRecord('radio'+i,it.inputList[key][i].inputItemList)}}
  445. {{??it.inputList[key][i].inputType === 'video'}}
  446. <div class="modula vedio-warp">
  447. <h4 class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  448. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  449. {{=it.inputList[key][i].inputName}}:
  450. </h4>
  451. <div class="text-input input-recode mp4_wrap" recordTrem-id="{{=it.inputList[key][i].id}}">
  452. <div class="upload-audio">
  453. <span class="upload-btn1" onclick="browseFile(this,'mp4')"></span>
  454. <button type="button" class="del-btn hide" onclick="delVedio(this)">删除</button>
  455. </div>
  456. <div class="audio-content">
  457. </div>
  458. </div>
  459. </div>
  460. {{??it.inputList[key][i].inputType === 'checkbox'}}
  461. <div class="modula checkbox">
  462. <label class="title isOptionals" isOptional="{{=it.inputList[key][i].isOptional}}">
  463. <span style="display:{{=it.inputList[key][i].isOptional== true?'inline-block':'none'}}">*</span>
  464. {{=it.inputList[key][i].inputName}}:
  465. </label>
  466. <div class="text-input input-recode">
  467. <input type="text" placeholder="请选择" class="isOptional input changeInput" recordTrem-id="{{=it.inputList[key][i].id}}" id="checkbox{{=i}}" readonly>
  468. <i class="ico"></i>
  469. </div>
  470. </div>
  471. {{=checkboxRecord('checkbox'+i,it.inputList[key][i].inputItemList)}}
  472. {{?}}
  473. {{ } }}
  474. </div>
  475. </div>
  476. {{ } }}
  477. <!-- 检查项 -->
  478. {{?it.checkItemList != ""}}
  479. {{ for(var i= 0;i<it.checkItemList.length;i++) { }}
  480. <div class="modula checkbox-term">
  481. <label class="title" style="margin-bottom: 0">
  482. {{=it.checkItemList[i].group.groupName}}:
  483. </label>
  484. <div class="radio-wrap">
  485. {{?it.checkItemList[i].group.checkType == 'radio'}}
  486. {{ for(var t=0;t<it.checkItemList[i].checkItemList.length;t++) { }}
  487. <label>
  488. <input class="aui-radio checked" type="radio" value="{{=it.checkItemList[i].checkItemList[t].id}}" name="{{=it.checkItemList[i].group.groupName}}">
  489. {{=it.checkItemList[i].checkItemList[t].itemValue}}
  490. </label>
  491. {{ } }}
  492. {{??}}
  493. {{ for(var t=0;t<it.checkItemList[i].checkItemList.length;t++) { }}
  494. <label>
  495. <input class="aui-checkbox checked" type="checkbox" value="{{=it.checkItemList[i].checkItemList[t].id}}" name="{{=it.checkItemList[i].group.groupName}}">
  496. {{=it.checkItemList[i].checkItemList[t].itemValue}}
  497. </label>
  498. {{ } }}
  499. {{?}}
  500. </div>
  501. </div>
  502. {{ } }}
  503. {{?}}
  504. <button type="button" name="button" class="submit-btn" onclick="submitRecode()">提交记录</button>
  505. </script>
  506. <script type="text/template" id="mapTemplate">
  507. <div class="position flex-space">
  508. <div class="map-name flex-start">
  509. <i class="ico-map"></i>
  510. <div class="names">
  511. <p class="map1">{{=it.address}}</p>
  512. </div>
  513. </div>
  514. <p class="again" onclick="getLonLat(true)">重新定位</p>
  515. </div>
  516. </script>
  517. <script type="text/javascript" src="../../script/api.js"></script>
  518. <script type="text/javascript" src="../../script/doT.min.js"></script>
  519. <script type="text/javascript" src="../../script/zepto.js"></script>
  520. <script type="text/javascript" src="../../script/select.js"></script>
  521. <script src="../../script/config.js" charset="utf-8"></script>
  522. <script type="text/javascript">
  523. var imgarr = [], UIAlbumBrowser= "";
  524. var pageId="", pageRecordParentId= "", recordParentId= "",
  525. templateId="", templateName="",departmentId="",userId= "",userName= "";
  526. var i = 0;
  527. apiready = function () {
  528. UIAlbumBrowser = api.require('UIAlbumBrowser');
  529. pageId = api.pageParam.pageId
  530. departmentId = api.pageParam.organizationIds
  531. userId= api.pageParam.createBy
  532. userName= api.pageParam.createName
  533. recordParentId= api.pageParam.recordTrueID
  534. recodeContent(api.pageParam.pageId, api.pageParam.pageRecordId)
  535. }
  536. // 记录模版内容
  537. function recodeContent(id,recodeId) {
  538. var param={
  539. pageId:id,
  540. pageRecordId:recodeId,
  541. recordParentId:recordParentId,
  542. }
  543. $http.requestShowProgress(UrlRouter.getInspection,'get',param)
  544. .then(ret=>{
  545. if (ret.code === '200') {
  546. pageRecordParentId = ret.data.parentId;
  547. templateId = ret.data.recordTemplate.id
  548. templateName = ret.data.recordTemplate.templateName
  549. $apis.html(recode_warp, '#recodeTemplate',ret.data.recordTemplate);
  550. }
  551. }).catch(err=>{})
  552. }
  553. // 录音
  554. // 删除录音
  555. function delAudio(that) {
  556. $(that).hide();
  557. $(that).parent().find('.upload-btn').show();
  558. $(that).parent().parent().find('audio').remove();
  559. }
  560. // 视频
  561. // 删除视频
  562. function delVedio(that) {
  563. $(that).hide();
  564. $(that).parent().find('.upload-btn1').show();
  565. $(that).parent().parent().find('video').remove();
  566. }
  567. // 状态
  568. function checkbox(el,list,titles) {
  569. var itmes = {title:'',value:''},itmesArray = [];
  570. for (var j= 0;j<list.length;j++) {
  571. itmes = {};
  572. itmes.title = list[j].statusContent;
  573. itmes.value = list[j].id;
  574. itmesArray.push(itmes)
  575. }
  576. setTimeout(function () {
  577. $('#'+el).select({
  578. title: titles,
  579. multi: true,
  580. items: itmesArray
  581. });
  582. },1000)
  583. return ''
  584. }
  585. // 记录项多选-单选
  586. function checkboxRecord(el,list) {
  587. var itmes = {title:'',value:''},itmesArray = [],idArray=[],titleArray=[];
  588. for (var j= 0;j<list.length;j++) {
  589. itmes = {};
  590. if (list[j].isDefault === true) {
  591. titleArray.push(list[j].itemValue)
  592. idArray.push(list[j].id)
  593. }
  594. itmes.title = list[j].itemValue;
  595. itmes.value = list[j].id;
  596. itmesArray.push(itmes)
  597. }
  598. setTimeout(function () {
  599. $("#"+el).select({
  600. multi: true,
  601. items: itmesArray
  602. });
  603. $("#"+el).attr("data-values",idArray.join(','))
  604. $("#"+el).attr("value",titleArray.join(','))
  605. },1000)
  606. return ''
  607. }
  608. function radioRecord(el,list) {
  609. var itmes = {title:'',value:''},itmesArray = [],idArray=[],titleArray=[];
  610. for (var j= 0;j<list.length;j++) {
  611. itmes = {};
  612. if (list[j].isDefault === true) {
  613. titleArray.push(list[j].itemValue)
  614. idArray.push(list[j].id)
  615. }
  616. itmes.title = list[j].itemValue;
  617. itmes.value = list[j].id;
  618. itmesArray.push(itmes)
  619. }
  620. setTimeout(function () {
  621. $("#"+el).select({
  622. multi: false,
  623. items: itmesArray
  624. });
  625. $("#"+el).attr("data-values",idArray.join(','))
  626. $("#"+el).attr("value",titleArray.join(','))
  627. },1000)
  628. return ''
  629. }
  630. //状态
  631. // 多选
  632. function statusCheckbox(el,list,titles) {
  633. var itmes = {title:'',value:''},itmesArray = [];
  634. for (var j= 0;j<list.length;j++) {
  635. itmes = {};
  636. itmes.title = list[j].statusContent;
  637. itmes.value = list[j].id;
  638. itmesArray.push(itmes)
  639. }
  640. setTimeout(function () {
  641. $("#"+el).select({
  642. title: titles,
  643. multi: true,
  644. items: itmesArray
  645. });
  646. },1000)
  647. return ''
  648. }
  649. // 单选
  650. function statusRadio(el,list,titles) {
  651. var itmes = {title:'',value:''},itmesArray = [];
  652. for (var j= 0;j<list.length;j++) {
  653. itmes = {};
  654. itmes.title = list[j].statusContent;
  655. itmes.value = list[j].id;
  656. itmesArray.push(itmes)
  657. }
  658. setTimeout(function () {
  659. $("#"+el).select({
  660. title: titles,
  661. multi: false,
  662. items: itmesArray
  663. });
  664. },1000)
  665. return ''
  666. }
  667. // 上传图片
  668. function uploadImg(type,that) {
  669. if (type == 'remote') {
  670. api.getPicture({
  671. sourceType: 'camera'
  672. }, function(ret, err){
  673. if(ret && ret.data!=""){
  674. uploadHead(ret.data,that);
  675. }
  676. });
  677. }else {
  678. api.actionSheet({
  679. title: '选择',
  680. cancelTitle: '取消',
  681. buttons: ['相机','相册']
  682. }, function(ret, err) {
  683. if (ret.buttonIndex !=3) {
  684. var type = 'camera';
  685. if(ret.buttonIndex == 1){
  686. type = 'camera';
  687. api.getPicture({
  688. sourceType: type
  689. }, function(ret, err){
  690. if(ret && ret.data!=""){
  691. uploadHead(ret.data,that);
  692. }
  693. });
  694. }else {
  695. type = 'album';
  696. // 支持多图片上传,UIAlbumBrowser模块获取图片路径
  697. changeImageUrl(that)
  698. }
  699. }
  700. });
  701. }
  702. }
  703. // upload img
  704. function uploadHead(imgUrl,that){
  705. $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:imgUrl})
  706. .then(ret=>{
  707. if(ret.code === '200'){
  708. var html = `<div class="img-item file-width" img-Url="${ret.data.fullURL}">
  709. <img src="${ret.data.fullURL}" alt="">
  710. </div>`;
  711. $api.append(that.parentNode,html);
  712. api.toast({
  713. msg: '上传成功',
  714. duration: 2000,
  715. location: 'top'
  716. });
  717. }else {
  718. api.toast({
  719. msg: '上传失败',
  720. duration: 2000,
  721. location: 'top'
  722. });
  723. }
  724. })
  725. .catch(err=>{
  726. api.toast({
  727. msg: '网络错误',
  728. duration: 2000,
  729. location: 'top'
  730. });
  731. })
  732. }
  733. // 获取相册图片路径
  734. function changeImageUrl(el) {
  735. UIAlbumBrowser.imagePicker({
  736. max: 9,
  737. styles: {
  738. bg: '#000000',
  739. //cameraImg: 'widget://res/cameraImg.png',
  740. mark: {
  741. position: 'top_right',
  742. size: 20
  743. },
  744. nav: {
  745. bg: '#000000',
  746. cancelColor: '#fff',
  747. cancelSize: 16,
  748. nextStepColor: '#7fff00',
  749. nextStepSize: 16
  750. },
  751. thumbnail: {
  752. w: 100,
  753. h: 100
  754. }
  755. },
  756. animation: true,
  757. }, function(ret) {
  758. if (ret.eventType == 'nextStep') {
  759. UIAlbumBrowser.closePicker();
  760. if (ret.list && ret.list.length > 0) {
  761. imgarr = ret.list;
  762. // 转换缩略图路径 ios
  763. UIAlbumBrowser_transPath(el);
  764. }
  765. }
  766. if (ret.originalPath && ret.originalPath.length > 0) {
  767. uploadHead(ret.originalPath,el)
  768. }
  769. });
  770. }
  771. // 转换缩略图路径 ios
  772. function UIAlbumBrowser_transPath(el) {
  773. UIAlbumBrowser.transPath({
  774. path: imgarr[i].path
  775. }, function(ret, err) {
  776. if (ret) {
  777. i++;
  778. if (i < imgarr.length) {
  779. UIAlbumBrowser_transPath(el);
  780. } else {
  781. i = 0;
  782. }
  783. uploadHead(ret.path,el)
  784. }
  785. });
  786. }
  787. // 上传文件
  788. // 浏览手机文件夹,获取文件路径
  789. function browseFile(el,type) {
  790. var fileBrowser = api.require('fileBrowser');
  791. fileBrowser.open(function(ret) {
  792. if (ret) {
  793. var type = ret.name.substring(ret.name.lastIndexOf('.'))
  794. if (
  795. type === '.xls' ||
  796. type === '.ppt' ||
  797. type === '.pptx' ||
  798. type === '.xlsx' ||
  799. type === '.doc' ||
  800. type === '.docx' ||
  801. type === '.zip' ||
  802. type === '.rar' ||
  803. type === '.pdf'
  804. ) {
  805. setTimeout(function () {
  806. uploadFile(el,ret.url)
  807. },500)
  808. }else if (type === '.mp3') {
  809. setTimeout(function () {
  810. uploadAudio(el,ret.url)
  811. },500)
  812. }else if(type === '.mp4'){
  813. setTimeout(function () {
  814. uploadVedio(el,ret.url)
  815. },500)
  816. }else {
  817. alert('选择文件格式不正确');
  818. }
  819. }
  820. });
  821. fileBrowser.skin({
  822. skin:1
  823. });
  824. }
  825. // 上传文件
  826. function uploadFile(el,fileUrl) {
  827. $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:fileUrl})
  828. .then(ret=>{
  829. if(ret.code === '200'){
  830. api.toast({
  831. msg: '上传成功',
  832. duration: 2000,
  833. location: 'top'
  834. });
  835. var fileType = ret.data.fileName.substr(ret.data.fileName.length-3,3);
  836. if (
  837. fileType == 'ppt' ||
  838. fileType == 'ptx' ||
  839. fileType == 'lsx' ||
  840. fileType == 'xls' ||
  841. fileType == 'doc' ||
  842. fileType == 'ocx' ||
  843. fileType == 'zip' ||
  844. fileType == 'rar' ||
  845. fileType == 'pdf'
  846. ){
  847. var html = `<div class="file-item file-width" file-Url="${ret.data.fullURL}" file-Name="${ret.data.fileName}">
  848. <img src="../../icon/${ret.data.fullURL.substr(ret.data.fullURL.length-3,3)}.png"/>
  849. <p>${ret.data.fileName}</p>
  850. </div>`;
  851. $api.append(el.parentNode,html);
  852. }else {
  853. api.toast({
  854. msg: '文件格式不对',
  855. duration: 2000,
  856. location: 'top'
  857. });
  858. }
  859. }else {
  860. api.toast({
  861. msg: '上传失败',
  862. duration: 2000,
  863. location: 'top'
  864. });
  865. }
  866. })
  867. .catch(err=>{
  868. api.toast({
  869. msg: '网络错误',
  870. duration: 2000,
  871. location: 'top'
  872. });
  873. })
  874. }
  875. // 上传音频
  876. function uploadAudio(el,fileUrl) {
  877. $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:fileUrl})
  878. .then(ret=>{
  879. if(ret.code === '200'){
  880. api.toast({
  881. msg: '上传成功',
  882. duration: 2000,
  883. location: 'top'
  884. });
  885. var fileType = ret.data.fileExt;
  886. if (
  887. fileType == 'm4a' ||
  888. fileType == 'mp3' ||
  889. fileType == 'amr' ||
  890. fileType == 'AMR' ||
  891. fileType == 'WAV' ||
  892. fileType == 'wav' ||
  893. fileType == 'AWB' ||
  894. fileType == 'awb'
  895. ){
  896. $(el).hide();
  897. $(el).parent().find('.del-btn').show();
  898. var html = `<audio src="${ret.data.fullURL}" controls></audio>`;
  899. $(el).parent().parent().find('.audio-content').html(html)
  900. }else {
  901. api.toast({
  902. msg: '音频格式不对',
  903. duration: 2000,
  904. location: 'top'
  905. });
  906. }
  907. }else {
  908. api.toast({
  909. msg: '上传失败',
  910. duration: 2000,
  911. location: 'top'
  912. });
  913. }
  914. })
  915. .catch(err=>{
  916. api.toast({
  917. msg: '网络错误',
  918. duration: 2000,
  919. location: 'top'
  920. });
  921. })
  922. }
  923. // 上传视频
  924. function uploadVedio(el,fileUrl) {
  925. $http.fileUploadRequest(UrlRouter.uploadFile,'post',{file:fileUrl})
  926. .then(ret=>{
  927. if(ret.code === '200'){
  928. api.toast({
  929. msg: '上传成功',
  930. duration: 2000,
  931. location: 'top'
  932. });
  933. var fileType = ret.data.fileExt;
  934. if (
  935. fileType == 'mp4' ||
  936. fileType == 'avi' ||
  937. fileType == 'wmv' ||
  938. fileType == '3gp' ||
  939. fileType == 'mkv' ||
  940. fileType == 'flv' ||
  941. fileType == 'rmvb'
  942. ){
  943. $(el).hide();
  944. $(el).parent().find('.del-btn').show();
  945. var html = `<video controls="controls" style="width: 100%;height: 200px;">
  946. <source src="${ret.data.fullURL}">
  947. 当前不支持播放该视频
  948. </video>`;
  949. $(el).parent().parent().find('.audio-content').html(html)
  950. }else {
  951. api.toast({
  952. msg: '视频格式不对',
  953. duration: 2000,
  954. location: 'top'
  955. });
  956. }
  957. }else {
  958. api.toast({
  959. msg: '上传失败',
  960. duration: 2000,
  961. location: 'top'
  962. });
  963. }
  964. })
  965. .catch(err=>{
  966. api.toast({
  967. msg: '网络错误',
  968. duration: 2000,
  969. location: 'top'
  970. });
  971. })
  972. }
  973. //提交
  974. function mvalidate() {
  975. var isOptionals = $('.isOptionals')
  976. var opnum=0,eachnum=0;
  977. isOptionals.each(function (index) {
  978. if ($(this).attr('isOptional') == 'true'){
  979. ++opnum;
  980. }
  981. if ($(this).attr('isOptional') == 'true' && $(this).parent().find('.isOptional').val() !== "") {
  982. ++eachnum
  983. }
  984. })
  985. if (opnum == eachnum) {
  986. return true;
  987. }else {
  988. return false;
  989. }
  990. }
  991. function submitRecode() {
  992. if (mvalidate()) {
  993. var inutItme =[],recordTrems = $('.recordTrems'),inputObj = {inputId:'',inputValue:''},changeInput = $('.changeInput');
  994. //6.图片
  995. var photoFile = $('.photoFile'),photoArray = [];
  996. var isOptional = true
  997. photoFile.each(function () {
  998. inputObj = {};
  999. photoArray =[];
  1000. inputObj.inputId = $(this).attr('recordTrem-id');
  1001. var photoList = $(this).find('.img-item');
  1002. photoList.each(function () {
  1003. photoArray.push($(this).attr('img-Url'));
  1004. });
  1005. inputObj.inputValue = photoArray.join(',');
  1006. if ($(this).attr('isOptional') === "true" && inputObj.inputValue =="") {
  1007. isOptional = false
  1008. }
  1009. inutItme.push(inputObj);
  1010. });
  1011. if (isOptional === false) {
  1012. return api.toast({
  1013. msg: '请上传带*号的图片',
  1014. duration: 2000,
  1015. location: 'bottom'
  1016. });
  1017. }
  1018. api.showProgress({
  1019. title: '',
  1020. text: '提交中...',
  1021. modal: true
  1022. });
  1023. // 检查项
  1024. var inspectTremA = $('.checked'),checkItemArray = [];
  1025. var obj = {checkItemId:'',instanceValue:''}
  1026. for (var i = 0; i < inspectTremA.length; i++) {
  1027. obj = {}
  1028. if (inspectTremA[i].checked) {
  1029. obj.checkItemId = inspectTremA[i].value
  1030. obj.instanceValue = true;
  1031. checkItemArray.push(obj)
  1032. }
  1033. }
  1034. // 记录项
  1035. //// 1.文本, 时间,日期,数字
  1036. recordTrems.each(function () {
  1037. inputObj = {};
  1038. var inputValue = $(this).val(),
  1039. inputId = $(this).attr('recordTrem-id'),
  1040. datetime = $(this).attr('data-datetime');;
  1041. if (datetime) {
  1042. inputObj.inputId = inputId;
  1043. inputObj.inputValue = inputValue.replace("T"," ");
  1044. }else {
  1045. inputObj.inputId = inputId;
  1046. inputObj.inputValue = inputValue;
  1047. }
  1048. inutItme.push(inputObj);
  1049. });
  1050. //2.多选,单选
  1051. changeInput.each(function () {
  1052. inputObj = {};
  1053. inputObj.inputId = $(this).attr('recordTrem-id');
  1054. inputObj.inputValue = $(this).attr('data-values');
  1055. inutItme.push(inputObj);
  1056. });
  1057. //3.录音
  1058. var mp3_wrap = $('.mp3_wrap');
  1059. mp3_wrap.each(function () {
  1060. inputObj = {};
  1061. inputObj.inputId = $(this).attr('recordTrem-id');
  1062. inputObj.inputValue = $(this).find('audio').attr('src');
  1063. inutItme.push(inputObj);
  1064. });
  1065. //4.视频
  1066. var mp4_wrap = $('.mp4_wrap');
  1067. mp4_wrap.each(function () {
  1068. inputObj = {};
  1069. inputObj.inputId = $(this).attr('recordTrem-id');
  1070. inputObj.inputValue = $(this).find('video>source').attr('src');
  1071. inutItme.push(inputObj);
  1072. });
  1073. //5.文件
  1074. var fileList_warp = $('.fileList_warp'),fileArray = [],fileName = [],num = 0;
  1075. fileList_warp.each(function (index) {
  1076. inputObj = {};
  1077. fileArray= [];
  1078. inputObj.inputId = $(this).attr('recordTrem-id');
  1079. var fileList = $(this).find('.file-item');
  1080. fileList.each(function () {
  1081. fileArray.push($(this).attr('file-Url')+"-"+$(this).attr('file-Name'));
  1082. });
  1083. inputObj.inputValue = fileArray.join(',');
  1084. inutItme.push(inputObj);
  1085. });
  1086. // 状态项
  1087. // 状态
  1088. var moreStatusA = $('.moreStatusA'),statusA = [],statusObj = {statusId:"",statusValue:''};
  1089. moreStatusA.each(function () {
  1090. statusObj = {};
  1091. statusObj.statusId = $(this).attr('statusId');
  1092. statusObj.statusValue = $(this).attr('data-values');
  1093. statusA.push(statusObj);
  1094. });
  1095. var filterl= inutItme.filter(function (item) {
  1096. if (item.inputValue != undefined){
  1097. return item.inputValue !=""
  1098. }
  1099. });
  1100. var param= {
  1101. checkItems: checkItemArray,
  1102. createBy: userId,
  1103. createName: userName,
  1104. inputs:filterl,
  1105. pageId:pageId,
  1106. pageRecordParentId:pageRecordParentId,
  1107. recordParentId:recordParentId,
  1108. status:statusA.length !=0? statusA : [],
  1109. statusContent:$('.statusContent').val(),
  1110. templateId:templateId,
  1111. templateName:templateName,
  1112. departmentId:departmentId,
  1113. spName:spName,
  1114. lng:lon,
  1115. lat:lat
  1116. }
  1117. $.ajax({
  1118. url: UrlRouter.addRecordInstance,
  1119. type: 'post',
  1120. contentType:'application/json;charset=UTF-8',
  1121. dataType: 'json',
  1122. data: JSON.stringify(param),
  1123. success: function (ret) {
  1124. if(ret.code === '200') {
  1125. $('.submit-btn').attr('disabled','disabled')
  1126. api.hideProgress()
  1127. $event.openTabLayout('recodeDetails'+Math.random(),'recodeDetails','记录详情',{recordParentId:ret.data});
  1128. }else if (ret.code == 422) {
  1129. api.hideProgress()
  1130. api.alert({
  1131. title: '提示',
  1132. msg: '请填写记录项',
  1133. });
  1134. }
  1135. },
  1136. error:function (err) {
  1137. api.hideProgress()
  1138. api.toast({
  1139. msg: err,
  1140. duration: 3000,
  1141. location: 'top'
  1142. });
  1143. }
  1144. })
  1145. }else {
  1146. api.toast({
  1147. msg: '请填写带*号的内容!',
  1148. duration: 3000,
  1149. location: 'top'
  1150. });
  1151. }
  1152. }
  1153. // 定位初始化
  1154. var spName = '',lon='',lat='';
  1155. function getLonLat(flag) {
  1156. if (flag) {
  1157. api.showProgress({
  1158. title: '提示',
  1159. text: '定位中...',
  1160. });
  1161. }
  1162. var aMap = api.require('aMap');
  1163. aMap.getLocation(function(ret, err) {
  1164. if (ret.status) {
  1165. api.hideProgress();
  1166. lon= ret.lon; lat=ret.lat;
  1167. aMap.getNameFromCoords({
  1168. lon: ret.lon,
  1169. lat: ret.lat
  1170. }, function(ret, err) {
  1171. if (ret.status) {
  1172. spName = ret.address
  1173. $apis.html(position_warp, '#mapTemplate',ret);
  1174. } else {
  1175. api.toast({
  1176. msg: '请打开手机定位',
  1177. duration: 2000,
  1178. location: 'top'
  1179. });
  1180. }
  1181. });
  1182. } else {
  1183. api.hideProgress();
  1184. api.toast({
  1185. msg: '定位失败请重新定位',
  1186. duration: 2000,
  1187. location: 'top'
  1188. });
  1189. }
  1190. });
  1191. return '';
  1192. }
  1193. // textarea根据文字多少自适应高度
  1194. function Oninput(that) {
  1195. $(that).height(that.scrollHeight);
  1196. }
  1197. </script>