Commit 92ecdb7d authored by 胡占生's avatar 胡占生 🇨🇳

Merge branch 'developer' of http://git.censoft.com.cn/ai-yunshou/ai-yunshou-vue into developer

parents 951203a4 4c844266
import { onMounted, ref, watch } from "vue";
import request from "@/utils/request";
import { ElMessageBox } from "element-plus";
function useIndex(apis, callback, listReady, immList = true ) {
function useIndex(apis, callback, listReady, immList = true) {
const visible = ref(false);
const search = ref({});
const form = ref({
......@@ -51,7 +51,7 @@ function useIndex(apis, callback, listReady, immList = true ) {
});
}
function getList(params, isFirst) {
request({
return request({
url: apis.list,
method: "get",
params: { ...params, ...page.value, ...search.value },
......@@ -73,6 +73,20 @@ function useIndex(apis, callback, listReady, immList = true ) {
return res;
});
}
function editSubmit(data) {
request({
url: apis.edit,
method: "put",
data,
}).then((res) => {
if (immclose) {
visible.value = false;
getList();
}
resolve();
});
}
function toSubmit(immclose = true) {
return new Promise((resolve, reject) => {
if (form.value.id) {
......@@ -129,9 +143,8 @@ function useIndex(apis, callback, listReady, immList = true ) {
getList,
toOpen,
search,
editSubmit
};
}
export { useIndex };
......@@ -11,11 +11,11 @@
<el-card class="left-list">
<div class="head-container">
<!-- <el-input -->
<!-- v-model="deptName" -->
<!-- placeholder="请输入" -->
<!-- clearable -->
<!-- prefix-icon="Search" -->
<!-- style="margin-bottom: 20px" -->
<!-- v-model="deptName" -->
<!-- placeholder="请输入" -->
<!-- clearable -->
<!-- prefix-icon="Search" -->
<!-- style="margin-bottom: 20px" -->
<!-- /> -->
</div>
<div class="head-container">
......@@ -88,6 +88,11 @@
align="center"
prop="deviceName"
/>
<el-table-column
label="点位名称"
align="center"
prop="locationName"
/>
<el-table-column
label="所属区域"
align="center"
......@@ -126,7 +131,7 @@
v-model="scope.row.runningState"
active-value="0"
inactive-value="1"
@change="(e)=>changeState(scope.row, e)"
@change="(e) => changeState(scope.row, e)"
/>
</template>
</el-table-column>
......@@ -169,7 +174,13 @@
</el-scrollbar>
</el-col>
</el-row>
<drawPoint ref="drawPointRef" :algorithmManage="algorithmManage" />
<template v-if="algorithmManage.visible.value">
<drawPoint
ref="drawPointRef"
:algorithmManage="algorithmManage"
:areaManger="areaManger"
/>
</template>
<el-dialog
title="新增区域"
v-model="areaManger.visible.value"
......@@ -185,7 +196,6 @@
:props="{ children: 'children', value: 'id', checkStrictly: true }"
placeholder="请选择上级区域"
clearable
@change="handleChange"
/>
</el-form-item>
<el-form-item label="区域名称" prop="regionName">
......@@ -362,7 +372,7 @@ const areaManger = useIndex(
(data) => {
algorithmManage.form.value.regionalId = data[0].id;
algorithmManage.search.value.regionalId = data[0].id;
algorithmManage.getList()
algorithmManage.getList();
}
);
......@@ -375,7 +385,7 @@ const algorithmManage = useIndex(
detail: "/yunshou/aiRegionalLocation/",
},
({ data }) => {},
()=>{},
() => {},
false
);
function submitAreaForm(e) {
......@@ -392,21 +402,22 @@ function submitAreaForm(e) {
function handleNodeClick(e) {
algorithmManage.form.value.regionalId = e.id;
algorithmManage.search.value.regionalId = e.id;
algorithmManage.search.value.status = 0;
areaManger.form.value.id = e.id;
algorithmManage.getList({ regionalId: e.id });
}
function changeState(data, e) {
request({
url:'/yunshou/aiRegionalLocation/updateRunningState',
method:'POST',
data:{
id:data.id,
runningState:e
}
}).then(()=>{
algorithmManage.getList({regionalId:data.regionalId})
})
request({
url: "/yunshou/aiRegionalLocation/updateRunningState",
method: "POST",
data: {
id: data.id,
runningState: e,
},
}).then(() => {
algorithmManage.getList({ regionalId: data.regionalId });
});
}
</script>
......
......@@ -7,13 +7,31 @@ export const colors = () => {
return `rgba(${r},${g},${b},${a})`;
};
export function drawImage(video){
export function drawImage(video) {
const img = video;
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const canvas = document.getElementById("canvas");
const ctx = canvas.getContext("2d");
canvas.width = img.offsetWidth;
canvas.height = img.offsetHeight;
ctx.drawImage(img, 0, 0, canvas.width, canvas.height); // 绘制图片
return canvas.toDataURL("image/jpg")
}
\ No newline at end of file
return canvas.toDataURL("image/jpg");
}
export function base64ToFile(base64) {
const name = new Date().getTime();
if (typeof base64 != "string") {
return;
}
var arr = base64.split(",");
var type = arr[0].match(/:(.*?);/)[1];
var fileExt = type.split("/")[1];
var bstr = atob(arr[1]);
var n = bstr.length;
var u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], `${name}.` + fileExt, {
type: type,
});
}
......@@ -31,7 +31,8 @@ export default defineConfig(({ mode, command }) => {
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {
target: 'http://192.168.3.82/ai',
target: 'http://192.168.3.82:80/ai',
// target: 'http://192.168.4.206:80/ai',
// target:'http://192.168.14.43:8111/ai',
changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment