index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <div class="registration-query flex flex-col h-full">
  3. <SearchForm :fields="fields" :params="params"></SearchForm>
  4. <div class="flex-1 page-wrap">
  5. <div class="btn-group">
  6. <t-button theme="success" @click="handleAdd">新增</t-button>
  7. <t-button theme="success" @click="handleImport">批量导入</t-button>
  8. </div>
  9. <t-table
  10. size="small"
  11. row-key="id"
  12. :columns="columns"
  13. :data="tableData"
  14. bordered
  15. :pagination="{
  16. defaultCurrent: 1,
  17. defaultPageSize: 10,
  18. onChange,
  19. total: pagination.total,
  20. }"
  21. >
  22. </t-table>
  23. </div>
  24. <edit-customer-dialog
  25. v-model:visible="showEditCustomerDialog"
  26. :curRow="curRow"
  27. @success="fetchData"
  28. ></edit-customer-dialog>
  29. </div>
  30. </template>
  31. <script setup lang="jsx" name="CustomerManage">
  32. import { ref, reactive } from 'vue';
  33. import useFetchTable from '@/hooks/useFetchTable';
  34. import EditCustomerDialog from './edit-customer-dialog.vue';
  35. import { customerListApi } from '@/api/system';
  36. const showEditCustomerDialog = ref(false);
  37. const curRow = ref(null);
  38. const columns = [
  39. { colKey: 'id', title: '客户ID' },
  40. { colKey: 'name', title: '客户名称' },
  41. { colKey: 'type', title: '客户类型' },
  42. { colKey: 'province', title: '省份' },
  43. { colKey: 'city', title: '城市' },
  44. { colKey: 'area', title: '县区' },
  45. { colKey: 'address', title: '地址' },
  46. { colKey: 'manager', title: '客户经理' },
  47. { colKey: 'serviceName', title: '服务档位名称' },
  48. { colKey: 'roles', title: '项目角色配置' },
  49. { colKey: 'k', title: '标准人天' },
  50. { colKey: 'l', title: '创建人' },
  51. { colKey: 'm', title: '创建时间' },
  52. {
  53. title: '管理',
  54. colKey: 'operate',
  55. fixed: 'right',
  56. width: 120,
  57. align: 'center',
  58. cell: (h, { row }) => {
  59. return (
  60. <div class="table-operations">
  61. <t-link
  62. theme="primary"
  63. hover="color"
  64. onClick={(e) => {
  65. e.stopPropagation();
  66. handleEdit(row);
  67. }}
  68. >
  69. 修改
  70. </t-link>
  71. <t-link
  72. theme="danger"
  73. hover="color"
  74. onClick={(e) => {
  75. e.stopPropagation();
  76. handleDelete(row);
  77. }}
  78. >
  79. 删除
  80. </t-link>
  81. </div>
  82. );
  83. },
  84. },
  85. ];
  86. const {
  87. loading: tableLoading,
  88. pagination,
  89. tableData,
  90. fetchData,
  91. onChange,
  92. } = useFetchTable(customerListApi);
  93. const refresh = async () => {};
  94. const fields = ref([
  95. {
  96. prop: 'a',
  97. label: '客户类型',
  98. type: 'select',
  99. labelWidth: 100,
  100. colSpan: 5,
  101. options: [
  102. { value: 1, label: '研究生' },
  103. { value: 2, label: '高校教务处' },
  104. ],
  105. },
  106. {
  107. prop: 'b',
  108. label: '客户经理',
  109. type: 'select',
  110. labelWidth: 100,
  111. colSpan: 5,
  112. options: [{ value: 1, label: '张三' }],
  113. },
  114. {
  115. prop: 'd',
  116. label: '客户名称',
  117. labelWidth: 100,
  118. colSpan: 5,
  119. attrs: {
  120. placeholder: '消息名称模糊查询',
  121. clearable: true,
  122. },
  123. },
  124. {
  125. prop: 'b',
  126. label: '服务档位',
  127. type: 'select',
  128. labelWidth: 100,
  129. colSpan: 5,
  130. options: [{ value: 1, label: '一档' }],
  131. },
  132. {
  133. type: 'buttons',
  134. colSpan: 2,
  135. children: [
  136. {
  137. type: 'button',
  138. text: '查询',
  139. },
  140. ],
  141. },
  142. ]);
  143. const params = reactive({
  144. a: '',
  145. b: '',
  146. c: [],
  147. d: '',
  148. });
  149. const handleAdd = () => {
  150. curRow.value = null;
  151. showEditCustomerDialog.value = true;
  152. };
  153. const handleImport = () => {
  154. console.log('import');
  155. };
  156. const handleDelete = (row) => {
  157. console.log(row);
  158. };
  159. const handleEdit = (row) => {
  160. console.log(row);
  161. curRow.value = row;
  162. showEditCustomerDialog.value = true;
  163. };
  164. </script>
  165. <style></style>