view_set.html 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. {eq name="$is_create_admin" value = "1"}
  2. <table class="layui-table layui-table-form">
  3. <tr id="flow_tr">
  4. <td class="layui-td-gray">审核人<font>*</font></td>
  5. <td colspan="7">
  6. <input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input picker-one" readonly>
  7. <input type="hidden" name="check_admin_ids" value="">
  8. </td>
  9. </tr>
  10. <!--<tr>
  11. <td class="layui-td-gray">抄送人</td>
  12. <td colspan="7">
  13. <input type="text" name="copy_names" value="" autocomplete="off" placeholder="请选择抄送人" class="layui-input picker-more" readonly>
  14. <input type="hidden" name="copy_uids" value="">
  15. </td>
  16. </tr>-->
  17. </table>
  18. {/eq}
  19. <div class="pt-2">
  20. {eq name="$is_create_admin" value = "1"}
  21. <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">提交审核</button>
  22. <a class="layui-btn" href="/admin/contract.index/edit?id={$detail.id}">编辑合同</a>
  23. {/eq}
  24. <span class="layui-btn layui-btn-warm" data-event="check" data-status="5">中止合同</span>
  25. <span class="layui-btn layui-btn-danger" data-event="check" data-status="6">作废合同</span>
  26. </div>
  27. <script>
  28. function init(form,tool) {
  29. $('body').on('click','[data-event="check"]',function(){
  30. let status = $(this).data('status');
  31. let action = '';
  32. let title = ''
  33. if(status == 5){
  34. title = '确定要中止该合同?';
  35. action = 'stop_ok';
  36. }
  37. if(status == 6){
  38. title = '确定要作废该合同?';
  39. action = 'void_ok';
  40. }
  41. layer.confirm(title, {
  42. icon: 3,
  43. title: '提示'
  44. }, function(index) {
  45. let callback = function (e) {
  46. layer.msg(e.msg);
  47. parent.layui.pageTable.reload();
  48. setTimeout(function(){
  49. location.reload();
  50. },2000)
  51. }
  52. layer.open({
  53. type: 1,
  54. title: '请输入原因或理由',
  55. area: ['800px', '360px'],
  56. content: '<div style="padding:5px;"><textarea class="layui-textarea" id="remarkTextarea" style="width: 100%; height: 240px;"></textarea></div>',
  57. btnAlign: 'c',
  58. btn: ['提交保存'],
  59. yes: function () {
  60. let remark = $("#remarkTextarea").val();
  61. if (remark != '') {
  62. tool.post("/admin/contract.api/check", {id: contract_id,check_status:status,mark:remark}, callback);
  63. } else {
  64. layer.msg('请输入原因或理由');
  65. }
  66. }
  67. })
  68. layer.close(index);
  69. });
  70. });
  71. //监听提交
  72. form.on('submit(webform)', function(data){
  73. layer.confirm('提交审核后合同内容将不能编辑,确定要提交审核?', {
  74. icon: 3,
  75. title: '提示'
  76. }, function(index) {
  77. data.field.id = contract_id;
  78. data.field.check_status = 1;
  79. $.ajax({
  80. url: "/admin/contract.api/check",
  81. type:'post',
  82. data:data.field,
  83. success:function(e){
  84. layer.msg(e.msg);
  85. if (e.code == 0) {
  86. parent.layui.tool.close(1000);
  87. }
  88. }
  89. })
  90. });
  91. return false;
  92. });
  93. form.on('select(flowtype)', function(data){
  94. var check_type = data.elem[data.elem.selectedIndex].title;
  95. var formHtml='<td class="layui-td-gray">审核人<font>*</font></td>\
  96. <td colspan="5">\
  97. <input type="text" name="check_admin_name" value="" autocomplete="off" placeholder="请选择审核人" lay-verify="required" lay-reqText="请选择审核人" class="layui-input picker-one"><input type="hidden" name="check_admin_ids" value="">\
  98. </td>';
  99. if(check_type == 2){
  100. $('#flow_tr').html(formHtml);
  101. form.render();
  102. }
  103. if(data.value==''){
  104. return false;
  105. }
  106. $.ajax({
  107. url: "/api/index/get_flow_users",
  108. type:'get',
  109. data:{id:data.value},
  110. success: function (e) {
  111. if (e.code == 0) {
  112. var flowLi='';
  113. var flow_data = e.data.flow_data;
  114. if(e.data.copy_uids && e.data.copy_uids !=''){
  115. $('[name="copy_names"]').val(e.data.copy_unames);
  116. $('[name="copy_uids"]').val(e.data.copy_uids.split(','));
  117. }
  118. if(check_type == 1 || check_type == 3){
  119. for(var a=0;a<flow_data.length;a++){
  120. var userList='',sign_type = '';
  121. if(check_type == 1){
  122. if(flow_data[a].flow_type==1){
  123. userList+= '<li style="padding:3px 0">当前部门负责人</li>';
  124. }
  125. else if(flow_data[a].flow_type==2){
  126. userList+= '<li style="padding:3px 0">上级部门负责人</li>';
  127. }
  128. else{
  129. if(flow_data[a].flow_type==3){
  130. sign_type= ' <span class="layui-badge layui-bg-blue">或签</span>';
  131. }
  132. if(flow_data[a].flow_type==4){
  133. sign_type= ' <span class="layui-badge layui-bg-blue">会签</span>';
  134. }
  135. for(var b=0;b<flow_data[a].user_id_info.length;b++){
  136. userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
  137. }
  138. }
  139. }
  140. else if(check_type == 3){
  141. sign_type= ' <span class="layui-badge layui-bg-blue">'+flow_data[a].flow_name+'</span>'
  142. for(var b=0;b<flow_data[a].user_id_info.length;b++){
  143. userList+= '<li style="padding:3px 0"><img src="'+flow_data[a].user_id_info[b].thumb+'" style="width:24px; height:24px; border-radius:50%; margin-right:8px;" />'+flow_data[a].user_id_info[b].name+'</li>';
  144. }
  145. }
  146. flowLi+='<li class="layui-timeline-item">\
  147. <i class="layui-icon layui-timeline-axis">&#xe63f;</i>\
  148. <div class="layui-timeline-content">\
  149. <p class="layui-timeline-title"><strong>第'+(a+1)+'级审批</strong>'+sign_type+'</p>\
  150. <ul>'+userList+'</ul>\
  151. </div>\
  152. </li>';
  153. }
  154. formHtml = '<td class="layui-td-gray">审批流程</td>\
  155. <td colspan="7">\
  156. <ul id="flowList" class="layui-timeline">'+flowLi+'</ul>\
  157. </td>';
  158. $('#flow_tr').html(formHtml);
  159. }
  160. }
  161. }
  162. })
  163. });
  164. }
  165. </script>