更新基础mes-能源-系统

This commit is contained in:
2024-09-26 14:07:00 +08:00
parent 4b621a6699
commit cee303fd20
28 changed files with 5681 additions and 1070 deletions

View File

@@ -1,38 +1,18 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="字典名称" prop="dictType">
<el-select v-model="queryParams.dictType">
<el-option v-for="item in typeOptions" :key="item.id" :label="item.name" :value="item.type"/>
</el-select>
</el-form-item>
<el-form-item label="字典标签" prop="label">
<el-input v-model="queryParams.label" placeholder="请输入字典标签" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="数据状态" clearable>
<el-option v-for="dict in statusDictDatas" :key="dict.value" :label="dict.label" :value="dict.value"/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:dict:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['system:dict:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dataList" >
<el-table
:header-cell-style="{
background: '#F2F4F9',
color: '#606266',
}"
border
style="width: 100%"
v-loading="loading" :data="dataList" >
<el-table-column label="字典编码" align="center" prop="id" />
<el-table-column label="字典标签" align="center" prop="label" />
<el-table-column label="字典键值" align="center" prop="value" />
@@ -64,7 +44,13 @@
@pagination="getList"/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :visible.sync="open" width="800px" append-to-body class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">{{ title }}</div>
</slot>
</template>
<slot />
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-form-item label="字典类型">
<el-input v-model="form.dictType" :disabled="true" />
@@ -96,8 +82,8 @@
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button class="btnTextStyle" @click="cancel"> </el-button>
<el-button type="primary" class="btnTextStyle" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
@@ -130,8 +116,6 @@ export default {
title: "",
// 是否显示弹出层
open: false,
// 类型数据字典
typeOptions: [],
// 查询参数
queryParams: {
pageNo: 1,
@@ -176,6 +160,60 @@ export default {
}
],
formConfig: [
{
type: 'select',
label: '字典名称',
selectOptions: [],
param: 'dictType',
defaultSelect: '',
valueField: 'type',
labelField: 'name',
filterable: true,
},
{
type: 'input',
label: '字典标签',
placeholder: '字典标签',
param: 'label',
},
{
type: 'select',
label: '状态',
selectOptions: getDictDatas(DICT_TYPE.COMMON_STATUS),
param: 'status',
defaultSelect: '',
valueField: 'value',
labelField: 'label',
filterable: true,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('system:dict:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('system:dict:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
{
type: this.$auth.hasPermi('system:dict:export') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('system:dict:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true,
},
],
// 枚举
CommonStatusEnum: CommonStatusEnum,
// 数据字典
@@ -188,6 +226,19 @@ export default {
this.getTypeList();
},
methods: {
buttonClick(val) {
if (val.btnName === 'search') {
this.queryParams.dictType = val.dictType;
this.queryParams.label = val.label;
this.queryParams.status = val.status;
this.getList();
} else if (val.btnName === 'export'){
this.handleExport()
}
else {
this.handleAdd();
}
},
/** 查询字典类型详细 */
getType(dictId) {
getType(dictId).then(response => {
@@ -199,7 +250,7 @@ export default {
/** 查询字典类型列表 */
getTypeList() {
listAllSimple().then(response => {
this.typeOptions = response.data;
this.formConfig[0].selectOptions = response.data;
});
},
/** 查询字典数据列表 */
@@ -281,7 +332,8 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id;
this.$modal.confirm('是否确认删除字典编码为"' + ids + '"的数据项?').then(function() {
this.$modal
.delConfirm(row.label).then(function() {
return delData(ids);
}).then(() => {
this.getList();
@@ -302,3 +354,36 @@ export default {
}
};
</script>
<style scoped>
.app-container >>> .el-table .el-table__cell {
padding: 0;
height: 35px;
}
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
.dialog >>> .btnTextStyle {
letter-spacing: 6px;
padding: 9px 10px 9px 16px;
font-size: 14px;
}
</style>

View File

@@ -1,40 +1,18 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="字典名称" prop="name">
<el-input v-model="queryParams.name" placeholder="请输入字典名称" clearable style="width: 240px" @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="字典类型" prop="type">
<el-input v-model="queryParams.type" placeholder="请输入字典类型" clearable style="width: 240px" @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="字典状态" clearable style="width: 240px">
<el-option v-for="dict in statusDictDatas" :key="parseInt(dict.value)" :label="dict.label" :value="parseInt(dict.value)"/>
</el-select>
</el-form-item>
<el-form-item label="创建时间" prop="createTime">
<el-date-picker v-model="queryParams.createTime" style="width: 240px" value-format="yyyy-MM-dd HH:mm:ss" type="daterange"
range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="['00:00:00', '23:59:59']" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:dict:create']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
v-hasPermi="['system:dict:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="typeList">
<el-table
:header-cell-style="{
background: '#F2F4F9',
color: '#606266',
}"
border
style="width: 100%"
v-loading="loading" :data="typeList">
<el-table-column label="字典编号" align="center" prop="id" />
<el-table-column label="字典名称" align="center" prop="name" :show-overflow-tooltip="true" />
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true">
@@ -69,7 +47,13 @@
@pagination="getList"/>
<!-- 添加或修改参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-dialog :visible.sync="open" width="800px" append-to-body class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">{{ title }}</div>
</slot>
</template>
<slot />
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="字典名称" prop="name">
<el-input v-model="form.name" placeholder="请输入字典名称" />
@@ -87,8 +71,8 @@
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
<el-button class="btnTextStyle" @click="cancel"> </el-button>
<el-button type="primary" class="btnTextStyle" @click="submitForm"> </el-button>
</div>
</el-dialog>
</div>
@@ -139,6 +123,70 @@ export default {
]
},
formConfig: [
{
type: 'input',
label: '字典名称',
placeholder: '字典名称',
param: 'name',
},
{
type: 'input',
label: '字典类型',
placeholder: '字典类型',
param: 'type',
},
{
type: 'select',
label: '状态',
selectOptions: getDictDatas(DICT_TYPE.COMMON_STATUS),
param: 'status',
defaultSelect: '',
valueField: 'value',
labelField: 'label',
filterable: true,
},
{
type: 'datePicker',
label: '创建时间',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
param: 'createTime',
defaultSelect: [],
defaultTime: ['00:00:00', '23:59:59'],
width: 250,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: this.$auth.hasPermi('system:dict:create') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('system:dict:create') ? 'button' : '',
btnName: '新增',
name: 'add',
color: 'success',
plain: true,
},
{
type: this.$auth.hasPermi('system:dict:export') ? 'separate' : '',
},
{
type: this.$auth.hasPermi('system:dict:export') ? 'button' : '',
btnName: '导出',
name: 'export',
color: 'primary',
plain: true,
},
],
// 枚举
CommonStatusEnum: CommonStatusEnum,
// 数据字典
@@ -149,6 +197,20 @@ export default {
this.getList();
},
methods: {
buttonClick(val) {
if (val.btnName === 'search') {
this.queryParams.name = val.name;
this.queryParams.type = val.type;
this.queryParams.createTime = val.createTime;
this.queryParams.status = val.status;
this.getList();
} else if (val.btnName === 'export'){
this.handleExport()
}
else {
this.handleAdd();
}
},
/** 查询字典类型列表 */
getList() {
this.loading = true;
@@ -224,7 +286,8 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除字典编号为"' + ids + '"的数据项?').then(function() {
this.$modal
.delConfirm(row.name).then(function() {
return delType(ids);
}).then(() => {
this.getList();
@@ -249,3 +312,36 @@ export default {
}
};
</script>
<style scoped>
.app-container >>> .el-table .el-table__cell {
padding: 0;
height: 35px;
}
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
.dialog >>> .btnTextStyle {
letter-spacing: 6px;
padding: 9px 10px 9px 16px;
font-size: 14px;
}
</style>