From 248b518a2bdd74cc216679e8b4b7e060afd6aed8 Mon Sep 17 00:00:00 2001 From: zwq Date: Thu, 5 Jan 2023 16:56:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/scss/common.scss | 63 ++-- src/filters/sys-filter.js | 38 +++ src/icons/svg/tuichu.svg | 1 + src/icons/svg/修改密码.svg | 1 + src/icons/svg/椭圆形.svg | 13 + src/icons/svg/角色.svg | 12 + src/mixins/basic-add.js | 5 +- src/mixins/basic-page.js | 321 ++++++++++-------- src/router/index.js | 5 +- src/store/index.js | 9 +- src/views/main-navbar.vue | 10 +- src/views/main-sidebar-sub-menu.vue | 10 +- src/views/main-sidebar.vue | 17 +- src/views/modules/sys/dept-add-or-update.vue | 19 +- src/views/modules/sys/dept.vue | 134 ++++++-- .../modules/sys/dict-data-add-or-update.vue | 16 +- src/views/modules/sys/dict-data.vue | 194 +++++++---- .../modules/sys/dict-type-add-or-update.vue | 15 +- src/views/modules/sys/dict-type-to.vue | 33 ++ src/views/modules/sys/dict-type.vue | 208 +++++++----- src/views/modules/sys/log-error.vue | 140 +++++--- src/views/modules/sys/log-login.vue | 168 +++++---- src/views/modules/sys/log-operation.vue | 172 ++++++---- src/views/modules/sys/menu-add-or-update.vue | 15 +- src/views/modules/sys/menu.vue | 156 ++++++--- .../modules/sys/params-add-or-update.vue | 22 +- src/views/modules/sys/params.vue | 159 ++++++--- src/views/modules/sys/role-add-or-update.vue | 16 +- src/views/modules/sys/role.vue | 167 +++++---- src/views/modules/sys/user-add-or-update.vue | 19 +- src/views/modules/sys/user.vue | 210 +++++++----- .../spc-basic/components/unitList-add.vue | 85 ----- src/views/spc-basic/query-form.vue | 73 ---- src/views/spc-basic/unitList.vue | 144 -------- vue.config.js | 15 +- 35 files changed, 1552 insertions(+), 1133 deletions(-) create mode 100644 src/filters/sys-filter.js create mode 100644 src/icons/svg/tuichu.svg create mode 100644 src/icons/svg/修改密码.svg create mode 100644 src/icons/svg/椭圆形.svg create mode 100644 src/icons/svg/角色.svg create mode 100644 src/views/modules/sys/dict-type-to.vue delete mode 100644 src/views/spc-basic/components/unitList-add.vue delete mode 100644 src/views/spc-basic/query-form.vue delete mode 100644 src/views/spc-basic/unitList.vue diff --git a/src/assets/scss/common.scss b/src/assets/scss/common.scss index 0f74e96..2596b03 100644 --- a/src/assets/scss/common.scss +++ b/src/assets/scss/common.scss @@ -4,7 +4,8 @@ box-sizing: border-box; } body { - font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif; + font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", + "微软雅黑", Arial, sans-serif; font-size: $--font-size-base; line-height: $base--line-height; color: $--color-text-primary; @@ -80,7 +81,6 @@ img { line-height: $base--line-height !important; } - /* Reset element-ui ------------------------------ */ .aui-wrapper { @@ -110,7 +110,6 @@ img { } } - /* Common ------------------------------ */ // 图标 @@ -161,7 +160,7 @@ img { bottom: 0; z-index: 1010; width: 210px; - transition: right .3s; + transition: right 0.3s; &--open { right: 0; } @@ -197,7 +196,6 @@ img { } } - /* Layout ------------------------------ */ .aui-wrapper { @@ -205,7 +203,6 @@ img { padding-top: $navbar--height; } - /* Sidebar fold ------------------------------ */ .aui-sidebar--fold { @@ -252,7 +249,6 @@ img { } } - /* Navbar ------------------------------ */ .aui-navbar { @@ -265,7 +261,7 @@ img { align-items: stretch; height: $navbar--height; background-color: $--color-primary; - box-shadow: 0 1px 0 0 rgba(0, 0, 0, .05); + box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.05); &--colorful { .aui-navbar__body { } @@ -315,7 +311,7 @@ img { position: relative; width: $sidebar--width; height: $navbar--height; - transition: width .3s; + transition: width 0.3s; } &__brand { background-color: rgba(0, 21, 41, 1); @@ -331,7 +327,7 @@ img { white-space: nowrap; color: #fff; overflow: hidden; - transition: width .3s; + transition: width 0.3s; &-lg, &-mini { max-width: 100%; @@ -402,7 +398,7 @@ img { width: auto; font-size: 12px; margin: 0 0 0 5px; - transition: transform .3s; + transition: transform 0.3s; } } } @@ -422,7 +418,7 @@ img { } &-txt { width: 0; - transition: width .3s, margin-left .3s; + transition: width 0.3s, margin-left 0.3s; &.is-show { width: 210px; margin-left: 8px; @@ -453,7 +449,6 @@ img { } } - /* Sidebar ------------------------------ */ .aui-sidebar { @@ -464,9 +459,9 @@ img { z-index: 1020; width: $sidebar--width; background-color: #fff; - box-shadow: 1px 0 2px 0 rgba(0, 0, 0, .05); + box-shadow: 1px 0 2px 0 rgba(0, 0, 0, 0.05); overflow: hidden; - transition: width .3s; + transition: width 0.3s; &--dark { background-color: $sidebar--background-color-dark; .aui-sidebar__menu, @@ -479,6 +474,10 @@ img { &:hover { color: #fff; background-color: rgba(11, 88, 255, 1); + .aui-sidebar__menu-icon-son{ + background: #fff; + border-radius: 4px; + } } } .el-menu, @@ -499,12 +498,12 @@ img { padding-bottom: 15px; overflow-x: hidden; overflow-y: scroll; - transition: width .3s; + transition: width 0.3s; } &__menu { width: $sidebar--width; border-right: 0; - transition: width .3s; + transition: width 0.3s; .el-menu-item, .el-submenu__title { height: $sidebar--menu-item-height; @@ -519,11 +518,20 @@ img { text-align: center; font-size: 16px; color: inherit !important; - transition: font-size .3s; + transition: font-size 0.3s; + } + &__menu-icon-son { + display: inline-block; + vertical-align: middle; + width: 8px !important; + margin-right: 15px; + text-align: center; + font-size: 8px; + color: inherit !important; + transition: font-size 0.3s; } } - /* Content ------------------------------ */ .aui-content { @@ -535,7 +543,7 @@ img { margin-left: $sidebar--width; min-height: calc(100vh - #{$navbar--height}); background-color: $content--background-color; - transition: margin-left .3s; + transition: margin-left 0.3s; } > .aui-card--fill > .el-card__body { min-height: calc(#{$content--fill-height} - 2px); @@ -574,9 +582,9 @@ img { z-index: 930; padding: 0 55px 0 15px; margin: 0; - box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .05); + box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); background-color: #fff; - transition: left .3s; + transition: left 0.3s; > .el-tabs__nav-wrap { margin-bottom: 0; &:after { @@ -610,7 +618,7 @@ img { position: absolute; bottom: 0; left: 0; - content: ''; + content: ""; width: 100%; height: 2px; background-color: $--color-primary; @@ -622,10 +630,10 @@ img { line-height: 24px; border-radius: 5px; background-color: rgba(239, 239, 239, 1); - &.is-active { - color: rgba(255, 255, 255, 1); - background-color: rgba(62, 142, 247, 1); - } + &.is-active { + color: rgba(255, 255, 255, 1); + background-color: rgba(62, 142, 247, 1); + } } > .el-icon-close { width: 14px; @@ -698,7 +706,6 @@ img { } } - /* Page ------------------------------ */ *[class*="aui-page__"] { diff --git a/src/filters/sys-filter.js b/src/filters/sys-filter.js new file mode 100644 index 0000000..6c6562c --- /dev/null +++ b/src/filters/sys-filter.js @@ -0,0 +1,38 @@ + +/* + * @Date: 2020-12-29 16:49:28 + * @LastEditors: zwq + * @LastEditTime: 2023-01-05 15:49:17 + * @FilePath: \basic-admin\src\filters\basicData\index.js + * @Description: + */ +import i18n from "@/i18n"; + +const table = { + sex: { + '0': '男', + '1': '女' + }, + userStatus: { + '0': i18n.t('user.status0'), + '1': i18n.t('user.status1') + }, + menuType: { + '0': i18n.t('menu.type0'), + '1': i18n.t('menu.type1') + }, + logOperation: { + '0': i18n.t('logLogin.operation0'), + '1': i18n.t('logLogin.operation1') + }, + logStatus: { + '0': i18n.t('logLogin.status0'), + '1': i18n.t('logLogin.status1') + }, +} + +export default function(dictTable) { + return function(val) { + return table?.[dictTable]?.[val] + } +} \ No newline at end of file diff --git a/src/icons/svg/tuichu.svg b/src/icons/svg/tuichu.svg new file mode 100644 index 0000000..6dc8ca1 --- /dev/null +++ b/src/icons/svg/tuichu.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/修改密码.svg b/src/icons/svg/修改密码.svg new file mode 100644 index 0000000..517df29 --- /dev/null +++ b/src/icons/svg/修改密码.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/icons/svg/椭圆形.svg b/src/icons/svg/椭圆形.svg new file mode 100644 index 0000000..1091081 --- /dev/null +++ b/src/icons/svg/椭圆形.svg @@ -0,0 +1,13 @@ + + + 椭圆形 + + + + + + + + + + \ No newline at end of file diff --git a/src/icons/svg/角色.svg b/src/icons/svg/角色.svg new file mode 100644 index 0000000..39fa5d0 --- /dev/null +++ b/src/icons/svg/角色.svg @@ -0,0 +1,12 @@ + + + 角色 + + + + + + + + + \ No newline at end of file diff --git a/src/mixins/basic-add.js b/src/mixins/basic-add.js index af29716..61aa86a 100644 --- a/src/mixins/basic-add.js +++ b/src/mixins/basic-add.js @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2022-08-24 11:19:43 * @LastEditors: zwq - * @LastEditTime: 2022-09-19 14:12:43 + * @LastEditTime: 2023-01-05 10:54:13 * @Description: */ export default { @@ -92,5 +92,8 @@ export default { .catch(() => { }); }); }, + formClear() { + this.$refs.dataForm.resetFields() + } } } \ No newline at end of file diff --git a/src/mixins/basic-page.js b/src/mixins/basic-page.js index eb7ea14..f07b92b 100644 --- a/src/mixins/basic-page.js +++ b/src/mixins/basic-page.js @@ -2,151 +2,192 @@ * @Author: zwq * @Date: 2022-08-24 11:19:43 * @LastEditors: zwq - * @LastEditTime: 2022-09-16 13:50:19 + * @LastEditTime: 2023-01-05 14:24:29 * @Description: */ export default { - data () { - /* eslint-disable */ - return { - urlOptions: { - getDataListURL: '', - deleteURL: '', - statusUrl: '', - exportUrl: '' - }, - dataList: [], - dataForm: {}, - pageIndex: 1, - pageSize: 10, - totalPage: 0, - dataListLoading: false, - addOrUpdateVisible: false, - } - }, - created () { - }, - activated() { - this.getDataList(); - }, - methods: { + data() { + /* eslint-disable */ + return { + urlOptions: { + getDataListURL: '', + deleteURL: '', + statusUrl: '', + exportUrl: '' + }, + addOrEditTitle: '', + tableData: [], + listQuery: { + limit: 10, + page: 1, + total: 1, + }, + dataListLoading: false, + addOrUpdateVisible: false, + } + }, + created() { + }, + activated() { + this.getDataList(); + }, + methods: { // 获取数据列表 getDataList() { - this.dataListLoading = true; - this.$http - .get(this.urlOptions.getDataListURL, { - params: { - page: this.pageIndex, - limit: this.pageSize, - ...this.dataForm - }, - }) - .then(({ data: res }) => { - this.dataListLoading = false; - if (res.code !== 0) { - this.dataList = []; - this.totalPage = 0; - return this.$message.error(res.msg); - } - this.dataList = res.data.list; - this.totalPage = res.data.total; - }) - .catch(() => { - this.dataListLoading = false; - }); - }, - // 每页数 - sizeChangeHandle(val) { - this.pageSize = val; - this.pageIndex = 1; - this.getDataList(); - }, - // 当前页 - currentChangeHandle(val) { - this.pageIndex = val; - this.getDataList(); - }, - // 新增 / 修改 - addOrUpdateHandle(id) { - this.addOrUpdateVisible = true; - this.$nextTick(() => { - this.$refs.addOrUpdate.init(id); - }); - }, - cancel(id) { - this.$refs["popover-" + id].showPopper = false; - }, - changeStatus(id) { - this.$http - .post(this.urlOptions.statusUrl, { id }) - .then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg); - } - this.$refs["popover-" + id].showPopper = false; - this.$message({ - message: this.$t("prompt.success"), - type: "success", - duration: 500, - onClose: () => { - this.getDataList(); - }, - }); - }) - .catch(() => {}); - }, - // 删除 - deleteHandle(id, name) { - this.$confirm(`确定对[名称=${name}]进行删除操作?`, "提示", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning", + this.dataListLoading = true; + this.$http + .get(this.urlOptions.getDataListURL, { + params: this.listQuery, }) - .then(() => { - this.$http.delete(this.urlOptions.deleteURL, { data: [id] }).then(({ data }) => { - if (data && data.code === 0) { - this.$message({ - message: "操作成功", - type: "success", - duration: 1500, - onClose: () => { - this.getDataList(); - }, - }); - } else { - this.$message.error(data.msg); - } - }); - }) - .catch(() => {}); - }, - // 导出 - exportHandle(name) { - this.$http - .get(this.urlOptions.exportUrl, { responseType: "blob" }) - .then(({ data: res }) => { - var date = new Date(); - var year = date.getFullYear(); - var month = date.getMonth() + 1; - var strDate = date.getDate(); - if (month >= 1 && month <= 9) { - month = "0" + month; - } - if (strDate >= 0 && strDate <= 9) { - strDate = "0" + strDate; - } - var currentdate = year + "-" + month + "-" + strDate; - const blob = new Blob([res]); - const downloadElement = document.createElement("a"); - const href = window.URL.createObjectURL(blob); // 创建下载的链接 - downloadElement.href = href; - downloadElement.download = `${name+currentdate}.xls`; // 下载后文件名 - document.body.appendChild(downloadElement); - downloadElement.click(); // 点击下载 - document.body.removeChild(downloadElement); // 下载完成移除元素 - window.URL.revokeObjectURL(href); - }) - .catch(() => {}); - } + .then(({ data: res }) => { + this.dataListLoading = false; + if (res.code !== 0) { + this.tableData = []; + this.listQuery.total = 0; + return this.$message.error(res.msg); + } + this.tableData = res.data.list; + this.listQuery.total = res.data.total; + }) + .catch(() => { + this.dataListLoading = false; + }); + }, + // 每页数 + sizeChangeHandle(val) { + this.listQuery.limit = val; + this.listQuery.page = 1; + this.getDataList(); + }, + // 当前页 + currentChangeHandle(val) { + this.listQuery.page = val; + this.getDataList(); + }, + // 新增 / 修改 + addOrUpdateHandle(id) { + this.addOrUpdateVisible = true; + this.$nextTick(() => { + this.$refs.addOrUpdate.init(id); + }); + }, + cancel(id) { + this.$refs["popover-" + id].showPopper = false; + }, + //改变状态 + changeStatus(id) { + this.$http + .post(this.urlOptions.statusUrl, { id }) + .then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg); + } + this.$refs["popover-" + id].showPopper = false; + this.$message({ + message: this.$t("prompt.success"), + type: "success", + duration: 500, + onClose: () => { + this.getDataList(); + }, + }); + }) + .catch(() => { }); + }, + //tableBtn点击 + handleClick(val) { + if (val.type === "edit") { + this.addOrUpdateVisible = true; + this.addOrEditTitle = "编辑"; + this.$nextTick(() => { + this.$refs.addOrUpdate.init(val.data.id); + }); + } else if (val.type === "delete") { + this.deleteHandle(val.data.id,val.data.name) + } + }, + // 删除 + deleteHandle(id, name) { + this.$confirm(`确定对[名称=${name}]进行删除操作?`, "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning", + }) + .then(() => { + this.$http.delete(this.urlOptions.deleteURL, { data: [id] }).then(({ data }) => { + if (data && data.code === 0) { + this.$message({ + message: "操作成功", + type: "success", + duration: 1500, + onClose: () => { + this.getDataList(); + }, + }); + } else { + this.$message.error(data.msg); + } + }); + }) + .catch(() => { }); + }, + //search-bar点击 + buttonClick(val) { + switch (val.btnName) { + case "search": + this.listQuery.xm1 = val.xm1; + this.listQuery.xm2 = val.xm2; + this.listQuery.page = 1; + this.getDataList(); + break; + case "add": + this.addOrEditTitle = '新增' + this.addOrUpdateVisible = true; + this.addOrUpdateHandle() + break; + default: + console.log(val) + } + }, + handleCancel() { + this.$refs.addOrUpdate.formClear() + this.addOrUpdateVisible = false + this.addOrEditTitle = '' + }, + handleConfirm() { + this.$refs.addOrUpdate.dataFormSubmit() + }, + successSubmit() { + this.handleCancel() + this.getDataList() + }, + // 导出 + exportHandle(name) { + this.$http + .get(this.urlOptions.exportUrl, { responseType: "blob" }) + .then(({ data: res }) => { + var date = new Date(); + var year = date.getFullYear(); + var month = date.getMonth() + 1; + var strDate = date.getDate(); + if (month >= 1 && month <= 9) { + month = "0" + month; + } + if (strDate >= 0 && strDate <= 9) { + strDate = "0" + strDate; + } + var currentdate = year + "-" + month + "-" + strDate; + const blob = new Blob([res]); + const downloadElement = document.createElement("a"); + const href = window.URL.createObjectURL(blob); // 创建下载的链接 + downloadElement.href = href; + downloadElement.download = `${name + currentdate}.xls`; // 下载后文件名 + document.body.appendChild(downloadElement); + downloadElement.click(); // 点击下载 + document.body.removeChild(downloadElement); // 下载完成移除元素 + window.URL.revokeObjectURL(href); + }) + .catch(() => { }); } + } } \ No newline at end of file diff --git a/src/router/index.js b/src/router/index.js index 8b162a5..80727c9 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2023-01-04 10:29:39 * @LastEditors: zwq - * @LastEditTime: 2023-01-04 10:42:56 + * @LastEditTime: 2023-01-05 15:52:02 * @Description: */ import Vue from 'vue' @@ -40,9 +40,6 @@ export const moduleRoutes = { meta: { title: '主入口布局' }, children: [ { path: '/home', component: () => import('@/views/modules/home'), name: 'home', meta: { title: '首页', isTab: true } }, - - // 基础信息 - { path: '/unitList', component: () => import('@/views/spc-basic/unitList'), name: 'unitList', meta: { title: '计量单位管理', isTab: true } }, ] } diff --git a/src/store/index.js b/src/store/index.js index 20029ec..956d7c5 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,3 +1,10 @@ +/* + * @Author: zwq + * @Date: 2023-01-04 10:29:39 + * @LastEditors: zwq + * @LastEditTime: 2023-01-05 16:14:45 + * @Description: + */ import Vue from 'vue' import Vuex from 'vuex' import cloneDeep from 'lodash/cloneDeep' @@ -24,7 +31,7 @@ export default new Vuex.Store({ { ...window.SITE_CONFIG['contentTabDefault'], 'name': 'home', - 'title': 'home' + 'title': '首页' } ], contentTabsActiveName: 'home' diff --git a/src/views/main-navbar.vue b/src/views/main-navbar.vue index 5af9187..caa96d3 100644 --- a/src/views/main-navbar.vue +++ b/src/views/main-navbar.vue @@ -2,7 +2,7 @@ * @Author: zwq * @Date: 2022-08-22 14:57:51 * @LastEditors: zwq - * @LastEditTime: 2022-08-22 15:25:14 + * @LastEditTime: 2023-01-05 16:44:00 * @Description: -->