add.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <div style="display: inline;">
  3. <el-dropdown @command="onShow">
  4. <el-button type="primary" size="small"> 阀门选型 </el-button>
  5. <el-dropdown-menu slot="dropdown">
  6. <el-dropdown-item :command="item.value" v-for="item in valvetypeList" :key="item.value">{{ item.remarks }}</el-dropdown-item>
  7. </el-dropdown-menu>
  8. </el-dropdown>
  9. <el-dialog custom-class="custom-select-option_class" :visible.sync="drawer" width="1100px" append-to-body :show-close="false">
  10. <component :position="position" @close="drawer=false" :is="formComponent" v-on="$listeners"></component>
  11. </el-dialog>
  12. </div>
  13. </template>
  14. <script>
  15. import { mapGetters } from "vuex";
  16. export default {
  17. props:['position'],
  18. data() {
  19. return {
  20. drawer: false,
  21. type: "",
  22. valvetypeList:[]
  23. };
  24. },
  25. provide () {
  26. return {
  27. valvetype:() => this.type
  28. }
  29. },
  30. computed: {
  31. ...mapGetters({
  32. loading: "loading",
  33. }),
  34. formComponent() {
  35. switch (this.type) {
  36. case "蝶阀":
  37. return () =>
  38. import("@/optionSystem/selectOption/components/DieFa.vue");
  39. break;
  40. default:
  41. break;
  42. }
  43. },
  44. },
  45. methods: {
  46. onShow(type) {
  47. this.type = type;
  48. this.drawer = true;
  49. },
  50. onSubmit() {
  51. this.$refs.target.$refs['form'].validate(async (valid) => {
  52. if (!valid) return false
  53. this.$refs.target.onSubmit(() => {
  54. this.$refs.target.refresh()
  55. this.drawer = false
  56. })
  57. });
  58. },
  59. optionList() {
  60. this.$store.dispatch("optiontypeselect", "valvetype").then((res) => {
  61. this.valvetypeList = res.data;
  62. console.log(this.valvetypeList, "阀门类型");
  63. });
  64. },
  65. },
  66. created () {
  67. this.optionList()
  68. }
  69. };
  70. </script>
  71. <style scoped>
  72. .dialog-footer {
  73. margin-top: 32px;
  74. text-align: center;
  75. }
  76. /deep/.el-dialog__header {
  77. display: none !important;
  78. }
  79. /deep/.el-dialog__body {
  80. padding-top: 0 !important;
  81. }
  82. </style>
  83. <style>
  84. @media screen and (max-width:1800px) {
  85. .custom-select-option_class.el-dialog {
  86. margin-top: 10px !important;
  87. }
  88. }
  89. </style>