formModel.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  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="450px"
  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. is_used:"",
  24. department_id: "",
  25. number: "",
  26. name: "",
  27. model: "",
  28. outside:"",
  29. torque:"",
  30. stress:"",
  31. bolt_size:"",
  32. bolt_number:"",
  33. install_position:"",
  34. brand:"",
  35. supplier:"",
  36. out_date:"",
  37. remark: "",
  38. },
  39. url: "flange",
  40. formConfig: {
  41. formDesc: {
  42. is_used: {
  43. type: "select",
  44. label: "使用状态",
  45. isOptions: true,
  46. options: [
  47. {
  48. text: "使用",
  49. value: 1
  50. },
  51. {
  52. text: "未使用",
  53. value: -1
  54. },
  55. {
  56. text: "已废弃",
  57. value: -2
  58. }
  59. ]
  60. },
  61. department_id: {
  62. type: "cascader",
  63. label: "所属部门",
  64. isOptions: true,
  65. options: [],
  66. required: true,
  67. attrs: {
  68. props: {
  69. label: "department_name",
  70. value: "id",
  71. emitPath: false,
  72. checkStrictly: true
  73. }
  74. }
  75. },
  76. //风场id
  77. fan_id:{
  78. type: "cascader",
  79. label: "风机编号",
  80. isOptions: true,
  81. options: [],
  82. required: true,
  83. attrs: {
  84. //查询
  85. filterable:true,
  86. props: {
  87. label: "text",
  88. value: "value",
  89. emitPath: false,
  90. checkStrictly: false,
  91. multiple:false
  92. }
  93. }
  94. },
  95. number: {
  96. type: "input",
  97. label: "编号",
  98. },
  99. name: {
  100. type: "input",
  101. label: "名称",
  102. required:true
  103. },
  104. model: {
  105. type: "select",
  106. label: "型号",
  107. required:true,
  108. isOptions: true,
  109. options:[]
  110. },
  111. outside:{
  112. type: "input",
  113. label: "外径"
  114. },
  115. torque:{
  116. type: "number",
  117. label: "扭矩",
  118. required:true,
  119. rules: [
  120. {
  121. type: "number",
  122. trigger: "blur",
  123. }
  124. ]
  125. },
  126. stress:{
  127. type: "number",
  128. label: "压力",
  129. rules: [
  130. {
  131. type: "number",
  132. trigger: "blur",
  133. message: "必须是数字"
  134. }
  135. ]
  136. },
  137. bolt_size: {
  138. type: "number",
  139. label: "螺栓尺寸",
  140. rules: [
  141. {
  142. type: "number",
  143. trigger: "blur",
  144. message: "必须是数字"
  145. }
  146. ]
  147. },
  148. bolt_number: {
  149. type: "number",
  150. label: "螺栓数量",
  151. rules: [
  152. {
  153. type: "number",
  154. trigger: "blur",
  155. message: "必须是数字"
  156. }
  157. ]
  158. },
  159. install_position:{
  160. type: "input",
  161. label: "安装位置"
  162. },
  163. brand: {
  164. type: "input",
  165. label: "品牌"
  166. },
  167. supplier: {
  168. type: "input",
  169. label: "供应商"
  170. },
  171. out_date: {
  172. type: "date",
  173. label: "出厂日期"
  174. },
  175. remark: {
  176. type: "textarea",
  177. label: "备注"
  178. }
  179. },
  180. order: ["is_used","department_id","fan_id","number", "name", "model","outside","torque","stress","bolt_size","bolt_number","install_position","brand","supplier","out_date","remark"]
  181. }
  182. };
  183. },
  184. created() {
  185. this.$http.get("departments").then(response => {
  186. this.formConfig.formDesc.department_id.options = response.data;
  187. });
  188. this.$http.get("getwindfan").then(response => {
  189. this.formConfig.formDesc.fan_id.options = response.data;
  190. });
  191. this.$http.get("devicetype").then(response => {
  192. this.formConfig.formDesc.model.options = response.data;
  193. });
  194. },
  195. methods: {
  196. handleFormSubmit(data) {
  197. this.$parent.handleSubmit();
  198. },
  199. handleRequest(data) {
  200. return Promise.resolve();
  201. },
  202. handleRequestSuccess() {
  203. this.$message.success("发送成功");
  204. }
  205. },
  206. computed: {
  207. DialogVisible: {
  208. set(val) {
  209. this.$emit("sendVal", val); // 表示将子组件改变的值传递给父组件
  210. },
  211. get() {
  212. return this.formModelVisible; // 表示获取父组件的值
  213. }
  214. }
  215. }
  216. };
  217. </script>