From 07925905f1a596e20e980de6d42db217abb753b0 Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期五, 12 十二月 2025 18:06:11 +0800
Subject: [PATCH] plugin
---
pages/modal/3018_2.vue | 714 ++++++++++++++++++++++++++++++-----------------------------
1 files changed, 360 insertions(+), 354 deletions(-)
diff --git a/pages/modal/3018_2.vue b/pages/modal/3018_2.vue
index 7fbcdcf..b4a257d 100644
--- a/pages/modal/3018_2.vue
+++ b/pages/modal/3018_2.vue
@@ -58,7 +58,9 @@
import utils from "@/js/utils.js"
import {
showInfo,
- showError
+ showError,
+ showLoading,
+ hideLoading
} from "@/js/Page.js"
import dayjs from "dayjs";
import OIForm from '@/components/oi-form/index.vue'
@@ -114,7 +116,7 @@
uni.scanCode({
scanType: ["qrCode", 'barCode'],
success: function(res) {
-
+ console.log(res)
if ($this.focusFieldId) {
const items = $this.head_styledef.form.items || []
for (let i in items) {
@@ -175,14 +177,16 @@
this.loadData()
}
},
+ onReady() {
+ uni.setNavigationBarTitle({
+ title: this.title
+ }); //璁剧疆椤堕儴鏍囬
+ },
onLoad(options) {
// console.log(options);
- uni.setNavigationBarTitle({
- title: options.titlename
- }); //璁剧疆椤堕儴鏍囬
+
this.param = JSON.parse(options.param);
- this.title = this.param.Add_BtnName ? this.param.Add_BtnName : options
- .titlename; //璁剧疆鎸夐挳鏂囧瓧
+ this.title = options.titlename; //璁剧疆鎸夐挳鏂囧瓧 this.param.Add_BtnName ? this.param.Add_BtnName :
this.btnName = this.param.Add_BtnName || ""
const paramValue = options.paramValue ? JSON.parse(options.paramValue) : undefined
this.loadData(paramValue)
@@ -225,44 +229,52 @@
});
},
async loadData(paramValue) {
+ try {
+ showLoading("loading...")
+ //鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�+ await this.Head_UIStyleGetInfo(this.param.DataCls?.id, this.param.UI_Style?.ID);
+ //浼犲叆鍙傛暟鍊�+ if (paramValue) {
- //鑾峰彇鏁版嵁绫荤殑鑷畾涔夎〃鍗曞弬鏁�- await this.Head_UIStyleGetInfo(this.param.DataCls?.id, this.param.UI_Style?.ID);
- //浼犲叆鍙傛暟鍊�- if (paramValue) {
-
- this.setFormValues(paramValue)
- // const attrs = paramValue.attrs || [];
- // (this.head_styledef?.form?.items || []).forEach(async (ele, index) => {
- // if (ele.name != "Layout") {
- // attrs.forEach(async (ele2, index2) => {
- // if (ele.fieldId == ele2.name) {
- // ele.value = ele2.value;
- // }
- // });
- // } else {
- // ele.setting.colList.forEach(async (col) => {
- // if (col) {
- // attrs.forEach(async (ele2,
- // index2) => {
- // if (col.fieldId == ele2.name) {
- // col.value = ele2.value;
- // }
- // });
- // }
- // });
- // }
- // })
-
+ this.setFormValues(paramValue)
+ }
+ await this.loadInitialEvent();
+ hideLoading()
+ } catch (ex) {
+ hideLoading()
+ showError(ex, this.translateSys("error"));
}
- await this.loadInitialEvent();
},
async loadInitialEvent() {
try {
- if (this.initialEvent.id) {
- this.onChange(this.initialEvent)
+ var eventid = this.initialEvent?.id; //鍐呭鍙樺寲鍚庝簨浠�+ if (eventid) {
+ // self.event_no_sub = 1;
+ let obj_attr = this.head_styledef.form.model;
+ let req = {
+ id: "",
+ attrs: Object.keys(obj_attr).map((a) => ({
+ attr: a,
+ value: obj_attr[a],
+ })),
+ };
+
+ var info = {
+ eventid: eventid,
+ edtype: "0",
+ projectid: '',
+ rclsid: '',
+ robjid: '',
+ userlogin: '',
+ clsid: this.param.DataCls.id,
+ objid: "",
+ attr: req,
+ dataJson: []
+ }
+ this.DataObjRunCustomEvent(info);
}
+
} catch (ex) {
showError(ex, this.translateSys("error"))
@@ -511,16 +523,16 @@
})
});
} else {
- showInfo(this.translate(
+ showInfo($this.translate(
'execute_init_event_failed') +
- this.translateSys("full_stop") +
- this.translate('reason') + this
+ $this.translateSys("full_stop") +
+ $this.translate('reason') + $this
.translateSys(
"colon") +
- this.translateSys("quotation_mark_left") +
+ $this.translateSys("quotation_mark_left") +
action
- .action_type + this.translateSys(
- "quotation_mark_right") + this
+ .action_type + $this.translateSys(
+ "quotation_mark_right") + $this
.translate('tip_action_unprocessed'))
}
@@ -553,7 +565,7 @@
},
onScanValue(item, value) {
const $this = this;
- //console.log("onScanValue", item);
+ console.log("onScanValue", value);
item.value = value
let newVal = item.value
if (typeof item.value == "string") {
@@ -647,7 +659,18 @@
},
onClick(item) {
// console.log("onClick",item);
- this.focusFieldId = item.fieldId
+ if (item.name == "Input" || item.name == "InputNumber" || item.name == "Textarea") {
+ this.focusFieldId = item.fieldId
+ } else if (item.name == "ImageButton") {
+
+ var onClickEvent = item.bind.onClickEvent; //鍚庡浘鏍囩偣鍑诲洖璋�+
+ if (!onClickEvent.id) {
+ showInfo(this.translate('icon_click_event_empty'))
+ return;
+ }
+ this.onChange(onClickEvent);
+ }
},
onEnterChange(item) {
let newVal = item.value
@@ -699,166 +722,25 @@
}
},
-
- classAttr_extButton(item) {
- var onSuffixClickCallbackEvent = item.bind.onSuffixClickCallbackEvent; //鍚庡浘鏍囩偣鍑讳簨浠�- var onSuffixClickEvent = item.bind.onSuffixClickEvent; //鍚庡浘鏍囩偣鍑诲洖璋�-
- if (!onSuffixClickCallbackEvent.id) {
- showInfo(this.translate('icon_click_callback_empty'))
-
- return;
- }
- if (!onSuffixClickEvent.id) {
- showInfo(this.translate('icon_click_event_empty'))
-
- return;
- }
- this.popupType = 'right'
- // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
- this.$refs.popup.open(this.popupType);
-
- this.dataObjRunCustomEvent_Return(onSuffixClickEvent.id, '', onSuffixClickCallbackEvent
- .id,
- item);
- },
- popupChange(e) {
- console.log('褰撳墠妯″紡锛� + e.type + ',鐘舵�锛� + e.show);
- },
- checkChange(e) { //寮规check閫夋嫨
- // console.log(e.target.dataset);
- var index = e.target.dataset.index;
- var ischeck = e.target.dataset.ischeck;
- var data = this.check_list.items;
- // this.check_list.items=[];
- if (this.check_list.multiple_choice == "0") { //鍒ゆ柇鏃跺崟閫夎繕鏄閫�- for (var i in data) {
- data[i].check = false;
- }
- }
- data[index].check = ischeck ? false : true;
- this.check_list.items = data;
-
- },
- popup_cancel(e) { //寮规鍙栨秷
- this.$refs.popup.close();
- },
- popup_sava(e) { //寮规纭畾
- var $this = this;
- var items = $this.check_list.items;
- var data = [];
- var name = "";
- for (var i = 0; i < items.length; i++) {
- if (items[i].check == true) {
- if (name)
- name += ';';
- name += items[i].name;
- data.push({
- id: items[i].id,
- name: items[i].name
- });
- }
- }
- if (!$this.popupParam) {
- showInfo("popupParam涓虹┖锛�)
-
- return;
- }
- if (data.length == 0) {
- showInfo(this.translate("tip_no_select_data"))
-
- return;
- }
- var callback_eventid = $this.popupParam.button_callback.trim();
- var info = {
- eventid: callback_eventid,
- edtype: "0",
- projectid: '',
- rclsid: '',
- robjid: '',
- userlogin: '',
- clsid: $this.param.DataCls.id,
- objid: "",
- attr: $this.popupParam.req,
- dataJson: data
- }
- $this.DataObjRunCustomEvent(info, $this.popupParam.data_attr);
- this.$refs.popup.close();
- },
-
- async DataObjRunCustomEvent(info, data_attr) {
- var $this = this;
- var enviroment = {
- 'function': '3000', // 鍔熻兘鐐圭紪鍙�- cls_id: this.param.DataCls.id, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�- 'button': 'top', // top/bottom
- button_name: this.translateSys('add2'),
- master: {
- cls_id: this.param.DataCls.id, // button=bottom鏃�master鐨刢ls_id
- //obj_id: '' // button=bottom鏃�master鐨刼bj_id
- }
- };
- if (data_attr) {
- enviroment.edit_dlg = {
- type: 'small', //灏忕獥鍙�- class_id: this.param.DataCls.id, //褰撳墠鏁版嵁绫籭d
- }
- if (data_attr) {
- enviroment.edit_dlg.form_control = { //鎵�睘鐨勮〃鍗曟帶浠�- name: data_attr.Name, //瀛楁灞炴�
- text: data_attr.DispName, //鏄剧ず鏂囨湰
- group_name: data_attr.GroupName, //灞炴�缁�- type: data_attr.Type, //瀛楁绫诲瀷
- readonly: data_attr.ReadOnly, //鏄惁鍙
- button_img: data_attr.button_img, //寮曠敤鎸夐挳鐨勫浘鏍�- button_tooltip: data_attr.button_tooltip //寮曠敤鎸夐挳鐨則ooltip
+ async onFormEventResult( data, callbackEventId, item,req) {
+ try {
+ const $this = this
+ var enviroment = {
+ 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: $this.param.DataCls.id, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom
+ button_name: $this.translateSys('add2'),
+ master: {
+ cls_id: $this.param.DataCls.id, // button=bottom鏃�master鐨刢ls_id
+ //obj_id: '' // button=bottom鏃�master鐨刼bj_id
}
- }
- }
-
- // var dataInfo = {
- // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid.replace('{','').replace('}',''),
- // rclsid: info.rclsid, robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid,
- // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), inputparameter: "",
- // global_attr: JSON.stringify(this.global_attr), dataJson:JSON.stringify(info.dataJson)
- // }
- enviroment = Base64.encode(JSON.stringify(enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
- var input_param = Base64.encode(JSON.stringify(info.attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
- var global_attr = Base64.encode(JSON.stringify(this
- .global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
- if (info.dataJson)
- info.dataJson = Base64.encode(JSON.stringify(info.dataJson)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
- var obj_attr = {};
- info.attr.forEach(item => {
- obj_attr[item.attr] = item.value;
- });
- if (!info.eventid.includes('{')) info.eventid = '{' + info.eventid + '}';
- var dataInfo = {
- ed_type: info.edtype,
- start_transaction: true,
- class_id: info.clsid,
- class_name: '',
- event_id: info.eventid,
- event_name: '',
- data_obj_id: info.objid,
- obj_attr: obj_attr,
- prj_id: info.projectid,
- ref_cls_id: info.rclsid,
- rel_obj_id: info.robjid,
- user_login: info.userlogin,
- data_json: info.dataJson,
- compose_info: '',
- ext_info: enviroment,
- global_attr: global_attr,
- input_param: input_param,
- };
- console.log(dataInfo);
- // return;
- runCustomEvent(dataInfo).then(data => {
+ };
if (data.ret != 0 && data.ret != 1) {
+
let cls_name = data.event_info?.cls_name
let event_name = data.event_info?.event_name
- tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data.err_info
+ tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
+ .err_info
.join('\n') : ''
if (data.ret == 801) {
if (this.param.Only_Script_Error) {
@@ -866,7 +748,8 @@
if (pos > -1) tip = tip.substring(pos + 1);
}
}
- if (cls_name && event_name) tip = `鎵ц鈥�{cls_name}鈥濇暟鎹被鐨勨�${event_name}鈥濊剼鏈椂杩斿洖閿欒锛�{tip}`
+ if (cls_name && event_name) tip =
+ `鎵ц鈥�{cls_name}鈥濇暟鎹被鐨勨�${event_name}鈥濊剼鏈椂杩斿洖閿欒锛�{tip}`
if (data.ret == 801) showInfo(tip)
else showError(`${tip}锛屾彁绀猴細${data.ret}`, this.translateSys('tip'))
this.saving = false
@@ -890,6 +773,7 @@
}
try {
var actionlist = data.action || []
+ var enviroment = JSON.stringify(enviroment);
for (var i = 0; i < actionlist.length; i++) {
var action = actionlist[i];
if (action.action_type == 'set_dlg_attr') {
@@ -918,141 +802,7 @@
focusFieldId: action.value
})
});
- } else {
- showInfo(this.translateSys(
- "quotation_mark_left") +
- action
- .action_type + this.translateSys(
- "quotation_mark_right") + this
- .translate(
- "tip_action_unprocessed"))
-
- }
- }
-
- } catch (ex) {
- let actionList = (data.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);
- showError(ex, this.translateSys("error") + " 3.1")
-
- });
- },
- dataObjRunCustomEvent_Return(eventid, data_attr, button_callback, item) {
- const $this = this
- var enviroment = {
- 'function': '3000', // 鍔熻兘鐐圭紪鍙�- cls_id: $this.param.DataCls.id, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�- 'button': 'top', // top/bottom
- button_name: $this.translateSys('add2'),
- master: {
- cls_id: $this.param.DataCls.id, // button=bottom鏃�master鐨刢ls_id
- //obj_id: '' // button=bottom鏃�master鐨刼bj_id
- }
- };
- var obj_attr = $this.head_styledef.form.model;
- console.log(obj_attr);
- var req = Object.keys(obj_attr).map((a) => ({
- attr: a,
- value: obj_attr[a] || "",
- }));
-
- var extinfo = enviroment;
- extinfo.edit_dlg = {
- type: 'small', //灏忕獥鍙�- class_id: $this.param.DataCls.id, //褰撳墠鏁版嵁绫籭d
- }
- extinfo = Base64.encode(JSON.stringify(extinfo)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
- var global_attr = Base64.encode(JSON.stringify($this
- .global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
- var obj_attr = {};
- req.forEach(item2 => {
- obj_attr[item2.attr] = item2.value;
- });
- let input_param = Base64.encode(
- JSON.stringify(
- Object.keys(obj_attr).map((a) => ({
- attr: a,
- value: obj_attr[a] || "",
- }))
- )
- );
-
- if (!eventid.includes('{')) eventid = '{' + eventid + '}';
- var dataInfo = {
- ed_type: "0",
- start_transaction: true,
- class_id: $this.param.DataCls.id,
- class_name: '',
- event_id: eventid,
- event_name: '',
- data_obj_id: '',
- obj_attr: obj_attr,
- prj_id: '',
- ref_cls_id: '',
- rel_obj_id: '',
- user_login: '',
- data_json: [],
- compose_info: '',
- ext_info: extinfo,
- global_attr: global_attr,
- input_param: input_param,
- };
- console.log(dataInfo);
- // return;
- runCustomEvent(dataInfo).then(data => {
- if (data.ret != 0 && data.ret != 1) {
- let cls_name = data.event_info?.cls_name
- let event_name = data.event_info?.event_name
- tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data.err_info
- .join('\n') : ''
- if (data.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 (data.ret == 801) showInfo(tip)
- else showError(`${tip}锛屾彁绀猴細${data.ret}`, this.translateSys('tip'))
- this.saving = false
- return false
- } else {
- var tip = data.info ? typeof data.info == 'string' ? data.info :
- data.info.join('\n') : '';
- tip = tip || data.err_info
- let time = data.info_time || 0
- if (time)
- showError(tip, this.translateSys('tip'))
- else
- showInfo(tip)
- if ([0, 2, 3, 4, -1].includes(data.result_type)) {
- if (data.result_type == 2) {
-
- } else if (typeof data.result == 'string') {
- if (data.result) {
- showInfo(data.result)
-
- }
- }
- try {
- var actions = data.action || []
- for (var i = 0; i < actions.length; i++) {
- var action = actions[i];
- console.log(action)
- var val = action.value;
- var enviroment = JSON.stringify(enviroment);
-
- if (action.action_type == 'open_panel') {
+ } else if (action.action_type == 'open_panel') {
var d = dialog({
title: '<i class="ace-icon fa fa-info-circle"></i> ' +
$this.translateSys("tip"),
@@ -1219,17 +969,16 @@
}
});
} else {
- showInfo($this.translateSys(
+ showInfo(this.translateSys(
"quotation_mark_left") +
- action.action_type + $this
- .translateSys(
- "quotation_mark_right") + $this
+ action
+ .action_type + this.translateSys(
+ "quotation_mark_right") + this
.translate(
"tip_action_unprocessed"))
}
}
-
} catch (ex) {
let actionList = (data.action || []).map(a => a.action_type).join(';')
let tip = typeof ex == 'string' ? ex : ex.message
@@ -1237,11 +986,250 @@
showError(tip, this.translateSys('tip'))
return
}
+
}
}
+ } catch (ex) {
+ showError(ex, this.translateSys("error") + "10.1")
+ }
+ },
+ classAttr_extButton(item) {
+ var onSuffixClickCallbackEvent = item.bind.onSuffixClickCallbackEvent; //鍚庡浘鏍囩偣鍑讳簨浠�+ var onSuffixClickEvent = item.bind.onSuffixClickEvent; //鍚庡浘鏍囩偣鍑诲洖璋�+
+ if (!onSuffixClickCallbackEvent.id) {
+ showInfo(this.translate('icon_click_callback_empty'))
+
+ return;
+ }
+ if (!onSuffixClickEvent.id) {
+ showInfo(this.translate('icon_click_event_empty'))
+
+ return;
+ }
+ this.popupType = 'right'
+ // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
+ this.$refs.popup.open(this.popupType);
+
+ this.dataObjRunCustomEvent_Return(onSuffixClickEvent.id, onSuffixClickCallbackEvent
+ .id,
+ item);
+ },
+ popupChange(e) {
+ console.log('褰撳墠妯″紡锛� + e.type + ',鐘舵�锛� + e.show);
+ },
+ checkChange(e) { //寮规check閫夋嫨
+ // console.log(e.target.dataset);
+ var index = e.target.dataset.index;
+ var ischeck = e.target.dataset.ischeck;
+ var data = this.check_list.items;
+ // this.check_list.items=[];
+ if (this.check_list.multiple_choice == "0") { //鍒ゆ柇鏃跺崟閫夎繕鏄閫�+ for (var i in data) {
+ data[i].check = false;
+ }
+ }
+ data[index].check = ischeck ? false : true;
+ this.check_list.items = data;
+
+ },
+ popup_cancel(e) { //寮规鍙栨秷
+ this.$refs.popup.close();
+ },
+ popup_sava(e) { //寮规纭畾
+ var $this = this;
+ var items = $this.check_list.items;
+ var data = [];
+ var name = "";
+ for (var i = 0; i < items.length; i++) {
+ if (items[i].check == true) {
+ if (name)
+ name += ';';
+ name += items[i].name;
+ data.push({
+ id: items[i].id,
+ name: items[i].name
+ });
+ }
+ }
+ if (!$this.popupParam) {
+ showInfo("popupParam涓虹┖锛�)
+
+ return;
+ }
+ if (data.length == 0) {
+ showInfo(this.translate("tip_no_select_data"))
+
+ return;
+ }
+ var callback_eventid = $this.popupParam.button_callback.trim();
+ var info = {
+ eventid: callback_eventid,
+ edtype: "0",
+ projectid: '',
+ rclsid: '',
+ robjid: '',
+ userlogin: '',
+ clsid: $this.param.DataCls.id,
+ objid: "",
+ attr: $this.popupParam.req || [],
+ dataJson: data
+ }
+ $this.DataObjRunCustomEvent(info, $this.popupParam.data_attr);
+ this.$refs.popup.close();
+ },
+
+ async DataObjRunCustomEvent(info, data_attr) {
+ try {
+ var $this = this;
+ if (!info.eventid)
+ return
+ showLoading("loading...")
+ var enviroment = {
+ 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: this.param.DataCls.id, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom
+ button_name: this.translateSys('add2'),
+ master: {
+ cls_id: this.param.DataCls.id, // button=bottom鏃�master鐨刢ls_id
+ //obj_id: '' // button=bottom鏃�master鐨刼bj_id
+ }
+ };
+ if (data_attr) {
+ enviroment.edit_dlg = {
+ type: 'small', //灏忕獥鍙�+ class_id: this.param.DataCls.id, //褰撳墠鏁版嵁绫籭d
+ }
+ if (data_attr) {
+ enviroment.edit_dlg.form_control = { //鎵�睘鐨勮〃鍗曟帶浠�+ name: data_attr.Name, //瀛楁灞炴�
+ text: data_attr.DispName, //鏄剧ず鏂囨湰
+ group_name: data_attr.GroupName, //灞炴�缁�+ type: data_attr.Type, //瀛楁绫诲瀷
+ readonly: data_attr.ReadOnly, //鏄惁鍙
+ button_img: data_attr.button_img, //寮曠敤鎸夐挳鐨勫浘鏍�+ button_tooltip: data_attr.button_tooltip //寮曠敤鎸夐挳鐨則ooltip
+ }
+ }
+ }
+ enviroment = Base64.encode(JSON.stringify(enviroment)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+ var input_param = info.attr ? Base64.encode(JSON.stringify(info.attr)):"" //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+ var global_attr = Base64.encode(JSON.stringify(this
+ .global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+ if (info.dataJson)
+ info.dataJson = Base64.encode(JSON.stringify(info.dataJson)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+ var obj_attr = {};
+ (info.attr || []).forEach(item => {
+ obj_attr[item.attr] = item.value;
+ });
+ if (!info.eventid.includes('{')) info.eventid = '{' + info.eventid + '}';
+ var dataInfo = {
+ ed_type: info.edtype,
+ start_transaction: true,
+ class_id: info.clsid,
+ class_name: '',
+ event_id: info.eventid,
+ event_name: '',
+ data_obj_id: info.objid,
+ obj_attr: obj_attr,
+ prj_id: info.projectid,
+ ref_cls_id: info.rclsid,
+ rel_obj_id: info.robjid,
+ user_login: info.userlogin,
+ data_json: info.dataJson,
+ compose_info: '',
+ ext_info: enviroment,
+ global_attr: global_attr,
+ input_param: input_param,
+ };
+ console.log(dataInfo);
+ // return;
+ runCustomEvent(dataInfo).then(data => {
+ hideLoading()
+ $this.onFormEventResult(data, "")
+
+ }).catch(ex => {
+ // console.log(ex);
+ showError(ex, this.translateSys("error") + " 3.1")
+
+ });
+ } catch (ex) {
+ hideLoading()
+ showError(ex, this.translateSys("error"));
+ }
+
+ },
+ dataObjRunCustomEvent_Return(eventid, button_callback, item) {
+ const $this = this
+ showLoading("loading...")
+ var enviroment = {
+ 'function': '3000', // 鍔熻兘鐐圭紪鍙�+ cls_id: $this.param.DataCls.id, // 鍔熻兘鐐逛富鏁版嵁绫绘爣璇�+ 'button': 'top', // top/bottom
+ button_name: $this.translateSys('add2'),
+ master: {
+ cls_id: $this.param.DataCls.id, // button=bottom鏃�master鐨刢ls_id
+ //obj_id: '' // button=bottom鏃�master鐨刼bj_id
+ }
+ };
+ var obj_attr = $this.head_styledef.form.model;
+ console.log(obj_attr);
+ var req = Object.keys(obj_attr).map((a) => ({
+ attr: a,
+ value: obj_attr[a] || "",
+ }));
+
+ var extinfo = enviroment;
+ extinfo.edit_dlg = {
+ type: 'small', //灏忕獥鍙�+ class_id: $this.param.DataCls.id, //褰撳墠鏁版嵁绫籭d
+ }
+ extinfo = Base64.encode(JSON.stringify(extinfo)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+ var global_attr = Base64.encode(JSON.stringify($this
+ .global_attr)); //灏嗗瓧绗︿覆杞崲涓篵ase64缂栫爜
+ var obj_attr = {};
+ req.forEach(item2 => {
+ obj_attr[item2.attr] = item2.value;
+ });
+ let input_param = Base64.encode(
+ JSON.stringify(
+ Object.keys(obj_attr).map((a) => ({
+ attr: a,
+ value: obj_attr[a] || "",
+ }))
+ )
+ );
+
+ if (!eventid.includes('{')) eventid = '{' + eventid + '}';
+ var dataInfo = {
+ ed_type: "0",
+ start_transaction: true,
+ class_id: $this.param.DataCls.id,
+ class_name: '',
+ event_id: eventid,
+ event_name: '',
+ data_obj_id: '',
+ obj_attr: obj_attr,
+ prj_id: '',
+ ref_cls_id: '',
+ rel_obj_id: '',
+ user_login: '',
+ data_json: [],
+ compose_info: '',
+ ext_info: extinfo,
+ global_attr: global_attr,
+ input_param: input_param,
+ };
+ console.log(dataInfo);
+ // return;
+ runCustomEvent(dataInfo).then(data => {
+ hideLoading()
+ $this.onFormEventResult( data, button_callback,item,req)
+
}).catch(ex => {
// console.log(ex);
+ hideLoading()
showError(ex, this.translateSys("error") + " 5.1")
});
@@ -1249,11 +1237,17 @@
//纭畾
sava() {
- if (this.after_ok?.id) { // 鐐瑰嚮纭畾鎸夐挳鍚�- this.afterOK();
- } else {
- this.add();
- }
+ this.handleButtonClick((done) => {
+ if (this.after_ok?.id) { // 鐐瑰嚮纭畾鎸夐挳鍚�+ this.afterOK();
+ } else {
+ this.add();
+ }
+ setTimeout(() => {
+ done(); // 閲嶇疆鐘舵�
+ }, 1000);
+ });
+
},
add() {
@@ -1529,6 +1523,7 @@
afterOK() {
this.saving = true
const $this = this
+ showLoading("loading...")
var obj_attr = this.head_styledef.form.model;
// console.log(obj_attr);
var input_param = {
@@ -1560,8 +1555,9 @@
console.log(dataInfo);
// return;
runCustomEvent(dataInfo).then(data => {
-
+ hideLoading()
if (data.ret != 0 && data.ret != 1) {
+
let cls_name = data.event_info?.cls_name
let event_name = data.event_info?.event_name
tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data.err_info
@@ -1637,7 +1633,6 @@
}
}
-
} catch (ex) {
let actionList = (data.action || []).map(a => a.action_type).join(';')
let tip = typeof ex == 'string' ? ex : ex.message
@@ -1649,9 +1644,9 @@
}
}
-
this.saving = false
}).catch(ex => {
+ hideLoading()
showError(ex, this.translateSys("tip") + " 7.1")
});
@@ -1674,6 +1669,14 @@
})
},
onButtonClicked(btn) {
+ this.handleButtonClick((done) => {
+ this.buttonClicked(btn);
+ setTimeout(() => {
+ done(); // 閲嶇疆鐘舵�
+ }, 1000);
+ });
+ },
+ buttonClicked(btn) {
let enviroment = {
button: "top",
button_name: btn.ShowName,
@@ -1697,6 +1700,7 @@
},
onTriggerEvent(btn, enviroment) {
const $this = this
+ showLoading("loading...")
var obj_attr = this.head_styledef.form.model;
// console.log(obj_attr);
var input_param = {
@@ -1727,7 +1731,7 @@
console.log(dataInfo);
// return;
runCustomEvent(dataInfo).then(data => {
-
+ hideLoading()
if (data.ret != 0 && data.ret != 1) {
let cls_name = data.event_info?.cls_name
let event_name = data.event_info?.event_name
@@ -1745,6 +1749,7 @@
this.saving = false
return false
} else {
+
var tip = data.info ? typeof data.info == 'string' ? data.info :
data.info.join('\n') : '';
tip = tip || data.err_info
@@ -1755,6 +1760,7 @@
showInfo(tip)
if (!this.param.After_Btn_Not_Refresh) {
//鍒锋柊
+
uni.redirectTo({
url: '../modal/3018_2?param=' + JSON.stringify(this
.$data
@@ -1807,8 +1813,7 @@
var value = action.value;
const eventChannel = this.getOpenerEventChannel();
eventChannel.emit('remove_pre_page_subtable_row', value);
- }
- else if (action.action_type == "goback_to_pre_page") {
+ } else if (action.action_type == "goback_to_pre_page") {
//杩斿洖涓婁竴椤� uni.navigateBack({
delta: 1, //杩斿洖灞傛暟锛�鍒欎笂涓婇〉
@@ -1825,6 +1830,7 @@
return
}
}
+
}
}
--
Gitblit v1.9.1