checkBill.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  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 class="text-center">
  45. <a class="text-primary" @click="fillInvoiceNumber(procurementCheckSheet.id)" v-if="!procurementCheckSheet.invoice_number">填写发票号</a>
  46. <span v-else>-</span>
  47. </td>
  48. </tr>
  49. </table>
  50. @can('采购管理-财务-对账单')
  51. @include('procurement.finance._fillInvoiceNumber')
  52. @endcan
  53. <div class="text-info h5 btn btn">{{$procurementCheckSheets->count()}}/@{{ sum }}</div>
  54. <div>{{$procurementCheckSheets->appends($paginateParams)->links()}}</div>
  55. </div>
  56. @endsection
  57. @section('lastScript')
  58. <script type="text/javascript" src="{{mix('js/queryForm/export.js')}}"></script>
  59. <script type="text/javascript" src="{{mix('js/queryForm/queryForm.js')}}"></script>
  60. <script type="text/javascript" src="{{mix('js/queryForm/header.js')}}"></script>
  61. <script>
  62. let vue = new Vue({
  63. el: '#list',
  64. data: {
  65. procurementCheckSheets: [
  66. @foreach($procurementCheckSheets as $procurementCheckSheet)
  67. {
  68. id:'{{$procurementCheckSheet->id}}',invoice_number:'{{$procurementCheckSheet->invoice_number}}',account_payable:'{{$procurementCheckSheet->account_payable}}',
  69. created_at:'{{$procurementCheckSheet->created_at}}',auditor:'{{$procurementCheckSheet->auditor}}',status:'{{$procurementCheckSheet->status}}',
  70. @if($procurementCheckSheet->procurementDelivery)
  71. amount:'{{$procurementCheckSheet->procurementDelivery->amount}}',initiator:'{{$procurementCheckSheet->procurementDelivery->initiator}}',
  72. signer:'{{$procurementCheckSheet->procurementDelivery->signer}}',signed_at:'{{$procurementCheckSheet->procurementDelivery->signed_at}}',
  73. procurement_delivery_at:'{{$procurementCheckSheet->procurementDelivery->created_at}}',@endif
  74. @if($procurementCheckSheet->procurementDelivery->procurement)
  75. procurement_quantity:'{{$procurementCheckSheet->procurementDelivery->procurement->quantity}}',
  76. procurement_code:'{{$procurementCheckSheet->procurementDelivery->procurement->code}}',
  77. procurement_at:'{{$procurementCheckSheet->procurementDelivery->procurement->created_at}}',@endif
  78. @if($procurementCheckSheet->procurementDelivery->receiver)
  79. signer_name:'{{$procurementCheckSheet->procurementDelivery->receiver->name}}',@endif
  80. @if($procurementCheckSheet->procurementDelivery->procurement->supplier)
  81. supplier_id:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->id}}',supplier_name:'{{$procurementCheckSheet->procurementDelivery->procurement->supplier->name}}',@endif
  82. @if($procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material)
  83. material_id:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->id}}',
  84. material_name:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->name}}',
  85. material_code:'{{$procurementCheckSheet->procurementDelivery->procurement->ownerMaterial->material->code}}',@endif
  86. },
  87. @endforeach
  88. ],
  89. suppliers:[
  90. @foreach($suppliers as $supplier)
  91. {name:'{{$supplier->id}}',value:'{{$supplier->name}}'},
  92. @endforeach
  93. ],
  94. materials: [
  95. @foreach($materials as $material)
  96. {name:'{{$material->id}}',value:'{{$material->name}}'},
  97. @endforeach
  98. ],
  99. checkData: [],
  100. sum:{!! $procurementCheckSheets->total() !!},
  101. procurement_check_sheet_status:{!! json_encode(\App\ProcurementCheckSheet::status,JSON_UNESCAPED_UNICODE) !!},
  102. invoice_number:'',procurementCheckSheetId:null,
  103. },
  104. mounted: function () {
  105. $(".tooltipTarget").tooltip({'trigger': 'hover'});
  106. $('#list').removeClass('d-none');
  107. let data = [
  108. [
  109. {name: 'signed_at', type: 'dateTime', tip: '选择显示指定的签收日期'},
  110. {
  111. name: 'supplier_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的供应商'],
  112. placeholder: ['供应商', '定位或多选供应商'], data: this.suppliers
  113. },
  114. {
  115. name: 'status', type: 'select',
  116. tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的耗材'],
  117. placeholder: '对账单状态',
  118. data: [{name:0,value:'未出账'},{name:1,value:'已出账'},{name:2,value:'已完结'},],
  119. },
  120. ],
  121. ];
  122. this.form = new query({
  123. el: "#form_div",
  124. condition: data,
  125. });
  126. this.form.init();
  127. let column = [
  128. {
  129. name: 'cloneCheckAll', customization: true, type: 'checkAll',column:'id',
  130. dom: $('#cloneCheckAll').removeClass('d-none'), neglect: true
  131. },
  132. {name: 'code', value: '采购编号', neglect: true},
  133. {name: 'procurement_at', value: '采购日期', class: ''},
  134. {name: '', value: '送货日期', class: 'text-muted'},
  135. {name: 'company_name', value: '供应商名称', class: 'text-muted'},
  136. {name: 'material_code', value: '耗材编号', class: 'text-muted'},
  137. {name: 'material_name', value: '耗材'},
  138. {name: 'quantity', value: '采购数量', class: 'text-muted'},
  139. {name: 'amount', value: '送货数量', class: 'text-muted'},
  140. {name: 'signer', value: '签收人', class: 'text-muted'},
  141. {name: 'signed_at', value: '签收日期', class: 'text-muted'},
  142. {name: '', value: '应付金额', neglect: true},
  143. {name: '', value: '发票号', neglect: true},
  144. {name: '', value: '状态', neglect: true},
  145. {name: '', value: '填写发票号', neglect: true},
  146. ];
  147. let _this = this;
  148. setTimeout(function () {
  149. let header = new Header({
  150. el: "#header",
  151. column: column,
  152. data: _this.procurementCheckSheets,
  153. restorationColumn: 'id',
  154. fixedTop: ($('#form_div').height()) + 2,
  155. offset: 0.5,
  156. vue: vue
  157. });
  158. header.init();
  159. }, 0);
  160. },
  161. methods: {
  162. //全选事件
  163. checkAll(e) {
  164. if (e.target.checked) {
  165. this.procurementCheckSheets.forEach((el, i) => {
  166. if (this.checkData.indexOf(el.id) == '-1') {
  167. this.checkData.push(el.id);
  168. }
  169. });
  170. } else {
  171. this.checkData = [];
  172. }
  173. },
  174. fillInvoiceNumber(id){
  175. let _this=this;
  176. _this.procurementCheckSheetId=id;
  177. $('#fill-invoice-number').modal('show');
  178. },
  179. fillInvoice(){
  180. let _this=this;
  181. if (!_this.procurementCheckSheetId)return;
  182. if (!_this.invoice_number){
  183. tempTip.setDuration(3000);
  184. tempTip.show('发票号不可为空!');
  185. return;
  186. }
  187. let url = '{{url('procurement/finance/fillInvoice')}}';
  188. let params = {invoice_number:_this.invoice_number,procurementCheckSheetId:_this.procurementCheckSheetId};
  189. window.axios.post(url,params).then(function (res) {
  190. if (!res.data.success){
  191. tempTip.setDuration(3000);
  192. tempTip.show(res.data.message);
  193. }else {
  194. _this.procurementCheckSheets.forEach(function (procurementCheckSheet) {
  195. if (procurementCheckSheet.id===_this.procurementCheckSheetId){
  196. procurementCheckSheet.invoice_number=_this.invoice_number;
  197. }
  198. });
  199. $("#fill-invoice-number").modal('hide');
  200. tempTip.setDuration(3000);
  201. tempTip.showSuccess('添加发票号成功!');
  202. }
  203. }).catch(function (err) {
  204. tempTip.setDuration(3000);
  205. tempTip.show('添加发票号失败!网络错误:'+err);
  206. });
  207. },
  208. checkBillExport(selectAll){
  209. let url = '{{url('procurement/finance/checkBillExport')}}';
  210. let token='{{ csrf_token() }}';
  211. excelExport(selectAll,this.checkData,url,this.sum,token);
  212. },
  213. }
  214. });
  215. </script>
  216. @endsection