feat: 点位
This commit is contained in:
parent
d198189d2c
commit
a0b397fc40
32
src/api/inspection/point.js
Normal file
32
src/api/inspection/point.js
Normal file
@ -0,0 +1,32 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getPointList(params) {
|
||||
return request({
|
||||
url: '/inspection/waypoint/list',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
export function addPoint(data) {
|
||||
return request({
|
||||
url: '/inspection/waypoint',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function updatePoint(data) {
|
||||
return request({
|
||||
url: '/inspection/waypoint',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function deletePoint(id) {
|
||||
return request({
|
||||
url: `/inspection/waypoint/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
32
src/api/inspection/task.js
Normal file
32
src/api/inspection/task.js
Normal file
@ -0,0 +1,32 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function getTaskList(params) {
|
||||
return request({
|
||||
url: '/inspection/task/list',
|
||||
method: 'get',
|
||||
params: params
|
||||
})
|
||||
}
|
||||
|
||||
export function addTask(data) {
|
||||
return request({
|
||||
url: '/inspection/task',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function updateTask(data) {
|
||||
return request({
|
||||
url: '/inspection/task',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteTask(id) {
|
||||
return request({
|
||||
url: `/inspection/task/${id}`,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
@ -88,7 +88,7 @@ app.use(ElementPlus, {
|
||||
|
||||
app.use(WebSocketPlugin, {
|
||||
// url: import.meta.env.VITE_WS_URL,
|
||||
url: 'ws://192.168.0.114:13080/ws',
|
||||
url: 'ws://192.168.0.201:13080/ws',
|
||||
// url: 'ws://10.148.209.5:13080/ws',
|
||||
userId: 'your_user_id'
|
||||
});
|
||||
|
||||
@ -235,8 +235,6 @@ function submitForm() {
|
||||
reset();
|
||||
open.value = false;
|
||||
});
|
||||
ElMessage.success("地图添加成功!");
|
||||
getList();
|
||||
} else {
|
||||
// 调用修改接口
|
||||
updateMap(form.value).then(() => {
|
||||
|
||||
@ -22,14 +22,33 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24" :xxl="6">
|
||||
<el-form-item label="点位描述" prop="remark">
|
||||
<el-input
|
||||
v-model="queryParams.remark"
|
||||
<el-form-item label="所属地图" prop="mapId">
|
||||
<el-select
|
||||
v-model="queryParams.mapId"
|
||||
clearable
|
||||
placeholder="请输入点位描述"
|
||||
placeholder="请选择所属地图"
|
||||
style="width: 100%"
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
>
|
||||
<el-option
|
||||
v-for="item in mapList"
|
||||
:key="item.id"
|
||||
:label="item.mapName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24" :xxl="6">
|
||||
<el-form-item label="启用状态" prop="enabled">
|
||||
<el-select
|
||||
v-model="queryParams.enabled"
|
||||
clearable
|
||||
placeholder="请选择启用状态"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option label="启用" value="0" />
|
||||
<el-option label="禁用" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
@ -38,7 +57,6 @@
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
v-hasPermi="['test:detect:add']"
|
||||
icon="Plus"
|
||||
plain
|
||||
type="primary"
|
||||
@ -71,6 +89,12 @@
|
||||
prop="waypointName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="所属地图"
|
||||
prop="mapName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="点位描述"
|
||||
@ -90,7 +114,7 @@
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="配置状态" prop="isDeploy">
|
||||
<el-table-column align="center" label="配置状态" prop="configStatus">
|
||||
<template #default="scope">
|
||||
<TableTags
|
||||
:options="[
|
||||
@ -105,7 +129,7 @@
|
||||
type: 'warning',
|
||||
},
|
||||
]"
|
||||
:value="scope.row.isDeploy"
|
||||
:value="scope.row.configStatus"
|
||||
></TableTags>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -165,12 +189,24 @@
|
||||
|
||||
<!-- 添加或修改检测项配置对话框 -->
|
||||
<el-dialog v-model="open" :title="title" append-to-body width="500px">
|
||||
<el-form ref="detectRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form ref="pointRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="点位名称" prop="waypointName">
|
||||
<el-input v-model="form.waypointName" placeholder="请输入点位名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="点位描述" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入点位描述" />
|
||||
<el-form-item label="所属地图" prop="mapId">
|
||||
<el-select
|
||||
v-model="form.mapId"
|
||||
clearable
|
||||
placeholder="请选择所属地图"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in mapList"
|
||||
:key="item.id"
|
||||
:label="item.mapName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
@ -197,12 +233,12 @@
|
||||
|
||||
<script name="Detect" setup>
|
||||
import {
|
||||
addDetect,
|
||||
delDetect,
|
||||
getDetect,
|
||||
listDetect,
|
||||
updateDetect,
|
||||
} from "@/api/test/detect";
|
||||
addPoint,
|
||||
deletePoint,
|
||||
getPointList,
|
||||
updatePoint,
|
||||
} from "@/api/inspection/point";
|
||||
import { getMapList } from "@/api/inspection/map";
|
||||
import TableSearch from "@/components/TableSearch/index.vue";
|
||||
import { listGroup } from "@/api/system/group.js";
|
||||
import { appendParamsToPath } from "@/utils/fn.js";
|
||||
@ -210,6 +246,9 @@ import TableTags from "@/components/TableTags/index.vue";
|
||||
import EditTable from "@/components/EditTable/index.vue";
|
||||
|
||||
import { useContainerHeight } from "@/hooks/tableHeight";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { el } from "element-plus/es/locale/index.mjs";
|
||||
import { map } from "lodash";
|
||||
|
||||
const topContainerRef = ref();
|
||||
const containerHeight = useContainerHeight(topContainerRef);
|
||||
@ -231,20 +270,43 @@ const data = reactive({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
waypointName: null,
|
||||
remark: null,
|
||||
enabled: null,
|
||||
mapId: null,
|
||||
},
|
||||
rules: {
|
||||
waypointName: [
|
||||
{ required: true, message: "点位名称不能为空", trigger: "blur" },
|
||||
],
|
||||
mapId: [
|
||||
{ required: true, message: "所属地图不能为空", trigger: "change" },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const mapList = ref([]);
|
||||
// 获取地图列表
|
||||
const getMapArr = () => {
|
||||
getMapList({
|
||||
pageNum: 1,
|
||||
pageSize: 10000,
|
||||
}).then((response) => {
|
||||
mapList.value = response.rows;
|
||||
});
|
||||
}
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询检测项配置列表 */
|
||||
/** 查询点位列表 */
|
||||
function getList() {
|
||||
// loading.value = true;
|
||||
loading.value = true;
|
||||
getPointList(queryParams.value)
|
||||
.then((res) => {
|
||||
tableDataList.value = res.rows;
|
||||
total.value = res.total;
|
||||
})
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
@ -255,7 +317,8 @@ function cancel() {
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
|
||||
pointRef.value.resetFields();
|
||||
form.value = {};
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
@ -271,29 +334,61 @@ function resetQuery() {
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
isNew.value = true;
|
||||
open.value = true;
|
||||
title.value = "添加检测项配置";
|
||||
title.value = "添加点位";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
|
||||
form.value = { ...row };
|
||||
isNew.value = false;
|
||||
open.value = true;
|
||||
title.value = "修改点位";
|
||||
}
|
||||
|
||||
const pointRef = ref();
|
||||
const isNew = ref(true);
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
|
||||
pointRef.value.validate((valid) => {
|
||||
if (valid) {
|
||||
if (isNew.value) {
|
||||
addPoint(form.value).then(() => {
|
||||
ElMessage.success("添加成功");
|
||||
getList();
|
||||
open.value = false;
|
||||
reset();
|
||||
});
|
||||
} else {
|
||||
updatePoint(form.value).then(() => {
|
||||
ElMessage.success("修改成功");
|
||||
getList();
|
||||
open.value = false;
|
||||
reset();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
|
||||
ElMessageBox.confirm("确定要删除该点位吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
deletePoint(row.id).then(() => {
|
||||
ElMessage.success("删除成功");
|
||||
getList();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** 配置按钮操作 */
|
||||
function handleDeploy(row) {
|
||||
const params = { itemId: row.id, name: row.waypointName, state: row.status };
|
||||
const params = { itemId: row.detectItemId, name: row.waypointName, state: row.status };
|
||||
const fullPath = appendParamsToPath("/flow", params);
|
||||
const p = window.open(fullPath, "_blank");
|
||||
}
|
||||
@ -302,6 +397,7 @@ function handleDeploy(row) {
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
getMapArr();
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -1,3 +1,232 @@
|
||||
<template>
|
||||
<div>任务管理</div>
|
||||
</template>
|
||||
<div class="app-container">
|
||||
<div ref="topContainerRef">
|
||||
<TableSearch :queryParams="queryParams" :showSearch="showSearch" label-width="90px" queryRef="queryRef"
|
||||
@refresh="resetQuery" @search="handleQuery">
|
||||
<template #one>
|
||||
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24" :xxl="6">
|
||||
<el-form-item label="任务名称" prop="taskName">
|
||||
<el-input v-model="queryParams.taskName" clearable placeholder="请输入任务名称"
|
||||
style="width: 100%" @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :lg="6" :md="12" :sm="24" :xl="6" :xs="24" :xxl="6">
|
||||
<el-form-item label="任务类型" prop="taskType">
|
||||
<el-select v-model="queryParams.taskType" clearable placeholder="请选择任务类型"
|
||||
style="width: 100%">
|
||||
<el-option label="巡检任务" value="1" />
|
||||
<el-option label="讲解任务" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
</TableSearch>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button icon="Plus" plain type="primary" @click="handleAdd">新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</div>
|
||||
|
||||
<div :style="containerHeight">
|
||||
<el-table v-loading="loading" height="100%" :data="tableDataList">
|
||||
<el-table-column align="center" label="id" prop="id" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="任务名称" prop="taskName" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="任务描述" prop="remark" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="任务类型" prop="taskType">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.taskType === '1' ? 'primary' : 'success'">
|
||||
{{ scope.row.taskType === '1' ? '巡检任务' : '讲解任务' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="创建人" prop="createBy" show-overflow-tooltip />
|
||||
<el-table-column align="center" label="创建时间" prop="createTime" show-overflow-tooltip />
|
||||
<el-table-column align="center" class-name="small-padding fixed-width" label="操作" width="260">
|
||||
<template #default="scope">
|
||||
<el-button icon="Edit" link type="primary" @click="handleUpdate(scope.row)">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button icon="Cpu" link type="primary" @click="handleBindPoint(scope.row)">绑定点位
|
||||
</el-button>
|
||||
<el-button icon="Delete" link type="primary" @click="handleDelete(scope.row)">删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" v-model:limit="queryParams.pageSize" v-model:page="queryParams.pageNum"
|
||||
:total="total" @pagination="getList" />
|
||||
</div>
|
||||
|
||||
|
||||
<el-dialog v-model="open" :title="title" append-to-body width="500px">
|
||||
<el-form ref="taskRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="任务名称" prop="taskName">
|
||||
<el-input v-model="form.taskName" placeholder="请输入任务名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="任务类型" prop="taskType">
|
||||
<el-select v-model="queryParams.taskType" clearable placeholder="请选择任务类型" style="width: 100%">
|
||||
<el-option label="巡检任务" value="1" />
|
||||
<el-option label="讲解任务" value="2" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" :rows="2" placeholder="请输入备注" type="textarea" />
|
||||
</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>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="dialogVisible" title="参数配置" width="1080px">
|
||||
<EditTable></EditTable>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script name="Detect" setup>
|
||||
import { addTask, updateTask, getTaskList, deleteTask } from "../../../api/inspection/task";
|
||||
import TableSearch from "@/components/TableSearch/index.vue";
|
||||
import { listGroup } from "@/api/system/group.js";
|
||||
import { appendParamsToPath } from "@/utils/fn.js";
|
||||
import TableTags from "@/components/TableTags/index.vue";
|
||||
import EditTable from "@/components/EditTable/index.vue";
|
||||
|
||||
import { useContainerHeight } from "@/hooks/tableHeight";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import { de } from "element-plus/es/locale/index.mjs";
|
||||
|
||||
const topContainerRef = ref();
|
||||
const containerHeight = useContainerHeight(topContainerRef);
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
|
||||
const tableDataList = ref([]);
|
||||
const open = ref(false);
|
||||
const dialogVisible = ref(false);
|
||||
const loading = ref(false);
|
||||
const showSearch = ref(true);
|
||||
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
taskName: null,
|
||||
taskType: null,
|
||||
},
|
||||
rules: {
|
||||
taskName: [
|
||||
{ required: true, message: "任务名称不能为空", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询任务列表 */
|
||||
function getList() {
|
||||
loading.value = false;
|
||||
getTaskList(queryParams.value).then((res) => {
|
||||
tableDataList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
taskRef.value.resetFields();
|
||||
form.value = {};
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
isNew.value = true;
|
||||
open.value = true;
|
||||
title.value = "添加任务";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
form.value = { ...row };
|
||||
isNew.value = false;
|
||||
open.value = true;
|
||||
title.value = "修改任务";
|
||||
}
|
||||
|
||||
const taskRef = ref();
|
||||
const isNew = ref(true);
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
taskRef.value.validate((valid) => {
|
||||
if (valid) {
|
||||
if (isNew.value) {
|
||||
addTask(form.value).then(() => {
|
||||
ElMessage.success("添加成功");
|
||||
cancel();
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
updateTask(form.value).then(() => {
|
||||
ElMessage.success("修改成功");
|
||||
cancel();
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
ElMessageBox.confirm("确定要删除该任务吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
deleteTask(row.id).then(() => {
|
||||
ElMessage.success("删除成功");
|
||||
getList();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const handleBindPoint = (row) => {
|
||||
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@ -222,7 +222,7 @@
|
||||
<el-form-item label="检测项描述" prop="detectDesc">
|
||||
<el-input v-model="form.detectDesc" placeholder="请输入检测项描述" />
|
||||
</el-form-item>
|
||||
<el-form-item label="所属分组">
|
||||
<el-form-item label="所属分组" prop="groupId">
|
||||
<el-select v-model="form.groupId" placeholder="请选择所属分组">
|
||||
<el-option
|
||||
v-for="group in groupList"
|
||||
@ -323,6 +323,9 @@ const data = reactive({
|
||||
detectName: [
|
||||
{ required: true, message: "检测项名称不能为空", trigger: "blur" },
|
||||
],
|
||||
groupId: [
|
||||
{ required: true, message: "所属分组不能为空", trigger: "change" },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -47,11 +47,10 @@ export default defineConfig(({mode, command}) => {
|
||||
proxy: {
|
||||
// https://cn.vitejs.dev/config/#server-proxy
|
||||
'/dev-api': {
|
||||
//服务器 http://192.168.0.114:13080
|
||||
//李小龙 http://192.168.0.5:13080
|
||||
//李小龙 http://192.168.0.201:13080
|
||||
// dev http://10.148.20.34:13080
|
||||
// target: VITE_API_URL,
|
||||
target: command === 'build' ? VITE_API_URL : 'http://192.168.0.114:13080',
|
||||
target: command === 'build' ? VITE_API_URL : 'http://192.168.0.201:13080',
|
||||
changeOrigin: true,
|
||||
rewrite: (p) => p.replace(/^\/dev-api/, '')
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user