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

组件提示统一 调整

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