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

整理代码格式化处理

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