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

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

上级 8214c908
......@@ -112,6 +112,15 @@ export default {
uiactions: {
},
},
quicksearchform_searchform: {
details: {
formpage1: "表单分页",
n_ibizbookname_like: "图书名称(%)",
n_price_gtandeq: "图书价格(>=)",
},
uiactions: {
},
},
default_searchform: {
details: {
formpage1: "常规条件",
......
......@@ -111,6 +111,15 @@ export default {
uiactions: {
},
},
quicksearchform_searchform: {
details: {
formpage1: "表单分页",
n_ibizbookname_like: "图书名称(%)",
n_price_gtandeq: "图书价格(>=)",
},
uiactions: {
},
},
default_searchform: {
details: {
formpage1: "常规条件",
......
......@@ -12,6 +12,21 @@
<div class="quick-group-container">
<app-quick-group :items="quickGroupModel" @valuechange="quickGroupValueChange"></app-quick-group>
</div>
<div class="quick-search-container">
<view_quicksearchform
:viewState="viewState"
:viewparams="viewparams"
:context="context"
:showBusyIndicator="true"
v-show="isExpandSearchForm"
loaddraftAction="FilterGetDraft"
loadAction="FilterGet"
name="quicksearchform"
ref='quicksearchform'
@closeview="closeView($event)">
</view_quicksearchform>
</div>
<i-input v-show="!isExpandSearchForm" v-model="query" search enter-button @on-search="onSearch($event)" class='quick-search-input' style='max-width: 400px;' placeholder="图书名称" />
<div class='pull-right'>
<div class='toolbar-container'>
......@@ -330,6 +345,7 @@ export default class IBIZBOOKInternalFuncGridViewBase extends Vue {
* @memberof IBIZBOOKInternalFuncGridViewBase
*/
public containerModel: any = {
view_quicksearchform: { name: 'quicksearchform', type: 'SEARCHFORM' },
view_toolbar: { name: 'toolbar', type: 'TOOLBAR' },
view_grid: { name: 'grid', type: 'GRID' },
view_searchform: { name: 'searchform', type: 'SEARCHFORM' },
......@@ -1881,6 +1897,23 @@ export default class IBIZBOOKInternalFuncGridViewBase extends Vue {
}
this.isEmitQuickGroupValue = true;
}
/**
* 快速搜索栏数据对象
*
* @memberof IBIZBOOKInternalFuncGridViewBase
*/
public quickFormData:any;
/**
* 快速搜索栏值变化
*
* @memberof IBIZBOOKInternalFuncGridViewBase
*/
public quickFormValueChange($event:any){
this.quickFormData = $event;
this.onSearch($event);
}
}
</script>
......
......@@ -2,10 +2,12 @@
import { Component } from 'vue-property-decorator';
import IBIZBOOKInternalFuncGridViewBase from './ibizbookinternal-func-grid-view-base.vue';
import view_quicksearchform from '@widgets/ibizbook/quicksearchform-searchform/quicksearchform-searchform.vue';
import view_grid from '@widgets/ibizbook/internal-func-grid/internal-func-grid.vue';
import view_searchform from '@widgets/ibizbook/default-searchform/default-searchform.vue';
@Component({
components: {
view_quicksearchform,
view_grid,
view_searchform,
},
......
<template>
<i-form :model="this.data" class='app-search-form' ref='quicksearchform' style="">
<input style="display:none;"/>
<row>
<i-col span="20" class="form-content">
<row>
<i-col v-show="detailsModel.n_ibizbookname_like.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='n_ibizbookname_like' :itemRules="this.rules.n_ibizbookname_like" class='' :caption="$t('entities.ibizbook.quicksearchform_searchform.details.n_ibizbookname_like')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_ibizbookname_like.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.n_ibizbookname_like"
@enter="onEnter($event)"
:disabled="detailsModel.n_ibizbookname_like.disabled"
type='text'
style="width:100px;">
</input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.n_price_gtandeq.visible" :style="{}" :lg="{ span: 12, offset: 0 }" :xl="{ span: 12, offset: 0 }">
<app-form-item name='n_price_gtandeq' :itemRules="this.rules.n_price_gtandeq" class='' :caption="$t('entities.ibizbook.quicksearchform_searchform.details.n_price_gtandeq')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.n_price_gtandeq.error" :isEmptyCaption="false" labelPos="LEFT">
<input-box
v-model="data.n_price_gtandeq"
@enter="onEnter($event)"
:disabled="detailsModel.n_price_gtandeq.disabled"
type='text'
style="width:100px;">
</input-box>
</app-form-item>
</i-col>
</row>
</i-col>
<i-col span="4" class="search-button">
<row v-show="Object.keys(data).length>0">
<i-button class='search_reset' size="default" type="primary" @click="onSearch">{{$t('app.searchButton.search')}}</i-button>
<i-button class='search_reset' size="default" @click="onReset">{{this.$t('app.searchButton.reset')}}</i-button>
</row>
</i-col>
</row>
</i-form>
</template>
<script lang='tsx'>
import { Vue, Component, Prop, Provide, Emit, Watch, Model,Inject } from 'vue-property-decorator';
import { CreateElement } from 'vue';
import { Subject, Subscription } from 'rxjs';
import { ControlInterface } from '@/interface/control';
import { UIActionTool,Util,ViewTool } from '@/utils';
import NavDataService from '@/service/app/navdata-service';
import AppCenterService from "@service/app/app-center-service";
import IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import QUICKSEARCHFORMService from './quicksearchform-searchform-service';
import IBIZBOOKUIService from '@/uiservice/ibizbook/ibizbook-ui-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
@Component({
components: {
}
})
export default class QUICKSEARCHFORMBase extends Vue implements ControlInterface {
/**
* 名称
*
* @type {string}
* @memberof QUICKSEARCHFORMBase
*/
@Prop() public name?: string;
/**
* 视图通讯对象
*
* @type {Subject<ViewState>}
* @memberof QUICKSEARCHFORMBase
*/
@Prop() public viewState!: Subject<ViewState>;
/**
* 应用上下文
*
* @type {*}
* @memberof QUICKSEARCHFORMBase
*/
@Prop() public context: any;
/**
* 视图参数
*
* @type {*}
* @memberof QUICKSEARCHFORMBase
*/
@Prop() public viewparams: any;
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof QUICKSEARCHFORMBase
*/
public viewStateEvent: Subscription | undefined;
/**
* 获取部件类型
*
* @returns {string}
* @memberof QUICKSEARCHFORMBase
*/
public getControlType(): string {
return 'SEARCHFORM'
}
/**
* 计数器服务对象集合
*
* @type {Array<*>}
* @memberof QUICKSEARCHFORMBase
*/
public counterServiceArray:Array<any> = [];
/**
* 建构部件服务对象
*
* @type {QUICKSEARCHFORMService}
* @memberof QUICKSEARCHFORMBase
*/
public service: QUICKSEARCHFORMService = new QUICKSEARCHFORMService({ $store: this.$store });
/**
* 实体服务对象
*
* @type {IBIZBOOKService}
* @memberof QUICKSEARCHFORMBase
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService({ $store: this.$store });
/**
* 转化数据
*
* @param {any} args
* @memberof QUICKSEARCHFORMBase
*/
public transformData(args: any) {
let _this: any = this;
if(_this.service && _this.service.handleRequestData instanceof Function && _this.service.handleRequestData('transform',_this.context,args)){
return _this.service.handleRequestData('transform',_this.context,args)['data'];
}
}
/**
* 关闭视图
*
* @param {any} args
* @memberof QUICKSEARCHFORMBase
*/
public closeView(args: any): void {
let _this: any = this;
_this.$emit('closeview', [args]);
}
/**
* 计数器刷新
*
* @memberof QUICKSEARCHFORMBase
*/
public counterRefresh(){
const _this:any =this;
if(_this.counterServiceArray && _this.counterServiceArray.length >0){
_this.counterServiceArray.forEach((item:any) =>{
if(item.refreshData && item.refreshData instanceof Function){
item.refreshData();
}
})
}
}
/**
* 获取多项数据
*
* @returns {any[]}
* @memberof QUICKSEARCHFORMBase
*/
public getDatas(): any[] {
return [this.data];
}
/**
* 获取单项树
*
* @returns {*}
* @memberof QUICKSEARCHFORMBase
*/
public getData(): any {
return this.data;
}
/**
* 显示处理提示
*
* @type {boolean}
* @memberof QUICKSEARCHFORMBase
*/
@Prop({ default: true }) public showBusyIndicator?: boolean;
/**
* 部件行为--loaddraft
*
* @type {string}
* @memberof QUICKSEARCHFORMBase
*/
@Prop() public loaddraftAction!: string;
/**
* 部件行为--load
*
* @type {string}
* @memberof QUICKSEARCHFORMBase
*/
@Prop() public loadAction!: string;
/**
* 视图标识
*
* @type {string}
* @memberof QUICKSEARCHFORMBase
*/
@Prop() public viewtag!: string;
/**
* 表单状态
*
* @type {Subject<any>}
* @memberof QUICKSEARCHFORMBase
*/
public formState: Subject<any> = new Subject();
/**
* 忽略表单项值变化
*
* @type {boolean}
* @memberof QUICKSEARCHFORMBase
*/
public ignorefieldvaluechange: boolean = false;
/**
* 数据变化
*
* @public
* @type {Subject<any>}
* @memberof QUICKSEARCHFORMBase
*/
public dataChang: Subject<any> = new Subject();
/**
* 视图状态事件
*
* @public
* @type {(Subscription | undefined)}
* @memberof QUICKSEARCHFORMBase
*/
public dataChangEvent: Subscription | undefined;
/**
* 原始数据
*
* @public
* @type {*}
* @memberof QUICKSEARCHFORMBase
*/
public oldData: any = {};
/**
* 表单数据对象
*
* @type {*}
* @memberof QUICKSEARCHFORMBase
*/
public data: any = {
n_ibizbookname_like: null,
n_price_gtandeq: null,
};
/**
* 详情模型集合
*
* @type {*}
* @memberof QUICKSEARCHFORMBase
*/
public detailsModel: any = {
formpage1: new FormPageModel({ caption: '表单分页', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this })
,
n_ibizbookname_like: new FormItemModel({ caption: '图书名称(%)', detailType: 'FORMITEM', name: 'n_ibizbookname_like', visible: true, isShowCaption: true, form: this,required:false, disabled: false, enableCond: 3 })
,
n_price_gtandeq: new FormItemModel({ caption: '图书价格(>=)', detailType: 'FORMITEM', name: 'n_price_gtandeq', visible: true, isShowCaption: true, form: this,required:false, disabled: false, enableCond: 3 })
,
};
/**
* 属性值规则
*
* @type {*}
* @memberof QUICKSEARCHFORMBase
*/
public rules: any = {
n_ibizbookname_like: [
{ type: 'string', message: '图书名称(%) 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '图书名称(%) 值必须为字符串类型', trigger: 'blur' },
{ required: this.detailsModel.n_ibizbookname_like.required, type: 'string', message: '图书名称(%) 值不能为空', trigger: 'change' },
{ required: this.detailsModel.n_ibizbookname_like.required, type: 'string', message: '图书名称(%) 值不能为空', trigger: 'blur' },
],
n_price_gtandeq: [
{ type: 'string', message: '图书价格(>=) 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '图书价格(>=) 值必须为字符串类型', trigger: 'blur' },
{ required: this.detailsModel.n_price_gtandeq.required, type: 'string', message: '图书价格(>=) 值不能为空', trigger: 'change' },
{ required: this.detailsModel.n_price_gtandeq.required, type: 'string', message: '图书价格(>=) 值不能为空', trigger: 'blur' },
],
}
/**
* 监控表单属性 n_ibizbookname_like 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QUICKSEARCHFORMBase
*/
@Watch('data.n_ibizbookname_like')
onN_ibizbookname_likeChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'n_ibizbookname_like', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 n_price_gtandeq 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof QUICKSEARCHFORMBase
*/
@Watch('data.n_price_gtandeq')
onN_price_gtandeqChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'n_price_gtandeq', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof QUICKSEARCHFORMBase
*/
public resetFormData({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单逻辑
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @memberof QUICKSEARCHFORMBase
*/
public formLogic({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
}
/**
* 表单值变化
*
* @public
* @param {{ name: string, newVal: any, oldVal: any }} { name, newVal, oldVal }
* @returns {void}
* @memberof QUICKSEARCHFORMBase
*/
public formDataChange({ name, newVal, oldVal }: { name: string, newVal: any, oldVal: any }): void {
if (this.ignorefieldvaluechange) {
return;
}
this.resetFormData({ name: name, newVal: newVal, oldVal: oldVal });
this.formLogic({ name: name, newVal: newVal, oldVal: oldVal });
this.dataChang.next(JSON.stringify(this.data));
}
/**
* 表单加载完成
*
* @public
* @param {*} [data={}]
* @param {string} [action]
* @memberof QUICKSEARCHFORMBase
*/
public onFormLoad(data: any = {},action:string): void {
this.setFormEnableCond(data);
this.fillForm(data,action);
this.formLogic({ name: '', newVal: null, oldVal: null });
}
/**
* 值填充
*
* @param {*} [_datas={}]
* @param {string} [action]
* @memberof QUICKSEARCHFORMBase
*/
public fillForm(_datas: any = {},action:string): void {
this.ignorefieldvaluechange = true;
Object.keys(_datas).forEach((name: string) => {
if (this.data.hasOwnProperty(name)) {
this.data[name] = _datas[name];
}
});
if(Object.is(action,'loadDraft')){
this.createDefault();
}
this.$nextTick(function () {
this.ignorefieldvaluechange = false;
})
}
/**
* 设置表单项是否启用
*
* @public
* @param {*} data
* @memberof QUICKSEARCHFORMBase
*/
public setFormEnableCond(data: any): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setEnableCond(data.srfuf);
});
}
/**
* 新建默认值
* @memberof QUICKSEARCHFORMBase
*/
public createDefault(){
}
/**
* 重置草稿表单状态
*
* @public
* @memberof QUICKSEARCHFORMBase
*/
public resetDraftFormStates(): void {
const form: any = this.$refs.form;
if (form) {
form.resetFields();
}
}
/**
* 重置校验结果
*
* @memberof QUICKSEARCHFORMBase
*/
public resetValidates(): void {
Object.values(this.detailsModel).forEach((detail: any) => {
if (!Object.is(detail.detailType, 'FORMITEM')) {
return;
}
const formItem: FormItemModel = detail;
formItem.setError('');
});
}
/**
* 填充校验结果 (后台)
*
* @param {any[]} fieldErrors
* @memberof QUICKSEARCHFORMBase
*/
public fillValidates(fieldErrors: any[]): void {
fieldErrors.forEach((error: any) => {
const formItem: FormItemModel = this.detailsModel[error.field];
if (!formItem) {
return;
}
this.$nextTick(() => {
formItem.setError(error.message);
});
});
}
/**
* 表单校验状态
*
* @returns {boolean}
* @memberof QUICKSEARCHFORMBase
*/
public formValidateStatus(): boolean {
const form: any = this.$refs.quicksearchform;
let validatestate: boolean = true;
form.validate((valid: boolean) => {
validatestate = valid ? true : false;
});
return validatestate
}
/**
* 获取全部值
*
* @returns {*}
* @memberof QUICKSEARCHFORMBase
*/
public getValues(): any {
return this.data;
}
/**
* 表单项值变更
*
* @param {{ name: string, value: any }} $event
* @returns {void}
* @memberof QUICKSEARCHFORMBase
*/
public onFormItemValueChange($event: { name: string, value: any }): void {
if (!$event) {
return;
}
if (!$event.name || Object.is($event.name, '') || !this.data.hasOwnProperty($event.name)) {
return;
}
this.data[$event.name] = $event.value;
}
/**
* 设置数据项值
*
* @param {string} name
* @param {*} value
* @returns {void}
* @memberof QUICKSEARCHFORMBase
*/
public setDataItemValue(name: string, value: any): void {
if (!name || Object.is(name, '') || !this.data.hasOwnProperty(name)) {
return;
}
if (Object.is(this.data[name], value)) {
return;
}
this.data[name] = value;
}
/**
* 分组界面行为事件
*
* @param {*} $event
* @memberof QUICKSEARCHFORMBase
*/
public groupUIActionClick($event: any): void {
if (!$event) {
return;
}
const item:any = $event.item;
}
/**
* Vue声明周期(处理组件的输入属性)
*
* @memberof QUICKSEARCHFORMBase
*/
public created(): void {
this.afterCreated();
}
/**
* 执行created后的逻辑
*
* @memberof QUICKSEARCHFORMBase
*/
public afterCreated(){
if (this.viewState) {
this.viewStateEvent = this.viewState.subscribe(({ tag, action, data }) => {
if (!Object.is(tag, this.name)) {
return;
}
if (Object.is('autoload', action)) {
this.autoLoad(data);
}
if (Object.is('load', action)) {
this.load(data);
}
if (Object.is('loaddraft', action)) {
this.loadDraft(data);
}
});
}
}
/**
* vue 生命周期
*
* @memberof QUICKSEARCHFORMBase
*/
public destroyed() {
this.afterDestroy();
}
/**
* 执行destroyed后的逻辑
*
* @memberof QUICKSEARCHFORMBase
*/
public afterDestroy() {
if (this.viewStateEvent) {
this.viewStateEvent.unsubscribe();
}
if (this.dataChangEvent) {
this.dataChangEvent.unsubscribe();
}
}
/**
* 自动加载
*
* @param {*} [arg={}]
* @returns {void}
* @memberof QUICKSEARCHFORMBase
*/
public autoLoad(arg: any = {}): void {
if (arg.srfkey && !Object.is(arg.srfkey, '')) {
Object.assign(arg, { srfkey: arg.srfkey });
this.load(arg);
return;
}
if (arg.srfkeys && !Object.is(arg.srfkeys, '')) {
Object.assign(arg, { srfkey: arg.srfkeys });
this.load(arg);
return;
}
this.loadDraft(arg);
}
/**
* 加载
*
* @public
* @param {*} [opt={}]
* @memberof QUICKSEARCHFORMBase
*/
public load(opt: any = {}): void {
if(!this.loadAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKInternalFuncGridView' + (this.$t('app.searchForm.notConfig.loadAction') as string) });
return;
}
const arg: any = { ...opt };
Object.assign(arg,{viewparams:this.viewparams});
const get: Promise<any> = this.service.get(this.loadAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
get.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 加载草稿
*
* @param {*} [opt={}]
* @memberof QUICKSEARCHFORMBase
*/
public loadDraft(opt: any = {},mode?:string): void {
if(!this.loaddraftAction){
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: 'IBIZBOOKInternalFuncGridView' + (this.$t('app.searchForm.notConfig.loaddraftAction') as string) });
return;
}
const arg: any = { ...opt } ;
Object.assign(arg,{viewparams:this.viewparams});
let post: Promise<any> = this.service.loadDraft(this.loaddraftAction,JSON.parse(JSON.stringify(this.context)), arg, this.showBusyIndicator);
post.then((response: any) => {
if (!response.status || response.status !== 200) {
if (response.errorMessage) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: response.errorMessage });
}
return;
}
const data = response.data;
this.resetDraftFormStates();
this.onFormLoad(data,'loadDraft');
setTimeout(() => {
const form: any = this.$refs.form;
if (form) {
form.fields.forEach((field: any) => {
field.validateMessage = "";
field.validateState = "";
field.validateStatus = false;
});
}
});
if(Object.is(mode,'RESET')){
if (!this.formValidateStatus()) {
return;
}
}
this.$emit('load', data);
this.$nextTick(() => {
this.formState.next({ type: 'load', data: data });
});
}).catch((response: any) => {
if (response && response.status === 401) {
return;
}
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.sysException') as string) });
return;
}
const { data: _data } = response;
this.$Notice.error({ title: _data.title, desc: _data.message });
});
}
/**
* 表单项更新
*
* @param {string} mode 界面行为名称
* @param {*} [data={}] 请求数据
* @param {string[]} updateDetails 更新项
* @param {boolean} [showloading] 是否显示加载状态
* @returns {void}
* @memberof QUICKSEARCHFORMBase
*/
public updateFormItems(mode: string, data: any = {}, updateDetails: string[], showloading?: boolean): void {
}
/**
* 回车事件
*
* @param {*} $event
* @memberof QUICKSEARCHFORMBase
*/
public onEnter($event: any): void {
if (!this.formValidateStatus()) {
return;
}
this.$emit('search', this.data);
}
/**
* 搜索
*
* @memberof QUICKSEARCHFORMBase
*/
public onSearch() {
if (!this.formValidateStatus()) {
return;
}
this.$emit('search', this.data);
}
/**
* 重置
*
* @memberof QUICKSEARCHFORMBase
*/
public onReset() {
this.loadDraft({},'RESET');
}
}
</script>
<style lang='less'>
@import './quicksearchform-searchform.less';
</style>
\ No newline at end of file
/**
* QUICKSEARCHFORM 部件模型
*
* @export
* @class QUICKSEARCHFORMModel
*/
export default class QUICKSEARCHFORMModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof QUICKSEARCHFORMModel
*/
public getDataItems(): any[] {
return [
{
name: 'srfwfmemo',
prop: 'srfwfmemo',
dataType: 'TEXT',
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
{
name: 'n_ibizbookname_like',
prop: 'ibizbookname',
dataType: 'TEXT',
},
{
name: 'n_price_gtandeq',
prop: 'price',
dataType: 'CURRENCY',
},
]
}
}
\ No newline at end of file
import { Http,Util,Errorlog } from '@/utils';
import ControlService from '@/widgets/control-service';
import IBIZBOOKService from '@/service/ibizbook/ibizbook-service';
import QUICKSEARCHFORMModel from './quicksearchform-searchform-model';
/**
* QUICKSEARCHFORM 部件服务对象
*
* @export
* @class QUICKSEARCHFORMService
*/
export default class QUICKSEARCHFORMService extends ControlService {
/**
* 图书服务对象
*
* @type {IBIZBOOKService}
* @memberof QUICKSEARCHFORMService
*/
public appEntityService: IBIZBOOKService = new IBIZBOOKService({ $store: this.getStore() });
/**
* 设置从数据模式
*
* @type {boolean}
* @memberof QUICKSEARCHFORMService
*/
public setTempMode(){
this.isTempMode = false;
}
/**
* Creates an instance of QUICKSEARCHFORMService.
*
* @param {*} [opts={}]
* @memberof QUICKSEARCHFORMService
*/
constructor(opts: any = {}) {
super(opts);
this.model = new QUICKSEARCHFORMModel();
}
/**
* 远端数据
*
* @type {*}
* @memberof QUICKSEARCHFORMService
*/
private remoteCopyData:any = {};
/**
* 处理数据
*
* @private
* @param {Promise<any>} promise
* @returns {Promise<any>}
* @memberof QUICKSEARCHFORMService
*/
private doItems(promise: Promise<any>, deKeyField: string, deName: string): Promise<any> {
return new Promise((resolve, reject) => {
promise.then((response: any) => {
if (response && response.status === 200) {
const data = response.data;
data.forEach((item:any,index:number) =>{
item[deName] = item[deKeyField];
data[index] = item;
});
resolve(data);
} else {
reject([])
}
}).catch((response: any) => {
reject([])
});
});
}
/**
* 获取跨实体数据集合
*
* @param {string} serviceName 服务名称
* @param {string} interfaceName 接口名称
* @param {*} data
* @param {boolean} [isloading]
* @returns {Promise<any[]>}
* @memberof QUICKSEARCHFORMService
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
data.page = data.page ? data.page : 0;
data.size = data.size ? data.size : 1000;
return Promise.reject([])
}
/**
* 启动工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof QUICKSEARCHFORMService
*/
@Errorlog
public wfstart(action: string,context: any = {},data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFStart(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 提交工作流
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {*} [localdata]
* @returns {Promise<any>}
* @memberof QUICKSEARCHFORMService
*/
@Errorlog
public wfsubmit(action: string,context: any = {}, data: any = {}, isloading?: boolean,localdata?:any): Promise<any> {
data = this.handleWFData(data,true);
context = this.handleRequestData(action,context,data,true).context;
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](context,data, isloading,localdata);
} else {
result = this.appEntityService.WFSubmit(context,data, isloading,localdata);
}
result.then((response) => {
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 添加数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中添加数据
* @returns {Promise<any>}
* @memberof QUICKSEARCHFORMService
*/
@Errorlog
public add(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Create(Context,Data, isloading);
}
result.then((response) => {
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
});
}
/**
* 删除数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof QUICKSEARCHFORMService
*/
@Errorlog
public delete(action: string, context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Remove(Context,Data, isloading);
}
result.then((response) => {
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 修改数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @param {boolean} [isWorkflow] 是否在工作流中修改数据
* @returns {Promise<any>}
* @memberof QUICKSEARCHFORMService
*/
@Errorlog
public update(action: string, context: any = {},data: any = {}, isloading?: boolean,isWorkflow?:boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Update(Context,Data, isloading);
}
result.then((response) => {
if(isWorkflow){
resolve(response);
}else{
this.handleResponse(action, response);
resolve(response);
}
}).catch(response => {
reject(response);
});
});
}
/**
* 查询数据
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof QUICKSEARCHFORMService
*/
@Errorlog
public get(action: string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.Get(Context,Data, isloading);
}
result.then((response) => {
this.setRemoteCopyData(response);
this.handleResponse(action, response);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 加载草稿
*
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof QUICKSEARCHFORMService
*/
@Errorlog
public loadDraft(action: string,context: any = {}, data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any) => {
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
result = this.appEntityService.GetDraft(Context,Data, isloading);
}
result.then((response) => {
this.setRemoteCopyData(response);
this.handleResponse(action, response, true);
resolve(response);
}).catch(response => {
reject(response);
});
});
}
/**
* 前台逻辑
* @param {string} action
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof QUICKSEARCHFORMService
*/
@Errorlog
public frontLogic(action:string,context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
const {data:Data,context:Context} = this.handleRequestData(action,context,data);
return new Promise((resolve: any, reject: any)=>{
let result: Promise<any>;
const _appEntityService: any = this.appEntityService;
if (_appEntityService[action] && _appEntityService[action] instanceof Function) {
result = _appEntityService[action](Context,Data, isloading);
} else {
return Promise.reject({ status: 500, data: { title: '失败', message: '系统异常' } });
}
result.then((response) => {
this.handleResponse(action, response,true);
resolve(response);
}).catch(response => {
reject(response);
});
})
}
/**
* 处理请求数据
*
* @param action 行为
* @param data 数据
* @memberof QUICKSEARCHFORMService
*/
public handleRequestData(action: string,context:any, data: any = {},isMerge:boolean = false){
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return data;
}
let formItemItems: any[] = mode.getDataItems();
let requestData:any = {};
if(isMerge && (data && data.viewparams)){
Object.assign(requestData,data.viewparams);
}
formItemItems.forEach((item:any) =>{
if(item && item.dataType && Object.is(item.dataType,'FONTKEY')){
if(item && item.prop){
requestData[item.prop] = context[item.name];
}
}else{
if(item && item.prop){
requestData[item.prop] = data[item.name];
}else{
if(item.dataType && Object.is(item.dataType,"FORMPART")){
Object.assign(requestData,data[item.name]);
}
}
}
});
let tempContext:any = JSON.parse(JSON.stringify(context));
if(tempContext && tempContext.srfsessionid){
tempContext.srfsessionkey = tempContext.srfsessionid;
delete tempContext.srfsessionid;
}
return {context:tempContext,data:requestData};
}
/**
* 通过属性名称获取表单项名称
*
* @param name 实体属性名称
* @memberof QUICKSEARCHFORMService
*/
public getItemNameByDeName(name:string) :string{
let itemName = name;
let mode: any = this.getMode();
if (!mode && mode.getDataItems instanceof Function) {
return name;
}
let formItemItems: any[] = mode.getDataItems();
formItemItems.forEach((item:any)=>{
if(item.prop === name){
itemName = item.name;
}
});
return itemName.trim();
}
/**
* 重写处理返回数据
*
* @param {string} action
* @param {*} response
* @memberof QUICKSEARCHFORMService
*/
public handleResponseData(action: string, data: any = {},isCreate?:boolean,codelistArray?:any){
let model: any = this.getMode();
if (!model && model.getDataItems instanceof Function) {
return data;
}
let item: any = {};
let dataItems: any[] = model.getDataItems();
dataItems.forEach(dataitem => {
let val = data.hasOwnProperty(dataitem.prop) ? data[dataitem.prop] : null;
if (val === null) {
val = data.hasOwnProperty(dataitem.name) ? data[dataitem.name] : null;
}
if((isCreate === undefined || isCreate === null ) && Object.is(dataitem.dataType, 'GUID') && Object.is(dataitem.name, 'srfkey') && (val && !Object.is(val, ''))){
isCreate = true;
}
item[dataitem.name] = val;
// 转化代码表
if(codelistArray && dataitem.codelist){
if(codelistArray.get(dataitem.codelist.tag) && codelistArray.get(dataitem.codelist.tag).get(val)){
item[dataitem.name] = codelistArray.get(dataitem.codelist.tag).get(val);
}
}
});
item.srfuf = data.srfuf ? data.srfuf : (isCreate ? "0" : "1");
item = Object.assign(data,item);
return item;
}
/**
* 设置远端数据
*
* @param result 远端请求结果
* @memberof QUICKSEARCHFORMService
*/
public setRemoteCopyData(result:any){
if (result && result.status === 200) {
this.remoteCopyData = Util.deepCopy(result.data);
}
}
/**
* 获取远端数据
*
* @memberof QUICKSEARCHFORMService
*/
public getRemoteCopyData(){
return this.remoteCopyData;
}
}
\ No newline at end of file
.ivu-tabs-no-animation>.ivu-tabs-content{
padding: 0 16px;
}
.ivu-card-head{
padding: 14px 0;
}
.app-search-form {
padding: 8px 14px 0;
.ivu-form-item{
margin-bottom: 8px;
}
.search_reset {
margin-right: 12px;
margin-bottom: 8px;
}
.search-button{
text-align: right;
}
}
.app-search-form-flex {
height: 100%;
> .ivu-row {
height: 100%;
> .ivu-tabs {
height: 100%;
display: flex;
flex-direction: column;
> .ivu-tabs-content {
flex-grow: 1;
overflow: auto;
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
}
}
.app-tabpanel-flex {
height: 100%;
> .ivu-tabs-content {
height: calc(100% - 52px);
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import QUICKSEARCHFORMBase from './quicksearchform-searchform-base.vue';
@Component({
components: {
}
})
export default class QUICKSEARCHFORM extends QUICKSEARCHFORMBase {
}
</script>
\ No newline at end of file
......@@ -34,6 +34,13 @@ public class IBIZBOOKSearchContext extends QueryWrapperContext<IBIZBOOK> {
this.getSearchCond().like("ibizbookname", n_ibizbookname_like);
}
}
private String n_price_gtandeq;//[图书价格]
public void setN_price_gtandeq(String n_price_gtandeq) {
this.n_price_gtandeq = n_price_gtandeq;
if(!ObjectUtils.isEmpty(this.n_price_gtandeq)){
this.getSearchCond().ge("price", n_price_gtandeq);
}
}
/**
* 启用快速搜索
......
......@@ -28,7 +28,7 @@
<!--输出实体[IBIZBOOK]数据结构 -->
<changeSet author="a_LAB01_df847bdfd" id="tab-ibizbook-75-2">
<changeSet author="a_LAB01_df847bdfd" id="tab-ibizbook-82-2">
<createTable tableName="T_IBIZBOOK">
<column name="CREATEMAN" remarks="" type="VARCHAR(60)">
</column>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册