Browse Source

update

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

2
package.json

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

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

@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
<el-table ref="table" :size="state.size.size" :data="page ? data.data : data"
@selection-change="selectionChange"
: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)"
:type="item.type" :min-width="item.width" :width="item.type ? item.width : ''" :fixed="item.fixed"
@ -72,6 +72,10 @@ const prop = defineProps({ @@ -72,6 +72,10 @@ const prop = defineProps({
type: Object,
default: null,
},
lazy: {
type: Boolean,
default: false,
},
});
const emit = defineEmits(["query", "selection-change"]);
@ -158,6 +162,10 @@ const select = (n) => { @@ -158,6 +162,10 @@ const select = (n) => {
}
}
const load = (dict, node, resolve) => {
resolve(dict.child);
}
watch(prop, select);
onMounted(() => { });

20
packages/manage/views/dictionary.vue

@ -4,8 +4,7 @@ @@ -4,8 +4,7 @@
<NoobInput v-model="example.code" :placeholder="t('dict.example.1')" />
<NoobSelect v-model="example.status" dict="active_status" :placeholder="t('dict.example.2')" />
</SearchRow>
<ListTable @query="query" :props="props" :example="example" :page="true" :data="result" rowKey="code"
:treeProps="{ children: 'children' }">
<ListTable @query="query" :props="props" :example="example" :page="true" :data="result" rowKey="code" lazy>
<template #status="{ row }">
<div slot="reference" class="name-wrapper">
<NoobTag v-if="row.status == 'A'">
@ -17,13 +16,14 @@ @@ -17,13 +16,14 @@
</div>
</template>
<template #action="{ row }">
<TableAction :add="row.parent == null" @modify="modify(row)" @del="delate(row)" @add="addDict(row)"/>
<TableAction :add="row.parent == null" @modify="modify(row)" @del="delate(row)" @add="addDict(row)" />
</template>
</ListTable>
<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">
<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>
<NoobInput v-model="dict.code" full :placeholder="t('rule.pleaseEnter') + t('dict.prop.1')"
:disabled="!flag.add" />
@ -72,7 +72,14 @@ const rules = { @@ -72,7 +72,14 @@ const rules = {
}
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) => {
@ -111,5 +118,4 @@ onMounted(() => { @@ -111,5 +118,4 @@ onMounted(() => {
});
</script>
<style lang="scss" scoped>
//@import url(); css
</style>
//@import url(); css</style>
Loading…
Cancel
Save