Browse Source

‘部分功能开发代码’

pull/1/head
ljlong_2630 1 year ago
parent
commit
ea8c891f8b
  1. 53
      src/api/model/devicemodel.js
  2. 54
      src/api/model/modelType.js
  3. 53
      src/api/model/modelparamrela.js
  4. 22
      src/assets/styles/self-defined.scss
  5. 6
      src/router/index.js
  6. 129
      src/views/model/devicemodel/addmodel.vue
  7. 300
      src/views/model/devicemodel/index.vue
  8. 269
      src/views/model/modelType/index.vue
  9. 269
      src/views/model/modelparamrela/index.vue

53
src/api/model/devicemodel.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询设备模型信息列表
export function listDevicemodel(query) {
return request({
url: '/model/dcModelDevice/list',
method: 'get',
params: query
})
}
// 查询设备模型信息详细
export function getDevicemodel(id) {
return request({
url: '/model/dcModelDevice/' + id,
method: 'get'
})
}
// 新增设备模型信息
export function addDevicemodel(data) {
return request({
url: '/model/dcModelDevice',
method: 'post',
data: data
})
}
// 修改设备模型信息
export function updateDevicemodel(data) {
return request({
url: '/model/dcModelDevice',
method: 'put',
data: data
})
}
// 删除设备模型信息
export function delDevicemodel(id) {
return request({
url: '/model/dcModelDevice/' + id,
method: 'delete'
})
}
// 导出设备模型信息
export function exportDevicemodel(query) {
return request({
url: '/${baseUrl}/export',
method: 'get',
params: query
})
}

54
src/api/model/modelType.js

@ -0,0 +1,54 @@
import request from '@/utils/request'
// 查询设备模型类别列表
export function listModelType(query) {
console.log("-------------"+query);
return request({
url: '/model/dcModelType/list',
method: 'get',
params: query
})
}
// 查询设备模型类别详细
export function getModelType(id) {
return request({
url: '/model/dcModelType/' + id,
method: 'get'
})
}
// 新增设备模型类别
export function addModelType(data) {
return request({
url: '/model/dcModelType',
method: 'post',
data: data
})
}
// 修改设备模型类别
export function updateModelType(data) {
return request({
url: '/model/dcModelType',
method: 'put',
data: data
})
}
// 删除设备模型类别
export function delModelType(id) {
return request({
url: '/model/dcModelType/' + id,
method: 'delete'
})
}
// 导出设备模型类别
export function exportModelType(query) {
return request({
url: '/${baseUrl}/export',
method: 'get',
params: query
})
}

53
src/api/model/modelparamrela.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询设备模型参数明细列表
export function listModelparamrela(query) {
return request({
url: '/model/dcModelDeviceParam/list',
method: 'get',
params: query
})
}
// 查询设备模型参数明细详细
export function getModelparamrela(id) {
return request({
url: '/model/dcModelDeviceParam/' + id,
method: 'get'
})
}
// 新增设备模型参数明细
export function addModelparamrela(data) {
return request({
url: '/model/dcModelDeviceParam',
method: 'post',
data: data
})
}
// 修改设备模型参数明细
export function updateModelparamrela(data) {
return request({
url: '/model/dcModelDeviceParam',
method: 'put',
data: data
})
}
// 删除设备模型参数明细
export function delModelparamrela(id) {
return request({
url: '/model/dcModelDeviceParam/' + id,
method: 'delete'
})
}
// 导出设备模型参数明细
export function exportModelparamrela(query) {
return request({
url: '/${baseUrl}/export',
method: 'get',
params: query
})
}

22
src/assets/styles/self-defined.scss

@ -0,0 +1,22 @@
@import './variables.module.scss';
@import './mixin.scss';
@import './transition.scss';
@import './element-ui.scss';
@import './sidebar.scss';
@import './btn.scss';
@import './ruoyi.scss';
.newLineCenter{
width: 100%;
display: block;
text-align: center;
div{
display: block;
}
}
.leftmargin100px{
margin-left: 100px;
}

6
src/router/index.js

