contract_add.html 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  1. <!DOCTYPE HTML>
  2. <html xmlns:th="http://www.thymeleaf.org"
  3. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
  4. layout:decorate="~{admin/common/common}">
  5. <head>
  6. <title>新增合同</title>
  7. </head>
  8. <body layout:fragment="content">
  9. <style>
  10. .col-sm-2 {
  11. width: 13.666667%
  12. }
  13. .width-180 {
  14. width: 180px
  15. }
  16. /*.width-80 {*/
  17. /*width: 80px*/
  18. /*}*/
  19. .width-25 {
  20. width: 25px
  21. }
  22. .btn-primary {
  23. margin-top: 10px
  24. }
  25. .line {
  26. display: block;
  27. text-align: left;
  28. background-color: #fff;
  29. color: #333;
  30. border-bottom: 1px solid #0a6999;
  31. border-color: #fff;
  32. border-bottom: 1px solid #0a6999;
  33. margin-top: 10px;
  34. vertical-align: middle;
  35. padding: 4px 12px;
  36. height: 31px;
  37. line-height: 31px;
  38. font-size: 14px;
  39. font-weight: bold;
  40. }
  41. h4 {
  42. display: inline-block;
  43. line-height: 20px;
  44. vertical-align: top;
  45. margin-top: 0;
  46. }
  47. .error {
  48. display: inline-block;
  49. }
  50. .mt_10 {
  51. margin-top: 10px !important;
  52. }
  53. .ml_5 {
  54. margin-left: 5px !important;
  55. }
  56. </style>
  57. <article class="page-container">
  58. <form class="form form-horizontal" id="form-content-add">
  59. <div class="line">基本信息</div>
  60. <div class="row cl">
  61. <input type="hidden" name="is_tenancy" id="is_tenancy" value="false"/>
  62. <input type="hidden" name="is_property" id="is_property" value="false"/>
  63. <input type="hidden" name="is_parking" id="is_parking" value="false"/>
  64. <input type="hidden" name="is_water" id="is_water" value="false"/>
  65. <input type="hidden" name="is_electric" id="is_electric" value="false"/>
  66. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>合同编号:</label>
  67. <div class="formControls col-xs-8 col-sm-4">
  68. <input type="text" class="input-text" required maxlength="45" placeholder="请输入合同编号" th:id="contract_no"
  69. th:name="contract_no"/>
  70. </div>
  71. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>企业名称:</label>
  72. <div class="formControls col-xs-8 col-sm-4">
  73. <input type="text" readonly="readonly" style="width:78%" required placeholder="点击查找按钮查找公司"
  74. maxlength="45" class="input-text readonly" id="company_name" th:name="company_name"
  75. onchange="checkIsExistCompany()"/>
  76. <input type="hidden" th:name="company_id"/>
  77. <a class="btn btn-primary" style="margin-top:0px;"
  78. th:onclick="'javascript:contract_dialog(\'查找公司\',\'/build/contract/selectCompany\',\'800\',\'500\');'">
  79. <i class="Hui-iconfont">&#xe665;</i>查找</a>
  80. </div>
  81. </div>
  82. <div class="row cl company_contact">
  83. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系人:</label>
  84. <div class="formControls col-xs-8 col-sm-4">
  85. <input type="text" class="input-text contact" required maxlength="45" th:name="company_contact"/>
  86. </div>
  87. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>联系电话:</label>
  88. <div class="formControls col-xs-8 col-sm-4">
  89. <input type="text" class="input-text phone" required maxlength="45" th:name="company_phone"/>
  90. </div>
  91. </div>
  92. <div class="row cl">
  93. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>单位地址:</label>
  94. <div class="formControls col-xs-8 col-sm-4">
  95. <input type="text" class="input-text" required maxlength="45" th:name="location"/>
  96. </div>
  97. </div>
  98. <div class="row cl">
  99. <label class="form-label col-xs-4 col-sm-2"><span>合同上传:</span></label>
  100. <div class="formControls col-xs-8 col-sm-9">
  101. <div class="uploader-thum-container">
  102. <div id="fileListPre" class="uploader-list">
  103. </div>
  104. <div id="filePicker">选择合同</div>
  105. </div>
  106. </div>
  107. </div>
  108. <div class="row cl">
  109. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>合同生效日:</label>
  110. <div class="formControls col-xs-8 col-sm-4">
  111. <input type="text" th:name="contract_start_date" required
  112. id="datemax"
  113. class="input-text">
  114. </div>
  115. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>合同到期日:</label>
  116. <div class="formControls col-xs-8 col-sm-4">
  117. <input type="text" th:name="contract_end_date" required
  118. id="datemin" class="input-text">
  119. </div>
  120. </div>
  121. <div class="row cl">
  122. <label class="form-label col-xs-4 col-sm-2">备注:</label>
  123. <div class="formControls col-xs-8 col-sm-9">
  124. <textarea name="" cols="" rows="" th:name="remark" class="textarea" placeholder="说点什么..."
  125. dragonfly="true" onKeyUp="$.Huitextarealength(this,200)"></textarea>
  126. </div>
  127. </div>
  128. <div class="row cl">
  129. <label class="form-label col-xs-4 col-sm-2">选择需要填写的模块:</label>
  130. <input type="checkbox" class="type" value="1" th:text="房屋租赁" onclick="selectModal(this)">
  131. <input type="checkbox" class="type" value="2" th:text="水费" onclick="selectModal(this)">
  132. <input type="checkbox" class="type" value="3" th:text="电费" onclick="selectModal(this)">
  133. <input type="checkbox" class="type" value="4" th:text="物业费" onclick="selectModal(this)">
  134. <input type="checkbox" class="type" value="5" th:text="停车费" onclick="selectModal(this)">
  135. </div>
  136. <div id="tenancy_fee">
  137. <div class="line">房屋租赁</div>
  138. <div class="row cl">
  139. <div class="formControls col-xs-8 col-sm-12">
  140. <div><i class="Hui-iconfont hand" onclick="addFloorLine()">&#xe600;</i></div>
  141. <table class="table table-border table-bordered table-bg table-hover">
  142. <thead>
  143. <tr class="text-c">
  144. <th>楼栋</th>
  145. <th>层</th>
  146. <th>可用面积(平方米)</th>
  147. <th>面积(平方米)</th>
  148. <th>单价(元/月/平方米)</th>
  149. <th>备注</th>
  150. <th width="100">操作</th>
  151. </tr>
  152. </thead>
  153. <tbody class="add_floor_line">
  154. <tr class="text-c ">
  155. <td>
  156. <div class="formControls col-sm-12 text-left">
  157. <span class="select-box">
  158. <input type="hidden" class="floor_id" th:name="buildLives[0].floor_id"/>
  159. <select class="select build_number" th:name="buildLives[0].build_number"
  160. onchange="setAttr(this);">
  161. <option value="">--请选择--</option>
  162. <option th:attr="floor_id=${item.id}"
  163. th:each="item : ${buildings}" th:value="${item.build_number}"
  164. th:text="${item.build_number}">
  165. </option>
  166. </select>
  167. </span>
  168. </div>
  169. </td>
  170. <td>
  171. <div class="formControls col-sm-12 text-left">
  172. <span class="select-box">
  173. <select class="select floor" th:name="buildLives[0].floor"
  174. onchange="setAreaPrice(this);">
  175. <option value="">--请选择--</option>
  176. </select>
  177. </span>
  178. </div>
  179. </td>
  180. <td>
  181. <div class="formControls col-sm-12 text-left">
  182. <span class=" remain_area"></span>
  183. </div>
  184. </td>
  185. <td>
  186. <div class="formControls col-sm-12 text-left">
  187. <input type="text" class="input-text use_area" number="true"
  188. min="0" max="99999.9999" th:name="buildLives[0].use_area"
  189. onchange="getPaidFee();getTotalArea();"/>
  190. </div>
  191. </td>
  192. <td>
  193. <div class="formControls col-sm-12 text-left">
  194. <input type="text" class="input-text pay" max="999.99" number="true"
  195. min="0"
  196. th:name="buildLives[0].pay" onchange="getPaidFee()"/>
  197. </div>
  198. </td>
  199. <td>
  200. <div class="formControls col-sm-12 text-left">
  201. <input type="text" class="input-text remarks" maxlength="255"
  202. th:name="buildLives[0].remarks"/>
  203. </div>
  204. </td>
  205. <td class="icon_font"></td>
  206. </tr>
  207. </tbody>
  208. </table>
  209. </div>
  210. </div>
  211. <div class="row cl ">
  212. <label class="form-label col-xs-4 col-sm-2">已收房租:</label>
  213. <div class="formControls col-xs-8 col-sm-4">
  214. <div class="col-sm-4 nopadding">
  215. <input type="text" class="input-text width-180 notRequired" style="width:60%" th:id="paid_tenancy_month"
  216. digits="true" maxlength="2"
  217. th:name="paid_tenancy_month" onchange="getPaidFee()"/><span>个月,</span>
  218. </div>
  219. <div class="col-sm-8 nopadding">
  220. <span>共 </span>
  221. <input type="text" class="input-text readonly notRequired" readonly="readonly" style="width: 80%;"
  222. th:id="paid_tenancy" maxlength="20" number="true" min="0"
  223. th:name="paid_tenancy"/><span style="margin-left:3px">元</span>
  224. </div>
  225. </div>
  226. <label class="form-label col-xs-4 col-sm-2">总面积(m²):</label>
  227. <div class="formControls col-xs-8 col-sm-4">
  228. <input type="hidden" th:name="area" id="area"/>
  229. <span id="total_area"></span>
  230. </div>
  231. </div>
  232. <div class="row cl">
  233. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>押金(元):</label>
  234. <div class="formControls col-xs-8 col-sm-4">
  235. <input type="text" class="input-text" maxlength="10" number="true" min="0"
  236. th:name="deposit_fee"/>
  237. </div>
  238. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>收款周期:</label>
  239. <div class="formControls col-xs-8 col-sm-4">
  240. <input type="text" class="input-text width-180" th:id="tenancy_payment_cycle" digits="true"
  241. range="[1,12]"
  242. th:name="tenancy_payment_cycle"/><span>月一次</span>
  243. </div>
  244. <!-- <label class="form-label col-xs-4 col-sm-2">定金:</label>
  245. <div class="formControls col-xs-8 col-sm-4">
  246. <input type="text" class="input-text" maxlength="20" number="true" min="0" th:name="earnest_fee"/>
  247. </div> -->
  248. </div>
  249. </div>
  250. <div id="water_fee">
  251. <div class="line">水费</div>
  252. <div class="row cl">
  253. <div class="formControls col-xs-8 col-sm-12">
  254. <div><i class="Hui-iconfont hand" onclick="addWaterLine()">&#xe600;</i></div>
  255. <table class="table table-border table-bordered table-bg table-hover">
  256. <thead>
  257. <tr class="text-c">
  258. <th>水表</th>
  259. <th>初始读数</th>
  260. <!-- <th>水价</th> -->
  261. <th class="width-25">操作</th>
  262. </tr>
  263. </thead>
  264. <tbody class="add_water_line">
  265. <tr class="text-c ">
  266. <td>
  267. <div class="formControls col-sm-12 text-left">
  268. <select id="water_select_0" class="water_select"
  269. th:name="contractWaterList[0].water_id" onchange="checkWaterName(this)">
  270. <option value="">--请选择--</option>
  271. <option th:each="item : ${waters}" th:attr="is_common=${item.is_common}" th:value="${item.id}">
  272. [[*{item.name}]] <span class="ml_5" th:if="${item.is_common}">共用</span>
  273. </option>
  274. </select>
  275. </div>
  276. </td>
  277. <td>
  278. <div class="formControls col-sm-12 text-left">
  279. <input type="text" class="input-text start_water_meter_count"
  280. maxlength="10" number="true" min="0"
  281. th:name="contractWaterList[0].start_water_meter_count"/>
  282. </div>
  283. </td>
  284. <!-- <td><input type="text" class="input-text water_price"
  285. maxlength="20" number="true" min="0" th:name="contractWaterList[0].water_price"/></td> -->
  286. <td class="icon_font"></td>
  287. </tr>
  288. </tbody>
  289. </table>
  290. </div>
  291. </div>
  292. </div>
  293. <div id="electric_fee">
  294. <div class="line">电费</div>
  295. <div class="row cl">
  296. <div class="formControls col-xs-8 col-sm-12">
  297. <div><i class="Hui-iconfont hand" onclick="addElectricLine()">&#xe600;</i></div>
  298. <table class="table table-border table-bordered table-bg table-hover">
  299. <thead>
  300. <tr class="text-c">
  301. <th>电表</th>
  302. <th>初始读数</th>
  303. <th>初始峰值读数</th>
  304. <th>初始平峰读数</th>
  305. <th>初始谷值读数</th>
  306. <th class="width-25">操作</th>
  307. </tr>
  308. </thead>
  309. <tbody class="add_electric_line">
  310. <tr class="text-c ">
  311. <td>
  312. <div class="formControls col-sm-12 text-left">
  313. <select id="electric_select_0" class="electric_select"
  314. th:name="contractElectrics[0].electric_id" onchange="checkElectricName(this)">
  315. <option value="">--请选择--</option>
  316. <option th:each="item : ${electrics}" th:attr="is_common=${item.is_common},is_peak=${item.is_peak}" th:value="${item.id}">
  317. [[*{item.name}]] <span class="ml_5" th:if="${item.is_peak}">峰平谷值电表</span>
  318. <span class="ml_5" th:unless="${item.is_peak}">通用电表</span><span class="ml_5" th:if="${item.is_common}">共用</span>
  319. </option>
  320. </select>
  321. </div>
  322. </td>
  323. <td class="commonElectric">
  324. <div class="formControls col-sm-12 text-left">
  325. <input type="text" class="input-text start_electric_meter_count"
  326. maxlength="10" number="true" min="0"
  327. th:name="contractElectrics[0].start_electric_meter_count"/>
  328. </div>
  329. </td>
  330. <td class="peakValleyElectric">
  331. <div class="formControls col-sm-12 text-left">
  332. <input type="text" class="input-text start_electric_peak_count"
  333. disabled number="true" min="0" max="99999.9999"
  334. th:name="contractElectrics[0].start_electric_peak_count"
  335. onchange="isfloat4Fn(value)"/>
  336. </div>
  337. </td>
  338. <td class="peakValleyElectric">
  339. <div class="formControls col-sm-12 text-left">
  340. <input type="text" class="input-text start_electric_flat_count"
  341. disabled number="true" min="0" max="99999.9999"
  342. th:name="contractElectrics[0].start_electric_flat_count"
  343. onchange="isfloat4Fn(value)"/>
  344. </div>
  345. </td>
  346. <td class="peakValleyElectric">
  347. <div class="formControls col-sm-12 text-left">
  348. <input type="text" class="input-text start_electric_valley_count"
  349. disabled number="true" min="0" max="99999.9999"
  350. th:name="contractElectrics[0].start_electric_valley_count"
  351. onchange="isfloat4Fn(value)"/>
  352. </div>
  353. </td>
  354. <!-- <td><input type="text" class="input-text electric_price"
  355. maxlength="20" number="true" min="0" th:name="contractElectrics[0].electric_price"/></td>
  356. -->
  357. <td class="icon_font"></td>
  358. </tr>
  359. </tbody>
  360. </table>
  361. </div>
  362. </div>
  363. </div>
  364. <div id="property_fee">
  365. <div class="line">物业费用</div>
  366. <div class="row cl">
  367. <div class="formControls col-xs-8 col-sm-12">
  368. <table class="table table-border table-bordered table-bg table-hover">
  369. <thead>
  370. <tr class="text-c">
  371. <th>费用项</th>
  372. <th class="width-180">价格(元/月/平方米)</th>
  373. <th class="width-180">面积(平方米)</th>
  374. <th class="width-180">收款周期(月/次)</th>
  375. <th>说明</th>
  376. </tr>
  377. </thead>
  378. <tbody>
  379. <tr class="text-c ">
  380. <td>
  381. 物业费<input type="hidden" th:name="contractProperty.fee_type" value="1"/>
  382. </td>
  383. <td>
  384. <div class="formControls col-sm-12 text-left">
  385. <input type="text" class="input-text " maxlength="10" number="true"
  386. min="0" max="99999.9999" th:name="contractProperty.price"
  387. onchange="isfloat4Fn(value)"/>
  388. </div>
  389. </td>
  390. <td>
  391. <div class="formControls col-sm-12 text-left">
  392. <input type="text" class="input-text " maxlength="10" number="true"
  393. min="0" th:name="contractProperty.number"/>
  394. </div>
  395. </td>
  396. <td>
  397. <div class="formControls col-sm-12 text-left">
  398. <input type="text" class="input-text " digits="true" range="[1,12]"
  399. th:name="contractProperty.payment_cycle"/>
  400. </div>
  401. </td>
  402. <td>
  403. <div class="formControls col-sm-12 text-left">
  404. <input type="text" class="input-text" maxlength="45"
  405. th:name="contractProperty.remarks"/>
  406. </div>
  407. </td>
  408. </tr>
  409. </tbody>
  410. </table>
  411. </div>
  412. </div>
  413. </div>
  414. <div id="parking_fee">
  415. <div class="line">停车费用</div>
  416. <div class="row cl">
  417. <div class="formControls col-xs-8 col-sm-12">
  418. <!-- <div><i class="Hui-iconfont" onclick="addParkingLine()">&#xe600;</i></div> -->
  419. <table class="table table-border table-bordered table-bg table-hover">
  420. <thead>
  421. <tr class="text-c">
  422. <th>费用项</th>
  423. <th class="width-180">价格(元/月/个)</th>
  424. <th class="width-180">数量(个)</th>
  425. <th class="width-180">收款周期(月/次)</th>
  426. <th>说明</th>
  427. </tr>
  428. </thead>
  429. <tbody class="add_parking_line">
  430. <tr class="text-c ">
  431. <td>
  432. 停车费<input type="hidden" class="fee_type" th:name="contractParking.fee_type"
  433. value="0"/>
  434. </td>
  435. <td>
  436. <div class="formControls col-sm-12 text-left">
  437. <input type="text" class="input-text price" maxlength="10"
  438. number="true" min="0" th:name="contractParking.price" max="99999.9999"
  439. onchange="isfloat4Fn(value)"/>
  440. </div>
  441. </td>
  442. <td>
  443. <div class="formControls col-sm-12 text-left">
  444. <input type="text" class="input-text number" maxlength="10" digits="true"
  445. number="true" min="0" th:name="contractParking.number"/>
  446. </div>
  447. </td>
  448. <td>
  449. <div class="formControls col-sm-12 text-left">
  450. <input type="text" class="input-text payment_cycle" digits="true"
  451. range="[1,12]"
  452. th:name="contractParking.payment_cycle"/>
  453. </div>
  454. </td>
  455. <td>
  456. <div class="formControls col-sm-12 text-left">
  457. <input type="text" class="input-text remarks" maxlength="45"
  458. th:name="contractParking.remarks"/>
  459. </div>
  460. </td>
  461. </tr>
  462. </tbody>
  463. </table>
  464. </div>
  465. </div>
  466. </div>
  467. <div class="row cl">
  468. <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>缴费日期前</label>
  469. <div class="formControls col-xs-8 col-sm-4">
  470. <input type="text" class="input-text width-180" required th:id="parking_fee" digits="true" min="0"
  471. maxlength="10"
  472. th:name="remind_day"/><span style="margin-left:4px">天提醒</span>
  473. </div>
  474. </div>
  475. <div class="row cl">
  476. <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
  477. <button class="btn btn-primary radius" style="margin-top:0" type="submit"><i class="Hui-iconfont">&#xe632;</i>
  478. 保存
  479. </button>
  480. <button onClick="removeIframe();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
  481. </div>
  482. </div>
  483. <div id="map" style="display: none"></div>
  484. </form>
  485. </article>
  486. <script type="text/javascript" th:src="@{/js/build/contract/contract_add.js}"></script>
  487. <script th:inline="javascript">
  488. $(document).ready(function () {
  489. initWaterSelect(0);
  490. initElectricSelect(0);
  491. });
  492. function initWaterSelect(index) {
  493. $("#water_select_" + index).select2({
  494. width: '150px',
  495. language: {
  496. noResults: function (params) {
  497. return "暂无数据";
  498. }
  499. }
  500. });
  501. }
  502. function initElectricSelect(index) {
  503. $("#electric_select_" + index).select2({
  504. width: '150px',
  505. language: {
  506. noResults: function (params) {
  507. return "暂无数据";
  508. }
  509. }
  510. });
  511. }
  512. $(function () {
  513. // 日期表单初始化
  514. laydate.render({
  515. elem: '#datemax'
  516. });
  517. laydate.render({
  518. elem: '#datemin'
  519. });
  520. });
  521. function addFloorLine() {
  522. var length = $(".add_floor_line tr").length;
  523. var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1;</i>";
  524. $(".add_floor_line tr:eq(0)").clone().insertAfter($('.add_floor_line>tr').eq(-1))
  525. .find(".floor_id").removeAttr("name").attr("name", "buildLives[" + length + "].floor_id").end()
  526. .find(".build_number").removeAttr("name").attr("name", "buildLives[" + length + "].build_number").end()
  527. .find(".floor").removeAttr("name").attr("name", "buildLives[" + length + "].floor").end()
  528. .find(".use_area").removeAttr("name").attr("name", "buildLives[" + length + "].use_area").val("").end()
  529. .find(".pay").removeAttr("name").attr("name", "buildLives[" + length + "].pay").val("").end()
  530. .find(".remarks").removeAttr("name").attr("name", "buildLives[" + length + "].remarks").val("").end()
  531. .find(".icon_font").html(html).end();
  532. $('#layui-layer2').height(48);
  533. }
  534. function addElectricLine() {
  535. var length = $(".add_electric_line tr").length;
  536. var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1;</i>";
  537. $(".add_electric_line tr:eq(0)").clone().insertAfter($('.add_electric_line>tr').eq(-1))
  538. .find(".start_electric_meter_count").removeAttr("name").attr("name", "contractElectrics[" + length + "].start_electric_meter_count").val("").end()
  539. .find(".electric_select").removeAttr("name").removeAttr("id").attr("name", "contractElectrics[" + length + "].electric_id")
  540. .attr("id", "electric_select_"+length).end()
  541. .find("span").remove().end()
  542. .find(".icon_font").html(html).end();
  543. var waterLength = $(".add_water_line tr").length;
  544. if (length >= waterLength) {
  545. $('#layui-layer2').height(48);
  546. }
  547. initElectricSelect(length);
  548. }
  549. function addWaterLine() {
  550. var length = $(".add_water_line tr").length;
  551. var html = "<i class='Hui-iconfont' onclick='removeLine(this)'>&#xe6a1;</i>";
  552. $(".add_water_line tr:eq(0)").clone().insertAfter($('.add_water_line>tr').eq(-1))
  553. .find(".start_water_meter_count").removeAttr("name").attr("name", "contractWaterList[" + length + "].start_water_meter_count").val("").end()
  554. .find(".water_select").removeAttr("name").removeAttr("id").attr("name", "contractWaterList[" + length + "].water_id")
  555. .attr("id", "water_select_"+length).end()
  556. .find("span").remove().end()
  557. .find(".icon_font").html(html).end();
  558. var electricLength = $(".add_electric_line tr").length;
  559. if (length >= electricLength) {
  560. $('#layui-layer2').height(48);
  561. }
  562. initWaterSelect(length);
  563. }
  564. function removeLine(obj) {
  565. $(obj).parents("tr").remove();
  566. }
  567. var options = {
  568. uploadBtnId: '#filePicker',
  569. picturePreId: 'fileListPre',
  570. hiddenPictureUrl: 'img',
  571. hiddenPictureName: 'imgName',
  572. // accept : {
  573. // title : 'file',
  574. // extensions : 'gif,jpg,jpeg,bmp,png',
  575. // mimeTypes : 'image/gif,image/jpg,image/jpeg,image/bmp,image/png'
  576. // },
  577. width: 81,
  578. height: 81,
  579. fileSizeLimit: 100 * 1024 * 1024,
  580. fileSingleSizeLimit: 100 * 1024 * 1024
  581. // fileNumLimit: 1
  582. };
  583. var webUploadDoc = new $WebUploadDoc(options);
  584. webUploadDoc.init();
  585. /**
  586. * 取消
  587. */
  588. function removeIframe() {
  589. var index = parent.layer.getFrameIndex(window.name);
  590. parent.layer.close(index);
  591. }
  592. function setAttr(obj) {
  593. if ($(obj).find("option:selected").attr("floor_id")) {
  594. $(".floor_id").val($(obj).find("option:selected").attr("floor_id"));
  595. $(obj).parents("tr").find(".floor").html("<option value=''>请选择</option>");
  596. $.ajax({
  597. type: "get",
  598. dataType: "json",
  599. url: pagePath + "/build/contract/findFloor/" + $(obj).find("option:selected").attr("floor_id"),
  600. success: function (result) {
  601. if (result.success) {
  602. var html = "";
  603. $.each(result.obj, function (index, item) {
  604. html += "<option remain_area='" + item.remain_area + "' value='" + item.floor + "'>" + item.floor + "</option>";
  605. });
  606. $(obj).parents("tr").find(".floor").append(html);
  607. } else {
  608. errorMessage(result.message);
  609. }
  610. },
  611. error: function () {
  612. errorMessage('系统错误!');
  613. }
  614. });
  615. } else {
  616. $(obj).parents("tr").find(".floor").html("<option value=''>请选择</option>");
  617. $(obj).parents("tr").find(".use_area").val("");
  618. $(obj).parents("tr").find(".remain_area").text("");
  619. $(obj).parents("tr").find(".pay").val("");
  620. }
  621. }
  622. function isAddedFloor(obj){
  623. var isAdded = false;
  624. if($.trim($(obj).val())!=""){
  625. var index = $(".add_floor_line tr").index($(obj).parents("tr"));
  626. var thisFloor = $(obj).parents("tr").find(".floor").val();
  627. var thisBuilding = $(obj).parents("tr").find(".build_number").val();
  628. $(".add_floor_line tr:not(:eq("+index+"))").each(function(i,item){
  629. var floor = $(this).find(".floor").val();
  630. var building = $(this).find(".build_number").val();
  631. if(floor == thisFloor && building == thisBuilding){
  632. errorMessage("不能添加重复楼层");
  633. isAdded = true;
  634. }
  635. });
  636. }
  637. return isAdded;
  638. }
  639. function setAreaPrice(obj) {
  640. if(isAddedFloor(obj)){
  641. $(obj).val("");
  642. }else{
  643. var remain_area = $(obj).find("option:selected").attr("remain_area");
  644. $(obj).parents("tr").find(".use_area").val(remain_area);
  645. $(obj).parents("tr").find(".remain_area").text(remain_area);
  646. getTotalArea();
  647. }
  648. }
  649. function getTotalArea() {
  650. var totalArea = 0;
  651. $(".add_floor_line").find(".use_area").each(function () {
  652. totalArea += parseFloat($(this).val() == "" ? 0 : $(this).val());
  653. });
  654. $("#total_area").text(totalArea);
  655. $("#area").val(totalArea);
  656. }
  657. function getPaidFee() {
  658. var totalMonthFee = 0.0;
  659. $(".add_floor_line").find("tr").each(function () {
  660. var floorArea = parseFloat($(this).find(".use_area").val() == "" ? 0 : $(this).find(".use_area").val());
  661. var floorPay = parseFloat($(this).find(".pay").val() == "" ? 0 : $(this).find(".pay").val());
  662. if (floorArea != "" || floorArea != 0) {
  663. isfloat4Fn(floorArea)
  664. }
  665. if (floorPay != "" || floorPay != 0) {
  666. isfloat2Fn(floorPay)
  667. }
  668. totalMonthFee += (floorArea * floorPay);
  669. });
  670. var paid_tenancy = parseFloat($("#paid_tenancy_month").val() == "" ? 0 : $("#paid_tenancy_month").val()) * totalMonthFee;
  671. $("#paid_tenancy").val(paid_tenancy.toFixed(2));
  672. }
  673. function checkWaterName(obj) {
  674. var index = $(".add_water_line tr").index($(obj).parents("tr"));
  675. $(".add_water_line tr:not(:eq(" + index + "))").find(".water_select").each(function (i, item) {
  676. if ($(this).val() != "" && $(obj).val() == $(this).val()) {
  677. errorMessage("水表名称不能重复!");
  678. $("#"+$(obj).attr("id")).val("").trigger("change");
  679. }
  680. });
  681. var flag= $(obj).find("option:selected").attr("is_common");
  682. if(flag=='true'){
  683. $(obj).parents("tr").find(".start_water_meter_count").removeAttr("required").attr("disabled","disabled").val("");
  684. $(obj).parents("tr").find(".start_water_meter_count").addClass("disabled","disabled");
  685. }else{
  686. $(obj).parents("tr").find(".start_water_meter_count").removeAttr("disabled").attr("required");
  687. $(obj).parents("tr").find(".start_water_meter_count").removeClass("disabled");
  688. }
  689. }
  690. function checkElectricName(obj) {
  691. var index = $(".add_electric_line tr").index($(obj).parents("tr"));
  692. $(".add_electric_line tr:not(:eq(" + index + "))").find(".electric_select").each(function (i, item) {
  693. if ($(this).val() != "" && $(obj).val() == $(this).val()) {
  694. errorMessage("电表名称不能重复!");
  695. $("#"+$(obj).attr("id")).val("").trigger("change");
  696. }
  697. });
  698. //debugger;
  699. var is_common= $(obj).find("option:selected").attr("is_common");
  700. var is_peak= $(obj).find("option:selected").attr("is_peak");
  701. if (is_peak=="true") {
  702. $(obj).parents("tr").find(".commonElectric").find("input").each(function () {
  703. $(this).val("");
  704. $(this).attr("disabled", "disabled");
  705. $(this).addClass("disabled", "disabled");
  706. });
  707. $(obj).parents("tr").find(".peakValleyElectric").find("input").each(function () {
  708. $(this).attr("required", "true");
  709. if(is_common=='false'){
  710. $(this).removeAttr("disabled");
  711. $(this).removeClass("disabled");
  712. }
  713. });
  714. } else {
  715. $(obj).parents("tr").find(".peakValleyElectric").find("input").each(function () {
  716. $(this).val("");
  717. $(this).attr("disabled", "disabled");
  718. $(this).addClass("disabled", "disabled");
  719. });
  720. $(obj).parents("tr").find(".commonElectric").find("input").each(function () {
  721. if(is_common=='false'){
  722. $(this).removeAttr("disabled");
  723. $(this).removeClass("disabled");
  724. }
  725. });
  726. }
  727. }
  728. function isfloat4Fn(val) {
  729. if (/^\d+(\.\d{1,4})?$/.test(String(val)) == false) {
  730. errorMessage("小数点后最多4位小数");
  731. }
  732. }
  733. function isfloat2Fn(val) {
  734. if (/^\d+(\.\d{1,2})?$/.test(String(val)) == false) {
  735. errorMessage("小数点后最多2位小数");
  736. }
  737. }
  738. function selectModal(obj) {
  739. var flag = $(obj).prop("checked");
  740. var val = $(obj).val();
  741. if (flag) {
  742. if (val == "1") {
  743. $("#tenancy_fee").show();
  744. $("#is_tenancy").val(true);
  745. $("#tenancy_fee").find("input").attr("required", true).end()
  746. .find("select").attr("required", true).end()
  747. .find(".remarks").removeAttr("required").end();
  748. $("#tenancy_fee").find(".notRequired").attr("required", false).end();
  749. } else if (val == "2") {
  750. $("#water_fee").show();
  751. $("#is_water").val(true);
  752. $("#water_fee").find("input").attr("required", true).end()
  753. .find("select").attr("required", true).end();
  754. } else if (val == "3") {
  755. $("#electric_fee").show();
  756. $("#is_electric").val(true);
  757. $("#electric_fee").find("select").attr("required", true).end();
  758. } else if (val == "4") {
  759. $("#property_fee").show();
  760. $("#is_property").val(true);
  761. $("#property_fee").find("input").attr("required", true).end()
  762. .find("input[name='contractProperty.remarks']").removeAttr("required").end();
  763. } else if (val == "5") {
  764. $("#parking_fee").show();
  765. $("#is_parking").val(true);
  766. $("#parking_fee").find("input").attr("required", true).end()
  767. .find("input[name='contractParking.remarks']").removeAttr("required").end();
  768. }
  769. $('#layui-layer2').height(200);
  770. } else {
  771. if (val == "1") {
  772. $("#tenancy_fee").hide();
  773. $("#is_tenancy").val(false);
  774. $("#tenancy_fee").find("select").removeAttr("required").end()
  775. .find("input").removeAttr("required").end();
  776. } else if (val == "2") {
  777. $("#water_fee").hide();
  778. $("#is_water").val(false);
  779. $("#water_fee").find("select").removeAttr("required").end()
  780. .find("input").removeAttr("required").end();
  781. } else if (val == "3") {
  782. $("#electric_fee").hide();
  783. $("#is_electric").val(false);
  784. $("#electric_fee").find("select").removeAttr("required").end()
  785. .find("input").removeAttr("required").end();
  786. } else if (val == "4") {
  787. $("#property_fee").hide();
  788. $("#is_property").val(false);
  789. $("#property_fee").find("select").removeAttr("required").end()
  790. .find("input").removeAttr("required").end();
  791. } else if (val == "5") {
  792. $("#parking_fee").hide();
  793. $("#is_parking").val(false);
  794. $("#parking_fee").find("select").removeAttr("required").end()
  795. .find("input").removeAttr("required").end();
  796. }
  797. }
  798. }
  799. $("#electric_fee").hide();
  800. $("#water_fee").hide();
  801. $("#property_fee").hide();
  802. $("#parking_fee").hide();
  803. $("#tenancy_fee").hide();
  804. </script>
  805. </body>
  806. </html>