提交维修分类的修改到git
This commit is contained in:
1 parent
eabe865c6c
commit
3f9838e8f1
7 files changed
+351
-123
No files matched your search
@@ -531,7 +531,89 @@ const moduleRouter: RouteRecordRaw = {
|
|||||||
export default moduleRouter;
|
export default moduleRouter;
|
||||||
```
|
```
|
||||||
|
|
||||||
## 7. 项目架构规范
|
## 7. 搜索表单布局规范(强制性)
|
||||||
|
|
||||||
|
### 7.1 设计目标
|
||||||
|
|
||||||
|
1. **一致性**:所有列表页面的检索栏保持统一外观和交互。
|
||||||
|
2. **响应式**:在 1920/1440/1280 等常用分辨率下均能保持整洁布局。
|
||||||
|
3. **易维护**:通过统一的栅格 + 样式类,后续页面可快速复用。
|
||||||
|
|
||||||
|
### 7.2 栅格布局
|
||||||
|
|
||||||
|
1. 采用 Element Plus `el-row` / `el-col` 栅格系统。
|
||||||
|
2. **每行固定 4 个检索元素**,每项 `:span="6"`(24 ÷ 4)。
|
||||||
|
3. 若检索项不足 4 个,也应保持占位对齐,避免按钮漂移。
|
||||||
|
|
||||||
|
```vue
|
||||||
|
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
|
||||||
|
<!-- 第一行 -->
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="字段1" prop="field1">
|
||||||
|
<el-input v-model="queryParams.field1" placeholder="请输入字段1" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="字段2" prop="field2">
|
||||||
|
<el-input v-model="queryParams.field2" placeholder="请输入字段2" clearable />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<!-- 其余两列同理 -->
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 更多行按需添加,仍保持 4 列规则 -->
|
||||||
|
|
||||||
|
<!-- 操作按钮行 -->
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24" class="search-btn-container">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7.3 按钮固定右侧
|
||||||
|
|
||||||
|
1. 统一在搜索表单尾部添加按钮行。
|
||||||
|
2. 使用 `.search-btn-container` 类,将按钮通过 Flex **右对齐**。
|
||||||
|
|
||||||
|
```scss
|
||||||
|
/* 搜索按钮容器样式(全局复用,可写在组件 scoped 内部)*/
|
||||||
|
.search-btn-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 0 !important; // 清除默认 margin
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7.4 应用示例
|
||||||
|
|
||||||
|
所有新页面或改造页面 **必须** 遵循以上规范。例如:
|
||||||
|
|
||||||
|
* `hq/pm/repairOrder/index.vue`
|
||||||
|
* `hq/pm/repairCategory/index.vue`
|
||||||
|
* `hq/hallAudit/index.vue`
|
||||||
|
* `hq/hallInfo/index.vue`
|
||||||
|
* `hq/hallReservation/index.vue`
|
||||||
|
|
||||||
|
### 7.5 代码检查要点
|
||||||
|
|
||||||
|
1. 检查是否存在 `:inline="true"`,如有应移除。
|
||||||
|
2. 确认每行 4 列,使用 `span=6`。
|
||||||
|
3. 搜索/重置按钮是否放置在 `.search-btn-container` 内。
|
||||||
|
4. scoped 样式内是否包含上述 `.search-btn-container` 定义。
|
||||||
|
|
||||||
|
遵循此规范,可显著提升列表页检索区域的统一性与用户体验。
|
||||||
|
|
||||||
|
## 8. 项目架构规范
|
||||||
|
|
||||||
### 目录结构
|
### 目录结构
|
||||||
|
|
||||||
@@ -568,7 +650,7 @@ web/src/
|
|||||||
- **工具文件**: camelCase,如 `formatUtils.ts`
|
- **工具文件**: camelCase,如 `formatUtils.ts`
|
||||||
- **类型文件**: PascalCase,如 `UserTypes.ts`
|
- **类型文件**: PascalCase,如 `UserTypes.ts`
|
||||||
|
|
||||||
## 8. 样式开发规范
|
## 9. 样式开发规范
|
||||||
|
|
||||||
### SCSS 变量使用
|
### SCSS 变量使用
|
||||||
|
|
||||||
@@ -605,7 +687,7 @@ web/src/
|
|||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
|
|
||||||
## 9. 性能优化规范
|
## 10. 性能优化规范
|
||||||
|
|
||||||
### 组件懒加载
|
### 组件懒加载
|
||||||
|
|
||||||
@@ -626,7 +708,7 @@ const AsyncComponent = defineAsyncComponent(() => import('@/components/HeavyComp
|
|||||||
</template>
|
</template>
|
||||||
```
|
```
|
||||||
|
|
||||||
## 10. 开发最佳实践
|
## 11. 开发最佳实践
|
||||||
|
|
||||||
### 代码规范
|
### 代码规范
|
||||||
|
|
||||||
@@ -667,7 +749,7 @@ interface UserForm {
|
|||||||
const user = data as UserForm;
|
const user = data as UserForm;
|
||||||
```
|
```
|
||||||
|
|
||||||
## 11. 测试规范
|
## 12. 测试规范
|
||||||
|
|
||||||
### 单元测试
|
### 单元测试
|
||||||
|
|
||||||
@@ -685,7 +767,7 @@ describe('UserForm', () => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## 12. 构建与部署
|
## 13. 构建与部署
|
||||||
|
|
||||||
### 环境配置
|
### 环境配置
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -78,7 +78,8 @@ public class HqPmRepairCategoryServiceImpl implements IHqPmRepairCategoryService
|
|||||||
lqw.orderByAsc(HqPmRepairCategory::getSortOrder).orderByAsc(HqPmRepairCategory::getId);
|
lqw.orderByAsc(HqPmRepairCategory::getSortOrder).orderByAsc(HqPmRepairCategory::getId);
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getCategoryName()), HqPmRepairCategory::getCategoryName,
|
lqw.like(StringUtils.isNotBlank(bo.getCategoryName()), HqPmRepairCategory::getCategoryName,
|
||||||
bo.getCategoryName());
|
bo.getCategoryName());
|
||||||
lqw.eq(StringUtils.isNotBlank(bo.getCategoryCode()), HqPmRepairCategory::getCategoryCode, bo.getCategoryCode());
|
lqw.like(StringUtils.isNotBlank(bo.getCategoryCode()), HqPmRepairCategory::getCategoryCode,
|
||||||
|
bo.getCategoryCode());
|
||||||
lqw.like(StringUtils.isNotBlank(bo.getCategoryDescription()), HqPmRepairCategory::getCategoryDescription,
|
lqw.like(StringUtils.isNotBlank(bo.getCategoryDescription()), HqPmRepairCategory::getCategoryDescription,
|
||||||
bo.getCategoryDescription());
|
bo.getCategoryDescription());
|
||||||
lqw.eq(bo.getParentId() != null, HqPmRepairCategory::getParentId, bo.getParentId());
|
lqw.eq(bo.getParentId() != null, HqPmRepairCategory::getParentId, bo.getParentId());
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
import { AxiosPromise } from 'axios';
|
import { AxiosPromise } from 'axios';
|
||||||
import { RepairCategoryVO, RepairCategoryForm, RepairCategoryQuery } from '@/api/hq/hq/pm/types';
|
import { RepairCategoryVO, RepairCategoryForm, RepairCategoryQuery } from '@/api/hq/pm/types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询维修类型列表
|
* 查询维修类型列表
|
||||||
|
|||||||
@@ -3,31 +3,65 @@
|
|||||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
<div ref="searchRef" v-show="showSearch" class="mb-[10px]">
|
<div ref="searchRef" v-show="showSearch" class="mb-[10px]">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="100px">
|
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
|
||||||
<!-- <el-form-item label="报告厅ID" prop="hallId">
|
<!-- 第一行:4个检索元素 -->
|
||||||
<el-input v-model="queryParams.hallId" placeholder="请输入报告厅ID" clearable @keyup.enter="handleQuery" />
|
<el-row :gutter="20">
|
||||||
</el-form-item> -->
|
<el-col :span="6">
|
||||||
<el-form-item label="报告厅名称" prop="hallName">
|
<el-form-item label="报告厅名称" prop="hallName">
|
||||||
<el-input v-model="queryParams.hallName" placeholder="请输入报告厅名称" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.hallName" placeholder="请输入报告厅名称" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="预约开始时间" prop="startTime">
|
</el-col>
|
||||||
<el-date-picker clearable v-model="queryParams.startTime" type="date" placeholder="请选择开始时间" value-format="YYYY-MM-DD" />
|
<el-col :span="6">
|
||||||
</el-form-item>
|
<el-form-item label="预约开始时间" prop="startTime">
|
||||||
<el-form-item label="预约结束时间" prop="endTime">
|
<el-date-picker
|
||||||
<el-date-picker clearable v-model="queryParams.endTime" type="date" placeholder="请选择结束时间" value-format="YYYY-MM-DD" />
|
clearable
|
||||||
</el-form-item>
|
v-model="queryParams.startTime"
|
||||||
<el-form-item label="申请人姓名" prop="applicantName">
|
type="date"
|
||||||
<el-input v-model="queryParams.applicantName" placeholder="请输入申请人姓名" clearable @keyup.enter="handleQuery" />
|
placeholder="请选择开始时间"
|
||||||
</el-form-item>
|
value-format="YYYY-MM-DD"
|
||||||
<el-form-item label="预约状态" prop="status">
|
style="width: 100%"
|
||||||
<el-select v-model="queryParams.status" placeholder="请选择预约状态" clearable>
|
/>
|
||||||
<el-option v-for="dict in hall_reserv_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
</el-form-item>
|
||||||
</el-select>
|
</el-col>
|
||||||
</el-form-item>
|
<el-col :span="6">
|
||||||
<el-form-item>
|
<el-form-item label="预约结束时间" prop="endTime">
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-date-picker
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
clearable
|
||||||
</el-form-item>
|
v-model="queryParams.endTime"
|
||||||
|
type="date"
|
||||||
|
placeholder="请选择结束时间"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="申请人姓名" prop="applicantName">
|
||||||
|
<el-input v-model="queryParams.applicantName" placeholder="请输入申请人姓名" clearable @keyup.enter="handleQuery" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 第二行:剩余检索元素 -->
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="预约状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择预约状态" clearable style="width: 100%">
|
||||||
|
<el-option v-for="dict in hall_reserv_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 操作按钮行 -->
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24" class="search-btn-container">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -1617,6 +1651,16 @@ onMounted(() => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
}
|
}
|
||||||
|
/* 搜索按钮容器样式 */
|
||||||
|
.search-btn-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -3,19 +3,30 @@
|
|||||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
<div v-show="showSearch" class="mb-[10px]">
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="100px">
|
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
|
||||||
<el-form-item label="报告厅名称" prop="hallName">
|
<el-row :gutter="20">
|
||||||
<el-input v-model="queryParams.hallName" placeholder="请输入报告厅名称" clearable @keyup.enter="handleQuery" />
|
<el-col :span="6">
|
||||||
</el-form-item>
|
<el-form-item label="报告厅名称" prop="hallName">
|
||||||
<el-form-item label="报告厅状态" prop="hallStatus">
|
<el-input v-model="queryParams.hallName" placeholder="请输入报告厅名称" clearable @keyup.enter="handleQuery" />
|
||||||
<el-select v-model="queryParams.hallStatus" placeholder="请选择报告厅状态" clearable>
|
</el-form-item>
|
||||||
<el-option v-for="dict in hall_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
</el-col>
|
||||||
</el-select>
|
<el-col :span="6">
|
||||||
</el-form-item>
|
<el-form-item label="报告厅状态" prop="hallStatus">
|
||||||
<el-form-item>
|
<el-select v-model="queryParams.hallStatus" placeholder="请选择报告厅状态" clearable style="width: 100%">
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-option v-for="dict in hall_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24" class="search-btn-container">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -534,4 +545,15 @@ onMounted(() => {
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 搜索按钮容器样式 */
|
||||||
|
.search-btn-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -3,28 +3,54 @@
|
|||||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
<div ref="searchRef" v-show="showSearch" class="mb-[10px]">
|
<div ref="searchRef" v-show="showSearch" class="mb-[10px]">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="100px">
|
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
|
||||||
<!-- <el-form-item label="报告厅ID" prop="hallId">
|
<el-row :gutter="20">
|
||||||
<el-input v-model="queryParams.hallId" placeholder="请输入报告厅ID" clearable @keyup.enter="handleQuery" />
|
<el-col :span="6">
|
||||||
</el-form-item> -->
|
<el-form-item label="报告厅名称" prop="hallName">
|
||||||
<el-form-item label="报告厅名称" prop="hallName">
|
<el-input v-model="queryParams.hallName" placeholder="请输入报告厅名称" clearable @keyup.enter="handleQuery" />
|
||||||
<el-input v-model="queryParams.hallName" placeholder="请输入报告厅名称" clearable @keyup.enter="handleQuery" />
|
</el-form-item>
|
||||||
</el-form-item>
|
</el-col>
|
||||||
<el-form-item label="预约开始时间" prop="startTime">
|
<el-col :span="6">
|
||||||
<el-date-picker clearable v-model="queryParams.startTime" type="date" placeholder="请选择开始时间" value-format="YYYY-MM-DD" />
|
<el-form-item label="预约开始时间" prop="startTime">
|
||||||
</el-form-item>
|
<el-date-picker
|
||||||
<el-form-item label="预约结束时间" prop="endTime">
|
clearable
|
||||||
<el-date-picker clearable v-model="queryParams.endTime" type="date" placeholder="请选择结束时间" value-format="YYYY-MM-DD" />
|
v-model="queryParams.startTime"
|
||||||
</el-form-item>
|
type="date"
|
||||||
<el-form-item label="预约状态" prop="status">
|
placeholder="请选择开始时间"
|
||||||
<el-select v-model="queryParams.status" placeholder="请选择预约状态" clearable>
|
value-format="YYYY-MM-DD"
|
||||||
<el-option v-for="dict in hall_reserv_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
style="width: 100%"
|
||||||
</el-select>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
</el-col>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
<el-col :span="6">
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
<el-form-item label="预约结束时间" prop="endTime">
|
||||||
</el-form-item>
|
<el-date-picker
|
||||||
|
clearable
|
||||||
|
v-model="queryParams.endTime"
|
||||||
|
type="date"
|
||||||
|
placeholder="请选择结束时间"
|
||||||
|
value-format="YYYY-MM-DD"
|
||||||
|
style="width: 100%"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="6">
|
||||||
|
<el-form-item label="预约状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择预约状态" clearable style="width: 100%">
|
||||||
|
<el-option v-for="dict in hall_reserv_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24" class="search-btn-container">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -1134,6 +1160,17 @@ onMounted(() => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 页面容器样式 */
|
/* 页面容器样式 */
|
||||||
|
|
||||||
|
/* 搜索按钮容器样式 */
|
||||||
|
.search-btn-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -4,27 +4,44 @@
|
|||||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||||
<div v-show="showSearch" class="mb-[10px]">
|
<div v-show="showSearch" class="mb-[10px]">
|
||||||
<el-card shadow="hover">
|
<el-card shadow="hover">
|
||||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true" label-width="100px">
|
<el-form ref="queryFormRef" :model="queryParams" label-width="100px">
|
||||||
<el-form-item label="类型名称" prop="categoryName">
|
<!-- 第一行:4个检索元素 -->
|
||||||
<el-input v-model="queryParams.categoryName" placeholder="请输入类型名称" clearable @keyup.enter="handleQuery" />
|
<el-row :gutter="20">
|
||||||
</el-form-item>
|
<el-col :span="6">
|
||||||
<el-form-item label="类型编码" prop="categoryCode">
|
<el-form-item label="类型名称" prop="categoryName">
|
||||||
<el-input v-model="queryParams.categoryCode" placeholder="请输入类型编码" clearable @keyup.enter="handleQuery" />
|
<el-input v-model="queryParams.categoryName" placeholder="请输入类型名称" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="技能等级" prop="skillLevel">
|
</el-col>
|
||||||
<el-select v-model="queryParams.skillLevel" placeholder="请选择技能等级" clearable>
|
<el-col :span="6">
|
||||||
<el-option v-for="dict in pm_skill_level" :key="dict.value" :label="dict.label" :value="dict.value" />
|
<el-form-item label="类型编码" prop="categoryCode">
|
||||||
</el-select>
|
<el-input v-model="queryParams.categoryCode" placeholder="请输入类型编码" clearable @keyup.enter="handleQuery" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态" prop="status">
|
</el-col>
|
||||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
<el-col :span="6">
|
||||||
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
<el-form-item label="技能等级" prop="skillLevel">
|
||||||
</el-select>
|
<el-select v-model="queryParams.skillLevel" placeholder="请选择技能等级" clearable style="width: 100%">
|
||||||
</el-form-item>
|
<el-option v-for="dict in pm_skill_level" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
<el-form-item>
|
</el-select>
|
||||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
</el-form-item>
|
||||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
</el-col>
|
||||||
</el-form-item>
|
<el-col :span="6">
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 100%">
|
||||||
|
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<!-- 操作按钮行 -->
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24" class="search-btn-container">
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
</div>
|
</div>
|
||||||
@@ -53,15 +70,17 @@
|
|||||||
:default-expand-all="isExpandAll"
|
:default-expand-all="isExpandAll"
|
||||||
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
|
||||||
border
|
border
|
||||||
|
header-align="center"
|
||||||
|
@row-click="handleRowClick"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
class="tree-table"
|
class="tree-table"
|
||||||
>
|
>
|
||||||
<el-table-column prop="categoryName" label="类型名称" min-width="260" show-overflow-tooltip>
|
<el-table-column align="left" header-align="center" prop="categoryName" label="类型名称" min-width="260" show-overflow-tooltip>
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span class="category-name-cell">
|
<span class="category-name-cell">
|
||||||
<el-icon v-if="scope.row.iconUrl" class="category-icon" :style="{ color: scope.row.colorCode }">
|
<!-- <el-icon v-if="scope.row.iconUrl" class="category-icon" :style="{ color: scope.row.colorCode }">
|
||||||
<component :is="getCategoryIcon(scope.row.categoryCode)" />
|
<component :is="getCategoryIcon(scope.row.categoryCode)" />
|
||||||
</el-icon>
|
</el-icon> -->
|
||||||
<span class="category-name">{{ scope.row.categoryName }}</span>
|
<span class="category-name">{{ scope.row.categoryName }}</span>
|
||||||
<el-tag v-if="scope.row.childrenCount > 0" size="small" type="info" class="children-count-tag">
|
<el-tag v-if="scope.row.childrenCount > 0" size="small" type="info" class="children-count-tag">
|
||||||
{{ scope.row.childrenCount }}个子类
|
{{ scope.row.childrenCount }}个子类
|
||||||
@@ -69,8 +88,8 @@
|
|||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="categoryCode" label="类型编码" width="150" show-overflow-tooltip />
|
<el-table-column prop="categoryCode" label="类型编码" width="150" align="left" header-align="center" show-overflow-tooltip />
|
||||||
<el-table-column prop="categoryDescription" label="类型描述" min-width="200" show-overflow-tooltip />
|
<el-table-column prop="categoryDescription" label="类型描述" min-width="200" align="left" header-align="center" show-overflow-tooltip />
|
||||||
<el-table-column prop="skillLevel" label="技能等级" width="100" align="center">
|
<el-table-column prop="skillLevel" label="技能等级" width="100" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-tag :type="getSkillLevelTagType(scope.row.skillLevel)" size="small">
|
<el-tag :type="getSkillLevelTagType(scope.row.skillLevel)" size="small">
|
||||||
@@ -78,7 +97,7 @@
|
|||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="estimatedDuration" label="预估时长" width="120" align="center">
|
<!-- <el-table-column prop="estimatedDuration" label="预估时长" width="120" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<span v-if="scope.row.estimatedDuration">{{ formatDuration(scope.row.estimatedDuration) }}</span>
|
<span v-if="scope.row.estimatedDuration">{{ formatDuration(scope.row.estimatedDuration) }}</span>
|
||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
@@ -90,7 +109,7 @@
|
|||||||
<span v-else>-</span>
|
<span v-else>-</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="usageCount" label="使用次数" width="100" align="center" />
|
<el-table-column prop="usageCount" label="使用次数" width="100" align="center" /> -->
|
||||||
<el-table-column prop="sortOrder" label="排序" width="80" align="center" />
|
<el-table-column prop="sortOrder" label="排序" width="80" align="center" />
|
||||||
<el-table-column prop="status" label="状态" width="80" align="center">
|
<el-table-column prop="status" label="状态" width="80" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
@@ -170,7 +189,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<!-- <el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="预估时长" prop="estimatedDuration">
|
<el-form-item label="预估时长" prop="estimatedDuration">
|
||||||
<el-input-number v-model="form.estimatedDuration" :min="0" :max="9999" placeholder="分钟" style="width: 100%" />
|
<el-input-number v-model="form.estimatedDuration" :min="0" :max="9999" placeholder="分钟" style="width: 100%" />
|
||||||
@@ -181,13 +200,13 @@
|
|||||||
<el-input-number v-model="form.standardCost" :min="0" :precision="2" placeholder="元" style="width: 100%" />
|
<el-input-number v-model="form.standardCost" :min="0" :precision="2" placeholder="元" style="width: 100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row> -->
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
<!-- <el-col :span="12">
|
||||||
<el-form-item label="分类颜色" prop="colorCode">
|
<el-form-item label="分类颜色" prop="colorCode">
|
||||||
<el-color-picker v-model="form.colorCode" :predefine="predefineColors" :clearable="false" style="width: 100%" />
|
<el-color-picker v-model="form.colorCode" :predefine="predefineColors" :clearable="false" style="width: 100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col> -->
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="排序顺序" prop="sortOrder">
|
<el-form-item label="排序顺序" prop="sortOrder">
|
||||||
<el-input-number v-model="form.sortOrder" :min="0" placeholder="数字越小越靠前" style="width: 100%" />
|
<el-input-number v-model="form.sortOrder" :min="0" placeholder="数字越小越靠前" style="width: 100%" />
|
||||||
@@ -231,9 +250,9 @@
|
|||||||
<el-descriptions :column="2" border>
|
<el-descriptions :column="2" border>
|
||||||
<el-descriptions-item label="类型名称">
|
<el-descriptions-item label="类型名称">
|
||||||
<div class="category-name-view">
|
<div class="category-name-view">
|
||||||
<el-icon v-if="viewData.iconUrl" class="category-icon" :style="{ color: viewData.colorCode }">
|
<!-- <el-icon v-if="viewData.iconUrl" class="category-icon" :style="{ color: viewData.colorCode }">
|
||||||
<component :is="getCategoryIcon(viewData.categoryCode)" />
|
<component :is="getCategoryIcon(viewData.categoryCode)" />
|
||||||
</el-icon>
|
</el-icon> -->
|
||||||
<span class="category-name">{{ viewData.categoryName }}</span>
|
<span class="category-name">{{ viewData.categoryName }}</span>
|
||||||
</div>
|
</div>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
@@ -244,7 +263,7 @@
|
|||||||
{{ getSkillLevelText(viewData.skillLevel) }}
|
{{ getSkillLevelText(viewData.skillLevel) }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="预估时长">
|
<!-- <el-descriptions-item label="预估时长">
|
||||||
{{ viewData.estimatedDuration ? formatDuration(viewData.estimatedDuration) : '-' }}
|
{{ viewData.estimatedDuration ? formatDuration(viewData.estimatedDuration) : '-' }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item>
|
||||||
<el-descriptions-item label="标准成本">
|
<el-descriptions-item label="标准成本">
|
||||||
@@ -253,7 +272,7 @@
|
|||||||
<el-descriptions-item label="使用次数">{{ viewData.usageCount }}</el-descriptions-item>
|
<el-descriptions-item label="使用次数">{{ viewData.usageCount }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="最后使用时间">
|
<el-descriptions-item label="最后使用时间">
|
||||||
{{ viewData.lastUsedTime ? proxy.parseTime(viewData.lastUsedTime, '{y}-{m}-{d} {h}:{i}') : '-' }}
|
{{ viewData.lastUsedTime ? proxy.parseTime(viewData.lastUsedTime, '{y}-{m}-{d} {h}:{i}') : '-' }}
|
||||||
</el-descriptions-item>
|
</el-descriptions-item> -->
|
||||||
<el-descriptions-item label="排序顺序">{{ viewData.sortOrder }}</el-descriptions-item>
|
<el-descriptions-item label="排序顺序">{{ viewData.sortOrder }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="状态">
|
<el-descriptions-item label="状态">
|
||||||
<el-tag :type="viewData.status === '1' ? 'success' : 'danger'" size="small">
|
<el-tag :type="viewData.status === '1' ? 'success' : 'danger'" size="small">
|
||||||
@@ -286,6 +305,8 @@ import {
|
|||||||
updateRepairCategory,
|
updateRepairCategory,
|
||||||
getRepairCategoryTree
|
getRepairCategoryTree
|
||||||
} from '@/api/hq/pm/repairCategory';
|
} from '@/api/hq/pm/repairCategory';
|
||||||
|
import { ref, reactive, getCurrentInstance, nextTick, onMounted, type ComponentInternalInstance } from 'vue';
|
||||||
|
import type { FormInstance as ElFormInstance, FormRules as ElFormRules } from 'element-plus';
|
||||||
import { RepairCategoryVO, RepairCategoryForm, RepairCategoryQuery } from '@/api/hq/pm/types';
|
import { RepairCategoryVO, RepairCategoryForm, RepairCategoryQuery } from '@/api/hq/pm/types';
|
||||||
|
|
||||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||||
@@ -296,6 +317,8 @@ const loading = ref(true);
|
|||||||
const showSearch = ref(true);
|
const showSearch = ref(true);
|
||||||
const isExpandAll = ref(false);
|
const isExpandAll = ref(false);
|
||||||
const refreshTable = ref(true);
|
const refreshTable = ref(true);
|
||||||
|
// 标记首次加载,用于控制默认展示主分类树
|
||||||
|
const initialLoad = ref(true);
|
||||||
|
|
||||||
// 字典数据
|
// 字典数据
|
||||||
const pm_skill_level = ref([
|
const pm_skill_level = ref([
|
||||||
@@ -363,24 +386,20 @@ const buttonLoading = ref(false);
|
|||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
try {
|
try {
|
||||||
// 根据是否有搜索条件决定使用哪个接口
|
// 首次加载时使用树形接口获取所有分类
|
||||||
let res;
|
if (initialLoad.value) {
|
||||||
const hasSearchConditions =
|
const res = await getRepairCategoryTree();
|
||||||
queryParams.value.categoryName || queryParams.value.categoryCode || queryParams.value.skillLevel || queryParams.value.status;
|
if (res.code === 200 && res.data) {
|
||||||
|
categoryList.value = res.data;
|
||||||
if (hasSearchConditions) {
|
|
||||||
// 有搜索条件时使用列表接口,然后手动构建树形结构
|
|
||||||
res = await listRepairCategory(queryParams.value);
|
|
||||||
if (res.code === 200 && res.rows) {
|
|
||||||
categoryList.value = buildTreeFromList(res.rows);
|
|
||||||
} else {
|
} else {
|
||||||
categoryList.value = [];
|
categoryList.value = [];
|
||||||
}
|
}
|
||||||
|
initialLoad.value = false; // 首次加载完成后,后续操作都使用列表接口
|
||||||
} else {
|
} else {
|
||||||
// 无搜索条件时直接使用树形接口
|
// 后续操作使用列表接口,并根据搜索条件过滤
|
||||||
res = await getRepairCategoryTree();
|
const res = await listRepairCategory(queryParams.value);
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.rows) {
|
||||||
categoryList.value = res.data;
|
categoryList.value = buildTreeFromList(res.rows);
|
||||||
} else {
|
} else {
|
||||||
categoryList.value = [];
|
categoryList.value = [];
|
||||||
}
|
}
|
||||||
@@ -468,6 +487,10 @@ const handleUpdate = async (row: RepairCategoryVO) => {
|
|||||||
getCategoryTree();
|
getCategoryTree();
|
||||||
const res = await getRepairCategory(row.id);
|
const res = await getRepairCategory(row.id);
|
||||||
Object.assign(form.value, res.data);
|
Object.assign(form.value, res.data);
|
||||||
|
// 若后端未返回技能等级,默认设置为中级
|
||||||
|
if (!form.value.skillLevel) {
|
||||||
|
form.value.skillLevel = '2';
|
||||||
|
}
|
||||||
dialog.visible = true;
|
dialog.visible = true;
|
||||||
dialog.title = '修改维修类型';
|
dialog.title = '修改维修类型';
|
||||||
};
|
};
|
||||||
@@ -479,6 +502,11 @@ const handleView = async (row: RepairCategoryVO) => {
|
|||||||
viewDialog.visible = true;
|
viewDialog.visible = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** 行点击预览 */
|
||||||
|
const handleRowClick = (row: RepairCategoryVO) => {
|
||||||
|
handleView(row);
|
||||||
|
};
|
||||||
|
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
const submitForm = () => {
|
const submitForm = () => {
|
||||||
categoryFormRef.value?.validate(async (valid: boolean) => {
|
categoryFormRef.value?.validate(async (valid: boolean) => {
|
||||||
@@ -515,13 +543,17 @@ const handleDelete = async (row: RepairCategoryVO) => {
|
|||||||
|
|
||||||
/** 状态修改 */
|
/** 状态修改 */
|
||||||
const handleStatusChange = async (row: RepairCategoryVO) => {
|
const handleStatusChange = async (row: RepairCategoryVO) => {
|
||||||
|
const originalStatus = row.status;
|
||||||
const text = row.status === '1' ? '启用' : '停用';
|
const text = row.status === '1' ? '启用' : '停用';
|
||||||
try {
|
try {
|
||||||
await proxy?.$modal.confirm('确认要' + text + '"' + row.categoryName + '"类型吗?');
|
await proxy?.$modal.confirm(`确认要${text}"${row.categoryName}"类型吗?`);
|
||||||
await updateRepairCategory({ id: row.id, status: row.status });
|
// 移除前端辅助字段,只保留后端需要的核心字段
|
||||||
|
const { children, ...updateData } = row as any;
|
||||||
|
await updateRepairCategory(updateData);
|
||||||
proxy?.$modal.msgSuccess(text + '成功');
|
proxy?.$modal.msgSuccess(text + '成功');
|
||||||
} catch {
|
} catch (e) {
|
||||||
row.status = row.status === '1' ? '0' : '1';
|
// 如果请求失败或被取消,则还原原状态
|
||||||
|
row.status = originalStatus;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -543,7 +575,7 @@ const reset = () => {
|
|||||||
categoryDescription: '',
|
categoryDescription: '',
|
||||||
parentId: 0, // 使用数字类型,确保与树形选择器数据类型一致
|
parentId: 0, // 使用数字类型,确保与树形选择器数据类型一致
|
||||||
requiredSkills: '',
|
requiredSkills: '',
|
||||||
skillLevel: '',
|
skillLevel: '2', // 默认中级
|
||||||
estimatedDuration: undefined,
|
estimatedDuration: undefined,
|
||||||
standardCost: undefined,
|
standardCost: undefined,
|
||||||
iconUrl: '',
|
iconUrl: '',
|
||||||
@@ -840,4 +872,14 @@ onMounted(() => {
|
|||||||
:deep(.el-color-picker__color) {
|
:deep(.el-color-picker__color) {
|
||||||
border: 0px !important;
|
border: 0px !important;
|
||||||
}
|
}
|
||||||
|
/* 搜索按钮容器样式 */
|
||||||
|
.search-btn-container {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
margin-top: 10px;
|
||||||
|
|
||||||
|
.el-form-item {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
Reference in new issue
Block a user