Browse Source
1、树拖拽会出现清除孩子的bug 2、w-grid 分组,需增加 group-by-title 属性,用于生成分组标题的函数 3、w-info 增加labelWidth与valueWidth属性main
12 changed files with 225 additions and 132 deletions
@ -1,70 +1,76 @@ |
|||||
<template> |
<template> |
||||
<div class="h-full"> |
|
||||
<w-grid |
<w-grid |
||||
ref="gridRef" |
:title="$t('menu.developer.springboot.bean')" |
||||
title="示例列表" |
:checkbox-selection="false" |
||||
:data-url="Environment.apiContextPath('/api/system/application')" |
:fetch-data-url="Environment.apiContextPath('/api/developer/springboot/beans')" |
||||
db-click-operation="testAdd" |
:pageable="false" |
||||
selected-mode="cell" |
:toolbar-actions="['refresh', 'separator', 'view', 'separator', 'export']" |
||||
:cell-selected="true" |
group-mode="alone" |
||||
:toolbar-actions="[ |
group-by-field="scope" |
||||
'add', |
:columns="[ |
||||
|
{ width: 500, name: 'name', label: $t('name') }, |
||||
|
{ width: 400, name: 'type', label: $t('className'), format: Formater.simpleClassName() }, |
||||
{ |
{ |
||||
extend: 'add', |
width: 100, |
||||
name: 'testAdd', |
name: 'scope', |
||||
click: (args) => { |
label: $t('scope'), |
||||
const cell = args.grid.getSelectedCell(); |
sortable: false, |
||||
console.info('cell=========', args); |
format: (val) => { |
||||
|
if (val === 'singleton') { |
||||
|
return '测试'; |
||||
|
} else if (val === 'prototype') { |
||||
|
return '测试2'; |
||||
|
} |
||||
|
return val; |
||||
}, |
}, |
||||
}, |
}, |
||||
[ |
]" |
||||
'remove', |
:viewer="{ |
||||
|
panel: { |
||||
|
columnNum: 2, |
||||
|
labelWidth: 200, |
||||
|
valueWidth: '100%', |
||||
|
fields: [ |
||||
|
{ width: 100, name: 'name', label: $t('name') }, |
||||
|
{ width: 100, name: 'context', label: $t('context') }, |
||||
{ |
{ |
||||
extend: 'edit', |
width: 100, |
||||
name: 'testEdit', |
name: 'scope', |
||||
click: (args) => { |
label: $t('scope'), |
||||
console.info('testEdit======', args); |
}, |
||||
|
{ width: 100, name: 'type', label: $t('className'), format: Formater.none() }, |
||||
|
{ width: 100, name: 'resource', label: $t('resource') }, |
||||
|
{ |
||||
|
width: 100, |
||||
|
name: 'aliases', |
||||
|
label: $t('aliases'), |
||||
|
format: (aliases) => { |
||||
|
aliases = aliases || []; |
||||
|
let result = ''; |
||||
|
for (const aliase of aliases) { |
||||
|
result += aliase + '<br/>'; |
||||
|
} |
||||
|
return result; |
||||
}, |
}, |
||||
}, |
}, |
||||
], |
|
||||
'query', |
|
||||
]" |
|
||||
:query-form-cols-num="12" |
|
||||
:query-form-fields="[{ colSpan: 3, name: 'code', label: '编码', type: 'w-text' }]" |
|
||||
:columns="[ |
|
||||
{ name: 'code', label: '编码', type: 'w-text' }, |
|
||||
{ name: 'name', label: '名称', type: 'w-text' }, |
|
||||
{ |
{ |
||||
name: 'enable', |
width: 100, |
||||
label: '状态', |
name: 'dependencies', |
||||
format: Formater.enableTag(), |
label: $t('dependencies'), |
||||
|
format: (dependencies) => { |
||||
|
dependencies = dependencies || []; |
||||
|
let result = ''; |
||||
|
for (const dependency of dependencies) { |
||||
|
result += dependency + '<br/>'; |
||||
|
} |
||||
|
return result; |
||||
}, |
}, |
||||
{ name: 'lastModifier', label: '最后修改人', align: 'center' }, |
|
||||
{ name: 'lastModifyDate', label: '最后修改日期', align: 'center' }, |
|
||||
]" |
|
||||
:editor="{ |
|
||||
dialog: { |
|
||||
width: '80%', |
|
||||
height: '80%', |
|
||||
}, |
}, |
||||
form: { |
|
||||
colsNum: 2, |
|
||||
fields: [ |
|
||||
{ name: 'code', label: '编码', type: 'w-text' }, |
|
||||
{ name: 'name', label: '名称', type: 'w-text' }, |
|
||||
], |
], |
||||
}, |
}, |
||||
}" |
}" |
||||
@row-click="rowClick" |
></w-grid> |
||||
> |
|
||||
</w-grid> |
|
||||
</div> |
|
||||
</template> |
</template> |
||||
|
|
||||
<script setup lang="ts"> |
<script setup lang="ts"> |
||||
import { ref } from 'vue'; |
import { Environment, Formater, $t } from '@/platform'; |
||||
import { Environment, Formater } from '@/platform'; |
|
||||
|
|
||||
const gridRef = ref(); |
|
||||
const rowClick = () => {}; |
|
||||
</script> |
</script> |
||||
|
@ -1,69 +1,50 @@ |
|||||
<template> |
<template> |
||||
<div class="q-pa-md"> |
<div class="q-pa-md"> |
||||
<q-table v-model:selected="selected" title="Treats" row-key="name" selection="multiple" :rows="rows" :columns="columns"> |
<q-table |
||||
<template #body="scope"> |
v-model:selected="selected" |
||||
<q-tr ref="trRef" class="selected" :props="scope"> |
title="bean" |
||||
<q-td class="text-center" style="padding: 0; width: 50px"> |
row-key="name" |
||||
<q-checkbox v-model="scope.row['selected']" flat @update:model-value="updateTicked($event, scope.row)" /> |
selection="multiple" |
||||
</q-td> |
:rows="rows" |
||||
<q-td v-for="col in scope.cols" :key="col.name" :props="scope"> |
:columns="columns" |
||||
<GridFormat :value="col.value"></GridFormat> |
:pagination="{ |
||||
</q-td> |
rowsPerPage: 0, |
||||
</q-tr> |
}" |
||||
</template> |
></q-table> |
||||
</q-table> |
|
||||
</div> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script setup lang="ts"> |
<script setup lang="ts"> |
||||
import { ref } from 'vue'; |
import { ref, onMounted } from 'vue'; |
||||
import { Tools } from '@/platform'; |
import { Tools, axios, Environment } from '@/platform'; |
||||
import GridFormat from './GridForamt.vue'; |
|
||||
|
|
||||
const selected = ref([]); |
const selected = ref([]); |
||||
|
|
||||
const updateTicked = (event, row) => { |
|
||||
row['selected'] = !row['selected']; |
|
||||
}; |
|
||||
|
|
||||
const columns = [ |
const columns = [ |
||||
{ |
{ |
||||
name: 'name', |
name: 'name', |
||||
required: true, |
label: '名称', |
||||
label: 'Dessert (100g serving)', |
field: 'field', |
||||
align: 'left', |
align: 'left', |
||||
field: (row) => row.name, |
|
||||
sortable: true, |
|
||||
}, |
}, |
||||
{ name: 'calories', align: 'center', label: 'Calories', field: 'calories', sortable: true }, |
|
||||
{ |
{ |
||||
name: 'fat', |
name: 'type', |
||||
label: 'Fat (g)', |
label: '类型', |
||||
field: 'fat', |
field: 'type', |
||||
sortable: true, |
align: 'left', |
||||
format: (val, row) => { |
|
||||
console.info('format.val====', val); |
|
||||
return val; |
|
||||
}, |
|
||||
}, |
}, |
||||
{ name: 'carbs', label: 'Carbs (g)', field: 'carbs' }, |
|
||||
{ name: 'protein', label: 'Protein (g)', field: 'protein' }, |
|
||||
{ name: 'sodium', label: 'Sodium (mg)', field: 'sodium' }, |
|
||||
{ name: 'calcium', label: 'Calcium (%)', field: 'calcium', sortable: true, sort: (a, b) => parseInt(a, 10) - parseInt(b, 10) }, |
|
||||
{ name: 'iron', label: 'Iron (%)', field: 'iron', sortable: true, sort: (a, b) => parseInt(a, 10) - parseInt(b, 10) }, |
|
||||
]; |
|
||||
|
|
||||
const rows = [ |
|
||||
{ |
{ |
||||
name: 'Frozen Yogurt', |
name: 'scope', |
||||
calories: 159, |
label: '作用域', |
||||
fat: 6.0, |
field: 'scope', |
||||
carbs: 24, |
align: 'left', |
||||
protein: 4.0, |
|
||||
sodium: 87, |
|
||||
calcium: '14%', |
|
||||
iron: '1%', |
|
||||
selected: false, |
|
||||
}, |
}, |
||||
]; |
]; |
||||
|
|
||||
|
const rows = ref([]); |
||||
|
|
||||
|
onMounted(async () => { |
||||
|
const data = await axios.get(Environment.apiContextPath('/api/developer/springboot/beans')); |
||||
|
rows.value = data.data; |
||||
|
}); |
||||
</script> |
</script> |
||||
|
Loading…
Reference in new issue