63769562810e56392ae9a8791c28e04a.php 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927
  1. <?php /*a:2:{s:75:"D:\phpstudy_pro\WWW\caiping\app\admin\view\project\cost_proprietor\add.html";i:1724909340;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. .fujianimg img {
  258. height: 5.5vh;
  259. }
  260. .filelist {
  261. width: 100%;
  262. overflow: auto;
  263. justify-content: flex-start;
  264. align-content: space-between;
  265. flex-direction: column-reverse;
  266. flex-wrap: wrap;
  267. display: flex;
  268. }
  269. .filelist li {
  270. padding: 0.5vw 0.8vw 0.5vw 0.8vw;
  271. white-space: nowrap;
  272. overflow: hidden;
  273. text-overflow: ellipsis;
  274. display: inline-block;
  275. border-right: 1px solid #e2e2e2;
  276. float: left;
  277. }
  278. .filelist p {
  279. margin: 3px 0 5px 0;
  280. width: 7vw;
  281. overflow: hidden;
  282. text-overflow: ellipsis;
  283. text-align: center;
  284. }
  285. #filesBox2 li {
  286. padding: 0.5vw 0.8vw 0.5vw 0.8vw;
  287. white-space: nowrap;
  288. overflow: hidden;
  289. text-overflow: ellipsis;
  290. display: inline-block;
  291. border-right: 1px solid #e2e2e2;
  292. float: left;
  293. }
  294. </style>
  295. </head>
  296. <body class="main-body">
  297. <!-- 主体 -->
  298. <form class="layui-form p-4">
  299. <table id="tabniubi" cellpadding="1" cellspacing="1">
  300. <tr>
  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. <th style="width: 10%;height: 0;"></th>
  309. <th style="width: 10%;height: 0;"></th>
  310. </tr>
  311. <tr border="1">
  312. <th class="form-title">项目名称 <font style="color: red !important;">*</font></th>
  313. <th colspan="2">
  314. <input type="text" name="project_name" lay-verify="required" lay-reqText="请完善项目名称" value=""
  315. autocomplete="off" placeholder="请输入项目名称" class="layui-input">
  316. </th>
  317. <th class="form-title">项目编号 <font style="color: red !important;">*</font></th>
  318. <th colspan="2">
  319. <input type="text" name="project_num" lay-verify="required" lay-reqText="请完善项目编号" value=""
  320. autocomplete="off" placeholder="请输入项目编号" class="layui-input">
  321. </th>
  322. <th class="form-title">工程类别</th>
  323. <th colspan="2">
  324. <select name="engineering_category" lay-verify="engineering_category" >
  325. <option value="">请选择工程类型</option>
  326. <option value="建筑物" >建筑物</option>
  327. <option value="交通" >交通</option>
  328. <option value="水利" >水利</option>
  329. <option value="土地整治" >土地整治</option>
  330. <option value="市政园林" >市政园林</option>
  331. <option value="信息网络" >信息网络</option>
  332. <option value="其他" >其他</option>
  333. </select>
  334. </th>
  335. <!-- <th class="form-title">项目周期 <font style="color: red !important;">*</font></th>-->
  336. <!-- <th id="date" colspan="2">-->
  337. <!-- <div class="layui-input-inline" style="width: 47%;display: inline-flex;">-->
  338. <!-- <input type="text" id="start_time" name="project_start_time" readonly lay-verify="required"-->
  339. <!-- lay-reqText="请选择开始时间" placeholder="请选择" class="layui-input" value="">-->
  340. <!-- </div>-->
  341. <!-- - -->
  342. <!-- <div class="layui-input-inline" style="width: 47%;display: inline-flex;">-->
  343. <!-- <input type="text" id="end_time" name="project_end_time" readonly lay-verify="required"-->
  344. <!-- lay-reqText="请选择结束时间" placeholder="请选择" class="layui-input" value="">-->
  345. <!-- </div>-->
  346. <!-- </th>-->
  347. </tr>
  348. <tr>
  349. <th class="form-title">项目类型<font style="color: red !important;">*</font></th>
  350. <th colspan="2">
  351. <div>
  352. <select name="engineering_type1" lay-verify="required">
  353. <option value="">请选择项目类型</option>
  354. <option value="1">预算</option>
  355. <option value="2">结算</option>
  356. </select>
  357. </div>
  358. </th>
  359. <th class="form-title">——</th>
  360. <th colspan="2">
  361. <div>
  362. <select name="engineering_type2" lay-verify="required">
  363. <option value="">请选择项目类型</option>
  364. <option value="1">审核</option>
  365. <option value="2">编制</option>
  366. </select>
  367. </div>
  368. </th>
  369. </tr>
  370. <tr>
  371. <th class="form-title">项目区域</th>
  372. <th colspan="2">
  373. <div>
  374. <div class="layui-form-item"
  375. style="margin-bottom: 0;display: flex;flex-direction: row;justify-content: space-between;">
  376. <div class="layui-input-inline" style="width: 6.5vw;">
  377. <select id="province" lay-filter="province" name="province"></select>
  378. </div>
  379. <div class="layui-input-inline area" style="width: 6.5vw;">
  380. <select id="city" lay-filter="city" name="city"></select>
  381. </div>
  382. <div class="layui-input-inline area" style="width: 6.5vw;">
  383. <select id="area" lay-filter="area" name="area"></select>
  384. </div>
  385. </div>
  386. </div>
  387. </th>
  388. </tr>
  389. <tr>
  390. <th class="form-title">资金性质</th>
  391. <th>
  392. <input type="radio" name="fiscal_nature" value="财政资金" title="财政资金" lay-filter="tax" checked>
  393. <input type="radio" name="fiscal_nature" value="非财政资金" title="非财政资金" lay-filter="tax">
  394. </th>
  395. <th class="form-title entrust_unit">委托单位 <font style="color: red !important;">*</font></th>
  396. <th colspan="2" class="entrust_unit">
  397. <input type="text" name="entrust_unit_name" autocomplete="off" readonly value="" lay-reqText="当地的财评" placeholder="当地的财评委托单位" class="layui-input get-entrust">
  398. <input type="hidden" name="entrust_unit" value="">
  399. </th>
  400. <!-- <th class="form-title review_unit">评审单位 <font style="color: red !important;">*</font></th>-->
  401. <!-- <th colspan="2" class="review_unit">-->
  402. <!-- <input type="text" name="review_unit_name" autocomplete="off" readonly value="" lay-reqText="请输入评审单位" placeholder="请输入评审单位" class="layui-input customer-picker">-->
  403. <!-- <input type="hidden" name="review_unit" value="">-->
  404. <!-- </th>-->
  405. </tr>
  406. <tr>
  407. <th class="form-title">审批人 <font style="color: red !important;">*</font></th>
  408. <th colspan="2">
  409. <select name="sent_review_approver" lay-verify="required" lay-reqText="请选择第一审批人">
  410. <option value="">请选择第一审批人</option>
  411. <?php if(is_array($person) || $person instanceof \think\Collection || $person instanceof \think\Paginator): $i = 0; $__LIST__ = $person;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
  412. <option value="<?php echo htmlentities($v['id']); ?>"><?php echo htmlentities($v['nickname']); ?></option>
  413. <?php endforeach; endif; else: echo "" ;endif; ?>
  414. </select>
  415. </th>
  416. <th colspan="2">
  417. <select name="sent_review_second_approver" lay-reqText="请选择第一审批人">
  418. <option value="">请选择第二审批人(可选)</option>
  419. <?php if(is_array($person) || $person instanceof \think\Collection || $person instanceof \think\Paginator): $i = 0; $__LIST__ = $person;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
  420. <option value="<?php echo htmlentities($v['id']); ?>"><?php echo htmlentities($v['nickname']); ?></option>
  421. <?php endforeach; endif; else: echo "" ;endif; ?>
  422. </select>
  423. </th>
  424. </tr>
  425. <tr>
  426. <th colspan="9" class="forleft">相关附件
  427. <button class="layui-btn layui-btn-xs layui-btn-danger" style="float: right;" type="button"
  428. id="uploadBtn">上传附件
  429. </button>
  430. </th>
  431. </tr>
  432. <tr>
  433. <th colspan="9" class="fujianimg" style="padding: 9px 0;">
  434. <div id="filesBox2">
  435. <div class="filelist" id="filesBigBox">
  436. <ul id="filesBox" style="overflow: scroll;">
  437. </ul>
  438. </div>
  439. <?php if(empty($file_array) || (($file_array instanceof \think\Collection || $file_array instanceof \think\Paginator ) && $file_array->isEmpty())): ?>
  440. <div class="layui-data-none">暂无附件</div>
  441. <?php endif; ?>
  442. </div>
  443. </th>
  444. </tr>
  445. </table>
  446. <div class="py-3">
  447. <input type="hidden" name="id" value="0"/>
  448. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="add">保存</button>
  449. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="save">提交</button>
  450. </div>
  451. </form>
  452. <!-- /主体 -->
  453. <!-- 底部 -->
  454. <div class="footer">
  455. 逸管工程项目管理系统 © www.yiguanfep.com
  456. <img src="/static/home/images/police.png" alt="" style="width:14.5px;height:16px;">
  457. <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>
  458. <a href="https://beian.miit.gov.cn/#/Integrated/index" onclick="window.open(this.href); return false;">桂ICP备17000971号</a>
  459. </div>
  460. <!-- /底部 -->
  461. <!-- 脚本 -->
  462. <script>
  463. var moduleInit = ['tool', 'oaTool'];
  464. var province = '';
  465. if (province == '') {
  466. province = '广西';
  467. city = '南宁市';
  468. area = '青秀区';
  469. }
  470. function Add() {
  471. var input1 = 0, input2 = 0;
  472. input1 = parseInt(document.getElementById("sent_review_amount").value);
  473. input2 = parseInt(document.getElementById("authorize_amount").value);
  474. if (input1 && input2) {
  475. var aa = input2 - input1;
  476. var bb = aa / input1 * 100;
  477. bb = bb.toFixed(2);
  478. $('[name="review_add_reduce_amount"]').val(aa);
  479. $('[name="review_add_reduce_rate"]').val(bb);
  480. $('#review_add_reduce_amount').html(aa);
  481. $('#review_add_reduce_rate').html(bb)
  482. } else {
  483. $('[name="review_add_reduce_amount"]').val('');
  484. $('[name="review_add_reduce_rate"]').val('');
  485. $('#review_add_reduce_amount').html('');
  486. $('#review_add_reduce_rate').html('')
  487. }
  488. // 总审定金额-总送审金额
  489. }
  490. function gouguInit() {
  491. var form = layui.form, tool = layui.tool, oaTool = layui.oaTool;
  492. let adress;
  493. //日期选择
  494. layui.laydate.render({
  495. elem: '#date',
  496. range: ['#start_time', '#end_time'],
  497. rangeLinked: true
  498. });
  499. $(".review_unit").hide();
  500. //radio选择
  501. form.on('radio(tax)', function (data) {
  502. if (data.value == "财政资金") {
  503. console.log(1)
  504. $(".entrust_unit").show();
  505. $(".review_unit").hide();
  506. } else {
  507. $(".review_unit").show();
  508. $(".entrust_unit").hide();
  509. }
  510. });
  511. $('.customer-picker').on('click', function () {
  512. let that = $(this);
  513. let callback = function(data){
  514. console.log(data);
  515. $('[name="review_unit"]').val(data.id);
  516. $('[name="review_unit_name"]').val(data.title);
  517. }
  518. oaTool.customerPicker(callback);
  519. });
  520. $('.get-entrust').on('click', function () {
  521. let that = $(this);
  522. let callback = function(data){
  523. console.log(data);
  524. $('[name="entrust_unit"]').val(data.id);
  525. $('[name="entrust_unit_name"]').val(data.title);
  526. }
  527. oaTool.getEntrust(callback);
  528. });
  529. let c = 1;
  530. //监听提交
  531. form.on('submit(add)', function (data) {
  532. if(data.field.fiscal_nature=="财政资金"){
  533. if(data.field.entrust_unit==""&&data.field.entrust_unit_name==""){
  534. layer.msg("请选择委托单位")
  535. return false;
  536. }
  537. }else {
  538. if(data.field.review_unit==""&&data.field.review_unit_name==""){
  539. layer.msg("请选择评审单位")
  540. return false;
  541. }
  542. }
  543. if (c) {
  544. let callback = function (e) {
  545. c = 1
  546. layer.msg(e.msg);
  547. if (e.code == 0) {
  548. tool.sideClose(1000);
  549. }
  550. }
  551. var engineering_type1 = '';
  552. if (data.field.engineering_type1 == 1) {
  553. engineering_type1 = '预算';
  554. } else if (data.field.engineering_type1 == 2) {
  555. engineering_type1 = '结算';
  556. }
  557. var engineering_type2 = '';
  558. if (data.field.engineering_type2 == 1) {
  559. engineering_type2 = '审核';
  560. } else if (data.field.engineering_type2 == 2) {
  561. engineering_type2 = '编制';
  562. }
  563. if(engineering_type1!==""&&engineering_type2!==""){
  564. data.field.engineering_type = engineering_type1 + "-" + engineering_type2;
  565. }
  566. data.field.file_ids = file_ids;
  567. tool.post("/admin/project.cost_proprietor/add", data.field, callback);
  568. }
  569. c = 0
  570. return false;
  571. });
  572. form.on('submit(save)', function (data) {
  573. if(c){
  574. let callback = function (e) {
  575. layer.msg(e.msg);
  576. if (e.code == 0) {
  577. tool.sideClose(1000);
  578. c = 1
  579. }
  580. }
  581. var engineering_type1 ='';
  582. if(data.field.engineering_type1==1){
  583. engineering_type1 ='预算';
  584. }else if(data.field.engineering_type1==2){
  585. engineering_type1 ='结算';
  586. }
  587. var engineering_type2 = '';
  588. if(data.field.engineering_type2==1){
  589. engineering_type2 ='审核';
  590. }else if(data.field.engineering_type2==2) {
  591. engineering_type2 = '编制';
  592. }
  593. if(engineering_type1!==""&&engineering_type2!==""){
  594. data.field.engineering_type = engineering_type1 + "-" + engineering_type2;
  595. }
  596. data.field.file_ids = file_ids;
  597. console.log("!!!");
  598. tool.post("/admin/project.cost_proprietor/save", data.field, callback);
  599. }
  600. c = 0
  601. return false;
  602. });
  603. function fileCard(item){
  604. var host = window.location.host;
  605. var li = '';
  606. if(item.length>0){
  607. for(var a=0;a<item.length;a++){
  608. let image = ['jpg','jpeg','png','gif'];
  609. let doc = ['doc','docx','xls','xlsx','ppt','pptx','txt','pdf','zip','rar','7z'];
  610. // let down = '<a href="'+item[a].filepath+'" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal" download="'+item[a].name+'">下载</a>';
  611. let down ='<a href="' + item[a]['filepath'] + '" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal" download="' + item[a]['name'] + '">预览</a>';
  612. // 判断元素是否在数组中
  613. let path='/static/home/images/icon/file.png';
  614. if (image.includes(item[a].fileext)) {
  615. path=item[a].filepath;
  616. down = '<span data-href="'+item[a].filepath+'" class="layui-btn layui-btn-xs layui-btn-normal file-view-img">预览</span>';
  617. } else if (doc.includes(item[a].fileext)){
  618. path='/static/home/images/icon/'+item[a].fileext+'.png';
  619. }
  620. if(item[a].fileext == 'pdf'){
  621. down = '<span data-href="'+item[a].filepath+'" class="layui-btn layui-btn-xs layui-btn-normal file-view-pdf">预览</span>';
  622. }
  623. 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+
  624. '" style="object-fit: contain;" class="file-item"><p title="'+item[a].name+'">'+item[a].name+
  625. '</p><div class="layui-btn-group">'+ down +
  626. '<span class="layui-btn layui-btn-xs layui-btn-danger file-del">删除</span></div></li>';
  627. }
  628. return li;
  629. }
  630. }
  631. var file_ids = [];
  632. $('#filesBox').on('click','.file-del',function(){
  633. let id = $(this).parent().parent().data('id');
  634. layer.confirm('确定要删除该文件吗?', { icon: 3, title: '提示' }, function () {
  635. layer.closeAll();
  636. var index = file_ids.indexOf(id);
  637. if (index > -1) {
  638. file_ids.splice(index, 1);
  639. }
  640. if(file_ids.length == 0){
  641. $("#filesBox").append('<div id="nofile" class="layui-data-none" >暂无附件</div>');
  642. }
  643. console.log(file_ids);
  644. $("#" + id).remove();
  645. });
  646. })
  647. oaTool.addFile({
  648. type: 1,
  649. isSave: true,
  650. ajaxSave: function (res) {
  651. let callback = function (e) {
  652. if (e.hasOwnProperty("msg")) {
  653. layer.msg(e.msg);
  654. }else{
  655. layer.msg('上传成功!')
  656. }
  657. $('#nofile').remove();
  658. $("#filesBox").append(fileCard(e));
  659. file_ids.push(e[0].id)
  660. }
  661. tool.post("/admin/project.api/add_file", {
  662. 'file_id': res.data.id,
  663. }, callback);
  664. }
  665. });
  666. $('#filesBox2').on('click', '.file-del', function () {
  667. let id = $(this).parent().parent().data('id');
  668. layer.confirm('确定要删除该文件吗?请慎重', {icon: 3, title: '提示'}, function () {
  669. var index = file_ids.indexOf(id);
  670. if (index > -1) {
  671. file_ids.splice(index, 1);
  672. }
  673. if(file_ids.length == 0){
  674. $("#filesBox").append('<div id="nofile" class="layui-data-none" >暂无附件</div>');
  675. }
  676. console.log(file_ids);
  677. $("#" + id).remove();
  678. });
  679. })
  680. layui.use(['form', 'jquery'], function () {
  681. var form = layui.form;
  682. const $ = layui.jquery;
  683. let adress;
  684. $.ajax({
  685. type: "get", //使用get方式
  686. url: "/static/assets/layui/adress.json", //json文件相对于这个HTML的路径
  687. dataType: "json",
  688. async: false,
  689. success: function (data) {
  690. //这个data就是json数据
  691. adress = data
  692. var province = Object.keys(adress)
  693. var proStrs = '<option value="">省</option>';
  694. for (var i = 0; i < province.length; i++) {
  695. proStrs += '<option value="' + province[i] + '">' + province[i] + '</option>';
  696. }
  697. $("#province").html(proStrs);
  698. layui.form.render("select")
  699. },
  700. error: function () {
  701. layer.alert("地址请求失败!! ");
  702. }
  703. });
  704. function getFirstAttr(obj) {
  705. for (var k in obj) return k;
  706. }
  707. function selectOption(selectedProvince, selectedCity = '', selectedArea = '') {
  708. var proStr = '<option value="">省</option>', cityStr = '<option value="">市</option>',
  709. areaStr = '<option value="">县</option>';
  710. var pro = adress[selectedProvince], ci = adress[selectedProvince][selectedCity];
  711. for (var province in adress) {
  712. if (province == selectedProvince) proStr += '<option value="' + province + '" selected>' + province + '</option>';
  713. else proStr += '<option value="' + province + '">' + province + '</option>';
  714. }
  715. $("#province").html(proStr);
  716. for (var city in pro) {
  717. if (city == selectedCity) cityStr += '<option value="' + city + '" selected>' + city + '</option>';
  718. else cityStr += '<option value="' + city + '">' + city + '</option>';
  719. }
  720. $("#city").html(cityStr);
  721. for (var area in ci) {
  722. if (area == "remove") {
  723. continue;
  724. }
  725. if (ci[area] == selectedArea) areaStr += '<option value="' + ci[area] + '" selected>' + ci[area] + '</option>';
  726. else areaStr += '<option value="' + ci[area] + '">' + ci[area] + '</option>';
  727. }
  728. $("#area").html(areaStr);
  729. form.render();
  730. }
  731. /*selectOption(1,2, 3);*/
  732. form.on('select(province)', function (data) {
  733. let thisProvince = data.value;
  734. let thisCity = getFirstAttr(adress[thisProvince]);
  735. selectOption(data.value);
  736. });
  737. form.on('select(city)', function (data) {
  738. selectOption($("#province").val(), data.value, getFirstAttr(data.value));
  739. });
  740. })
  741. }
  742. </script>
  743. <!-- /脚本 -->
  744. <!-- <script src="/static/assets/layui/layui.js"></script> -->
  745. <script src="/static/assets/layui/layui.js"></script>
  746. <script src="/static/assets/third_party/echart/echarts.min.js"></script>
  747. <script src="/static/assets/gougu/gouguInit.js"></script>
  748. <script src="https://unpkg.com/pinyin-pro"></script>
  749. <script>
  750. var { pinyin } = pinyinPro;
  751. </script>
  752. <!-- 统计代码 -->
  753. <!-- /统计代码 -->
  754. </body>
  755. </html>