@ -167,6 +167,12 @@ export const constantRoutes = [
}
]
},
{
path: '/devicemodel/addmodel',
component: () => import('@/views/model/devicemodel/addmodel'),
name: 'newdevicemodel',
meta: { title: '新增设备模型', icon: '' }
},
]
// 动态路由,基于用户权限动态去加载

129
src/views/model/devicemodel/addmodel.vue

@ -0,0 +1,129 @@
<template>
<div class="app-container">
<!-- 添加或修改设备模型信息对话框 -->
<template>
<el-steps :space="200" :active="1" simple>
<el-step title="Step 1" :icon="Edit" />
<el-step title="Step 2" :icon="UploadFilled" />
<el-step title="Step 3" :icon="Picture" />
</el-steps>
<el-steps :active="1" finish-status="success" simple style="margin-top: 20px">
<el-step title="Step 1" />
<el-step title="Step 2" />
<el-step title="Step 3" />
</el-steps>
</template>
<el-form ref="devicemodelRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="模型名称" prop="modelName">
<el-input v-model="form.modelName" placeholder="请输入模型名称" />
</el-form-item>
<el-form-item label="模型编码" prop="modelCode">
<el-input v-model="form.modelCode" placeholder="请输入模型编码" />
</el-form-item>
<el-form-item label="排序;排序" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序;排序" />
</el-form-item>
<el-form-item label="上级id;上级id" prop="pid">
<el-tree-select
v-model="form.pid"
:data="devicemodelOptions"
:props="{ value: 'id', label: 'modelName', children: 'children' }"
value-key="id"
placeholder="请选择上级id;上级id"
check-strictly
/>
</el-form-item>
<el-form-item label="备注" prop="note">
<el-input v-model="form.note" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</el-form-item>
</el-form>
</div>
</template>
<script setup name="newdevicemodel">
import { addDevicemodel, updateDevicemodel } from "@/api/model/devicemodel";
import { Edit, Picture, UploadFilled } from '@element-plus/icons-vue'
const { proxy } = getCurrentInstance();
const router = useRouter();
const devicemodelOptions = ref([]);
const open = ref(false);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
modelName: null,
modelCode: null,
sort: null,
modelTypeId: null,
pid: null,
note: null
},
rules: {
modelTypeId: [
{ required: true, message: "模型类别Id不能为空", trigger: "change" }
],
}
});
const { queryParams, form, rules } = toRefs(data);
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
tentantId: null,
version: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
userId: null,
deleteBy: null,
deleteTime: null,
id: null,
modelName: null,
modelCode: null,
sort: null,
modelTypeId: null,
pid: null,
note: null
};
proxy.resetForm("devicemodelRef");
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["devicemodelRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateDevicemodel(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
router.go(-1);
});
} else {
addDevicemodel(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
router.go(-1);
});
}
}
});
}
</script>

300
src/views/model/devicemodel/index.vue

