search.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <script setup lang="ts">
  2. import { ref } from "vue";
  3. // https://plus-pro-components.com/components/search.html
  4. import "plus-pro-components/es/components/search/style/css";
  5. import { type PlusColumn, PlusSearch } from "plus-pro-components";
  6. const state = ref({
  7. status: "0",
  8. time: new Date().toString()
  9. });
  10. const columns: PlusColumn[] = [
  11. {
  12. label: "名称",
  13. prop: "name",
  14. valueType: "copy",
  15. tooltip: "名称最多显示6个字符"
  16. },
  17. {
  18. label: "状态",
  19. prop: "status",
  20. valueType: "select",
  21. options: [
  22. {
  23. label: "未解决",
  24. value: "0",
  25. color: "red"
  26. },
  27. {
  28. label: "已解决",
  29. value: "1",
  30. color: "blue"
  31. },
  32. {
  33. label: "解决中",
  34. value: "2",
  35. color: "yellow"
  36. },
  37. {
  38. label: "失败",
  39. value: "3",
  40. color: "red"
  41. }
  42. ]
  43. },
  44. {
  45. label: "时间",
  46. prop: "time",
  47. valueType: "date-picker"
  48. },
  49. {
  50. label: "数量",
  51. prop: "number",
  52. valueType: "input-number",
  53. fieldProps: { precision: 2, step: 2 }
  54. },
  55. {
  56. label: "城市",
  57. prop: "city",
  58. valueType: "cascader",
  59. options: [
  60. {
  61. value: "0",
  62. label: "陕西",
  63. children: [
  64. {
  65. value: "0-0",
  66. label: "西安",
  67. children: [
  68. {
  69. value: "0-0-0",
  70. label: "新城区"
  71. },
  72. {
  73. value: "0-0-1",
  74. label: "高新区"
  75. },
  76. {
  77. value: "0-0-2",
  78. label: "灞桥区"
  79. }
  80. ]
  81. }
  82. ]
  83. },
  84. {
  85. value: "1",
  86. label: "山西",
  87. children: [
  88. {
  89. value: "1-0",
  90. label: "太原",
  91. children: [
  92. {
  93. value: "1-0-0",
  94. label: "小店区"
  95. },
  96. {
  97. value: "1-0-1",
  98. label: "古交市"
  99. },
  100. {
  101. value: "1-0-2",
  102. label: "万柏林区"
  103. }
  104. ]
  105. }
  106. ]
  107. }
  108. ]
  109. },
  110. {
  111. label: "地区",
  112. prop: "place",
  113. tooltip: "请精确到门牌号",
  114. fieldProps: {
  115. placeholder: "请精确到门牌号"
  116. }
  117. },
  118. {
  119. label: "到期时间",
  120. prop: "endTime",
  121. valueType: "date-picker",
  122. fieldProps: {
  123. type: "datetimerange",
  124. startPlaceholder: "请选择",
  125. endPlaceholder: "请选择"
  126. }
  127. },
  128. {
  129. label: "奖励",
  130. prop: "price"
  131. },
  132. {
  133. label: "提成",
  134. prop: "percentage"
  135. }
  136. ];
  137. const handleChange = (values: any) => {
  138. console.log(values, "change");
  139. };
  140. const handleSearch = (values: any) => {
  141. console.log(values, "search");
  142. };
  143. const handleRest = () => {
  144. console.log("handleRest");
  145. };
  146. </script>
  147. <template>
  148. <PlusSearch
  149. v-model="state"
  150. :columns="columns"
  151. :show-number="2"
  152. label-width="80"
  153. label-position="right"
  154. @change="handleChange"
  155. @search="handleSearch"
  156. @reset="handleRest"
  157. />
  158. </template>