hurx vor 2 Tagen
Ursprung
Commit
d93653829e
2 geänderte Dateien mit 246 neuen und 457 gelöschten Zeilen
  1. 116 275
      src/views/platform/gift/title/index.vue
  2. 130 182
      src/views/platform/industrial/searchNav/index.vue

+ 116 - 275
src/views/platform/gift/title/index.vue

@@ -1,103 +1,74 @@
 <template>
-  <div class="title-page">
-    <div class="title-container">
-      <!-- 标题栏(独立卡片) -->
-      <div class="header-card">
-        <div class="table-title">福礼标题信息列表</div>
-        <div class="action-btns">
-          <el-button type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
-          <el-button icon="Refresh" @click="getList">刷新</el-button>
+  <div class="p-2">
+    <el-card shadow="hover">
+      <template #header>
+        <div class="card-header">
+          <span class="title">首页导航信息列表</span>
+          <div>
+            <el-button type="primary" @click="handleAdd" v-hasPermi="['system:navigation:add']">+ 新增</el-button>
+            <el-button @click="getList">刷新</el-button>
+          </div>
         </div>
-      </div>
+      </template>
 
-      <!-- 表格区域(独立卡片) -->
-      <div class="table-card">
-        <!-- 表格 -->
-        <el-table v-loading="loading" :data="titleList" border>
-        <el-table-column label="标题名称" align="center" prop="title" min-width="140" />
-        <el-table-column label="导航类型" align="center" prop="remark" min-width="120">
+      <el-table v-loading="loading" :data="dataList" border>
+        <el-table-column label="导航标题" prop="navigationName" align="center" />
+        <el-table-column label="链接地址" prop="url" align="center" show-overflow-tooltip />
+        <el-table-column label="页面类型" prop="title" align="center">
           <template #default="scope">
-            {{ navTypeMap[scope.row.remark] || scope.row.remark }}
+            <dict-tag :options="nav_page_type" :value="scope.row.title" />
           </template>
         </el-table-column>
-        <el-table-column label="链接地址" align="center" prop="link" :show-overflow-tooltip="true" min-width="240" />
-        <el-table-column label="状态" align="center" width="100">
+        <el-table-column label="排序" prop="sort" width="100" align="center" />
+        <el-table-column label="是否显示" prop="isEnable" width="100" align="center">
           <template #default="scope">
-            <el-tag :type="scope.row.status === 1 ? 'success' : 'info'">
-              {{ scope.row.status === 1 ? '显示' : '隐藏' }}
-            </el-tag>
+            {{ scope.row.isEnable === '0' ? '显示' : '不显示' }}
           </template>
         </el-table-column>
-        <el-table-column label="排序" align="center" prop="sort" width="80" />
-        <el-table-column label="操作" align="center" width="150">
+        <el-table-column label="操作" width="150" align="center">
           <template #default="scope">
-            <span class="action-link primary" @click="handleUpdate(scope.row)">编辑</span>
-            <span class="action-link danger" @click="handleDelete(scope.row)">删除</span>
+            <el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['system:navigation:edit']">编辑</el-button>
+            <el-button link type="danger" @click="handleDelete(scope.row)" v-hasPermi="['system:navigation:remove']">删除</el-button>
           </template>
         </el-table-column>
       </el-table>
 
-        <!-- 分页 -->
-        <pagination
-          v-show="total > 0"
-          v-model:page="queryParams.pageNum"
-          v-model:limit="queryParams.pageSize"
-          :total="total"
-          @pagination="getList"
-        />
-      </div>
-    </div>
+      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
+    </el-card>
+
+    <!-- 添加或修改对话框 -->
+    <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
+      <el-form ref="formRef" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="导航标题" prop="navigationName">
+          <el-input v-model="form.navigationName" placeholder="请输入导航标题" />
+        </el-form-item>
+
+        <el-form-item label="导航链接" prop="url">
+          <WebLinkInput v-model="form.url" placeholder="请输入或选择链接" />
+        </el-form-item>
 
