提交 e2d51c27 编写于 作者: 邱定凯's avatar 邱定凯

update: 更新模板

上级 a3955eaa
......@@ -23,7 +23,17 @@
:disabled="state.detailsModel.{{item.name}}.disabled"
{{/if}}
{{#if item.psEditor.readOnly}}
:readonly="{{item.psEditor.readOnly}}"
:readOnly="{{item.psEditor.readOnly}}"
{{/if}}
{{#if item.psEditor.editorParams}}
{{#jsonParse item.psEditor.editorParams}}
{{#if mode}}
:mode="{{mode}}"
{{/if}}
{{#if valueType}}
:valueType="{{valueType}}"
{{/if}}
{{/jsonParse}}
{{/if}}
{{#if item.psEditor.psAppCodeList}}
codeListTag="{{item.psEditor.psAppCodeList.codeListTag}}"
......
......@@ -31,9 +31,15 @@
{{else if (eq ctrlType 'panel')}}
:disabled="state.detailsModel.{{item.name}}.disabled"
{{/if}}
{{#if item.psEditor.editorParams.multiple}}
:multiple="{{item.psEditor.editorParams.multiple}}"
{{#eq item.psEditor.editorType "DROPDOWNLIST"}}
{{#if item.psEditor.editorParams}}
{{#jsonParse item.psEditor.editorParams}}
{{#if multiple}}
:multiple="{{multiple}}"
{{/if}}
{{/jsonParse}}
{{/if}}
{{/eq}}
{{#if item.psEditor.psNavigateContexts}}
:localContext="{{> @macro/front-end/common/navparam.hbs appNavParams=item.psEditor.psNavigateContexts}}"
{{/if}}
......
......@@ -13,20 +13,24 @@
:deMajorField="state.appDeMajorFieldName"
:deKeyField="state.appDeKeyFieldName"
editorType='{{item.psEditor.editorType}}'
{{#if item.psEditor.editorParams.mode}}
:mode="{{item.psEditor.editorParams.mode}}"
{{/if}}
{{#if item.psEditor.editorParams.valueType}}
:valueType="{{item.psEditor.editorParams.valueType}}"
{{/if}}
{{#and item.psEditor.psAppDataEntity item.psEditor.psAppDEDataSet}}
:acParams="{ serviceName: '{{item.psEditor.psAppDataEntity.codeName}}', interfaceName: '{{item.psEditor.psAppDEDataSet.codeName}}' }"
{{/and}}
{{#and item.psEditor.psAppDEACMode item.psEditor.psAppDEACMode.minorSortPSAppDEField}}
sort="{{lowerCase item.psEditor.psAppDEACMode.minorSortPSAppDEField}},{{#if item.psEditor.psAppDEACMode.minorSortDir}}{{item.psEditor.psAppDEACMode.minorSortDir}}{{else}}asc{{/if}}"
{{/and}}
{{#if item.psEditor.editorParams.multiple}}
:multiple="{{item.psEditor.editorParams.multiple}}"
{{#if item.psEditor.editorParams}}
{{#jsonParse item.psEditor.editorParams}}
{{#if mode}}
:mode="{{mode}}"
{{/if}}
{{#if valueType}}
:valueType="{{valueType}}"
{{/if}}
{{#if multiple}}
:multiple="{{multiple}}"
{{/if}}
{{/jsonParse}}
{{/if}}
{{#if (eq ctrlType 'form')}}
:disabled="state.detailsModel.{{item.codeName}}.disabled"
......@@ -42,7 +46,7 @@
:disabled="state.detailsModel.{{item.name}}.disabled"
{{/if}}
{{#if item.psEditor.readOnly}}
:readonly="{{item.psEditor.readOnly}}"
:readOnly="{{item.psEditor.readOnly}}"
{{/if}}
{{#if item.psEditor.psAppCodeList}}
codeListTag="{{item.psEditor.psAppCodeList.codeListTag}}"
......
......@@ -28,7 +28,7 @@
:disabled="state.detailsModel.{{item.name}}.disabled"
{{/if}}
{{#if item.psEditor.readOnly}}
:readonly="{{item.psEditor.readOnly}}"
:readOnly="{{item.psEditor.readOnly}}"
{{/if}}
{{#if item.psEditor.psNavigateContexts}}
:localContext="{{> @macro/front-end/common/navparam.hbs appNavParams=item.psEditor.psNavigateContexts}}"
......
......@@ -22,16 +22,23 @@
{{else if (eq ctrlType 'panel')}}
:disabled="state.detailsModel.{{item.name}}.disabled"
{{/if}}
{{#if item.psEditor.editorParams.contentType}}
contentType="{{item.psEditor.editorParams.contentType}}"
{{else}}
{{#if item.psEditor.editorParams}}
{{#jsonParse item.psEditor.editorParams}}
{{#if contentType}}
contentType="{{contentType}}"
{{else}}
contentType="RAW"
{{/if}}
{{#if item.psEditor.editorParams.icon}}
iconClass="{{item.psEditor.editorParams.icon}}"
{{/if}}
{{#if item.psEditor.editorParams.caption}}
caption="{{item.psEditor.editorParams.caption}}"
{{/if}}
{{#if iconClass}}
iconClass="{{iconClass}}"
{{/if}}
{{#if imgPath}}
imgPath="{{imgPath}}"
{{/if}}
{{#if caption}}
caption="{{caption}}"
{{/if}}
{{/jsonParse}}
{{/if}}
{{#if (or (eq ctrlType 'form') (eq ctrlType 'panel'))}}
:value="state.data.{{item.psEditor.name}}"
......
<script setup lang="ts">
import { EditorBase, IActionParam, IParam, IContext, typeOf } from '@core';
import { EditorBase, IActionParam, IParam, IContext, typeOf, deepCopy} from '@core';
import { computed, onBeforeMount, ref, Ref } from 'vue';
interface ListBoxProps {
/**
......@@ -26,14 +26,6 @@ interface ListBoxProps {
*/
data: IParam;
/**
* 代码表值分隔符
*
* @type {string}
* @memberof ListBoxProps
*/
valueSeparator?: string;
/**
* 模式(数字或者字符串)
*
......@@ -65,7 +57,14 @@ interface ListBoxProps {
* @memberof ListBoxProps
*/
codeListType?: string;
/**
* 代码表值分隔符
*
* @type {string}
* @memberof ListBoxProps
*/
valueSeparator?: string;
/**
* 表单服务(todo 编辑器应该脱钩)
*
......@@ -159,7 +158,7 @@ interface ListBoxProps {
*
* @type {boolean}
*/
readonly?: boolean;
readOnly?: boolean;
}
interface EditorEmit {
......@@ -168,7 +167,7 @@ interface EditorEmit {
const props = withDefaults(defineProps<ListBoxProps>(), {
disabled: false,
readonly: false,
readOnly: false,
multiple: false,
valueType: 'string',
valueSeparator: ',',
......@@ -186,7 +185,9 @@ const selectArray: Ref<boolean> = computed(() => {
if (props.multiple) {
if (Object.is('LISTBOX', props.editorType)) {
if (Object.is(props.mode, 'string')) {
return props.value.split(props.valueSeparator);
if(props.value) {
return props.value.split(props.valueSeparator);
}
} else {
let selectsArray: Array<any> = [];
let num: number = parseInt(props.value, 10);
......@@ -274,22 +275,25 @@ const formatCodeList = (items: Array<any>) => {
}
};
const loadData = () => {
let _navContext = deepCopy(navContext);
let _navViewParam = deepCopy(navViewParam);
if (!props.service) {
console.warn('部件服务错误');
} else if (!props.acParams?.serviceName) {
console.warn('未拥有serviceName参数');
} else if (!props.acParams?.interfaceName) {
console.warn('未拥有interfaceName参数');
App.getNotificationService().warning({ message: '获取数据失败', desription: '部件服务不存在' });
} else if (!props.acParams) {
App.getNotificationService().warning({ message: '获取数据失败', desription: '查询参数不存在' });
} else {
const { serviceName, interfaceName } = props.acParams;
props.service
.getItems(props.acParams.serviceName, props.acParams.interfaceName, navContext, navViewParam)
.getItems(serviceName, interfaceName, _navContext, _navViewParam)
.then((response: any) => {
if (response) {
items.value = [...response];
if (!response) {
App.getNotificationService().warning({ message: '获取数据失败', desription: '' });
return;
}
items.value = [...response];
})
.catch((response: any) => {
console.error('加载数据失败');
.catch((error: any) => {
App.getNotificationService().warning({ message: '获取数据失败', desription: error?.message });
});
}
};
......@@ -307,10 +311,10 @@ onBeforeMount(() => {
<template>
<div :class="['app-editor-container', 'app-list-box', `app-list-box-${name}`]">
<template v-if="multiple">
<a-checkbox-group @change="onChange" :value="selectArray" :options="items" :disabled="disabled || readonly" />
<a-checkbox-group @change="onChange" :value="selectArray" :options="items" :disabled="disabled || readOnly" />
</template>
<template v-else>
<a-radio-group @change="onChange" :value="value" :options="items" :disabled="disabled || readonly" />
<a-radio-group @change="onChange" :value="value" :options="items" :disabled="disabled || readOnly" />
</template>
</div>
</template>
......@@ -87,7 +87,7 @@ interface RadioGroupProps {
*
* @type {boolean}
*/
readonly?: boolean;
readOnly?: boolean;
}
interface EditorEmit {
......@@ -96,7 +96,7 @@ interface EditorEmit {
const props = withDefaults(defineProps<RadioGroupProps>(), {
disabled: false,
readonly: false,
readOnly: false,
});
const emit = defineEmits<EditorEmit>();
const { handleEditorNavParams, loadCodeListData } = new EditorBase();
......@@ -120,7 +120,7 @@ onBeforeMount(() => {
<template>
<div :class="['app-editor-container', 'app-radio-group', `app-radio-group-${name}`]">
<a-radio-group @change="onChange" :value="value" :options="items" :disabled="disabled || readonly"></a-radio-group>
<a-radio-group @change="onChange" :value="value" :options="items" :disabled="disabled || readOnly"></a-radio-group>
</div>
</template>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册