create.blade.php 3.0 KB

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