Przeglądaj źródła

```
feat(government): 更新员工导入记录接口类型定义并优化用户列表功能

- 调整 importRecordList 接口字段,移除 result 字段,新增 batchNo、channel、
completeTime、error、id、phone、realName、success 和 total 字段
- 用户列表页面增加 SVGIcon 组件用于下载失败记录
- 修改所属企业筛选项为 ApiSelect 下拉选择组件,并绑定 channelId 字段
- 优化导入结果展示逻辑,明确显示成功与失败条数,并支持点击图标下载失败数据
- 增加手机号码输入校验规则,限制长度为11位并验证格式
- 编辑和删除按钮状态根据 available 字段控制启用状态
- 移除首页项目资讯和创意横幅模块的引用与渲染

refactor(operation): 广告管理跳转链接字段标签及提示更新

- 将跳转链接字段标签修改为“链接和参数”
- 添加 placeholder 提示示例格式如:/pages/xxx?id=1
```

zhangtao 1 tydzień temu
rodzic
commit
390e55aab6

+ 10 - 14
src/typings/api.d.ts

@@ -732,22 +732,18 @@ declare namespace Api {
      * 员工导入记录
      */
     interface importRecordList {
-      /**
-       * 导入结果
-       */
-      result: string;
-      /**
-       * 创建时间
-       */
+      batchNo: string;
+      channel: string;
+      completeTime: string;
       createTime: string;
-      /**
-       * 任务名称
-       */
-      taskName: string;
-      /**
-       * 操作人
-       */
+      error: number;
+      id: number;
       operator: string;
+      phone: string;
+      realName: string;
+      success: number;
+      taskName: string;
+      total: number;
     }
   }
   namespace operation {

+ 48 - 24
src/views/government/user-list/index.vue

@@ -14,6 +14,8 @@ import { useTable } from '@/components/zt/Table/hooks/useTable';
 import { useModalFrom } from '@/components/zt/ModalForm/hooks/useModalForm';
 import type { ModalMethods } from '@/components/zt/Modal/types';
 import { useModal } from '@/components/zt/Modal/hooks/useModal';
+import SVGIcon from '@/components/custom/svg-icon.vue';
+
 const importTemplateRef = ref<ModalMethods>();
 const columns: NaiveUI.TableColumn<Api.government.userList>[] = [
   {
@@ -75,9 +77,14 @@ const [registerTable, { refresh, setTableLoading }] = useTable({
   searchFormConfig: {
     schemas: [
       {
-        field: 'channelName',
+        field: 'channelId',
         label: '所属企业',
-        component: 'NInput'
+        component: 'ApiSelect',
+        componentProps: {
+          api: fetchGetAllChannelList,
+          labelFeild: 'channelName',
+          valueFeild: 'id'
+        }
       },
       {
         field: 'realName',
@@ -141,27 +148,33 @@ const failColumns: NaiveUI.TableColumn<Api.government.importRecordList>[] = [
     align: 'center',
     width: 240,
     render(row) {
-      const resultText = row.result;
-      // 使用正则表达式匹配"失败X条"部分
-      const failedMatch = resultText.match(/(失败\d+条)/);
-
-      if (failedMatch) {
-        const failedText = failedMatch[1];
-        const parts = resultText.split(failedText);
-
-        return (
-          <div>
-            {parts[0]}
-            <span class={'text-red-500'}>{failedText}</span>
-            {parts[1]}
-          </div>
-        );
-      }
-
-      return <div>{resultText}</div>;
+      return (
+        <div class={'flex items-center'}>
+          共{Number(row.success) + Number(row.error)}条,成功:{row.success},
+          <span class={'flex items-center text-red-500'}>
+            失败:
+            {row.error}
+            {row.error != 0 && (
+              <div onClick={() => hanleExportFailure(row.batchNo)}>
+                <SVGIcon
+                  icon={'tdesign:download'}
+                  class={'ml-1 cursor-pointer text-20px'}
+                  style={'color:var(--n-loading-color)'}
+                ></SVGIcon>
+              </div>
+            )}
+          </span>
+        </div>
+      );
     }
   }
 ];
+function hanleExportFailure(batchNo: string) {
+  window.open(
+    `${import.meta.env.VITE_SERVICE_BASE_URL}/admin/enterprise/downloadErrorExcel?batchNo=${batchNo}`,
+    '_blank'
+  );
+}
 async function handleDelete(row: Api.government.userList) {
   setTableLoading(true);
   await fetchDeleteUser(row.userId);
@@ -187,13 +200,24 @@ const [registerModalForm, { openModal, closeModal, getFieldsValue, setFieldsValu
       {
         field: 'realName',
         label: '员工姓名',
-        component: 'NInput'
+        component: 'NInput',
+        required: true
       },
       {
         field: 'userMobile',
         label: '手机号码',
         component: 'NInput',
-        required: true
+        required: true,
+        componentProps: {
+          maxlength: 11
+        },
+        rules: [
+          {
+            pattern: /^1[3456789]\d{9}$/,
+            message: '请输入正确的手机号',
+            trigger: ['blur', 'input']
+          }
+        ]
       },
       {
         field: 'channelId',
@@ -252,10 +276,10 @@ async function handleSubmitImport(file: File) {
   <LayoutTable>
     <ZTable :columns="columns" :api="fetchGetUserList" @register="registerTable" @add="openModal">
       <template #op="{ row }">
-        <NButton size="small" ghost type="primary" :disabled="Boolean(row.used)" @click="edit(row)">编辑</NButton>
+        <NButton size="small" ghost type="primary" :disabled="Boolean(row.available)" @click="edit(row)">编辑</NButton>
         <NPopconfirm @positive-click="handleDelete(row)">
           <template #trigger>
-            <NButton size="small" type="error" ghost>删除</NButton>
+            <NButton size="small" type="error" ghost :disabled="Boolean(row.available)">删除</NButton>
           </template>
           确定删除吗?
         </NPopconfirm>

+ 5 - 3
src/views/home/index.vue

@@ -5,8 +5,8 @@ import HeaderBanner from './modules/header-banner.vue';
 import CardData from './modules/card-data.vue';
 import LineChart from './modules/line-chart.vue';
 import PieChart from './modules/pie-chart.vue';
-import ProjectNews from './modules/project-news.vue';
-import CreativityBanner from './modules/creativity-banner.vue';
+// import ProjectNews from './modules/project-news.vue';
+// import CreativityBanner from './modules/creativity-banner.vue';
 
 const appStore = useAppStore();
 
@@ -29,7 +29,8 @@ const gap = computed(() => (appStore.isMobile ? 0 : 16));
         </NCard>
       </NGi>
     </NGrid>
-    <NGrid :x-gap="gap" :y-gap="16" responsive="screen" item-responsive>
+    <!--
+ <NGrid :x-gap="gap" :y-gap="16" responsive="screen" item-responsive>
       <NGi span="24 s:24 m:14">
         <ProjectNews />
       </NGi>
@@ -37,6 +38,7 @@ const gap = computed(() => (appStore.isMobile ? 0 : 16));
         <CreativityBanner />
       </NGi>
     </NGrid>
+-->
   </NSpace>
 </template>
 

+ 4 - 1
src/views/operation/advertisement/index.vue

@@ -149,8 +149,11 @@ const [registerModalForm, { openModal, closeModal, getFieldsValue, setFieldsValu
       },
       {
         field: 'jumpUrl',
-        label: '跳转链接',
+        label: '链接和参数',
         component: 'NInput',
+        componentProps: {
+          placeholder: '列如:/pages/xxx?id=1'
+        },
         required: true
       },
       {

+ 5 - 1
src/views/user-management/user-list/index.vue

@@ -23,7 +23,11 @@ const columns: NaiveUI.TableColumn<Api.userManagement.userList>[] = [
   {
     key: 'name',
     title: '渠道',
-    align: 'center'
+    align: 'center',
+    render: row => {
+      const arr = ['企业用户', 'B端用户', '市民请集合'];
+      return arr[row.platform - 1] || '--';
+    }
   },
   {
     key: 'userRegtime',