mirror of https://gitee.com/lmlz_0/dc-ui.git
13 changed files with 1649 additions and 901 deletions
@ -1,253 +1,384 @@ |
|||||
<template> |
<template> |
||||
<div class="app-container"> |
<div class="app-container"> |
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px"> |
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="80px" class="my-custom-form"> |
||||
<el-form-item label="类别" prop="classType"> |
<el-row> |
||||
<el-select v-model="queryParams.classType" placeholder="请选择类别" clearable> |
<el-col :span="4"> |
||||
<el-option v-for="dict in dc_class_type" :key="dict.value" :label="dict.label" :value="dict.value" /> |
<el-form-item label="参数名称" prop="paramClassName"> |
||||
</el-select> |
<el-input |
||||
</el-form-item> |
v-model="queryParams.paramClassName" |
||||
<!-- <el-form-item label="分区" prop="devicePartion"> |
placeholder="请输入参数名称" |
||||
<el-select v-model="queryParams.devicePartion" placeholder="请选择分区" clearable> |
clearable |
||||
<el-option v-for="dict in dc_device_partion" :key="dict.value" :label="dict.label" :value="dict.value" /> |
@keyup.enter="handleQuery" |
||||
</el-select> |
/> |
||||
</el-form-item> --> |
</el-form-item> |
||||
<el-form-item> |
</el-col> |
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
<el-col :span="4"> |
||||
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button> |
<el-form-item label="参数编码" prop="paramClassCode"> |
||||
</el-form-item> |
<el-input |
||||
</el-form> |
v-model="queryParams.paramClassCode" |
||||
|
placeholder="请输入参数编码" |
||||
<el-row :gutter="10" class="mb8"> |
clearable |
||||
<el-col :span="1.5"> |
@keyup.enter="handleQuery" |
||||
<el-button type="success" icon="Plus" @click="handleAdd">新增</el-button> |
/> |
||||
</el-col> |
</el-form-item> |
||||
<el-col :span="1.5"> |
</el-col> |
||||
<el-button type="success" icon="Edit" @click="handleUpdate">修改</el-button> |
<el-col :span="4"> |
||||
</el-col> |
<el-form-item label="类别" prop="classType"> |
||||
<el-col :span="1.5"> |
<el-select v-model="queryParams.classType" placeholder="请选择类别" clearable> |
||||
<el-button type="success" icon="Delete" @click="handleDelete">删除</el-button> |
<el-option |
||||
</el-col> |
v-for="dict in dc_class_type" |
||||
<el-col :span="1.5"> |
:key="dict.value" |
||||
<el-button type="warning" icon="Download" @click="handleExport">导出</el-button> |
:label="dict.label" |
||||
</el-col> |
:value="dict.value" |
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
/> |
||||
</el-row> |
</el-select> |
||||
|
</el-form-item> |
||||
<el-table v-loading="loading" :data="paramclassList" @selection-change="handleSelectionChange"> |
</el-col> |
||||
<el-table-column type="selection" width="55" align="center" /> |
<el-col :span="4"> |
||||
<el-table-column label="ID" align="center" width="55" prop="id" /> |
<el-form-item label="单位" prop="paramUnit"> |
||||
<el-table-column label="参数名称" align="center" prop="paramClassName" /> |
<el-select v-model="queryParams.paramUnit" placeholder="请选择单位" clearable> |
||||
<el-table-column label="参数编码" align="center" prop="paramClassCode" /> |
<el-option |
||||
<el-table-column label="类别" align="center" prop="classType"> |
v-for="dict in dc_param_uint_type" |
||||
<template #default="scope"> |
:key="dict.value" |
||||
<dict-tag :options="dc_class_type" :value="scope.row.classType" /> |
:label="dict.label" |
||||
</template> |
:value="dict.value" |
||||
</el-table-column> |
/> |
||||
<!-- <el-table-column label="分区" align="center" prop="devicePartion"> |
</el-select> |
||||
<template #default="scope"> |
</el-form-item> |
||||
<dict-tag :options="dc_device_partion" :value="scope.row.devicePartion" /> |
</el-col> |
||||
</template> |
<el-col :span="4"> |
||||
</el-table-column> --> |
<el-form-item class="childTextAlignCenter"> |
||||
<el-table-column label="备注" align="center" prop="note" /> |
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> |
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button> |
||||
<template #default="scope"> |
</el-form-item> |
||||
<el-button type="text" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button> |
</el-col> |
||||
<el-button type="text" icon="Delete" @click="handleDelete(scope.row)">删除</el-button> |
</el-row> |
||||
</template> |
|
||||
</el-table-column> |
|
||||
</el-table> |
|
||||
|
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" |
</el-form> |
||||
@pagination="getList" /> |
|
||||
|
<el-row :gutter="10" class="mb8"> |
||||
<!-- 添加或修改参数模型信息对话框 --> |
<el-col :span="1.5"> |
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body> |
<el-button |
||||
<el-form ref="paramclassRef" :model="form" :rules="rules" label-width="80px"> |
type="success" |
||||
|
icon="Plus" |
||||
<el-row> |
@click="handleAdd" |
||||
<el-col :span="24"> |
>新增</el-button> |
||||
<el-form-item label="参数名称" prop="paramClassName"> |
</el-col> |
||||
<el-input v-model="form.paramClassName" placeholder="请输入参数名称" maxlength="30" /> |
<el-col :span="1.5"> |
||||
</el-form-item> |
<el-button |
||||
</el-col> |
type="success" |
||||
<el-col :span="24"> |
icon="Edit" |
||||
<el-form-item label="参数编码" prop="paramClassCode"> |
@click="handleUpdate" |
||||
<el-input v-model="form.paramClassCode" placeholder="请输入参数编码" maxlength="30" /> |
>修改</el-button> |
||||
</el-form-item> |
</el-col> |
||||
</el-col> |
<el-col :span="1.5"> |
||||
<el-col :span="24"> |
<el-button |
||||
<el-form-item label="类别" prop="classType"> |
type="success" |
||||
<el-select v-model="form.classType" placeholder="请选择类别"> |
icon="Delete" |
||||
<el-option v-for="dict in dc_class_type" :key="dict.value" :label="dict.label" |
@click="handleDelete" |
||||
:value="dict.value"></el-option> |
>删除</el-button> |
||||
</el-select> |
</el-col> |
||||
</el-form-item> |
<el-col :span="1.5"> |
||||
</el-col> |
<el-button |
||||
<!-- <el-col :span="24"> |
type="warning" |
||||
<el-form-item label="分区" prop="devicePartion"> |
icon="Download" |
||||
<el-select v-model="form.devicePartion" placeholder="请选择分区"> |
@click="handleExport" |
||||
<el-option v-for="dict in dc_device_partion" :key="dict.value" :label="dict.label" |
>导出</el-button> |
||||
:value="dict.value"></el-option> |
</el-col> |
||||
</el-select> |
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
||||
</el-form-item> |
</el-row> |
||||
</el-col> --> |
|
||||
|
<el-table v-loading="loading" :data="paramclassList" @selection-change="handleSelectionChange" :max-height="tableHeight" :border="true" :column-width-draggable="true"> |
||||
</el-row> |
<el-table-column type="selection" width="55" align="center" fixed="left"/> |
||||
</el-form> |
<el-table-column label="参数名称" align="center" prop="paramClassName" /> |
||||
<template #footer> |
<el-table-column label="参数编码" align="center" prop="paramClassCode" /> |
||||
<div class="dialog-footer"> |
<el-table-column label="类别" align="center" prop="classType"> |
||||
<el-button type="primary" @click="submitForm">确 定</el-button> |
<template #default="scope"> |
||||
<el-button @click="cancel">取 消</el-button> |
<dict-tag :options="dc_class_type" :value="scope.row.classType"/> |
||||
</div> |
</template> |
||||
</template> |
</el-table-column> |
||||
</el-dialog> |
<el-table-column label="单位" align="center" prop="paramUnit"> |
||||
</div> |
<template #default="scope"> |
||||
</template> |
<dict-tag :options="dc_param_uint_type" :value="scope.row.paramUnit"/> |
||||
|
</template> |
||||
<script setup name="Paramclass"> |
</el-table-column> |
||||
import { listParamclass, getParamclass, delParamclass, addParamclass, updateParamclass } from "@/api/model/paramclass"; |
<el-table-column label="备注" align="center" prop="note" /> |
||||
|
<el-table-column label="主键" align="center" prop="id" /> |
||||
const { proxy } = getCurrentInstance(); |
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" :width="200" :fixed="fixedColumns?'right':false"> |
||||
const { dc_class_type, dc_device_partion } = proxy.useDict('dc_class_type', 'dc_device_partion'); |
<template #header> |
||||
|
<div class="fixed-column-header" style="text-align: center;display: block;" @dblclick="toggleFixedColumns"> |
||||
const paramclassList = ref([]); |
<span style="text-align: center;display: block;">操作<img style="width:10px;margin-left:5px" v-show="fixedColumns" :src="lock" alt="Image"/></span> |
||||
const open = ref(false); |
</div> |
||||
const loading = ref(true); |
</template> |
||||
const showSearch = ref(true); |
<template #default="scope"> |
||||
const ids = ref([]); |
<el-button |
||||
const single = ref(true); |
type="text" |
||||
const multiple = ref(true); |
icon="Edit" |
||||
const total = ref(0); |
@click="handleUpdate(scope.row)" |
||||
const title = ref(""); |
>修改</el-button> |
||||
|
<el-button |
||||
const data = reactive({ |
type="text" |
||||
form: {}, |
icon="Delete" |
||||
queryParams: { |
@click="handleDelete(scope.row)" |
||||
pageNum: 1, |
>删除</el-button> |
||||
pageSize: 10, |
</template> |
||||
createBy: null, |
</el-table-column> |
||||
createTime: null, |
</el-table> |
||||
paramClassName: null, |
|
||||
paramClassCode: null, |
<pagination |
||||
classType: null, |
v-show="total>0" |
||||
devicePartion: null, |
:total="total" |
||||
}, |
v-model:page="queryParams.pageNum" |
||||
rules: { |
v-model:limit="queryParams.pageSize" |
||||
} |
@pagination="getList" |
||||
}); |
class="paddingBothLeftRight" |
||||
|
/> |
||||
const { queryParams, form, rules } = toRefs(data); |
|
||||
|
<!-- 添加或修改参数模型信息对话框 --> |
||||
/** 查询参数模型信息列表 */ |
<el-dialog :title="title" v-model="open" width="500px" append-to-body> |
||||
function getList() { |
<el-form ref="paramclassRef" :model="form" :rules="rules" label-width="80px"> |
||||
loading.value = true; |
|
||||
listParamclass(queryParams.value).then(response => { |
<el-row> |
||||
paramclassList.value = response.rows; |
<el-col :span="12"> |
||||
total.value = response.total; |
<el-form-item label="参数名称" prop="paramClassName"> |
||||
loading.value = false; |
<el-input v-model="form.paramClassName" placeholder="请输入参数名称" /> |
||||
}); |
</el-form-item> |
||||
} |
</el-col> |
||||
|
<el-col :span="12"> |
||||
// 取消按钮 |
<el-form-item label="参数编码" prop="paramClassCode"> |
||||
function cancel() { |
<el-input v-model="form.paramClassCode" placeholder="请输入参数编码" /> |
||||
open.value = false; |
</el-form-item> |
||||
reset(); |
</el-col> |
||||
} |
<el-col :span="12"> |
||||
|
<el-form-item label="类别" prop="classType"> |
||||
// 表单重置 |
<el-select v-model="form.classType" placeholder="请选择类别"> |
||||
function reset() { |
<el-option |
||||
form.value = { |
v-for="dict in dc_class_type" |
||||
tentantId: null, |
:key="dict.value" |
||||
revision: null, |
:label="dict.label" |
||||
createBy: null, |
:value="dict.value" ></el-option> |
||||
createTime: null, |
</el-select> |
||||
updatedBy: null, |
</el-form-item> |
||||
updatedTime: null, |
</el-col> |
||||
id: null, |
<el-col :span="12"> |
||||
paramClassName: null, |
<el-form-item label="单位" prop="paramUnit"> |
||||
paramClassCode: null, |
<el-select v-model="form.paramUnit" placeholder="请选择单位"> |
||||
classType: null, |
<el-option |
||||
devicePartion: null, |
v-for="dict in dc_param_uint_type" |
||||
note: null |
:key="dict.value" |
||||
}; |
:label="dict.label" |
||||
proxy.resetForm("paramclassRef"); |
:value="dict.value" ></el-option> |
||||
} |
</el-select> |
||||
|
</el-form-item> |
||||
/** 搜索按钮操作 */ |
</el-col> |
||||
function handleQuery() { |
|
||||
queryParams.value.pageNum = 1; |
</el-row> |
||||
getList(); |
</el-form> |
||||
} |
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
/** 重置按钮操作 */ |
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
function resetQuery() { |
<el-button @click="cancel">取 消</el-button> |
||||
proxy.resetForm("queryRef"); |
</div> |
||||
handleQuery(); |
</template> |
||||
} |
</el-dialog> |
||||
|
</div> |
||||
// 多选框选中数据 |
</template> |
||||
function handleSelectionChange(selection) { |
<style lang="scss" > |
||||
ids.value = selection.map(item => item.id); |
@import "@/assets/styles/self-defined.scss"; |
||||
single.value = selection.length != 1; |
</style> |
||||
multiple.value = !selection.length; |
<script setup name="Paramclass"> |
||||
} |
import { listParamclass, getParamclass, delParamclass, addParamclass, updateParamclass } from "@/api/model/paramclass"; |
||||
|
import lock from "@/assets/icons/svg/lock.svg"; |
||||
/** 新增按钮操作 */ |
const { proxy } = getCurrentInstance(); |
||||
function handleAdd() { |
const { dc_class_type, dc_param_uint_type } = proxy.useDict('dc_class_type', 'dc_param_uint_type'); |
||||
reset(); |
|
||||
open.value = true; |
const paramclassList = ref([]); |
||||
title.value = "添加参数模型信息"; |
const open = ref(false); |
||||
} |
const loading = ref(true); |
||||
|
const showSearch = ref(true); |
||||
/** 修改按钮操作 */ |
const ids = ref([]); |
||||
function handleUpdate(row) { |
const single = ref(true); |
||||
reset(); |
const multiple = ref(true); |
||||
const _id = row.id || ids.value |
const total = ref(0); |
||||
getParamclass(_id).then(response => { |
const title = ref(""); |
||||
form.value = response.data; |
const fixedColumns = ref(false); |
||||
open.value = true; |
const tableHeight = ref("0px"); |
||||
title.value = "修改参数模型信息"; |
const sortItemMap = ref({}); |
||||
}); |
const queryParamFilter = ref({}); |
||||
} |
const sortProps = ref([]); |
||||
|
const collapseVisible = ref(false); |
||||
/** 提交按钮 */ |
const data = reactive({ |
||||
function submitForm() { |
form: {}, |
||||
proxy.$refs["paramclassRef"].validate(valid => { |
queryParams: { |
||||
if (valid) { |
pageNum: 1, |
||||
if (form.value.id != null) { |
pageSize: 10, |
||||
updateParamclass(form.value).then(response => { |
paramClassName: null, |
||||
proxy.$modal.msgSuccess("修改成功"); |
paramClassCode: null, |
||||
open.value = false; |
classType: null, |
||||
getList(); |
paramUnit: null, |
||||
}); |
note: null, |
||||
} else { |
}, |
||||
addParamclass(form.value).then(response => { |
rules: { |
||||
proxy.$modal.msgSuccess("新增成功"); |
} |
||||
open.value = false; |
}); |
||||
getList(); |
|
||||
}); |
const { queryParams, form, rules } = toRefs(data); |
||||
} |
|
||||
} |
/** 查询参数模型信息列表 */ |
||||
}); |
function getList() { |
||||
} |
loading.value = true; |
||||
|
listParamclass(queryParams.value).then(response => { |
||||
/** 删除按钮操作 */ |
paramclassList.value = response.rows; |
||||
function handleDelete(row) { |
total.value = response.total; |
||||
const _ids = row.id || ids.value; |
loading.value = false; |
||||
proxy.$modal.confirm('是否确认删除参数模型信息编号为"' + _ids + '"的数据项?').then(function () { |
}); |
||||
return delParamclass(_ids); |
} |
||||
}).then(() => { |
|
||||
getList(); |
// 取消按钮 |
||||
proxy.$modal.msgSuccess("删除成功"); |
function cancel() { |
||||
}).catch(() => { }); |
open.value = false; |
||||
} |
reset(); |
||||
|
} |
||||
/** 导出按钮操作 */ |
|
||||
function handleExport() { |
// 表单重置 |
||||
proxy.download('system/paramclass/export', { |
function reset() { |
||||
...queryParams.value |
form.value = { |
||||
}, `paramclass_${new Date().getTime()}.xlsx`) |
paramClassName: null, |
||||
} |
paramClassCode: null, |
||||
|
classType: null, |
||||
getList(); |
paramUnit: null, |
||||
</script> |
note: null, |
||||
|
tentantId: null, |
||||
|
version: null, |
||||
|
createBy: null, |
||||
|
createTime: null, |
||||
|
updateBy: null, |
||||
|
updateTime: null, |
||||
|
deptId: null, |
||||
|
userId: null, |
||||
|
deleteBy: null, |
||||
|
deleteTime: null, |
||||
|
id: null |
||||
|
}; |
||||
|
proxy.resetForm("paramclassRef"); |
||||
|
} |
||||
|
|
||||
|
/** 搜索按钮操作 */ |
||||
|
function handleQuery() { |
||||
|
queryParams.value.pageNum = 1; |
||||
|
getList(); |
||||
|
} |
||||
|
|
||||
|
/** 重置按钮操作 */ |
||||
|
function resetQuery() { |
||||
|
proxy.resetForm("queryRef"); |
||||
|
handleQuery(); |
||||
|
} |
||||
|
|
||||
|
// 多选框选中数据 |
||||
|
function handleSelectionChange(selection) { |
||||
|
ids.value = selection.map(item => item.id); |
||||
|
single.value = selection.length != 1; |
||||
|
multiple.value = !selection.length; |
||||
|
} |
||||
|
|
||||
|
/** 新增按钮操作 */ |
||||
|
function handleAdd() { |
||||
|
reset(); |
||||
|
open.value = true; |
||||
|
title.value = "添加参数模型信息"; |
||||
|
} |
||||
|
|
||||
|
/** 修改按钮操作 */ |
||||
|
function handleUpdate(row) { |
||||
|
reset(); |
||||
|
const _id = row.id || ids.value |
||||
|
getParamclass(_id).then(response => { |
||||
|
form.value = response.data; |
||||
|
open.value = true; |
||||
|
title.value = "修改参数模型信息"; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 提交按钮 */ |
||||
|
function submitForm() { |
||||
|
proxy.$refs["paramclassRef"].validate(valid => { |
||||
|
if (valid) { |
||||
|
if (form.value.id != null) { |
||||
|
updateParamclass(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("修改成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} else { |
||||
|
addParamclass(form.value).then(response => { |
||||
|
proxy.$modal.msgSuccess("新增成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
function handleDelete(row) { |
||||
|
const _ids = row.id || ids.value; |
||||
|
proxy.$modal.confirm('是否确认删除参数模型信息编号为"' + _ids + '"的数据项?').then(function() { |
||||
|
return delParamclass(_ids); |
||||
|
}).then(() => { |
||||
|
getList(); |
||||
|
proxy.$modal.msgSuccess("删除成功"); |
||||
|
}).catch(() => {}); |
||||
|
} |
||||
|
|
||||
|
/** 导出按钮操作 */ |
||||
|
function handleExport() { |
||||
|
proxy.download('model/dcModelParamclass/export', { |
||||
|
...queryParams.value |
||||
|
}, `paramclass_${new Date().getTime()}.xlsx`) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
function toggleFixedColumns() { |
||||
|
fixedColumns.value = !fixedColumns.value; |
||||
|
} |
||||
|
|
||||
|
onMounted(()=>{ |
||||
|
calculateTableHeight(); |
||||
|
window.addEventListener('resize', calculateTableHeight); |
||||
|
window.onresize = () => { |
||||
|
return (() => { |
||||
|
calculateTableHeight(); |
||||
|
})() |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
onUnmounted(() => { |
||||
|
window.removeEventListener('resize', calculateTableHeight); |
||||
|
}); |
||||
|
watch( |
||||
|
[collapseVisible,showSearch], |
||||
|
() => { |
||||
|
calculateTableHeight(); |
||||
|
} |
||||
|
); |
||||
|
const calculateTableHeight = () => { |
||||
|
nextTick(() => { |
||||
|
const heightForm = proxy.$refs.queryRef?.$el.clientHeight||0; |
||||
|
const windowHeight = window.innerHeight; |
||||
|
const paginationHeight = 60; |
||||
|
const tableHeaderHeight = 40; |
||||
|
const tableMargin = 20; |
||||
|
const remainingHeight = windowHeight - paginationHeight - tableHeaderHeight - tableMargin - heightForm - 100; |
||||
|
tableHeight.value = remainingHeight + 'px'; |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
getList(); |
||||
|
</script> |
||||
|
Loading…
Reference in new issue