index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <BsPageWrapper>
  3. <bs-table v-bind="tableOptions">
  4. <template #toolbarLeft>
  5. <a-space> 待审核客户 3 |审核中客户 23 </a-space>
  6. </template>
  7. </bs-table>
  8. </BsPageWrapper>
  9. </template>
  10. <script setup>
  11. import { ref, reactive } from 'vue';
  12. import BsTable, { useBsTable } from '/@/components/BsUi/Table/index.js';
  13. import { DISPLAY_STATE } from '/@/components/BsUi/constant.js';
  14. import { useRouter } from 'vue-router';
  15. const router = useRouter();
  16. const generateReviewCustomerData = () => {
  17. // 基础数据配置
  18. const statuses = ['待审核', '审核中', '已驳回', '已通过'];
  19. const customerNames = ['阿里巴巴', '腾讯科技', '百度在线', '京东集团', '字节跳动'];
  20. const regions = ['华东', '华北', '华南', '华中', '西南'];
  21. const customerTypes = ['企业客户', '政府客户', '教育客户', '金融客户'];
  22. const marketers = ['张经理', '李主管', '王总监', '赵专员'];
  23. const addresses = [
  24. '杭州市余杭区文一西路969号',
  25. '深圳市南山区科技中一路腾讯大厦',
  26. '北京市海淀区上地十街10号',
  27. '北京市亦庄经济开发区科创十一街18号'
  28. ];
  29. // 生成20条数据
  30. const data = [];
  31. for (let i = 0; i < 8; i++) {
  32. const isPending = Math.random() > 0.7; // 30%待审核
  33. const status = isPending ? '待审核' :
  34. Math.random() > 0.5 ? '审核中' :
  35. Math.random() > 0.5 ? '已驳回' : '已通过';
  36. data.push({
  37. status: status,
  38. customerName: customerNames[Math.floor(Math.random() * customerNames.length)],
  39. customerId: `CUST${20230000 + i}`,
  40. address: addresses[Math.floor(Math.random() * addresses.length)],
  41. region: regions[Math.floor(Math.random() * regions.length)],
  42. customerType: customerTypes[Math.floor(Math.random() * customerTypes.length)],
  43. operateTime: new Date(Date.now() - Math.floor(Math.random() * 7 * 24 * 60 * 60 * 1000))
  44. .toISOString().replace('T', ' ').substring(0, 19),
  45. submitCycle: `${Math.floor(Math.random() * 5) + 1}天`, // 1-5天
  46. marketer: marketers[Math.floor(Math.random() * marketers.length)],
  47. id: `REV${10000 + i}`
  48. });
  49. }
  50. return data;
  51. };
  52. const {
  53. tableOptions,
  54. setTablePropsValue: setValue,
  55. getTablePropsValue: getValue,
  56. } = useBsTable({
  57. tableOptions: {
  58. // url: '/supports/customer/queryPage',
  59. gridOptions: {
  60. loading: false,
  61. columns: [
  62. {
  63. type: 'seq',
  64. width: 80,
  65. },
  66. {
  67. field: 'status',
  68. title: '状态',
  69. width: 200,
  70. },
  71. {
  72. field: 'customerName',
  73. title: '客户名称',
  74. width: 200,
  75. },
  76. {
  77. field: 'customerId',
  78. title: '客户ID',
  79. width: 200,
  80. },
  81. {
  82. field: 'address',
  83. title: '客户地址',
  84. width: 200,
  85. },
  86. {
  87. field: 'region',
  88. title: '归属区域',
  89. width: 200,
  90. },
  91. {
  92. field: 'customerType',
  93. title: '客户类型',
  94. width: 200,
  95. },
  96. {
  97. field: 'operateTime',
  98. title: '操作时间',
  99. width: 200,
  100. },
  101. {
  102. field: 'submitCycle',
  103. title: '提交周期',
  104. width: 200,
  105. },
  106. {
  107. field: 'marketer',
  108. title: '归属营销人',
  109. width: 200,
  110. },
  111. {
  112. // fixed: 'right',
  113. cellRender: {
  114. name: 'CellOption',
  115. extraProps: {
  116. buttons: [
  117. {
  118. title: '去审核',
  119. code: 'edit',
  120. display: ({ row }) => {
  121. return DISPLAY_STATE.VISIBLE;
  122. },
  123. disabled({ row }) {
  124. return false;
  125. },
  126. onClick({ row }) { },
  127. extraProps: {},
  128. },
  129. {
  130. title: '查看详情',
  131. code: 'view',
  132. display: ({ row }) => {
  133. return DISPLAY_STATE.VISIBLE;
  134. },
  135. disabled({ row }) {
  136. return false;
  137. },
  138. onClick({ row }) {
  139. router.push({
  140. path: '/customer-manage/customer-detail',
  141. query: {
  142. id: row.id,
  143. },
  144. });
  145. },
  146. extraProps: {},
  147. },
  148. ],
  149. },
  150. },
  151. },
  152. ],
  153. data:generateReviewCustomerData(),
  154. },
  155. searchConfig: {
  156. enabled: true,
  157. fieldSpan: 4,
  158. fields: [
  159. {
  160. field: 'name',
  161. label: '客户名称',
  162. component: 'a-input',
  163. componentProps: {
  164. placeholder: '请输入客户名称',
  165. },
  166. },
  167. {
  168. field: 'name',
  169. label: '客户地址',
  170. component: 'a-input',
  171. componentProps: {
  172. placeholder: '请输入客户地址',
  173. },
  174. },
  175. {
  176. field: 'name',
  177. label: '客户类型',
  178. component: 'a-select',
  179. componentProps: {
  180. placeholder: '请输入客户类型',
  181. },
  182. },
  183. ],
  184. onSearch() {
  185. fetchTableData();
  186. },
  187. onReset() {
  188. fetchTableData();
  189. },
  190. },
  191. toolbarConfig: {
  192. onRefresh() {
  193. fetchTableData();
  194. },
  195. },
  196. },
  197. });
  198. </script>
  199. <style lang="scss" scoped></style>