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

update: 编辑器名称更改

上级 5206e49f
<IbizAutoComplete <app-auto-complete
name="{{item.codeName}}" name="{{item.codeName}}"
:data="state.data" :data="state.data"
{{#if item.valueItemName}} {{#if item.valueItemName}}
......
<IbizCheckboxList <app-checkbox-list
name="{{item.codeName}}" name="{{item.codeName}}"
:data="state.data" :data="state.data"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
......
<IbizCheckbox <app-checkbox
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
......
<IbizCode <app-code
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.isReadOnly}} {{#if item.psEditor.isReadOnly}}
:readonly="{{item.psEditor.isReadOnly}}" :readonly="{{item.psEditor.isReadOnly}}"
......
<IbizDataPickerView <app-data-picker-view
name="{{item.codeName}}" name="{{item.codeName}}"
:data="state.data" :data="state.data"
{{#if item.valueItemName}} {{#if item.valueItemName}}
......
<IbizDataPicker <app-data-picker
name="{{item.codeName}}" name="{{item.codeName}}"
:data="state.data" :data="state.data"
{{#if item.valueItemName}} {{#if item.valueItemName}}
......
<IbizDatePicker <app-date-picker
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.placeHolder}} {{#if item.psEditor.placeHolder}}
placeholder="{{item.psEditor.placeHolder}}" placeholder="{{item.psEditor.placeHolder}}"
......
<IbizDropdownList <app-dropdown-list
name="{{item.codeName}}" name="{{item.codeName}}"
:data="state.data"
{{#if item.psEditor.codeList}} {{#if item.psEditor.codeList}}
codeListTag="{{item.psEditor.codeList.codeListTag}}" codeListTag="{{item.psEditor.codeList.codeListTag}}"
codeListType="{{item.psEditor.codeList.codeListType}}" codeListType="{{item.psEditor.codeList.codeListType}}"
...@@ -28,10 +27,12 @@ ...@@ -28,10 +27,12 @@
:viewParams="state.viewParams" :viewParams="state.viewParams"
{{#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}}"
:data="state.data"
@editorEvent="handleEditorEvent" @editorEvent="handleEditorEvent"
{{/if}} {{/if}}
{{#eq ctrlType 'grid'}} {{#eq ctrlType 'grid'}}
:value="record.{{item.psEditor.name}}" :value="record.{{item.psEditor.name}}"
:data="record"
@editorEvent="($event) => handleEditorEvent(index,$event)" @editorEvent="($event) => handleEditorEvent(index,$event)"
{{/eq}} {{/eq}}
/> />
<IbizInputIp <app-input-ip
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
......
<IbizInput <app-input
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.placeHolder}} {{#if item.psEditor.placeHolder}}
placeholder="{{item.psEditor.placeHolder}}" placeholder="{{item.psEditor.placeHolder}}"
......
<IbizListBox <app-list-box
name="{{item.codeName}}" name="{{item.codeName}}"
:data="state.data" :data="state.data"
:server="state.controlService" :server="state.controlService"
......
<IbizRadioGroup <app-radio-group
name="{{item.codeName}}" name="{{item.codeName}}"
:data="state.data" :data="state.data"
{{#if item.psEditor.codeList}} {{#if item.psEditor.codeList}}
......
<IbizRating <app-rating
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
......
<IbizRaw <app-raw
name="{{item.codeName}}" name="{{item.codeName}}"
:date="state.data" :date="state.data"
{{#if item.psEditor.editorParams.contentType}} {{#if item.psEditor.editorParams.contentType}}
......
<IbizSlider <app-slider
name="{{item.codeName}}" name="{{item.codeName}}"
:date="state.data" :date="state.data"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
......
<IbizSpan <app-span
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.codeList}} {{#if item.psEditor.codeList}}
codeListTag="{{item.psEditor.codeList.codeListTag}}" codeListTag="{{item.psEditor.codeList.codeListTag}}"
......
<IbizStepper <app-stepper
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
......
<IbizSwitch <app-switch
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.disabled}} {{#if item.psEditor.disabled}}
:disabled="{{item.psEditor.disabled}}" :disabled="{{item.psEditor.disabled}}"
......
<IbizUpload <app-upload
name="{{item.codeName}}" name="{{item.codeName}}"
{{#if item.psEditor.editorParams.method}} {{#if item.psEditor.editorParams.method}}
method="{{item.psEditor.editorParams.method}}" method="{{item.psEditor.editorParams.method}}"
......
import { toRefs } from 'vue'; import { toRefs } from 'vue';
import { UIUtil, IParam, UIBase } from '@core'; import { UIUtil, IParam, UIBase } from '@core';
import axios from 'axios';
/** /**
* @description 部件基类 * @description 部件基类
* @export * @export
...@@ -180,4 +181,118 @@ export class EditorBase { ...@@ -180,4 +181,118 @@ export class EditorBase {
// } // }
return {}; return {};
} }
/**
* @description 获取上传参数
* @return {*} {IParam[]}
* @memberof EditorBase
*/
public getUploadParams(uploadParams: IParam, data: IParam, context: IParam, viewParams: IParam): IParam[] {
return UIUtil.computedNavData(data, context, viewParams, uploadParams);
}
/**
* @description 获取导出参数
* @return {*} {IParam[]}
* @memberof EditorBase
*/
public getExportParams(exportParams: IParam, data: IParam, context: IParam, viewParams: IParam): IParam[] {
return UIUtil.computedNavData(data, context, viewParams, exportParams);
}
/**
* @description 获取base64的图片url
* @param {string} url
* @param {Map<string, any>} loadingImgMap
* @param {Map<string, any>} successImgMap
* @return {*}
* @memberof EditorBase
*/
public getImgURLOfBase64(url: string, loadingImgMap: Map<string, any>, successImgMap: Map<string, any>): Promise<string> {
return new Promise((resolve, reject) => {
let img = '/';
// 富文本CV上传图片与鼠标移出抛值冲突问题,上传成功回调还没执行时就抛值
var reg = /^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*?)\s*$/i;
if (reg.test(url)) {
return resolve(url);
}
// 缓存中有从缓存中拿
if (successImgMap.get(url)) {
let img = successImgMap.get(url);
resolve(img);
}
const callback: Function = (url: string, promise: Promise<any>) => {
promise.then((response: any) => {
if (response && response.status === 200 && response.data) {
// 获取文件名
const disposition = response.headers['content-disposition'];
const filename = disposition.split('filename=')[1];
let type = 'image/png';
if (filename && filename.indexOf('.') > 0) {
const start = filename.lastIndexOf('.');
const expandedName = filename.substring(start + 1);
if (expandedName.match(/(bmp|jpg|jpeg|png|tif|gif|pcx|tga|exif|fpx|svg|psd|cdr|pcd|dxf|ufo|eps|ai|raw|WMF|webp)/gi) != null) {
type = 'image/' + expandedName;
} else {
resolve(img);
}
}
let blob = new Blob([response.data],{type: type});
this.blobToBase64(blob).then((res: any) => {
// 转化后的base64
img = `${res}`;
// 缓存图片
successImgMap.set(url, img);
resolve(img);
})
} else {
resolve(img);
}
}).catch((result: any) => {
return resolve(img);
})
}
// 加载中
if (loadingImgMap.get(url)) {
callback(url, loadingImgMap.get(url));
} else {
let _url = url;
if (!Object.is('/', _url.substring(0,1))) {
_url = '/'+_url;
}
let result:Promise<any> = axios({method: 'get', url: _url, responseType: 'blob'});
loadingImgMap.set(url, result);
callback(url, result);
}
});
}
/**
* @description blob对象转base64
* @param {Blob} blob
* @return {*} {Promise<string>}
* @memberof EditorBase
*/
public blobToBase64(blob: Blob): Promise<string> {
return new Promise((resolve, reject) => {
const fileReader = new FileReader();
fileReader.onload = (e: any) => {
resolve(e.target.result);
};
fileReader.readAsDataURL(blob);
fileReader.onerror = () => {
reject(new Error('blobToBase64 error'));
};
});
}
/**
* @description 获取当前国际化
* @return {*} {string}
* @memberof EditorBase
*/
public getLocal(): string {
//todo
return 'zh_CN';
}
} }
@use './ibizInput.scss'; @use './app-input.scss';
@use './ibizListBox.scss'; @use './app-list-box.scss';
\ No newline at end of file \ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册