create.blade.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. @extends('layouts.app')
  2. @section('title')作业类型-录入更新@endsection
  3. @section('content')
  4. <div id="nav2">
  5. @component('maintenance.menu')@endcomponent
  6. @component('maintenance.processMethod.menu')
  7. @if(isset($method))@can('作业类型-编辑')
  8. <li class="nav-item">
  9. <a class="nav-link" href="{{URL::current()}}" :class="{active:isActive('edit',4)}">编辑</a>
  10. </li> @endcan @endif
  11. @endcomponent
  12. </div>
  13. <div class="container-fluid card" id="container">
  14. <div class="card-body offset-3 mt-2">
  15. <form method="post" :action="method.id ? '{{url('maintenance/processMethod')}}/'+method.id : '{{url('maintenance/processMethod')}}'">
  16. @csrf
  17. @if(isset($method)) @method('PUT') @endif
  18. <div class="row">
  19. <label class="col-2 text-info" for="name">作业类型名称</label>
  20. <input type="text" class="form-control col-6" :class="errors.name ? 'is-invalid' : ''" id="name" name="name"
  21. v-model="method.name" required>
  22. <span class="offset-2 mt-0 invalid-feedback" v-if="errors.name">
  23. <strong>@{{errors.name[0]}}</strong>
  24. </span>
  25. </div>
  26. <div class="row mt-3">
  27. <label class="col-2" for="unit_id">作业类型单位</label>
  28. <select class="form-control col-3" :class="errors.unit_id ? 'is-invalid' : ''" id="unit_id" name="unit_id"
  29. v-model="method.unit_id">
  30. <option v-for="unit in units" :value="unit.id">@{{ unit.name }}</option>
  31. </select>
  32. <span class="offset-2 mt-0 invalid-feedback" v-if="errors.unit_id">
  33. <strong>@{{errors.unit_id[0]}}</strong>
  34. </span>
  35. </div>
  36. <div class="row mt-3">
  37. <label class="col-2" for="unit_price">作业类型单价</label>
  38. <input type="number" min="0" step="0.001" class="form-control col-6" id="unit_price" name="unit_price"
  39. :class="errors.unit_price ? 'is-invalid' : ''" v-model="method.unit_price">
  40. <span class="offset-2 mt-0 invalid-feedback" v-if="errors.unit_price">
  41. <strong>@{{errors.unit_price[0]}}</strong>
  42. </span>
  43. </div>
  44. <div class="row mt-3 offset-1">
  45. <button class="btn btn-success col-7">提交</button>
  46. </div>
  47. </form>
  48. </div>
  49. </div>
  50. @stop
  51. @section('lastScript')
  52. <script>
  53. new Vue({
  54. el:"#container",
  55. data:{
  56. method:{
  57. id : "{{isset($method) ? $method->id : ''}}",
  58. name : "{{old("name") ?? (isset($method) ? $method->name : '')}}",
  59. unit_id : "{{old("unit_id") ?? (isset($method) ? $method->unit_id : '')}}",
  60. unit_price : "{{old("unit_price") ?? (isset($method) ? $method->unit_price : '')}}",
  61. },
  62. errors : {!! $errors !!},
  63. units : [
  64. @foreach($units as $unit)
  65. {id:"{{$unit->id}}",name:"{{$unit->name}}"},
  66. @endforeach
  67. ],
  68. },
  69. });
  70. </script>
  71. @stop