1.系统参数配置管理 增删改查
main
liuhr 2 years ago
parent 6cf243d09c
commit 79e58d48bb

@ -94,16 +94,16 @@ module.exports = configure(function (/* ctx */) {
// https: true,
port: 8080,
open: true, // opens browser window automatically
proxy: {
'/api': {
target: 'https://127.0.0.1:7200',
secure: false, //开启代理:在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求
changeOrigin: true,
pathRewrite: {
'^/api': '/', //重写匹配的字段。把/api 转为 /
},
},
},
// proxy: {
// '/api': {
// target: 'http://127.0.0.1:5223',
// secure: false, //开启代理:在本地会创建一个虚拟服务端,然后发送请求的数据,并同时接收请求
// changeOrigin: true,
// pathRewrite: {
// '^/api': '/', //重写匹配的字段。把/api 转为 /
// },
// },
// },
},
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#framework

@ -28,6 +28,16 @@ export function convert<T, R>(
return val1;
}
export function cconvert<T, R>(
val1: Pagination<T>,
val2: Common.cpageResult<R>
): Pagination<T> {
val1.page = val2.currentPage;
val1.rowsPerPage = val2.pageSize;
val1.rowsNumber = val2.totalPages;
return val1;
}
/** ***************** Permission *****************************************************/
export class MenuSearchEntity {
dictType: string;

@ -1,18 +1,28 @@
declare namespace Common {
interface pageResult<T> {
sortBy: string;
descending: boolean;
page: number;
rowsPerPage: number;
rowsNumber: number;
dataList: T[];
}
interface pageResult<T>{
sortBy: string,
descending: boolean,
page: number,
rowsPerPage: number,
rowsNumber: number,
dataList: T[]
interface cpageResult<T> {
currentPage: number;
totalPages: number;
pageSize: number;
totalCount: number;
currentCount: number;
hasPrev: boolean;
hasNext: boolean;
data: T[];
}
interface result<T> {
errorCode: string,
success: boolean,
errorMessage: number,
data: T,
errorCode: string;
success: boolean;
errorMessage: number;
data: T;
}
}

@ -1,4 +1,13 @@
export class SysConfigSearchEntity {
configName!: string;
configKey!: string;
}
export class SysConfigEntity {
id!: string;
configName!: string;
configKey!: string;
configValue!: string;
configType!: string;
remark!: string;
}

@ -1,15 +1,33 @@
import { request } from '../../boot/axios';
import { Pagination } from '../class';
import { SysConfigEntity } from './model/sysConfig';
import { SysConfigSearchEntity, SysConfigEntity } from './model/sysConfig';
const pathName = 'SysConfig/';
class SysConfigApi {
// 获取系统参数设置分页列表 configName: string, configKey: string, page: any, size: any
getPage = (val: Pagination<SysConfigEntity>) => {
return request.get(
`${pathName}GetSysConfigPageList?configName=${val.data.configName}&configKey=${val.data.configKey}&page=${val.page}&size=${val.rowsPerPage}`
);
getPage = (val: Pagination<SysConfigSearchEntity>) => {
let format = `?page=${val.page}&size=${val.rowsPerPage}`;
if (val.data.configName) {
format += `&configName=${val.data.configName}`;
}
if (val.data.configKey) {
format += `&configKey=${val.data.configKey}`;
}
return request.get(`${pathName}GetSysConfigPageList${format}`);
};
// 添加
add = (val: SysConfigEntity) => {
return request.post(`${pathName}AddSysConfig`, val);
};
// 修改
edit = (val: SysConfigEntity) => {
return request.post(`${pathName}UpdateSysConfig`, val);
};
// 删除
delete = (val: any) => {
return request.post(`${pathName}DeleteSysConfig`, val);
};
// // 获取系统配置项
// getControllerItem = () => {
// return request.get(`${pathName}getControllerItem`);

@ -39,20 +39,21 @@ class Request {
// 响应拦截器
this.instance.interceptors.response.use(
(res: AxiosResponse) => {
debugger;
if (res.config.responseType == 'blob') {
return Promise.resolve(res);
}
if (res.data.success) {
if (res.data.errorMessage) {
if (res.data.isSuccess) {
if (res.data.message) {
Notify.create({
progress: true,
type: 'positive',
icon: 'feedback',
position: 'top',
message: res.data.errorMessage
message: res.data.message
});
}
return res.data.data;
return res.data.content;
} else {
if (res.data.errorCode === 'needLogin') {
LocalStorage.remove('token');
@ -73,11 +74,11 @@ class Request {
type: 'negative',
icon: 'feedback',
position: 'top',
message: res.data.errorMessage
? res.data.errorMessage
message: res.data.message
? res.data.message
: '操作错误,请重试或联系管理员!'
});
return Promise.reject(res.data.data);
return Promise.reject(res.data.content);
}
}
},

@ -0,0 +1,118 @@
<template>
<q-dialog v-model="visible">
<q-card class="shadow-24" style="max-width: 40vw">
<q-card-section class="no-padding">
<q-card-actions class="bg-light-blue-10 text-white">
<q-card-actions class="text-h6">{{ addOrEditFormTitle }}</q-card-actions>
<q-space />
<q-btn dense flat round icon="close" @click="clickForm()">
<q-tooltip content-class="bg-amber text-black shadow-4">关闭</q-tooltip>
</q-btn>
</q-card-actions>
</q-card-section>
<q-card-section style="max-width: 40vw" class="scroll">
<q-form ref="myForm">
<div class="row q-col-gutter-md">
<div class="col-xl-6 col-lg-12 col-sm-12">
<q-input class="text-h6" outlined v-model="addOrEditFormData.configName" label="参数名称"
:rules="[(val) => (val && val.length > 0) || '请填写参数名称']" />
</div>
<div class="col-xl-6 col-lg-12 col-sm-12">
<q-input class="text-h6" outlined v-model="addOrEditFormData.configKey" label="参数键名"
:rules="[(val) => (val && val.length > 0) || '请填写参数键名']" />
</div>
<div class="col-xl-6 col-lg-12 col-sm-12">
<q-input class="text-h6" outlined v-model="addOrEditFormData.configValue" label="参数键值"
:rules="[(val) => (val && val.length > 0) || '请填写参数键值']" />
</div>
<div class="col-xl-6 col-lg-12 col-sm-12">
<q-select class="text-h6" outlined v-model="addOrEditFormData.configType"
:options="configTypeList" emit-value map-options label="系统内置"
:rules="[(val) => (val && val.length > 0) || '请选择系统内置']" />
</div>
<div class="col-xl-6 col-lg-12 col-sm-12">
<q-input class="text-h6" outlined v-model="addOrEditFormData.remark" label="备注"
:rules="[(val) => (val && val.length > 0) || '请填写备注']" />
</div>
</div>
</q-form>
</q-card-section>
<q-separator />
<q-card-actions align="right">
<q-btn color="white" text-color="black" style="margin-right: 25px" @click="clickForm()">{{ '' }}</q-btn>
<q-btn color="primary" @click="submitForm()"></q-btn>
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script lang="ts" setup>
import { init } from 'src/Utils/filterUtils';
import { sysConfigApi } from 'src/api/sysConfig/sysConifgApi';
import { SysConfigEntity } from 'src/api/sysConfig/model/sysConfig';
import { ref } from 'vue';
import {
filterFunction,
filterOption,
filterLabel,
filterValue,
} from 'src/Utils/filterUtils';
// const props = defineProps<{
// areaPropertyList: any[];
// warehouseList: any[];
// }>();
const emit = defineEmits(['refresh']);
const configTypeList = ref([
{ label: '是', value: 'Y' },
{ label: '否', value: 'N' },
])
//
const selectVis = ref(false);
const visible = ref(false);
const addOrEditFormTitle = ref('');
init();
const addOrEditFormData = ref(new SysConfigEntity());
const clickForm = (e?: any) => {
if (visible.value) {
addOrEditFormData.value = new SysConfigEntity();
} else {
if (e) {
//class /
addOrEditFormData.value = JSON.parse(JSON.stringify(e)); // ;
addOrEditFormTitle.value = '修改系统参数';
selectVis.value = true;
} else {
addOrEditFormTitle.value = '新增系统参数';
selectVis.value = false;
}
}
visible.value = !visible.value;
};
const myForm = ref();
const submitForm = () => {
myForm.value.validate().then((success: any) => {
if (success) {
if (addOrEditFormData.value.id !== undefined) {
sysConfigApi.edit(addOrEditFormData.value).then(() => {
clickForm();
emit('refresh');
});
} else {
sysConfigApi.add(addOrEditFormData.value).then(() => {
clickForm();
emit('refresh');
});
}
}
});
};
defineExpose({
clickForm,
});
</script>

@ -7,6 +7,11 @@
<!-- 刷新 查询 -->
<div class="col-xl-2 col-lg-2 col-sm-12">
<q-btn-group push glossy>
<q-btn push label="新增" icon="add" @click="addOrEditForm()">
<q-tooltip content-class="bg-amber text-black shadow-4" :offset="[10, 10]"
content-style="font-size: 12px">{{
'新增一条数据' }}</q-tooltip>
</q-btn>
<q-btn push label="刷新" icon="refresh" @click="reFresh()">
<q-tooltip content-class="bg-amber text-black shadow-4" :offset="[10, 10]"
content-style="font-size: 12px">清空所有条件并刷新数据</q-tooltip>
@ -19,35 +24,10 @@
</div>
<!-- 搜索条件 -->
<div class="col-xl-2 col-lg-2 col-sm-12">
<q-input dense label="日期范围" ref="rangDateRef" readonly outlined v-model="rangDateText">
<template v-slot:append>
<q-icon name="event" class="cursor-pointer">
<q-tooltip content-class="bg-amber text-black shadow-4" :offset="[10, 10]"
content-style="font-size: 12px">选择日期范围</q-tooltip>
<q-popup-proxy ref="qDateProxy" transition-show="scale" transition-hide="scale">
<q-date v-model="rangeDate" years-in-month-view landscape range mask="YYYY-MM-DD"
@update:model-value="rangeDateUpdate">
<!-- <div class="row items-center justify-end">
<q-btn v-close-popup label="关闭" color="primary" flat />
</div> -->
<div class="row">
<div class="col-3">
<q-btn v-close-popup label="本月" @click="setCurrMonth" color="orange"
flat />
</div>
<div class="col-3">
<q-btn v-close-popup label="本年" @click="setCurrYear" color="red" flat />
</div>
<div class="col-3"></div>
<div class="col-3">
<q-btn v-close-popup label="关闭" color="primary" flat />
</div>
</div>
</q-date>
</q-popup-proxy>
</q-icon>
</template>
</q-input>
<q-input dense label="参数名称" outlined v-model="pagination.data.configName" />
</div>
<div class="col-xl-2 col-lg-2 col-sm-12">
<q-input dense label="参数键名" outlined v-model="pagination.data.configKey" />
</div>
</div>
</q-card-section>
@ -62,13 +42,26 @@
<q-tr :props="props" class="tr_hover">
<q-td style="font-size: 16px;" key="index" :props="props">{{ props.rowIndex + 1
}}</q-td>
<q-td style="font-size: 16px;" key="name" :props="props">{{ props.row.name }}</q-td>
<q-td style="font-size: 16px;" key="calories" :props="props">{{ props.row.calories
<q-td style="font-size: 16px;" key="configName" :props="props">{{ props.row.configName
}}</q-td>
<q-td style="font-size: 16px;" key="count" :props="props">{{ props.row.count }}</q-td>
<q-td style="font-size: 16px;" key="start" :props="props">{{ props.row.start }}</q-td>
<q-td style="font-size: 16px;" key="end" :props="props">{{ props.row.end }}</q-td>
<q-td style="font-size: 16px;" key="total" :props="props">{{ props.row.total }}</q-td>
<q-td style="font-size: 16px;" key="configKey" :props="props">{{ props.row.configKey
}}</q-td>
<q-td style="font-size: 16px;" key="configValue" :props="props">{{ props.row.configValue
}}</q-td>
<q-td style="font-size: 16px;" key="configType" :props="props">{{ props.row.configType
}}</q-td>
<q-td style="font-size: 16px;" key="remark" :props="props">{{ props.row.remark }}</q-td>
<q-td key="action" :props="props" style="width: 100px">
<q-btn round flat push color="info" icon="edit" @click="addOrEditForm(props.row)">
<q-tooltip content-class="bg-amber text-black shadow-4" :offset="[10, 10]"
content-style="font-size: 12px">编辑这条数据</q-tooltip>
</q-btn>
<q-btn round flat push color="negative" icon="delete"
@click="openDelDialog(props.row)">
<q-tooltip content-class="bg-amber text-black shadow-4" :offset="[10, 10]"
content-style="font-size: 12px">删除这条数据</q-tooltip>
</q-btn>
</q-td>
</q-tr>
</template>
</q-table>
@ -77,17 +70,24 @@
</q-card-section>
</q-card>
</transition>
<!-- 系统参数设置 -->
<addOrEditDialog ref="addOrEdit" @refresh="getPage" />
<!-- 删除弹窗 -->
<customDialog ref="deleteDialogRef" @func="delFunc" />
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { onMounted, ref } from 'vue';
import { Notify, Screen, date } from 'quasar';
import { sysConfigApi } from '../../api/sysConfig/sysConifgApi';
import { SysConfigEntity } from '../../api/sysConfig/model/sysConfig';
import { Pagination, convert } from 'src/api/class';
import { SysConfigSearchEntity } from '../../api/sysConfig/model/sysConfig';
import { Pagination, cconvert } from 'src/api/class';
import customDialog from 'src/components/customDialog.vue';
import addOrEditDialog from 'src/pages/sysConfig/components/addOrEditDialog.vue'
//
const pagination = ref(new Pagination(new SysConfigEntity()));
const pagination = ref(new Pagination(new SysConfigSearchEntity()));
const loading = ref(false);
const rangeDate = ref();
const rangDateText = ref();
@ -103,234 +103,29 @@ const columns = ref([
headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;',
},
{
name: 'name',
name: 'configName',
align: 'center',
label: '设备名称',
field: 'name',
label: '参数名称',
field: 'configName',
headerClasses: 'text-h4 text-weight-bold',
headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;',
},
{ name: 'count', align: 'center', label: '开炉次数', field: 'count', headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;' },
{ name: 'start', align: 'center', label: '总运行时长', field: 'start', headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;' },
{ name: 'end', align: 'center', label: '总报警时长', field: 'end', headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;' },
{ name: 'total', align: 'center', label: '总待机时长', field: 'total', headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;' },
{ name: 'configKey', align: 'center', label: '参数键名', field: 'configKey', headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;' },
{ name: 'configValue', align: 'center', label: '参数键值', field: 'configValue', headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;' },
{ name: 'configType', align: 'center', label: '是否系统内置', field: 'configType', headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;' },
{ name: 'remark', align: 'center', label: '备注', field: 'remark', headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;' },
{ name: 'action', align: 'center', label: '操作', field: 'action', headerStyle: 'background-color: #5186ec;color: white;font-weight: bold;font-size:20px;' }
])
const list = ref([
{
name: '24#|Balzers',
calories: 159,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '25#|Balzers',
calories: 237,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '26#|Balzers',
calories: 262,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '9#|Ionbond',
calories: 305,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '19#|Ionbond',
calories: 356,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '12#|Ionbond',
calories: 375,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '13#|Ionbond',
calories: 392,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '16#|Ionbond',
calories: 408,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '23#|Ionbond',
calories: 452,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '17#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '18#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '20#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '11#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '21#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '15#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '22#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '14#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '3#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '7#|CemeCon',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '5#|CemeCon',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '6#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '4#|CemeCon',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '8#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '2#|CemeCon',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '10#|Balzers',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
},
{
name: '1#|CemeCon',
calories: 518,
count: '12',
start: '89',
end: '102',
total: '500'
}
]);
const list = ref([]);
onMounted(() => {
getPage();
})
const reFresh = () => {
device.value = ''
rangDateText.value = ''
rangeDate.value = ''
pagination.value.data = new SysConfigSearchEntity();
getPage();
};
const onRequest = (props: any) => {
@ -342,61 +137,26 @@ const onRequest = (props: any) => {
const getPage = () => {
sysConfigApi.getPage(pagination.value).then((res: any) => {
list.value = res.dataList;;
convert(pagination.value, res);
list.value = res.data;
cconvert(pagination.value, res);
});
}
const addOrEdit = ref();
const addOrEditForm = (row?: any) => {
addOrEdit.value.clickForm(row);
};
//
const setCurrMonth = () => {
var d = new Date(); //
var monthStart = date.formatDate(new Date(d.getFullYear(), d.getMonth(), 1), 'YYYY-MM-DD'); //
var monthEnd = date.formatDate(new Date(d.getFullYear(), d.getMonth() + 1, 0), 'YYYY-MM-DD'); // 23:59:59
rangDateText.value = `${monthStart} ~ ${monthEnd}`
rangeDate.value = { from: `${monthStart}`, to: `${monthEnd}` }
}
//
const setCurrYear = () => {
var d = new Date(); //
var monthStart = date.formatDate(new Date(d.getFullYear(), 0, 1), 'YYYY-MM-DD'); //
var monthEnd = date.formatDate(new Date(d.getFullYear(), 12, 0), 'YYYY-MM-DD'); // 23:59:59
rangDateText.value = `${monthStart} ~ ${monthEnd}`
rangeDate.value = { from: `${monthStart}`, to: `${monthEnd}` }
}
//
const rangeDateUpdate = (value: any, reason: any, details) => {
if (reason === 'add-range') {
const start = value.from //
const end = value.to //
const diff = date.getDateDiff(new Date(end), new Date(start), 'days') //
// 365
if (diff >= 366) {
Notify.create({
position: 'top',
message: '日期范围不能大于365天',
icon: 'feedback',
color: 'negative',
})
rangDateText.value = ''
return
}
rangDateText.value = start + ' ~ ' + end
}
if (reason === 'add-day') {
Notify.create({
position: 'top',
message: '日期范围不能为同一天!',
icon: 'feedback',
color: 'negative',
})
rangDateText.value = ''
return
}
const deleteDialogRef = ref();
const openDelDialog = (row: any) => {
deleteDialogRef.value.open(row);
}
//
const delFunc = (e: any) => {
sysConfigApi.delete(e.id).then(() => {
getPage();
});
};
</script>
<style scoped>

Loading…
Cancel
Save