timeDialog.vue 3.4 KB

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