formModel.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <template>
  2. <ele-form-dialog
  3. v-bind="formConfig"
  4. v-model="formFieldsData"
  5. v-dialogDrag
  6. :title="title"
  7. :request-fn="handleFormSubmit"
  8. :visible.sync="DialogVisible"
  9. width="550px"
  10. custom-class="abow_dialog"
  11. label-width="100px"
  12. label-position="left"
  13. :dialogAttrs="{ 'close-on-click-modal': false,'top':'8vh'}"
  14. />
  15. </template>
  16. <script>
  17. export default {
  18. props: ["formModelVisible", "title"],
  19. data() {
  20. return {
  21. formData: {},
  22. formFieldsData: {
  23. id:"",
  24. number: "",
  25. fan_id:"",
  26. work_location:"",
  27. parts:"",
  28. bolt_style:"",
  29. boit_type:"",
  30. info: "",
  31. },
  32. url: "workLocation",
  33. formConfig: {
  34. formDesc: {
  35. //风场id
  36. fan_id:{
  37. type: "cascader",
  38. label: "风机编号",
  39. isOptions: true,
  40. options: [],
  41. required: true,
  42. vif:true,
  43. attrs: {
  44. //查询
  45. filterable:true,
  46. props: {
  47. label: "text",
  48. value: "value",
  49. emitPath: false,
  50. multiple:false
  51. }
  52. }
  53. },
  54. number: {
  55. required:true,
  56. type: "input",
  57. label: "编号",
  58. },
  59. work_location: {
  60. type: "input",
  61. label: "工作位置",
  62. required:true
  63. },
  64. parts: {
  65. required:true,
  66. type: "select",
  67. label: "所属部件",
  68. required:true,
  69. options:[]
  70. },
  71. bolt_style:{
  72. type: "input",
  73. label: "螺丝样式",
  74. required:true
  75. },
  76. boit_type:{
  77. type: "input",
  78. label: "螺丝型号",
  79. required:true,
  80. rules: [
  81. {pattern: /^((0{1}\.\d{1,2})|([1-9]\d*\.{1}\d{1,2})|([1-9]+\d*)|0)$/,message: '请輸入正数,最多保存两位小数'}
  82. ]
  83. },
  84. info: {
  85. type: "textarea",
  86. label: "备注"
  87. }
  88. },
  89. order: ["number","fan_id","work_location","parts","bolt_style", "boit_type","info","info"]
  90. }
  91. };
  92. },
  93. created() {
  94. // this.$http.get("getwindfan").then(response => {
  95. // this.formConfig.formDesc.fan_id.options = response.data;
  96. // });
  97. // this.$http.get("get_device_mold",{ params: {type:2} }).then(resp => {
  98. // this.formConfig.formDesc.model.options = resp.data
  99. // });
  100. // this.$http.get("wrenchtype").then(response => {
  101. // this.formConfig.formDesc.wrench.options = response.data;
  102. // });
  103. // this.$http.get("synschemetype").then(response => {
  104. // this.formConfig.formDesc.fastening_scheme.options = response.data;
  105. // });
  106. },
  107. methods: {
  108. handleFormSubmit(data) {
  109. this.$parent.handleSubmit();
  110. },
  111. handleRequest(data) {
  112. return Promise.resolve();
  113. },
  114. handleRequestSuccess() {
  115. this.$message.success("发送成功");
  116. }
  117. },
  118. computed: {
  119. DialogVisible: {
  120. set(val) {
  121. this.$emit("sendVal", val); // 表示将子组件改变的值传递给父组件
  122. },
  123. get() {
  124. return this.formModelVisible; // 表示获取父组件的值
  125. }
  126. }
  127. }
  128. };
  129. </script>