@ -0,0 +1,300 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="模型名称" prop="modelName">
<el-input
v-model="queryParams.modelName"
placeholder="请输入模型名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="模型编码" prop="modelCode">
<el-input
v-model="queryParams.modelCode"
placeholder="请输入模型编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="排序;排序" prop="sort">
<el-input
v-model="queryParams.sort"
placeholder="请输入排序;排序"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="上级id;上级id" prop="pid">
<el-input
v-model="queryParams.pid"
placeholder="请输入上级id;上级id"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['model:devicemodel:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="Sort"
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-if="refreshTable"
v-loading="loading"
:data="devicemodelList"
row-key="id"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="模型名称" align="center" prop="modelName" />
<el-table-column label="模型编码" align="center" prop="modelCode" />
<el-table-column label="排序;排序" align="center" prop="sort" />
<el-table-column label="模型类别Id" align="center" prop="modelTypeId" />
<el-table-column label="上级id;上级id" align="center" prop="pid" />
<el-table-column label="备注" align="center" prop="note" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button
type="text"
icon="Edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['model:devicemodel:edit']"
>修改</el-button>
<el-button
type="text"
icon="Plus"
@click="handleAdd(scope.row)"
v-hasPermi="['model:devicemodel:add']"
>新增</el-button>
<el-button
type="text"
icon="Delete"
@click="handleDelete(scope.row)"
v-hasPermi="['model:devicemodel:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改设备模型信息对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="devicemodelRef" :model="form" :rules="rules" label-width="80px">
<el-form-item label="模型名称" prop="modelName">
<el-input v-model="form.modelName" placeholder="请输入模型名称" />
</el-form-item>
<el-form-item label="模型编码" prop="modelCode">
<el-input v-model="form.modelCode" placeholder="请输入模型编码" />
</el-form-item>
<el-form-item label="排序;排序" prop="sort">
<el-input v-model="form.sort" placeholder="请输入排序;排序" />
</el-form-item>
<el-form-item label="上级id;上级id" prop="pid">
<el-tree-select
v-model="form.pid"
:data="devicemodelOptions"
:props="{ value: 'id', label: 'modelName', children: 'children' }"
value-key="id"
placeholder="请选择上级id;上级id"
check-strictly
/>
</el-form-item>
<el-form-item label="备注" prop="note">
<el-input v-model="form.note" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Devicemodel">
import { listDevicemodel, getDevicemodel, delDevicemodel, addDevicemodel, updateDevicemodel } from "@/api/model/devicemodel";
const { proxy } = getCurrentInstance();
const router = useRouter();
const devicemodelList = ref([]);
const devicemodelOptions = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const title = ref("");
const isExpandAll = ref(true);
const refreshTable = ref(true);
const data = reactive({
form: {},
queryParams: {
modelName: null,
modelCode: null,
sort: null,
modelTypeId: null,
pid: null,
note: null
},
rules: {
modelTypeId: [
{ required: true, message: "模型类别Id不能为空", trigger: "change" }
],
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询设备模型信息列表 */
function getList() {
loading.value = true;
listDevicemodel(queryParams.value).then(response => {
devicemodelList.value = proxy.handleTree(response.data, "id", "pid");
loading.value = false;
});
}
/** 查询设备模型信息下拉树结构 */
function getTreeselect() {
listDevicemodel().then(response => {
devicemodelOptions.value = [];
const data = { id: 0, modelName: '顶级节点', children: [] };
data.children = proxy.handleTree(response.data, "id", "pid");
devicemodelOptions.value.push(data);
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
tentantId: null,
version: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
userId: null,
deleteBy: null,
deleteTime: null,
id: null,
modelName: null,
modelCode: null,
sort: null,
modelTypeId: null,
pid: null,
note: null
};
proxy.resetForm("devicemodelRef");
}
/** 搜索按钮操作 */
function handleQuery() {
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 新增按钮操作 */
function handleAdd(row) {
const path = "/devicemodel/addmodel"
reset();
getTreeselect();
if (row != null && row.id) {
form.value.pid = row.id;
} else {
form.value.pid = 0;
}
router.push(path);
// open.value = true;
// title.value = "";
}
/** 展开/折叠操作 */
function toggleExpandAll() {
refreshTable.value = false;
isExpandAll.value = !isExpandAll.value;
nextTick(() => {
refreshTable.value = true;
});
}
/** 修改按钮操作 */
async function handleUpdate(row) {
reset();
await getTreeselect();
if (row != null) {
form.value.pid = row.id;
}
getDevicemodel(row.id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改设备模型信息";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["devicemodelRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateDevicemodel(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
router.go(-1);
});
} else {
addDevicemodel(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
router.go(-1);
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
proxy.$modal.confirm('是否确认删除设备模型信息编号为"' + row.id + '"的数据项?').then(function() {
return delDevicemodel(row.id);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
getList();
</script>

269
src/views/model/modelType/index.vue

@ -0,0 +1,269 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="模型类别名称" prop="modelTypeName">
<el-input
v-model="queryParams.modelTypeName"
placeholder="请输入模型类别名称"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="模型类别编码" prop="modelTypeCode">
<el-input
v-model="queryParams.modelTypeCode"
placeholder="请输入模型类别编码"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item class="newLineCenter">
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
icon="Plus"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="Edit"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<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-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="modelTypeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="模型类别名称" align="center" prop="modelTypeName" />
<el-table-column label="模型类别编码" align="center" prop="modelTypeCode" />
<el-table-column label="备注" align="center" prop="note" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<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>
</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"
/>
<!-- 添加或修改设备模型类别对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="modelTypeRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="模型类别名称" prop="modelTypeName" label-width="100px">
<el-input v-model="form.modelTypeName" placeholder="请输入模型类别名称" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="模型类别编码" prop="modelTypeCode" label-width="100px">
<el-input v-model="form.modelTypeCode" placeholder="请输入模型类别编码" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="note" label-width="100px">
<el-input v-model="form.note" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<style lang="scss">
@import "@/assets/styles/self-defined.scss";
</style>
<script setup name="ModelType">
import { listModelType, getModelType, delModelType, addModelType, updateModelType } from "@/api/model/modelType";
const { proxy } = getCurrentInstance();
const modelTypeList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
tentantId: null,
modelTypeName: null,
modelTypeCode: null,
note: null
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询设备模型类别列表 */
function getList() {
loading.value = true;
listModelType(queryParams.value).then(response => {
modelTypeList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
tentantId: null,
version: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
userId: null,
deleteBy: null,
deleteTime: null,
id: null,
modelTypeName: null,
modelTypeCode: null,
note: null
};
proxy.resetForm("modelTypeRef");
}
/** 搜索按钮操作 */
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
getModelType(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改设备模型类别";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["modelTypeRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateModelType(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addModelType(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 delModelType(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/modelType/export', {
...queryParams.value
}, `modelType_${new Date().getTime()}.xlsx`)
}
getList();
</script>

269
src/views/model/modelparamrela/index.vue

@ -0,0 +1,269 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="100px">
<el-form-item label="参数模型ID" prop="paramModelId">
<el-select v-model="queryParams.paramModelId" placeholder="请选择参数模型ID" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item label="设备模型ID" prop="modelId">
<el-select v-model="queryParams.modelId" placeholder="请选择设备模型ID" clearable>
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button type="info" plain icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="success"
icon="Plus"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
icon="Edit"
@click="handleUpdate"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<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-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="modelparamrelaList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="参数模型ID" align="center" prop="paramModelId" />
<el-table-column label="设备模型ID" align="center" prop="modelId" />
<el-table-column label="备注" align="center" prop="note" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<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>
</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"
/>
<!-- 添加或修改设备模型参数明细对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="modelparamrelaRef" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="参数模型ID" prop="paramModelId">
<el-select v-model="form.paramModelId" placeholder="请选择参数模型ID">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备模型ID" prop="modelId">
<el-select v-model="form.modelId" placeholder="请选择设备模型ID">
<el-option label="请选择字典生成" value="" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="备注" prop="note">
<el-input v-model="form.note" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Modelparamrela">
import { listModelparamrela, getModelparamrela, delModelparamrela, addModelparamrela, updateModelparamrela } from "@/api/model/modelparamrela";
const { proxy } = getCurrentInstance();
const modelparamrelaList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
paramModelId: null,
modelId: null,
note: null
},
rules: {
paramModelId: [
{ required: true, message: "参数模型ID不能为空", trigger: "change" }
],
modelId: [
{ required: true, message: "设备模型ID不能为空", trigger: "change" }
],
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询设备模型参数明细列表 */
function getList() {
loading.value = true;
listModelparamrela(queryParams.value).then(response => {
modelparamrelaList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
//
function cancel() {
open.value = false;
reset();
}
//
function reset() {
form.value = {
tentantId: null,
version: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
deptId: null,
userId: null,
deleteBy: null,
deleteTime: null,
id: null,
paramModelId: null,
modelId: null,
note: null
};
proxy.resetForm("modelparamrelaRef");
}
/** 搜索按钮操作 */
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
getModelparamrela(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改设备模型参数明细";
});
}
/** 提交按钮 */
function submitForm() {
proxy.$refs["modelparamrelaRef"].validate(valid => {
if (valid) {
if (form.value.id != null) {
updateModelparamrela(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addModelparamrela(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 delModelparamrela(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('model/modelparamrela/export', {
...queryParams.value
}, `modelparamrela_${new Date().getTime()}.xlsx`)
}
getList();
</script>
Loading…
Cancel
Save