b5ffb4d420b39853d1161a4a92977c8d.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. <?php /*a:2:{s:72:"D:\phpstudy_pro\WWW\caiping\app\admin\view\project\cost_company\add.html";i:1723541257;s:59:"D:\phpstudy_pro\WWW\caiping\app\admin\view\common\base.html";i:1723541257;}*/ ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta name="360-site-verification" content="a7c876fae8b6e3175a52ea9f19543f51" />
  9. <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=0">
  10. <script src="/static/dist/xm-select.js"></script>
  11. <link rel="mobile-prefetch" href=""/>
  12. <title><?php echo get_system_config('web','admin_title'); ?></title>
  13. <meta name="keywords" content="<?php echo get_system_config('web','keywords'); ?>"/>
  14. <meta name="description" content="<?php echo get_system_config('web','desc'); ?>"/>
  15. <link rel="stylesheet" href="/static/assets/gougu/css/gougu.css?v=<?php echo get_system_config('web','version'); ?>" media="all">
  16. <style>
  17. .footer{
  18. width: 100%;
  19. height: 25px;
  20. text-align: center;
  21. margin-bottom: 0 !important;
  22. display: none;
  23. }
  24. .heading th {
  25. text-align: center;
  26. }
  27. .form td {
  28. text-align: center;
  29. }
  30. /* 日志 */
  31. .log_top {
  32. padding-left: 1vw;
  33. }
  34. .log_top span {
  35. margin: 0 0.5vw;
  36. }
  37. /* 1,1,1 */
  38. .log_commentary {
  39. color: rgb(0, 176, 80);
  40. }
  41. .log_company {
  42. color: rgb(255, 33, 0);
  43. }
  44. .log_content {
  45. width: fit-content;
  46. margin: 0.3vw 1.5vw 1vw 1.5vw;
  47. padding: 0.5vw 0vw;
  48. text-indent: 1.2em;
  49. line-height: 2.1vh;
  50. background-color: rgb(255, 255, 255);
  51. border-radius: 0.5vw;
  52. box-shadow: 0.19vw 0.16vw 0.4vw 0.03vw rgba(0, 0, 0, 0.13);
  53. }
  54. .log_content_color {
  55. /* background-color: rgb(250,250,250); */
  56. }
  57. .log_content_img img {
  58. /* width: 10%; */
  59. height: 150px;
  60. border-radius: 0.5vw;
  61. margin: 0.3vw 0;
  62. padding-right: 18px;
  63. padding-bottom: 7px;
  64. padding-left: 2px;
  65. }
  66. .log_item_top {
  67. height: 70%;
  68. overflow: scroll;
  69. }
  70. .log_item_top {
  71. height: 60vh;
  72. }
  73. .log_item_bottom {
  74. display: flex;
  75. /* height: 17vh; */
  76. /* border-top: 1px solid #eee; */
  77. margin: 0 1.5vw;
  78. /* background-color: rgb(250,250,250); */
  79. }
  80. .log_input input {
  81. width: 55vw;
  82. height: 10vh;
  83. border: #eee 1px solid;
  84. }
  85. .log_bottom_img {
  86. /* height: 5vh; */
  87. }
  88. .log_bottom_img img {
  89. height: 4vw;
  90. width: 6vw;
  91. border-radius: 0.5vw;
  92. margin: 0.5vw 0vw 0.5vw 0.3vw;
  93. }
  94. .log_bottom_left {
  95. width: 100%;
  96. margin-top: 1.5vh;
  97. }
  98. .log_bottom_right {
  99. width: 5%;
  100. }
  101. /* 上传图片 */
  102. .layui-upload-drag-self {
  103. background-color: #fbfdff;
  104. border: 1px dashed #c0ccda;
  105. border-radius: 6px;
  106. box-sizing: border-box;
  107. line-height: 4vw;
  108. vertical-align: top;
  109. display: inline-block;
  110. text-align: center;
  111. cursor: pointer;
  112. outline: 0;
  113. margin-right: 13px;
  114. float: left;
  115. }
  116. .layui-input-inlines-self {
  117. position: relative;
  118. margin-left: 90px;
  119. min-height: 36px;
  120. text-align: left;
  121. }
  122. .layui-upload-drag-self .layui-icon {
  123. font-size: 28px;
  124. color: #8c939d
  125. }
  126. .layui-upload-drag-self .img {
  127. position: relative;
  128. height: 148px;
  129. width: 148px;
  130. }
  131. .layui-upload-img {
  132. width: 148px;
  133. height: 148px;
  134. border-radius: 6px;
  135. margin-top: -3px;
  136. margin-left: -2px;
  137. }
  138. .handle {
  139. position: absolute;
  140. width: 148px;
  141. height: 100%;
  142. z-index: 100;
  143. border-radius: 6px;
  144. top: 0;
  145. background: rgba(59, 60, 61, 0.6);
  146. text-align: center;
  147. }
  148. .handle .icon-myself {
  149. z-index: 999;
  150. transition: all .3s;
  151. cursor: pointer;
  152. font-size: 25px;
  153. width: 25px;
  154. color: rgba(255, 255, 255, 0.91);
  155. margin: 0 4px;
  156. }
  157. .log_textarea {
  158. width: 89vw;
  159. height: 8vh;
  160. padding: 0.5vw;
  161. /* margin-right: 2vw; */
  162. margin: 1vw;
  163. }
  164. .log_button_img {
  165. width: 2vw;
  166. }
  167. .log_card {
  168. border: none !important;
  169. }
  170. /* 点击图片放大 */
  171. .content_img img {
  172. max-width: 100%;
  173. cursor: pointer;
  174. }
  175. .overlay {
  176. display: none;
  177. position: fixed;
  178. top: 0;
  179. left: 0;
  180. width: 100%;
  181. height: 100%;
  182. background-color: rgba(0, 0, 0, 0.7);
  183. justify-content: center;
  184. z-index: 1;
  185. }
  186. .overlay img {
  187. margin-top: 4%;
  188. max-width: 90%;
  189. max-height: 90%;
  190. object-fit: contain;
  191. }
  192. .p-4 {
  193. background-color: rgb(255, 255, 255);
  194. }
  195. /*表格*/
  196. #tabniubi {
  197. width: 100%;
  198. margin: 10px 0;
  199. background-color: #fff;
  200. color: #5f5f5f;
  201. }
  202. #tabniubi th {
  203. padding: 9px 15px;
  204. min-height: 20px;
  205. height: 40px;
  206. line-height: 40px;
  207. text-align: center;
  208. /* font-size: 14px; */
  209. border-width: 1px;
  210. border-style: solid;
  211. border-color: #e2e2e2;
  212. font: 14px Helvetica Neue, Helvetica, PingFang SC, Tahoma, Arial, sans-serif;
  213. }
  214. #tabniubi tr:first-child {
  215. padding: 0;
  216. min-height: 0;
  217. line-height: 0;
  218. border-width: 0;
  219. border-style: none;
  220. border-color: #fff;
  221. font-size: 0;
  222. }
  223. #tabniubi tr:first-child th {
  224. padding: 0;
  225. min-height: 0;
  226. line-height: 0;
  227. border-width: 0;
  228. border-style: none;
  229. border-color: #fff;
  230. font-size: 0;
  231. }
  232. .form-title {
  233. background-color: rgb(241, 241, 241);
  234. color: rgb(95, 95, 95);
  235. border-color: rgb(241, 241, 241);
  236. font-weight: 600;
  237. }
  238. .forleft {
  239. text-align: left !important;
  240. }
  241. /* .forright{
  242. text-align:right !important;
  243. } */
  244. .layui-form-select dl dd.layui-this {
  245. background-color: #f8f8f8;
  246. color: rgb(23, 145, 233);
  247. font-weight: 700;
  248. }
  249. .layui-input, .layui-textarea {
  250. /* padding-left: 3.75vw; */
  251. color: #5f5f5f;
  252. }
  253. .upimg {
  254. width: 250px;
  255. height: 250px;
  256. }
  257. .filelist{
  258. width: 100%;
  259. overflow: auto;
  260. justify-content:flex-start;
  261. align-content: space-between;
  262. flex-direction: column-reverse;
  263. flex-wrap: wrap;
  264. display: flex;
  265. }
  266. .filelist li{
  267. padding: 0.5vw 0.8vw 0.5vw 0.8vw;
  268. white-space: nowrap;
  269. overflow: hidden;
  270. text-overflow: ellipsis;
  271. display: inline-block;
  272. border-right: 1px solid #e2e2e2;
  273. float: left;
  274. }
  275. .filelist p{
  276. margin: 3px 0 5px 0;
  277. width: 7vw;
  278. overflow: hidden;
  279. text-overflow: ellipsis;
  280. text-align: center;
  281. }
  282. #filesBox2 li{
  283. padding: 0.5vw 0.8vw 0.5vw 0.8vw;
  284. white-space: nowrap;
  285. overflow: hidden;
  286. text-overflow: ellipsis;
  287. display: inline-block;
  288. border-right: 1px solid #e2e2e2;
  289. float: left;
  290. }
  291. </style>
  292. </head>
  293. <body class="main-body">
  294. <!-- 主体 -->
  295. <form class="layui-form p-4">
  296. <h3 class="pb-3">新建造价项目</h3>
  297. <table id="tabniubi" cellpadding="1" cellspacing="1">
  298. <tr>
  299. <th style="width: 10%;height: 0;"></th>
  300. <th style="width: 10%;height: 0;"></th>
  301. <th style="width: 10%;height: 0;"></th>
  302. <th style="width: 10%;height: 0;"></th>
  303. <th style="width: 10%;height: 0;"></th>
  304. <th style="width: 10%;height: 0;"></th>
  305. <th style="width: 10%;height: 0;"></th>
  306. <th style="width: 10%;height: 0;"></th>
  307. <th style="width: 10%;height: 0;"></th>
  308. </tr>
  309. <tr border="1">
  310. <th class="form-title">项目名称 <font style="color: red !important;">*</font></th>
  311. <th colspan="2">
  312. <input type="text" name="project_name" lay-verify="required" lay-reqText="请完善项目名称" value="" autocomplete="off" placeholder="请输入项目名称" class="layui-input">
  313. </th>
  314. <th class="form-title">项目编号 <font style="color: red !important;">*</font></th>
  315. <th colspan="2">
  316. <input type="text" name="project_num" lay-verify="required" lay-reqText="请完善项目编号" value="" autocomplete="off" placeholder="请输入项目编号" class="layui-input">
  317. </th>
  318. <th class="form-title">项目周期 <font style="color: red !important;">*</font></th>
  319. <th id="date" colspan="2">
  320. <div class="layui-input-inline" style="width: 47%;display: inline-flex;">
  321. <input type="text" id="start_time" name="project_start_time" readonly lay-verify="required" lay-reqText="请选择开始时间" placeholder="请选择" class="layui-input" value="">
  322. </div>
  323. -
  324. <div class="layui-input-inline" style="width: 47%;display: inline-flex;">
  325. <input type="text" id="end_time" name="project_end_time" readonly lay-verify="required" lay-reqText="请选择结束时间" placeholder="请选择" class="layui-input" value="">
  326. </div>
  327. </th>
  328. </tr>
  329. <tr>
  330. <th class="form-title">项目类型 <font style="color: red !important;">*</font></th>
  331. <th colspan="2">
  332. <div>
  333. <select name="engineering_type1" lay-verify="required" >
  334. <option value="">请选择项目类型</option>
  335. <option value="1" >预算</option>
  336. <option value="2" >结算</option>
  337. <option value="3">概算</option>
  338. <option value="4">决算</option>
  339. <option value="5">工程总承包(EPC)</option>
  340. </select>
  341. </div>
  342. </th>
  343. <th class="form-title">——</th>
  344. <th colspan="2">
  345. <div>
  346. <select name="engineering_type2" lay-verify="required" >
  347. <option value="">请选择项目类型</option>
  348. <option value="1" >审核</option>
  349. <option value="2" >编制</option>
  350. </select>
  351. </div>
  352. </th>
  353. <th class="form-title">工程类别</th>
  354. <th colspan="2">
  355. <select name="engineering_category" lay-verify="engineering_category" >
  356. <option value="">请选择工程类型</option>
  357. <option value="建筑物" >建筑物</option>
  358. <option value="交通" >交通</option>
  359. <option value="水利" >水利</option>
  360. <option value="土地整治" >土地整治</option>
  361. <option value="市政园林" >市政园林</option>
  362. <option value="信息网络" >信息网络</option>
  363. <option value="其他" >其他</option>
  364. </select>
  365. </th>
  366. </tr>
  367. <tr>
  368. <th class="form-title">项目区域</th>
  369. <th colspan="2">
  370. <div>
  371. <div class="layui-form-item"
  372. style="margin-bottom: 0;display: flex;flex-direction: row;justify-content: space-between;">
  373. <div class="layui-input-inline" style="width: 6.5vw;">
  374. <select id="province" lay-filter="province" name="province"></select>
  375. </div>
  376. <div class="layui-input-inline area" style="width: 6.5vw;">
  377. <select id="city" lay-filter="city" name="city"></select>
  378. </div>
  379. <div class="layui-input-inline area" style="width: 6.5vw;">
  380. <select id="area" lay-filter="area" name="area"></select>
  381. </div>
  382. </div>
  383. </div>
  384. </th>
  385. </tr>
  386. <!-- <tr>
  387. <th class="form-title">资金性质</th>
  388. <th>
  389. <div>
  390. <select name="fiscal_nature" lay-filter="aihao">
  391. <option value="">请选择资金性质</option>
  392. <option value="财政资金">财政资金</option>
  393. <option value="非财政资金">非财政资金</option>
  394. </select>
  395. </div>
  396. </th>
  397. <th class="form-title">项目规模</th>
  398. <th colspan="3">
  399. <input type="text" name="project_scale" value="" autocomplete="off" placeholder="请输入项目规模" class="layui-input">
  400. </th>
  401. <th class="form-title">收费标准</th>
  402. <th colspan="2">
  403. <input type="text" name="charge_standard" value="" autocomplete="off" placeholder="请输入收费标准" class="layui-input">
  404. </th>
  405. </tr>
  406. <tr>
  407. <th colspan="9" class="forleft">金额详情</th>
  408. </tr>
  409. <tr>
  410. <th class="form-title" colspan="1">送审金额(元)</th>
  411. <th colspan="3">
  412. <input type="text" id="sent_review_amount" name="sent_review_amount" onkeyup="Add()" value="" autocomplete="off" placeholder="请输入送审金额" class="layui-input">
  413. </th>
  414. <th class="form-title" colspan="1">审定金额(元)</th>
  415. <th colspan="4" style="text-align: left;">
  416. <input type="text" id="authorize_amount" name="authorize_amount" value="" onkeyup="Add()" autocomplete="off" placeholder="请输入审定金额" class="layui-input">
  417. </th>
  418. </tr>
  419. <tr>
  420. <th class="form-title" colspan="1">审增减额(元)</th>
  421. <th colspan="1">
  422. <span id="review_add_reduce_amount"></span>
  423. <input type="hidden" name="review_add_reduce_amount" value="" autocomplete="off" placeholder="请输入审增减额" class="layui-input">
  424. </th>
  425. <th class="form-title" colspan="1">审增减率(%)</th>
  426. <th colspan="1">
  427. <span id="review_add_reduce_rate"></span>
  428. <input type="hidden" name="review_add_reduce_rate" value="" autocomplete="off" placeholder="请输入审增减率" class="layui-input">
  429. </th>
  430. <th class="form-title" colspan="1">送审服务费 (元)</th>
  431. <th colspan="4" style="text-align: left;">
  432. <input type="text" name="sent_review_cost" value="" autocomplete="off" placeholder="请输入送审服务费" class="layui-input">
  433. </th>
  434. </tr> -->
  435. <!-- <tr>
  436. <th class="form-title" colspan="1">报告时间</th>
  437. <th colspan="8" style="text-align: left;"></th>
  438. </tr>-->
  439. <tr>
  440. <th colspan="9" class="forleft">相关附件
  441. <button class="layui-btn layui-btn-xs layui-btn-danger" style="float: right;" type="button"
  442. id="uploadBtn">上传附件
  443. </button>
  444. </th>
  445. </tr>
  446. <tr>
  447. <th colspan="9" class="fujianimg" >
  448. <div id="filesBox2">
  449. <div class="filelist" id="filesBigBox">
  450. <ul id="filesBox">
  451. <div id="nofile" class="layui-data-none">暂无附件</div>
  452. </ul>
  453. </div>
  454. </div>
  455. </th>
  456. </tr>
  457. </table>
  458. <div class="py-3">
  459. <input type="hidden" name="id" value=""/>
  460. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="save">保存</button>
  461. </div>
  462. </form>
  463. <!-- /主体 -->
  464. <!-- 底部 -->
  465. <div class="footer">
  466. 逸管工程项目管理系统 © www.yiguanfep.com
  467. <img src="/static/home/images/police.png" alt="" style="width:14.5px;height:16px;">
  468. <a href="https://beian.mps.gov.cn/#/query/websearch?code=45030202000160 " rel="\&quot;noreferrer'target=\”blank\&quot;" onclick="window.open(this.href); return false;">桂公网安备45030202000160号</a>
  469. <a href="https://beian.miit.gov.cn/#/Integrated/index" onclick="window.open(this.href); return false;">桂ICP备17000971号</a>
  470. </div>
  471. <!-- /底部 -->
  472. <!-- 脚本 -->
  473. <script>
  474. var moduleInit = ['tool','oaTool'];
  475. var province = '';
  476. if(province==''){
  477. province = '广西';city = '南宁市'; area = '青秀区';
  478. }
  479. function Add(){
  480. var input1 = 0,input2 = 0;
  481. input1 = parseInt(document.getElementById("sent_review_amount").value);
  482. input2 = parseInt(document.getElementById("authorize_amount").value);
  483. if (input1 && input2) {
  484. var aa= input2-input1;
  485. var bb = aa/input1*100;
  486. bb = bb.toFixed(2);
  487. $('[name="review_add_reduce_amount"]').val(aa);
  488. $('[name="review_add_reduce_rate"]').val(bb );
  489. $('#review_add_reduce_amount').html(aa );
  490. $('#review_add_reduce_rate').html(bb)
  491. }else {
  492. $('[name="review_add_reduce_amount"]').val('');
  493. $('[name="review_add_reduce_rate"]').val('' );
  494. $('#review_add_reduce_amount').html('' );
  495. $('#review_add_reduce_rate').html('')
  496. }
  497. // 总审定金额-总送审金额
  498. }
  499. function gouguInit() {
  500. var form = layui.form, tool = layui.tool, oaTool = layui.oaTool;
  501. let adress;
  502. //日期选择
  503. layui.laydate.render({
  504. elem: '#date',
  505. range: ['#start_time', '#end_time'],
  506. rangeLinked: true
  507. });
  508. let c = 1;
  509. //监听提交
  510. form.on('submit(save)', function (data) {
  511. if(c){
  512. let callback = function (e) {
  513. c = 1
  514. layer.msg(e.msg);
  515. if (e.code == 0) {
  516. tool.sideClose(1000);
  517. }
  518. }
  519. var engineering_type1 ='';
  520. if(data.field.engineering_type1==1){
  521. engineering_type1 ='预算';
  522. }else if(data.field.engineering_type1==2){
  523. engineering_type1 ='结算';
  524. }
  525. var engineering_type2 = '';
  526. if(data.field.engineering_type2==1){
  527. engineering_type2 ='审核';
  528. }else if(data.field.engineering_type2==2) {
  529. engineering_type2 = '编制';
  530. }
  531. if(engineering_type1!==""&&engineering_type2!==""){
  532. data.field.engineering_type = engineering_type1 + "-" + engineering_type2;
  533. }
  534. data.field.file_ids = file_ids;
  535. tool.post("/admin/project.cost_company/add", data.field, callback);
  536. }
  537. c = 0
  538. return false;
  539. });
  540. var file_ids = [];
  541. $('#filesBox').on('click','.file-del',function(){
  542. let id = $(this).parent().parent().data('id');
  543. layer.confirm('确定要删除该文件吗?', { icon: 3, title: '提示' }, function () {
  544. layer.closeAll();
  545. var index = file_ids.indexOf(id);
  546. if (index > -1) {
  547. file_ids.splice(index, 1);
  548. }
  549. if(file_ids.length == 0){
  550. $("#filesBox").append('<div id="nofile" class="layui-data-none" >暂无附件</div>');
  551. }
  552. console.log(file_ids);
  553. $("#" + id).remove();
  554. });
  555. })
  556. //上传文件数组
  557. function fileCard(item){
  558. var host = window.location.host;
  559. var li = '';
  560. if(item.length>0){
  561. for(var a=0;a<item.length;a++){
  562. let image = ['jpg','jpeg','png','gif'];
  563. let doc = ['doc','docx','xls','xlsx','ppt','pptx','txt','pdf','zip','rar','7z'];
  564. // let down = '<a href="'+item[a].filepath+'" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal" download="'+item[a].name+'">下载</a>';
  565. let down ='<a href="https://view.officeapps.live.com/op/view.aspx?src=https://' + host + item[a]['filepath'] + '" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal" download="' + item[a]['name'] + '">预览</a>';
  566. // 判断元素是否在数组中
  567. let path='/static/home/images/icon/file.png';
  568. if (image.includes(item[a].fileext)) {
  569. path=item[a].filepath;
  570. down = '<span data-href="'+item[a].filepath+'" class="layui-btn layui-btn-xs layui-btn-normal file-view-img">预览</span>';
  571. } else if (doc.includes(item[a].fileext)){
  572. path='/static/home/images/icon/'+item[a].fileext+'.png';
  573. }
  574. if(item[a].fileext == 'pdf'){
  575. down = '<span data-href="'+item[a].filepath+'" class="layui-btn layui-btn-xs layui-btn-normal file-view-pdf">预览</span>';
  576. }
  577. li += '<li id="'+item[a].id+'" data-id="'+item[a].id+'" data-title="'+item[a].name+'" data-ext="'+item[a].fileext+'"><img src="'+path+'" alt="'+item[a].filename+
  578. '" style="object-fit: contain;" class="file-item"><p title="'+item[a].name+'">'+item[a].name+
  579. '</p><div class="layui-btn-group">'+ down +
  580. '<span class="layui-btn layui-btn-xs layui-btn-danger file-del">删除</span></div></li>';
  581. }
  582. return li;
  583. }
  584. }
  585. oaTool.addFile({
  586. type: 1,
  587. isSave: true,
  588. ajaxSave: function (res) {
  589. let callback = function (e) {
  590. if (e.hasOwnProperty("msg")) {
  591. layer.msg(e.msg);
  592. }else{
  593. layer.msg('上传成功!')
  594. }
  595. $('#nofile').remove();
  596. $("#filesBox").append(fileCard(e));
  597. file_ids.push(e[0].id)
  598. }
  599. tool.post("/admin/project.api/add_file", {
  600. 'file_id': res.data.id,
  601. }, callback);
  602. }
  603. });
  604. $('#filesBox2').on('click', '.file-del', function () {
  605. let id = $(this).parent().parent().data('id');
  606. layer.confirm('确定要删除该文件吗?请慎重', {icon: 3, title: '提示'}, function () {
  607. var index = file_ids.indexOf(id);
  608. layer.closeAll();
  609. if (index > -1) {
  610. file_ids.splice(index, 1);
  611. }
  612. if(file_ids.length == 0){
  613. $("#filesBox").append('<div id="nofile" class="layui-data-none" >暂无附件</div>');
  614. }
  615. console.log(file_ids);
  616. $("#" + id).remove();
  617. });
  618. })
  619. layui.use(['form', 'jquery'], function () {
  620. var form = layui.form;
  621. const $ = layui.jquery;
  622. let adress;
  623. $.ajax({
  624. type: "get", //使用get方式
  625. url: "/static/assets/layui/adress.json", //json文件相对于这个HTML的路径
  626. dataType: "json",
  627. async: false,
  628. success: function (data) {
  629. //这个data就是json数据
  630. adress = data
  631. var province = Object.keys(adress)
  632. var proStrs= '<option value="">省</option>';
  633. for (var i=0; i<province.length;i++){
  634. proStrs += '<option value="' + province[i] + '">' + province[i] + '</option>';
  635. }
  636. $("#province").html(proStrs);
  637. layui.form.render("select")
  638. },
  639. error: function () {
  640. layer.alert("地址请求失败!! ");
  641. }
  642. });
  643. function getFirstAttr(obj) {
  644. for (var k in obj) return k;
  645. }
  646. function selectOption(selectedProvince, selectedCity='', selectedArea='') {
  647. var proStr = '<option value="">省</option>', cityStr = '<option value="">市</option>', areaStr = '<option value="">县</option>';
  648. var pro = adress[selectedProvince], ci = adress[selectedProvince][selectedCity];
  649. for (var province in adress) {
  650. if (province == selectedProvince) proStr += '<option value="' + province + '" selected>' + province + '</option>';
  651. else proStr += '<option value="' + province + '">' + province + '</option>';
  652. }
  653. $("#province").html(proStr);
  654. for (var city in pro) {
  655. if (city == selectedCity) cityStr += '<option value="' + city + '" selected>' + city + '</option>';
  656. else cityStr += '<option value="' + city + '">' + city + '</option>';
  657. }
  658. $("#city").html(cityStr);
  659. for (var area in ci) {
  660. if (area == "remove") {
  661. continue;
  662. }
  663. if (ci[area] == selectedArea) areaStr += '<option value="' + ci[area] + '" selected>' + ci[area] + '</option>';
  664. else areaStr += '<option value="' + ci[area] + '">' + ci[area] + '</option>';
  665. }
  666. $("#area").html(areaStr);
  667. form.render();
  668. }
  669. /*selectOption(1,2, 3);*/
  670. form.on('select(province)', function (data) {
  671. let thisProvince = data.value;
  672. let thisCity = getFirstAttr(adress[thisProvince]);
  673. selectOption(data.value);
  674. });
  675. form.on('select(city)', function (data) {
  676. selectOption($("#province").val(), data.value, getFirstAttr(data.value));
  677. });
  678. })
  679. }
  680. </script>
  681. <!-- /脚本 -->
  682. <!-- <script src="/static/assets/layui/layui.js"></script> -->
  683. <script src="/static/assets/layui/layui.js"></script>
  684. <script src="/static/assets/third_party/echart/echarts.min.js"></script>
  685. <script src="/static/assets/gougu/gouguInit.js"></script>
  686. <script src="https://unpkg.com/pinyin-pro"></script>
  687. <script>
  688. var { pinyin } = pinyinPro;
  689. </script>
  690. <!-- 统计代码 -->
  691. <!-- /统计代码 -->
  692. </body>
  693. </html>