From 79e58d48bbf00779cc40fda0d0874972ac6e7c75 Mon Sep 17 00:00:00 2001 From: liuhr Date: Mon, 30 Oct 2023 17:23:53 +0800 Subject: [PATCH] =?UTF-8?q?[FEAT]:=201.=E7=B3=BB=E7=BB=9F=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=85=8D=E7=BD=AE=E7=AE=A1=E7=90=86=20=E5=A2=9E?= =?UTF-8?q?=E5=88=A0=E6=94=B9=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PVDEMCSUI/quasar.config.js | 20 +- PVDEMCSUI/src/api/class.ts | 10 + PVDEMCSUI/src/api/common.d.ts | 32 +- .../src/api/sysConfig/model/sysConfig.ts | 9 + PVDEMCSUI/src/api/sysConfig/sysConifgApi.ts | 28 +- PVDEMCSUI/src/boot/axios.ts | 15 +- .../sysConfig/components/addOrEditDialog.vue | 118 ++++++ PVDEMCSUI/src/pages/sysConfig/index.vue | 378 ++++-------------- 8 files changed, 268 insertions(+), 342 deletions(-) create mode 100644 PVDEMCSUI/src/pages/sysConfig/components/addOrEditDialog.vue diff --git a/PVDEMCSUI/quasar.config.js b/PVDEMCSUI/quasar.config.js index d6d58a4..c464ebf 100644 --- a/PVDEMCSUI/quasar.config.js +++ b/PVDEMCSUI/quasar.config.js @@ -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 diff --git a/PVDEMCSUI/src/api/class.ts b/PVDEMCSUI/src/api/class.ts index 2123111..727d948 100644 --- a/PVDEMCSUI/src/api/class.ts +++ b/PVDEMCSUI/src/api/class.ts @@ -28,6 +28,16 @@ export function convert( return val1; } +export function cconvert( + val1: Pagination, + val2: Common.cpageResult +): Pagination { + val1.page = val2.currentPage; + val1.rowsPerPage = val2.pageSize; + val1.rowsNumber = val2.totalPages; + return val1; +} + /** ***************** Permission *****************************************************/ export class MenuSearchEntity { dictType: string; diff --git a/PVDEMCSUI/src/api/common.d.ts b/PVDEMCSUI/src/api/common.d.ts index de0c58d..b7cb53b 100644 --- a/PVDEMCSUI/src/api/common.d.ts +++ b/PVDEMCSUI/src/api/common.d.ts @@ -1,18 +1,28 @@ declare namespace Common { + interface pageResult { + sortBy: string; + descending: boolean; + page: number; + rowsPerPage: number; + rowsNumber: number; + dataList: T[]; + } - interface pageResult{ - sortBy: string, - descending: boolean, - page: number, - rowsPerPage: number, - rowsNumber: number, - dataList: T[] + interface cpageResult { + currentPage: number; + totalPages: number; + pageSize: number; + totalCount: number; + currentCount: number; + hasPrev: boolean; + hasNext: boolean; + data: T[]; } interface result { - errorCode: string, - success: boolean, - errorMessage: number, - data: T, + errorCode: string; + success: boolean; + errorMessage: number; + data: T; } } diff --git a/PVDEMCSUI/src/api/sysConfig/model/sysConfig.ts b/PVDEMCSUI/src/api/sysConfig/model/sysConfig.ts index 8565a21..fe19121 100644 --- a/PVDEMCSUI/src/api/sysConfig/model/sysConfig.ts +++ b/PVDEMCSUI/src/api/sysConfig/model/sysConfig.ts @@ -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; } diff --git a/PVDEMCSUI/src/api/sysConfig/sysConifgApi.ts b/PVDEMCSUI/src/api/sysConfig/sysConifgApi.ts index f874bdb..918347e 100644 --- a/PVDEMCSUI/src/api/sysConfig/sysConifgApi.ts +++ b/PVDEMCSUI/src/api/sysConfig/sysConifgApi.ts @@ -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) => { - return request.get( - `${pathName}GetSysConfigPageList?configName=${val.data.configName}&configKey=${val.data.configKey}&page=${val.page}&size=${val.rowsPerPage}` - ); + getPage = (val: Pagination) => { + 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`); diff --git a/PVDEMCSUI/src/boot/axios.ts b/PVDEMCSUI/src/boot/axios.ts index aaef60c..d5c71ef 100644 --- a/PVDEMCSUI/src/boot/axios.ts +++ b/PVDEMCSUI/src/boot/axios.ts @@ -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); } } }, diff --git a/PVDEMCSUI/src/pages/sysConfig/components/addOrEditDialog.vue b/PVDEMCSUI/src/pages/sysConfig/components/addOrEditDialog.vue new file mode 100644 index 0000000..18117f8 --- /dev/null +++ b/PVDEMCSUI/src/pages/sysConfig/components/addOrEditDialog.vue @@ -0,0 +1,118 @@ + + \ No newline at end of file diff --git a/PVDEMCSUI/src/pages/sysConfig/index.vue b/PVDEMCSUI/src/pages/sysConfig/index.vue index 516624c..de3150d 100644 --- a/PVDEMCSUI/src/pages/sysConfig/index.vue +++ b/PVDEMCSUI/src/pages/sysConfig/index.vue @@ -7,6 +7,11 @@
+ + {{ + '新增一条数据' }} + 清空所有条件并,刷新数据 @@ -19,35 +24,10 @@
- - - + +
+
+
@@ -62,13 +42,26 @@ {{ props.rowIndex + 1 }} - {{ props.row.name }} - {{ props.row.calories + {{ props.row.configName }} - {{ props.row.count }} - {{ props.row.start }} - {{ props.row.end }} - {{ props.row.total }} + {{ props.row.configKey + }} + {{ props.row.configValue + }} + {{ props.row.configType + }} + {{ props.row.remark }} + + + 编辑这条数据 + + + 删除这条数据 + + @@ -77,17 +70,24 @@ + + + + +