diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/assets/style/lib/table.less b/Api/Ewide.Core/Ewide.Core.Web.Src/src/assets/style/lib/table.less index f5b8b2b..10ffedb 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/assets/style/lib/table.less +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/assets/style/lib/table.less @@ -1,15 +1,20 @@ @import (reference) '~@/assets/style/extend.less'; + .yo-query-bar { margin-bottom: @padding-md; } + .yo-action-bar { display: flex; justify-content: space-between; margin-bottom: @padding-md; + &--actions { + >.ant-btn, >.ant-btn-group { + +.ant-btn, +.ant-btn-group { margin-left: @padding-xs; @@ -17,16 +22,20 @@ } } } + .ant-table { background-color: @white; + .yo-action-bar { margin-bottom: 0; } } + .ant-table-small { >.ant-table-content { >.ant-table-body { margin: 0; + >table { >.ant-table-thead { >tr { @@ -39,6 +48,7 @@ } } } + .ant-table-thead { >tr { >th { @@ -46,15 +56,20 @@ } } } + .yo-table { - .border-right-none { - border-right-width: 0; + .border-right-none() { + border-right-width: 0 !important; + &:last-child { - border-right-width: 1px; + border-right-width: 1px !important; } } + .ant-table-content { - >.ant-table-body { + .ant-table-body { + overflow-x: auto !important; + >table { >.ant-table-thead { >tr { @@ -63,6 +78,7 @@ } } } + >.ant-table-tbody { >tr { >td { @@ -72,19 +88,82 @@ } } } + + .ant-table-fixed-left { + .ant-table-thead { + >tr { + >th { + border-right-width: 0 !important; + } + } + } + + .ant-table-tbody { + >tr { + >td { + border-right-width: 0 !important; + } + } + } + } + + .ant-table-fixed-right { + .ant-table-fixed { + border-left-width: 0 !important; + } + + .ant-table-thead { + >tr { + >th { + .border-right-none(); + } + } + } + + .ant-table-tbody { + >tr { + >td { + .border-right-none(); + } + } + } + } } } + .yo-table-actions { display: inline-block; vertical-align: middle; + &--inner { display: flex; align-items: center; height: 18px; + >a { color: darken(@primary-color, 20%); } } } + +.yo-table--column-setting { + width: 240px; + + .ant-dropdown-menu-item { + display: flex; + justify-content: space-between; + align-items: center; + } + + .anticon-pushpin { + color: darken(@white, 40%); + transition: @animation-duration-slow; + transform: rotate(45deg); + } + + .yo-table--fixed { + transform: rotate(-45deg); + } +} \ No newline at end of file diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/common/api/index.js b/Api/Ewide.Core/Ewide.Core.Web.Src/src/common/api/index.js index 2abd397..eac6bda 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/common/api/index.js +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/common/api/index.js @@ -18,7 +18,7 @@ axios.defaults.baseURL = '/api' */ import urls from './requests' -const initInstance = function () { +const initInstance = () => { const instance = axios .create({ headers: { @@ -40,6 +40,27 @@ const initInstance = function () { return instance } +const errorNotification = ({ code, message }) => { + switch (message.constructor) { + case Array: + message.map(p => { + app.$notification.error({ + duration: 0, + message: p.field, + description: p.messages.join('/'), + }) + }) + break + default: + app.$notification.error({ + duration: 0, + message: code || '错误', + description: message, + }) + break + } +} + const api = {} for (let key in urls) { @@ -75,24 +96,22 @@ for (let key in urls) { return new Promise((reslove, reject) => { api[`${key}Wait`](params) .then(({ data }) => { - reslove(data) + if ([status.BadRequest].indexOf(data.code) >= 0) { + errorNotification(data) + reject(data) + } else { + reslove(data) + } }) .catch(({ response: { data } }) => { - const { code, message } = data - app.$notification.error({ - duration: 0, - message: code, - description: message, - }) - - // if (process.env.VUE_APP_NODE_ENV === 'development') { - // app.$notification.open({ - // message: '错误', - // description: '发生错误,请联系管理员', - // }); - // } else { - // reject(err, urls[key]) - // } + if (process.env.VUE_APP_NODE_ENV === 'development') { + errorNotification({ + message: '发生错误,请联系管理员' + }) + } else { + errorNotification(data) + reject(data) + } }) }) } diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/authorized/index.js b/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/authorized/index.js index 417851c..aa1a55b 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/authorized/index.js +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/authorized/index.js @@ -127,7 +127,6 @@ const authByJson = (auth, permissions) => { export const auth = (auth) => { const { info } = app.global - const permissions = info.permissions if (!info) { return false @@ -140,6 +139,8 @@ export const auth = (auth) => { return true } + const permissions = info.permissions + let flag = false if (auth) { diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTable/column.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTable/column.vue new file mode 100644 index 0000000..104c6bf --- /dev/null +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTable/column.vue @@ -0,0 +1,64 @@ + + + 显示列 + { return false; }" class="yo-table--column-setting" slot="overlay"> + + 全选 + + + + onCheck(column, e)">{{column.title}} + + + + + + \ No newline at end of file diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTable/index.js b/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTable/index.js index 64072b3..c3264d5 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTable/index.js +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTable/index.js @@ -1,4 +1,5 @@ -import { template } from "lodash"; +// 列设置用jsx实现起来较为困难 +import ColumnSetting from './column' export default { props: { @@ -39,7 +40,9 @@ export default { sorter: { sortField: '', sortOrder: '', - } + }, + + columnSettingVisible: false }; }, @@ -49,6 +52,37 @@ export default { methods: { + renderColumnSetting() { + + const props = { + visible: this.columnSettingVisible, + placement: 'bottomRight' + } + + const on = { + visibleChange: (visible) => { + this.columnSettingVisible = visible + } + } + + return ( + + this.columnSettingVisible = true}>设置列 + { return false }}> + { + this.columns.map(column => { + return ( + + { column.hidden = !column.hidden }}>{column.title} + + ) + }) + } + + + ) + }, + onLoading() { this.loading = { indicator: @@ -74,7 +108,7 @@ export default { }, onReloadData(refresh = false) { - if (refresh) { + if (refresh && refresh.constructor === Boolean) { this.pagination.current = this.pageNo this.pagination.pageSize = this.pageSize } @@ -93,22 +127,37 @@ export default { loading: this.loading, pagination: this.pagination, dataSource: this.data, - columns: this.columns, + columns: this.columns.filter(p => !p.hidden), bordered: true, size: 'middle', - rowKey: record => record.id + rowKey: record => record.id, + scroll: { x: 'max-content' } } const on = { change: this.onTableChange } - return ( - - 后端没有排序参数 + + + 后端没有排序参数 + + 字段固定应该遵循左侧固定到最左,右侧固定到最右(此逻辑难以实现) + + + + {this.$scopedSlots.operator && this.$scopedSlots.operator()} + + + + 刷新 + + + + {Object.keys(this.$slots).map((name) => ( {this.$slots[name]} diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTreeLayout/index.js b/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTreeLayout/index.js index 31d4be0..f3b7c31 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTreeLayout/index.js +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/components/yoTreeLayout/index.js @@ -37,6 +37,7 @@ export default { this.loadData().then((res) => { const data = this.generateKey(res) + this.list = [] this.generateList(data) if (this.defaultExpandedKeys) { this.expandedKeys = this.list.map(p => p.key) diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/main.js b/Api/Ewide.Core/Ewide.Core.Web.Src/src/main.js index a97461f..f1d1387 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/main.js +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/main.js @@ -68,6 +68,14 @@ const app = new Vue({ * 可通过this.$root.global调用 */ global: { + + defaultWindow: [{ + title: '首页', + path: '/home', + icon: 'home', + closable: false, + }], + /** * 用于存储用户信息 */ diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/addForm.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/addForm.vue index 8002997..2d1ce72 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/addForm.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/addForm.vue @@ -42,16 +42,18 @@ export default { this.$refs['form-body'].onValidate((valid) => { if (valid) { this.confirmLoading = true; - this.$api.sysAppAdd(this.$refs['form-body'].form).then(({ success, message }) => { - this.confirmLoading = false; - if (success) { - this.$message.success('编辑成功'); - this.onCancel(); - this.$emit('ok'); - } else { - this.$message.error(message); - } - }); + this.$api + .sysAppAdd(this.$refs['form-body'].form) + .then(({ success }) => { + if (success) { + this.$message.success('新增成功'); + this.onCancel(); + this.$emit('ok'); + } + }) + .finally(() => { + this.confirmLoading = false; + }); } }); }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/editForm.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/editForm.vue index 3f917c2..76f613d 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/editForm.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/editForm.vue @@ -45,16 +45,18 @@ export default { this.$refs['form-body'].onValidate((valid) => { if (valid) { this.confirmLoading = true; - this.$api.sysAppEdit(this.$refs['form-body'].form).then(({ success, message }) => { - this.confirmLoading = false; - if (success) { - this.$message.success('新增成功'); - this.onCancel(); - this.$emit('ok'); - } else { - this.$message.error(message); - } - }); + this.$api + .sysAppEdit(this.$refs['form-body'].form) + .then(({ success }) => { + if (success) { + this.$message.success('编辑成功'); + this.onCancel(); + this.$emit('ok'); + } + }) + .finally(() => { + this.confirmLoading = false; + }); } }); }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/index.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/index.vue index 4907057..b5f5991 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/index.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/app/index.vue @@ -22,11 +22,9 @@ - - - 新增应用 - - + + 新增应用 + {{ bindCodeValue(text, 'yes_or_no') }} @@ -101,14 +99,6 @@ export default { title: '排序', dataIndex: 'sort', }, - { - title: '操作', - width: '200px', - dataIndex: 'action', - scopedSlots: { - customRender: 'action', - }, - }, ], codes: [ { @@ -124,6 +114,19 @@ export default { }, created() { this.onLoadCodes(); + + const flag = this.$auth({ + sysApp: [['edit'], ['delete']], + }); + + if (flag) { + this.columns.push({ + title: '操作', + width: '150px', + dataIndex: 'action', + scopedSlots: { customRender: 'action' }, + }); + } }, methods: { /** @@ -187,27 +190,25 @@ export default { this.$refs[formName].onOpen(record); }, - onResult(success, message, successMessage) { + onResult(success, successMessage) { if (success) { this.$message.success(successMessage); this.onReloadData(); - } else { - this.$refs.table.onLoaded(); - this.$message.error(message); } + this.$refs.table.onLoaded(); }, onSetDefault(record) { this.$refs.table.onLoading(); - this.$api.sysAppSetAsDefault({ id: record.id }).then(({ success, message }) => { - this.onResult(success, message, '设置成功'); + this.$api.sysAppSetAsDefault({ id: record.id }).then(({ success }) => { + this.onResult(success, '设置成功'); }); }, onDelete(record) { this.$refs.table.onLoading(); - this.$api.sysAppDelete(record).then(({ success, message }) => { - this.onResult(success, message, '删除成功'); + this.$api.sysAppDelete(record).then(({ success }) => { + this.onResult(success, '删除成功'); }); }, }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/addForm.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/addForm.vue index 8002997..af133ac 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/addForm.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/addForm.vue @@ -5,7 +5,7 @@ @cancel="onCancel" @ok="onOk" class="yo-modal-form" - title="新增应用" + title="新增机构" > @@ -25,13 +25,27 @@ export default { }; }, + computed: { + formBody() { + return this.$refs['form-body']; + }, + }, + methods: { /** * 必要的方法 * 从外部调用打开本窗口 */ - onOpen() { + onOpen(record, orgId) { this.visible = true; + this.$nextTick(async () => { + await this.formBody.onInit(); + + // 获取外部选中的部门id + this.formBody.onFillData({ + pid: orgId, + }); + }); }, /** @@ -42,16 +56,18 @@ export default { this.$refs['form-body'].onValidate((valid) => { if (valid) { this.confirmLoading = true; - this.$api.sysAppAdd(this.$refs['form-body'].form).then(({ success, message }) => { - this.confirmLoading = false; - if (success) { - this.$message.success('编辑成功'); - this.onCancel(); - this.$emit('ok'); - } else { - this.$message.error(message); - } - }); + this.$api + .sysOrgAdd(this.$refs['form-body'].form) + .then(({ success }) => { + if (success) { + this.$message.success('新增成功'); + this.onCancel(); + this.$emit('ok'); + } + }) + .finally(() => { + this.confirmLoading = false; + }); } }); }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/editForm.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/editForm.vue index 3f917c2..0220671 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/editForm.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/editForm.vue @@ -5,7 +5,7 @@ @cancel="onCancel" @ok="onOk" class="yo-modal-form" - title="编辑应用" + title="编辑机构" > @@ -32,7 +32,8 @@ export default { */ onOpen(record) { this.visible = true; - this.$nextTick(() => { + this.$nextTick(async () => { + await this.$refs['form-body'].onInit(); this.$refs['form-body'].onFillData(record); }); }, @@ -45,16 +46,18 @@ export default { this.$refs['form-body'].onValidate((valid) => { if (valid) { this.confirmLoading = true; - this.$api.sysAppEdit(this.$refs['form-body'].form).then(({ success, message }) => { - this.confirmLoading = false; - if (success) { - this.$message.success('新增成功'); - this.onCancel(); - this.$emit('ok'); - } else { - this.$message.error(message); - } - }); + this.$api + .sysOrgEdit(this.$refs['form-body'].form) + .then(({ success }) => { + if (success) { + this.$message.success('编辑成功'); + this.onCancel(); + this.$emit('ok'); + } + }) + .finally(() => { + this.confirmLoading = false; + }); } }); }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/form.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/form.vue index 2600cee..7f2ccba 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/form.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/form.vue @@ -1,38 +1,52 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/index.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/index.vue index 41ba1c1..baa4946 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/index.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/org/index.vue @@ -1,9 +1,14 @@ - + - + @@ -19,6 +24,9 @@ + + 新增机构 + @@ -58,14 +66,17 @@ export default { columns: [ { title: '机构名称', + width: '400px', dataIndex: 'name', }, { title: '唯一编码', + width: '200px', dataIndex: 'code', }, { title: '排序', + width: '80px', dataIndex: 'sort', }, { @@ -147,6 +158,7 @@ export default { */ onReloadData() { this.$refs.table.onReloadData(); + this.$refs['tree-layout'].onReloadData(); }, /** @@ -158,12 +170,13 @@ export default { }, onDelete(record) { - this.$api.sysOrgDelete(record).then(({ success, message }) => { + this.$api.sysOrgDelete(record).then(({ success }) => { if (success) { this.$message.success('删除成功'); this.onReloadData(); - } else { - this.$message.error(message); + if (this.query['pid'] == record.id) { + delete this.query.pid; + } } }); }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/addForm.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/addForm.vue index c7bfa1d..b30cf3c 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/addForm.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/addForm.vue @@ -41,16 +41,19 @@ export default { this.$refs['form-body'].onValidate((valid) => { if (valid) { this.confirmLoading = true; - this.$api.sysRoleAdd(this.$refs['form-body'].form).then(({ success, message }) => { - this.confirmLoading = false; - if (success) { - this.$message.success('编辑成功'); - this.onCancel(); - this.$emit('ok'); - } else { - this.$message.error(message); - } - }); + this.$api + .sysRoleAdd(this.$refs['form-body'].form) + .then(({ success }) => { + this.confirmLoading = false; + if (success) { + this.$message.success('编辑成功'); + this.onCancel(); + this.$emit('ok'); + } + }) + .finally(() => { + this.confirmLoading = false; + }); } }); }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/editForm.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/editForm.vue index 79bc11f..ee99935 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/editForm.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/editForm.vue @@ -45,16 +45,19 @@ export default { this.$refs['form-body'].onValidate((valid) => { if (valid) { this.confirmLoading = true; - this.$api.sysRoleEdit(this.$refs['form-body'].form).then(({ success, message }) => { - this.confirmLoading = false; - if (success) { - this.$message.success('编辑成功'); - this.onCancel(); - this.$emit('ok'); - } else { - this.$message.error(message); - } - }); + this.$api + .sysRoleEdit(this.$refs['form-body'].form) + .then(({ success }) => { + this.confirmLoading = false; + if (success) { + this.$message.success('编辑成功'); + this.onCancel(); + this.$emit('ok'); + } + }) + .finally(() => { + this.confirmLoading = false; + }); } }); }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/index.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/index.vue index 37a29fc..9a31edb 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/index.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/role/index.vue @@ -2,7 +2,7 @@ - + @@ -22,35 +22,33 @@ - - - 新建角色 - - + + 新建角色 + - + 编辑 - + 删除 - + 授权 - + 授权菜单 - + 授权数据 @@ -108,9 +106,7 @@ export default { ], }; }, - created() { - // this.onLoadCodes(); - }, + created() {}, methods: { /** * 必要的方法 @@ -143,29 +139,6 @@ export default { this.$refs.table.onReloadData(); }, - /** - * 加载字典数据时的必要方法 - */ - // onLoadCodes() { - // this.$api - // .$queue([ - // this.$api.sysDictTypeDropDownWait({ code: "yes_or_no" }), - // this.$api.sysDictTypeDropDownWait({ code: "common_status" }), - // ]) - // .then(([yesOrNo, commonStatus]) => { - // this.codes.find((p) => p.code === "yes_or_no").values = yesOrNo.data; - // this.codes.find((p) => p.code === "common_status").values = - // commonStatus.data; - // }); - // }, - bindCodeValue(code, name) { - const c = this.codes.find((p) => p.code == name).values.find((p) => p.code == code); - if (c) { - return c.value; - } - return null; - }, - /** * 有编辑新增功能的必要方法 * 从列表页调用窗口的打开方法 @@ -174,27 +147,18 @@ export default { this.$refs[formName].onOpen(record); }, - onResult(success, message, successMessage) { + onResult(success, successMessage) { if (success) { this.$message.success(successMessage); this.onReloadData(); - } else { - this.$refs.table.onLoaded(); - this.$message.error(message); } - }, - - onSetDefault(record) { - this.$refs.table.onLoading(); - this.$api.sysAppSetAsDefault({ id: record.id }).then(({ success, message }) => { - this.onResult(success, message, '设置成功'); - }); + this.$refs.table.onLoaded(); }, onDelete(record) { this.$refs.table.onLoading(); this.$api.sysRoleDel(record).then(({ success, message }) => { - this.onResult(success, message, '删除成功'); + this.onResult(success, '删除成功'); }); }, }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/addForm.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/addForm.vue index e3e141b..346526e 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/addForm.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/addForm.vue @@ -59,16 +59,18 @@ export default { this.formBody.onValidate((valid) => { if (valid) { this.confirmLoading = true; - this.$api.sysUserAdd(this.formBody.form).then(({ success, message }) => { - this.confirmLoading = false; - if (success) { - this.$message.success('编辑成功'); - this.onCancel(); - this.$emit('ok'); - } else { - this.$message.error(message); - } - }); + this.$api + .sysUserAdd(this.formBody.form) + .then(({ success }) => { + if (success) { + this.$message.success('新增成功'); + this.onCancel(); + this.$emit('ok'); + } + }) + .finally(() => { + this.confirmLoading = false; + }); } }); }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/editForm.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/editForm.vue index f3260fc..c14d8cd 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/editForm.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/editForm.vue @@ -46,16 +46,18 @@ export default { this.$refs['form-body'].onValidate((valid) => { if (valid) { this.confirmLoading = true; - this.$api.sysUserEdit(this.$refs['form-body'].form).then(({ success, message }) => { - this.confirmLoading = false; - if (success) { - this.$message.success('编辑成功'); - this.onCancel(); - this.$emit('ok'); - } else { - this.$message.error(message); - } - }); + this.$api + .sysUserEdit(this.$refs['form-body'].form) + .then(({ success }) => { + if (success) { + this.$message.success('编辑成功'); + this.onCancel(); + this.$emit('ok'); + } + }) + .finally(() => { + this.confirmLoading = false; + }); } }); }, diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/index.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/index.vue index 22bfecf..39951d9 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/index.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/pages/system/user/index.vue @@ -45,11 +45,9 @@ - - - 新增用户 - - + + 新增用户 + {{ bindCodeValue(text, 'sex') }} {{ bindCodeValue(text, 'common_status') }} diff --git a/Api/Ewide.Core/Ewide.Core.Web.Src/src/views/main/index.vue b/Api/Ewide.Core/Ewide.Core.Web.Src/src/views/main/index.vue index 1339c17..8ca8cfa 100644 --- a/Api/Ewide.Core/Ewide.Core.Web.Src/src/views/main/index.vue +++ b/Api/Ewide.Core/Ewide.Core.Web.Src/src/views/main/index.vue @@ -89,7 +89,10 @@ export default { }; }, - created() { + mounted() { + Vue.prototype.openContentWindow = this.onOpenContentWindow; + Vue.prototype.closeContentWindow = this.onCloseContentWindow; + this.nav.loading = true; this.$api.getLoginUser().then(({ data }) => { @@ -102,18 +105,10 @@ export default { this.menus = data.menus; this.serializeMenu(); this.nav.loading = false; - }); - }, - mounted() { - Vue.prototype.openContentWindow = this.onOpenContentWindow; - Vue.prototype.closeContentWindow = this.onCloseContentWindow; - - this.onOpenContentWindow({ - title: '首页', - path: '/home', - icon: 'home', - closable: false, + this.$root.global.defaultWindow.map((options) => { + this.onOpenContentWindow(options); + }); }); },