form.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. {extend name='main'}
  2. {block name="button"}
  3. <button class="layui-btn" style="height: 30px;line-height:28px;background-color:#DC2219;color: #FFFFFF;border: 1px solid #C9C9C9 " type='button' onclick="window.history.back()">返 回</button>
  4. {/block}
  5. {block name="content"}
  6. <style>
  7. .layui-anim .layui-anim-fadein{
  8. display: none !important;
  9. }
  10. </style>
  11. <form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
  12. <div class="layui-card-body think-box-shadow padding-left-40">
  13. <div class="layui-form-item layui-row layui-col-space15">
  14. <label class="layui-col-xs3 relative">
  15. <span class="color-green">项目名称</span>
  16. <input name="project_name" required class="layui-input" placeholder="请输入项目名称" value="{$vo.project_name|default=''}">
  17. </label>
  18. <label class="layui-col-xs3 relative">
  19. <span class="color-green">造价类别</span>
  20. <select name="cost_categories" required class="province-selector layui-select" id="cost_categories" lay-verify="required" lay-search >
  21. <option value="">请选择</option>
  22. {if isset($vo.id) && $vo.id neq ''}
  23. {foreach ['投标价'=>'投标价','合同价'=>'合同价','结算价'=>'结算价','重计量'=>'重计量','清单控制价'=>'清单控制价','估算'=>'估算','概算'=>'概算','其他'=>'其他','目标成本'=>'目标成本'] as $k=>$v}
  24. {if $v eq $vo.cost_categories}
  25. <option selected value="{$k}">{$v}</option>
  26. {else}
  27. <option value="{$k}">{$v}</option>
  28. {/if}
  29. {/foreach}
  30. {else}
  31. {foreach ['投标价'=>'投标价','合同价'=>'合同价','结算价'=>'结算价','重计量'=>'重计量','清单控制价'=>'清单控制价','估算'=>'估算','概算'=>'概算','其他'=>'其他','目标成本'=>'目标成本'] as $k=>$v}
  32. <option value="{$k}">{$v}</option>
  33. {/foreach}
  34. {/if}
  35. </select>
  36. </label>
  37. <label class="layui-col-xs3 relative">
  38. <span class="color-green">编制日期</span>
  39. <input required type="text" class="layui-input" name="prepare_date" value="{$vo.prepare_date|default=''}" id="test1" placeholder="yyyy-MM-dd">
  40. </label>
  41. <label class="layui-col-xs3 relative">
  42. <span class="color-green">模板类型</span>
  43. <select name='template' class='layui-select' required lay-verify="required" lay-search>
  44. <option value=''>请选择</option>
  45. {if isset($vo.id)}
  46. <!--{foreach $template as $menu}-->
  47. <!--{eq name='menu.id' value='$vo.template'}-->
  48. <option selected value='{$menu.id}'>{$menu.title}</option>
  49. <!--{else}-->
  50. <option value='{$menu.id}'>{$menu.title}</option>
  51. <!--{/eq}-->
  52. <!--{/foreach}-->
  53. {else}
  54. <!--{foreach $template as $menu}-->
  55. <option value='{$menu.id}'>{$menu.title}</option>
  56. <!--{/foreach}-->
  57. {/if}
  58. </select>
  59. </label>
  60. </div>
  61. <div class="layui-form-item layui-row layui-col-space15">
  62. <label class="layui-col-xs3 relative">
  63. <span class="color-green">清单编制依据</span>
  64. <input name="basis_for_listing" class="layui-input" placeholder="请输入清单编制依据" value="{$vo.basis_for_listing|default=''}">
  65. </label>
  66. <label class="layui-col-xs3 relative">
  67. <span class="color-green">工程范围</span>
  68. <input name="project_scope" class="layui-input" placeholder="请输入工程范围" value="{$vo.project_scope|default=''}">
  69. </label>
  70. </div>
  71. <h3 style="margin-bottom: 15px">项目业态</h3>
  72. <div class="layui-form-item layui-row layui-col-space15">
  73. <label class="layui-col-xs3 relative">
  74. <span class="color-green">建筑分类</span>
  75. <select name='category_id' class='layui-select' required lay-verify="required" lay-search>
  76. <option value=''>请选择</option>
  77. {if isset($vo.id)}
  78. <!--{foreach $menus as $menu}-->
  79. <!--{eq name='menu.id' value='$vo.category_id'}-->
  80. <option selected value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
  81. <!--{else}-->
  82. <option value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
  83. <!--{/eq}-->
  84. <!--{/foreach}-->
  85. {else}
  86. <!--{foreach $menus as $menu}-->
  87. <option value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
  88. <!--{/foreach}-->
  89. {/if}
  90. </select>
  91. </label>
  92. <label class="layui-col-xs3 relative">
  93. <span class="color-green">工程类别</span>
  94. <select required name="engineering_category" class="province-selector" id="engineering_category" lay-verify="required" lay-search >
  95. <option value="">请选择</option>
  96. {if isset($vo.id) && $vo.id neq ''}
  97. {foreach ['新建工程'=>'新建工程','改扩建加固工程'=>'改扩建加固工程','其他'=>'其他'] as $k=>$v}
  98. {if $v eq $vo.engineering_category}
  99. <option selected value="{$k}">{$v}</option>
  100. {else}
  101. <option value="{$k}">{$v}</option>
  102. {/if}
  103. {/foreach}
  104. {else}
  105. {foreach ['新建工程'=>'新建工程','改扩建加固工程'=>'改扩建加固工程','其他'=>'其他'] as $k=>$v}
  106. <option value="{$k}">{$v}</option>
  107. {/foreach}
  108. {/if}
  109. </select>
  110. </label>
  111. <label class="layui-col-xs3 relative">
  112. <span class="color-green" required>建设地点</span>
  113. <div class="layui-form-item layui-row layui-col-space12">
  114. <label class="layui-col-xs4 relative">
  115. <select name="construction_site_province" class="province-selector" id="province" lay-filter="province" lay-verify="required" lay-search >
  116. <option value="">请选择省</option>
  117. {if isset($vo.id) && $vo.id neq ''}
  118. {foreach $province as $k=>$v}
  119. {if $v.name eq $vo.construction_site_province}
  120. <option selected value="{$v.name}">{$v.name}</option>
  121. {else}
  122. <option value="{$v.name}">{$v.name}</option>
  123. {/if}
  124. {/foreach}
  125. {else}
  126. {foreach $province as $k=>$v}
  127. <option value="{$v.name}">{$v.name}</option>
  128. {/foreach}
  129. {/if}
  130. </select>
  131. </label>
  132. <label class="layui-col-xs4 relative">
  133. <select name="construction_site_city" class="city-selector" data-value="" id="city" lay-filter="city" lay-verify="required" lay-search>
  134. <option value="">请选择市</option>
  135. {if isset($vo.id) && $vo.id neq ''}
  136. {foreach $city as $k=>$v}
  137. {if $v.name eq $vo.construction_site_city}
  138. <option selected value="{$v.name}">{$v.name}</option>
  139. {else}
  140. <option value="{$v.name}">{$v.name}</option>
  141. {/if}
  142. {/foreach}
  143. {/if}
  144. </select>
  145. </label>
  146. <label class="layui-col-xs4 relative">
  147. <select name="construction_site_area" class="county-selector" data-value="" id="area" lay-filter="area" lay-search>
  148. <option value="">请选择区</option>
  149. {if isset($vo.id) && $vo.id neq ''}
  150. {foreach $area as $k=>$v}
  151. {if $v.name eq $vo.construction_site_area}
  152. <option selected value="{$v.name}">{$v.name}</option>
  153. {else}
  154. <option value="{$v.name}">{$v.name}</option>
  155. {/if}
  156. {/foreach}
  157. {/if}
  158. </select>
  159. </label>
  160. </div>
  161. </label>
  162. <label class="layui-col-xs3 relative">
  163. <span class="color-green">标准(档次)</span>
  164. <input name="grade" class="layui-input" placeholder="请输入标准(档次)" value="{$vo.grade|default=''}">
  165. </label>
  166. </div>
  167. <h3 style="margin-bottom: 15px">项目总体特征</h3>
  168. <div class="layui-form-item layui-row layui-col-space15">
  169. <label class="layui-col-xs3 relative">
  170. <span class="color-green">建筑类别及组成</span>
  171. <input name="building_composition" class="layui-input" placeholder="请输入建筑类别及组成" value="{$vo.building_composition|default=''}">
  172. </label>
  173. <label class="layui-col-xs3 relative">
  174. <span class="color-green">总用地面积</span>
  175. <input name="total_land_area" class="layui-input" placeholder="请输入总用地面积" value="{$vo.total_land_area|default=''}">
  176. </label>
  177. <label class="layui-col-xs3 relative">
  178. <span class="color-green">总建筑面积</span>
  179. <input name="gross_floor_area" required class="layui-input" lay-verify="number" placeholder="请输入总建筑面积" value="{$vo.gross_floor_area|default=''}">
  180. </label>
  181. </div>
  182. <div class="layui-form-item layui-row layui-col-space15">
  183. <label class="layui-col-xs3 relative">
  184. <span class="color-green">地上面积</span>
  185. <input name="floor_area" required class="layui-input" lay-verify="number" placeholder="请输入地上面积" value="{$vo.floor_area|default=''}">
  186. </label>
  187. <label class="layui-col-xs3 relative">
  188. <span class="color-green">地下面积</span>
  189. <input name="underground_area" required class="layui-input" lay-verify="number" placeholder="请输入地下面积" value="{$vo.underground_area|default=''}">
  190. </label>
  191. <label class="layui-col-xs3 relative">
  192. <span class="color-green">建筑密度</span>
  193. <input name="building_density" class="layui-input" placeholder="请输入建筑密度" value="{$vo.building_density|default=''}">
  194. </label>
  195. <label class="layui-col-xs3 relative">
  196. <span class="color-green">绿化面积</span>
  197. <input name="green_area" class="layui-input" placeholder="请输入绿化面积" value="{$vo.green_area|default=''}">
  198. </label>
  199. </div>
  200. <div class="layui-form-item layui-row layui-col-space15">
  201. <label class="layui-col-xs3 relative">
  202. <span class="color-green">道路面积</span>
  203. <input name="road_area" class="layui-input" placeholder="请输入道路面积" value="{$vo.road_area|default=''}">
  204. </label>
  205. <label class="layui-col-xs3 relative">
  206. <span class="color-green">道路长度</span>
  207. <input name="road_length" class="layui-input" placeholder="请输入道路长度" value="{$vo.road_length|default=''}">
  208. </label>
  209. <label class="layui-col-xs3 relative">
  210. <span class="color-green">建筑分期或分期建设情况描述密度</span>
  211. <input name="case_description" class="layui-input" placeholder="请输入分期或分期建设情况描述" value="{$vo.case_description|default=''}">
  212. </label>
  213. <label class="layui-col-xs3 relative">
  214. <span class="color-green">功能参数</span>
  215. <input name="function_parameters" class="layui-input" placeholder="请输入功能参数" value="{$vo.function_parameters|default=''}">
  216. </label>
  217. </div>
  218. <div class="layui-form-item layui-row layui-col-space15">
  219. <label class="layui-col-xs3 relative">
  220. <span class="color-green">人防面积</span>
  221. <input name="defense" class="layui-input" placeholder="请输入人防面积" value="{$vo.defense|default=''}">
  222. </label>
  223. <label class="layui-col-xs3 relative">
  224. <span class="color-green">人防类型</span>
  225. <input name="defense_type" class="layui-input" placeholder="请输入人防类型" value="{$vo.defense_type|default=''}">
  226. </label>
  227. </div>
  228. <h3 style="margin-bottom: 15px">投融资模式</h3>
  229. <div class="layui-form-item layui-row layui-col-space15">
  230. <label class="layui-col-xs3 relative">
  231. <span class="color-green">投资主体</span>
  232. <input name="investment_subject" class="layui-input" placeholder="请输入投资主体" value="{$vo.investment_subject|default=''}">
  233. </label>
  234. <label class="layui-col-xs3 relative">
  235. <span class="color-green">资金来源</span>
  236. <input name="sources_funding" class="layui-input" placeholder="请输入资金来源" value="{$vo.sources_funding|default=''}">
  237. </label>
  238. <label class="layui-col-xs3 relative">
  239. <span class="color-green">承发包模式</span>
  240. <input name="contract_mode" class="layui-input" placeholder="请输入承发包模式" value="{$vo.contract_mode|default=''}">
  241. </label>
  242. <label class="layui-col-xs3 relative">
  243. <span class="color-green">组织管理模式</span>
  244. <input name="management_mode" class="layui-input" placeholder="请输入组织管理模式" value="{$vo.management_mode|default=''}">
  245. </label>
  246. </div>
  247. <h3 style="margin-bottom: 15px">项目主要参与单位</h3>
  248. <div class="layui-form-item layui-row layui-col-space15">
  249. <label class="layui-col-xs3 relative">
  250. <span class="color-green">业主</span>
  251. <input name="owner" class="layui-input" placeholder="请输入业主" value="{$vo.owner|default=''}">
  252. </label>
  253. <label class="layui-col-xs3 relative">
  254. <span class="color-green">总包</span>
  255. <input name="total_package" class="layui-input" placeholder="请输入总包" value="{$vo.total_package|default=''}">
  256. </label>
  257. </div>
  258. <h3 style="margin-bottom: 15px">日期</h3>
  259. <div class="layui-form-item layui-row layui-col-space15">
  260. <label class="layui-col-xs3 relative">
  261. <span class="color-green">开工时间</span>
  262. <input name="starting_time" readonly required class="layui-input" id="test2" placeholder="yyyy-MM-dd" value="{$vo.starting_time|default=''}">
  263. </label>
  264. <label class="layui-col-xs3 relative">
  265. <span class="color-green">竣工时间</span>
  266. <input name="ending_time" readonly required class="layui-input" id="test3" placeholder="yyyy-MM-dd" value="{$vo.ending_time|default=''}">
  267. </label>
  268. <label class="layui-col-xs3 relative">
  269. <span class="color-green">工期(单位:天)</span>
  270. <input name="project_time" readonly class="layui-input" id="project_time" placeholder="自动计算" value="{$vo.project_time|default=''}">
  271. </label>
  272. </div>
  273. <div class="layui-form-item layui-row layui-col-space15">
  274. <label class="layui-col-xs6 relative">
  275. <span class="color-green">获奖情况</span>
  276. <textarea placeholder="请输入" name="awards" class="layui-textarea">{$vo.awards|default=''}</textarea>
  277. </label>
  278. <label class="layui-col-xs6 relative">
  279. <span class="color-green">其他说明</span>
  280. <textarea placeholder="请输入" name="other_instructions" class="layui-textarea">{$vo.other_instructions|default=''}</textarea>
  281. </label>
  282. </div>
  283. <div class="layui-form-item text-center">
  284. {if isset($vo.id) && $vo.id neq ''}<input type='hidden' value="<?php echo date('Y-m-d H:i:s'); ?>" name='update_at'>{else}<input type='hidden' value="<?php echo date('Y-m-d H:i:s'); ?>" name='create_at'>{/if}
  285. {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
  286. <button class="layui-btn layui-btn-danger" ng-click="hsitoryBack()" onclick="window.history.back()" type="button">取消</button>
  287. <button class="layui-btn" type="submit" lay-submit >确定</button>
  288. </div>
  289. </div>
  290. </form>
  291. {/block}
  292. {block name='script'}
  293. <script>
  294. window.form.render();
  295. layui.config({
  296. base: 'static/modules/'
  297. }).extend({
  298. numinput: 'numinput/numinput'
  299. });
  300. layui.use(['form', 'layedit', 'laydate','numinput'], function(){
  301. var form = layui.form
  302. ,layer = layui.layer
  303. ,layedit = layui.layedit
  304. ,laydate = layui.laydate,
  305. numinp = layui.numinput;
  306. // numinp.init({
  307. // // 123:123键置顶, 789:789键置顶
  308. // topBtns: 789,
  309. // // 右侧功能按钮开关
  310. // rightBtns: false,
  311. // // 功能按钮提示开关
  312. // showTips: true,
  313. // // 是否监听键盘事件
  314. // listening: true,
  315. // // 批量配置默认小数精确度,默认 -1 不处理精确度,0 表示禁止输入小数
  316. // defaultPrec: -1,
  317. // // 初始化回调,无参
  318. // initEnd: $.noop,
  319. // // 触发显示回调,参数为当前输入框和数字键盘的 jQuery 对象
  320. // showEnd: $.noop,
  321. // // 隐藏键盘回调,参数为当前输入框的 jQuery 对象
  322. // hideEnd: $.noop,
  323. // // 自定义 z-index
  324. // zIndex: 19999999
  325. // });
  326. //常规用法
  327. laydate.render({
  328. elem: '#test1'
  329. });
  330. laydate.render({
  331. elem: '#test2',
  332. done:function (value,date) {
  333. var endtime = $("#test3").val()
  334. if (endtime!=''){
  335. changeday(value,endtime)
  336. }
  337. }
  338. });
  339. laydate.render({
  340. elem: '#test3',
  341. done:function (value,date) {
  342. var starttime = $("#test2").val()
  343. if (starttime!=''){
  344. changeday(starttime,value)
  345. }
  346. }
  347. });
  348. form.on('select(province)', function (data) {
  349. var val = data.value;
  350. console.log(val)
  351. $.ajax({
  352. type:"get",
  353. url:"{:url('MainProject/get_city')}", //数据传输的控制器方法
  354. data: {id:val},//这里data传递过去的是序列化以后的字符串
  355. success:function(data){
  356. //console.log(data)
  357. var arr = data.data;
  358. //console.log(arr)
  359. if (arr.length>0){
  360. //$("#tow").attr("style","display:block;");//显示div
  361. var options='<option value="">请选择市</option>';
  362. for (var i = 0; i < arr.length; i++) {
  363. var tag = arr[i];
  364. options+=' <option value="'+tag.name+'">'+tag.name+'</option>';
  365. }
  366. $("select[name='construction_site_city']").html(options)
  367. form.render('select');
  368. }else {
  369. var options='<option value="">请选择市</option>';
  370. $("select[name='construction_site_city']").html(options)
  371. form.render('select');
  372. }
  373. }
  374. });
  375. });
  376. form.on('select(city)', function (data) {
  377. var val = data.value;
  378. // console.log(val)
  379. $.ajax({
  380. type:"get",
  381. url:"{:url('MainProject/get_area')}", //数据传输的控制器方法
  382. data: {id:val},//这里data传递过去的是序列化以后的字符串
  383. success:function(data){
  384. //console.log(data)
  385. var arr = data.data;
  386. // console.log(arr)
  387. if (arr.length>0){
  388. var options='<option value="">请选择区</option>';
  389. for (var i = 0; i < arr.length; i++) {
  390. var tag = arr[i];
  391. options+=' <option value="'+tag.name+'">'+tag.name+'</option>';
  392. }
  393. $("select[name='construction_site_area']").html(options)
  394. form.render('select');
  395. }else {
  396. var options='<option value="">请选择区</option>';
  397. $("select[name='construction_site_area']").html(options)
  398. form.render('select');
  399. }
  400. }
  401. });
  402. });
  403. });
  404. function changeday(startdate,enddate) {
  405. var day = 0;
  406. if (startdate==enddate){
  407. day = 1;
  408. }else if (startdate>enddate){
  409. day = 0;
  410. }else {
  411. day = getDaysBetween(startdate,enddate) + 1
  412. }
  413. $("#project_time").attr("value",day);
  414. }
  415. //计算两个日期相差的天数
  416. function getDaysBetween(dateString1,dateString2){
  417. var startDate = Date.parse(dateString1);
  418. var endDate = Date.parse(dateString2);
  419. if (startDate>endDate){
  420. return 0;
  421. }
  422. if (startDate==endDate){
  423. return 1;
  424. }
  425. var days=(endDate - startDate)/(1*24*60*60*1000);
  426. return days;
  427. }
  428. </script>
  429. {/block}