style(@vben/web-antd): lint 自动格式化修正巡检及区域模块
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { FunctionType } from '#/api/ops/area';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
export namespace InspectionTemplateApi {
|
||||
/** 巡检检查项模板 */
|
||||
export interface Template {
|
||||
@@ -41,7 +41,9 @@ export namespace InspectionTemplateApi {
|
||||
// ========== 巡检检查项模板 API ==========
|
||||
|
||||
/** 获取模板分页 */
|
||||
export function getTemplatePage(params: InspectionTemplateApi.TemplatePageQuery) {
|
||||
export function getTemplatePage(
|
||||
params: InspectionTemplateApi.TemplatePageQuery,
|
||||
) {
|
||||
return requestClient.get<InspectionTemplateApi.PageResult>(
|
||||
'/ops/inspection/template/page',
|
||||
{ params },
|
||||
|
||||
@@ -101,8 +101,7 @@ const routes: RouteRecordRaw[] = [
|
||||
title: '巡检记录',
|
||||
activePath: '/ops/inspection-record',
|
||||
},
|
||||
component: () =>
|
||||
import('#/views/ops/inspection-record/index.vue'),
|
||||
component: () => import('#/views/ops/inspection-record/index.vue'),
|
||||
},
|
||||
// 巡检模板管理
|
||||
{
|
||||
@@ -112,8 +111,7 @@ const routes: RouteRecordRaw[] = [
|
||||
title: '巡检模板管理',
|
||||
activePath: '/ops/inspection-template',
|
||||
},
|
||||
component: () =>
|
||||
import('#/views/ops/inspection-template/index.vue'),
|
||||
component: () => import('#/views/ops/inspection-template/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -312,4 +312,3 @@ export function useGridColumns(): VxeTableGridOptions<OpsAreaApi.BusArea>['colum
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -73,8 +73,7 @@ function handleEdit(row: OpsAreaApi.BusArea) {
|
||||
function buildFullNameMap(list: OpsAreaApi.BusArea[]): Map<number, string> {
|
||||
const nodeMap = new Map<number, OpsAreaApi.BusArea>();
|
||||
for (const item of list) {
|
||||
if (item.id !== null && item.id !== undefined)
|
||||
nodeMap.set(item.id, item);
|
||||
if (item.id !== null && item.id !== undefined) nodeMap.set(item.id, item);
|
||||
}
|
||||
|
||||
const cache = new Map<number, string>();
|
||||
|
||||
@@ -6,13 +6,7 @@ import { onActivated, onMounted, ref } from 'vue';
|
||||
import { Page, useVbenDrawer } from '@vben/common-ui';
|
||||
import { IconifyIcon } from '@vben/icons';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
DatePicker,
|
||||
Input,
|
||||
Tabs,
|
||||
} from 'ant-design-vue';
|
||||
import { Button, Card, DatePicker, Input, Tabs } from 'ant-design-vue';
|
||||
|
||||
import { STATUS_TAB_OPTIONS } from './data';
|
||||
import CardView from './modules/card-view.vue';
|
||||
@@ -84,11 +78,8 @@ function handleDetail(record: InspectionRecordApi.InspectionRecord) {
|
||||
|
||||
/** 日期范围变化 */
|
||||
function handleDateChange(_dates: any, dateStrings: [string, string]) {
|
||||
if (dateStrings && dateStrings[0]) {
|
||||
queryParams.value.createTime = dateStrings;
|
||||
} else {
|
||||
queryParams.value.createTime = undefined;
|
||||
}
|
||||
queryParams.value.createTime =
|
||||
dateStrings && dateStrings[0] ? dateStrings : undefined;
|
||||
}
|
||||
|
||||
let isFirstActivate = true;
|
||||
|
||||
@@ -103,7 +103,7 @@ defineExpose({
|
||||
@click="emit('detail', item)"
|
||||
>
|
||||
<!-- 左上角渐变背景层 -->
|
||||
<div class="card-gradient-bg" />
|
||||
<div class="card-gradient-bg"></div>
|
||||
|
||||
<!-- 卡片内容 -->
|
||||
<div class="card-inner">
|
||||
@@ -160,10 +160,7 @@ defineExpose({
|
||||
>
|
||||
{{ ATTRIBUTION_MAP[item.attributionResult] }}
|
||||
</Tag>
|
||||
<span
|
||||
v-if="item.generatedOrderId"
|
||||
class="order-link"
|
||||
>
|
||||
<span v-if="item.generatedOrderId" class="order-link">
|
||||
<IconifyIcon icon="solar:document-bold-duotone" />
|
||||
已生成工单
|
||||
</span>
|
||||
@@ -230,10 +227,10 @@ defineExpose({
|
||||
|
||||
.card-inner {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
z-index: 1;
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
@@ -273,11 +270,11 @@ defineExpose({
|
||||
display: -webkit-box;
|
||||
margin: 0 0 10px;
|
||||
overflow: hidden;
|
||||
-webkit-line-clamp: 2;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
color: #262626;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
@@ -305,9 +302,9 @@ defineExpose({
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
font-size: 13px;
|
||||
color: #595959;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,13 +21,7 @@ import dayjs from 'dayjs';
|
||||
|
||||
import { getRecordDetail } from '#/api/ops/inspection-record';
|
||||
|
||||
import {
|
||||
ATTRIBUTION_MAP,
|
||||
ATTRIBUTION_TAG_COLOR_MAP,
|
||||
RESULT_COLOR_MAP,
|
||||
RESULT_ICON_MAP,
|
||||
RESULT_STATUS_MAP,
|
||||
} from '../data';
|
||||
import { RESULT_ICON_MAP, RESULT_STATUS_MAP } from '../data';
|
||||
|
||||
const router = useRouter();
|
||||
const record = ref<InspectionRecordApi.InspectionRecordDetail | null>(null);
|
||||
@@ -36,8 +30,7 @@ const loading = ref(false);
|
||||
const [Drawer, drawerApi] = useVbenDrawer({
|
||||
onOpenChange(isOpen: boolean) {
|
||||
if (isOpen) {
|
||||
const data =
|
||||
drawerApi.getData<InspectionRecordApi.InspectionRecord>();
|
||||
const data = drawerApi.getData<InspectionRecordApi.InspectionRecord>();
|
||||
if (data?.id) {
|
||||
loadDetail(data.id);
|
||||
}
|
||||
@@ -69,7 +62,12 @@ const itemStats = computed(() => {
|
||||
if (!record.value?.items?.length) return null;
|
||||
const total = record.value.items.length;
|
||||
const passed = record.value.items.filter((i) => i.isPassed).length;
|
||||
return { total, passed, failed: total - passed, rate: Math.round((passed / total) * 100) };
|
||||
return {
|
||||
total,
|
||||
passed,
|
||||
failed: total - passed,
|
||||
rate: Math.round((passed / total) * 100),
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -80,7 +78,11 @@ const itemStats = computed(() => {
|
||||
<!-- ============ 1. 结果横幅 ============ -->
|
||||
<div
|
||||
class="result-banner"
|
||||
:class="record.resultStatus === 1 ? 'result-banner--pass' : 'result-banner--fail'"
|
||||
:class="
|
||||
record.resultStatus === 1
|
||||
? 'result-banner--pass'
|
||||
: 'result-banner--fail'
|
||||
"
|
||||
>
|
||||
<div class="result-banner__left">
|
||||
<IconifyIcon
|
||||
@@ -157,11 +159,17 @@ const itemStats = computed(() => {
|
||||
<div class="check-card__header">
|
||||
<span>检查项</span>
|
||||
<div v-if="itemStats" class="check-card__stats">
|
||||
<span v-if="itemStats.passed > 0" class="check-card__stat check-card__stat--pass">
|
||||
<span
|
||||
v-if="itemStats.passed > 0"
|
||||
class="check-card__stat check-card__stat--pass"
|
||||
>
|
||||
<IconifyIcon icon="solar:check-circle-bold" />
|
||||
{{ itemStats.passed }}
|
||||
</span>
|
||||
<span v-if="itemStats.failed > 0" class="check-card__stat check-card__stat--fail">
|
||||
<span
|
||||
v-if="itemStats.failed > 0"
|
||||
class="check-card__stat check-card__stat--fail"
|
||||
>
|
||||
<IconifyIcon icon="solar:close-circle-bold" />
|
||||
{{ itemStats.failed }}
|
||||
</span>
|
||||
@@ -188,7 +196,11 @@ const itemStats = computed(() => {
|
||||
<!-- 主行 -->
|
||||
<div class="check-item__main">
|
||||
<IconifyIcon
|
||||
:icon="item.isPassed ? 'solar:check-circle-bold' : 'solar:close-circle-bold'"
|
||||
:icon="
|
||||
item.isPassed
|
||||
? 'solar:check-circle-bold'
|
||||
: 'solar:close-circle-bold'
|
||||
"
|
||||
class="check-item__icon"
|
||||
:style="{ color: item.isPassed ? '#52c41a' : '#ff4d4f' }"
|
||||
/>
|
||||
@@ -245,14 +257,15 @@ const itemStats = computed(() => {
|
||||
</Card>
|
||||
|
||||
<!-- ============ 5. 关联工单 ============ -->
|
||||
<Card
|
||||
v-if="record.generatedOrderId"
|
||||
size="small"
|
||||
class="linked-card"
|
||||
>
|
||||
<Card v-if="record.generatedOrderId" size="small" class="linked-card">
|
||||
<div
|
||||
class="linked-card__row"
|
||||
@click="router.push({ name: 'WorkOrderDetail', params: { id: record.generatedOrderId } })"
|
||||
@click="
|
||||
router.push({
|
||||
name: 'WorkOrderDetail',
|
||||
params: { id: record.generatedOrderId },
|
||||
})
|
||||
"
|
||||
>
|
||||
<IconifyIcon
|
||||
icon="solar:document-bold-duotone"
|
||||
@@ -523,12 +536,12 @@ const itemStats = computed(() => {
|
||||
|
||||
&__photo {
|
||||
overflow: hidden;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
|
||||
:deep(.ant-image-img) {
|
||||
border-radius: 6px;
|
||||
object-fit: cover;
|
||||
border-radius: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,14 +64,13 @@ defineExpose({ refresh: loadStats });
|
||||
<Row :gutter="12" class="mb-3">
|
||||
<!-- 巡检总数 -->
|
||||
<Col :xs="24" :sm="12" :md="6">
|
||||
<Card
|
||||
:body-style="{ padding: '12px 14px' }"
|
||||
class="stats-card"
|
||||
>
|
||||
<Card :body-style="{ padding: '12px 14px' }" class="stats-card">
|
||||
<div class="stats-content">
|
||||
<div
|
||||
class="stats-icon"
|
||||
style="--icon-color: #1677ff; --icon-bg: #e6f4ff"
|
||||
style="
|
||||
|
||||
--icon-color: #1677ff; --icon-bg: #e6f4ff"
|
||||
>
|
||||
<IconifyIcon icon="solar:clipboard-list-bold-duotone" />
|
||||
</div>
|
||||
@@ -85,14 +84,13 @@ defineExpose({ refresh: loadStats });
|
||||
|
||||
<!-- 合格数 -->
|
||||
<Col :xs="24" :sm="12" :md="6">
|
||||
<Card
|
||||
:body-style="{ padding: '12px 14px' }"
|
||||
class="stats-card"
|
||||
>
|
||||
<Card :body-style="{ padding: '12px 14px' }" class="stats-card">
|
||||
<div class="stats-content">
|
||||
<div
|
||||
class="stats-icon"
|
||||
style="--icon-color: #52c41a; --icon-bg: #f6ffed"
|
||||
style="
|
||||
|
||||
--icon-color: #52c41a; --icon-bg: #f6ffed"
|
||||
>
|
||||
<IconifyIcon icon="solar:check-circle-bold-duotone" />
|
||||
</div>
|
||||
@@ -106,14 +104,13 @@ defineExpose({ refresh: loadStats });
|
||||
|
||||
<!-- 不合格数 -->
|
||||
<Col :xs="24" :sm="12" :md="6">
|
||||
<Card
|
||||
:body-style="{ padding: '12px 14px' }"
|
||||
class="stats-card"
|
||||
>
|
||||
<Card :body-style="{ padding: '12px 14px' }" class="stats-card">
|
||||
<div class="stats-content">
|
||||
<div
|
||||
class="stats-icon"
|
||||
style="--icon-color: #ff4d4f; --icon-bg: #fff1f0"
|
||||
style="
|
||||
|
||||
--icon-color: #ff4d4f; --icon-bg: #fff1f0"
|
||||
>
|
||||
<IconifyIcon icon="solar:close-circle-bold-duotone" />
|
||||
</div>
|
||||
@@ -127,21 +124,24 @@ defineExpose({ refresh: loadStats });
|
||||
|
||||
<!-- 合格率 -->
|
||||
<Col :xs="24" :sm="12" :md="6">
|
||||
<Card
|
||||
:body-style="{ padding: '12px 14px' }"
|
||||
class="stats-card"
|
||||
>
|
||||
<Card :body-style="{ padding: '12px 14px' }" class="stats-card">
|
||||
<div class="stats-content">
|
||||
<div
|
||||
class="stats-icon"
|
||||
style="--icon-color: #722ed1; --icon-bg: #f9f0ff"
|
||||
style="
|
||||
|
||||
--icon-color: #722ed1; --icon-bg: #f9f0ff"
|
||||
>
|
||||
<IconifyIcon icon="solar:chart-bold-duotone" />
|
||||
</div>
|
||||
<div class="stats-info">
|
||||
<div class="stats-title">合格率</div>
|
||||
<div class="stats-value">
|
||||
{{ statsData.passRate ? `${statsData.passRate.toFixed(1)}%` : '-' }}
|
||||
{{
|
||||
statsData.passRate
|
||||
? `${statsData.passRate.toFixed(1)}%`
|
||||
: '-'
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -4,13 +4,6 @@ import type { InspectionTemplateApi } from '#/api/ops/inspection-template';
|
||||
|
||||
import { z } from '#/adapter/form';
|
||||
|
||||
import {
|
||||
FUNCTION_TYPE_OPTIONS,
|
||||
FUNCTION_TYPE_TAG_COLORS,
|
||||
} from '../area/data';
|
||||
|
||||
export { FUNCTION_TYPE_OPTIONS, FUNCTION_TYPE_TAG_COLORS };
|
||||
|
||||
/** 检查项列表列 */
|
||||
export function useGridColumns(): VxeTableGridOptions<InspectionTemplateApi.Template>['columns'] {
|
||||
return [
|
||||
@@ -109,3 +102,5 @@ export function useTemplateFormSchema(): VbenFormSchema[] {
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
export { FUNCTION_TYPE_OPTIONS, FUNCTION_TYPE_TAG_COLORS } from '../area/data';
|
||||
|
||||
@@ -239,7 +239,10 @@ onMounted(() => {
|
||||
|
||||
<div class="flex h-full gap-4">
|
||||
<!-- 左侧:功能类型列表 -->
|
||||
<Card class="w-[220px] flex-shrink-0 overflow-hidden" :body-style="{ padding: '8px' }">
|
||||
<Card
|
||||
class="w-[220px] flex-shrink-0 overflow-hidden"
|
||||
:body-style="{ padding: '8px' }"
|
||||
>
|
||||
<div class="mb-2 px-2 text-sm font-medium text-gray-500">功能类型</div>
|
||||
<div
|
||||
v-for="opt in FUNCTION_TYPE_OPTIONS"
|
||||
@@ -256,7 +259,8 @@ onMounted(() => {
|
||||
<Badge
|
||||
:count="typeCounts[opt.value] ?? 0"
|
||||
:number-style="{
|
||||
backgroundColor: selectedType === opt.value ? '#1677ff' : '#f0f0f0',
|
||||
backgroundColor:
|
||||
selectedType === opt.value ? '#1677ff' : '#f0f0f0',
|
||||
color: selectedType === opt.value ? '#fff' : '#999',
|
||||
fontSize: '12px',
|
||||
boxShadow: 'none',
|
||||
@@ -268,7 +272,13 @@ onMounted(() => {
|
||||
<!-- 右侧:检查项列表 -->
|
||||
<Card
|
||||
class="min-w-0 flex-1 overflow-hidden"
|
||||
:body-style="{ padding: '16px', height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden' }"
|
||||
:body-style="{
|
||||
padding: '16px',
|
||||
height: '100%',
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
overflow: 'hidden',
|
||||
}"
|
||||
>
|
||||
<!-- 工具栏 -->
|
||||
<div class="mb-4 flex flex-shrink-0 items-center justify-between">
|
||||
@@ -281,10 +291,7 @@ onMounted(() => {
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<template v-if="!isSorting">
|
||||
<Button
|
||||
v-if="templateList.length > 1"
|
||||
@click="handleStartSort"
|
||||
>
|
||||
<Button v-if="templateList.length > 1" @click="handleStartSort">
|
||||
<template #icon>
|
||||
<IconifyIcon icon="lucide:align-start-vertical" />
|
||||
</template>
|
||||
|
||||
@@ -43,7 +43,8 @@ const [Modal, modalApi] = useVbenModal({
|
||||
const valid = await formApi.validate();
|
||||
if (!valid) return;
|
||||
modalApi.lock();
|
||||
const values = (await formApi.getValues()) as InspectionTemplateApi.Template;
|
||||
const values =
|
||||
(await formApi.getValues()) as InspectionTemplateApi.Template;
|
||||
try {
|
||||
// 自动填入功能类型
|
||||
const data: InspectionTemplateApi.Template = {
|
||||
|
||||
Reference in New Issue
Block a user