-    <!-- 新增/编辑对话框 -->
-    <el-dialog v-model="dialog.visible" :title="dialog.title" width="620px" append-to-body @close="cancel">
-      <el-form ref="titleFormRef" :model="form" :rules="rules" label-width="90px">
-        <el-row :gutter="20">
-          <el-col :span="12">
-            <el-form-item label="标题名称" prop="title">
-              <el-input v-model="form.title" placeholder="请输入标题名称" />
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="标题链接" prop="link">
-              <el-input v-model="form.link" placeholder="请输入标题链接" />
-            </el-form-item>
-          </el-col>
-        </el-row>
+        <el-form-item label="页面类型" prop="title">
+          <el-select v-model="form.title" placeholder="请选择页面类型">
+            <el-option v-for="dict in nav_page_type" :key="dict.value" :label="dict.label" :value="dict.value" />
+          </el-select>
+        </el-form-item>
 
-        <el-row :gutter="20">
-          <el-col :span="12">
-            <el-form-item label="导航类型" prop="remark">
-              <el-select v-model="form.remark" placeholder="请选择" style="width: 100%">
-                <el-option
-                  v-for="item in navTypeOptions"
-                  :key="item.value"
-                  :label="item.label"
-                  :value="item.value"
-                />
-              </el-select>
-            </el-form-item>
-          </el-col>
-          <el-col :span="12">
-            <el-form-item label="排序" prop="sort">
-              <el-input-number v-model="form.sort" :min="0" controls-position="right" style="width: 100%" />
-            </el-form-item>
-          </el-col>
-        </el-row>
+        <el-form-item label="排序" prop="sort">
+          <el-input-number v-model="form.sort" :min="0" controls-position="right" style="width: 100%" />
+        </el-form-item>
 
-        <el-form-item label="状态" prop="status">
-          <el-switch
-            v-model="form.status"
-            :active-value="1"
-            :inactive-value="0"
-            active-text="显示"
-            inactive-text="隐藏"
-          />
+        <el-form-item label="是否启用" prop="isEnable">
+          <el-switch v-model="form.isEnable" active-value="0" inactive-value="1" />
+        </el-form-item>
+
+        <el-form-item label="描述" prop="remark">
+          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
       </el-form>
       <template #footer>
         <div class="dialog-footer">
-          <el-button type="primary" @click="submitForm">确认</el-button>
-          <el-button @click="cancel">取消</el-button>
+          <el-button type="primary" @click="submitForm">确 认</el-button>
+          <el-button @click="cancel">取 消</el-button>
         </div>
       </template>
     </el-dialog>
@@ -105,244 +76,114 @@
 </template>
 
 <script setup name="GiftTitle" lang="ts">
-import { getCurrentInstance, onMounted, reactive, ref } from 'vue';
-import type { ComponentInternalInstance } from 'vue';
-import type { ElFormInstance } from 'element-plus';
-import dayjs from 'dayjs';
-import { listAdContent, addAdContent, updateAdContent, delAdContent } from '@/api/ad/content';
-import { listNavigation } from '@/api/system/navigation';
+import { listNavigation, getNavigation, addNavigation, updateNavigation, delNavigation } from '@/api/system/navigation';
+import { ComponentInternalInstance, getCurrentInstance, ref, reactive, toRefs } from 'vue';
+import type { FormInstance } from 'element-plus';
 
 const { proxy } = getCurrentInstance() as ComponentInternalInstance;
-
-const loading = ref(false);
+const { nav_page_type } = toRefs<any>(proxy?.useDict('nav_page_type'));
+const dataList = ref([]);
+const loading = ref(true);
 const total = ref(0);
-const titleList = ref<any[]>([]);
-const navTypeOptions = ref<{ label: string; value: string }[]>([]);
-
-// 导航类型映射
-const navTypeMap: Record<string, string> = {
-  home: '首页导航',
-  inner: '内页导航',
-  search: '搜索导航',
-  footer: '底部导航',
-  float: '浮动导航'
-};
 
