提交 d612298f 编写于 作者: RedPig97's avatar RedPig97

update: 更新

上级 59b4e4d1
......@@ -11,49 +11,39 @@
:readonly="{{item.psEditor.readOnly}}"
{{/if}}
{{#eq item.psEditor.editorType "DATEPICKEREX"}}
valueFormat="yyyy-MM-dd HH:mm:ss"
picker="date"
mode="date"
dateFormat="YYYY-MM-DD HH:mm:ss"
dateType="dateTime"
{{/eq}}
{{#eq item.psEditor.editorType "DATEPICKEREX_NOTIME"}}
valueFormat="yyyy-MM-dd"
picker="date"
mode="date"
dateFormat="YYYY-MM-DD"
dateType="date"
{{/eq}}
{{#eq item.psEditor.editorType "DATEPICKER"}}
valueFormat="yyyy-MM-dd HH:mm:ss"
picker="date"
mode="time"
dateFormat="YYYY-MM-DD HH:mm:ss"
dateType="dateTime"
{{/eq}}
{{#eq item.psEditor.editorType "DATEPICKEREX_HOUR"}}
valueFormat="yyyy-MM-dd HH"
picker="date"
mode="time"
dateFormat="YYYY-MM-DD HH"
dateType="dateTime"
{{/eq}}
{{#eq item.psEditor.editorType "DATEPICKEREX_MINUTE"}}
valueFormat="yyyy-MM-dd HH:mm"
picker="time"
mode="date"
dateFormat="YYYY-MM-DD HH:mm"
dateType="dateTime"
{{/eq}}
{{#eq item.psEditor.editorType "DATEPICKEREX_SECOND"}}
valueFormat="yyyy-MM-dd HH:mm:ss"
picker="time"
mode="date"
dateFormat="YYYY-MM-DD HH:mm:ss"
dateType="dateTime"
{{/eq}}
{{#eq item.psEditor.editorType "DATEPICKEREX_NODAY"}}
valueFormat="HH:mm:ss"
picker="date"
mode="date"
dateFormat="HH:mm:ss"
dateType="time"
{{/eq}}
{{#eq item.psEditor.editorType "DATEPICKEREX_NODAY_NOSECOND"}}
valueFormat="HH:mm"
picker="date"
mode="date"
dateFormat="HH:mm"
dateType="time"
{{/eq}}
{{#eq item.psEditor.editorType "DATEPICKEREX_NOSECOND"}}
valueFormat="yyyy-MM-dd HH:mm"
picker="date"
mode="date"
dateFormat="YYYY-MM-DD HH:mm"
dateType="dateTime"
{{/eq}}
@editorEvent="handleEditorEvent"/>
<script setup lang="ts">
import { onBeforeMount, Ref, ref } from "vue";
import { handleEditorNavParams, deepCopy, IParam, IActionParam } from "@ibiz-core";
import { deepCopy, IParam, IActionParam, EditorBase } from "@ibiz-core";
interface AutoCompleteProps {
/**
* @description 表单数据或表格行数据
......@@ -84,6 +84,7 @@ interface AutoCompleteProps {
interface EditorEmit {
(name: "editorEvent", value: IActionParam): void;
}
const { handleEditorNavParams } = new EditorBase();
const props = withDefaults(defineProps<AutoCompleteProps>(), {
deMajorField: "srfmajortext",
deKeyField: "srfkey",
......
<script setup lang="ts">
import {
handleEditorNavParams,
handleLevelCodeList,
loadCodeListData,
EditorBase,
IActionParam,
IParam
} from "@ibiz-core";
......@@ -132,6 +130,7 @@ const props = withDefaults(defineProps<CheckboxListProps>(), {
mode: "string",
});
const emit = defineEmits<EditorEmit>();
const { handleEditorNavParams, handleLevelCodeList, loadCodeListData } = new EditorBase();
const { navContext, navViewParam } = handleEditorNavParams(props);
let items: Ref<IParam[]> = ref([]);
const selectArray: Ref<boolean> = computed(() => {
......
<script setup lang="ts">
import { onBeforeMount, Ref, ref } from "vue";
import { handleEditorNavParams, deepCopy, openLinkView, openPickUpView, IParam, IActionParam } from "@ibiz-core";
import { deepCopy, IParam, IActionParam, EditorBase } from "@ibiz-core";
interface DataPickerProps {
/**
* @description 编辑器名称
......@@ -95,6 +95,7 @@ const props = withDefaults(defineProps<DataPickerProps>(), {
deKeyField: 'srfkey',
});
const emit = defineEmits<EditorEmit>();
const { handleEditorNavParams, openLinkView, openPickUpView } = new EditorBase();
const { navContext, navViewParam } = handleEditorNavParams(props);
let items: Ref<any[]> = ref([]);
......@@ -200,7 +201,7 @@ onBeforeMount(() => {
<select-outlined v-if="linkView" @click="openLinkView"/>
</template>
<a-select-option v-for="(item, index) in items" :key="index" :value="item[deKeyField]">
{{item[deMajorField]}}
\{{item[deMajorField]}}
</a-select-option>
</a-select>
</template>
......
<script setup lang="ts">
import { IActionParam } from "@ibiz-core";
import { computed, Ref } from "vue";
import { IActionParam } from '@ibiz-core';
// import dayjs from 'ant-design-vue/lib/time-picker/dayjs';
import { computed, Ref } from 'vue';
import dayjs, { Dayjs } from 'dayjs';
interface DatePickerProps {
/**
* checked选中状态
*
* @type {number}
* @type {string}
* @memberof DatePickerProps
*/
value: number;
value: string;
/**
* checked选中状态
......@@ -19,20 +21,20 @@ interface DatePickerProps {
name: string;
/**
* 日期面板的状态
* 设置选择器类型
*
* @type {string}
* @memberof DatePickerProps
*/
mode: 'time' | 'date' | 'month' | 'year' | 'decade';
dateFormat: string;
/**
* 设置选择器类型
/**
* 时间类型
*
* @type {string}
* @memberof DatePickerProps
*/
picker: 'date' | 'week' | 'month' | 'quarter' | 'year';
dateType: 'time' | 'date' | 'dateTime';
/**
* 提示信息
......@@ -56,37 +58,71 @@ interface DatePickerProps {
* @type {boolean}
*/
readonly?: boolean;
}
interface EditorEmit {
(name: "editorEvent", value: IActionParam): void;
(name: 'editorEvent', value: IActionParam): void;
}
const props = withDefaults(defineProps<DatePickerProps>(), {
disabled: false,
readonly: false,
picker: 'date',
dateType: 'date',
dateFormat: 'yyyy-MM-dd HH:mm:ss',
placeholder: '请选择日期',
});
const emit = defineEmits<EditorEmit>();
const onChange = (value: number) => {
emit("editorEvent", {
const curValue: Ref<any> = props.value ? ref<Dayjs>(dayjs(props.value, props.dateFormat)) : ref('');
const onChange = (date: string, dateString: string) => {
emit('editorEvent', {
tag: props.name,
action: "valueChange",
data: value ? 1 : 0,
action: 'valueChange',
data: dateString,
});
};
</script>
<template>
<a-date-picker
:class="['app-editor-container', `app-date-picker-${name}`]"
:mode="mode"
:picker="picker"
:placeholder="placeholder"
:inputReadOnly="readonly"
:disabled="disabled"/>
<template v-if="dateType === 'time'">
<a-time-picker
:class="['app-date-picker', `app-date-picker--${name}`]"
v-model:value="curValue"
:format="dateFormat"
:placeholder="placeholder"
:inputReadOnly="readonly"
:disabled="disabled"
@change="onChange"
/>
</template>
<template v-else-if="dateType === 'date'">
<a-date-picker
:class="['app-date-picker', `app-date-picker--${name}`]"
v-model:value="curValue"
:format="dateFormat"
picker="date"
:placeholder="placeholder"
:inputReadOnly="readonly"
:disabled="disabled"
@change="onChange"
/>
</template>
<template v-else>
<a-date-picker
showTime
:class="['app-date-picker', `app-date-picker--${name}`]"
v-model:value="curValue"
:format="dateFormat"
:placeholder="placeholder"
:inputReadOnly="readonly"
:disabled="disabled"
@change="onChange"
/>
</template>
</template>
<style scoped>
<style lang="scss">
.app-date-picker {
width: 100%;
}
</style>
<script setup lang="ts">
import { onBeforeMount, Ref, ref } from "vue";
import { IActionParam, IParam, handleEditorNavParams, typeOf, loadCodeListData, handleLevelCodeList } from "@ibiz-core";
import { IActionParam, IParam, typeOf, EditorBase } from "@ibiz-core";
interface DropdownListProps {
/**
......@@ -79,6 +79,7 @@ const props = withDefaults(defineProps<DropdownListProps>(), {
})
const emit = defineEmits<EditorEmit>()
const { handleEditorNavParams, loadCodeListData, handleLevelCodeList } = new EditorBase();
const { navContext, navViewParam } = handleEditorNavParams(props);
let curValue: Ref<any> = ref(
props.multiple ?
......
<script setup lang="ts">
import {
handleEditorNavParams,
handleLevelCodeList,
loadCodeListData,
IActionParam,
IParam
IParam,
EditorBase
} from "@ibiz-core";
import { onBeforeMount, ref, Ref } from "vue";
interface RadioGroupProps {
......@@ -105,6 +103,7 @@ const props = withDefaults(defineProps<RadioGroupProps>(), {
readonly: false,
});
const emit = defineEmits<EditorEmit>();
const { handleEditorNavParams, loadCodeListData, handleLevelCodeList } = new EditorBase();
const { navContext, navViewParam } = handleEditorNavParams(props);
let items: Ref<IParam[]> = ref([]);
......
<script setup lang="ts">
import { handleEditorNavParams, IActionParam } from "@ibiz-core";
import { EditorBase, IActionParam } from "@ibiz-core";
import { onBeforeMount, ref, Ref } from "vue";
interface RawProps {
/**
......@@ -52,6 +52,7 @@ const props = withDefaults(defineProps<RawProps>(), {
contentType: "RAW",
});
const emit = defineEmits<EditorEmit>();
const { handleEditorNavParams } = new EditorBase();
const content: Ref<string> = ref("");
const { navContext, navViewParam } = handleEditorNavParams(props);
......@@ -82,9 +83,9 @@ onBeforeMount(() => {
<template>
<div :class="['app-editor-container', `app-raw-${name}`]">
<div class="raw-caption" v-if="caption">{{ caption }}</div>
<div class="raw-caption" v-if="caption">\{{ caption }}</div>
<div v-if="Object.is(contentType, 'RAW')">
{{ content }}
\{{ content }}
</div>
<div v-else-if="Object.is(contentType, 'HTML')" v-html="content" />
<div v-else-if="Object.is(contentType, 'IMAGE')">
......
<script setup lang="ts">
import { handleEditorNavParams, loadCodeListData, IParam } from "@ibiz-core";
import { IParam, EditorBase } from "@ibiz-core";
import { onBeforeMount, ref, Ref } from "vue";
interface SpanProps {
/**
......@@ -93,6 +93,7 @@ const props = withDefaults(defineProps<SpanProps>(), {
unitName: "",
precision: 2,
});
const { handleEditorNavParams, loadCodeListData } = new EditorBase();
const { navContext, navViewParam } = handleEditorNavParams(props);
let text: Ref<string> = ref("");
let textFormat: Ref<string> = ref("");
......@@ -133,7 +134,7 @@ onBeforeMount(() => {
<template>
<div :class="['app-editor-container', `app-span-${name}`]">
<span>{{text}}</span>
<span>\{{text}}</span>
</div>
</template>
......
<script setup lang="ts">
import { getDownloadUrl, getRequestingHeader, getUploadUrl, IActionParam, IParam } from "@ibiz-core";
import { EditorBase, IActionParam, IParam } from "@ibiz-core";
import { UploadOutlined, PlusOutlined } from '@ant-design/icons-vue';
import { ref, Ref } from "vue";
interface UploadProps {
......@@ -98,6 +98,7 @@ const props = withDefaults(defineProps<UploadProps>(), {
listType: 'text',
});
const emit = defineEmits<EditorEmit>();
const { getDownloadUrl, getRequestingHeader, getUploadUrl } = new EditorBase();
const uploadUrl = getUploadUrl();
const downloadUrl = getDownloadUrl();
const headers = getRequestingHeader();
......
import { toRefs } from "vue";
import { IParam } from "@ibiz-core";
import { computedNavData, useContextParams } from "@ibiz-core";
/**
* @description 处理编辑器导航数据(查询代码表)
* @export
* @param {Record<string, any>} props 编辑器输入属性
* @return {*}
*/
export function handleEditorNavParams(props: Record<string, any>) {
const { localContext, localParam, data } = toRefs(props);
const { context, viewParams } = useContextParams(props);
const navParams = {
navContext: context.value,
navViewParam: viewParams.value,
}
if (localContext && Object.keys(localContext).length > 0) {
const _context = computedNavData(data, navParams.navContext, navParams.navViewParam, localContext);
Object.assign(navParams.navContext, _context);
}
if (localParam && Object.keys(localParam).length > 0) {
const _param = computedNavData(data, navParams.navContext, navParams.navViewParam, localParam);
Object.assign(navParams.navViewParam, _param);
}
return navParams;
}
/**
* @description 加载代码表数据
* @export
* @param {string} codeListTag 代码表标识
* @param {string} codeListType 代码表类型
* @param {IParam} navContext 导航上下文
* @param {IParam} navViewParam 导航视图参数
* @param {boolean} isNumber 是否为数值类型
* @return {Promise<any[]>} {any[]}
*/
export async function loadCodeListData(codeListTag?: string, codeListType?: string, navContext?: IParam, navViewParam?: IParam): Promise<IParam[]> {
const data: IParam[] = [
{
value: '243144',
label: 'Jack',
},
{
value: '7dawda',
label: 'Lucy',
},
{
value: 'disaweqeqeqbled',
label: 'Disabled',
disabled: true,
},
{
value: 'yimirwqrqwenghe',
label: 'Yiminghe',
}
];
if (codeListTag) {
// todo 调用代码表服务获取数据
}
return data;
}
/**
* @description 处理层级代码表
* @export
* @param {IParam[]} codeListData 代码表数据
*/
export function handleLevelCodeList(codeListData: IParam[]): IParam[] {
let items: IParam[] = [...codeListData]
const hasChildren: boolean = codeListData.some((item:any) =>{
return item.pvalue;
})
if(hasChildren){
let list: IParam[] = [];
items.forEach((codeItem: IParam) =>{
if(!codeItem.pvalue){
let valueField: string = codeItem.value;
setChildCodeItems(valueField, items, codeItem);
list.push(codeItem);
}
})
items = list;
}
return items;
}
/**
* @description 设置子代码表
* @param {string} pValue 父代码项值
* @param {IParam[]} result 代码表
* @param {IParam} codeItem 代码项
*/
function setChildCodeItems(pValue: string, result: IParam[], codeItem: IParam) {
result.forEach((item: IParam) =>{
if(item.pvalue == pValue){
let valueField:string = item.value;
setChildCodeItems(valueField, result, item);
if(!codeItem.options){
codeItem.children = [];
}
codeItem.children.push(item);
}
})
}
/**
* @description 打开选择视图
* @export
*/
export function openPickUpView() {
//todo
}
/**
* @description 打开链接视图
* @export
*/
export function openLinkView() {
//todo
}
/**
* @description 获取文件上传路径
* @export
* @return {*} {string}
*/
export function getUploadUrl(): string {
//todo 环境参数
// return AppServiceBase.getInstance().getAppEnvironment().BaseUrl + AppServiceBase.getInstance().getAppEnvironment().UploadFile;
return "";
}
/**
* @description 获取文件上传路径
* @export
* @return {*} {string}
*/
export function getDownloadUrl(): string {
//todo 环境参数
// return AppServiceBase.getInstance().getAppEnvironment().ExportFile;
return "";
}
/**
* @description 获取文件请求头
* @export
* @return {*} {IParam}
*/
export function getRequestingHeader(): IParam {
//todo 请求头
// if (AppServiceBase.getInstance().getAppEnvironment().SaaSMode) {
// let activeOrgData = getSessionStorage('activeOrgData');
// this.headers['srforgid'] = activeOrgData?.orgid;
// this.headers['srfsystemid'] = activeOrgData?.systemid;
// if(getSessionStorage("srfdynaorgid")){
// this.headers['srfdynaorgid'] = getSessionStorage("srfdynaorgid");
// }
// } else {
// if(getSessionStorage("srfdynaorgid")){
// this.headers['srfdynaorgid'] = getSessionStorage("srfdynaorgid");
// }
// }
// if (getCookie('ibzuaa-token')) {
// this.headers['Authorization'] = `Bearer ${getCookie('ibzuaa-token')}`;
// } else {
// // 第三方应用打开免登
// if (sessionStorage.getItem("srftoken")) {
// const token = sessionStorage.getItem('srftoken');
// this.headers['Authorization'] = `Bearer ${token}`;
// }
// }
return {};
}
import { computedNavData, ControlPropsBase, ControlStateBase, IParam, toOneWayRef, useContextParams } from '@ibiz-core';
import { RouteLocationNormalizedLoaded, Router, useRoute, useRouter } from 'vue-router';
/**
* @description 部件基类
* @export
* @class EditorBase
*/
export class EditorBase {
/**
* @description 处理编辑器导航数据(查询代码表)
* @export
* @param {Record<string, any>} props 编辑器输入属性
* @return {*}
*/
public handleEditorNavParams(props: Record<string, any>) {
const { localContext, localParam, data } = toRefs(props);
const { context, viewParams } = useContextParams(props);
const navParams = {
navContext: context.value,
navViewParam: viewParams.value,
}
if (localContext && Object.keys(localContext).length > 0) {
const _context = computedNavData(data, navParams.navContext, navParams.navViewParam, localContext);
Object.assign(navParams.navContext, _context);
}
if (localParam && Object.keys(localParam).length > 0) {
const _param = computedNavData(data, navParams.navContext, navParams.navViewParam, localParam);
Object.assign(navParams.navViewParam, _param);
}
return navParams;
}
/**
* @description 加载代码表数据
* @export
* @param {string} codeListTag 代码表标识
* @param {string} codeListType 代码表类型
* @param {IParam} navContext 导航上下文
* @param {IParam} navViewParam 导航视图参数
* @param {boolean} isNumber 是否为数值类型
* @return {Promise<any[]>} {any[]}
*/
public async loadCodeListData(codeListTag?: string, codeListType?: string, navContext?: IParam, navViewParam?: IParam): Promise<IParam[]> {
const data: IParam[] = [
{
value: '243144',
label: 'Jack',
},
{
value: '7dawda',
label: 'Lucy',
},
{
value: 'disaweqeqeqbled',
label: 'Disabled',
disabled: true,
},
{
value: 'yimirwqrqwenghe',
label: 'Yiminghe',
}
];
if (codeListTag) {
// todo 调用代码表服务获取数据
}
return data;
}
/**
* @description 处理层级代码表
* @export
* @param {IParam[]} codeListData 代码表数据
*/
public handleLevelCodeList(codeListData: IParam[]): IParam[] {
let items: IParam[] = [...codeListData]
const hasChildren: boolean = codeListData.some((item:any) =>{
return item.pvalue;
})
if(hasChildren){
let list: IParam[] = [];
items.forEach((codeItem: IParam) =>{
if(!codeItem.pvalue){
let valueField: string = codeItem.value;
this.setChildCodeItems(valueField, items, codeItem);
list.push(codeItem);
}
})
items = list;
}
return items;
}
/**
* @description 设置子代码表
* @param {string} pValue 父代码项值
* @param {IParam[]} result 代码表
* @param {IParam} codeItem 代码项
*/
public setChildCodeItems(pValue: string, result: IParam[], codeItem: IParam) {
result.forEach((item: IParam) =>{
if(item.pvalue == pValue){
let valueField:string = item.value;
this.setChildCodeItems(valueField, result, item);
if(!codeItem.options){
codeItem.children = [];
}
codeItem.children.push(item);
}
})
}
/**
* @description 打开选择视图
* @export
*/
public openPickUpView() {
//todo
}
/**
* @description 打开链接视图
* @export
*/
public openLinkView() {
//todo
}
/**
* @description 获取文件上传路径
* @export
* @return {*} {string}
*/
public getUploadUrl(): string {
//todo 环境参数
// return AppServiceBase.getInstance().getAppEnvironment().BaseUrl + AppServiceBase.getInstance().getAppEnvironment().UploadFile;
return "";
}
/**
* @description 获取文件上传路径
* @export
* @return {*} {string}
*/
public getDownloadUrl(): string {
//todo 环境参数
// return AppServiceBase.getInstance().getAppEnvironment().ExportFile;
return "";
}
/**
* @description 获取文件请求头
* @export
* @return {*} {IParam}
*/
public getRequestingHeader(): IParam {
//todo 请求头
// if (AppServiceBase.getInstance().getAppEnvironment().SaaSMode) {
// let activeOrgData = getSessionStorage('activeOrgData');
// this.headers['srforgid'] = activeOrgData?.orgid;
// this.headers['srfsystemid'] = activeOrgData?.systemid;
// if(getSessionStorage("srfdynaorgid")){
// this.headers['srfdynaorgid'] = getSessionStorage("srfdynaorgid");
// }
// } else {
// if(getSessionStorage("srfdynaorgid")){
// this.headers['srfdynaorgid'] = getSessionStorage("srfdynaorgid");
// }
// }
// if (getCookie('ibzuaa-token')) {
// this.headers['Authorization'] = `Bearer ${getCookie('ibzuaa-token')}`;
// } else {
// // 第三方应用打开免登
// if (sessionStorage.getItem("srftoken")) {
// const token = sessionStorage.getItem('srftoken');
// this.headers['Authorization'] = `Bearer ${token}`;
// }
// }
return {};
}
}
export * from './editor-base-help';
\ No newline at end of file
export * from './editor-base';
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册