巡检记录,巡检路线,巡检点完成,巡检项目完成

This commit is contained in:
Zy
2026-04-21 10:20:15 +08:00
parent 35cf75f377
commit df20099dfd
9 changed files with 227 additions and 68 deletions

View File

@@ -45,12 +45,23 @@ export const addItem = (data: ItemForm) => {
*/ */
export const updateItem = (data: ItemForm) => { export const updateItem = (data: ItemForm) => {
return request({ return request({
url: '/inspection/item', url: '/inspection/item/updateItem',
method: 'put', method: 'PUT',
data: data data: data
}); });
}; };
/**
* 修改巡检项目 状态
* @param data
*/
export const updateItemStatus = (data: { id: string; status: string }) => {
return request({
url: `/inspection/item/changeStatus?id=${data.id}&status=${data.status}`,
method: 'PUT'
});
};
/** /**
* 删除巡检项目 * 删除巡检项目
* @param id * @param id

View File

@@ -52,7 +52,7 @@ export interface ItemVO {
/** /**
* 状态0-开启1-关闭 * 状态0-开启1-关闭
*/ */
status: number; status: string;
/** /**
* 备注 * 备注
@@ -114,7 +114,7 @@ export interface ItemForm extends BaseEntity {
/** /**
* 状态0-开启1-关闭 * 状态0-开启1-关闭
*/ */
status?: number; status?: string;
/** /**
* 备注 * 备注
@@ -171,7 +171,7 @@ export interface ItemQuery extends PageQuery {
/** /**
* 状态0-开启1-关闭 * 状态0-开启1-关闭
*/ */
status?: number; status?: string;
/** /**
* 日期范围参数 * 日期范围参数

View File

@@ -0,0 +1,126 @@
<template>
<div class="AddBuildingBox">
<PageHeader></PageHeader>
<div class="AddBuildingBody">
<div class="title">基本信息</div>
<div class="addBuildingFormBody">
<el-form class="formBody" label-position="right" ref="formRef" :model="form" :rules="rules" label-width="130px">
<el-form-item label="项目名称" prop="itemName">
<el-input v-model.trim="form.itemName" placeholder="请输入项目名称" />
</el-form-item>
<el-form-item label="巡检标准" prop="inspectionStandard">
<el-input type="textarea" :rows="5" v-model.trim="form.inspectionStandard" placeholder="请输入巡检标准" />
</el-form-item>
<el-form-item style="margin-top: 30px">
<el-button type="primary" @click="submitForm">提交</el-button>
<el-button @click="cancelForm">返回</el-button>
</el-form-item>
</el-form>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import PageHeader from '@/components/Pageheader/index.vue';
import { addMonthCard, getMonthCard, updateMonthCard } from '@/api/system/MonthCard';
import { addItem, getItem, updateItem } from '@/api/system/InspectionItem';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const router = useRouter();
const route = useRoute();
const formRef = ref();
const form = ref({
id: null,
itemName: '', // 项目名称
inspectionStandard: null // 巡检标准
});
const rules = ref({
itemName: [{ required: true, message: '请输入项目名称', trigger: 'blur' }],
inspectionStandard: [{ required: true, message: '请输入 巡检标准', trigger: 'blur' }]
});
const userid = ref(null);
if (route.query.id) {
userid.value = route.query.id;
getItem(userid.value).then((res) => {
form.value = {
id: res.data.id,
itemName: res.data.itemName,
inspectionStandard: res.data.inspectionStandard
};
});
}
// !== 提交 =============================================================================
// 提交
const submitForm = () => {
formRef.value?.validate(async (valid: boolean) => {
if (valid) {
if (userid.value) {
updateItem(form.value).then((res) => {
ElMessage.success('编辑成功');
cancelForm();
});
} else {
addItem(form.value).then((res) => {
ElMessage.success('添加成功');
cancelForm();
});
}
}
});
};
// 推出
const cancelForm = () => {
router.push({
path: '/Inspection/item'
});
};
</script>
<style scoped lang="scss">
.AddBuildingBox {
padding: 15px;
height: 100%;
width: 100%;
}
.AddBuildingBody {
margin-top: 20px;
display: flex;
flex-direction: column;
justify-content: center;
background-color: white;
padding: 15px;
.title {
height: 40px;
line-height: 40px;
padding-left: 20px;
background-color: rgba(255, 255, 255, 1);
color: rgba(16, 16, 16, 1);
border-bottom: 1px solid #bbbbbb;
margin-bottom: 60px;
}
.formBody {
width: 1050px;
margin: 0 auto;
&:deep(.el-form-item__content, .el-select, .el-input) {
width: 350px !important;
margin-right: 10px;
.el-cascader {
width: 100%;
}
}
.el-form-item {
margin-bottom: 20px;
align-items: center;
}
.el-button {
width: 80px;
height: 35px;
margin-right: 20px;
}
}
}
</style>

View File

@@ -1,5 +1,6 @@
<template> <template>
<div class="p-2"> <div class="h-full flex flex-col p-2">
<Pageheader></Pageheader>
<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">
@@ -16,7 +17,7 @@
</div> </div>
</transition> </transition>
<el-card shadow="never"> <el-card class="flex-1" shadow="never">
<template #header> <template #header>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
@@ -39,12 +40,22 @@
<el-table v-loading="loading" border :data="itemList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" border :data="itemList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="项目名称" align="center" prop="itemName" /> <el-table-column label="项目名称" width="200" align="center" prop="itemName" />
<el-table-column label="巡检标准" align="center" prop="inspectionStandard" /> <el-table-column label="巡检标准" align="center" prop="inspectionStandard" />
<el-table-column label="状态0-开启1-关闭" align="center" prop="status" /> <el-table-column label="状态" width="200" align="center" prop="status">
<el-table-column label="添加人" align="center" prop="remark" /> <template #default="scope">
<el-table-column label="添加时间" align="center" prop="remark" /> <el-switch
<el-table-column label="备注" align="center" prop="remark" /> @change="(val) => handleChange(val, scope.row.id)"
v-model="scope.row.status"
active-value="0"
inactive-value="1"
active-text="开启"
inactive-text="关闭"
></el-switch>
</template>
</el-table-column>
<el-table-column label="添加人" width="150" align="center" prop="remark" />
<el-table-column label="添加时间" width="150" align="center" prop="remark" />
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
<template #default="scope"> <template #default="scope">
<el-tooltip content="修改" placement="top"> <el-tooltip content="修改" placement="top">
@@ -59,49 +70,11 @@
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" /> <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
</el-card> </el-card>
<!-- 添加或修改巡检项目对话框 -->
<el-dialog :title="dialog.title" v-model="dialog.visible" width="500px" append-to-body>
<el-form ref="itemFormRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="项目名称" prop="itemName">
<el-input v-model="form.itemName" placeholder="请输入项目名称" />
</el-form-item>
<el-form-item label="项目编号" prop="itemCode">
<el-input v-model="form.itemCode" placeholder="请输入项目编号" />
</el-form-item>
<el-form-item label="巡检标准" prop="inspectionStandard">
<el-input v-model="form.inspectionStandard" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="项目类别" prop="category">
<el-input v-model="form.category" placeholder="请输入项目类别" />
</el-form-item>
<el-form-item label="项目描述" prop="description">
<el-input v-model="form.description" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="默认值" prop="defaultValue">
<el-input v-model="form.defaultValue" placeholder="请输入默认值" />
</el-form-item>
<el-form-item label="选项,多个用逗号分隔" prop="options">
<el-input v-model="form.options" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="是否必填0-否1-是" prop="isRequired">
<el-input v-model="form.isRequired" placeholder="请输入是否必填0-否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 :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div> </div>
</template> </template>
<script setup name="Item" lang="ts"> <script setup name="Item" lang="ts">
import { listItem, getItem, delItem, addItem, updateItem } from '@/api/system/InspectionItem/index'; import { listItem, getItem, delItem, addItem, updateItem, updateItemStatus } from '@/api/system/InspectionItem/index';
import { ItemVO, ItemQuery, ItemForm } from '@/api/system/InspectionItem/type'; import { ItemVO, ItemQuery, ItemForm } from '@/api/system/InspectionItem/type';
const { proxy } = getCurrentInstance() as ComponentInternalInstance; const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@@ -202,21 +175,39 @@ const handleSelectionChange = (selection: ItemVO[]) => {
multiple.value = !selection.length; multiple.value = !selection.length;
}; };
const router = useRouter();
/** 新增按钮操作 */ /** 新增按钮操作 */
const handleAdd = () => { const handleAdd = () => {
reset(); router.push({
dialog.visible = true; path: '/inspection/addItem'
dialog.title = '添加巡检项目'; });
}; };
/** 修改按钮操作 */ /** 修改按钮操作 */
const handleUpdate = async (row?: ItemVO) => { const handleUpdate = async (row?: ItemVO) => {
reset(); router.push({
const _id = row?.id || ids.value[0]; path: '/inspection/addItem',
const res = await getItem(_id); query: {
Object.assign(form.value, res.data); id: row.id
dialog.visible = true; }
dialog.title = '修改巡检项目'; });
};
const handleChange = (value: string, id: string) => {
console.log(value, id, typeof value, typeof id);
updateItemStatus({
id,
status: value
})
.then(() => {
proxy?.$modal.msgSuccess('状态修改成功');
getList();
})
.catch(() => {
proxy?.$modal.msgError('状态修改失败,请稍后再试');
getList();
});
}; };
/** 提交按钮 */ /** 提交按钮 */
@@ -239,7 +230,7 @@ const submitForm = () => {
/** 删除按钮操作 */ /** 删除按钮操作 */
const handleDelete = async (row?: ItemVO) => { const handleDelete = async (row?: ItemVO) => {
const _ids = row?.id || ids.value; const _ids = row?.id || ids.value;
await proxy?.$modal.confirm('是否确认删除巡检项目编号为"' + _ids + '"的数据项').finally(() => (loading.value = false)); await proxy?.$modal.confirm('是否确认删除?').finally(() => (loading.value = false));
await delItem(_ids); await delItem(_ids);
proxy?.$modal.msgSuccess('删除成功'); proxy?.$modal.msgSuccess('删除成功');
await getList(); await getList();
@@ -260,3 +251,9 @@ onMounted(() => {
getList(); getList();
}); });
</script> </script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="p-2"> <div class="p-2">
<PageHeader title="新建巡检计划"></PageHeader> <PageHeader></PageHeader>
<div class="EditBody"> <div class="EditBody">
<div class="title"> <div class="title">
<div>基本信息</div> <div>基本信息</div>

View File

@@ -13,6 +13,7 @@
<div <div
class="item" class="item"
:class="{ :class="{
disabled: item.status === '1',
active: checkoutPointItemlist.includes(item.id) active: checkoutPointItemlist.includes(item.id)
}" }"
@click="checkoutItem(item.id)" @click="checkoutItem(item.id)"
@@ -271,6 +272,11 @@ onUnmounted(() => {
align-items: center; align-items: center;
margin-right: 20px; margin-right: 20px;
margin-bottom: 10px; margin-bottom: 10px;
max-width: 200px;
min-width: 100px;
overflow: hidden;
text-overflow: ellipsis;
text-wrap: nowrap;
font-size: 14px; font-size: 14px;
color: #606266; color: #606266;
border: 1px solid #ccc; border: 1px solid #ccc;
@@ -289,6 +295,12 @@ onUnmounted(() => {
color: #409eff; color: #409eff;
background-color: #f0f9ff; background-color: #f0f9ff;
} }
&.disabled {
border-color: #eeeeee5b;
color: #fff;
cursor: not-allowed;
background-color: #d1d1d1;
}
} }
} }

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="h-full flex flex-col p-2"> <div class="h-full flex flex-col p-2">
<PageHeader></PageHeader> <Pageheader></Pageheader>
<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">

View File

@@ -1,6 +1,6 @@
<template> <template>
<div class="p-2"> <div class="flex flex-col h-full p-2">
<PageHeader></PageHeader> <Pageheader></Pageheader>
<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">
@@ -30,7 +30,7 @@
</div> </div>
</transition> </transition>
<el-card shadow="never"> <el-card class="flex-1" shadow="never">
<template #header> <template #header>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
@@ -225,3 +225,9 @@ onMounted(() => {
getList(); getList();
}); });
</script> </script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>

View File

@@ -1,5 +1,6 @@
<template> <template>
<div class="p-2"> <div class="p-2 flex flex-col h-full">
<pageheader></pageheader>
<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">
@@ -16,7 +17,7 @@
</div> </div>
</transition> </transition>
<el-card shadow="never"> <el-card class="flex-1" shadow="never">
<template #header> <template #header>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<el-col :span="1.5"> <el-col :span="1.5">
@@ -268,3 +269,9 @@ onMounted(() => {
getList(); getList();
}); });
</script> </script>
<style lang="scss" scoped>
.el-table {
height: calc(100% - 80px);
}
</style>