form.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. {extend name='main'}
  2. {block name="button"}
  3. {if auth("add")}
  4. <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>
  5. {/if}
  6. {/block}
  7. {block name="content"}
  8. <form onsubmit="return false;" id="GoodsForm" data-auto="true" method="post" class='layui-form layui-card' autocomplete="off">
  9. <div class="layui-card-body think-box-shadow padding-left-40">
  10. <div class="layui-form-item layui-row layui-col-space15">
  11. <label class="layui-col-xs3 relative">
  12. <span class="color-green">选择主项目</span>
  13. <select name='main_project_id' class='layui-select' required lay-verify="required" lay-search>
  14. <option value=''>请选择</option>
  15. {if isset($vo.id)}
  16. <!--{foreach $main_list as $menu}-->
  17. <!--{eq name='menu.id' value='$vo.main_project_id'}-->
  18. <option selected value='{$menu.id}'>{$menu.project_name}</option>
  19. <!--{else}-->
  20. <option value='{$menu.id}'>{$menu.project_name}</option>
  21. <!--{/eq}-->
  22. <!--{/foreach}-->
  23. {else}
  24. <!--{foreach $main_list as $menu}-->
  25. <option value='{$menu.id}'>{$menu.project_name}</option>
  26. <!--{/foreach}-->
  27. {/if}
  28. </select>
  29. </label>
  30. <label class="layui-col-xs3 relative">
  31. <span class="color-green">项目名称</span>
  32. <input name="project_name" required class="layui-input" placeholder="请输入项目名称" value="{$vo.project_name|default=''}">
  33. </label>
  34. <label class="layui-col-xs3 relative">
  35. <span class="color-green">建筑分类</span>
  36. <select name='category_id' class='layui-select' required lay-verify="required" lay-search>
  37. <option value=''>请选择</option>
  38. {if isset($vo.id)}
  39. <!--{foreach $menus as $menu}-->
  40. <!--{eq name='menu.id' value='$vo.category_id'}-->
  41. <option selected value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
  42. <!--{else}-->
  43. <option value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
  44. <!--{/eq}-->
  45. <!--{/foreach}-->
  46. {else}
  47. <!--{foreach $menus as $menu}-->
  48. <option value='{$menu.id}'>{$menu.spl|raw}{$menu.title}</option>
  49. <!--{/foreach}-->
  50. {/if}
  51. </select>
  52. </label>
  53. <label class="layui-col-xs3 relative">
  54. <span class="color-green">建筑高度</span>
  55. <input name="building_height" required class="layui-input" placeholder="请输入建筑高度" value="{$vo.building_height|default=''}">
  56. </label>
  57. </div>
  58. <div class="layui-form-item layui-row layui-col-space15">
  59. <label class="layui-col-xs3 relative">
  60. <span class="color-green">建筑层数</span>
  61. <input name="construction_layer" required class="layui-input" placeholder="请输入建筑层数" value="{$vo.construction_layer|default=''}">
  62. </label>
  63. <label class="layui-col-xs3 relative">
  64. <span class="color-green">地上层数</span>
  65. <input name="upper_number" required class="layui-input" placeholder="请输入地上层数" value="{$vo.upper_number|default=''}">
  66. </label>
  67. <label class="layui-col-xs3 relative">
  68. <span class="color-green">地下层数</span>
  69. <input name="underground" class="layui-input" placeholder="请输入地下层数" value="{$vo.underground|default=''}">
  70. </label>
  71. <label class="layui-col-xs3 relative">
  72. <span class="color-green">地下层高</span>
  73. <input name="underground_layer" class="layui-input" placeholder="请输入地下层高" value="{$vo.underground_layer|default=''}">
  74. </label>
  75. </div>
  76. <div class="layui-form-item layui-row layui-col-space15">
  77. <label class="layui-col-xs3 relative">
  78. <span class="color-green">首层层高</span>
  79. <input name="first_layer_high" class="layui-input" placeholder="请输入首层层高" value="{$vo.first_layer_high|default=''}">
  80. </label>
  81. <label class="layui-col-xs3 relative">
  82. <span class="color-green">标准层层高</span>
  83. <input name="standard_height" class="layui-input" placeholder="请输入标准层层高" value="{$vo.standard_height|default=''}">
  84. </label>
  85. <label class="layui-col-xs3 relative">
  86. <span class="color-green">结构类型</span>
  87. <select name="structure_type" required class="province-selector layui-select" id="structure_type" lay-verify="required" lay-search >
  88. <option value="">请选择</option>
  89. {if isset($vo.id) && $vo.id neq ''}
  90. {foreach ['框架结构'=>'框架结构','剪力墙结构'=>'剪力墙结构','框架剪力墙结构'=>'框架剪力墙结构','断肢剪力墙结构'=>'断肢剪力墙结构','砖混结构'=>'砖混结构','钢结构'=>'钢结构','装配式混泥土结构'=>'装配式混泥土结构','框架简体结构'=>'框架简体结构'] as $k=>$v}
  91. {if $v eq $vo.structure_type}
  92. <option selected value="{$k}">{$v}</option>
  93. {else}
  94. <option value="{$k}">{$v}</option>
  95. {/if}
  96. {/foreach}
  97. {else}
  98. {foreach ['框架结构'=>'框架结构','剪力墙结构'=>'剪力墙结构','框架剪力墙结构'=>'框架剪力墙结构','断肢剪力墙结构'=>'断肢剪力墙结构','砖混结构'=>'砖混结构','钢结构'=>'钢结构','装配式混泥土结构'=>'装配式混泥土结构','框架简体结构'=>'框架简体结构'] as $k=>$v}
  99. <option value="{$k}">{$v}</option>
  100. {/foreach}
  101. {/if}
  102. </select>
  103. </label>
  104. <label class="layui-col-xs3 relative">
  105. <span class="color-green">建筑设防烈度</span>
  106. <select name="building_fortification_intensity" required class="province-selector layui-select" id="building_fortification_intensity" lay-verify="required" lay-search >
  107. <option value="">请选择</option>
  108. {if isset($vo.id) && $vo.id neq ''}
  109. {foreach ['6度'=>'6度','7度'=>'7度','8度'=>'8度','9度'=>'9度'] as $k=>$v}
  110. {if $v eq $vo.building_fortification_intensity}
  111. <option selected value="{$k}">{$v}</option>
  112. {else}
  113. <option value="{$k}">{$v}</option>
  114. {/if}
  115. {/foreach}
  116. {else}
  117. {foreach ['6度'=>'6度','7度'=>'7度','8度'=>'8度','9度'=>'9度'] as $k=>$v}
  118. <option value="{$k}">{$v}</option>
  119. {/foreach}
  120. {/if}
  121. </select>
  122. </label>
  123. </div>
  124. <div class="layui-form-item layui-row layui-col-space15">
  125. <label class="layui-col-xs3 relative">
  126. <span class="color-green">抗震等级</span>
  127. <select name="seismic_grade" required class="province-selector layui-select" id="seismic_grade" lay-verify="required" lay-search >
  128. <option value="">请选择</option>
  129. {if isset($vo.id) && $vo.id neq ''}
  130. {foreach ['一级'=>'一级','二级'=>'二级','三级'=>'三级','四级'=>'四级'] as $k=>$v}
  131. {if $v eq $vo.seismic_grade}
  132. <option selected value="{$k}">{$v}</option>
  133. {else}
  134. <option value="{$k}">{$v}</option>
  135. {/if}
  136. {/foreach}
  137. {else}
  138. {foreach ['一级'=>'一级','二级'=>'二级','三级'=>'三级','四级'=>'四级'] as $k=>$v}
  139. <option value="{$k}">{$v}</option>
  140. {/foreach}
  141. {/if}
  142. </select>
  143. </label>
  144. <label class="layui-col-xs3 relative">
  145. <span class="color-green">设计寿命</span>
  146. <input name="design_life" class="layui-input" placeholder="请输入设计寿命" value="{$vo.design_life|default=''}">
  147. </label>
  148. <label class="layui-col-xs3 relative">
  149. <span class="color-green">基础类型</span>
  150. <select name="base_type" required class="province-selector layui-select" id="base_type" lay-verify="required" lay-search >
  151. <option value="">请选择</option>
  152. {if isset($vo.id) && $vo.id neq ''}
  153. {foreach ['不包含'=>'不包含','独立基础'=>'独立基础','条形基础'=>'条形基础','满堂基础'=>'满堂基础','桩基础'=>'桩基础','桩承台基础'=>'桩承台基础','混合基础'=>'混合基础','带形基础'=>'带形基础','筏板基础'=>'筏板基础','砖基础'=>'砖基础'] as $k=>$v}
  154. {if $v eq $vo.base_type}
  155. <option selected value="{$k}">{$v}</option>
  156. {else}
  157. <option value="{$k}">{$v}</option>
  158. {/if}
  159. {/foreach}
  160. {else}
  161. {foreach ['不包含'=>'不包含','独立基础'=>'独立基础','条形基础'=>'条形基础','满堂基础'=>'满堂基础','桩基础'=>'桩基础','桩承台基础'=>'桩承台基础','混合基础'=>'混合基础','带形基础'=>'带形基础','筏板基础'=>'筏板基础','砖基础'=>'砖基础'] as $k=>$v}
  162. <option value="{$k}">{$v}</option>
  163. {/foreach}
  164. {/if}
  165. </select>
  166. </label>
  167. <label class="layui-col-xs3 relative">
  168. <span class="color-green">装修标准</span>
  169. <input name="decorate_standard" class="layui-input" placeholder="请输入装修标准" value="{$vo.decorate_standard|default=''}">
  170. </label>
  171. </div>
  172. <div class="layui-form-item layui-row layui-col-space15">
  173. <label class="layui-col-xs3 relative">
  174. <span class="color-green">其他参数</span>
  175. <input name="other_parameters" class="layui-input" placeholder="请输入其他参数" value="{$vo.other_parameters|default=''}">
  176. </label>
  177. <label class="layui-col-xs3 relative">
  178. <span class="color-green">建筑面积</span>
  179. <input name="construction_area" required class="layui-input" placeholder="请输入建筑面积" value="{$vo.construction_area|default=''}">
  180. </label>
  181. <label class="layui-col-xs3 relative">
  182. <span class="color-green">地上建筑面积</span>
  183. <input name="ground_floor_area" required class="layui-input" placeholder="请输入地上建筑面积" value="{$vo.ground_floor_area|default=''}">
  184. </label>
  185. <label class="layui-col-xs3 relative">
  186. <span class="color-green">地下建筑面积</span>
  187. <input name="underground_floor_area" required class="layui-input" placeholder="请输入地下建筑面积" value="{$vo.underground_floor_area|default=''}">
  188. </label>
  189. </div>
  190. <div class="layui-form-item layui-row layui-col-space15">
  191. <label class="layui-col-xs3 relative">
  192. <span class="color-green">建筑占地面积</span>
  193. <input name="building_floor_area" class="layui-input" placeholder="请输入建筑占地面积" value="{$vo.building_floor_area|default=''}">
  194. </label>
  195. <label class="layui-col-xs3 relative">
  196. <span class="color-green">钢结构受益面积</span>
  197. <input name="steel_benefit_area" class="layui-input" placeholder="请输入钢结构受益面积" value="{$vo.steel_benefit_area|default=''}">
  198. </label>
  199. <label class="layui-col-xs3 relative">
  200. <span class="color-green">木质构件面积</span>
  201. <input name="wood_area" class="layui-input" placeholder="请输入木质构件面积" value="{$vo.wood_area|default=''}">
  202. </label>
  203. <label class="layui-col-xs3 relative">
  204. <span class="color-green">可售面积</span>
  205. <input name="available_area" class="layui-input" placeholder="请输入可售面积" value="{$vo.available_area|default=''}">
  206. </label>
  207. </div>
  208. <div class="layui-form-item layui-row layui-col-space15">
  209. <label class="layui-col-xs3 relative">
  210. <span class="color-green">户数</span>
  211. <input name="number" class="layui-input" placeholder="请输入户数" value="{$vo.number|default=''}">
  212. </label>
  213. <label class="layui-col-xs3 relative">
  214. <span class="color-green">地下室底面积</span>
  215. <input name="basement_floor_area" class="layui-input" placeholder="请输入地下室底面积" value="{$vo.basement_floor_area|default=''}">
  216. </label>
  217. <label class="layui-col-xs3 relative">
  218. <span class="color-green">其他说明</span>
  219. <input name="other_instructions" class="layui-input" placeholder="请输入其他说明" value="{$vo.other_instructions|default=''}">
  220. </label>
  221. <label class="layui-col-xs3 relative">
  222. <span class="color-green">模板类型</span>
  223. <select name='template' class='layui-select' required lay-verify="required" lay-search>
  224. <option value=''>请选择</option>
  225. {if isset($vo.id)}
  226. <!--{foreach $template as $menu}-->
  227. <!--{eq name='menu.id' value='$vo.template'}-->
  228. <option selected value='{$menu.id}'>{$menu.title}</option>
  229. <!--{else}-->
  230. <option value='{$menu.id}'>{$menu.title}</option>
  231. <!--{/eq}-->
  232. <!--{/foreach}-->
  233. {else}
  234. <!--{foreach $template as $menu}-->
  235. <option value='{$menu.id}'>{$menu.title}</option>
  236. <!--{/foreach}-->
  237. {/if}
  238. </select>
  239. </label>
  240. </div>
  241. <div class="layui-form-item text-center">
  242. {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}
  243. {notempty name='vo.id'}<input type="hidden" name="id" value="{$vo.id}">{/notempty}
  244. <button class="layui-btn layui-btn-danger" ng-click="hsitoryBack()" onclick="window.history.back()" type="button">取消</button>
  245. <button class="layui-btn" type="submit" lay-submit >确定</button>
  246. </div>
  247. </div>
  248. </form>
  249. {/block}
  250. {block name='script'}
  251. <script>
  252. window.form.render();
  253. layui.use(['form', 'layedit', 'laydate'], function(){
  254. var form = layui.form
  255. ,layer = layui.layer
  256. ,layedit = layui.layedit
  257. ,laydate = layui.laydate;
  258. //常规用法
  259. laydate.render({
  260. elem: '#test1'
  261. });
  262. laydate.render({
  263. elem: '#test2',
  264. done:function (value,date) {
  265. var endtime = $("#test3").val()
  266. if (endtime!=''){
  267. changeday(value,endtime)
  268. }
  269. }
  270. });
  271. laydate.render({
  272. elem: '#test3',
  273. done:function (value,date) {
  274. var starttime = $("#test2").val()
  275. if (starttime!=''){
  276. changeday(starttime,value)
  277. }
  278. }
  279. });
  280. form.on('select(province)', function (data) {
  281. var val = data.value;
  282. console.log(val)
  283. $.ajax({
  284. type:"get",
  285. url:"{:url('MainProject/get_city')}", //数据传输的控制器方法
  286. data: {id:val},//这里data传递过去的是序列化以后的字符串
  287. success:function(data){
  288. //console.log(data)
  289. var arr = data.data;
  290. //console.log(arr)
  291. if (arr.length>0){
  292. //$("#tow").attr("style","display:block;");//显示div
  293. var options='<option value="">请选择市</option>';
  294. for (var i = 0; i < arr.length; i++) {
  295. var tag = arr[i];
  296. options+=' <option value="'+tag.name+'">'+tag.name+'</option>';
  297. }
  298. $("select[name='construction_site_city']").html(options)
  299. form.render('select');
  300. }else {
  301. var options='<option value="">请选择市</option>';
  302. $("select[name='construction_site_city']").html(options)
  303. form.render('select');
  304. }
  305. }
  306. });
  307. });
  308. form.on('select(city)', function (data) {
  309. var val = data.value;
  310. // console.log(val)
  311. $.ajax({
  312. type:"get",
  313. url:"{:url('MainProject/get_area')}", //数据传输的控制器方法
  314. data: {id:val},//这里data传递过去的是序列化以后的字符串
  315. success:function(data){
  316. //console.log(data)
  317. var arr = data.data;
  318. // console.log(arr)
  319. if (arr.length>0){
  320. var options='<option value="">请选择区</option>';
  321. for (var i = 0; i < arr.length; i++) {
  322. var tag = arr[i];
  323. options+=' <option value="'+tag.name+'">'+tag.name+'</option>';
  324. }
  325. $("select[name='construction_site_area']").html(options)
  326. form.render('select');
  327. }else {
  328. var options='<option value="">请选择区</option>';
  329. $("select[name='construction_site_area']").html(options)
  330. form.render('select');
  331. }
  332. }
  333. });
  334. });
  335. });
  336. function changeday(startdate,enddate) {
  337. var day = 0;
  338. if (startdate==enddate){
  339. day = 1;
  340. }else if (startdate>enddate){
  341. day = 0;
  342. }else {
  343. day = getDaysBetween(startdate,enddate) + 1
  344. }
  345. $("#project_time").attr("value",day);
  346. }
  347. //计算两个日期相差的天数
  348. function getDaysBetween(dateString1,dateString2){
  349. var startDate = Date.parse(dateString1);
  350. var endDate = Date.parse(dateString2);
  351. if (startDate>endDate){
  352. return 0;
  353. }
  354. if (startDate==endDate){
  355. return 1;
  356. }
  357. var days=(endDate - startDate)/(1*24*60*60*1000);
  358. return days;
  359. }
  360. </script>
  361. {/block}