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.
 
 
 
 
 
 

134 lines
3.7 KiB

<template>
<w-grid
ref="gridRef"
dense-body
class="px-1"
hide-bottom
:config-button="false"
dnd-mode="server"
selection="multiple"
:checkbox-selection="true"
db-click-operation="edit"
:tree="false"
:fetch-data-url="Environment.apiContextPath('/api/re/model/parameter/option/findByParameterId?parameterId=' + parameter.id)"
:data-url="Environment.apiContextPath('/api/re/model/parameter/option')"
:pageable="false"
:sort-by="['order']"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="[
'refresh',
'separator',
{
extend: 'add',
enableIf: (arg) => {
return !readOnly;
},
},
{
extend: 'clone',
enableIf: (arg) => {
return !readOnly && arg.selected;
},
},
{
extend: 'edit',
enableIf: (arg) => {
return !readOnly && arg.selected;
},
},
{
extend: 'remove',
enableIf: (arg) => {
return !readOnly && arg.selected;
},
},
'separator',
'view',
'separator',
'export',
]"
:columns="[
{ width: 60, name: 'order', label: $t('order'), align: 'right', showIf: false },
{ width: 100, name: 'inputValue', label: $t('re.option.grid.entity.inputValue') },
{ width: 100, name: 'value', label: $t('re.option.grid.entity.value') },
{ width: 400, name: 'title', label: $t('re.option.grid.entity.title') },
{ width: '100%', name: 'description', label: $t('description') },
]"
:editor="{
dialog: {
width: '600px',
},
form: {
colsNum: 1,
fields: [
{ name: 'parameter', label: 'parameter', type: 'w-text', defaultValue: parameter.id, showIf: false },
{ name: 'id', label: $t('id'), type: 'w-text', showIf: false },
{
name: 'inputValue',
label: $t('re.option.grid.entity.inputValue'),
type: 'w-text',
},
{
name: 'value',
label: $t('re.option.grid.entity.value'),
type: 'w-text',
},
{
name: 'title',
label: $t('re.option.grid.entity.title'),
type: 'w-text',
},
{
name: 'description',
label: $t('description'),
type: 'w-text',
},
],
},
}"
:viewer="{
panel: {
columnNum: 1,
fields: [
{ name: 'id', label: $t('id') },
{ name: 'order', label: $t('order') },
{ name: 'inputValue', label: $t('re.option.grid.entity.inputValue') },
{ name: 'value', label: $t('re.option.grid.entity.value') },
{ name: 'title', label: $t('re.option.grid.entity.title') },
{ name: 'description', label: $t('description') },
...CorporationAuditorEntityManager.getViewerFields(),
],
},
}"
></w-grid>
</template>
<script setup lang="ts">
import 'tailwindcss/utilities.css';
import { ref, onMounted } from 'vue';
import { Environment, Formater, CorporationAuditorEntityManager } from 'platform-core';
const props = defineProps({
fetchDataUrl: { type: String, default: '' },
dataUrl: { type: String, default: '' },
parameter: { type: Object, default: undefined },
readOnly: { type: Boolean, default: false },
});
const emit = defineEmits<{
(e: 'rowClick', evt: Event, row: any, index: number): void;
(e: 'beforeRequestData', requestParams: URLSearchParams | any, callback: any): void;
}>();
const gridRef = ref();
const refresh = () => {
gridRef.value.refresh();
};
onMounted(() => {
gridRef.value.refresh();
});
defineExpose({
refresh,
});
</script>