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
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
"element-plus": "^2.7.6", "element-plus": "^2.7.6",
"file-saver": "2.0.5", "file-saver": "2.0.5",
"fuse.js": "6.6.2", "fuse.js": "6.6.2",
"html2canvas": "^1.4.1",
"js-cookie": "3.0.5", "js-cookie": "3.0.5",
"jsencrypt": "3.3.2", "jsencrypt": "3.3.2",
"moment": "^2.30.1", "moment": "^2.30.1",
......
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from "vue";
import request from "@/utils/request"; import request from "@/utils/request";
import { ElMessageBox } from "element-plus"; import { ElMessageBox } from "element-plus";
function useIndex(apis, callback, listReady, immList = true ) { function useIndex(apis, callback, listReady, immList = true) {
const visible = ref(false); const visible = ref(false);
const search = ref({}); const search = ref({});
const form = ref({ const form = ref({
...@@ -51,7 +51,7 @@ function useIndex(apis, callback, listReady, immList = true ) { ...@@ -51,7 +51,7 @@ function useIndex(apis, callback, listReady, immList = true ) {
}); });
} }
function getList(params, isFirst) { function getList(params, isFirst) {
request({ return request({
url: apis.list, url: apis.list,
method: "get", method: "get",
params: { ...params, ...page.value, ...search.value }, params: { ...params, ...page.value, ...search.value },
...@@ -73,6 +73,20 @@ function useIndex(apis, callback, listReady, immList = true ) { ...@@ -73,6 +73,20 @@ function useIndex(apis, callback, listReady, immList = true ) {
return res; 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) { function toSubmit(immclose = true) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (form.value.id) { if (form.value.id) {
...@@ -129,9 +143,8 @@ function useIndex(apis, callback, listReady, immList = true ) { ...@@ -129,9 +143,8 @@ function useIndex(apis, callback, listReady, immList = true ) {
getList, getList,
toOpen, toOpen,
search, search,
editSubmit
}; };
} }
export { useIndex }; export { useIndex };
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
<el-card class="left-list"> <el-card class="left-list">
<div class="head-container"> <div class="head-container">
<!-- <el-input --> <!-- <el-input -->
<!-- v-model="deptName" --> <!-- v-model="deptName" -->
<!-- placeholder="请输入" --> <!-- placeholder="请输入" -->
<!-- clearable --> <!-- clearable -->
<!-- prefix-icon="Search" --> <!-- prefix-icon="Search" -->
<!-- style="margin-bottom: 20px" --> <!-- style="margin-bottom: 20px" -->
<!-- /> --> <!-- /> -->
</div> </div>
<div class="head-container"> <div class="head-container">
...@@ -88,6 +88,11 @@ ...@@ -88,6 +88,11 @@
align="center" align="center"
prop="deviceName" prop="deviceName"
/> />
<el-table-column
label="点位名称"
align="center"
prop="locationName"
/>
<el-table-column <el-table-column
label="所属区域" label="所属区域"
align="center" align="center"
...@@ -126,7 +131,7 @@ ...@@ -126,7 +131,7 @@
v-model="scope.row.runningState" v-model="scope.row.runningState"
active-value="0" active-value="0"
inactive-value="1" inactive-value="1"
@change="(e)=>changeState(scope.row, e)" @change="(e) => changeState(scope.row, e)"
/> />
</template> </template>
</el-table-column> </el-table-column>
...@@ -169,7 +174,13 @@ ...@@ -169,7 +174,13 @@
</el-scrollbar> </el-scrollbar>
</el-col> </el-col>
</el-row> </el-row>
<drawPoint ref="drawPointRef" :algorithmManage="algorithmManage" /> <template v-if="algorithmManage.visible.value">
<drawPoint
ref="drawPointRef"
:algorithmManage="algorithmManage"
:areaManger="areaManger"
/>
</template>
<el-dialog <el-dialog
title="新增区域" title="新增区域"
v-model="areaManger.visible.value" v-model="areaManger.visible.value"
...@@ -185,7 +196,6 @@ ...@@ -185,7 +196,6 @@
:props="{ children: 'children', value: 'id', checkStrictly: true }" :props="{ children: 'children', value: 'id', checkStrictly: true }"
placeholder="请选择上级区域" placeholder="请选择上级区域"
clearable clearable
@change="handleChange"
/> />
</el-form-item> </el-form-item>
<el-form-item label="区域名称" prop="regionName"> <el-form-item label="区域名称" prop="regionName">
...@@ -362,7 +372,7 @@ const areaManger = useIndex( ...@@ -362,7 +372,7 @@ const areaManger = useIndex(
(data) => { (data) => {
algorithmManage.form.value.regionalId = data[0].id; algorithmManage.form.value.regionalId = data[0].id;
algorithmManage.search.value.regionalId = data[0].id; algorithmManage.search.value.regionalId = data[0].id;
algorithmManage.getList() algorithmManage.getList();
} }
); );
...@@ -375,7 +385,7 @@ const algorithmManage = useIndex( ...@@ -375,7 +385,7 @@ const algorithmManage = useIndex(
detail: "/yunshou/aiRegionalLocation/", detail: "/yunshou/aiRegionalLocation/",
}, },
({ data }) => {}, ({ data }) => {},
()=>{}, () => {},
false false
); );
function submitAreaForm(e) { function submitAreaForm(e) {
...@@ -392,21 +402,22 @@ function submitAreaForm(e) { ...@@ -392,21 +402,22 @@ function submitAreaForm(e) {
function handleNodeClick(e) { function handleNodeClick(e) {
algorithmManage.form.value.regionalId = e.id; algorithmManage.form.value.regionalId = e.id;
algorithmManage.search.value.regionalId = e.id; algorithmManage.search.value.regionalId = e.id;
algorithmManage.search.value.status = 0;
areaManger.form.value.id = e.id; areaManger.form.value.id = e.id;
algorithmManage.getList({ regionalId: e.id }); algorithmManage.getList({ regionalId: e.id });
} }
function changeState(data, e) { function changeState(data, e) {
request({ request({
url:'/yunshou/aiRegionalLocation/updateRunningState', url: "/yunshou/aiRegionalLocation/updateRunningState",
method:'POST', method: "POST",
data:{ data: {
id:data.id, id: data.id,
runningState:e runningState: e,
} },
}).then(()=>{ }).then(() => {
algorithmManage.getList({regionalId:data.regionalId}) algorithmManage.getList({ regionalId: data.regionalId });
}) });
} }
</script> </script>
......
...@@ -7,13 +7,31 @@ export const colors = () => { ...@@ -7,13 +7,31 @@ export const colors = () => {
return `rgba(${r},${g},${b},${a})`; return `rgba(${r},${g},${b},${a})`;
}; };
export function drawImage(video) {
export function drawImage(video){
const img = video; const img = video;
const canvas = document.getElementById('canvas'); const canvas = document.getElementById("canvas");
const ctx = canvas.getContext('2d'); const ctx = canvas.getContext("2d");
canvas.width = img.offsetWidth; canvas.width = img.offsetWidth;
canvas.height = img.offsetHeight; canvas.height = img.offsetHeight;
ctx.drawImage(img, 0, 0, canvas.width, canvas.height); // 绘制图片 ctx.drawImage(img, 0, 0, canvas.width, canvas.height); // 绘制图片
return canvas.toDataURL("image/jpg") return canvas.toDataURL("image/jpg");
} }
\ No newline at end of file
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 }) => { ...@@ -31,7 +31,8 @@ export default defineConfig(({ mode, command }) => {
proxy: { proxy: {
// https://cn.vitejs.dev/config/#server-proxy // https://cn.vitejs.dev/config/#server-proxy
'/dev-api': { '/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', // target:'http://192.168.14.43:8111/ai',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '') 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