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

update: 更新模板

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