Loading src/api/algorithmList/index.js +7 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ export function detailAlg(id) { }) } // 查询我的算法列表详情 export function detailMyAlg(id) { return request({ url: `/yunshou/userAlgorithm/${id}`, method: 'get', }) } // 新增算法列表 export function addAlg(data) { Loading src/views/algorithmControl/components/form.vue +12 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,12 @@ :key="disc.id" :label="disc.alarmName" :value="disc.id" /> > <span> <el-tag type="success" :style="{backgroundColor: disc.alarmColor,width:'40px'}">{{ }}</el-tag> </span> {{ disc.alarmName }} </el-option> </el-select> </el-form-item> </el-col> Loading Loading @@ -174,7 +179,12 @@ :key="disc.id" :label="disc.alarmName" :value="disc.id" /> > <span> <el-tag type="success" :style="{backgroundColor: disc.alarmColor,width:'40px'}">{{ }}</el-tag> </span> {{ disc.alarmName }} </el-option> </el-select> </el-form-item> </el-col> Loading src/views/algorithmList/components/form.vue +53 −40 Original line number Diff line number Diff line Loading @@ -7,38 +7,33 @@ > <el-form ref="algRef" :model="form" :rules="rules" label-width="80px"> <el-row> <el-col :span="12"> <el-col :span="24"> <el-form-item label="算法名称" prop="algorithmName"> <el-input v-model="form.algorithmName" placeholder="请输入岗位名称" /> <el-input v-model="form.algorithmName" placeholder="请输入岗位名称" disabled/> </el-form-item> </el-col> <el-col :span="12"> <el-col :span="24"> <el-form-item label="算法英文" prop="algorithmEnglish"> <el-input v-model="form.algorithmEnglish" placeholder="请输入编码名称" /> <el-input v-model="form.algorithmEnglish" placeholder="请输入编码名称" disabled/> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="硬件平台" prop="algorithmPlat"> <el-input v-model="form.algorithmPlat" placeholder="请输入编码名称" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="告警等级" prop="alarmLevel"> <el-input v-model="form.alarmLevel" placeholder="请输入告警等级" /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="卡片文案" prop="cardCopywriting"> <el-input v-model="form.cardCopywriting" type="textarea" :rows="8" placeholder="请输入内容" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="卡片图片" prop="status"> <ImageUpload :modelValue="form.cardImg" :limit='1' :fileSize="5" @update:modelValue="getImageUrl"/> <el-col :span="24"> <el-form-item label="预警等级" prop="alarmLevel"> <el-select v-model="form.alarmLevel" placeholder="请选择预警等级" clearable > <el-option v-for="disc in levelList" :key="disc.id" :label="disc.alarmName" :value="disc.id" > <span> <el-tag type="success" :style="{backgroundColor: disc.alarmColor,width:'40px'}">{{ }}</el-tag> </span> {{ disc.alarmName }} </el-option> </el-select> </el-form-item> </el-col> </el-row> Loading @@ -53,20 +48,29 @@ </template> <script setup> import { addAlg, updateAlg , detailAlg} from "@/api/algorithmList/index.js"; import { addAlg, updateMyAlg , detailAlg,detailMyAlg} from "@/api/algorithmList/index.js"; import { listAlgLevel} from "@/api/algorithmList/algorithmDown.js"; const { proxy } = getCurrentInstance(); const emit = defineEmits(); const open = ref(false); const title = ref(""); const levelList = ref([]); const ids = ref([]); const data = reactive({ form: {}, form: { id: '', algorithmEnglish: '', algorithmName: '', algorithmPlat: 0, status: "0", remark: '' }, queryParams: { pageNum: 1, pageSize: 10, algorithmEnglish: undefined, algorithmName: undefined, status: undefined algorithmEnglish: '', algorithmName: '', status: '' }, rules: { algorithmName: [{ required: true, message: "算法名称不能为空", trigger: "blur" }], Loading @@ -85,16 +89,23 @@ console.log("🚀 ~ getImageUrl ~ orm.cardImg:", form) /** 表单重置 */ function reset() { form.value = { id: undefined, algorithmEnglish: undefined, algorithmName: undefined, id: '', algorithmEnglish: '', algorithmName: '', algorithmPlat: 0, status: "0", remark: undefined remark: '' }; proxy.resetForm("algRef"); } /** 查询预警等级列表 */ function getLevelList() { listAlgLevel().then(response => { levelList.value = response.rows; }); } getLevelList() /** 新增按钮操作 */ function handleAdd() { Loading @@ -105,12 +116,14 @@ function handleAdd() { /** 修改按钮操作 */ function handleUpdate(row) { reset(); const id = row.id || ids.value; detailAlg(id).then(response => { console.log("🚀 ~ handleUpdate ~ row:", row) const id = row.userAlgorithmId || ids.value; detailMyAlg(id).then(response => { form.value = response.data; form.value.algorithmName = row.algorithmName; form.value.algorithmEnglish = row.algorithmEnglish; open.value = true; title.value = "修改算法"; title.value = "修改我的算法"; }); } Loading @@ -119,7 +132,7 @@ function submitForm() { proxy.$refs["algRef"].validate(valid => { if (valid) { if (form.value.id != undefined) { updateAlg(form.value).then(response => { updateMyAlg(form.value).then(response => { proxy.$modal.msgSuccess("修改成功"); open.value = false; emit("getList"); Loading src/views/algorithmList/index.vue +23 −9 Original line number Diff line number Diff line Loading @@ -27,12 +27,12 @@ default-active="2" class="el-menu-vertical-demo" > <el-menu-item :index="'我的算法'" @click="getMyList"> <el-menu-item :index="'我的算法'" @click="handMyMenuClick"> <span><el-icon style="color: #7F8184;"><component :is="'HomeFilled'" /></el-icon>我的算法</span> </el-menu-item> <el-divider style="margin: 5px 0;"/> <el-menu-item :index="''" @click="handMenuClick"> <span> <el-icon style="color: #7F8184;"><component :is="'DeleteFilled'" /></el-icon>全部</span> <span> <el-icon style="color: #7F8184;"><component :is="'Menu'" /></el-icon>全部算法</span> </el-menu-item> <el-menu-item v-for="item in algorithm_scen" :key="item.value" :index="item.value" @click="handMenuClick"> <span style="display: flex;align-items: center;"> Loading Loading @@ -116,9 +116,10 @@ > {{ item.cardCopywriting }} </div> <div style="display: flex;justify-content: flex-end;position: absolute;right: 15px;bottom: 10px;" > <el-button link type="primary" icon="Bottom" @click.stop="handleUpdate(item)" v-if="!listState">添加</el-button> <el-button link type="primary" icon="Edit" @click.stop="handleEnable(item)" v-if="listState">{{item.algorithmStatus=='0'?'停用':'启用' }}</el-button> <div style="display: flex;justify-content: flex-end;position: absolute;right: 15px;bottom: 5px;" > <el-button link type="primary" :icon="item.status=='0'?'Bottom':'Check'" @click.stop="handleUpdate(item)" v-if="!listState">{{item.status=='0'?'添加':'已添加'}}</el-button> <el-button link type="primary" icon="Open" @click.stop="handleEnable(item)" v-if="listState">{{item.algorithmStatus=='0'?'停用':'启用' }}</el-button> <el-button link type="primary" icon="Edit" @click.stop="handlUpdateMyAlg(item)" v-if="listState">{{'编辑'}}</el-button> <el-button link type="primary" icon="Delete" @click.stop="handleDelete(item)" v-if="listState">删除</el-button> <!-- <el-dropdown trigger="click" @command.stop="handleSetSize"> <el-button link type="primary"> Loading Loading @@ -148,13 +149,14 @@ </el-col> </el-row> <algorithmDown ref="algorithmDownRef" /> <algForm ref="algFormRef" /> </div> </template> <script setup name="Index"> import { listAlg, listMyAlg ,detailAlg, addMyAlg, updateMyAlgState,deleteMyAlg, deleteAlg,updateAlgState } from "@/api/algorithmList/index.js"; import algorithmDown from './components/algorithmDown.vue' // import algForm from './components/algorithmDown.vue' import algForm from './components/form.vue' const { proxy } = getCurrentInstance(); const { algorithm_scen, sys_job_status } = proxy.useDict("algorithm_scen", "sys_job_status"); import { ArrowDown } from '@element-plus/icons-vue' Loading @@ -162,6 +164,7 @@ const globalScreenHeight = inject('globalScreenHeight'); const router = useRouter(); const algorithmDownRef = ref(null) const algFormRef = ref(null) const nowText=ref('算法管理') const nowTopTitle=ref('算法管理') const listState=ref(false) Loading Loading @@ -217,8 +220,9 @@ getList() } function handleUpdate(row) { addMyAlg({algorithmId:row.id}).then((res) => { if(row.status=='0') addMyAlg({algorithmId:row.id}).then((res) => { proxy.$modal.msgSuccess("添加成功"); getList() console.log("🚀 ~ addMyAlg ~ res:", res) }) // algorithmDownRef.value.handleUpdate(row) Loading @@ -230,13 +234,19 @@ getList() } function handMyMenuClick(row) { queryParams.value.applicationScenarios='' nowTopTitle.value=row.index getMyList() } function iconComponent(row){ if(row){ return row }else{ return 'CirclePlusFilled' } } function handleEnable(row){ Loading @@ -251,6 +261,10 @@ } function handlUpdateMyAlg(row){ algFormRef.value.handleUpdate(row) } /** 删除按钮操作 */ function handleDelete(row) { const id = row.userAlgorithmId || ids.value; Loading Loading @@ -282,7 +296,7 @@ -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 5px 0; margin: 10px 0; } .ellipsis { overflow: hidden; /* 隐藏超出的内容 */ Loading Loading
src/api/algorithmList/index.js +7 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,13 @@ export function detailAlg(id) { }) } // 查询我的算法列表详情 export function detailMyAlg(id) { return request({ url: `/yunshou/userAlgorithm/${id}`, method: 'get', }) } // 新增算法列表 export function addAlg(data) { Loading
src/views/algorithmControl/components/form.vue +12 −2 Original line number Diff line number Diff line Loading @@ -61,7 +61,12 @@ :key="disc.id" :label="disc.alarmName" :value="disc.id" /> > <span> <el-tag type="success" :style="{backgroundColor: disc.alarmColor,width:'40px'}">{{ }}</el-tag> </span> {{ disc.alarmName }} </el-option> </el-select> </el-form-item> </el-col> Loading Loading @@ -174,7 +179,12 @@ :key="disc.id" :label="disc.alarmName" :value="disc.id" /> > <span> <el-tag type="success" :style="{backgroundColor: disc.alarmColor,width:'40px'}">{{ }}</el-tag> </span> {{ disc.alarmName }} </el-option> </el-select> </el-form-item> </el-col> Loading
src/views/algorithmList/components/form.vue +53 −40 Original line number Diff line number Diff line Loading @@ -7,38 +7,33 @@ > <el-form ref="algRef" :model="form" :rules="rules" label-width="80px"> <el-row> <el-col :span="12"> <el-col :span="24"> <el-form-item label="算法名称" prop="algorithmName"> <el-input v-model="form.algorithmName" placeholder="请输入岗位名称" /> <el-input v-model="form.algorithmName" placeholder="请输入岗位名称" disabled/> </el-form-item> </el-col> <el-col :span="12"> <el-col :span="24"> <el-form-item label="算法英文" prop="algorithmEnglish"> <el-input v-model="form.algorithmEnglish" placeholder="请输入编码名称" /> <el-input v-model="form.algorithmEnglish" placeholder="请输入编码名称" disabled/> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="硬件平台" prop="algorithmPlat"> <el-input v-model="form.algorithmPlat" placeholder="请输入编码名称" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="告警等级" prop="alarmLevel"> <el-input v-model="form.alarmLevel" placeholder="请输入告警等级" /> </el-form-item> </el-col> </el-row> <el-row> <el-col :span="12"> <el-form-item label="卡片文案" prop="cardCopywriting"> <el-input v-model="form.cardCopywriting" type="textarea" :rows="8" placeholder="请输入内容" /> </el-form-item> </el-col> <el-col :span="12"> <el-form-item label="卡片图片" prop="status"> <ImageUpload :modelValue="form.cardImg" :limit='1' :fileSize="5" @update:modelValue="getImageUrl"/> <el-col :span="24"> <el-form-item label="预警等级" prop="alarmLevel"> <el-select v-model="form.alarmLevel" placeholder="请选择预警等级" clearable > <el-option v-for="disc in levelList" :key="disc.id" :label="disc.alarmName" :value="disc.id" > <span> <el-tag type="success" :style="{backgroundColor: disc.alarmColor,width:'40px'}">{{ }}</el-tag> </span> {{ disc.alarmName }} </el-option> </el-select> </el-form-item> </el-col> </el-row> Loading @@ -53,20 +48,29 @@ </template> <script setup> import { addAlg, updateAlg , detailAlg} from "@/api/algorithmList/index.js"; import { addAlg, updateMyAlg , detailAlg,detailMyAlg} from "@/api/algorithmList/index.js"; import { listAlgLevel} from "@/api/algorithmList/algorithmDown.js"; const { proxy } = getCurrentInstance(); const emit = defineEmits(); const open = ref(false); const title = ref(""); const levelList = ref([]); const ids = ref([]); const data = reactive({ form: {}, form: { id: '', algorithmEnglish: '', algorithmName: '', algorithmPlat: 0, status: "0", remark: '' }, queryParams: { pageNum: 1, pageSize: 10, algorithmEnglish: undefined, algorithmName: undefined, status: undefined algorithmEnglish: '', algorithmName: '', status: '' }, rules: { algorithmName: [{ required: true, message: "算法名称不能为空", trigger: "blur" }], Loading @@ -85,16 +89,23 @@ console.log("🚀 ~ getImageUrl ~ orm.cardImg:", form) /** 表单重置 */ function reset() { form.value = { id: undefined, algorithmEnglish: undefined, algorithmName: undefined, id: '', algorithmEnglish: '', algorithmName: '', algorithmPlat: 0, status: "0", remark: undefined remark: '' }; proxy.resetForm("algRef"); } /** 查询预警等级列表 */ function getLevelList() { listAlgLevel().then(response => { levelList.value = response.rows; }); } getLevelList() /** 新增按钮操作 */ function handleAdd() { Loading @@ -105,12 +116,14 @@ function handleAdd() { /** 修改按钮操作 */ function handleUpdate(row) { reset(); const id = row.id || ids.value; detailAlg(id).then(response => { console.log("🚀 ~ handleUpdate ~ row:", row) const id = row.userAlgorithmId || ids.value; detailMyAlg(id).then(response => { form.value = response.data; form.value.algorithmName = row.algorithmName; form.value.algorithmEnglish = row.algorithmEnglish; open.value = true; title.value = "修改算法"; title.value = "修改我的算法"; }); } Loading @@ -119,7 +132,7 @@ function submitForm() { proxy.$refs["algRef"].validate(valid => { if (valid) { if (form.value.id != undefined) { updateAlg(form.value).then(response => { updateMyAlg(form.value).then(response => { proxy.$modal.msgSuccess("修改成功"); open.value = false; emit("getList"); Loading
src/views/algorithmList/index.vue +23 −9 Original line number Diff line number Diff line Loading @@ -27,12 +27,12 @@ default-active="2" class="el-menu-vertical-demo" > <el-menu-item :index="'我的算法'" @click="getMyList"> <el-menu-item :index="'我的算法'" @click="handMyMenuClick"> <span><el-icon style="color: #7F8184;"><component :is="'HomeFilled'" /></el-icon>我的算法</span> </el-menu-item> <el-divider style="margin: 5px 0;"/> <el-menu-item :index="''" @click="handMenuClick"> <span> <el-icon style="color: #7F8184;"><component :is="'DeleteFilled'" /></el-icon>全部</span> <span> <el-icon style="color: #7F8184;"><component :is="'Menu'" /></el-icon>全部算法</span> </el-menu-item> <el-menu-item v-for="item in algorithm_scen" :key="item.value" :index="item.value" @click="handMenuClick"> <span style="display: flex;align-items: center;"> Loading Loading @@ -116,9 +116,10 @@ > {{ item.cardCopywriting }} </div> <div style="display: flex;justify-content: flex-end;position: absolute;right: 15px;bottom: 10px;" > <el-button link type="primary" icon="Bottom" @click.stop="handleUpdate(item)" v-if="!listState">添加</el-button> <el-button link type="primary" icon="Edit" @click.stop="handleEnable(item)" v-if="listState">{{item.algorithmStatus=='0'?'停用':'启用' }}</el-button> <div style="display: flex;justify-content: flex-end;position: absolute;right: 15px;bottom: 5px;" > <el-button link type="primary" :icon="item.status=='0'?'Bottom':'Check'" @click.stop="handleUpdate(item)" v-if="!listState">{{item.status=='0'?'添加':'已添加'}}</el-button> <el-button link type="primary" icon="Open" @click.stop="handleEnable(item)" v-if="listState">{{item.algorithmStatus=='0'?'停用':'启用' }}</el-button> <el-button link type="primary" icon="Edit" @click.stop="handlUpdateMyAlg(item)" v-if="listState">{{'编辑'}}</el-button> <el-button link type="primary" icon="Delete" @click.stop="handleDelete(item)" v-if="listState">删除</el-button> <!-- <el-dropdown trigger="click" @command.stop="handleSetSize"> <el-button link type="primary"> Loading Loading @@ -148,13 +149,14 @@ </el-col> </el-row> <algorithmDown ref="algorithmDownRef" /> <algForm ref="algFormRef" /> </div> </template> <script setup name="Index"> import { listAlg, listMyAlg ,detailAlg, addMyAlg, updateMyAlgState,deleteMyAlg, deleteAlg,updateAlgState } from "@/api/algorithmList/index.js"; import algorithmDown from './components/algorithmDown.vue' // import algForm from './components/algorithmDown.vue' import algForm from './components/form.vue' const { proxy } = getCurrentInstance(); const { algorithm_scen, sys_job_status } = proxy.useDict("algorithm_scen", "sys_job_status"); import { ArrowDown } from '@element-plus/icons-vue' Loading @@ -162,6 +164,7 @@ const globalScreenHeight = inject('globalScreenHeight'); const router = useRouter(); const algorithmDownRef = ref(null) const algFormRef = ref(null) const nowText=ref('算法管理') const nowTopTitle=ref('算法管理') const listState=ref(false) Loading Loading @@ -217,8 +220,9 @@ getList() } function handleUpdate(row) { addMyAlg({algorithmId:row.id}).then((res) => { if(row.status=='0') addMyAlg({algorithmId:row.id}).then((res) => { proxy.$modal.msgSuccess("添加成功"); getList() console.log("🚀 ~ addMyAlg ~ res:", res) }) // algorithmDownRef.value.handleUpdate(row) Loading @@ -230,13 +234,19 @@ getList() } function handMyMenuClick(row) { queryParams.value.applicationScenarios='' nowTopTitle.value=row.index getMyList() } function iconComponent(row){ if(row){ return row }else{ return 'CirclePlusFilled' } } function handleEnable(row){ Loading @@ -251,6 +261,10 @@ } function handlUpdateMyAlg(row){ algFormRef.value.handleUpdate(row) } /** 删除按钮操作 */ function handleDelete(row) { const id = row.userAlgorithmId || ids.value; Loading Loading @@ -282,7 +296,7 @@ -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 5px 0; margin: 10px 0; } .ellipsis { overflow: hidden; /* 隐藏超出的内容 */ Loading