基于vue3.0和element-plus的组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.3 KiB

2 years ago
<template>
<SearchRow :title="t('buffer.title')" :del="false" @query="query" :add="false" :query="false">
<template #left>
<NoobButton type="success" :icon="delete" @click="clean().then(query)">
{{ t('buffer.clean') }}
</NoobButton>
</template>
</SearchRow>
<ListTable @query="query" :props="props" :data="result">
<template #value="{ row }">
<Descriptions :data="row.value" />
</template>
<template #action="{ row }">
<TableAction @modify="delay(row)" @del="delate(row)" />
</template>
</ListTable>
</template>
<script lang="ts" setup>
import { useStore } from "vuex";
2 years ago
import { onMounted, ref } from "vue";
import { Api, ListTable, SearchRow, NoobButton, TableAction, Element, Descriptions } from "noob-mengyxu";
import { useI18n } from "vue3-i18n";
const { t } = useI18n();
const { state, commit, dispatch } = useStore();
2 years ago
const { prompt } = Element;
const { list, clean, set, del } = Api.buffer;
const result = ref([]);
const props = [
{ code: 'value', type: "expand", slot: true },
{ i18n: 'buffer.prop.1', code: 'key', width: 200 },
{ i18n: 'buffer.prop.2', code: 'effective', width: 100, dict: 'boolean' },
{ i18n: 'buffer.prop.3', code: 'loseTime', width: 180 },
2 years ago
{ i18n: 'buffer.prop.4', code: 'action', width: 130, slot: true },
]
const query = () => {
list().then((rsp: any) => result.value = rsp)
}
const delate = (row) => {
Element.confirm(t('buffer.delete.0'), t('buffer.delete.1')).then(() => {
del(row).then(query);
})
}
const delay = row => {
prompt(t(''), t(''), /^((\d{2}(([02468][048])|([13579][26]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9])))))|(\d{2}(([02468][1235679])|([13579][01345789]))[\-\/\s]?((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\s((([0-1][0-9])|(2?[0-3]))\:([0-5]?[0-9])((\s)|(\:([0-5]?[0-9])))))?$/, '时间格式不正确').then(value => {
value && set({ key: row.key, loseTime: value }).then(query)
2 years ago
})
}
onMounted(() => {
query();
dispatch("getDictMap", ['boolean'])
2 years ago
});
</script>
<style lang="scss" scoped></style>