Browse Source

update

master
许孟阳 1 year ago
parent
commit
6b38ec6b72
  1. 2
      package.json
  2. 10
      packages/base/data/list-table.vue
  3. 18
      packages/manage/views/dictionary.vue

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "noob-mengyxu", "name": "noob-mengyxu",
"version": "0.3.7", "version": "0.3.8",
"main": "index.ts", "main": "index.ts",
"module": "index.ts", "module": "index.ts",
"keywords": [ "keywords": [

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

@ -3,7 +3,7 @@
<el-table ref="table" :size="state.size.size" :data="page ? data.data : data" <el-table ref="table" :size="state.size.size" :data="page ? data.data : data"
@selection-change="selectionChange" @selection-change="selectionChange"
:height="height || (page ? state.size.pTableHeight : state.size.tableHeight)" highlight-current-row :height="height || (page ? state.size.pTableHeight : state.size.tableHeight)" highlight-current-row
:row-key="rowKey" :tree-porps="treeProps"> :row-key="rowKey" :tree-porps="treeProps" :lazy="lazy" :load="load">
<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"
@ -72,6 +72,10 @@ const prop = defineProps({
type: Object, type: Object,
default: null, default: null,
}, },
lazy: {
type: Boolean,
default: false,
},
}); });
const emit = defineEmits(["query", "selection-change"]); const emit = defineEmits(["query", "selection-change"]);
@ -158,6 +162,10 @@ const select = (n) => {
} }
} }
const load = (dict, node, resolve) => {
resolve(dict.child);
}
watch(prop, select); watch(prop, select);
onMounted(() => { }); onMounted(() => { });

18
packages/manage/views/dictionary.vue

@ -4,8 +4,7 @@
<NoobInput v-model="example.code" :placeholder="t('dict.example.1')" /> <NoobInput v-model="example.code" :placeholder="t('dict.example.1')" />
<NoobSelect v-model="example.status" dict="active_status" :placeholder="t('dict.example.2')" /> <NoobSelect v-model="example.status" dict="active_status" :placeholder="t('dict.example.2')" />
</SearchRow> </SearchRow>
<ListTable @query="query" :props="props" :example="example" :page="true" :data="result" rowKey="code" <ListTable @query="query" :props="props" :example="example" :page="true" :data="result" rowKey="code" lazy>
:treeProps="{ children: 'children' }">
<template #status="{ row }"> <template #status="{ row }">
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<NoobTag v-if="row.status == 'A'"> <NoobTag v-if="row.status == 'A'">
@ -23,7 +22,8 @@
<el-dialog :title="t('base.add') + t('dict.name')" v-model="flag.modify" :close-on-click-modal="false" top="15vh" <el-dialog :title="t('base.add') + t('dict.name')" v-model="flag.modify" :close-on-click-modal="false" top="15vh"
width="40%" @keydown.enter.native="confirm"> width="40%" @keydown.enter.native="confirm">
<ModifyForm ref="form" :param="dict" :rules="rules" :items="items" @confirm="confirm" @cancel="flag.modify = false"> <ModifyForm ref="form" :param="dict" :rules="rules" :items="items" @confirm="confirm"
@cancel="flag.modify = false">
<template #code> <template #code>
<NoobInput v-model="dict.code" full :placeholder="t('rule.pleaseEnter') + t('dict.prop.1')" <NoobInput v-model="dict.code" full :placeholder="t('rule.pleaseEnter') + t('dict.prop.1')"
:disabled="!flag.add" /> :disabled="!flag.add" />
@ -72,7 +72,14 @@ const rules = {
} }
const query = () => { const query = () => {
list(example).then((rsp: any) => result.value = rsp) list(example).then((rsp: any) => {
result.value = rsp;
result.value.data.forEach((i: any) => {
i.child = i.children;
i.children = [];
i.hasChildren = true;
})
})
} }
const addDict = (row) => { const addDict = (row) => {
@ -111,5 +118,4 @@ onMounted(() => {
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
//@import url(); css //@import url(); css</style>
</style>
Loading…
Cancel
Save