|
|
@ -1,48 +1,35 @@ |
|
|
|
<template> |
|
|
|
<div class="app-container"> |
|
|
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" class="my-custom-form"> |
|
|
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" class="my-custom-form"> |
|
|
|
<el-row> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="参数名称" prop="paramClassName" label-width="auto"> |
|
|
|
<el-input |
|
|
|
v-model="queryParams.paramClassName" |
|
|
|
placeholder="请输入参数名称" |
|
|
|
clearable |
|
|
|
@keyup.enter="handleQuery" |
|
|
|
/> |
|
|
|
<el-input v-model="queryParams.paramClassName" placeholder="请输入参数名称" clearable @keyup.enter="handleQuery" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="参数编码" prop="paramClassCode" label-width="auto"> |
|
|
|
<el-input |
|
|
|
v-model="queryParams.paramClassCode" |
|
|
|
placeholder="请输入参数编码" |
|
|
|
clearable |
|
|
|
@keyup.enter="handleQuery" |
|
|
|
/> |
|
|
|
<el-input v-model="queryParams.paramClassCode" placeholder="请输入参数编码" clearable @keyup.enter="handleQuery" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="类别" prop="classType" label-width="auto"> |
|
|
|
<el-select v-model="queryParams.classType" placeholder="请选择类别" clearable> |
|
|
|
<el-option |
|
|
|
v-for="dict in dc_class_type" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" |
|
|
|
/> |
|
|
|
<el-option v-for="dict in dc_class_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="单位" prop="paramUnit" label-width="auto"> |
|
|
|
<el-select v-model="queryParams.paramUnit" placeholder="请选择单位" clearable> |
|
|
|
<el-option |
|
|
|
v-for="dict in dc_param_uint_type" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" |
|
|
|
/> |
|
|
|
<el-option v-for="dict in dc_param_uint_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="4"> |
|
|
|
<el-form-item label="数据类型" prop="paramType"> |
|
|
|
<el-select v-model="queryParams.paramType" placeholder="请选择数据类型" clearable> |
|
|
|
<el-option v-for="dict in dc_param_value_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
@ -57,119 +44,104 @@ |
|
|
|
|
|
|
|
<el-row :gutter="10" class="mb8"> |
|
|
|
<el-col :span="1.5"> |
|
|
|
<el-button |
|
|
|
type="success" |
|
|
|
icon="Plus" |
|
|
|
@click="handleAdd" |
|
|
|
>新增</el-button> |
|
|
|
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button> |
|
|
|
</el-col> |
|
|
|
<el-col :span="1.5"> |
|
|
|
<el-button |
|
|
|
type="success" |
|
|
|
icon="Delete" |
|
|
|
@click="handleDelete" |
|
|
|
>删除</el-button> |
|
|
|
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button> |
|
|
|
</el-col> |
|
|
|
<el-col :span="1.5"> |
|
|
|
<el-button |
|
|
|
type="warning" |
|
|
|
icon="Download" |
|
|
|
@click="handleExport" |
|
|
|
>导出</el-button> |
|
|
|
<el-button type="warning" icon="Download" @click="handleExport">导出</el-button> |
|
|
|
</el-col> |
|
|
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
|
|
|
</el-row> |
|
|
|
|
|
|
|
<el-table v-loading="loading" :data="paramclassList" @selection-change="handleSelectionChange" :max-height="tableHeight" :border="true" :column-width-draggable="true"> |
|
|
|
<el-table-column type="selection" width="55" align="center" fixed="left"/> |
|
|
|
<el-table v-loading="loading" :data="paramclassList" @selection-change="handleSelectionChange" |
|
|
|
:max-height="tableHeight" :border="true" :column-width-draggable="true"> |
|
|
|
<el-table-column type="selection" width="55" align="center" fixed="left" /> |
|
|
|
<el-table-column label="参数名称" align="center" prop="paramClassName" /> |
|
|
|
<el-table-column label="参数编码" align="center" prop="paramClassCode" /> |
|
|
|
<el-table-column label="数据类型" align="center" prop="paramType"> |
|
|
|
<template #default="scope"> |
|
|
|
<dict-tag :options="dc_param_value_type" :value="scope.row.paramType" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="类别" align="center" prop="classType"> |
|
|
|
<template #default="scope"> |
|
|
|
<dict-tag :options="dc_class_type" :value="scope.row.classType"/> |
|
|
|
<dict-tag :options="dc_class_type" :value="scope.row.classType" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="单位" align="center" prop="paramUnit"> |
|
|
|
<template #default="scope"> |
|
|
|
<dict-tag :options="dc_param_uint_type" :value="scope.row.paramUnit"/> |
|
|
|
<dict-tag :options="dc_param_uint_type" :value="scope.row.paramUnit" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="备注" align="center" prop="note" /> |
|
|
|
<!-- <el-table-column label="主键" align="center" prop="id" /> --> |
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" :width="200" :fixed="fixedColumns?'right':false"> |
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" :width="200" |
|
|
|
:fixed="fixedColumns ? 'right' : false"> |
|
|
|
<template #header> |
|
|
|
<div class="fixed-column-header" style="text-align: center;display: block;" @dblclick="toggleFixedColumns"> |
|
|
|
<span style="text-align: center;display: block;">操作<img style="width:10px;margin-left:5px" v-show="fixedColumns" :src="lock" alt="Image"/></span> |
|
|
|
<div class="fixed-column-header" style="text-align: center;display: block;" @dblclick="toggleFixedColumns"> |
|
|
|
<span style="text-align: center;display: block;">操作<img style="width:10px;margin-left:5px" |
|
|
|
v-show="fixedColumns" :src="lock" alt="Image" /></span> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<template #default="scope"> |
|
|
|
<el-button |
|
|
|
type="text" |
|
|
|
icon="Edit" |
|
|
|
@click="handleUpdate(scope.row)" |
|
|
|
>修改</el-button> |
|
|
|
<el-button |
|
|
|
type="text" |
|
|
|
icon="Delete" |
|
|
|
@click="handleDelete(scope.row)" |
|
|
|
>删除</el-button> |
|
|
|
<el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> |
|
|
|
<el-button type="text" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<pagination |
|
|
|
v-show="total>0" |
|
|
|
:total="total" |
|
|
|
v-model:page="queryParams.pageNum" |
|
|
|
v-model:limit="queryParams.pageSize" |
|
|
|
@pagination="getList" |
|
|
|
class="paddingBothLeftRight" |
|
|
|
/> |
|
|
|
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" |
|
|
|
@pagination="getList" class="paddingBothLeftRight" /> |
|
|
|
|
|
|
|
<!-- 添加或修改参数模型信息对话框 --> |
|
|
|
<el-dialog :title="title" v-model="open" width="500px" append-to-body draggable> |
|
|
|
<el-form ref="paramclassRef" :model="form" :rules="rules" label-width="80px"> |
|
|
|
|
|
|
|
<el-row> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="参数名称" prop="paramClassName"> |
|
|
|
<el-input v-model="form.paramClassName" placeholder="请输入参数名称" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="参数编码" prop="paramClassCode"> |
|
|
|
<el-input v-model="form.paramClassCode" placeholder="请输入参数编码" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="类别" prop="classType"> |
|
|
|
<el-select v-model="form.classType" placeholder="请选择类别"> |
|
|
|
<el-option |
|
|
|
v-for="dict in dc_class_type" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" ></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="单位" prop="paramUnit"> |
|
|
|
<el-select v-model="form.paramUnit" placeholder="请选择单位"> |
|
|
|
<el-option |
|
|
|
v-for="dict in dc_param_uint_type" |
|
|
|
:key="dict.value" |
|
|
|
:label="dict.label" |
|
|
|
:value="dict.value" ></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="备注" prop="note"> |
|
|
|
<el-input v-model="form.note" placeholder="请输入备注" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-row> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="参数名称" prop="paramClassName"> |
|
|
|
<el-input v-model="form.paramClassName" placeholder="请输入参数名称" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="参数编码" prop="paramClassCode"> |
|
|
|
<el-input v-model="form.paramClassCode" placeholder="请输入参数编码" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="数据类型" prop="paramType"> |
|
|
|
<el-select v-model="form.paramType" placeholder="请选择数据类型"> |
|
|
|
<el-option v-for="dict in dc_param_value_type" :key="dict.value" :label="dict.label" |
|
|
|
:value="dict.value"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="类别" prop="classType"> |
|
|
|
<el-select v-model="form.classType" placeholder="请选择类别"> |
|
|
|
<el-option v-for="dict in dc_class_type" :key="dict.value" :label="dict.label" |
|
|
|
:value="dict.value"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="单位" prop="paramUnit"> |
|
|
|
<el-select v-model="form.paramUnit" placeholder="请选择单位"> |
|
|
|
<el-option v-for="dict in dc_param_uint_type" :key="dict.value" :label="dict.label" |
|
|
|
:value="dict.value"></el-option> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item label="备注" prop="note"> |
|
|
|
<el-input v-model="form.note" placeholder="请输入备注" /> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
|
|
|
|
</el-row> |
|
|
|
</el-row> |
|
|
|
</el-form> |
|
|
|
<template #footer> |
|
|
|
<div class="dialog-footer"> |
|
|
@ -180,15 +152,14 @@ |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
<style lang="scss" > |
|
|
|
@import "@/assets/styles/self-defined.scss"; |
|
|
|
<style lang="scss" > @import "@/assets/styles/self-defined.scss"; |
|
|
|
</style> |
|
|
|
<script setup name="Paramclass"> |
|
|
|
import { listParamclass, getParamclass, delParamclass, addParamclass, updateParamclass,listParamclassForRepetition } from "@/api/model/paramclass"; |
|
|
|
import { listParamclass, getParamclass, delParamclass, addParamclass, updateParamclass, listParamclassForRepetition } from "@/api/model/paramclass"; |
|
|
|
import lock from "@/assets/icons/svg/lock.svg"; |
|
|
|
import { ElMessageBox } from 'element-plus'; |
|
|
|
const { proxy } = getCurrentInstance(); |
|
|
|
const { dc_class_type, dc_param_uint_type } = proxy.useDict('dc_class_type', 'dc_param_uint_type'); |
|
|
|
const { dc_class_type, dc_param_uint_type, dc_param_value_type } = proxy.useDict('dc_class_type', 'dc_param_uint_type', 'dc_param_value_type'); |
|
|
|
const paramclassList = ref([]); |
|
|
|
const open = ref(false); |
|
|
|
const loading = ref(true); |
|
|
@ -227,7 +198,7 @@ const data = reactive({ |
|
|
|
{ required: true, message: "参数类型不能为空", trigger: "blur" } |
|
|
|
], |
|
|
|
paramUnit: [ |
|
|
|
{ required: true, message: "单位不能为空", trigger: "blur" } |
|
|
|
{ required: false, message: "单位不能为空", trigger: "blur" } |
|
|
|
], |
|
|
|
} |
|
|
|
}); |
|
|
@ -304,17 +275,17 @@ function handleAdd() { |
|
|
|
function handleUpdate(row) { |
|
|
|
reset(); |
|
|
|
const _id = row.id || ids.value; |
|
|
|
if(_id.length === 0){ |
|
|
|
if (_id.length === 0) { |
|
|
|
ElMessageBox.alert('请选择需要修改的记录', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
center: true, |
|
|
|
}) |
|
|
|
confirmButtonText: '确定', |
|
|
|
center: true, |
|
|
|
}) |
|
|
|
return; |
|
|
|
}else if(_id.length > 1){ |
|
|
|
} else if (_id.length > 1) { |
|
|
|
ElMessageBox.alert('只能选择一条记录进行修改', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
center: true, |
|
|
|
}) |
|
|
|
confirmButtonText: '确定', |
|
|
|
center: true, |
|
|
|
}) |
|
|
|
return; |
|
|
|
} |
|
|
|
getParamclass(_id).then(response => { |
|
|
@ -328,7 +299,7 @@ function handleUpdate(row) { |
|
|
|
function submitForm() { |
|
|
|
proxy.$refs["paramclassRef"].validate(valid => { |
|
|
|
if (valid) { |
|
|
|
const param = {"paramClassCode":form.value.paramClassCode}; |
|
|
|
const param = { "paramClassCode": form.value.paramClassCode }; |
|
|
|
if (form.value.id != null) { |
|
|
|
listParamclassForRepetition(param).then(response => { |
|
|
|
const result = response.data; |
|
|
@ -338,7 +309,7 @@ function submitForm() { |
|
|
|
confirmButtonText: '确定', |
|
|
|
center: true, |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
updateParamclass(form.value).then(response => { |
|
|
|
proxy.$modal.msgSuccess("修改成功"); |
|
|
|
open.value = false; |
|
|
@ -355,7 +326,7 @@ function submitForm() { |
|
|
|
confirmButtonText: '确定', |
|
|
|
center: true, |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
addParamclass(form.value).then(response => { |
|
|
|
proxy.$modal.msgSuccess("新增成功"); |
|
|
|
open.value = false; |
|
|
@ -371,20 +342,20 @@ function submitForm() { |
|
|
|
/** 删除按钮操作 */ |
|
|
|
function handleDelete(row) { |
|
|
|
const _ids = row.id || ids.value; |
|
|
|
if(_ids.length == 0){ |
|
|
|
if (_ids.length == 0) { |
|
|
|
ElMessageBox.alert('请先选择要删除的项', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
center: true, |
|
|
|
}) |
|
|
|
confirmButtonText: '确定', |
|
|
|
center: true, |
|
|
|
}) |
|
|
|
return; |
|
|
|
} |
|
|
|
const _names = row.paramClassName || names.value; |
|
|
|
proxy.$modal.confirm('是否确认删除参数模型名称为"' + _names + '"的数据项?').then(function() { |
|
|
|
proxy.$modal.confirm('是否确认删除参数模型名称为"' + _names + '"的数据项?').then(function () { |
|
|
|
return delParamclass(_ids); |
|
|
|
}).then(() => { |
|
|
|
getList(); |
|
|
|
proxy.$modal.msgSuccess("删除成功"); |
|
|
|
}).catch(() => {}); |
|
|
|
}).catch(() => { }); |
|
|
|
} |
|
|
|
|
|
|
|
/** 导出按钮操作 */ |
|
|
@ -400,7 +371,7 @@ function toggleFixedColumns() { |
|
|
|
fixedColumns.value = !fixedColumns.value; |
|
|
|
} |
|
|
|
|
|
|
|
onMounted(()=>{ |
|
|
|
onMounted(() => { |
|
|
|
calculateTableHeight(); |
|
|
|
window.addEventListener('resize', calculateTableHeight); |
|
|
|
window.onresize = () => { |
|
|
@ -414,14 +385,14 @@ onUnmounted(() => { |
|
|
|
window.removeEventListener('resize', calculateTableHeight); |
|
|
|
}); |
|
|
|
watch( |
|
|
|
[collapseVisible,showSearch], |
|
|
|
[collapseVisible, showSearch], |
|
|
|
() => { |
|
|
|
calculateTableHeight(); |
|
|
|
} |
|
|
|
); |
|
|
|
const calculateTableHeight = () => { |
|
|
|
nextTick(() => { |
|
|
|
const heightForm = proxy.$refs.queryRef?.$el.clientHeight||0; |
|
|
|
const heightForm = proxy.$refs.queryRef?.$el.clientHeight || 0; |
|
|
|
const windowHeight = window.innerHeight; |
|
|
|
const paginationHeight = 60; |
|
|
|
const tableHeaderHeight = 40; |
|
|
|