steps.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <script setup lang="ts">
  2. import { ref } from "vue";
  3. // https://plus-pro-components.com/components/steps-form.html
  4. import "plus-pro-components/es/components/steps-form/style/css";
  5. import { PlusStepsForm } from "plus-pro-components";
  6. const stepForm = ref([
  7. {
  8. title: "第一步",
  9. form: {
  10. labelPosition: "top",
  11. style: {
  12. width: "400px",
  13. margin: "40px auto"
  14. },
  15. modelValue: {},
  16. columns: [
  17. {
  18. label: "名称",
  19. width: 120,
  20. prop: "name",
  21. valueType: "copy",
  22. tooltip: "名称最多显示6个字符"
  23. },
  24. {
  25. label: "状态",
  26. width: 120,
  27. prop: "status",
  28. valueType: "select",
  29. options: [
  30. {
  31. label: "未解决",
  32. value: "0",
  33. color: "red"
  34. },
  35. {
  36. label: "已解决",
  37. value: "1",
  38. color: "blue"
  39. },
  40. {
  41. label: "解决中",
  42. value: "2",
  43. color: "yellow"
  44. },
  45. {
  46. label: "失败",
  47. value: "3",
  48. color: "red"
  49. }
  50. ]
  51. }
  52. ],
  53. rules: {
  54. name: [
  55. {
  56. required: true,
  57. message: "请输入名称"
  58. }
  59. ]
  60. }
  61. }
  62. },
  63. {
  64. title: "第二步",
  65. form: {
  66. labelPosition: "top",
  67. style: {
  68. width: "400px",
  69. margin: "40px auto"
  70. },
  71. labelWidth: "100",
  72. modelValue: {},
  73. columns: [
  74. {
  75. label: "标签",
  76. width: 120,
  77. prop: "tag"
  78. },
  79. {
  80. label: "执行进度",
  81. width: 200,
  82. prop: "progress"
  83. },
  84. {
  85. label: "评分",
  86. width: 200,
  87. prop: "rate",
  88. valueType: "rate"
  89. },
  90. {
  91. label: "是否显示",
  92. width: 100,
  93. prop: "switch",
  94. valueType: "switch"
  95. }
  96. ],
  97. rules: {
  98. tag: [
  99. {
  100. required: true,
  101. message: "请输入标签"
  102. }
  103. ],
  104. progress: [
  105. {
  106. required: true,
  107. message: "请输入执行进度"
  108. }
  109. ]
  110. }
  111. }
  112. },
  113. {
  114. title: "第三步",
  115. form: {
  116. labelPosition: "top",
  117. style: {
  118. width: "400px",
  119. margin: "40px auto"
  120. },
  121. modelValue: {},
  122. columns: [
  123. {
  124. label: "时间",
  125. prop: "time",
  126. valueType: "date-picker"
  127. },
  128. {
  129. label: "要求",
  130. prop: "demand",
  131. valueType: "checkbox",
  132. options: [
  133. {
  134. label: "四六级",
  135. value: "0"
  136. },
  137. {
  138. label: "计算机二级证书",
  139. value: "1"
  140. },
  141. {
  142. label: "普通话证书",
  143. value: "2"
  144. }
  145. ]
  146. },
  147. {
  148. label: "奖励",
  149. prop: "price"
  150. },
  151. {
  152. label: "提成",
  153. prop: "percentage"
  154. },
  155. {
  156. label: "说明",
  157. prop: "desc",
  158. valueType: "textarea",
  159. fieldProps: {
  160. maxlength: 10,
  161. showWordLimit: true,
  162. autosize: { minRows: 2, maxRows: 4 }
  163. }
  164. }
  165. ],
  166. rules: {
  167. time: [
  168. {
  169. required: true,
  170. trigger: "change",
  171. message: "请选择时间"
  172. }
  173. ],
  174. demand: [
  175. {
  176. required: true,
  177. trigger: "change",
  178. message: "请选择要求"
  179. }
  180. ]
  181. }
  182. }
  183. }
  184. ]);
  185. const active = ref(1);
  186. const next = (actives: number, values: any) => {
  187. active.value = actives;
  188. console.log(active, values, stepForm.value);
  189. };
  190. </script>
  191. <template>
  192. <PlusStepsForm
  193. v-model="active"
  194. simple
  195. class="w-[800px] m-auto"
  196. :data="stepForm as any"
  197. align-center
  198. @next="next"
  199. />
  200. </template>