myWordOrderReject.html 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  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. <title></title>
  8. <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
  9. <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  10. <link rel="stylesheet" href="../../css/select.css">
  11. <style>
  12. body {
  13. background: #fff;
  14. }
  15. .api_layout {
  16. background: #009FE8;
  17. width: 100%;
  18. /*margin-top: -10px;*/
  19. }
  20. .column {
  21. margin-bottom: 10px;
  22. }
  23. .aui-row {
  24. border: 1px dashed #c8d2de;
  25. -webkit-border-radius: 5px;
  26. -moz-border-radius: 5px;
  27. border-radius: 5px;
  28. padding: 10px;
  29. }
  30. .technological-process {
  31. margin-top: 10px;
  32. }
  33. /*****/
  34. /*审批进度条*/
  35. .layui-timeline {
  36. padding-left: 5px;
  37. }
  38. .layui-timeline-item {
  39. position: relative;
  40. padding-bottom: 20px;
  41. }
  42. .layui-timeline-item:first-child:before {
  43. display: block;
  44. }
  45. .layui-timeline-item:before {
  46. content: '';
  47. position: absolute;
  48. left: 5px;
  49. top: 0;
  50. z-index: 0;
  51. width: 1px;
  52. height: 100%;
  53. }
  54. .layui-timeline-item:before,
  55. hr {
  56. background-color: #e6e6e6;
  57. }
  58. .layui-timeline-axis {
  59. font-size: 12px;
  60. font-weight: bold;
  61. position: absolute;
  62. left: -5px;
  63. top: 0;
  64. z-index: 10;
  65. width: 20px;
  66. height: 20px;
  67. line-height: 20px;
  68. background-color: #fff;
  69. border-radius: 50%;
  70. text-align: center;
  71. cursor: pointer;
  72. }
  73. .Correct {
  74. color: #5FB878;
  75. border: 1px solid #5FB878;
  76. }
  77. .closes {
  78. color: red;
  79. border: 1px solid red;
  80. }
  81. .layui-timeline-content {
  82. padding-left: 25px;
  83. }
  84. .layui-text {
  85. line-height: 22px;
  86. font-size: 14px;
  87. color: #666;
  88. }
  89. .layui-timeline-title {
  90. position: relative;
  91. margin-bottom: 10px;
  92. display: flex;
  93. justify-content: flex-start;
  94. }
  95. .remark {
  96. padding: 2px 3px;
  97. border-radius: 2px;
  98. display: none;
  99. }
  100. /******/
  101. .aui-list-item-input label {
  102. font-size: 14px;
  103. height: 21px;
  104. display: inline-block;
  105. line-height: 22px;
  106. margin-right: 5px;
  107. }
  108. .aui-list-item-input label:last-child {
  109. margin-right: 0;
  110. }
  111. .itmes li {
  112. display: flex;
  113. justify-content: space-between;
  114. flex-wrap: nowrap;
  115. padding: 10px 0;
  116. position: relative;
  117. }
  118. .itmes li p:first-child {
  119. width: 33%;
  120. color: #2c3e50;
  121. font-size: 15px;
  122. }
  123. .itmes li p:last-child {
  124. margin-left: 2%;
  125. width: 65%;
  126. color: #3498db;
  127. }
  128. .header-img {
  129. width: 50px;
  130. height: 50px;
  131. -webkit-border-radius: 50%;
  132. -moz-border-radius: 50%;
  133. border-radius: 50%;
  134. object-fit: cover;
  135. margin-right: 10px;
  136. }
  137. .img-title {
  138. display: flex;
  139. justify-content: flex-start;
  140. flex-wrap: nowrap;
  141. }
  142. .details-message {
  143. width: 100%;
  144. background: #fff;
  145. }
  146. .details-message-child {
  147. padding: 15px;
  148. }
  149. .personalInfo {
  150. padding: 10px 0;
  151. }
  152. .personalInfo span {
  153. display: block;
  154. font-size: 14px;
  155. color: #6c6f74;
  156. }
  157. .personalInfo span:first-child {
  158. font-size: 18px;
  159. color: #002257;
  160. }
  161. .examine-success {
  162. background: #1abc9c;
  163. }
  164. .examine-red {
  165. background: #e74c3c;
  166. }
  167. .staff_name {
  168. width: 50px;
  169. height: 50px;
  170. -webkit-border-radius: 50%;
  171. -moz-border-radius: 50%;
  172. border-radius: 50%;
  173. margin-right: 10px;
  174. line-height: 50px;
  175. text-align: center;
  176. color: #fff;
  177. }
  178. .aui-col-xs-4 img {
  179. object-fit: cover;
  180. border-radius: 3px;
  181. margin: auto;
  182. }
  183. .aui-col-xs-4 span {
  184. overflow: hidden;
  185. text-overflow: ellipsis;
  186. display: -webkit-box;
  187. -webkit-line-clamp: 2;
  188. -webkit-box-orient: vertical;
  189. padding: 0 3px;
  190. height: 48px;
  191. text-align: center;
  192. margin: 5px 0;
  193. font-size: 15px;
  194. }
  195. .fileList img {
  196. width: 35px;
  197. height: 35px;
  198. }
  199. .name-column span {
  200. background: #009fe8;
  201. padding: 3px;
  202. color: #fff;
  203. border-radius: 2px;
  204. font-size: 13px;
  205. }
  206. .column-title {
  207. display: block;
  208. font-size: 15px;
  209. color: #97a3b4;
  210. /*#2c3e50*/
  211. margin-bottom: 10px;
  212. }
  213. .column-textarea {
  214. border: 1px solid rgba(200, 210, 222, 1);
  215. -webkit-border-radius: 5px;
  216. -moz-border-radius: 5px;
  217. border-radius: 5px;
  218. padding: 10px;
  219. height: 40px;
  220. }
  221. .column-textarea::placeholder {
  222. font-size: 14px;
  223. color: #333;
  224. }
  225. /*定位*/
  226. .position-photo-notes {
  227. padding: 15px;
  228. }
  229. /*position*/
  230. .flex-space {
  231. display: flex;
  232. align-items: center;
  233. white-space: nowrap;
  234. }
  235. .flex-start {
  236. display: flex;
  237. justify-content: space-between;
  238. white-space: nowrap;
  239. align-items: center;
  240. }
  241. .ico-map {
  242. width: 25px;
  243. height: 25px;
  244. background: url("../../icon/position.png") no-repeat;
  245. background-position: center;
  246. background-size: cover;
  247. }
  248. .position {
  249. padding: 4px 10px 4px 15px;
  250. border-radius: 50px;
  251. background: #F0F0F0;
  252. font-size: 14px;
  253. margin-top: 10px;
  254. }
  255. .map1 {
  256. color: #009FE8;
  257. }
  258. .again {
  259. color: #6C6F74;
  260. }
  261. .map-name {
  262. width: 99%;
  263. }
  264. .names {
  265. width: 85%;
  266. }
  267. .names .map1 {
  268. width: 100%;
  269. padding-top: 3px;
  270. white-space: pre-wrap;
  271. overflow: hidden;
  272. text-overflow: ellipsis;
  273. display: -webkit-box;
  274. -webkit-box-orient: vertical;
  275. -webkit-line-clamp: 2;
  276. }
  277. .textarea {
  278. height: 45px;
  279. line-height: 1.5;
  280. }
  281. /*图片上传*/
  282. .input-recode {
  283. border: dashed 1px rgba(200, 210, 222, 1);
  284. display: flex;
  285. flex-flow: wrap;
  286. align-items: center;
  287. line-height: 100%;
  288. }
  289. .file-width {
  290. width: 33.3333333%;
  291. box-sizing: border-box;
  292. font-size: 14px;
  293. color: #333;
  294. }
  295. .upload {
  296. padding-top: 10px;
  297. }
  298. .upload img {
  299. width: 80px;
  300. height: 80px;
  301. margin-left: 15px;
  302. }
  303. /*图片*/
  304. /*未提交定位信息的图片容器*/
  305. .img-item {
  306. text-align: center;
  307. line-height: 100%;
  308. }
  309. .img-item img {
  310. width: 80px;
  311. height: 80px;
  312. border-radius: 3px;
  313. object-fit: cover;
  314. }
  315. .img-items .upload {
  316. text-align: center;
  317. }
  318. .img-items .upload img {
  319. width: 80px;
  320. height: 80px;
  321. margin: 0;
  322. }
  323. .add-message-remark {
  324. background: #009FE8;
  325. width: 100%;
  326. position: relative;
  327. }
  328. .add-message-remark-child {
  329. background: #fff;
  330. margin: 0 15px 15px 15px;
  331. border-radius: 5px;
  332. }
  333. .add-msg-list {
  334. margin-top: 10px;
  335. }
  336. .add-msg-list div {
  337. width: 100%;
  338. height: 40px;
  339. line-height: 40px;
  340. text-align: center;
  341. border-radius: 4px;
  342. color: #fff;
  343. background: #009fe8;
  344. font-size: 14px;
  345. }
  346. .work-order-remarks {
  347. font-size: 20px;
  348. font-weight: bold;
  349. color: #009FE8;
  350. }
  351. .remarkInfo {
  352. color: #232627
  353. }
  354. .remarkInfo-message {
  355. color: #009FE8;
  356. white-space: pre-wrap;
  357. }
  358. .more-icon {
  359. width: 20px;
  360. height: 20px;
  361. background: url("../../image/more.png") no-repeat;
  362. background-position: center;
  363. background-size: cover;
  364. }
  365. .img-item-two {
  366. position: relative;
  367. display: inline-block;
  368. width: 32%;
  369. margin-left: 6px;
  370. margin-top: 6px;
  371. }
  372. .img-item-two img {
  373. z-index: 0;
  374. height: 27vw;
  375. width: 27vw;
  376. object-fit: cover;
  377. border-radius: 5px;
  378. }
  379. .notes-content {
  380. margin-top: 15px;
  381. }
  382. </style>
  383. </head>
  384. <body>
  385. <div class="api_layout" id="wordOrder_details">
  386. </div>
  387. </body>
  388. <script type="text/template" id="template">
  389. {{?api.pageParam.status == 2}}
  390. <div class="add-message-remark">
  391. <div style="height: 15px; width: 100%"></div>
  392. <div class="add-message-remark-child">
  393. <!-- 是否定位 -->
  394. {{?it.open_gps == 1 && it.open_remark == 1}} {{=getLonLat(it.open_gps)}} {{?}}
  395. <!-- 定位信息 拍照 以及备注信息 -->
  396. <div class="position-photo-notes">
  397. <label class="work-order-remarks">目的地打卡</label> {{? it.open_gps == 1 && it.open_remark == 1}}
  398. <div class="position-content" id="position_warp"></div>
  399. {{?}} {{? it.open_gps == 1 && it.open_remark == 2}}
  400. <div class="position flex-space" onclick="openMaps('{{=it.longitude}}','{{=it.latitude}}')">
  401. <div class="map-name flex-start">
  402. <i class="ico-map"></i>
  403. <div class="names">
  404. <p class="map1">{{=it.address}}</p>
  405. </div>
  406. </div>
  407. <p class="more-icon"></p>
  408. </div>
  409. {{?}} {{? it.open_remark == 1}}
  410. <div class="notes-content">
  411. <div class="column">
  412. <label class="remarkInfo">备注信息:</label>
  413. <textarea oninput="Oninput(this)" id="remark_information" class="column-textarea font-s column-textarea1" placeholder="请输入备注信息"></textarea>
  414. </div>
  415. </div>
  416. {{?}} {{? it.open_remark == 2 && JSON.parse(it.remark_info).remarkInfo != ''}}
  417. <div class="notes-content">
  418. <div class="column">
  419. <label class="remarkInfo">备注信息:</label>
  420. <div class="remarkInfo-message">
  421. {{=JSON.parse(it.remark_info).remarkInfo}}
  422. </div>
  423. </div>
  424. </div>
  425. {{?}} {{? it.open_remark == 1}}
  426. <div class="modula img-warp">
  427. <label class="remarkInfo">现场照片:</label>
  428. <div class="text-input input-recode file-items-add img-items photoFile">
  429. <div class="upload file-width" onclick="uploadImg('remote',this)">
  430. <!-- 'remote',this -->
  431. <img src="../../image/upload.png" alt="">
  432. </div>
  433. </div>
  434. </div>
  435. {{?}} {{? it.open_remark == 2 && JSON.parse(it.remark_info).imageList.length > 0}}
  436. <div class="modula img-warp">
  437. <label class="remarkInfo">现场照片:</label>
  438. <div class="text-input input-recode file-items-add img-items photoFile">
  439. {{ for (var i = 0; i
  440. < JSON.parse(it.remark_info).imageList.length; i++) { }} <div class="img-dv img-item-two" onclick="browseImgTwo('{{=i}}','{{=JSON.parse(it.remark_info).imageList.toString()}}')">
  441. <a href="javascript:;">
  442. <img src="{{=JSON.parse(it.remark_info).imageList[i]}}">
  443. </a>
  444. </div>
  445. {{ } }}
  446. </div>
  447. </div>
  448. {{?}} {{? it.open_remark == 1}}
  449. <div class="add-msg-list">
  450. <div onclick="addPositionNotes()">提交</div>
  451. </div>
  452. {{?}}
  453. </div>
  454. </div>
  455. </div>
  456. {{?}}
  457. <div class="details-message">
  458. <div class="details-message-child">
  459. <div class="personalInfo">
  460. <div class="img-title">
  461. {{?it.staff_avatar === null}}
  462. <p class="staff_name" style="background:#{{=Math.random().toString(16).slice(2,8)}}">{{=it.staff.substr(it.staff.length-1,1)}}</p>
  463. {{??}}
  464. <img src="{{=it.staff_avatar}}" alt="" class="header-img"> {{?}}
  465. <div>
  466. <span>{{=it.staff}}</span>
  467. <span>{{=it.section}}</span>
  468. </div>
  469. </div>
  470. </div>
  471. <ul class="itmes">
  472. <li>
  473. <p>工单编号:</p>
  474. <p>#{{=it.id}}</p>
  475. </li>
  476. <li>
  477. <p>工单分类:</p>
  478. <p>{{=it.classify}}</p>
  479. </li>
  480. <li>
  481. <p>流程名称:</p>
  482. <p>{{=it.title}}</p>
  483. </li>
  484. </ul>
  485. <ul class="itmes">
  486. {{ for (var i = 0;i
  487. <it.form.length;i++) { }} {{?it.form[i].type !='images' && it.form[i].type !='files' }} <li>
  488. <p>{{=it.form[i].label}}:</p>
  489. <p>{{=it.form[i].value}}</p>
  490. </li>
  491. {{?}} {{ } }}
  492. </ul>
  493. <div class="column-row">
  494. {{ for (var i = 0;i
  495. <it.form.length;i++) { }} {{?it.form[i].type=='images' && it.form[i].value.length> 0 }}
  496. <div class="column">
  497. <label class="column-title">{{=it.form[i].label}}:</label>
  498. <div class="aui-row aui-row-padded">
  499. {{ for (var j = 0;j
  500. <it.form[i].value.length;j++) { }} <div class="aui-col-xs-4">
  501. <img src="{{=it.form[i].value[j]}}" class="colsImg" onload="setUpHeight(this)" onclick="browseImg('{{=it.form[i].value}}','{{=j}}')" />
  502. </div>
  503. {{ } }}
  504. </div>
  505. </div>
  506. {{?? it.form[i].type == 'files' && it.form[i].value.length > 0 }}
  507. <div class="column">
  508. <label class="column-title">{{=it.form[i].label}}:</label>
  509. <div class="aui-row aui-row-padded fileList">
  510. {{ for (var j = 0;j
  511. <it.form[i].value.length;j++) { }} {{?it.form[i].value[j].path.endsWith( 'docx') || it.form[i].value[j].path.endsWith( 'doc')}} <div class="aui-col-xs-4" onclick="browseFile('{{=it.form[i].value[j].path}}')">
  512. <img src="../../icon/{{=it.form[i].value[j].path.substr(it.form[i].value[j].path.length-3,3)}}.png" />
  513. <span>{{=it.form[i].value[j].name}}</span>
  514. </div>
  515. {{??it.form[i].value[j].path.endsWith('pdf')}}
  516. <div class="aui-col-xs-4" onclick="browseFile('{{=it.form[i].value[j].path}}')">
  517. <img src="../../icon/{{=it.form[i].value[j].path.substr(it.form[i].value[j].path.length-3,3)}}.png" />
  518. <span>{{=it.form[i].value[j].name}}</span>
  519. </div>
  520. {{??it.form[i].value[j].path.endsWith('ppt') || it.form[i].value[j].path.endsWith('ptx')}}
  521. <div class="aui-col-xs-4" onclick="browseFile('{{=it.form[i].value[j].path}}')">
  522. <img src="../../icon/{{=it.form[i].value[j].path.substr(it.form[i].value[j].path.length-3,3)}}.png" />
  523. <span>{{=it.form[i].value[j].name}}</span>
  524. </div>
  525. {{??it.form[i].value[j].path.endsWith('zip') || it.form[i].value[j].path.endsWith('rar')}}
  526. <div class="aui-col-xs-4" onclick="browseFile('{{=it.form[i].value[j].path}}',true)">
  527. <img src="../../icon/{{=it.form[i].value[j].path.substr(it.form[i].value[j].path.length-3,3)}}.png" />
  528. <span>{{=it.form[i].value[j].name}}</span>
  529. </div>
  530. {{??it.form[i].value[j].path.endsWith('xlsx')}}
  531. <div class="aui-col-xs-4" onclick="browseFile('{{=it.form[i].value[j].path}}')">
  532. <img src="../../icon/{{=it.form[i].value[j].path.substr(it.form[i].value[j].path.length-3,3)}}.png" />
  533. <span>{{=it.form[i].value[j].name}}</span>
  534. </div>
  535. {{??}}
  536. <div class="aui-col-xs-4" onclick="browseFile('{{=it.form[i].value[j].path}}')">
  537. <img src="../../icon/OTHER.png" />
  538. <span>{{=it.form[i].value[j].name}}</span>
  539. </div>
  540. {{?}} {{ } }}
  541. </div>
  542. </div>
  543. {{?}} {{ } }}
  544. </div>
  545. <div class="technologicals" style="margin-top:10px">
  546. <label class="column-title">固定审批流程:</label>
  547. <div class="technological-process">
  548. {{ for(var prop in it.flows) { }}
  549. <ul class="layui-timeline">
  550. <li class="layui-timeline-item">
  551. <i class="{{=it.flows[prop].status == 2?'aui-iconfont aui-icon-correct Correct':(it.flows[prop].status == 3?'aui-iconfont aui-icon-close closes':'Correct')}} layui-timeline-axis"></i>
  552. <div class="layui-timeline-content layui-text">
  553. <div class="layui-timeline-title">
  554. <span>{{=it.flows[prop].flow_name}}:</span>
  555. <div class="name-column">
  556. {{ for (var j = 0;j
  557. <it.flows[prop].flow.length;j++) { }} <span>{{=it.flows[prop].flow[j]}}</span>
  558. {{ } }}
  559. </div>
  560. </div>
  561. <div class="layui-timeline-title remark" style="border:1px solid {{=it.flows[prop].status == 2?'#5FB878':(it.flows[prop].status == 3?'red':'')}};display:{{=it.flows[prop].remark?'inline-block':'none'}}">
  562. {{=it.flows[prop].remark}}
  563. </div>
  564. </div>
  565. </li>
  566. </ul>
  567. {{ } }}
  568. </div>
  569. </div>
  570. </div>
  571. </div>
  572. </script>
  573. <script type="text/template" id="mapTemplate">
  574. <div class="position flex-space">
  575. <div class="map-name flex-start">
  576. <i class="ico-map"></i>
  577. <div class="names">
  578. <p class="map1">{{=it.address}}</p>
  579. </div>
  580. </div>
  581. <p class="again" onclick="getLonLat(1)">重新定位</p>
  582. </div>
  583. </script>
  584. <script type="text/javascript" src="../../script/api.js"></script>
  585. <script type="text/javascript" src="../../script/doT.min.js"></script>
  586. <script type="text/javascript" src="../../script/config.js"></script>
  587. <script type="text/javascript" src="../../script/zepto.js"></script>
  588. <script type="text/javascript">
  589. var toast = new auiToast()
  590. var token
  591. apiready = function() {
  592. var info = $api.getStorage('data');
  593. token = JSON.parse(info).data.access_token;
  594. getApplyDe(api.pageParam.ID, token);
  595. };
  596. function getApplyDe(id, token) {
  597. var headers = {
  598. "Authorization": "Bearer " + token
  599. };
  600. $http.fnReuestData(UrlRouter.submitApplyDe + id, headers, 'get', '', function(ret, err) {
  601. if (ret.code === 0) {
  602. $apis.html(wordOrder_details, '#template', ret.data);
  603. toast.hide();
  604. } else {
  605. toast.hide();
  606. }
  607. })
  608. }
  609. // 上传图片的高度
  610. function setUpHeight(that) {
  611. that.style.width = that.offsetWidth + 'px'
  612. that.style.height = that.offsetWidth + 'px'
  613. }
  614. //  上传图浏览
  615. function browseImg(data, i) {
  616. var imageBrowser = api.require('imageBrowser');
  617. imageBrowser.openImages({
  618. imageUrls: data.split(','),
  619. activeIndex: i,
  620. showList: false
  621. });
  622. }
  623. // 上传文件在线浏览
  624. function browseFile(paths, flag) {
  625. api.download({
  626. url: paths,
  627. report: true,
  628. cache: true,
  629. allowResume: true
  630. }, function(ret, err) {
  631. if (ret.state == 1) {
  632. if (!flag) {
  633. var superFile = api.require('superFile');
  634. superFile.open({
  635. path: ret.savePath
  636. });
  637. }
  638. setTimeout(function() {
  639. api.toast({
  640. msg: '下载成功',
  641. duration: 2000,
  642. location: 'top'
  643. });
  644. }, 100)
  645. } else {
  646. }
  647. });
  648. }
  649. // 定位初始化
  650. var spName = '',
  651. lon = '',
  652. lat = '';
  653. function getLonLat(flag) {
  654. if (flag == 1) {
  655. api.showProgress({
  656. title: '提示',
  657. text: '定位中...',
  658. });
  659. }
  660. var aMap = api.require('aMap');
  661. aMap.getLocation(function(ret, err) {
  662. if (ret.status) {
  663. api.hideProgress();
  664. lon = ret.lon;
  665. lat = ret.lat;
  666. aMap.getNameFromCoords({
  667. lon: ret.lon,
  668. lat: ret.lat
  669. }, function(ret, err) {
  670. if (ret.status) {
  671. spName = ret.address
  672. $apis.html(position_warp, '#mapTemplate', ret);
  673. } else {
  674. api.toast({
  675. msg: '请打开手机定位',
  676. duration: 2000,
  677. location: 'top'
  678. });
  679. }
  680. });
  681. } else {
  682. api.hideProgress();
  683. api.toast({
  684. msg: '定位失败请重新定位',
  685. duration: 2000,
  686. location: 'top'
  687. });
  688. }
  689. });
  690. return '';
  691. }
  692. function uploadImg(type, that) {
  693. if (type == 'remote') {
  694. api.getPicture({
  695. sourceType: 'camera',
  696. mediaValue: 'pic',
  697. saveToPhotoAlbum: false
  698. }, function(ret, err) {
  699. if (ret && ret.data != '') {
  700. uploadHead(ret.data, that);
  701. } else {
  702. alert(JSON.stringify(err));
  703. }
  704. });
  705. }
  706. }
  707. // upload img
  708. function uploadHead(imgUrl, that) {
  709. $http.fileUploadRequest(UrlRouter.up_images, 'post', {
  710. image: imgUrl
  711. })
  712. .then(ret => {
  713. if (ret.code == 0) {
  714. var html = `<div class="img-item file-width" img-Url="${ret.data.path}">
  715. <img src="${ret.data.path}" alt="">
  716. </div>`;
  717. $api.append(that.parentNode, html);
  718. api.toast({
  719. msg: '上传成功',
  720. duration: 2000,
  721. location: 'top'
  722. });
  723. } else {
  724. api.toast({
  725. msg: '上传失败',
  726. duration: 2000,
  727. location: 'top'
  728. });
  729. }
  730. })
  731. .catch(err => {
  732. api.toast({
  733. msg: '网络错误',
  734. duration: 2000,
  735. location: 'top'
  736. });
  737. })
  738. }
  739. // 获取相册图片路径
  740. function changeImageUrl(el) {
  741. UIAlbumBrowser.imagePicker({
  742. max: 9,
  743. styles: {
  744. bg: '#000000',
  745. //cameraImg: 'widget://res/cameraImg.png',
  746. mark: {
  747. position: 'top_right',
  748. size: 20
  749. },
  750. nav: {
  751. bg: '#000000',
  752. cancelColor: '#fff',
  753. cancelSize: 16,
  754. nextStepColor: '#7fff00',
  755. nextStepSize: 16
  756. },
  757. thumbnail: {
  758. w: 100,
  759. h: 100
  760. }
  761. },
  762. animation: true,
  763. }, function(ret) {
  764. if (ret.eventType == 'nextStep') {
  765. UIAlbumBrowser.closePicker();
  766. if (ret.list && ret.list.length > 0) {
  767. imgarr = ret.list;
  768. // 转换缩略图路径 ios
  769. UIAlbumBrowser_transPath(el);
  770. }
  771. }
  772. if (ret.originalPath && ret.originalPath.length > 0) {
  773. uploadHead(ret.originalPath, el)
  774. }
  775. });
  776. }
  777. // 转换缩略图路径 ios
  778. function UIAlbumBrowser_transPath(el) {
  779. UIAlbumBrowser.transPath({
  780. path: imgarr[i].path
  781. }, function(ret, err) {
  782. if (ret) {
  783. i++;
  784. if (i < imgarr.length) {
  785. UIAlbumBrowser_transPath(el);
  786. } else {
  787. i = 0;
  788. }
  789. uploadHead(ret.path, el)
  790. }
  791. });
  792. }
  793. // 备注地理位置
  794. function addPositionNotes() {
  795. var headers = {
  796. "Authorization": "Bearer " + token
  797. };
  798. var photoFile = $('.photoFile'),
  799. photoArray = [],
  800. inputObj = {};
  801. photoFile.each(function() {
  802. inputObj = {};
  803. photoArray = [];
  804. var photoList = $(this).find('.img-item');
  805. photoList.each(function() {
  806. photoArray.push($(this).attr('img-Url'));
  807. });
  808. inputObj.inputValue = photoArray.join(',');
  809. });
  810. const query = {
  811. address: spName,
  812. longitude: lon,
  813. latitude: lat,
  814. remark_info: {
  815. remarkInfo: $api.val($api.byId('remark_information')),
  816. imageList: photoArray
  817. }
  818. }
  819. $http.fnReuestData(UrlRouter.fill_order + api.pageParam.ID, headers, 'post', query, function(ret, err) {
  820. if (ret.code === 0) {
  821. toast.hide();
  822. getApplyDe(api.pageParam.ID, token);
  823. } else {
  824. api.toast({
  825. msg: ret.message,
  826. duration: 2000,
  827. location: 'bottom'
  828. });
  829. toast.hide();
  830. }
  831. })
  832. }
  833. // textarea根据文字多少自适应高度
  834. function Oninput(that) {
  835. $(that).height(that.scrollHeight);
  836. }
  837. // 打开地图
  838. function openMaps(lon, lat) {
  839. $event.openTabLayout('map', '../browseQrcode/map', '', {
  840. lon: lon,
  841. lat: lat
  842. })
  843. }
  844. // 图片浏览
  845. function browseImgTwo(i, value) {
  846. var imageBrowser = api.require('imageBrowser');
  847. imageBrowser.openImages({
  848. imageUrls: value.split(','),
  849. activeIndex: i,
  850. showList: false
  851. });
  852. }
  853. </script>
  854. </html>