-// 加载导航类型选项
-const loadNavTypeOptions = async () => {
-  try {
-    const res = await listNavigation({ pageNum: 1, pageSize: 100 });
-    const list = res.rows || res.data || [];
-    // 提取navType并去重
-    const typeSet = new Set<string>();
-    list.forEach((item: any) => {
-      if (item.navType) {
-        typeSet.add(item.navType);
-      }
-    });
-    // 转换为下拉选项
-    navTypeOptions.value = Array.from(typeSet).map((type) => ({
-      label: navTypeMap[type] || type,
-      value: type
-    }));
-  } catch (error) {
-    console.error('获取导航类型失败', error);
-    // 接口失败时使用默认选项
-    navTypeOptions.value = [
-      { label: '首页导航', value: 'home' },
-      { label: '内页导航', value: 'inner' },
-      { label: '搜索导航', value: 'search' },
-      { label: '底部导航', value: 'footer' },
-      { label: '浮动导航', value: 'float' }
-    ];
+const formRef = ref<FormInstance>();
+
+const dialog = reactive({ visible: false, title: '' });
+
+const data = reactive({
+  form: {} as any,
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    navType: 'setting_home',
+    title: '3'
+  },
+  rules: {
+    navigationName: [{ required: true, message: '导航名称不能为空', trigger: 'blur' }],
+    url: [{ required: true, message: '链接地址不能为空', trigger: 'blur' }],
+    title: [{ required: true, message: '请选择页面类型', trigger: 'blur' }],
+    sort: [{ required: true, message: '排序不能为空', trigger: 'blur' }],
+    isEnable: [{ required: true, message: '请选择是否显示', trigger: 'change' }]
   }
-};
-
-const queryParams = ref({
-  pageNum: 1,
-  pageSize: 10,
-  adType: 'gift_title',
-  title: ''
 });
 
-const dialog = reactive<DialogOption>({
-  visible: false,
-  title: ''
-});
-
-const titleFormRef = ref<ElFormInstance>();
-
-const initFormData = {
-  id: undefined as number | undefined,
-  adType: 'gift_title',
-  title: '',
-  remark: '',
-  link: '',
-  imageUrl: '', // 后端校验需要,标题广告可用占位
-  sort: 0,
-  status: 1,
-  color: '#ffffff',
-  extJson: '{}',
-  startTime: '',
-  endTime: ''
-};
-
-const form = ref({ ...initFormData });
-
-const rules = reactive({
-  title: [{ required: true, message: '标题名称不能为空', trigger: 'blur' }]
-});
+const { queryParams, form, rules } = toRefs(data);
 
 const getList = async () => {
   loading.value = true;
-  const res = await listAdContent({
-    pageNum: queryParams.value.pageNum,
-    pageSize: queryParams.value.pageSize,
-    adType: queryParams.value.adType,
-    title: queryParams.value.title
-  });
-  titleList.value = res.rows || [];
-  total.value = res.total || 0;
+  const res = await listNavigation(queryParams.value);
+  dataList.value = res.rows;
+  total.value = res.total;
   loading.value = false;
 };
 
 const reset = () => {
-  form.value = { ...initFormData };
-  titleFormRef.value?.resetFields();
+  form.value = {
+    id: undefined,
+    navType: 'setting_home',
+    navigationName: undefined,
+    url: undefined,
+    title: '3',
+    sort: 0,
+    isEnable: '0',
+    remark: undefined
+  };
+  formRef.value?.resetFields();
 };
 
 const handleAdd = () => {
   reset();
-  const today = dayjs().format('YYYY-MM-DD');
-  const future = dayjs().add(365, 'day').format('YYYY-MM-DD');
-  form.value.startTime = today;
-  form.value.endTime = future;
-  form.value.imageUrl = form.value.imageUrl || 'https://via.placeholder.com/1x1';
   dialog.visible = true;
-  dialog.title = '新增标题';
+  dialog.title = '添加首页导航';
 };
 
-const handleUpdate = (row: any) => {
+const handleUpdate = async (row: any) => {
   reset();
-  form.value = {
-    ...row,
-    adType: 'gift_title',
-    status: row.status ?? 1,
-    remark: row.remark || '',
-    color: row.color || '#ffffff',
-    extJson: row.extJson || '{}',
-    imageUrl: row.imageUrl || 'https://via.placeholder.com/1x1',
-    startTime: row.startTime ? dayjs(row.startTime).format('YYYY-MM-DD') : '',
-    endTime: row.endTime ? dayjs(row.endTime).format('YYYY-MM-DD') : ''
-  };
+  const res = await getNavigation(row.id);
+  Object.assign(form.value, res.data);
   dialog.visible = true;
-  dialog.title = '编辑标题';
+  dialog.title = '修改首页导航';
 };
 
 const submitForm = () => {
-  titleFormRef.value?.validate((valid: boolean) => {
+  formRef.value.validate(async (valid: boolean) => {
     if (valid) {
-      const api = form.value.id ? updateAdContent : addAdContent;
-      api(form.value).then(() => {
-        proxy?.$modal.msgSuccess(form.value.id ? '修改成功' : '新增成功');
-        dialog.visible = false;
-        getList();
-      });
+      if (form.value.id) {
+        await updateNavigation(form.value);
+        proxy?.$modal.msgSuccess('修改成功');
+      } else {
+        await addNavigation(form.value);
+        proxy?.$modal.msgSuccess('新增成功');
+      }
+      dialog.visible = false;
+      getList();
     }
   });
 };
 
-const handleDelete = (row: any) => {
-  proxy
-    ?.$modal.confirm(`是否确认删除标题名称为"${row.title}"的数据项?`)
-    .then(() => delAdContent(row.id))
-    .then(() => {
-      proxy?.$modal.msgSuccess('删除成功');
-      getList();
-    });
+const handleDelete = async (row: any) => {
+  await proxy?.$modal.confirm('是否确认删除?');
+  await delNavigation(row.id);
+  proxy?.$modal.msgSuccess('删除成功');
+  getList();
 };
 
 const cancel = () => {
-  reset();
   dialog.visible = false;
+  reset();
 };
 
-onMounted(() => {
-  loadNavTypeOptions();
-  getList();
-});
+getList();
 </script>
 
-<style scoped lang="scss">
-.title-page {
-  min-height: 100vh;
-  background: #f5f5f5;
-  padding: 20px;
-}
-
-.title-container {
-  max-width: 1200px;
-  margin: 0 auto;
-}
-
-.header-card {
-  background: #fff;
-  border-radius: 4px;
-  padding: 15px 20px;
-  margin-bottom: 12px;
+<style scoped>
+.card-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
-
-  .table-title {
-    font-size: 16px;
-    font-weight: 600;
-    color: #303133;
-  }
-
-  .action-btns {
-    display: flex;
-    gap: 10px;
-  }
 }
-
-.table-card {
-  background: #fff;
-  border-radius: 4px;
-  padding: 20px;
-}
-
-.table-header {
-  display: flex;
-  justify-content: space-between;
-  align-items: center;
-  margin-bottom: 15px;
-
-  .table-title {
-    font-size: 16px;
-    font-weight: 600;
-    color: #303133;
-  }
-
-  .action-btns {
-    display: flex;
-    gap: 10px;
-  }
-}
-
-.action-link {
-  cursor: pointer;
-  margin: 0 8px;
-  
-  &.primary {
-    color: #409eff;
-    &:hover { color: #66b1ff; }
-  }
-  
-  &.danger {
-    color: #f56c6c;
-    &:hover { color: #f78989; }
-  }
+.card-header .title {
+  font-size: 16px;
+  font-weight: bold;
 }
 </style>
-

+ 130 - 182
src/views/platform/industrial/searchNav/index.vue

@@ -1,235 +1,183 @@
 <template>
-  <div class="search-nav-page">
-    <div class="search-nav-container">
-      <!-- 表格区域 -->
-      <div class="table-card">
-        <div class="table-header">
-          <span class="table-title">搜索导航信息列表</span>
-          <div class="table-header-right">
-            <el-button type="primary" icon="Plus" @click="handleAdd">新增</el-button>
-            <el-button icon="Refresh" circle size="small" @click="getList" />
+  <div class="p-2">
+    <el-card shadow="hover">
+      <template #header>
+        <div class="card-header">
+          <span class="title">搜索导航信息列表</span>
+          <div>
+            <el-button type="primary" @click="handleAdd" v-hasPermi="['system:navigation:add']">+ 新增</el-button>
+            <el-button @click="getList">刷新</el-button>
           </div>
         </div>
+      </template>
 
-        <el-table v-loading="loading" :data="navList" border>
-          <el-table-column label="导航标题" align="center" prop="title" min-width="120" />
-          <el-table-column label="链接地址" align="center" prop="link" min-width="280">
-            <template #default="scope">
-              <el-link type="primary" :href="scope.row.link" target="_blank">{{ scope.row.link }}</el-link>
-            </template>
-          </el-table-column>
-          <el-table-column label="排序" align="center" prop="sort" width="100" />
-          <el-table-column label="导航类型" align="center" width="120">
-            <template #default>搜索导航</template>
-          </el-table-column>
-          <el-table-column label="操作" align="center" width="150">
-            <template #default="scope">
-              <span class="action-link danger" @click="handleDelete(scope.row)">删除</span>
-              <span class="action-link primary" @click="handleEdit(scope.row)">编辑</span>
-            </template>
-          </el-table-column>
-        </el-table>
-
-        <pagination
-          v-show="total > 0"
-          v-model:page="queryParams.pageNum"
-          v-model:limit="queryParams.pageSize"
-          :total="total"
-          @pagination="getList"
-        />
-      </div>
-    </div>
-
-    <!-- 添加/编辑对话框 -->
-    <el-dialog v-model="dialog.visible" :title="dialog.title" width="500px" append-to-body>
+      <el-table v-loading="loading" :data="dataList" border>
+        <el-table-column label="导航标题" prop="navigationName" align="center" />
+        <el-table-column label="链接地址" prop="url" align="center" show-overflow-tooltip />
+        <el-table-column label="页面类型" prop="title" align="center">
+          <template #default="scope">
+            <dict-tag :options="nav_page_type" :value="scope.row.title" />
+          </template>
+        </el-table-column>
+        <el-table-column label="排序" prop="sort" width="100" align="center" />
+        <el-table-column label="是否显示" prop="isEnable" width="100" align="center">
+          <template #default="scope">
+            {{ scope.row.isEnable === '0' ? '显示' : '不显示' }}
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" width="150" align="center">
+          <template #default="scope">
+            <el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['system:navigation:edit']">编辑</el-button>
+            <el-button link type="danger" @click="handleDelete(scope.row)" v-hasPermi="['system:navigation:remove']">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+
+      <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
+    </el-card>
+
+    <!-- 添加或修改对话框 -->
+    <el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
       <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
-        <el-form-item label="导航标题" prop="title">
-          <el-input v-model="form.title" placeholder="请输入导航标题" />
+        <el-form-item label="导航名称" prop="navigationName">
+          <el-input v-model="form.navigationName" placeholder="请输入导航名称" />
+        </el-form-item>
+        <el-form-item label="链接地址" prop="url">
+          <WebLinkInput v-model="form.url" placeholder="请输入或选择链接" />
         </el-form-item>
-        <el-form-item label="链接地址" prop="link">
-          <el-input v-model="form.link" placeholder="请输入链接地址" />
+        <el-form-item label="页面类型" prop="title">
+          <el-select v-model="form.title" placeholder="请选择页面类型">
+            <el-option v-for="dict in nav_page_type" :key="dict.value" :label="dict.label" :value="dict.value" />
+          </el-select>
         </el-form-item>
         <el-form-item label="排序" prop="sort">
-          <el-input-number v-model="form.sort" :min="0" :max="999" controls-position="right" />
+          <el-input-number v-model="form.sort" :min="0" />
+        </el-form-item>
+        <el-form-item label="是否启用" prop="isEnable">
+          <el-radio-group v-model="form.isEnable">
+            <el-radio value="0">是</el-radio>
+            <el-radio value="1">否</el-radio>
+          </el-radio-group>
         </el-form-item>
       </el-form>
       <template #footer>
-        <el-button @click="dialog.visible = false">取 消</el-button>
-        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <div class="dialog-footer">
+          <el-button type="primary" @click="submitForm">确 定</el-button>
+          <el-button @click="cancel">取 消</el-button>
+        </div>
       </template>
     </el-dialog>
   </div>
 </template>
 
 <script setup name="IndustrialSearchNav" lang="ts">
-import { ref, reactive, onMounted } from 'vue';
-import { ElMessage, ElMessageBox } from 'element-plus';
-import { listIndustrialHomeTitle, addIndustrialHomeTitle, updateIndustrialHomeTitle, delIndustrialHomeTitle } from '@/api/system/industrialHomeTitle';
-
-// 固定的导航类型:0=搜索导航
-const NAV_TYPE = 0;
+import { listNavigation, getNavigation, addNavigation, updateNavigation, delNavigation } from '@/api/system/navigation';
+import { ComponentInternalInstance, getCurrentInstance, ref, reactive, toRefs } from 'vue';
+import type { FormInstance } from 'element-plus';
 
-// 查询参数
-const queryParams = reactive({
-  pageNum: 1,
-  pageSize: 10
-});
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
+const { nav_page_type } = toRefs<any>(proxy?.useDict('nav_page_type'));
 
-// 列表数据
-const navList = ref<any[]>([]);
-const loading = ref(false);
+const dataList = ref([]);
+const loading = ref(true);
 const total = ref(0);
 
-// 对话框
-const dialog = reactive({
-  visible: false,
-  title: ''
+const formRef = ref<FormInstance>();
+
+const dialog = reactive({ visible: false, title: '' });
+
+const data = reactive({
+  form: {} as any,
+  queryParams: {
+    pageNum: 1,
+    pageSize: 10,
+    navType: 'setting_search',
+    title: '2'
+  },
+  rules: {
+    navigationName: [{ required: true, message: '导航名称不能为空', trigger: 'blur' }],
+    url: [{ required: true, message: '链接地址不能为空', trigger: 'blur' }],
+    title: [{ required: true, message: '请选择页面类型', trigger: 'blur' }],
+    sort: [{ required: true, message: '排序不能为空', trigger: 'blur' }],
+    isEnable: [{ required: true, message: '请选择是否启用', trigger: 'change' }]
+  }
 });
+const { queryParams, form, rules } = toRefs(data);
 
-// 表单
-const formRef = ref();
-const initForm = {
-  id: undefined as number | undefined,
-  title: '',
-  link: '',
-  type: NAV_TYPE,
-  sort: 0
-};
-const form = ref({ ...initForm });
-
-const rules = {
-  title: [{ required: true, message: '请输入导航标题', trigger: 'blur' }],
-  link: [{ required: true, message: '请输入链接地址', trigger: 'blur' }]
-};
-
-// 查询列表
 const getList = async () => {
   loading.value = true;
-  try {
-    const res: any = await listIndustrialHomeTitle({
-      type: NAV_TYPE,
-      pageNum: queryParams.pageNum,
-      pageSize: queryParams.pageSize
-    });
-    navList.value = res.rows || [];
-    total.value = res.total || 0;
-  } catch (error) {
-    console.error('加载列表失败', error);
-    navList.value = [];
-    total.value = 0;
-  } finally {
-    loading.value = false;
-  }
+  const res = await listNavigation(queryParams.value);
+  dataList.value = res.rows;
+  total.value = res.total;
+  loading.value = false;
 };
 
-// 添加
-const handleAdd = () => {
-  form.value = { ...initForm };
-  dialog.title = '新增导航';
-  dialog.visible = true;
-};
-
-// 编辑
-const handleEdit = (row: any) => {
+const reset = () => {
   form.value = {
-    id: row.id,
-    title: row.title || '',
-    link: row.link || '',
-    type: NAV_TYPE,
-    sort: row.sort || 0
+    id: undefined,
+    navType: 'setting_search',
+    navigationName: undefined,
+    url: undefined,
+    title: '2',
+    sort: 0,
+    isEnable: '0'
   };
-  dialog.title = '编辑导航';
+  formRef.value?.resetFields();
+};
+
+const handleAdd = () => {
+  reset();
   dialog.visible = true;
+  dialog.title = '添加搜索导航';
 };
 
-// 删除
-const handleDelete = (row: any) => {
-  ElMessageBox.confirm(`是否确认删除导航"${row.title}"?`, '提示', {
-    confirmButtonText: '确定',
-    cancelButtonText: '取消',
-    type: 'warning'
-  }).then(async () => {
-    await delIndustrialHomeTitle(row.id);
-    ElMessage.success('删除成功');
-    getList();
-  }).catch(() => {});
+const handleUpdate = async (row: any) => {
+  reset();
+  const res = await getNavigation(row.id);
+  Object.assign(form.value, res.data);
+  dialog.visible = true;
+  dialog.title = '修改搜索导航';
 };
 
-// 提交表单
 const submitForm = () => {
   formRef.value?.validate(async (valid: boolean) => {
     if (valid) {
-      try {
-        if (form.value.id) {
-          await updateIndustrialHomeTitle(form.value);
-          ElMessage.success('修改成功');
-        } else {
-          await addIndustrialHomeTitle(form.value);
-          ElMessage.success('添加成功');
-        }
-        dialog.visible = false;
-        getList();
-      } catch (error) {
-        ElMessage.error('操作失败');
+      if (form.value.id) {
+        await updateNavigation(form.value);
+        proxy?.$modal.msgSuccess('修改成功');
+      } else {
+        await addNavigation(form.value);
+        proxy?.$modal.msgSuccess('新增成功');
       }
+      dialog.visible = false;
+      getList();
     }
   });
 };
 
-onMounted(() => {
+const handleDelete = async (row: any) => {
+  await proxy?.$modal.confirm('是否确认删除?');
+  await delNavigation(row.id);
+  proxy?.$modal.msgSuccess('删除成功');
   getList();
-});
-</script>
-
-<style scoped lang="scss">
-.search-nav-page {
-  min-height: 100vh;
-  background: #f5f5f5;
-  padding: 20px;
-}
+};
 
-.search-nav-container {
-  max-width: 1200px;
-  margin: 0 auto;
-}
+const cancel = () => {
+  dialog.visible = false;
+  reset();
+};
 
-.table-card {
-  background: #fff;
-  border-radius: 4px;
-  padding: 20px;
-}
+getList();
+</script>
 
-.table-header {
+<style scoped>
+.card-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
-  margin-bottom: 15px;
 }
-
-.table-header-right {
-  display: flex;
-  align-items: center;
-  gap: 10px;
-}
-
-.table-title {
+.card-header .title {
   font-size: 16px;
-  font-weight: 600;
-  color: #303133;
-}
-
-.action-link {
-  cursor: pointer;
-  margin: 0 6px;
-  
-  &.primary {
-    color: #409eff;
-    &:hover { color: #66b1ff; }
-  }
-  
-  &.danger {
-    color: #f56c6c;
-    &:hover { color: #f78989; }
-  }
+  font-weight: bold;
 }
 </style>