index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. <template>
  2. <BsPageWrapper>
  3. <bs-table v-bind="tableOptions">
  4. <template #searchRight>
  5. <div>
  6. <a-button type="primary" >
  7. <span>服务商入库登记</span>
  8. </a-button>
  9. </div>
  10. </template>
  11. </bs-table>
  12. </BsPageWrapper>
  13. </template>
  14. <script setup lang="jsx">
  15. import { ref, reactive, onMounted, nextTick } from "vue"
  16. import { useRouter } from "vue-router";
  17. import BsTable, { useBsTable } from '/@/components/BsUi/Table/index.js';
  18. import { DISPLAY_STATE } from '/@/components/BsUi/constant.js';
  19. import useBsDict from "/@/utils/dict.js";
  20. const router = useRouter()
  21. const generateMockData = () => {
  22. const mockData = [];
  23. const providerNames = ['阿里云', '腾讯云', '华为云', '百度智能云', '京东云', '金山云', 'UCloud', '青云', '七牛云', '又拍云'];
  24. const regions = ['中国', '美国', '日本', '德国', '英国', '新加坡', '澳大利亚', '韩国', '印度', '巴西'];
  25. const provinces = ['北京', '上海', '广东', '江苏', '浙江', '四川', '湖北', '陕西', '重庆', '福建'];
  26. const cities = ['北京市', '上海市', '广州市', '深圳市', '杭州市', '成都市', '武汉市', '西安市', '重庆市', '厦门市'];
  27. const districts = ['朝阳区', '浦东新区', '天河区', '南山区', '余杭区', '武侯区', '武昌区', '雁塔区', '渝北区', '思明区'];
  28. const providerTypes = ['云服务商', '系统集成商', '软件开发商', '硬件供应商', '咨询服务商', '培训服务商', '运维服务商', '安全服务商', '数据分析商', 'AI服务商'];
  29. const contacts = ['张伟', '李娜', '王芳', '刘强', '陈静', '杨磊', '赵敏', '黄丽', '周军', '吴秀英'];
  30. for (let i = 0; i < 5; i++) {
  31. mockData.push({
  32. id: `SP${10000 + i}`,
  33. interviewStatus: Math.floor(Math.random() * 3), // 0-待审核,1-审核中,2-审核完毕
  34. flowId: `FLOW${20230000 + i}`,
  35. storeSource: ['官网注册', '渠道推荐', '展会收集', '客户转介'][Math.floor(Math.random() * 4)],
  36. providerName: providerNames[Math.floor(Math.random() * providerNames.length)],
  37. countryRegion: regions[Math.floor(Math.random() * regions.length)],
  38. provinceName: provinces[Math.floor(Math.random() * provinces.length)],
  39. cityName: cities[Math.floor(Math.random() * cities.length)],
  40. districtName: districts[Math.floor(Math.random() * districts.length)],
  41. address: `${provinces[Math.floor(Math.random() * provinces.length)]}${cities[Math.floor(Math.random() * cities.length)]}${districts[Math.floor(Math.random() * districts.length)]}科技园${Math.floor(Math.random() * 20) + 1}号`,
  42. providerType: providerTypes[Math.floor(Math.random() * providerTypes.length)],
  43. contactPeople: contacts[Math.floor(Math.random() * contacts.length)],
  44. contactPhone: `1${Math.floor(Math.random() * 900000000) + 100000000}`,
  45. createTime: new Date(Date.now() - Math.floor(Math.random() * 365 * 24 * 60 * 60 * 1000)).toISOString().replace('T', ' ').substring(0, 19)
  46. });
  47. }
  48. return mockData;
  49. };
  50. const {
  51. tableOptions,
  52. setTablePropsValue: setValue,
  53. getTablePropsValue: getValue,
  54. } = useBsTable({
  55. tableOptions: {
  56. // url: '/supports/provider/queryPage',
  57. gridOptions: {
  58. loading: false,
  59. columns: [
  60. {
  61. type: 'seq',
  62. width: 80,
  63. },
  64. {
  65. field: 'interviewStatus',
  66. title: '状态',
  67. slots: {
  68. default: ({ row }) => {
  69. if (row.interviewStatus === 0) {
  70. return <span style={{ color: '#ed8a94' }}>未面试</span>
  71. } else if (row.interviewStatus === 1) {
  72. return <span style={{ color: '#dc861f' }}>面试中</span>
  73. } else if (row.interviewStatus === 2) {
  74. return <span style={{ color: '#70b603' }}>面试完毕</span>
  75. }
  76. }
  77. }
  78. },
  79. {
  80. field: 'flowId',
  81. title: '流水号',
  82. },
  83. {
  84. field: 'storeSource',
  85. title: '来源',
  86. },
  87. {
  88. field: 'providerName',
  89. title: '服务商名称',
  90. },
  91. {
  92. field: 'id',
  93. title: '服务商ID',
  94. },
  95. {
  96. field: 'countryRegion',
  97. title: '服务商地区',
  98. },
  99. {
  100. field: 'address',
  101. title: '服务商地址',
  102. slots: {
  103. default: ({ row }) => {
  104. return [...new Set(`${(row.countryRegion ?? '') + (row.provinceName ?? '') + (row.cityName ?? '') + (row.districtName ?? '')}`)]
  105. }
  106. }
  107. },
  108. {
  109. field: 'providerType',
  110. title: '服务商类型',
  111. // cellRender: {
  112. // name: 'CellDict',
  113. // },
  114. },
  115. {
  116. field: 'contactPeople',
  117. title: '联系人',
  118. },
  119. {
  120. field: 'contactPhone',
  121. title: '联系电话',
  122. },
  123. {
  124. field: 'createTime',
  125. title: '注册时间',
  126. },
  127. {
  128. // fixed: 'right',
  129. cellRender: {
  130. name: 'CellOption',
  131. extraProps: {
  132. buttons: [
  133. {
  134. title: '发起面试',
  135. code: 'view',
  136. display: ({ row }) => {
  137. return row.interviewStatus === 0 ? DISPLAY_STATE.VISIBLE : DISPLAY_STATE.HIDDEN;
  138. },
  139. disabled({ row }) {
  140. return false;
  141. },
  142. onClick({ row }) {
  143. openFlow(row)
  144. },
  145. extraProps: {},
  146. },
  147. {
  148. title: '查看详情',
  149. code: 'view',
  150. display: ({ row }) => {
  151. return row.interviewStatus !== 0 ? DISPLAY_STATE.VISIBLE : DISPLAY_STATE.HIDDEN;
  152. },
  153. disabled({ row }) {
  154. return false;
  155. },
  156. onClick({ row }) {
  157. router.push('/market-manage/service-provider-manage/detail?id=' + row.id)
  158. },
  159. extraProps: {},
  160. },
  161. ],
  162. },
  163. },
  164. },
  165. ],
  166. data:generateMockData(),
  167. },
  168. searchConfig: {
  169. enabled: true,
  170. fieldSpan: 4,
  171. fields: [
  172. {
  173. field: 'providerName',
  174. label: '服务商名称',
  175. component: 'a-input',
  176. componentProps: {
  177. placeholder: '请输入服务商名称',
  178. },
  179. },
  180. {
  181. field: 'address',
  182. label: '服务商地址',
  183. component: 'a-input',
  184. componentProps: {
  185. placeholder: '请输入服务商地址',
  186. },
  187. },
  188. {
  189. field: 'providerType',
  190. label: '服务商类型',
  191. component: 'a-select',
  192. componentProps: {
  193. options: useBsDict.getDictList('BLINK_PROVIDER_TYPE'),
  194. placeholder: '请输入服务商类型',
  195. },
  196. },
  197. ],
  198. },
  199. tableSearchBeforeBiz() {
  200. const searchParams = getValue('searchConfig.data');
  201. setValue('searchConfig.data', { ...searchParams, bizModel: 'INTERVIEW' });
  202. },
  203. },
  204. });
  205. function openFlow(row) {
  206. window.open(import.meta.env.VITE_APP_API_BASE_URL + '/MvcSheet/formWork?flowCode=PROVIDER_REGISTER&tag=START')
  207. }
  208. </script>
  209. <style lang="scss" scoped></style>