diff --git a/src/api/inspection/point.js b/src/api/inspection/point.js new file mode 100644 index 0000000..5f4b17e --- /dev/null +++ b/src/api/inspection/point.js @@ -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' + }) +} \ No newline at end of file diff --git a/src/api/inspection/task.js b/src/api/inspection/task.js new file mode 100644 index 0000000..7fa245d --- /dev/null +++ b/src/api/inspection/task.js @@ -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' + }) +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index 5630a13..eb71c52 100644 --- a/src/main.js +++ b/src/main.js @@ -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' }); diff --git a/src/views/inspection/map/index.vue b/src/views/inspection/map/index.vue index c8c20c0..ef55834 100644 --- a/src/views/inspection/map/index.vue +++ b/src/views/inspection/map/index.vue @@ -235,8 +235,6 @@ function submitForm() { reset(); open.value = false; }); - ElMessage.success("地图添加成功!"); - getList(); } else { // 调用修改接口 updateMap(form.value).then(() => { diff --git a/src/views/inspection/flow/index.vue b/src/views/inspection/point/index.vue similarity index 65% rename from src/views/inspection/flow/index.vue rename to src/views/inspection/point/index.vue index 6531b30..f40527e 100644 --- a/src/views/inspection/flow/index.vue +++ b/src/views/inspection/point/index.vue @@ -22,14 +22,33 @@ - - + + > + + + + + + + + + + @@ -38,7 +57,6 @@ + - + @@ -165,12 +189,24 @@ - + - - + + + + 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(); }); diff --git a/src/views/inspection/task/index.vue b/src/views/inspection/task/index.vue index e038e55..e07f8e3 100644 --- a/src/views/inspection/task/index.vue +++ b/src/views/inspection/task/index.vue @@ -1,3 +1,232 @@ \ No newline at end of file +
+
+ + + + + + + 新增 + + + + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + diff --git a/src/views/test/detect/index.vue b/src/views/test/detect/index.vue index de6991e..9357367 100644 --- a/src/views/test/detect/index.vue +++ b/src/views/test/detect/index.vue @@ -222,7 +222,7 @@ - + { 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/, '') }