| | |
| | | <div class="airspaceManage"> |
| | | <div class="search-box"> |
| | | <el-form :model="params" inline> |
| | | <el-form-item label="类型名称:"> |
| | | <el-input v-model="params.algName" placeholder="请输入空域名称" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="创建人:"> |
| | | <el-input v-model="params.algName" placeholder="请输入空域名称" clearable /> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getList">搜索</el-button> |
| | | <el-button @click="cancelSearch">取消</el-button> |
| | | </el-form-item> |
| | | <div style="display: flex;justify-content: space-between"> |
| | | <div> |
| | | <el-form-item label="类型名称:"> |
| | | <el-input v-model="params.typeName" placeholder="请输入类型名称" clearable /> |
| | | </el-form-item> |
| | | </div> |
| | | <div> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getList">搜索</el-button> |
| | | <el-button @click="cancelSearch">取消</el-button> |
| | | </el-form-item> |
| | | </div> |
| | | </div> |
| | | </el-form> |
| | | <div> |
| | | <el-button type="primary" icon="el-icon-plus" @click="handleAdd">新增类型</el-button> |
| | |
| | | <div class="mange-table"> |
| | | <el-table border :data="tableList" class="custom-header"> |
| | | <el-table-column label="序号" type="index" width="60"></el-table-column> |
| | | <el-table-column prop="model_name" label="类型名称" align="center" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="alg_type" label="创建时间" align="center"></el-table-column> |
| | | <el-table-column prop="alg_type" label="创建人" align="center"></el-table-column> |
| | | <el-table-column prop="type_name" label="类型名称" align="center" show-overflow-tooltip></el-table-column> |
| | | <el-table-column prop="create_time" label="创建时间" align="center"></el-table-column> |
| | | <el-table-column prop="nick_name" label="创建人" align="center"></el-table-column> |
| | | <el-table-column label="操作" width="180" align="center"> |
| | | <template #default="scope"> |
| | | <el-button icon="el-icon-view" type="text" @click="handleDetail(scope.row)">查看</el-button> |
| | | <el-button icon="el-icon-delete" type="text" @click="handleDelete">删除</el-button> |
| | | <!-- <el-button icon="el-icon-view" type="text" @click="handleDetail(scope.row)">查看</el-button> --> |
| | | <el-button icon="el-icon-edit" type="text" @click="handleEdit(scope.row)">编辑</el-button> |
| | | <el-button icon="el-icon-delete" type="text" @click="handleDelete(scope.row)">删除</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | @size-change="handleSizeChange" @current-change="handleCurrentChange" /> |
| | | </div> |
| | | </div> |
| | | <el-dialog class="ztzf-dialog" append-to-body v-model="isShowView" title="查看" |
| | | <!-- <el-dialog class="ztzf-dialog" append-to-body v-model="isShowView" title="查看" |
| | | :width="pxToRem(600)" :close-on-click-modal="false" :destroy-on-close="true"> |
| | | <div class="content"> |
| | | <table class="view-table" border> |
| | |
| | | </tr> |
| | | </table> |
| | | </div> |
| | | </el-dialog> |
| | | <el-dialog class="ztzf-dialog" append-to-body v-model="isShowEditView" title="新增" |
| | | :width="pxToRem(800)" :close-on-click-modal="false" :destroy-on-close="true"> |
| | | </el-dialog> --> |
| | | <el-dialog class="ztzf-dialog" append-to-body v-model="isShowEditView" :title="titleTxt" |
| | | :width="pxToRem(880)" :close-on-click-modal="false" :destroy-on-close="true"> |
| | | <div class="content-edit"> |
| | | <el-form ref="ruleFormRef" :model="editParams" :rules="rules" inline> |
| | | <el-form-item label="空域名称"> |
| | | <el-input v-model="editParams.model_name" /> |
| | | <el-form-item label="类型名称" prop="type_name"> |
| | | <el-input v-model="editParams.type_name" /> |
| | | </el-form-item> |
| | | <div class="btns"> |
| | | <el-button type="primary" @click="submit(ruleFormRef)">确认</el-button> |
| | | <el-button @click="isShowEditView = false">取消</el-button> |
| | | <el-button v-if="titleTxt === '新增'" type="primary" @click="submit(ruleFormRef)"><el-icon><CirclePlus /></el-icon>确认</el-button> |
| | | <el-button v-else type="primary" @click="submit(ruleFormRef)"><el-icon><CircleCheck /></el-icon>修改</el-button> |
| | | <el-button @click="isShowEditView = false"><el-icon><CircleClose /></el-icon>取消</el-button> |
| | | </div> |
| | | </el-form> |
| | | </div> |
| | | </el-dialog> |
| | | </template> |
| | | <script setup> |
| | | import { getAlgorithmManageList, algorithmManageEdit } from '@/api/airspaceManage/airspaceManage'; |
| | | import { getDictionaryByCode } from '@/api/system/dictbiz'; |
| | | import { getAirSpaceTypeList, airSpaceTypeEdit, airSpaceTypeAdd, airSpaceTypeDelete } from '@/api/airspace/airspace'; |
| | | import { ElMessage } from 'element-plus' |
| | | |
| | | const total = ref(0) |
| | | const params = ref({ |
| | | current: 1, |
| | | size: 10, |
| | | algName: '', |
| | | algTypeCode: '', |
| | | typeName: '', |
| | | }); |
| | | |
| | | let titleTxt = ref('新增') |
| | | let tableList = ref([]) |
| | | |
| | | let isShowView = ref(false) |
| | |
| | | |
| | | let isShowEditView = ref(false) |
| | | |
| | | let sfTypes = ref([]) |
| | | const ruleFormRef = ref() |
| | | let editParams = ref({ |
| | | model_name: '', |
| | | alg_type: '', |
| | | qua_rate: '', |
| | | pass_rate: '', |
| | | event_type: '', |
| | | remark: '' |
| | | type_name: '' |
| | | }) |
| | | const rules = reactive({ |
| | | qua_rate: [ |
| | | { required: true, message: '请输入最低准确率', trigger: 'blur' }, |
| | | { |
| | | validator: (rule, value, callback) => { |
| | | if (!/^\d+(\.\d+)?$/.test(value)) { |
| | | callback(new Error('请输入有效的数字(整数或小数)')); |
| | | } else if (parseFloat(value) < 0.4) { |
| | | callback(new Error('最低准确率不能小于0.4')); |
| | | } else if (parseFloat(value) >= parseFloat(editParams.value.pass_rate)) { |
| | | callback(new Error('最低准确率必须小于最高准确率')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | trigger: 'blur' |
| | | } |
| | | ], |
| | | pass_rate: [ |
| | | { required: true, message: '请输入最低准确率', trigger: 'blur' }, |
| | | { |
| | | validator: (rule, value, callback) => { |
| | | if (!/^\d+(\.\d+)?$/.test(value)) { |
| | | callback(new Error('请输入有效的数字(整数或小数)')); |
| | | } else if (parseFloat(value) > 0.8) { |
| | | callback(new Error('最高准确率不能大于0.8')); |
| | | } else { |
| | | callback(); |
| | | } |
| | | }, |
| | | trigger: 'blur' |
| | | } |
| | | ], |
| | | event_type: [ |
| | | type_name: [ |
| | | { |
| | | required: true, |
| | | message: '请选择事件生成类型', |
| | | trigger: 'change', |
| | | message: '请输入空域类型名称', |
| | | trigger: 'blur', |
| | | }, |
| | | ], |
| | | }) |
| | | |
| | | function cancelSearch() { |
| | | params.value = { |
| | | algName: '', |
| | | algTypeCode: '', |
| | | id: '', |
| | | typeName: '', |
| | | } |
| | | params.value.current = 1 |
| | | getList() |
| | | } |
| | | |
| | | function getList() { |
| | | getAlgorithmManageList(params.value).then(res => { |
| | | getAirSpaceTypeList(params.value).then(res => { |
| | | tableList.value = res.data.data.records || [] |
| | | total.value = res.data.data.total || 0 |
| | | }) |
| | | } |
| | | function getSFType() { |
| | | getDictionaryByCode('WORK_ORDER_TYPE').then(res => { |
| | | sfTypes.value = res.data.data.WORK_ORDER_TYPE || [] |
| | | }); |
| | | } |
| | | |
| | | function handleDetail(row) { |
| | | isShowView.value = true |
| | | rowView.value = row |
| | | } |
| | | function handleDelete(row) { |
| | | console.log(row) |
| | | function handleDelete (row) { |
| | | airSpaceTypeDelete(row.id).then(res => { |
| | | ElMessage.success('删除成功') |
| | | getList() |
| | | }) |
| | | } |
| | | function handleAdd(row) { |
| | | function handleAdd() { |
| | | titleTxt.value = '新增' |
| | | editParams.value.type_name = '' |
| | | isShowEditView.value = true |
| | | // editParams.value = { ...row } |
| | | } |
| | | |
| | | function handleEdit(row) { |
| | | titleTxt.value = '编辑' |
| | | isShowEditView.value = true |
| | | editParams.value = { ...row } |
| | | } |
| | | |
| | | function handleSizeChange(val) { |
| | | params.value.size = val |
| | | getList() |
| | | } |
| | | |
| | | function handleCurrentChange(val) { |
| | | params.value.current = val |
| | | getList() |
| | | } |
| | | |
| | | async function submit(formValidate) { |
| | | if (!formValidate) return |
| | | await formValidate.validate((valid, fields) => { |
| | | if (valid) { |
| | | algorithmManageEdit(editParams.value).then(res => { |
| | | isShowEditView.value = false |
| | | getList() |
| | | }) |
| | | if (titleTxt.value === '新增') { |
| | | airSpaceTypeAdd({ type_name: editParams.value.type_name }).then(res => { |
| | | isShowEditView.value = false |
| | | ElMessage.success('新增成功') |
| | | getList() |
| | | }) |
| | | } else { |
| | | airSpaceTypeEdit({ type_name: editParams.value.type_name, id: editParams.value.id } ).then(res => { |
| | | isShowEditView.value = false |
| | | ElMessage.success('操作成功') |
| | | getList() |
| | | }) |
| | | } |
| | | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | onMounted(() => { |
| | | getList() |
| | | getSFType() |
| | | }) |
| | | </script> |
| | | |
| | |
| | | .airspaceManage { |
| | | height: 0; |
| | | flex: 1; |
| | | padding: 20px; |
| | | margin: 0 10px 10px 10px; |
| | | background-color: #ffffff; |
| | | padding: 10px 20px; |
| | | // padding: 10px 20px; |
| | | border-radius: 5px; |
| | | display: flex; |
| | | flex-direction: column; |
| | | .search-box { |
| | | margin-top: 20px; |
| | | height: 80px; |
| | | } |
| | | |
| | |
| | | .content-edit { |
| | | .el-form { |
| | | .el-form-item { |
| | | width: 300px; |
| | | width: 500px; |
| | | :deep(.el-form-item__label) { |
| | | width: 120px; |
| | | width: 220px; |
| | | } |
| | | |
| | | } |
| | | .btns { |
| | | display: flex; |
| | | justify-content: center |
| | | justify-content: flex-end; |
| | | } |
| | | } |
| | | } |