checkBill.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. @extends('layouts.app')
  2. @section('title')采购管理-财务-对账单@endsection
  3. @section('content')
  4. @component('procurement.finance.menu')@endcomponent
  5. <div class="container-fluid" id="list">
  6. <div id="form_div" class="mt-1"></div>
  7. <div class="row mt-2">
  8. <span class="dropdown ml-3">
  9. <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
  10. :class="[checkData.length>0?'btn-dark text-light':'']"
  11. data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
  12. 导出Excel
  13. </button>
  14. <div class="dropdown-menu">
  15. <a class="dropdown-item" @click="checkBillExport(false)" href="javascript:">导出勾选内容</a>
  16. <a class="dropdown-item" @click="checkBillExport(true)" href="javascript:">导出所有页</a>
  17. </div>
  18. </span>
  19. </div>
  20. <label for="all" id="cloneCheckAll" class="d-none">
  21. <input id="all" type="checkbox" @click="checkAll($event)">全选
  22. </label>
  23. <table class="table table-sm table-bordered text-nowrap d-none" id="headerRoll"></table>
  24. <table class="table table-sm table-striped table-bordered table-hover text-nowrap card-body mt-2"
  25. id="headerParent">
  26. <tr id="header"></tr>
  27. <tr v-for="(procurementCheckSheet,i) in procurementCheckSheets">
  28. <td>
  29. <input class="checkItem" type="checkbox" :value="procurementCheckSheet.id" v-model="checkData">
  30. </td>
  31. <td class="">@{{ procurementCheckSheet.procurement_code }}</td>
  32. <td class="text-muted">@{{ procurementCheckSheet.procurement_at }}</td>
  33. <td class="text-muted">@{{ procurementCheckSheet.procurement_delivery_at }}</td>
  34. <td class="text-muted">@{{ procurementCheckSheet.supplier_name }}</td>
  35. <td class="tooltipTarget" style="max-width: 200px;overflow:hidden">@{{ procurementCheckSheet.material_code }}</td>
  36. <td class="text-muted">@{{ procurementCheckSheet.material_name }}</td>
  37. <td class="text-muted">@{{ procurementCheckSheet.procurement_quantity }}</td>
  38. <td class="text-muted">@{{ procurementCheckSheet.amount }}</td>
  39. <td class="text-muted">@{{ procurementCheckSheet.signer_name }}</td>
  40. <td class="text-muted">@{{ procurementCheckSheet.signed_at }}</td>
  41. <td class="text-muted">@{{ procurementCheckSheet.account_payable }}</td>
  42. <td><span>@{{ procurementCheckSheet.invoice_number }}</span></td>
  43. <td><span>@{{ procurement_check_sheet_status[procurementCheckSheet.status] }}</span></td>
  44. <td><a class="text-primary" @click="fillInvoiceNumber(procurementCheckSheet.id)" v-if="!procurementCheckSheet.invoice_number">填写发票号</a></td>
  45. </tr>
  46. </table>
  47. @can('采购管理-财务-对账单')
  48. @include('procurement.finance._fillInvoiceNumber')
  49. @endcan
  50. <div class="text-info h5 btn btn">{{$procurementCheckSheets->count()}}/@{{ sum }}</div>
  51. <div>{{$procurementCheckSheets->appends($paginateParams)->links()}}</div>
  52. </div>
  53. @endsection
  54. @section('lastScript')
  55. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  56. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  57. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  58. <script>
  59. let vue = new Vue({
  60. el: '#list',
  61. data: {
  62. procurementCheckSheets: [
  63. @foreach($procurementCheckSheets as $procurementCheckSheet)
  64. {
  65. id:'{{$procurementCheckSheet->id}}',invoice_number:'{{$procurementCheckSheet->invoice_number}}',account_payable:'{{$procurementCheckSheet->account_payable}}',
  66. created_at:'{{$procurementCheckSheet->created_at}}',auditor:'{{$procurementCheckSheet->auditor}}',status:'{{$procurementCheckSheet->status}}',
  67. @if($procurementCheckSheet->procurementDelivery)
  68. amount:'{{$procurementCheckSheet->procurementDelivery->amount}}',initiator:'{{$procurementCheckSheet->procurementDelivery->initiator}}',
  69. signer:'{{$procurementCheckSheet->procurementDelivery->signer}}',signed_at:'{{$procurementCheckSheet->procurementDelivery->signed_at}}',
  70. procurement_delivery_at:'{{$procurementCheckSheet->procurementDelivery->created_at}}',@endif
  71. @if($procurementCheckSheet->procurementDelivery->procurement)
  72. procurement_quantity:'{{$procurementCheckSheet->procurementDelivery->procurement->quantity}}',
  73. procurement_code:'{{$procurementCheckSheet->procurementDelivery->procurement->code}}',
  74. procurement_at:'{{$procurementCheckSheet->procurementDelivery->procurement->created_at}}',@endif
  75. @if($procurementCheckSheet->procurementDelivery->receiver)
  76. signer_name:'{{$procurementCheckSheet->procurementDelivery->receiver->name}}',@endif
  77. @if($procurementCheckSheet->procurementDelivery->procurement->supplier)
  78. supplier_id:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->id}}',supplier_name:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->name}}',@endif
  79. @if($procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material)
  80. material_id:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->id}}',
  81. material_name:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->name}}',
  82. material_code:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->code}}',@endif
  83. }
  84. @endforeach
  85. ],
  86. suppliers:[
  87. @foreach($suppliers as $supplier)
  88. {name:'{{$supplier->id}}',value:'{{$supplier->name}}'},
  89. @endforeach
  90. ],
  91. materials: [
  92. @foreach($materials as $material)
  93. {name:'{{$material->id}}',value:'{{$material->name}}'},
  94. @endforeach
  95. ],
  96. checkData: [],
  97. sum:{!! $procurementCheckSheets->total() !!},
  98. procurement_check_sheet_status:{!! json_encode(\App\ProcurementCheckSheet::status,JSON_UNESCAPED_UNICODE) !!},
  99. invoice_number:'',procurementCheckSheetId:null,
  100. },
  101. mounted: function () {
  102. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  103. $('#list').removeClass('d-none');
  104. let data = [
  105. [
  106. {name: 'signed_at', type: 'dateTime', tip: '选择显示指定的签收日期'},
  107. {
  108. name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
  109. placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
  110. },
  111. {
  112. name: 'status', type: 'select',
  113. tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的耗材'],
  114. placeholder: '对账单状态',
  115. data: [{name:0,value:'未出账'},{name:1,value:'已出账'},{name:2,value:'已完结'},],
  116. },
  117. ],
  118. ];
  119. this.form = new query({
  120. el: "#form_div",
  121. condition: data,
  122. });
  123. this.form.init();
  124. let column = [
  125. {
  126. name: 'cloneCheckAll', customization: true, type: 'checkAll',column:'id',
  127. dom: $('#cloneCheckAll').removeClass('d-none'), neglect: true
  128. },
  129. {name: 'code', value: '采购编号', neglect: true},
  130. {name: 'procurement_at', value: '采购日期', class: ''},
  131. {name: '', value: '送货日期', class: 'text-muted'},
  132. {name: 'company_name', value: '供应商名称', class: 'text-muted'},
  133. {name: 'material_code', value: '耗材编号', class: 'text-muted'},
  134. {name: 'material_name', value: '耗材'},
  135. {name: 'quantity', value: '采购数量', class: 'text-muted'},
  136. {name: 'amount', value: '送货数量', class: 'text-muted'},
  137. {name: 'signer', value: '签收人', class: 'text-muted'},
  138. {name: 'signed_at', value: '签收日期', class: 'text-muted'},
  139. {name: '', value: '应付金额', neglect: true},
  140. {name: '', value: '发票号', neglect: true},
  141. {name: '', value: '状态', neglect: true},
  142. {name: '', value: '填写发票号', neglect: true},
  143. ];
  144. let _this = this;
  145. setTimeout(function () {
  146. let header = new Header({
  147. el: "#header",
  148. column: column,
  149. data: _this.procurementCheckSheets,
  150. restorationColumn: 'id',
  151. fixedTop: ($('#form_div').height()) + 2,
  152. offset: 0.5,
  153. vue: vue
  154. });
  155. header.init();
  156. }, 0);
  157. },
  158. methods: {
  159. //全选事件
  160. checkAll(e) {
  161. if (e.target.checked) {
  162. this.procurementCheckSheets.forEach((el, i) => {
  163. if (this.checkData.indexOf(el.id) == '-1') {
  164. this.checkData.push(el.id);
  165. }
  166. });
  167. } else {
  168. this.checkData = [];
  169. }
  170. },
  171. fillInvoiceNumber(id){
  172. let _this=this;
  173. _this.procurementCheckSheetId=id;
  174. $('#fill-invoice-number').modal('show');
  175. },
  176. fillInvoice(){
  177. let _this=this;
  178. if (!_this.procurementCheckSheetId)return;
  179. if (!_this.invoice_number){
  180. tempTip.setDuration(3000);
  181. tempTip.show('发票号不可为空!');
  182. }
  183. let url = '{{url('procurement/finance/fillInvoice')}}';
  184. let params = {invoice_number:_this.invoice_number,procurementCheckSheetId:_this.procurementCheckSheetId};
  185. window.axios.post(url,params).then(function (res) {
  186. if (!res.data.success){
  187. tempTip.setDuration(3000);
  188. tempTip.show(res.data.message);
  189. }else {
  190. _this.procurementCheckSheets.forEach(function (procurementCheckSheet) {
  191. if (procurementCheckSheet.id===_this.procurementCheckSheetId){
  192. procurementCheckSheet.invoice_number=_this.invoice_number;
  193. }
  194. });
  195. $("#fill-invoice-number").modal('hide');
  196. tempTip.setDuration(3000);
  197. tempTip.showSuccess('添加发票号成功!');
  198. }
  199. }).catch(function (err) {
  200. tempTip.setDuration(3000);
  201. tempTip.show('添加发票号失败!网络错误:'+err);
  202. });
  203. },
  204. checkBillExport(selectAll){
  205. let url = '{{url('procurement/finance/checkBillExport')}}';
  206. let token='{{ csrf_token() }}';
  207. excelExport(selectAll,this.checkData,url,this.sum,token);
  208. },
  209. }
  210. });
  211. </script>
  212. @endsection