提交 3cc1d4b3 编写于 作者: zcdtk's avatar zcdtk

整理代码格式化处理

上级 c5d2b7ca
......@@ -3,28 +3,13 @@
<ion-input class="ibz-input" :value="refvalue" @ionFocus="openView"></ion-input>
<ion-icon v-if="refvalue" class="delete-value " name="close-circle-outline" @click="onClear"></ion-icon>
<ion-icon class="open-picker" name="search-outline" @click="openView"></ion-icon>
<!-- <van-field
:value="refvalue"
clearable
right-icon="search"
@click-right-icon="openView"
style="padding: 0px;"
@focus="onSelectOpen($event, true)"
@blur="onBlur($event)"
@clear="onClear($event)"
@input="onInput($event)">
</van-field>
<div class="app-picker-item" v-if="open">
<template v-for="item in items">
<van-cell :key="item.value" :clickable="true" :title="item.text" @click="onSelect($event, item.value, false)"/>
</template>
</div> -->
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Model, Watch } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs';
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
import { ViewOpenService } from '../../utils/view-open-service/view-open-service';
@Component({
i18n: {
......@@ -215,6 +200,14 @@ export default class AppPicker extends Vue {
*/
public selectValue = this.value;
/**
* 视图打开服务
*
* @type {ViewOpenService}
* @memberof AppPicker
*/
public openService: ViewOpenService = ViewOpenService.getInstance();
/**
* 获取关联数据项值
*
......@@ -223,12 +216,12 @@ export default class AppPicker extends Vue {
*/
get refvalue() {
if (this.valueitem && this.data) {
if(this.data[this.deMajorField]){
if (this.data[this.deMajorField]) {
return this.data[this.deMajorField];
}else{
} else {
return this.value;
}
}
return this.curvalue;
}
......@@ -349,11 +342,11 @@ export default class AppPicker extends Vue {
this.inputState = false;
Object.assign(_param, { query: query });
if (!this.service) {
this.$notify({ type: 'danger', message: this.$t("missingParameters")+'service' })
this.$notify({ type: 'danger', message: this.$t("missingParameters") + 'service' })
} else if (!this.acParams.serviceName) {
this.$notify({ type: 'danger', message: this.$t("missingParameters")+'serviceName' })
this.$notify({ type: 'danger', message: this.$t("missingParameters") + 'serviceName' })
} else if (!this.acParams.interfaceName) {
this.$notify({ type: 'danger', message: this.$t("missingParameters")+'interfaceName' })
this.$notify({ type: 'danger', message: this.$t("missingParameters") + 'interfaceName' })
} else {
let { serviceName: _serviceName, interfaceName: _interfaceName }: { serviceName: string, interfaceName: string } = this.acParams;
const appEntityServiceConstructor = window.appEntityServiceConstructor;
......@@ -361,7 +354,7 @@ export default class AppPicker extends Vue {
if (entityService && entityService[_interfaceName] && entityService[_interfaceName] instanceof Function) {
entityService[_interfaceName](_context, _param).then((response: any) => {
if (!response) {
this.$notify({ type: 'danger', message: this.$t("requestException")+"" })
this.$notify({ type: 'danger', message: this.$t("requestException") + "" })
} else {
this.items = [...response.data];
}
......@@ -477,8 +470,8 @@ export default class AppPicker extends Vue {
* @memberof AppPicker
*/
private openIndexViewTab(view: any, context: any, param: any): void {
const routePath = this.$viewTool.buildUpRoutePath(this.$route, this.context, view.deResParameters, view.parameters, [context], param);
this.$router.push(routePath);
const routeStr: any = this.openService.formatRouteParam(this.context, view.deResParameters, view.parameters, [context], param);
this.$router.push(routeStr);
}
/**
......@@ -556,7 +549,7 @@ export default class AppPicker extends Vue {
private openRedirectView($event: any, view: any, data: any): void {
this.$http.get(view.url, data).then((response: any) => {
if (!response || response.status !== 200) {
this.$notify({ type: 'danger', message: this.$t("requestException")+"" });
this.$notify({ type: 'danger', message: this.$t("requestException") + "" });
}
if (response.status === 401) {
return;
......@@ -608,7 +601,7 @@ export default class AppPicker extends Vue {
}
}).catch((response: any) => {
if (!response || !response.status || !response.data) {
this.$notify({ type: 'danger', message: this.$t('systemIsAbnormal')+"" });
this.$notify({ type: 'danger', message: this.$t('systemIsAbnormal') + "" });
return;
}
if (response.status === 401) {
......@@ -627,7 +620,7 @@ export default class AppPicker extends Vue {
return;
}
if (!this.data || !this.valueitem || !this.data[this.valueitem]) {
this.$notify({ type: 'danger', message: this.$t('valueItemIsAbnormal')+"" });
this.$notify({ type: 'danger', message: this.$t('valueItemIsAbnormal') + "" });
return;
}
// 公共参数处理
......@@ -691,12 +684,12 @@ export default class AppPicker extends Vue {
return false;
}
// 合并表单参数
arg.param = this.viewparams ? {...this.viewparams} : {};
arg.context = this.context ? {...this.context} : {};
arg.param = this.viewparams ? { ...this.viewparams } : {};
arg.context = this.context ? { ...this.context } : {};
// 附加参数处理
const param = this.$viewTool.formatNavigateParam({context:this.navigateContext,param:this.navigateParam},this.context,this.viewparams,this.data);
Object.assign(arg.context,param.context);
Object.assign(arg.param,param.param);
const param = this.$viewTool.formatNavigateParam({ context: this.navigateContext, param: this.navigateParam }, this.context, this.viewparams, this.data);
Object.assign(arg.context, param.context);
Object.assign(arg.param, param.param);
return true;
}
......
......@@ -8,19 +8,11 @@
</template>
<script lang="ts">
import {
Vue,
Component,
Prop,
Provide,
Emit,
Watch,
Model
} from "vue-property-decorator";
import CodeListService from "@app-core/service/app/code-list-service";
import { Vue, Component, Prop, Watch, Model } from "vue-property-decorator";
import { Subject } from 'rxjs';
import { ViewOpenService } from '../../utils/view-open-service/view-open-service';
@Component({
components: {}
components: {}
})
export default class AppSelectDropDown extends Vue {
/**
......@@ -45,7 +37,7 @@ export default class AppSelectDropDown extends Vue {
* @type {*}
* @memberof AppSelectDropDown
*/
@Prop({default: () => {}}) public acParams?: any;
@Prop({ default: () => { } }) public acParams?: any;
/**
* 表单服务
......@@ -61,7 +53,7 @@ export default class AppSelectDropDown extends Vue {
* @type {string}
* @memberof AppSelectDropDown
*/
@Prop({default: 'srfmajortext'}) public deMajorField!: string;
@Prop({ default: 'srfmajortext' }) public deMajorField!: string;
/**
* 应用实体主键属性名称
......@@ -69,7 +61,7 @@ export default class AppSelectDropDown extends Vue {
* @type {string}
* @memberof AppSelectDropDown
*/
@Prop({default: 'srfkey'}) public deKeyField!: string;
@Prop({ default: 'srfkey' }) public deKeyField!: string;
/**
* 表单数据
......@@ -102,7 +94,7 @@ export default class AppSelectDropDown extends Vue {
* @memberof AppSelectDropDown
*/
@Prop() public editortype?: string;
/**
* 视图参数(如:视图name,title,width,height)
......@@ -190,13 +182,21 @@ export default class AppSelectDropDown extends Vue {
*/
public inputState: boolean = false;
/**
* 当前选择的值
/**
* 当前选择的值
*
* @type {string}
* @memberof AppSelectDropDown
*/
public selectValue = this.value;
/**
* 视图打开服务
*
* @type {string}
* @type {ViewOpenService}
* @memberof AppSelectDropDown
*/
public selectValue = this.value;
public openService: ViewOpenService = ViewOpenService.getInstance();
/**
* 获取关联数据项值
......@@ -211,13 +211,13 @@ export default class AppSelectDropDown extends Vue {
return this.curvalue;
}
/**
* 关联数据项值
*
* @readonly
* @memberof AppSelectDropDown
*/
set refvalue(item:any){
/**
* 关联数据项值
*
* @readonly
* @memberof AppSelectDropDown
*/
set refvalue(item: any) {
this.onSelect(item);
}
......@@ -239,9 +239,9 @@ export default class AppSelectDropDown extends Vue {
}
this.items = [];
if (value) {
this.items.push({text: newVal, value: value});
this.items.push({ text: newVal, value: value });
}
this.onSearch(newVal, false);
this.onSearch(newVal, false);
}
}
......@@ -252,8 +252,8 @@ export default class AppSelectDropDown extends Vue {
* @memberof AppSelectDropDown
*/
public created() {
if(Object.is(this.editortype, 'dropdown')){
this.onSearch(null,true);
if (Object.is(this.editortype, 'dropdown')) {
this.onSearch(null, true);
}
}
......@@ -288,7 +288,7 @@ export default class AppSelectDropDown extends Vue {
* @param query
* @param callback
*/
public async onSearch(query:any,other: boolean): Promise<any> {
public async onSearch(query: any, other: boolean): Promise<any> {
// 公共参数处理
let data: any = {};
const bcancel: boolean = this.handlePublicParams(data);
......@@ -306,7 +306,7 @@ export default class AppSelectDropDown extends Vue {
Object.assign(_param, { query: query });
if (!this.acParams.serviceName || !this.acParams.interfaceName) {
this.$notice.error('请在对应实体属性中配置关联实体与数据集!');
return ;
return;
}
const appEntityServiceConstructor = window.appEntityServiceConstructor;
const entityService: any = await appEntityServiceConstructor.getService(this.acParams.serviceName);
......@@ -323,22 +323,22 @@ export default class AppSelectDropDown extends Vue {
/**
* 处理返回数据格式
*/
public result(items:any) {
/**
* 处理返回数据格式
*/
public result(items: any) {
let _data = [];
items.forEach((item:any,index:number) => {
if(item[this.deMajorField]){
items.forEach((item: any, index: number) => {
if (item[this.deMajorField]) {
items[index].text = item[this.deMajorField];
}
if(item[this.deKeyField]){
if (item[this.deKeyField]) {
items[index].value = item[this.deKeyField];
}
});
}
......@@ -418,7 +418,7 @@ export default class AppSelectDropDown extends Vue {
} else {
this.openPopupModal(view, _context, _param);
}
}
/**
......@@ -430,8 +430,8 @@ export default class AppSelectDropDown extends Vue {
* @memberof AppSelectDropDown
*/
private openIndexViewTab(view: any, context: any, param: any): void {
const routePath = this.$viewTool.buildUpRoutePath(this.$route, this.context, view.deResParameters, view.parameters, [context] , param);
this.$router.push(routePath);
const routeStr: any = this.openService.formatRouteParam(this.context, view.deResParameters, view.parameters, [context], param);
this.$router.push(routeStr);
}
/**
......@@ -537,7 +537,7 @@ export default class AppSelectDropDown extends Vue {
width: result.width,
height: result.height,
}
this.openPopupModal(view, null,data);
this.openPopupModal(view, null, data);
} else if (result.openmode.startsWith('DRAWER')) {
const viewname = this.$util.srfFilePath2(result.viewname);
const view: any = {
......@@ -624,10 +624,10 @@ export default class AppSelectDropDown extends Vue {
if (this.data) {
if (this.valueitem) {
this.$emit('formitemvaluechange', { name: this.valueitem, value: item[this.deKeyField]?item[this.deKeyField]:item["srfkey"] });
this.$emit('formitemvaluechange', { name: this.valueitem, value: item[this.deKeyField] ? item[this.deKeyField] : item["srfkey"] });
}
if (this.name) {
this.$emit('formitemvaluechange', { name: this.name, value: item[this.deMajorField]?item[this.deMajorField]:item["srfmajortext"] });
this.$emit('formitemvaluechange', { name: this.name, value: item[this.deMajorField] ? item[this.deMajorField] : item["srfmajortext"] });
}
}
}
......@@ -644,12 +644,12 @@ export default class AppSelectDropDown extends Vue {
return false;
}
// 合并表单参数
arg.param = this.viewparams ? {...this.viewparams} : {};
arg.context = this.context ? {...this.context} : {};
arg.param = this.viewparams ? { ...this.viewparams } : {};
arg.context = this.context ? { ...this.context } : {};
// 附加参数处理
const param = this.$viewTool.formatNavigateParam({context:this.navigateContext,param:this.navigateParam},this.context,this.viewparams,this.data);
Object.assign(arg.context,param.context);
Object.assign(arg.param,param.param);
const param = this.$viewTool.formatNavigateParam({ context: this.navigateContext, param: this.navigateParam }, this.context, this.viewparams, this.data);
Object.assign(arg.context, param.context);
Object.assign(arg.param, param.param);
return true;
}
......@@ -660,7 +660,7 @@ export default class AppSelectDropDown extends Vue {
* @returns
* @memberof AppSelectDropDown
*/
public newAndEdit($event:any){
public newAndEdit($event: any) {
if (this.disabled) {
return;
}
......@@ -686,7 +686,7 @@ export default class AppSelectDropDown extends Vue {
} else {
this.openPopupModal(view, _context, _param);
}
}
/**
......@@ -707,7 +707,7 @@ export default class AppSelectDropDown extends Vue {
*/
public openDropdown() {
const appPicker: any = this.$refs.appPicker;
if(appPicker) {
if (appPicker) {
appPicker.focus();
}
}
......@@ -719,7 +719,7 @@ export default class AppSelectDropDown extends Vue {
*/
public closeDropdown() {
const appPicker: any = this.$refs.appPicker;
if(appPicker) {
if (appPicker) {
appPicker.blur();
}
}
......@@ -733,7 +733,7 @@ export default class AppSelectDropDown extends Vue {
* @returns {any}
* @memberof AppSelectDropDown
*/
public formatData(arg: any, params: any): any {
public formatData(arg: any, params: any): any {
let _data: any = {};
Object.keys(params).forEach((name: string) => {
if (!name) {
......@@ -759,7 +759,7 @@ export default class AppSelectDropDown extends Vue {
* @memberof AppSelect
*/
public change(value: any) {
this.curvalue = value.detail.value;
this.curvalue = value.detail.value;
this.$emit("change", value.detail.value);
}
......@@ -767,9 +767,9 @@ export default class AppSelectDropDown extends Vue {
* 清空值
* @memberof AppSelect
*/
public clear(){
this.curvalue="";
this.$emit('change','')
public clear() {
this.curvalue = "";
this.$emit('change', '')
}
}
</script>
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册