From f9aa1010e164e21a3c8147e0f2e13b828676800a Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 29 八月 2025 18:38:55 +0800
Subject: [PATCH] initialEvent 输入参数格式和web端保持一致
---
pages/modal/3202_view.vue | 308 +++++++++++++++++++++++++-------------------------
1 files changed, 153 insertions(+), 155 deletions(-)
diff --git a/pages/modal/3202_view.vue b/pages/modal/3202_view.vue
index 0ab4c7e..a4501b9 100644
--- a/pages/modal/3202_view.vue
+++ b/pages/modal/3202_view.vue
@@ -33,6 +33,10 @@
import {
Base64
} from '@/js/Base64.js';
+ import {
+ showInfo,
+ showError
+ } from "@/js/Page.js"
import classUtils from "@/js/utils.js"
import {
appGetInfo,
@@ -55,7 +59,7 @@
},
data() {
return {
- largeMode: getApp().globalData.largeMode || false,
+ largeMode: getApp().globalData.largeMode || false,
title: this.translateSys('add2'),
param: {},
styledef: {},
@@ -109,7 +113,7 @@
},
},
onBackPress(e) {
- this.navigateBackEvent()
+ this.beforeNavigateBack()
},
async onLoad(options) {
console.log(options);
@@ -234,13 +238,7 @@
}
} catch (ex) {
// console.log(ex);
- let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex
- uni.showModal({
- title: this.translateSys("error") + "1.1",
- content: tip,
- showCancel: false,
- confirmText: this.translateSys('close')
- });
+ showError(ex, this.translateSys('error') + "1.1")
}
},
@@ -265,13 +263,7 @@
$this.detail1_styledef.SelBut_Checked = false;
} catch (ex) {
// console.log(ex);
- let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex
- uni.showModal({
- title: this.translateSys("error") + "1.1",
- content: tip,
- showCancel: false,
- confirmText: this.translateSys('close')
- });
+ showError(ex, this.translateSys('error') + "1.1")
}
@@ -309,12 +301,7 @@
}
} catch (ex) {
// console.log(ex);
- uni.showModal({
- title: this.translateSys("error") + "3",
- content: ex.errMsg,
- showCancel: false,
- confirmText: this.translateSys('close')
- });
+ showError(ex, this.translateSys('error') + "3")
}
},
viewAceionContent(list) {
@@ -322,9 +309,10 @@
return;
}
let styleStr = JSON.stringify(this.detail1_styledef); //宸茬爜鐩�- let detailStyle = JSON.parse(styleStr);
+
list.forEach((cont) => {
let attrs = [];
+ let detailStyle = JSON.parse(styleStr);
Object.keys(cont).forEach((a) => {
attrs.push({
attr: a,
@@ -394,7 +382,7 @@
})
} catch (ex) {
- this.showError(ex);
+ showError(ex, this.translateSys('tip'));
}
},
@@ -403,71 +391,55 @@
async runCustomEvent(dataInfo) {
try {
var $this = this;
-
+
runCustomEvent(dataInfo).then(result => {
console.log(result);
- if (result.ret != 0) {
- var tip = result.err_info ? typeof result
- .err_info ==
- 'string' ?
+ if (result.ret != 0 && result.ret != 1) {
+ let cls_name = result.event_info?.cls_name
+ let event_name = result.event_info?.event_name
+ tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info :
result
- .err_info : result.err_info.join(
- '<br/>') : '';
+ .err_info
+ .join('\n') : ''
if (result.ret == 801) {
if (this.param.Only_Script_Error) {
let pos = tip.indexOf("锛�);
- if (pos > -1) tip = tip.substring(
- pos + 1);
+ if (pos > -1) tip = tip.substring(pos + 1);
}
- uni.showModal({
- title: this.translateSys(
- "tip"),
- content: tip,
- showCancel: false,
- confirmText: this
- .translateSys('close')
- });
- } else uni.showModal({
- title: this.translateSys(
- "tip"),
- content: tip + ',' + this
- .translateSys('tip') +
- ':' +
- result.ret,
- showCancel: false,
- confirmText: this.translateSys(
- 'close')
- });
- return false;
+ }
+ if (cls_name && event_name) tip =
+ `鎵ц鈥�{cls_name}鈥濇暟鎹被鐨勨�${event_name}鈥濊剼鏈椂杩斿洖閿欒锛�{tip}`
+ if (result.ret == 801) showInfo(tip)
+ else showError(`${tip}锛屾彁绀猴細${result.ret}`, this.translateSys('tip'))
+ this.saving = false
+ return false
} else {
- var tip = result.info ? typeof result
- .info == 'string' ? result
- .info : result
- .info.join('<br/>') : '';
- if (tip) uni.showModal({
- title: this.translateSys(
- "tip"),
- content: tip,
- showCancel: false,
- confirmText: this.translateSys(
- 'close')
- });
+ var tip = result.info ? typeof result.info == 'string' ? result.info :
+ result.info.join('\n') : '';
+ tip = tip || result.err_info
+ let time = result.info_time || 0
+ if (time)
+ showError(tip, this.translateSys('tip'))
+ else
+ showInfo(tip)
+ if ([0, 2, 3, 4, -1].includes(result.result_type)) {
+ if (result.result_type == 2) {
- if (result.result_type == 0 && result.action) {
- result.action.forEach(item => {
- if (item.action_type == "goback_to_pre_page") { //杩斿洖涓婁竴椤�- var value = item.value;
- uni.navigateBack({
- delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
- });
- } else {
- uni.showModal({
- title: this
- .translateSys(
- "tip"
- ),
- content: this
+ } else if (typeof result.result == 'string') {
+ showInfo(result.result)
+
+ }
+ try {
+ var actionList = result.action || []
+ actionList.forEach(item => {
+ if (item.action_type == "goback_to_pre_page") { //杩斿洖涓婁竴椤�+ var value = item.value;
+ uni.navigateBack({
+ delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
+ });
+ } else {
+ showInfo(this
.translateSys(
"quotation_mark_left"
) +
@@ -480,53 +452,28 @@
this
.translate(
"tip_action_unprocessed"
- ),
- showCancel: false,
- confirmText: this
- .translateSys(
- 'close'
- )
- });
- }
- });
- } else {
- if (result.info) {
- uni.showModal({
- title: this
- .translateSys(
- "tip"),
- content: result.info,
- showCancel: false,
- confirmText: this
- .translateSys(
- 'close')
+ ))
+
+ }
});
+
+ } catch (ex) {
+ let actionList = (result.action || []).map(a => a.action_type).join(';')
+ let tip = typeof ex == 'string' ? ex : ex.message
+ tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+ showError(tip, this.translateSys('tip'))
+ return
}
}
+
}
}).catch(ex => {
console.log(ex);
- uni.showModal({
- title: this.translateSys("error") +
- "9.1",
- content: ex.errMsg,
- showCancel: false,
- confirmText: this.translateSys(
- 'close')
- });
+ showError(ex, this.translateSys("error") + "9.1")
+
});
} catch (ex) {
- var tip = typeof ex == "string" ? ex : ex.message;
- uni.showModal({
- title: this.translateSys("error") + "9.2",
- content: this.translate('execute_event_failed') +
- this.translateSys(
- "comma") +
- this.translate('reason') + this.translateSys(
- "colon") + tip,
- showCancel: false,
- confirmText: this.translateSys('close')
- });
+ showError(ex, this.translateSys('error') + "9.2")
}
},
@@ -548,7 +495,7 @@
})
},
onButtonClicked(btn) {
-
+
let enviroment = {
button: "top",
button_name: btn.ShowName,
@@ -561,12 +508,12 @@
} else {
this.$Message.warning(this.$t("sys.unrealized"));
}
-
+
},
async onTriggerEvent(btn, enviroment) {
let data_json = [];
let jsonlist = [];
-
+
let detailStyleList = this.detail1StyleDefList;
detailStyleList.forEach((style) => {
let detail_attr = {};
@@ -599,51 +546,102 @@
data_json,
});
},
- navigateBackEvent() {
- if (!this.exit_view_event.id)
- return
- let data_json = [];
- let jsonlist = [];
- let detailStyleList = this.detail1StyleDefList;
- detailStyleList.forEach((style) => {
- let detail_attr = {};
- style.form.items.forEach((item) => {
+ async navigateBackEvent() {
+ try {
+ var $this = this;
+ if (!this.exit_view_event.id)
+ return
+ let data_json = [];
+ let jsonlist = [];
+ let detailStyleList = this.detail1StyleDefList;
+ detailStyleList.forEach((style) => {
+ let detail_attr = {};
+ style.form.items.forEach((item) => {
+ if (item.name == "Layout") {
+ item.setting.colList.forEach((cols) => {
+ if (cols != null) detail_attr[cols.fieldId] = cols.value;
+ });
+ } else detail_attr[item.fieldId] = item.value;
+ });
+ jsonlist.push(detail_attr);
+ });
+ data_json = Base64.encode(JSON.stringify(jsonlist));
+
+ let input_param = {};
+ this.head_styledef.form.items.forEach((item) => {
if (item.name == "Layout") {
item.setting.colList.forEach((cols) => {
- if (cols != null) detail_attr[cols.fieldId] = cols.value;
+ if (cols != null) input_param[cols.fieldId] = cols.value;
});
- } else detail_attr[item.fieldId] = item.value;
+ } else input_param[item.fieldId] = item.value;
});
- jsonlist.push(detail_attr);
- });
- data_json = Base64.encode(JSON.stringify(jsonlist));
+ input_param = Base64.encode(JSON.stringify(input_param));
+ const result = await runCustomEvent({
+ ed_type: 0,
+ start_transaction: true,
+ class_id: this.param.ClsID,
+ event_id: this.exit_view_event.id,
+ input_param,
+ data_json,
+ })
+ if (result.ret != 0 && result.ret != 1) {
+ let cls_name = result.event_info?.cls_name
+ let event_name = result.event_info?.event_name
+ tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info :
+ result
+ .err_info
+ .join('\n') : ''
+ if (result.ret == 801) {
+ if (this.param.Only_Script_Error) {
+ let pos = tip.indexOf("锛�);
+ if (pos > -1) tip = tip.substring(pos + 1);
+ }
+ }
+ if (cls_name && event_name) tip =
+ `鎵ц鈥�{cls_name}鈥濇暟鎹被鐨勨�${event_name}鈥濊剼鏈椂杩斿洖閿欒锛�{tip}`
+ if (result.ret == 801) showInfo(tip)
+ else showError(`${tip}锛屾彁绀猴細${result.ret}`, this.translateSys('tip'))
+ this.saving = false
+ return false
+ } else {
+ var tip = result.info ? typeof result.info == 'string' ? result.info :
+ result.info.join('\n') : '';
+ tip = tip || result.err_info
+ let time = result.info_time || 0
+ if (time)
+ showError(tip, this.translateSys('tip'))
+ else
+ showInfo(tip)
+ if ([0, 2, 3, 4, -1].includes(result.result_type)) {
+ if (result.result_type == 2) {
- let input_param = {};
- this.head_styledef.form.items.forEach((item) => {
- if (item.name == "Layout") {
- item.setting.colList.forEach((cols) => {
- if (cols != null) input_param[cols.fieldId] = cols.value;
- });
- } else input_param[item.fieldId] = item.value;
- });
- input_param = Base64.encode(JSON.stringify(input_param));
- const eventChannel = this.getOpenerEventChannel();
+ } else if (typeof result.result == 'string') {
+ showInfo(result.result)
+ }
- eventChannel.emit('ExitViewEvent', {
- ed_type: 0,
- start_transaction: true,
- class_id: this.param.ClsID,
- event_id: this.exit_view_event.id,
- input_param,
- data_json,
- });
+ }
+
+ }
+
+ } catch (ex) {
+ showError(ex, this.translateSys('error') + "9.2")
+
+ }
+
},
- cancel(e) { //鍙栨秷
- this.navigateBackEvent()
+ cancel(e) { //鍙栨秷
+
+ this.beforeNavigateBack()
uni.navigateBack({
delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
});
},
+ async beforeNavigateBack()
+ {
+ await this.navigateBackEvent()
+ const eventChannel = this.getOpenerEventChannel();
+ eventChannel.emit('ExitViewPage');
+ },
/**
* 鍙敮鎸乕"column1='A' or column2='B'", "column3='C' and column4='D'", "column5='E'"]杩欑鏍煎紡
* {
--
Gitblit v1.9.1