timeDialog.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <el-dialog :title="title" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
  3. :close-on-press-escape="false" append-to-body width="35%">
  4. <el-form :model="form" ref="tableForm" class="tableForm" :rules="tableFormRules">
  5. <el-table ref="multipleTable" :data="form.timeList" tooltip-effect="dark" style="width: 100%" stripe
  6. :header-cell-style="{ background: '#EEEEEE', border: 'none' }">
  7. <el-table-column label="数量" prop="purchaseQuantity">
  8. <template slot-scope="{ row, $index }">
  9. <el-form-item :prop="'timeList.' + $index + '.purchaseQuantity'"
  10. >
  11. <el-input placeholder="请输入" disabled v-model="row.purchaseQuantity"></el-input>
  12. </el-form-item>
  13. </template>
  14. </el-table-column>
  15. <el-table-column label="到货时间">
  16. <template slot-scope="{ row, $index }">
  17. <el-form-item :prop="'timeList.' + $index + '.requireDeliveryTime'"
  18. :rules="tableFormRules.requireDeliveryTime">
  19. <el-date-picker disabled v-model="row.requireDeliveryTime" value-format="timestamp" placeholder="请选择日期">
  20. </el-date-picker>
  21. </el-form-item>
  22. </template></el-table-column>
  23. </el-table>
  24. </el-form>
  25. <div class="btns">
  26. <el-button size="small" @click="handleClose">取消</el-button>
  27. </div>
  28. </el-dialog>
  29. </template>
  30. <script>
  31. export default {
  32. components: {
  33. },
  34. data() {
  35. return {
  36. visible: false,
  37. title: '设置分批时间',
  38. current: null,
  39. form: {
  40. timeList: [
  41. {
  42. requireDeliveryTime: null,
  43. purchaseQuantity: null
  44. }
  45. ]
  46. },
  47. tableFormRules: {
  48. purchaseQuantity: {
  49. required: true,
  50. message: '请输入数量',
  51. trigger: 'blur'
  52. },
  53. requireDeliveryTime: {
  54. required: true,
  55. message: '请选择日期',
  56. trigger: 'change'
  57. }
  58. }
  59. }
  60. },
  61. watch: {
  62. },
  63. methods: {
  64. open(row) {
  65. this.form.timeList = row.timeList
  66. this.current = row;
  67. this.visible = true
  68. },
  69. handleClose() {
  70. this.visible = false
  71. this.form.timeList = [{
  72. requireDeliveryTime: null,
  73. purchaseQuantity: null
  74. }];
  75. },
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .btns {
  81. margin-top: 20px;
  82. text-align: center;
  83. }
  84. .el-form-item {
  85. margin-bottom: 20px !important;
  86. }
  87. </style>