index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <div class="maintenance-container">
  3. <PageTitle title="维保服务" />
  4. <el-button type="danger" plain @click="handleApply" style="float: right; margin-bottom: 10px">新增维保</el-button>
  5. <div v-if="tableData.length">
  6. <el-table v-loading="loading" :data="tableData" border style="width: 100%" ref="tableRef">
  7. <el-table-column prop="applicantName" label="申请人名称" min-width="130" align="center" />
  8. <el-table-column prop="applicantPhone" label="手机号码" min-width="110" align="center" />
  9. <el-table-column prop="serviceTime" label="服务时间" align="center">
  10. <template #default="{ row }">
  11. {{ getDictLabel(service_time_type, row.serviceTime) }}
  12. </template>
  13. </el-table-column>
  14. <el-table-column prop="monthMainten" label="月度维保次数" align="center" />
  15. <el-table-column prop="maintainType" label="维保类型" min-width="90" align="center">
  16. <template #default="{ row }">
  17. {{ getDictLabel(maintenance_type, row.maintainType) }}
  18. </template>
  19. </el-table-column>
  20. <el-table-column prop="serviceContentStr" label="维保类型" align="center" />
  21. <el-table-column label="操作" width="100" align="center">
  22. <template #default="{ row }">
  23. <el-button type="primary" link size="small" @click="handleView(row)">查看</el-button>
  24. <el-button type="danger" link size="small" @click="handleUpdate(row)">修改</el-button>
  25. </template>
  26. </el-table-column>
  27. </el-table>
  28. </div>
  29. <div class="empty-state" v-else>
  30. <div class="empty-icon">
  31. <img
  32. src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 160'%3E%3Crect fill='%23f5f5f5' width='200' height='160' rx='8'/%3E%3Crect x='50' y='60' width='100' height='70' fill='%23e0e0e0' rx='4'/%3E%3Crect x='60' y='70' width='80' height='8' fill='%23ccc'/%3E%3Crect x='60' y='85' width='60' height='6' fill='%23ccc'/%3E%3Crect x='60' y='98' width='70' height='6' fill='%23ccc'/%3E%3Cpath d='M85 45 L95 55 L115 35' stroke='%23ccc' stroke-width='4' fill='none'/%3E%3C/svg%3E"
  33. alt="empty"
  34. />
  35. </div>
  36. <p class="empty-text">亲!您还未体验过优易办公金牌维保服务,还在犹豫什么!金牌服务从点击开始!</p>
  37. <el-button type="danger" plain @click="handleApply">加入金牌维保服务</el-button>
  38. </div>
  39. </div>
  40. </template>
  41. <script setup lang="ts">
  42. import { getMaintainInfoList, listServerItem } from '@/api/pc/valueAdded';
  43. import { PageTitle } from '@/components';
  44. import { useRouter } from 'vue-router';
  45. const { proxy } = getCurrentInstance() as ComponentInternalInstance;
  46. const { service_time_type, maintenance_type } = toRefs<any>(proxy?.useDict('service_time_type', 'maintenance_type'));
  47. const router = useRouter();
  48. const pagination = reactive({ page: 1, pageSize: 5, total: 0 });
  49. const tableData = ref<any[]>([]);
  50. const loading = ref(false);
  51. const serviceContentList = ref<any[]>([]);
  52. const handleApply = () => {
  53. router.push(`/valueAdded/maintenanceApply`);
  54. };
  55. // 查看维保详情
  56. const handleView = (row: any) => {
  57. router.push({
  58. path: `/valueAdded/maintenanceApply`,
  59. query: { id: row.id, mode: 'view' }
  60. });
  61. };
  62. // 修改维保信息
  63. const handleUpdate = (row: any) => {
  64. router.push({
  65. path: `/valueAdded/maintenanceApply`,
  66. query: { id: row.id, mode: 'edit' }
  67. });
  68. };
  69. // 加载对账单列表
  70. const loadMaintainInfoList = async () => {
  71. try {
  72. loading.value = true;
  73. const queryParams = {
  74. pageNum: pagination.page,
  75. pageSize: pagination.pageSize
  76. };
  77. const res = await getMaintainInfoList(queryParams);
  78. if (res.code === 200 && res.rows) {
  79. tableData.value = res.rows;
  80. pagination.total = res.total || 0;
  81. }
  82. } catch (error) {
  83. ElMessage.error('加载维保列表失败');
  84. } finally {
  85. loading.value = false;
  86. }
  87. };
  88. const getDictLabel = (dictOptions: any[], value: string) => {
  89. if (!dictOptions || !value) return value;
  90. const dict = dictOptions.find((item) => item.value === value);
  91. return dict ? dict.label : value;
  92. };
  93. // 加载服务内容列表
  94. const loadServiceContentList = async () => {
  95. try {
  96. const res = await listServerItem({});
  97. serviceContentList.value = res.rows || [];
  98. } catch (error) {
  99. ElMessage.error('加载服务内容列表失败');
  100. }
  101. };
  102. onMounted(() => {
  103. loadServiceContentList();
  104. loadMaintainInfoList();
  105. });
  106. </script>
  107. <style scoped lang="scss">
  108. .maintenance-container {
  109. padding: 20px;
  110. background: #fff;
  111. min-height: 100%;
  112. flex: 1;
  113. border-radius: 4px;
  114. }
  115. .empty-state {
  116. display: flex;
  117. flex-direction: column;
  118. align-items: center;
  119. justify-content: center;
  120. padding: 100px 20px;
  121. .empty-icon {
  122. width: 200px;
  123. height: 160px;
  124. margin-bottom: 24px;
  125. img {
  126. width: 100%;
  127. height: 100%;
  128. }
  129. }
  130. .empty-text {
  131. font-size: 14px;
  132. color: #666;
  133. margin-bottom: 24px;
  134. }
  135. }
  136. </style>