Browse Source

0.4.2

master
许孟阳 2 months ago
parent
commit
cc54da9dd8
  1. 2
      .env.development
  2. 2
      examples/App.vue
  3. 9
      examples/view/home.vue
  4. 8
      packages/base/data/list-table.vue
  5. 13
      packages/base/item/select.vue
  6. 2
      packages/manage/common/login.vue
  7. 5
      packages/manage/router/index.vue
  8. 4
      packages/manage/views/user.vue
  9. 26
      packages/tool/grafana-iframe.vue
  10. 3
      packages/tool/index.ts
  11. 102
      packages/tool/terminal-split.vue
  12. 1
      plugs/http/axios.ts
  13. 1
      plugs/i18n/zh.ts
  14. 2
      plugs/store/index.ts

2
.env.development

@ -1,3 +1,3 @@ @@ -1,3 +1,3 @@
NODE_ENV="preview"
# VUE_APP_BASE_URL="http://172.16.16.120:8080"
VUE_APP_BASE_URL="http://localhost"
VUE_APP_BASE_URL="http://10.100.0.108:8082"

2
examples/App.vue

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
<template>
<Index :menus="menus" @updatePwd="pwd => console.log(pwd)" :checkUser="true" username="超级管理员" :closeAble="true"
<Index :menus="menus" @updatePwd="pwd => console.log(pwd)" :checkUser="false" username="超级管理员" :closeAble="true"
mode="horizontal">
</Index>
</template>

9
examples/view/home.vue

