提交 fc714bc6 编写于 作者: KK's avatar KK

组件提示统一 调整

上级 1801913c
......@@ -147,10 +147,8 @@ export default class AppMobFileUpload extends Vue {
'Content-Type': 'multipart/form-data'
}
}
Loading.show();
Axios.post(this.uploadUrl, params, config).then((response: any) => {
if (response && response.data && response.status === 200) {
Loading.hidden();
let data: any = response.data;
if (process.env.NODE_ENV === 'development') {
this.devFiles.push(Object.assign({}, data, {
......@@ -159,11 +157,9 @@ export default class AppMobFileUpload extends Vue {
}
this.onSuccess(data, file, this.files);
} else {
Loading.hidden();
this.onError(response, file, this.files);
}
}).catch((response: any) => {
Loading.hidden();
this.onError(response, file, this.files);
});
}
......
......@@ -342,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.$notice.error(this.$t("missingParameters") + 'service' )
} else if (!this.acParams.serviceName) {
this.$notify({ type: 'danger', message: this.$t("missingParameters") + 'serviceName' })
this.$notice.error(this.$t("missingParameters") + 'serviceName' )
} else if (!this.acParams.interfaceName) {
this.$notify({ type: 'danger', message: this.$t("missingParameters") + 'interfaceName' })
this.$notice.error(this.$t("missingParameters") + 'interfaceName')
} else {
let { serviceName: _serviceName, interfaceName: _interfaceName }: { serviceName: string, interfaceName: string } = this.acParams;
const appEntityServiceConstructor = window.appEntityServiceConstructor;
......@@ -354,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.$notice.error(`${this.$t("requestException")}`)
} else {
this.items = [...response.data];
}
......@@ -551,7 +551,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.$notice.error(`${this.$t("requestException")}`);
}
if (response.status === 401) {
return;
......@@ -603,7 +603,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.$notice.error(`${this.$t('systemIsAbnormal')}`);
return;
}
if (response.status === 401) {
......@@ -622,7 +622,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.$notice.error(`${this.$t('valueItemIsAbnormal')}`);
return;
}
// 公共参数处理
......
......@@ -130,7 +130,7 @@ export default class AppMobPicture extends Vue {
public beforeRead(file: any, detail: any): boolean {
this.dataProcess();
if (file && Array.isArray(file)) {
this.$notify({ type: 'warning', message: `${this.$t('one_doc')}` });
this.$notice.warning(`${this.$t('one_doc')}`);
return false;
}
return true;
......@@ -152,7 +152,7 @@ export default class AppMobPicture extends Vue {
'Content-Type': 'multipart/form-data'
}
}
Loading.show();
Axios.post(this.uploadUrl, params, config).then((response: any) => {
Loading.hidden();
if (response && response.data && response.status === 200) {
......@@ -165,11 +165,10 @@ export default class AppMobPicture extends Vue {
this.onError(response, file, this.files);
}
}).catch((response: any) => {
Loading.hidden();
this.onError(response, file, this.files);
});
}
// MOB LOGIC END
/**
* 是否支持多个上传
......@@ -359,44 +358,6 @@ export default class AppMobPicture extends Vue {
});
}
/**
* vue 生命周期
*
* @memberof AppMobPicture
*/
public created() {
this.platform = Capacitor.getPlatform();
if (this.formState) {
this.formStateEvent = this.formState.subscribe(($event: any) => {
// 表单加载完成
if (Object.is($event.type, 'load')) {
if (this.value) {
this.files = JSON.parse(this.value);
}
this.dataProcess();
}
// 表单保存完成 和 表单项更新
if (Object.is($event.type, "save") || Object.is($event.type, "updateformitem")) {
this.dataProcess();
}
});
}
}
/**
* vue 生命周期
*
* @memberof AppMobPicture
*/
public mounted() {
this.appData = this.$store.getters.getAppData();
if (this.value) {
this.files = JSON.parse(this.value);
}
this.dataProcess();
this.changeLabelStyle();
}
/**
* 修改label默认样式
* @memberof AppMobPicture
......@@ -475,7 +436,7 @@ export default class AppMobPicture extends Vue {
* @memberof AppMobPicture
*/
public onError(error: any, file: any, fileList: any) {
this.$notify({ type: 'danger', message: `${this.$t('upload_failed')}` });
this.$notice.error(`${this.$t('upload_failed')}`);
}
/**
......@@ -527,6 +488,44 @@ export default class AppMobPicture extends Vue {
let base = image.base64String;
this.$emit('formitemvaluechange', { name: this.name, value: this.files });
}
/**
* vue 生命周期
*
* @memberof AppMobPicture
*/
public created() {
this.platform = Capacitor.getPlatform();
if (this.formState) {
this.formStateEvent = this.formState.subscribe(($event: any) => {
// 表单加载完成
if (Object.is($event.type, 'load')) {
if (this.value) {
this.files = JSON.parse(this.value);
}
this.dataProcess();
}
// 表单保存完成 和 表单项更新
if (Object.is($event.type, "save") || Object.is($event.type, "updateformitem")) {
this.dataProcess();
}
});
}
}
/**
* vue 生命周期
*
* @memberof AppMobPicture
*/
public mounted() {
this.appData = this.$store.getters.getAppData();
if (this.value) {
this.files = JSON.parse(this.value);
}
this.dataProcess();
this.changeLabelStyle();
}
}
</script>
......
......@@ -641,7 +641,7 @@ export default class AppMobRecorder extends Vue {
* @memberof AppMobRecorder
*/
public onError(error: any, file: any, fileList: any) {
this.$notify({ type: 'danger', message: `${this.$t('uploadfailed')}` });
this.$notice.error(`${this.$t('uploadfailed')}`);
}
/**
......
......@@ -348,7 +348,7 @@ export class MOBMDCTRLBase extends ControlBase {
Object.assign(data, parentdata);
const response: any = await this.service.search(this.fetchAction, this.context, data, this.showBusyIndicator);
if (!response || response.status !== 200) {
this.$notify({ type: 'danger', message: response.error.message });
this.$notice.error({ type: 'danger', message: response.error.message });
return response;
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册