Browse Source

update

master
许孟阳 1 year ago
parent
commit
abce92de5e
  1. 4
      package.json
  2. 28
      packages/base/data/list-table.vue
  3. 24
      packages/base/data/login-form.vue
  4. 2
      packages/base/data/modify-form.vue
  5. 8
      packages/base/item/datetime.vue
  6. 13
      packages/base/item/input.vue
  7. 15
      packages/manage/common/head.vue
  8. 7
      packages/manage/router/index.vue
  9. 18
      plugs/element/message.ts
  10. 47
      plugs/i18n/en.ts
  11. 38
      plugs/i18n/zh.ts

4
package.json

@ -1,6 +1,6 @@
{ {
"name": "noob-mengyxu", "name": "noob-mengyxu",
"version": "0.2.6", "version": "0.2.7",
"main": "index.ts", "main": "index.ts",
"module": "index.ts", "module": "index.ts",
"keywords": [ "keywords": [
@ -32,7 +32,7 @@
"dependencies": { "dependencies": {
"axios": "^0.19.2", "axios": "^0.19.2",
"core-js": "^3.8.3", "core-js": "^3.8.3",
"element-plus": "2.2.20", "element-plus": "2.4.0",
"vue": "^3.2.25", "vue": "^3.2.25",
"vue-class-component": "^8.0.0-0", "vue-class-component": "^8.0.0-0",
"vue-router": "^4.0.3", "vue-router": "^4.0.3",

28
packages/base/data/list-table.vue

@ -6,7 +6,8 @@
<el-table-column v-for="item in props" :key="item.code" :prop="item.code" :label="item.name || t(item.i18n)" <el-table-column v-for="item in props" :key="item.code" :prop="item.code" :label="item.name || t(item.i18n)"
:type="item.type" :min-width="item.width" :width="item.type ? item.width : ''" :fixed="item.fixed" :type="item.type" :min-width="item.width" :width="item.type ? item.width : ''" :fixed="item.fixed"
:align="item.align ? item.align : 'center'" show-overflow-tooltip :formatter="formatter"> :align="item.align ? item.align : 'center'" show-overflow-tooltip
:formatter="item.stamp ? formatStamp : item.fileSize ? formatFileSize : formatter">
<template v-if="item.slot" #default="scope"> <template v-if="item.slot" #default="scope">
<slot :name="item.code" :row="scope.row"></slot> <slot :name="item.code" :row="scope.row"></slot>
@ -95,6 +96,31 @@ const getValue = (
return value; return value;
}; };
const formatStamp = (row: any, column: any, value: any, index: number) => {
const date = new Date(value * 1000);
const month = date.getMonth() < 9 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
const day = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
const hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
const minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
const second = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return date.getFullYear() + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second;
};
const formatFileSize = (row: any, column: any, value: any, index: number) => {
const k = value / 1024;
if (k < 1) {
return value + "B";
}
const m = k / 1024;
if (m < 1) {
return k.toFixed(2) + "K";
}
const g = m / 1024;
if (g < 1) {
return m.toFixed(2) + "M";
}
return g.toFixed(2) + "G";
};
const formatter = (row: any, column: any, value: any, index: number) => { const formatter = (row: any, column: any, value: any, index: number) => {
if (row.scheme) if (row.scheme)
return formatterByDist(row.scheme + '_' + column.property, value); return formatterByDist(row.scheme + '_' + column.property, value);

24
packages/base/data/login-form.vue

@ -1,5 +1,8 @@
<template> <template>
<el-form label-position="right" class="login-form" :model="param" ref="loginForm" :rules="rules"> <el-form label-position="right" class="login-form" :model="param" ref="loginForm" :rules="rules">
<div class="logo-item" v-if="logo">
<el-image class="logo" :src="logo" fit="fit" />
</div>
<el-form-item> <el-form-item>
<div class="lte-title"> {{ t('title') }} </div> <div class="lte-title"> {{ t('title') }} </div>
</el-form-item> </el-form-item>
@ -35,6 +38,13 @@ const rules = {
password: [new SimpleRequired('pwd.pwd')] password: [new SimpleRequired('pwd.pwd')]
} }
const props = defineProps({
logo: {
type: String,
default: null,
},
});
const login = () => { const login = () => {
if (!loginForm.value) return; if (!loginForm.value) return;
loginForm.value?.validate((valid, fields) => { loginForm.value?.validate((valid, fields) => {
@ -54,6 +64,20 @@ onMounted(() => { });
height: v-bind('state.size.loginHeight'); height: v-bind('state.size.loginHeight');
} }
.logo-item {
text-align: center;
align-items: center;
}
.logo {
width: 50px;
height: 50px;
img {
display: inline !important;
}
}
.lte-title { .lte-title {
font-size: 1.5em; font-size: 1.5em;
font-weight: bold; font-weight: bold;

2
packages/base/data/modify-form.vue

@ -9,7 +9,7 @@
<NoobDate v-else-if="item.date" v-model="param[item.code]" :formater="item.formater" full <NoobDate v-else-if="item.date" v-model="param[item.code]" :formater="item.formater" full
:placeholder="t('rule.pleaseSelect') + (item.name || t(item.i18n))" :disabled="item.disabled" /> :placeholder="t('rule.pleaseSelect') + (item.name || t(item.i18n))" :disabled="item.disabled" />
<slot v-else-if="item.slot" :name="item.code" /> <slot v-else-if="item.slot" :name="item.code" />
<NoobInput v-else v-model="param[item.code]" full :type="item.type" <NoobInput v-else v-model="param[item.code]" full :type="item.type" :rows="items.rows"
:placeholder="t('rule.pleaseEnter') + (item.name || t(item.i18n))" :disabled="item.disabled" /> :placeholder="t('rule.pleaseEnter') + (item.name || t(item.i18n))" :disabled="item.disabled" />
</el-form-item> </el-form-item>
<slot></slot> <slot></slot>

8
packages/base/item/datetime.vue

@ -1,6 +1,6 @@
<template> <template>
<el-date-picker :size="state.size.size" :class="['form-item', full && 'full']" :value-format="formater" <el-date-picker :size="state.size.size" :class="['form-item', full && 'full']" :value-format="formater"
v-model="myValue" type="datetime" :placeholder="placeholder || t('rule.pleaseEnter')" :disabled="disabled" v-model="myValue" :type="type" :placeholder="placeholder || t('rule.pleaseEnter')" :disabled="disabled"
:clearable="clearable" :teleported="false" /> :clearable="clearable" :teleported="false" />
</template> </template>
@ -17,6 +17,10 @@ const prop = defineProps({
type: String, type: String,
default: null default: null
}, },
type: {
type: String,
default: 'datetime'
},
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -31,7 +35,7 @@ const prop = defineProps({
}, },
formater: { formater: {
type: String, type: String,
defaul: 'YYYY-MM-DDTHH:mm:ss' defaul: 'YYYY-MM-DD HH:mm:ss'
}, },
width: { width: {
type: Number type: Number

13
packages/base/item/input.vue

@ -1,6 +1,8 @@
<template> <template>
<el-input :size="state.size.size" :class="['form-item', full && 'full']" v-model="myValue" :type="type" <el-input :size="state.size.size" :class="['form-item', full && 'full']" v-model="myValue" :type="type"
:placeholder="placeholder || t('rule.pleaseEnter')" :disabled="disabled" :clearable="clearable"></el-input> :placeholder="placeholder || t('rule.pleaseEnter')" :disabled="disabled" :clearable="clearable">
<template v-if="label" #prepend>{{ label }}</template>
</el-input>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -12,6 +14,10 @@ const { state } = useStore();
const prop = defineProps({ const prop = defineProps({
modelValue: null, modelValue: null,
label: {
type: String,
default: null
},
placeholder: { placeholder: {
type: String, type: String,
default: null default: null
@ -65,4 +71,9 @@ onMounted(() => {
.form-item { .form-item {
width: v-bind('width'); width: v-bind('width');
} }
::v-deep .el-input-group__prepend {
min-width: 20px;
padding: 0px 4px !important;
}
</style> </style>

15
packages/manage/common/head.vue

@ -2,7 +2,10 @@
<el-button v-if="closeAble" class="close-btn" :icon="isClose ? 'CaretRight' : 'CaretLeft'" circle <el-button v-if="closeAble" class="close-btn" :icon="isClose ? 'CaretRight' : 'CaretLeft'" circle
:size="state.size.size" @click="close"></el-button> :size="state.size.size" @click="close"></el-button>
<div class="head"> <div class="head">
<div class="title">{{ title || t('title') }}</div> <div class="title">
<el-image class="logo" v-if="logo" :src="logo" fit="fit" />
{{ title || t('title') }}
</div>
<div class="menu"> <div class="menu">
<el-dropdown class="icon" :size="state.size.size" :teleported="false"> <el-dropdown class="icon" :size="state.size.size" :teleported="false">
<el-button :size="state.size.size" icon="Avatar" circle></el-button> <el-button :size="state.size.size" icon="Avatar" circle></el-button>
@ -135,6 +138,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
logo: {
type: String,
default: null,
},
}); });
const isClose = ref(false) const isClose = ref(false)
@ -221,6 +228,12 @@ onMounted(() => { });
height: v-bind('state.size.headHeight'); height: v-bind('state.size.headHeight');
} }
.logo {
float: left;
width: v-bind('state.size.headHeight');
height: v-bind('state.size.headHeight');
}
.title { .title {
height: v-bind('state.size.headHeight'); height: v-bind('state.size.headHeight');
width: v-bind('state.size.asideWidth'); width: v-bind('state.size.asideWidth');

7
packages/manage/router/index.vue

@ -3,7 +3,8 @@
<el-header v-show="state.size.headHeight != '0px'" class="app-head" :height="state.size.headHeight"> <el-header v-show="state.size.headHeight != '0px'" class="app-head" :height="state.size.headHeight">
<Head :title="title" @updatePwd="pwd => emit('updatePwd', pwd)" @logout="emit('logout')" :styleAble="styleAble" <Head :title="title" @updatePwd="pwd => emit('updatePwd', pwd)" @logout="emit('logout')" :styleAble="styleAble"
:sizeAble="sizeAble" :langAble="langAble" :center="center" :username="username" :closeAble="closeAble" /> :sizeAble="sizeAble" :langAble="langAble" :center="center" :username="username" :closeAble="closeAble"
:logo="logo" />
</el-header> </el-header>
<el-container id="container"> <el-container id="container">
<el-aside v-show="state.size.asideWidth != '0px'" :width="state.size.asideWidth"> <el-aside v-show="state.size.asideWidth != '0px'" :width="state.size.asideWidth">
@ -76,6 +77,10 @@ const props = defineProps({
type: Boolean, type: Boolean,
default: false, default: false,
}, },
logo: {
type: String,
default: null,
},
}); });
const onResize = () => { const onResize = () => {

18
plugs/element/message.ts

@ -75,18 +75,18 @@ export const confirm = (msg: string, title: string) => {
confirmButtonClass: 'el-button--info', confirmButtonClass: 'el-button--info',
type: 'warning', type: 'warning',
}) })
.then(resolve) .then(() => {
resolve(true);
})
.catch((error) => { .catch((error) => {
if (reject != null) { resolve(false);
reject(error);
}
}); });
}); });
}; };
export const prompt = (msg: string, title: string, pattern: RegExp, errorMsg: string) => { export const prompt = (msg: string, title: string, pattern: RegExp, errorMsg: string) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
ElMessageBox.confirm(msg, title, { ElMessageBox.prompt(msg, title, {
confirmButtonText: t('base.confirm'), confirmButtonText: t('base.confirm'),
cancelButtonText: t('base.cancel'), cancelButtonText: t('base.cancel'),
buttonSize: 'default', buttonSize: 'default',
@ -94,11 +94,11 @@ export const prompt = (msg: string, title: string, pattern: RegExp, errorMsg: st
inputPattern: pattern, inputPattern: pattern,
inputErrorMessage: errorMsg, inputErrorMessage: errorMsg,
}) })
.then(resolve) .then((result) => {
resolve(result.value);
})
.catch((error) => { .catch((error) => {
if (reject != null) { resolve(false);
reject(error);
}
}); });
}); });
}; };

47
plugs/i18n/en.ts

@ -8,6 +8,8 @@ export default class English {
modify: 'Modify', modify: 'Modify',
stop: 'Stop', stop: 'Stop',
select: 'Select', select: 'Select',
refresh: 'Refresh',
save: 'Save',
confirm: 'Confirm', confirm: 'Confirm',
cancel: 'Cancel', cancel: 'Cancel',
loading: 'Loading...', loading: 'Loading...',
@ -29,8 +31,7 @@ export default class English {
rePwdError: 'The password is entered twice inconsistently', rePwdError: 'The password is entered twice inconsistently',
length: 'The password length is: {0}~{1} characters', length: 'The password length is: {0}~{1} characters',
noSpace: 'The password cannot contain spaces', noSpace: 'The password cannot contain spaces',
required: required: 'The password contains at least uppercase and lowercase letters and numbers',
'The password contains at least uppercase and lowercase letters and numbers',
}; };
head = { head = {
@ -75,37 +76,19 @@ export default class English {
}; };
http = { http = {
unPermission: unPermission: 'You do not have access yet, please contact your administrator to add it',
'You do not have access yet, please contact your administrator to add it', noPermission: 'This permission is not yet open, do not access without permission',
noPermission:
'This permission is not yet open, do not access without permission',
error: 'Network error', error: 'Network error',
downFail: 'Download failed with network abnormality!', downFail: 'Download failed with network abnormality!',
}; };
preMenu = { preMenu = {
operator: [ operator: ['Buffer', 'Config', 'Dictionary', 'Permission', 'Role', 'Status', 'Log'],
'Buffer',
'Config',
'Dictionary',
'Permission',
'Role',
'Status',
'Log',
],
}; };
log = { log = {
title: 'Action log list', title: 'Action log list',
prop: [ prop: ['Sequence', 'Action user', 'Log module', 'Action type', 'Action time', 'Login IP', 'Log content'],
'Sequence',
'Action user',
'Log module',
'Action type',
'Action time',
'Login IP',
'Log content',
],
start: 'Start time', start: 'Start time',
stop: 'Stop time', stop: 'Stop time',
}; };
@ -115,26 +98,14 @@ export default class English {
name: ' type/dictionary', name: ' type/dictionary',
prop: ['Name', 'Code', 'Description', 'Status', 'Action'], prop: ['Name', 'Code', 'Description', 'Status', 'Action'],
example: ['Type name(Fuzzy queries)', 'Type code', 'Status'], example: ['Type name(Fuzzy queries)', 'Type code', 'Status'],
delete: [ delete: ['Confirm whether to delete the dictionary/dictionary type (deleting a dictionary type deletes all dictionaries under that type)?', 'Tips'],
'Confirm whether to delete the dictionary/dictionary type (deleting a dictionary type deletes all dictionaries under that type)?',
'Tips',
],
}; };
permission = { permission = {
title: 'Permission manage', title: 'Permission manage',
name: 'permission', name: 'permission',
parent: 'Permission parent', parent: 'Permission parent',
prop: [ prop: ['Name', 'Code', 'Icon', 'Level', 'Priority', 'Status', 'Content', 'Action'],
'Name',
'Code',
'Icon',
'Level',
'Priority',
'Status',
'Content',
'Action',
],
example: ['Permission code'], example: ['Permission code'],
delete: ['Are you sure you want to remove the permission?', 'Tips'], delete: ['Are you sure you want to remove the permission?', 'Tips'],
}; };

38
plugs/i18n/zh.ts

@ -8,6 +8,8 @@ export default class Zh {
modify: '修改', modify: '修改',
stop: '停止', stop: '停止',
select: '查询', select: '查询',
refresh: '刷新',
save: '保存',
confirm: '确认', confirm: '确认',
cancel: '取消', cancel: '取消',
loading: '加载中...', loading: '加载中...',
@ -81,28 +83,12 @@ export default class Zh {
}; };
preMenu = { preMenu = {
operator: [ operator: ['缓存管理', '系统配置', '数据字典', '权限管理', '角色管理', '状态管理', '接口日志'],
'缓存管理',
'系统配置',
'数据字典',
'权限管理',
'角色管理',
'状态管理',
'接口日志',
],
}; };
log = { log = {
title: '接口日志查询', title: '接口日志查询',
prop: [ prop: ['序号', '操作用户', '日志模块', '操作类型', '操作时间', '登录IP', '日志信息'],
'序号',
'操作用户',
'日志模块',
'操作类型',
'操作时间',
'登录IP',
'日志信息',
],
start: '开始时间', start: '开始时间',
stop: '结束时间', stop: '结束时间',
}; };
@ -112,26 +98,14 @@ export default class Zh {
name: '类型/字典', name: '类型/字典',
prop: ['字典名称', '字典编码', '字典说明', '字典状态', '操作'], prop: ['字典名称', '字典编码', '字典说明', '字典状态', '操作'],
example: ['字典类型名称(模糊查询)', '字典类型编码', '状态'], example: ['字典类型名称(模糊查询)', '字典类型编码', '状态'],
delete: [ delete: ['确认是否删除该字典/字典类型(删除字典类型将删除该类型下所有字典)?', '提示'],
'确认是否删除该字典/字典类型(删除字典类型将删除该类型下所有字典)?',
'提示',
],
}; };
permission = { permission = {
title: '权限管理', title: '权限管理',
name: '权限', name: '权限',
parent: '父权限', parent: '父权限',
prop: [ prop: ['权限名称', '权限编号', '菜单图标', '权限级别', '排序优先级', '权限状态', '权限内容', '操作'],
'权限名称',
'权限编号',
'菜单图标',
'权限级别',
'排序优先级',
'权限状态',
'权限内容',
'操作',
],
example: ['权限编号'], example: ['权限编号'],
delete: ['确定要删除该权限吗?', '提示'], delete: ['确定要删除该权限吗?', '提示'],
}; };

Loading…
Cancel
Save