提交 4e4a5de0 编写于 作者: ibizdev's avatar ibizdev

Mosher 发布系统代码 [后台服务,演示应用]

上级 312b68f3
......@@ -279,11 +279,11 @@ export default class IBIZBOOKUIServiceBase extends UIService {
const reader = new FileReader();
reader.readAsText(error.data, 'utf-8');
reader.onload = (event: any) => {
const message = JSON.parse(event.target.result)?.message;
actionContext.$Notice.error({ title: '错误', desc: 'actionContext.$t('app.grid.exportexcel.error')' });
const message = event && event.target && event.target.result && JSON.parse(event.target.result) ? JSON.parse(event.target.result) : '';
actionContext.$Notice.error({ title: '错误', desc: message ? message : actionContext.$t('app.grid.exportexcel.error') });
}
} catch (error) {
actionContext.$Notice.error({ title: '错误', desc: 'actionContext.$t('app.grid.exportexcel.error')' });
actionContext.$Notice.error({ title: '错误', desc: actionContext.$t('app.grid.exportexcel.error') });
}
}
}
......@@ -548,7 +548,7 @@ export default class IBIZBOOKUIServiceBase extends UIService {
requestUrl = `/${Util.srfpluralize(actionContext.context.srfparentdename).toLowerCase()}/${actionContext.context.srfparentkey}` + requestUrl;
}
} else {
actionContext.$Notice.error({ title: '错误', desc: 'actionContext.$t('app.utilview.nodatakey')' });
actionContext.$Notice.error({ title: '错误', desc: actionContext.$t('app.utilview.nodatakey') });
return;
}
requestUrl += '?srfprinttag=Print';
......@@ -561,7 +561,7 @@ export default class IBIZBOOKUIServiceBase extends UIService {
const link = window.URL.createObjectURL(response.data);
window.open(link, '_blank');
} else {
actionContext.$Notice.error({ title: '错误', desc: 'actionContext.$t('app.utilview.printerror')' });
actionContext.$Notice.error({ title: '错误', desc: actionContext.$t('app.utilview.printerror') });
}
}
......
/**
* 复数变化规则
*
*
*/
export class PluralizeRule{
/**
* 不规则
*
* @protected
* @type {string[]}
* @memberof PluralizeRule
*/
protected irregular: Map<string, string> = new Map();
/**
* 不可数
*
* @protected
* @type {string[]}
* @memberof PluralizeRule
*/
protected uncountable: string[] = [
"equipment", "information", "rice", "money", "species", "series", "fish", "sheep", "people", "men",
"children", "sexes", "moves", "stadiums", "oxen", "octopi", "viri", "aliases", "quizzes",
];
/**
* 初始化pluralizeRule对象
*
* @param opts 额外参数
* @memberof PluralizeRule
*/
public constructor(opts: any = {}) {
this.initIrregular();
}
/**
* 初始化不规则变化
*
* @param opts 额外参数
* @memberof PluralizeRule
*/
protected initIrregular(){
this.irregular.set("person", "people");
this.irregular.set("man", "men");
this.irregular.set("child", "children");
this.irregular.set("sex", "sexes");
this.irregular.set("move", "moves");
this.irregular.set("stadium", "stadiums");
}
/**
* 是否为不可数
*
* @param word 单词
* @returns 返回判断
* @memberof PluralizeRule
*/
public isUncountable(word: string){
const index: number = this.uncountable.findIndex((wordStr: string) =>{
return Object.is(word, wordStr);
})
if (index == -1) {
return false;
} else {
return true;
}
}
/**
* 不规则变化
*
* @param word 单词
* @returns 返回变化值
* @memberof PluralizeRule
*/
public irregularChange(word: string){
for(let item of this.irregular.entries()){
if(word && word.endsWith(item[0])){
return word.replace(new RegExp(item[0],'g'),item[1]);
}
}
return this.irregular.get(word);
}
/**
* 规则变化
*
* @param word 单词
* @returns 返回变化值
* @memberof PluralizeRule
*/
public ruleChange(word: string){
if(/(ax|test)is$/.test(word)) return word.replace(/is$/,"es");
if(/(octop|vir)us$/.test(word)) return word.replace(/us$/,"i");
if(/(octop|vir)i$/.test(word)) return word;
if(/(alias|status)$/.test(word)) return word+"es";
if(/(bu)s$/.test(word)) return word.replace(/s$/,"ses");
if(/(buffal|tomat)o$/.test(word)) return word.replace(/o$/,"oes");
if(/([ti])um$/.test(word)) return word.replace(/um$/,"a");
if(/([ti])a$/.test(word)) return word;
if(/sis$/.test(word)) return word.replace(/sis$/,"ses");
if(/(?:([^f])fe|([lr])f)$/.test(word)) return word.substring(0, word.length - 1)+"ves";
if(/(hive)$/.test(word)) return word+"s";
if(/([^aeiouy]|qu)y$/.test(word)) return word.replace(/y$/,"ies");
if(/(x|ch|ss|sh)$/.test(word)) return word+"es";
if(/(matr|vert|ind)ix|ex$/.test(word)) return word.replace(/ix|ex$/,"ices");
if(/([m|l])ouse$/.test(word)) return word.replace(/ouse$/,"ice");
if(/([m|l])ice$/.test(word)) return word;
if(/^(ox)$$/.test(word)) return word+"en";
if(/(quiz)$/.test(word)) return word+"zes";
if(/s$/.test(word)) return word.replace(/s$/,"s");
return word+"s";
}
}
\ No newline at end of file
import qs from 'qs';
import { Route } from 'vue-router';
import Schema from "async-validator";
import { PanelContainerModel, PanelRawitemModel, PanelFieldModel, PanelControlModel, PanelButtonModel, PanelUserControlModel, PanelTabPanelModel, PanelTabPageModel, PanelCtrlPosModel } from '@/model/panel-detail';
import { PluralizeRule } from './pluralizeRule';
/**
* 平台工具类
*
......@@ -10,6 +9,14 @@ import { PanelContainerModel, PanelRawitemModel, PanelFieldModel, PanelControlMo
*/
export class Util {
/**
* @description PluralizeRule对象
* @private
* @type {PluralizeRule}
* @memberof Util
*/
public static pluralizeRule: PluralizeRule = new PluralizeRule();
/**
* 创建 UUID
*
......@@ -292,6 +299,29 @@ export class Util {
return _str;
}
/**
* 计算单词复数
*
* @static
* @returns {string}
* @memberof Util
*/
public static srfpluralize(word: string) {
let wordStr = word.trim().toLowerCase();
if (wordStr.length == 0) {
return wordStr;
}
if (this.pluralizeRule.isUncountable(wordStr)) {
return wordStr;
}
const newWordStr = this.pluralizeRule.irregularChange(wordStr);
if (newWordStr) {
return newWordStr;
} else {
return this.pluralizeRule.ruleChange(wordStr);
}
}
/**
* 附加参数格式化
*
......
......@@ -712,7 +712,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKCalendarView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr9GridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -748,7 +748,7 @@ export default class DefaultBase extends Vue implements ControlInterface {
*/
public async loadDraft(opt: any = {},mode?:string): Promise<any> {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKCalendarView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr9GridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
......
......@@ -1378,7 +1378,7 @@ export default class GuideBorrowFormBase extends Vue implements ControlInterface
*/
public async load(opt: any = {}): Promise<any> {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.loadaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -1425,7 +1425,7 @@ export default class GuideBorrowFormBase extends Vue implements ControlInterface
*/
public async loadDraft(opt: any = {}): Promise<any> {
if (!this.loaddraftAction) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
return;
}
const arg: any = { ...opt } ;
......@@ -1495,7 +1495,7 @@ export default class GuideBorrowFormBase extends Vue implements ControlInterface
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1603,7 +1603,7 @@ export default class GuideBorrowFormBase extends Vue implements ControlInterface
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg, { viewparams: this.viewparams });
......@@ -1695,7 +1695,7 @@ export default class GuideBorrowFormBase extends Vue implements ControlInterface
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.removeaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
return;
}
const arg: any = opt[0];
......
......@@ -1344,7 +1344,7 @@ export default class GuideReturnFormBase extends Vue implements ControlInterface
*/
public async load(opt: any = {}): Promise<any> {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.loadaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -1391,7 +1391,7 @@ export default class GuideReturnFormBase extends Vue implements ControlInterface
*/
public async loadDraft(opt: any = {}): Promise<any> {
if (!this.loaddraftAction) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
return;
}
const arg: any = { ...opt } ;
......@@ -1461,7 +1461,7 @@ export default class GuideReturnFormBase extends Vue implements ControlInterface
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1569,7 +1569,7 @@ export default class GuideReturnFormBase extends Vue implements ControlInterface
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg, { viewparams: this.viewparams });
......@@ -1661,7 +1661,7 @@ export default class GuideReturnFormBase extends Vue implements ControlInterface
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.removeaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
return;
}
const arg: any = opt[0];
......
......@@ -1447,7 +1447,7 @@ export default class GuideViewFormBase extends Vue implements ControlInterface {
*/
public async load(opt: any = {}): Promise<any> {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.loadaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.loadaction') as string) });
return;
}
const arg: any = { ...opt };
......@@ -1494,7 +1494,7 @@ export default class GuideViewFormBase extends Vue implements ControlInterface {
*/
public async loadDraft(opt: any = {}): Promise<any> {
if (!this.loaddraftAction) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.loaddraftaction') as string) });
return;
}
const arg: any = { ...opt } ;
......@@ -1564,7 +1564,7 @@ export default class GuideViewFormBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg,{viewparams:this.viewparams});
......@@ -1672,7 +1672,7 @@ export default class GuideViewFormBase extends Vue implements ControlInterface {
const action: any = Object.is(data.srfuf, '1') ? this.updateAction : this.createAction;
if(!action){
let actionName:any = Object.is(data.srfuf, '1')?"updateAction":"createAction";
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.actionname') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.actionname') as string) });
return;
}
Object.assign(arg, { viewparams: this.viewparams });
......@@ -1764,7 +1764,7 @@ export default class GuideViewFormBase extends Vue implements ControlInterface {
public remove(opt:Array<any> = [],showResultInfo?: boolean): Promise<any> {
return new Promise((resolve: any, reject: any) => {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView_layout' + (this.$t('app.formpage.notconfig.removeaction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKWizardView' + (this.$t('app.formpage.notconfig.removeaction') as string) });
return;
}
const arg: any = opt[0];
......
......@@ -698,7 +698,7 @@ export default class Usr4Base extends Vue implements ControlInterface {
*/
public async load(opt: any = {}, isReset: boolean = false): Promise<any> {
if(!this.fetchAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKTestCLDataView' + (this.$t('app.list.notConfig.fetchAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4DataView' + (this.$t('app.list.notConfig.fetchAction') as string) });
return;
}
const arg: any = {...opt};
......@@ -792,7 +792,7 @@ export default class Usr4Base extends Vue implements ControlInterface {
*/
public async remove(datas: any[]): Promise<any> {
if(!this.removeAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKTestCLDataView' + (this.$t('app.gridpage.notConfig.removeAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4DataView' + (this.$t('app.gridpage.notConfig.removeAction') as string) });
return;
}
let _datas:any[] = [];
......@@ -908,7 +908,7 @@ export default class Usr4Base extends Vue implements ControlInterface {
try {
if(Object.is(item.rowDataState, 'create')){
if(!this.createAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKTestCLDataView' + (this.$t('app.list.notConfig.createAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4DataView' + (this.$t('app.list.notConfig.createAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
let response = await this.service.add(this.createAction, JSON.parse(JSON.stringify(this.context)),item, this.showBusyIndicator);
......@@ -916,7 +916,7 @@ export default class Usr4Base extends Vue implements ControlInterface {
}
}else if(Object.is(item.rowDataState, 'update')){
if(!this.updateAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKTestCLDataView' + (this.$t('app.list.notConfig.updateAction') as string) });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKUsr4DataView' + (this.$t('app.list.notConfig.updateAction') as string) });
}else{
Object.assign(item,{viewparams:this.viewparams});
if(item.ibizbook){
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册