setAllValue.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <el-button
  3. size="small"
  4. type="primary"
  5. class="ele-btn-icon"
  6. style="margin-left: 5px"
  7. :disabled="disabled"
  8. @click="show = true"
  9. >批量设置{{ title }}
  10. <ele-modal
  11. custom-class="ele-dialog-form long-dialog-form"
  12. :centered="true"
  13. :visible.sync="show"
  14. :close-on-click-modal="false"
  15. width="600px"
  16. :maxable="true"
  17. :resizable="true"
  18. :append-to-body="true"
  19. >
  20. <div v-if="inputType === 'number'">
  21. {{ title }}:
  22. <el-input v-model="value" placeholder="请输入" type="number" />
  23. </div>
  24. <div v-else>
  25. {{ title }}:
  26. <el-date-picker
  27. v-model="value"
  28. type="date"
  29. placeholder="选择日期"
  30. value-format="yyyy-MM-dd"
  31. >
  32. </el-date-picker>
  33. </div>
  34. <div slot="footer" class="footer">
  35. <el-button type="primary" @click="warehouseChangeAll">确认</el-button>
  36. <el-button @click="show = false">返回</el-button>
  37. </div>
  38. </ele-modal>
  39. </el-button>
  40. </template>
  41. <script>
  42. export default {
  43. components: {},
  44. data() {
  45. return {
  46. show: false,
  47. value: ''
  48. };
  49. },
  50. props: {
  51. disabled: {
  52. default: true,
  53. type: Boolean
  54. },
  55. valueKey: '',
  56. inputType: '',
  57. title: ''
  58. },
  59. created() {},
  60. computed: {},
  61. methods: {
  62. warehouseChangeAll() {
  63. if (!this.value) {
  64. return this.$message.error(this.title + '不能为空!');
  65. }
  66. this.$emit('success', { key: this.valueKey, value: this.value });
  67. this.cancel();
  68. },
  69. cancel() {
  70. this.value = '';
  71. this.show = false;
  72. }
  73. }
  74. };
  75. </script>
  76. <style scoped lang="scss"></style>