edit.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. {extend name="common/base"/}
  2. <!-- 主体 -->
  3. {block name="style"}
  4. <style>
  5. .footer{
  6. display: none;
  7. }
  8. .form-title {
  9. background-color: rgb(241, 241, 241);
  10. color: #5f5f5f;
  11. border-color: rgb(241, 241, 241);
  12. }
  13. .layui-table td {
  14. border-width: 1px;
  15. border-style: solid;
  16. border-color: #e2e2e2;
  17. }
  18. .annex li{
  19. padding: 0 1vw 0 1vw;
  20. border-right: 1px solid #e2e2e2;
  21. }
  22. .annex p{
  23. overflow: hidden;
  24. text-overflow: ellipsis;
  25. white-space: nowrap;
  26. width: 7vw;
  27. font-weight: 500 !important;
  28. }
  29. .annex img{
  30. height: auto !important;
  31. }
  32. </style>
  33. {/block}
  34. {block name="body"}
  35. <form class="layui-form p-4">
  36. <h3 class="pb-3">编辑合同</h3>
  37. <table class="layui-table layui-table-form">
  38. {gt name="$detail.pid" value="0"}
  39. <tr>
  40. <td class="layui-td-gray form-title">母合同名称</td>
  41. <td colspan="5">{$detail.pname}</td>
  42. </tr>
  43. {/gt}
  44. <tr>
  45. <td class="layui-td-gray form-title">合同名称<font>*</font></td>
  46. <td colspan="3"><input type="text" name="name" value="{$detail.name}" lay-verify="required"
  47. lay-reqText="请输入合同名称" autocomplete="off" placeholder="请输入合同名称"
  48. class="layui-input"></td>
  49. <td class="layui-td-gray form-title">合同性质</td>
  50. <td>
  51. {eq name="$detail.type" value="1" }普通合同{/eq}
  52. {eq name="$detail.type" value="2" }框架合同{/eq}
  53. {eq name="$detail.type" value="3" }补充协议{/eq}
  54. {eq name="$detail.type" value="4" }其他合同{/eq}
  55. </td>
  56. </tr>
  57. <tr>
  58. <td class="layui-td-gray form-title">签约主体<span style="font-size:12px;">(乙方)</span><font>*</font></td>
  59. <td>
  60. <input type="text" name="subject_name" autocomplete="off" value="{$detail.subject_name}" lay-verify="required" lay-reqText="请输入客户名称" placeholder="请输入客户名称" class="layui-input">
  61. </td>
  62. <td class="layui-td-gray form-title">合同编号<font>*</font></td>
  63. <td>
  64. <input type="text" name="code" value="{$detail.code}" autocomplete="off" lay-verify="required"
  65. lay-reqText="请输入合同编号" placeholder="请输入合同编号" class="layui-input">
  66. </td>
  67. <td class="layui-td-gray form-title">合同类别<font>*</font></td>
  68. <td>
  69. <select name="cate_id" lay-verify="required" lay-reqText="请选择合同类别">
  70. <option value="">请选择合同类别</option>
  71. {volist name="cate" id="v"}
  72. <option value="{$v.id}" {eq name="$v.id" value="$detail.cate_id" } selected {/eq}>{$v.title}</option>
  73. {/volist}
  74. </select>
  75. </td>
  76. </tr>
  77. <tr>
  78. <td class="layui-td-gray form-title">客户名称<span style="font-size:12px;">(甲方)</span><font>*</font></td>
  79. <td>
  80. <input type="text" name="customer" autocomplete="off" value="{$detail.customer}" lay-verify="required" lay-reqText="请输入客户名称" placeholder="请输入客户名称" class="layui-input">
  81. </td>
  82. <td class="layui-td-gray form-title">签约客户代表</td>
  83. <td>
  84. <input type="text" name="customer_name" value="{$detail.customer_name}" autocomplete="off" lay-verify="required" lay-reqText="请输入客户代表姓名" placeholder="请输入客户代表姓名" class="layui-input">
  85. </td>
  86. <td class="layui-td-gray form-title">客户联系电话<font>*</font></td>
  87. <td>
  88. <input type="text" name="customer_mobile" value="{$detail.customer_mobile}" autocomplete="off" lay-verify="required" lay-reqText="请输入客户联系电话" placeholder="请输入客户联系电话" class="layui-input">
  89. </td>
  90. </tr>
  91. <tr>
  92. <td class="layui-td-gray-2 form-title">客户联系地址</td>
  93. <td colspan="3">
  94. <input type="text" name="customer_address" value="{$detail.customer_address}" autocomplete="off" placeholder="请输入客户联系地址" class="layui-input">
  95. </td>
  96. <td class="layui-td-gray-2 form-title">合同始止日期<font>*</font></td>
  97. <td>
  98. <div id="barDate" class="layui-input-inline">
  99. <div class="layui-input-inline" style="width:110px; margin-bottom:0">
  100. <input type="text" class="layui-input" id="start_time" placeholder="选择时间区间" readonly name="start_time" value="{$detail.start_time}" readonly lay-verify="required" lay-reqText="请选择合同开始时间">
  101. </div>
  102. ~
  103. <div class="layui-input-inline" style="width:110px;margin-bottom:0">
  104. <input type="text" class="layui-input" id="end_time" placeholder="选择时间区间" readonly name="end_time" value="{$detail.end_time}" readonly lay-verify="required" lay-reqText="请选择合同结束时间">
  105. </div>
  106. </div>
  107. </td>
  108. </tr>
  109. {neq name="$detail.type" value="2"}
  110. <tr>
  111. <td class="layui-td-gray form-title">合同金额{eq name="$detail.type" value="1"}<font>*</font>{/eq}</td>
  112. <td>
  113. <input type="text" name="cost" value="{$detail.cost}" {eq name="$detail.type" value="1" } lay-verify="required|number" {/eq} lay-reqText="请输入合同金额,数字" placeholder="请输入合同金额,数字" autocomplete="off" class="layui-input">
  114. </td>
  115. <td class="layui-td-gray form-title">是否含税</td>
  116. <td>
  117. <input type="radio" name="is_tax" value="1" title="是" {eq name="$detail.is_tax" value="1" } checked{/eq} lay-filter="tax">
  118. <input type="radio" name="is_tax" value="0" title="否" {eq name="$detail.is_tax" value="0" } checked{/eq} lay-filter="tax">
  119. </td>
  120. <td class="layui-td-gray form-title">税点(百分比)</td>
  121. <td>
  122. <input type="text" name="tax" value="{$detail.tax}"
  123. <input type="text" name="tax" value="" lay-verify="number" placeholder="请输入税点,数字" autocomplete="off" class="layui-input" {eq name="$detail.is_tax" value="0" } style="display:none;" {/eq}>
  124. </td>
  125. </tr>
  126. {/neq}
  127. <tr>
  128. <td colspan="6"><strong>签订信息</strong></td>
  129. </tr>
  130. <tr>
  131. <td class="layui-td-gray-2 form-title">合同签订人<font>*</font></td>
  132. <td>
  133. <div class="layui-input-inline" style="width:50%;">
  134. <input type="text" name="sign_name" value="{$detail.sign_name}" autocomplete="off" readonly lay-verify="required" lay-reqText="请选择合同签订人" placeholder="请选择合同签订人" class="layui-input picker-one">
  135. </div>
  136. <!--<div class="layui-input-inline gray" style="width:42%;" id="sign_department">
  137. 部门:{/$detail.sign_department}
  138. </div>
  139. <input type="hidden" name="sign_uid" value="{$detail.sign_uid}">
  140. <input type="hidden" name="sign_did" value="{$detail.sign_did}">-->
  141. </td>
  142. <td class="layui-td-gray-2 form-title">合同签订时间<font>*</font></td>
  143. <td>
  144. <input type="text" name="sign_time" value="{$detail.sign_time}" readonly lay-verify="required" lay-reqText="请选择合同签订日期" placeholder="请选择合同签订日期" class="layui-input tool-time">
  145. </td>
  146. <td class="layui-td-gray-2 form-title">合同制定人<font>*</font></td>
  147. <td>
  148. <input type="text" name="prepared_name" value="{$detail.prepared_name}" autocomplete="off" readonly placeholder="请选择合同制定人" class="layui-input picker-one">
  149. <input type="hidden" name="prepared_uid" value="{$detail.prepared_uid}" lay-verify="required" lay-reqText="请选择合同制定人">
  150. </td>
  151. </tr>
  152. <tr>
  153. <td class="layui-td-gray-2 form-title">合同保管人<font>*</font></td>
  154. <td>
  155. <input type="text" name="keeper_name" value="{$detail.keeper_name}" autocomplete="off" readonly placeholder="请选择合同保管人" class="layui-input picker-one">
  156. <input type="hidden" name="keeper_uid" value="{$detail.keeper_uid}" lay-verify="required" lay-reqText="请选择合同保管人">
  157. </td>
  158. <td class="layui-td-gray form-title">合同共享人员</td>
  159. <td colspan="3">
  160. <input type="text" name="share_names" value="{$detail.share_names}" autocomplete="off" readonly placeholder="请选择共享人员" class="layui-input picker-more">
  161. <input type="hidden" name="share_ids" value="{$detail.share_ids}">
  162. </td>
  163. </tr>
  164. <tr>
  165. <th colspan="9" style="text-align:left;"><strong>补充附件</strong></th>
  166. </tr>
  167. <tr>
  168. <th class="form-title" style="text-align:center !important;">
  169. <button type="button" class="layui-btn layui-btn-sm" id="uploadBtn"><i
  170. class="layui-icon"></i>附件上传
  171. </button>
  172. </th>
  173. <th colspan="8" style="line-height:inherit">
  174. <div id="fileBox" class="annex" style="display: flex;">
  175. {:fileCard($detail.file_array_other)}
  176. </div>
  177. </th>
  178. </tr>
  179. <tr>
  180. <td colspan="6"><strong>备注信息</strong></td>
  181. </tr>
  182. <tr>
  183. <td colspan="6">
  184. <textarea name="remark" placeholder="请输入备注信息" class="layui-textarea">{$detail.remark}</textarea>
  185. </td>
  186. </tr>
  187. </table>
  188. <div class="py-3">
  189. <input type="hidden" name="id" value="{$detail.id}">
  190. <input type="hidden" name="scene" value="edit">
  191. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
  192. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  193. </div>
  194. </form>
  195. {/block}
  196. <!-- /主体 -->
  197. <!-- 脚本 -->
  198. {block name="script"}
  199. <script>
  200. const moduleInit = ['tool', 'employeepicker', 'oaTool'];
  201. const contract_id = '{$detail.id}';
  202. function gouguInit() {
  203. var form = layui.form, tool = layui.tool, table = layui.table, laydate = layui.laydate, oaTool = layui.oaTool,
  204. employeepicker = layui.employeepicker;
  205. //日期范围
  206. laydate.render({
  207. elem: '#barDate',
  208. range: ['#start_time', '#end_time'],
  209. rangeLinked: true
  210. });
  211. //相关附件上传
  212. var file_ids = [];
  213. oaTool.addFile({
  214. type: 1,
  215. isSave: true,
  216. ajaxDelete: function (file_id) {
  217. let callback = function (e) {
  218. layer.msg(e.msg);
  219. if (e.code == 0) {
  220. $("#" + file_id + "").remove();
  221. }
  222. }
  223. tool.delete("/admin/contract.api/delete_file", {id: file_id}, callback);
  224. },
  225. ajaxSave: function (res) {
  226. let callback = function (e) {
  227. layer.msg(e.msg);
  228. if (e.code == 0) {
  229. location.reload();
  230. }
  231. }
  232. tool.post("/admin/contract.api/add_file", {
  233. 'contract_id': contract_id,
  234. 'file_id': res.data.id,
  235. 'file_name': res.data.name
  236. }, callback);
  237. }
  238. });
  239. //radio选择
  240. form.on('radio(tax)', function (data) {
  241. if (data.value == 0) {
  242. $('[name="tax"]').val('0').hide();
  243. } else {
  244. $('[name="tax"]').val('').show();
  245. }
  246. });
  247. //监听提交
  248. form.on('submit(webform)', function (data) {
  249. if (data.field.type == 1 && data.field.cost == '') {
  250. layer.msg('请完善合同金额');
  251. return false;
  252. }
  253. if (data.field.is_tax == 1 && data.field.tax == '') {
  254. layer.msg('请完善税点');
  255. return false;
  256. }
  257. if (data.field.is_tax == 1 && data.field.cost == '') {
  258. layer.msg('请完善金额');
  259. return false;
  260. }
  261. let callback = function (e) {
  262. layer.msg(e.msg);
  263. if (e.code == 0) {
  264. tool.sideClose(1000);
  265. }
  266. }
  267. tool.post("/admin/contract.index/edit", data.field, callback);
  268. return false;
  269. });
  270. }
  271. </script>
  272. {/block}
  273. <!-- /脚本 -->