Commit 539ff970 authored by 胡占生's avatar 胡占生 🇨🇳

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

parents 68a50b0a 7c50bfac
......@@ -78,6 +78,7 @@
</el-form>
</div>
<div class="left-list">
<div class="form-title">算法列表</div>
<el-table
:data="
unref(algorithmManage.form).aiRegionalLocationList ||
......@@ -232,10 +233,10 @@ function handleDeviceChange(e, index) {
function submit() {
let algorithms = [];
algorithmManage.form.value.runningState = '0';
if (algorithmManage.form.value.id) {
algorithms = unref(algorithmManage.form).aiRegionalLocationList;
} else {
algorithmManage.form.value.runningState = 0;
unref(aiAlgorithm.list).forEach((val) => {
algorithms.push({
algorithmId: val.id,
......
import { onMounted, ref, watch } from "vue";
import request from "@/utils/request";
import { ElMessageBox } from "element-plus";
function useIndex(apis, callback) {
function useIndex(apis, callback, listReady, immList = true ) {
const visible = ref(false);
const search = ref({});
const form = ref({
......@@ -50,7 +50,7 @@ function useIndex(apis, callback) {
});
});
}
function getList(params) {
function getList(params, isFirst) {
request({
url: apis.list,
method: "get",
......@@ -58,6 +58,9 @@ function useIndex(apis, callback) {
}).then((res) => {
list.value = res.data || res.rows;
page.value.total = res.total;
if (isFirst) {
listReady && listReady(res.data);
}
});
}
function getDetail(id) {
......@@ -107,8 +110,8 @@ function useIndex(apis, callback) {
visible.value = false;
}
onMounted(() => {
if (apis.list) {
getList();
if (apis.list && immList) {
getList({}, true);
}
});
......@@ -125,7 +128,10 @@ function useIndex(apis, callback) {
toSubmit,
getList,
toOpen,
search,
};
}
export { useIndex };
......@@ -10,13 +10,13 @@
<el-col :xs="0" :sm="2" :md="3" :lg="4">
<el-card class="left-list">
<div class="head-container">
<el-input
v-model="deptName"
placeholder="请输入"
clearable
prefix-icon="Search"
style="margin-bottom: 20px"
/>
<!-- <el-input -->
<!-- v-model="deptName" -->
<!-- placeholder="请输入" -->
<!-- clearable -->
<!-- prefix-icon="Search" -->
<!-- style="margin-bottom: 20px" -->
<!-- /> -->
</div>
<div class="head-container">
<el-tree
......@@ -123,9 +123,10 @@
<!-- }}</el-tag -->
<!-- > -->
<el-switch
v-model:value="scope.row.runningState"
v-model="scope.row.runningState"
active-value="0"
inactive-value="1"
@change="(e)=>changeState(scope.row, e)"
/>
</template>
</el-table-column>
......@@ -356,6 +357,11 @@ const areaManger = useIndex(
},
({ data }) => {
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(
delete: "/yunshou/aiRegionalLocation/",
detail: "/yunshou/aiRegionalLocation/",
},
({ data }) => {}
({ data }) => {},
()=>{},
false
);
function submitAreaForm(e) {
const { form } = areaManger;
......@@ -382,9 +390,23 @@ function submitAreaForm(e) {
}
function handleNodeClick(e) {
algorithmManage.form.value.regionalId = e.id;
algorithmManage.search.value.regionalId = e.id;
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})
})
}
</script>
<style scoped lang="scss">
......
......@@ -31,9 +31,8 @@ export default defineConfig(({ mode, command }) => {
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {
// target: 'http://192.168.14.43:8111/ai',
target: 'http://192.168.4.206:80/ai',
// target:'http://192.168.14.43:8111/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