@ -1,15 +1,16 @@ @@ -1,15 +1,16 @@
<template>
<NoobTag>{{ t('title') }}</NoobTag>
<NoobTag type="success">{{ t('title') }}</NoobTag>
<!-- <NoobTag>{{ t('title') }}</NoobTag>
<NoobTag type="success">{{ t('title') }}</NoobTag> -->
<GrafanaIframe :src="src" />
</template>
<script lang="ts" setup>
import { NoobTag, Http } from "noob-mengyxu";
import { NoobTag, Http, GrafanaIframe } from "noob-mengyxu";
import { useI18n } from "vue3-i18n";
const { t } = useI18n();
const { post } = Http.Axios2
const src = "http://10.100.0.108:3001";
</script>
<style lang="scss" scoped>
//@import url(); css
</style>

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

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
<template>
<div class="my-table">
<el-table ref="table" :size="state.size.size" :data="page ? data.data : data"
@selection-change="selectionChange" :border="border"
<el-table ref="table" :size="state.size.size" :data="page ? data.data : data" :border="border"
@selection-change="selectionChange" @row-click="emit('row-click', $event)"
:height="height || (page ? state.size.pTableHeight : state.size.tableHeight)" highlight-current-row
:row-key="rowKey" :tree-porps="treeProps" :lazy="lazy" :load="load">
@ -82,7 +82,7 @@ const prop = defineProps({ @@ -82,7 +82,7 @@ const prop = defineProps({
},
});
const emit = defineEmits(["query", "selection-change"]);
const emit = defineEmits(["query", "selection-change", "row-click"]);
const selectionChange = selection => {
emit("selection-change", selection);
@ -199,7 +199,7 @@ onUpdated(() => { @@ -199,7 +199,7 @@ onUpdated(() => {
}
::v-deep .el-table .el-table__cell {
padding: v-bind('state.size.tablePad') 0px;
padding: v-bind('state.size.tablePad');
}
.my-pagination * {

13
packages/base/item/select.vue

@ -1,8 +1,9 @@ @@ -1,8 +1,9 @@
<template>
<el-select :size="state.size.size" :class="['form-item', full && 'full']" v-model="myValue"
:placeholder="placeholder || t('rule.pleaseSelect')" :filterable="filterable" :disabled="disabled"
:clearable="clearable" @change="$emit('change', myValue)" :teleported="false">
<el-option v-if="dict" v-for="(val, key, i) in state.dict[dict]" :key="key" :value="parse(key)" :label="val" />
:clearable="clearable" @change="$emit('change', myValue)" :teleported="false" :remote="remote"
:remote-method="remoteMethod">
<el-option v-if="dict" v-for="(val, key) in state.dict[dict]" :key="key" :value="parse(key)" :label="val" />
<el-option v-if="stateProp" v-for="item in state[stateProp]" :key="item[valueKey]" :value="item[valueKey]"
:label="item[labelKey]" />
<el-option v-if="maxValue" v-for="index in maxValue" :key="index" :value="index" />
@ -58,6 +59,14 @@ const prop = defineProps({ @@ -58,6 +59,14 @@ const prop = defineProps({
type: String,
default: 'value'
},
remote: {
type: Boolean,
default: false,
},
remoteMethod: {
type: Function,
default: null,
}
});
const emit = defineEmits(["update:modelValue", 'change']);
const myValue = ref<any>(null);

2
packages/manage/common/login.vue

@ -83,8 +83,6 @@ const login = () => { @@ -83,8 +83,6 @@ const login = () => {
});
}
const enter_up = (e) => {
console.log(e);
if (e.keyCode == 13 || e.keyCode == 100) {
login();
}

5
packages/manage/router/index.vue

@ -208,8 +208,11 @@ body { @@ -208,8 +208,11 @@ body {
#app {
.el-input,
.el-textarea {
.el-textarea,
.el-date-editor,
.el-input__wrapper {
--el-input-bg-color: v-bind('state.style.itemBg') !important;
--el-fill-color-blank: v-bind('state.style.itemBg') !important;
--el-input-text-color: v-bind('state.style.color') !important;
}

4
packages/manage/views/user.vue

@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
<script lang="ts" setup>
import { useStore } from "vuex";
import { reactive, onMounted, ref } from "vue";
import { Api, ListTable, SearchRow, NoobInput, TableAction, NoobSelect, NoobButton, ModifyForm, Element, PageResult, PageExample } from "noob-mengyxu";
import { Api, ListTable, SearchRow, NoobInput, TableAction, ModifyForm, Element, PageResult, PageExample } from "noob-mengyxu";
import md5 from "js-md5";
import { useI18n } from "vue3-i18n";
const { t } = useI18n();
@ -66,7 +66,7 @@ const props = [ @@ -66,7 +66,7 @@ const props = [
const rules = {
userId: [new Username()],
password: [new Password()],
roles: [new SimpleRequired('user.prop.2')],
roles: [{type: 'array', required:true, message:t('rule.pleaseSelect') + t('user.prop.2'), trigger: 'blur'}],
name: [new SimpleRequired('user.prop.3'), new Name()],
idCard: [new IdCard()],
phone: [new Phone()],

26
packages/tool/grafana-iframe.vue

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
<template>
<iframe ref="iframe" :src="src" :style="iframeStyle"></iframe>
</template>
<script lang="ts" setup>
import { useStore } from "vuex";
import { reactive, onMounted, ref } from "vue";
import { useI18n } from "vue3-i18n";
const { t } = useI18n();
const { state, commit, dispatch } = useStore();
const props = defineProps({
src: {
type: String,
default: '',
},
});
const iframeStyle = {
height: '100%',
width: '100%',
};
onMounted(() => { });
</script>
<style lang="scss" scoped></style>

3
packages/tool/index.ts

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
import Terminal from './terminal.vue';
import TerminalSplit from './terminal-split.vue';
import Color from './color.vue';
import GrafanaIframe from './grafana-iframe.vue';
export { TerminalSplit, Terminal, Color };
export { TerminalSplit, Terminal, Color, GrafanaIframe };

102
packages/tool/terminal-split.vue

@ -31,6 +31,14 @@ const prop = defineProps({ @@ -31,6 +31,14 @@ const prop = defineProps({
prmt: {
type: String,
default: ">"
},
cols: {
type: Number,
default: 80
},
rows: {
type: Number,
default: 40
}
});
const flag = reactive({
@ -95,31 +103,69 @@ const onKey = e => { @@ -95,31 +103,69 @@ const onKey = e => {
//\x1B ESC
//\x1BOP-\x1B[24~ F1-F12
const key = e.key;
if (key.indexOf("\u001b") !== -1) {
if (key.indexOf("\u001b") !== -1 || !isWsOpen()) {
return;
}
if (isWsOpen()) {
if (key === '\x7F') {
if (text.length > 0) {
term.value.write("\b \b");
text = text.substring(0, text.length - 1)
}
return;
}
if (key == '\r') {
term.value.writeln(key)
if (e.domEvent.ctrlKey) {
text += key;
} else {
sendText(text);
text = "";
}
} else {
text += key
term.value.write(key)
}
if (back(e) || newLine(e) || cancel(e) || copy(e) || paste(e))
return;
text += key;
term.value.write(key);
}
const back = e => {
if (e.key !== '\x7F') {//退
return false;
}
if (text.length > 0) {
term.value.write("\b \b");
text = text.substring(0, text.length - 1)
}
return true;
}
const newLine = (e) => {
const key = e.key;
if (key !== '\r') {//
return false;
}
term.value.writeln(key)
if (e.domEvent.ctrlKey) {
text += key;
} else {
sendText(text);
text = "";
}
return true;
}
const cancel = (e) => {
if (e.key !== '\x1A') {//ctrl+z
return false;
}
if(text){
term.value.writeln("\r");
term.value.write(prop.prmt);
text = "";
}
return true;
}
const copy = e => {
if (e.key !== '\x03') {//ctrl+c
return false;
}
return true;
}
const paste = (e) => {
if (e.key !== '\x16') {//
return false;
}
navigator.clipboard.readText().then(val => {
text += val;
term.value.write(val);
})
return true;
}
const initTerm = () => {
const options: any = {
lineHeight: 1.2,
@ -133,9 +179,9 @@ const initTerm = () => { @@ -133,9 +179,9 @@ const initTerm = () => {
cursorStyle: 'underline',
scrollback: 100,
tabStopWidth: 2,
cols: 80
cols: prop.cols,
rows: prop.rows
}
options.cols = Math.ceil((window.innerWidth - 80) / 20)
term.value = new Terminal(options);
term.value.open(terminal.value);
term.value.onKey(onKey);
@ -166,11 +212,11 @@ const showClear = e => { @@ -166,11 +212,11 @@ const showClear = e => {
document.oncontextmenu = function (e) {
e.preventDefault();
};
navigator.clipboard.readText().then(content => {
term.value.write(content)
text += content;
// sendText(content);
})
// navigator.clipboard.readText().then(content => {
// term.value.write(content)
// text += content;
// sendText(content);
// })
// term.value.clear();
}

1
plugs/http/axios.ts

@ -164,6 +164,7 @@ function handResponse(response, resolve, noMsg, noLoading) { @@ -164,6 +164,7 @@ function handResponse(response, resolve, noMsg, noLoading) {
} else {
if (response.message == 'session timeout') {
router?.push('/login');
response.message = t('http.unLogin');
}
if (response.message == 'no permission') {
response.message = t('http.unPermission');

1
plugs/i18n/zh.ts

@ -82,6 +82,7 @@ export default class Zh { @@ -82,6 +82,7 @@ export default class Zh {
noPermission: '此权限尚未开放,请勿越权访问',
error: '网络错误',
downFail: '下载失败,网络异常!',
unLogin: '请先登录系统',
};
preMenu = {

2
plugs/store/index.ts

@ -76,7 +76,7 @@ export class Mutations { @@ -76,7 +76,7 @@ export class Mutations {
size.tableHeight = size.height - 2 * (mainPad + searchRowPad) - 3 - searchRow - head;
size.pTableHeight = size.tableHeight - size.pageHeight;
size.headLeftWidth = size.width - headRightWidth - 10 + 'px';
size.headLeftWidth = size.width - headRightWidth - 20 + 'px';
};
updateDict = (state, param) => {
state.dict[param[0]] = param[1];

Loading…
Cancel
Save