Commit cb95ecb1 authored by wp song's avatar wp song

完成点位管理

parent 0dbe1947
...@@ -78,6 +78,7 @@ ...@@ -78,6 +78,7 @@
</el-form> </el-form>
</div> </div>
<div class="left-list"> <div class="left-list">
<div class="form-title">算法列表</div>
<el-table <el-table
:data=" :data="
unref(algorithmManage.form).aiRegionalLocationList || unref(algorithmManage.form).aiRegionalLocationList ||
...@@ -232,10 +233,10 @@ function handleDeviceChange(e, index) { ...@@ -232,10 +233,10 @@ function handleDeviceChange(e, index) {
function submit() { function submit() {
let algorithms = []; let algorithms = [];
algorithmManage.form.value.runningState = '0';
if (algorithmManage.form.value.id) { if (algorithmManage.form.value.id) {
algorithms = unref(algorithmManage.form).aiRegionalLocationList; algorithms = unref(algorithmManage.form).aiRegionalLocationList;
} else { } else {
algorithmManage.form.value.runningState = 0;
unref(aiAlgorithm.list).forEach((val) => { unref(aiAlgorithm.list).forEach((val) => {
algorithms.push({ algorithms.push({
algorithmId: val.id, algorithmId: val.id,
......
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) { 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({
...@@ -50,7 +50,7 @@ function useIndex(apis, callback) { ...@@ -50,7 +50,7 @@ function useIndex(apis, callback) {
}); });
}); });
} }
function getList(params) { function getList(params, isFirst) {
request({ request({
url: apis.list, url: apis.list,
method: "get", method: "get",
...@@ -58,6 +58,9 @@ function useIndex(apis, callback) { ...@@ -58,6 +58,9 @@ function useIndex(apis, callback) {
}).then((res) => { }).then((res) => {
list.value = res.data || res.rows; list.value = res.data || res.rows;
page.value.total = res.total; page.value.total = res.total;
if (isFirst) {
listReady && listReady(res.data);
}
}); });
} }
function getDetail(id) { function getDetail(id) {
...@@ -107,8 +110,8 @@ function useIndex(apis, callback) { ...@@ -107,8 +110,8 @@ function useIndex(apis, callback) {
visible.value = false; visible.value = false;
} }
onMounted(() => { onMounted(() => {
if (apis.list) { if (apis.list && immList) {
getList(); getList({}, true);
} }
}); });
...@@ -125,7 +128,10 @@ function useIndex(apis, callback) { ...@@ -125,7 +128,10 @@ function useIndex(apis, callback) {
toSubmit, toSubmit,
getList, getList,
toOpen, toOpen,
search,
}; };
} }
export { useIndex }; export { useIndex };
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
<el-col :xs="0" :sm="2" :md="3" :lg="4"> <el-col :xs="0" :sm="2" :md="3" :lg="4">
<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">
<el-tree <el-tree
...@@ -123,9 +123,10 @@ ...@@ -123,9 +123,10 @@
<!-- }}</el-tag --> <!-- }}</el-tag -->
<!-- > --> <!-- > -->
<el-switch <el-switch
v-model:value="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)"
/> />
</template> </template>
</el-table-column> </el-table-column>
...@@ -356,6 +357,11 @@ const areaManger = useIndex( ...@@ -356,6 +357,11 @@ const areaManger = useIndex(
}, },
({ data }) => { ({ data }) => {
data.parents = data.regionPath.split(",").map((x) => Number(x)); data.parents = data.regionPath.split(",").map((x) => Number(x));
},
(data) => {
algorithmManage.form.value.regionalId = data[0].id;
algorithmManage.search.value.regionalId = data[0].id;
algorithmManage.getList()
} }
); );
...@@ -367,7 +373,9 @@ const algorithmManage = useIndex( ...@@ -367,7 +373,9 @@ const algorithmManage = useIndex(
delete: "/yunshou/aiRegionalLocation/", delete: "/yunshou/aiRegionalLocation/",
detail: "/yunshou/aiRegionalLocation/", detail: "/yunshou/aiRegionalLocation/",
}, },
({ data }) => {} ({ data }) => {},
()=>{},
false
); );
function submitAreaForm(e) { function submitAreaForm(e) {
const { form } = areaManger; const { form } = areaManger;
...@@ -382,9 +390,23 @@ function submitAreaForm(e) { ...@@ -382,9 +390,23 @@ 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;
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) {
request({
url:'/yunshou/aiRegionalLocation/updateRunningState',
method:'POST',
data:{
id:data.id,
runningState:e
}
}).then(()=>{
algorithmManage.getList({regionalId:data.regionalId})
})
}
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
......
...@@ -31,8 +31,8 @@ export default defineConfig(({ mode, command }) => { ...@@ -31,8 +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.4.206: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