From e540e5b44f56ce8e8edc377dfa4c5b343b1a9eef Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期四, 14 八月 2025 16:12:15 +0800
Subject: [PATCH] paramvalue
---
pages/modal/3037_2.vue | 951 ++++++++++++++++++++++++++++++----------------------------
1 files changed, 495 insertions(+), 456 deletions(-)
diff --git a/pages/modal/3037_2.vue b/pages/modal/3037_2.vue
index 69b6392..1d4d857 100644
--- a/pages/modal/3037_2.vue
+++ b/pages/modal/3037_2.vue
@@ -1,7 +1,8 @@
<template>
<view class="uni-page-modal-3017-2" :class="largeMode?'large-mode':''">
<!-- 琛ㄥご鏍峰紡 -->
- <OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form" @on-focus="ontap"
+ <OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form"
+ :hiddenIds="head_styledef.hiddenIds ?head_styledef.hiddenIds :[] " @on-focus="ontap"
@on-change="onEnterChange" @on-click-prefix="classAttr_extButton" @on-click-suffix="classAttr_extButton">
</OIForm>
<!-- 浠庢暟鎹�-->
@@ -123,7 +124,7 @@
import {
getUIStyleInfo,
runCustomEvent,
- dataObjCreate,
+
dataObjDel
} from "@/api/data.js"
import dayjs from "dayjs";
@@ -137,7 +138,7 @@
},
data() {
return {
- largeMode: getApp().globalData.largeMode || false,
+ largeMode: getApp().globalData.largeMode || false,
title: this.translateSys('add2'),
param: {},
edit_inital_event: "", //寮圭獥鍒濆鍖栦簨浠禝D
@@ -172,7 +173,8 @@
}); //璁剧疆椤堕儴鏍囬
this.title = options.titlename;
this.param = JSON.parse(options.param);
- this.loadData(options.paramValue)
+ const paramValue = options.paramValue ? JSON.parse(options.paramValue) : undefined
+ this.loadData(paramValue)
//椤甸潰鍒濆鍖栬幏鍙栫劍鐐� // this.focusMateria=true;
@@ -205,28 +207,29 @@
await this.Head_UIStyleGetInfo(this.param.Master_Cls?.ID, this.param.Master_Cls?.UI_Style?.ID);
//浼犲叆鍙傛暟鍊� if (paramValue) {
- const attrs = paramValue.attrs || [];
+ this.setFormItemVisible(this.head_styledef,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.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;
- }
- });
- }
- });
- }
- })
}
await this.Detail1_UIstyleGetInfo(this.param.Sub_Cls?.ID, this.param.Sub_Cls?.UI_Style?.ID);
@@ -266,11 +269,11 @@
}
$this.head_styledef.form.items[index].selections = selections.map((
a) => {
- return {
- value: a.value,
- text: a.label
- }
- })
+ return {
+ value: a.value,
+ text: a.label
+ }
+ })
}
}
@@ -439,7 +442,7 @@
runCustomEvent(dataInfo).then(data => {
console.log(data);
- if (data.ret != 0) {
+ if (data.ret != 0 && data.ret != 1) {
var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
.err_info.join('<br/>') : '';
if (data.ret == 801) {
@@ -463,145 +466,99 @@
} else {
var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join(
'<br/>') : '';
+ tip = tip || data.err_info
if (tip) uni.showModal({
title: this.translateSys("tip"),
content: tip,
showCancel: false,
confirmText: this.translateSys('close')
});
+ if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+ if (data.result_type == 2) {
- var actionlist = data.action;
- if (actionlist) {
- console.log(actionlist);
- for (var i = 0; i < actionlist.length; i++) {
- var action = actionlist[i];
- if (action.action_type == 'set_dlg_attr') {
- var result = action.value;
- for (var i = 0; i < result.length; i++) {
- if (result[i].choice_list) {
- for (var c = 0; c < styledef.form.items.length; c++) {
- var attr = styledef.form.items[c];
- if (attr.name != 'Layout') {
- if (attr.fieldId == result[i].attr) {
- var dictItemList = [];
- for (var d in result[i].choice_list) {
- var val = result[i].choice_list[d];
- dictItemList.push({
- "CN_S_NAME": val,
- "CN_S_VALUE": val,
- "text": val,
- "value": val
- });
- }
- attr.dict = dictItemList;
- }
- } else if (attr.name == 'Layout') {
- attr.setting.colList.forEach(col => {
- if (col) {
- if (col.fieldId == result[i].attr) {
- var dictItemList = [];
- for (var d in result[i]
- .choice_list) {
- var val = result[i]
- .choice_list[d];
- dictItemList.push({
- "CN_S_NAME": val,
- "CN_S_VALUE": val,
- "text": val,
- "value": val
- });
- }
- col.dict = dictItemList;
- }
- }
- });
- }
-
- }
- }
- for (var c = 0; c < styledef.form.items.length; c++) {
- var attr = styledef.form.items[c];
- // console.log(attr[j].Name+'=='+result[i].attr);
- //鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹�- if ($this.head_styledef.form.model[result[i].attr] ==
- undefined) {
- $this.head_styledef.form.model[result[i].attr] = result[i]
- .value;
- }
- //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (attr.name != 'Layout') {
- if (attr.fieldId == result[i].attr) {
- attr.value = '';
- attr.oldvalue = '';
- attr.value = result[i].value;
- attr.oldvalue = result[i].value;
- $this.head_styledef.form.model[attr.fieldId] = result[
- i].value;
- }
- } else if (attr.name == 'Layout') {
- attr.setting.colList.forEach(col => {
- if (col) {
- if (col.fieldId == result[i].attr) {
- col.value = '';
- col.oldvalue = '';
- col.value = result[i].value;
- col.oldvalue = result[i].value;
- $this.head_styledef.form.model[col
- .fieldId] = result[i].value;
- }
- }
- });
- }
- }
-
- }
- } else if (data.action[i].action_type == 'set_dlg_attr_show') {
- var result = action.value;
- result.forEach(async (attr, key) => {
- styledef.form.items.forEach(async (ele, index) => {
- //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (ele.name != 'Layout') {
- if (ele.fieldId == attr.attr) {
- ele.show = attr.show;
- }
- } else if (ele.name == 'Layout') {
- ele.setting.colList.forEach(
- col => {
- if (col) {
- if (col.fieldId ==
- attr.attr) {
- col.show = attr
- .show;
- }
- }
- });
- }
- });
- });
- var style_def = JSON.parse(JSON.stringify(styledef));
- if (type == 'head') {
- $this.head_styledef = [];
- $this.head_styledef = style_def;
- // console.log($this.head_styledef);
- } else {
- $this.detail1_styledef = [];
- $this.detail1_styledef = style_def;
- // console.log($this.detail1_styledef);
- }
- } else {
+ } else if (typeof data.result == 'string') {
+ if (data.result) {
uni.showModal({
- title: this.translateSys("tip"),
- content: this.translate('execute_init_event_failed') +
- this.translateSys("full_stop") +
- this.translate('reason') + this.translateSys("colon") +
- this.translateSys("quotation_mark_left") + action
- .action_type + this.translateSys(
- "quotation_mark_right") + this
- .translate('tip_action_unprocessed'),
+ title: this.translateSys('tip'),
+ content: data.result,
showCancel: false,
confirmText: this.translateSys('close')
});
}
+ }
+ try {
+ var actionlist = data.action || []
+ for (var i = 0; i < actionlist.length; i++) {
+ var action = actionlist[i];
+ if (action.action_type == 'set_dlg_attr') {
+ var result = action.value;
+ $this.setFormValues(styledef, result)
+
+ } else if (data.action[i].action_type == 'set_dlg_attr_show') {
+ var result = action.value;
+ if (type == 'head') {
+ $this.setFormItemVisible(result)
+ // console.log($this.head_styledef);
+ } else {
+ result.forEach(async (attr, key) => {
+ styledef.form.items.forEach(async (ele, index) => {
+ //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�+ if (ele.name != 'Layout') {
+ if (ele.fieldId == attr.attr) {
+ ele.show = attr.show;
+ }
+ } else if (ele.name == 'Layout') {
+ ele.setting.colList.forEach(
+ col => {
+ if (col) {
+ if (col
+ .fieldId ==
+ attr.attr
+ ) {
+ col.show =
+ attr
+ .show;
+ }
+ }
+ });
+ }
+ });
+ });
+ var style_def = JSON.parse(JSON.stringify(styledef));
+
+
+ $this.detail1_styledef = [];
+ $this.detail1_styledef = style_def;
+ // console.log($this.detail1_styledef);
+ }
+ } else {
+ uni.showModal({
+ title: this.translateSys("tip"),
+ content: this.translate('execute_init_event_failed') +
+ this.translateSys("full_stop") +
+ this.translate('reason') + this.translateSys("colon") +
+ this.translateSys("quotation_mark_left") + action
+ .action_type + this.translateSys(
+ "quotation_mark_right") + this
+ .translate('tip_action_unprocessed'),
+ showCancel: false,
+ confirmText: this.translateSys('close')
+ });
+ }
+ }
+
+ } catch (ex) {
+ let actionList = (data.action || []).map(a => a.action_type).join(';')
+ let tip = typeof ex == 'string' ? ex : ex.message
+ tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+ uni.showModal({
+ title: this.translateSys('tip'),
+ content: tip,
+ showCancel: false,
+ confirmText: this.translateSys('close')
+ });
+ console.log(ex)
+ return
}
}
}
@@ -823,7 +780,7 @@
console.log(dataInfo);
// return;
runCustomEvent(dataInfo).then(data => {
- if (data.ret != 0) {
+ if (data.ret != 0 && data.ret != 1) {
var tip = data.err_info ? typeof data.err_info == 'string' ? data
.err_info :
data
@@ -852,16 +809,28 @@
.info
.join(
'<br/>') : '';
+ tip = tip || data.err_info
if (tip) uni.showModal({
title: $this.translateSys("tip"),
content: tip,
showCancel: false,
confirmText: $this.translateSys('close')
});
+ if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+ if (data.result_type == 2) {
- if (data != "") {
- var actions = data.action;
- if (actions) {
+ } else if (typeof data.result == 'string') {
+ if (data.result) {
+ uni.showModal({
+ title: this.translateSys('tip'),
+ content: data.result,
+ showCancel: false,
+ confirmText: this.translateSys('close')
+ });
+ }
+ }
+ try {
+ var actions = data.action || []
for (var i = 0; i < actions.length; i++) {
var action = actions[i];
console.log(action)
@@ -1035,18 +1004,22 @@
});
}
}
+
+ } catch (ex) {
+ let actionList = (data.action || []).map(a => a.action_type).join(';')
+ let tip = typeof ex == 'string' ? ex : ex.message
+ tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+ uni.showModal({
+ title: this.translateSys('tip'),
+ content: tip,
+ showCancel: false,
+ confirmText: this.translateSys('close')
+ });
+ console.log(ex)
+ return
}
- } else {
- uni.showModal({
- title: $this.translateSys('tip') + "5.2",
- content: $this.translateSys("quotation_mark_left") +
- "before_click_button" + $this.translateSys(
- "quotation_mark_right") + $this.translateSys(
- "comma") + 'event_id' + eventid,
- showCancel: false,
- confirmText: $this.translateSys('close')
- });
}
+
}
}).catch(ex => {
@@ -1504,7 +1477,7 @@
// return;
runCustomEvent(dataInfo).then(data => {
console.log(data);
- if (data.ret != 0) {
+ if (data.ret != 0 && data.ret != 1) {
var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
.err_info.join('<br/>') : '';
if (data.ret == 801) {
@@ -1528,167 +1501,101 @@
} else {
var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join(
'<br/>') : '';
+ tip = tip || data.err_info
if (tip) uni.showModal({
title: this.translateSys("tip"),
content: tip,
showCancel: false,
confirmText: this.translateSys('close')
});
+ if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+ if (data.result_type == 2) {
+ var result = data.result || []
- var actionlist = data.action;
- if (actionlist) {
- console.log(actionlist);
- for (var i = 0; i < actionlist.length; i++) {
- var action = actionlist[i];
- if (action.action_type == 'set_dlg_attr') {
- var result = action.value;
- for (var i = 0; i < result.length; i++) {
- if (result[i].choice_list) {
- for (var c = 0; c < $this.head_styledef.form.items.length; c++) {
- var attr = $this.head_styledef.form.items[c];
- if (attr.name != 'Layout') {
- if (attr.fieldId == result[i].attr) {
- var dictItemList = [];
- for (var d in result[i].choice_list) {
- var val = result[i].choice_list[d];
- dictItemList.push({
- "CN_S_NAME": val,
- "CN_S_VALUE": val,
- "text": val,
- "value": val
- });
- }
- attr.dict = dictItemList;
- }
- } else if (attr.name == 'Layout') {
- attr.setting.colList.forEach(col => {
- if (col) {
- if (col.fieldId == result[i].attr) {
- var dictItemList = [];
- for (var d in result[i].choice_list) {
- var val = result[i].choice_list[d];
- dictItemList.push({
- "CN_S_NAME": val,
- "CN_S_VALUE": val,
- "text": val,
- "value": val
- });
- }
- col.dict = dictItemList;
- }
- }
- });
- }
+ for (var i = 0; i < result.length; i++) {
+ for (var c = 0; c < $this.head_styledef.form.items.length; c++) {
+ var attr = $this.head_styledef.form.items[c];
+ if (attr.name != 'Layout') {
+ if (attr.fieldId == result[i].attr) {
+ attr.value = '';
+ attr.oldvalue = '';
+ attr.value = result[i].value;
+ attr.oldvalue = result[i].value;
+ $this.head_styledef.form.model[attr.fieldId] = result[i].value;
}
- }
- for (var c = 0; c < $this.head_styledef.form.items.length; c++) {
- var attr = $this.head_styledef.form.items[c];
- // console.log(attr[j].Name+'=='+result[i].attr);
- if (attr.name != 'Layout') {
- if (attr.fieldId == result[i].attr) {
- attr.value = '';
- attr.oldvalue = '';
- attr.value = result[i].value;
- attr.oldvalue = result[i].value;
- $this.head_styledef.form.model[attr.fieldId] = result[i]
- .value;
- }
- } else if (attr.name == 'Layout') {
- attr.setting.colList.forEach(col => {
- if (col) {
- if (col.fieldId == result[i].attr) {
- col.value = '';
- col.oldvalue = '';
- col.value = result[i].value;
- col.oldvalue = result[i].value;
- $this.head_styledef.form.model[col
- .fieldId] = result[i].value;
- }
+ } else if (attr.name == 'Layout') {
+ attr.setting.colList.forEach(col => {
+ if (col) {
+ if (col.fieldId == result[i].attr) {
+ col.value = '';
+ col.oldvalue = '';
+ col.value = result[i].value;
+ col.oldvalue = result[i].value;
+ $this.head_styledef.form.model[col.fieldId] =
+ result[i].value;
}
- });
- }
-
+ }
+ });
}
}
- } else if (action.action_type == 'set_dlg_attr_show') {
- var result = action.value;
- result.forEach(async (attr, key) => {
- $this.head_styledef.form.items.forEach(async (ele,
- index) => {
- //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�- if (ele.name != 'Layout') {
- if (ele.fieldId == attr.attr) {
- ele.show = attr.show;
- }
- } else if (ele.name == 'Layout') {
- ele.setting.colList.forEach(col => {
- if (col) {
- if (col.fieldId == attr
- .attr) {
- col.show = attr
- .show;
- }
- }
- });
+
+ var length = 0;
+ if (!$this.refdatastore.filter(function(s) {
+ return result[i].attr == s.attr
+ }).length) {
+ length = 1;
+ $this.refdatastore.push(result[i]);
+ }
+ if (length == 0) {
+ for (var j = 0; j < $this.refdatastore.length; j++) {
+ if ($this.refdatastore[j].attr == result[i].attr) {
+ $this.refdatastore[j].value = result[i].value;
}
- });
+ }
+ }
+ }
+
+
+ } else if (typeof data.result == 'string') {
+ if (data.result) {
+ uni.showModal({
+ title: this.translateSys('tip'),
+ content: data.result,
+ showCancel: false,
+ confirmText: this.translateSys('close')
});
- var head_styledef = JSON.parse(JSON.stringify($this.head_styledef));
- $this.head_styledef = [];
- $this.head_styledef = head_styledef;
- // console.log($this.head_styledef);
- } else if (action.action_type == 'set_global_attr') {
- $this.global_attr = action.value || [];
}
-
}
- }
-
- if (data.result) {
- var result = data.result;
- for (var i = 0; i < result.length; i++) {
- for (var c = 0; c < $this.head_styledef.form.items.length; c++) {
- var attr = $this.head_styledef.form.items[c];
- if (attr.name != 'Layout') {
- if (attr.fieldId == result[i].attr) {
- attr.value = '';
- attr.oldvalue = '';
- attr.value = result[i].value;
- attr.oldvalue = result[i].value;
- $this.head_styledef.form.model[attr.fieldId] = result[i].value;
- }
- } else if (attr.name == 'Layout') {
- attr.setting.colList.forEach(col => {
- if (col) {
- if (col.fieldId == result[i].attr) {
- col.value = '';
- col.oldvalue = '';
- col.value = result[i].value;
- col.oldvalue = result[i].value;
- $this.head_styledef.form.model[col.fieldId] =
- result[i].value;
- }
- }
- });
+ try {
+ var actionlist = data.action || []
+ for (var i = 0; i < actionlist.length; i++) {
+ var action = actionlist[i];
+ if (action.action_type == 'set_dlg_attr') {
+ var result = action.value;
+ $this.setFormValues($this.head_styledef, result)
+ } else if (action.action_type == 'set_dlg_attr_show') {
+ var data = action.value;
+ $this.setFormItemVisible(data)
+ // console.log($this.head_styledef);
+ } else if (action.action_type == 'set_global_attr') {
+ $this.global_attr = action.value || [];
}
}
- var length = 0;
- if (!$this.refdatastore.filter(function(s) {
- return result[i].attr == s.attr
- }).length) {
- length = 1;
- $this.refdatastore.push(result[i]);
- }
- if (length == 0) {
- for (var j = 0; j < $this.refdatastore.length; j++) {
- if ($this.refdatastore[j].attr == result[i].attr) {
- $this.refdatastore[j].value = result[i].value;
- }
- }
- }
+ } catch (ex) {
+ let actionList = (data.action || []).map(a => a.action_type).join(';')
+ let tip = typeof ex == 'string' ? ex : ex.message
+ tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+ uni.showModal({
+ title: this.translateSys('tip'),
+ content: tip,
+ showCancel: false,
+ confirmText: this.translateSys('close')
+ });
+ console.log(ex)
+ return
}
}
}
@@ -1702,6 +1609,110 @@
confirmText: this.translateSys('close')
});
});
+ },
+ setFormValues(styledef, attrs) {
+ if (!Array.isArray(attrs)) {
+ return
+ }
+ for (var i = 0; i < attrs.length; i++) {
+ if (attrs[i].choice_list) {
+ for (var c = 0; c < styledef.form.items.length; c++) {
+ var attr = styledef.form.items[c];
+ if (attr.name != 'Layout') {
+ if (attr.fieldId == attrs[i].attr) {
+ var dictItemList = [];
+ for (var d in attrs[i].choice_list) {
+ var val = attrs[i].choice_list[d];
+ dictItemList.push({
+ "CN_S_NAME": val,
+ "CN_S_VALUE": val,
+ "text": val,
+ "value": val
+ });
+ }
+ attr.dict = dictItemList;
+ }
+ } else if (attr.name == 'Layout') {
+ attr.setting.colList.forEach(col => {
+ if (col) {
+ if (col.fieldId == attrs[i].attr) {
+ var dictItemList = [];
+ for (var d in attrs[i]
+ .choice_list) {
+ var val = attrs[i]
+ .choice_list[d];
+ dictItemList.push({
+ "CN_S_NAME": val,
+ "CN_S_VALUE": val,
+ "text": val,
+ "value": val
+ });
+ }
+ col.dict = dictItemList;
+ }
+ }
+ });
+ }
+
+ }
+ }
+ for (var c = 0; c < styledef.form.items.length; c++) {
+ var attr = styledef.form.items[c];
+ // console.log(attr[j].Name+'=='+attrs[i].attr);
+ //鍒ゆ柇琛ㄥ崟閲屾槸鍚︽湁杩斿洖瀛楁锛屾病鏈夊氨瑁呰浇鍒癿odel閲岋紝鐐瑰嚮纭畾鎻愪氦鐨勬椂鍊欏甫涓婅繖浜涙暟鎹�+ if (styledef.form.model[attrs[i].attr] ==
+ undefined) {
+ styledef.form.model[attrs[i].attr] = attrs[i]
+ .value;
+ }
+ //鍒ゆ柇鏄惁鏄爡鏍艰〃鍗�+ if (attr.name != 'Layout') {
+ if (attr.fieldId == attrs[i].attr) {
+ attr.value = '';
+ attr.oldvalue = '';
+ attr.value = attrs[i].value;
+ attr.oldvalue = attrs[i].value;
+ styledef.form.model[attr.fieldId] = attrs[
+ i].value;
+ }
+ } else if (attr.name == 'Layout') {
+ attr.setting.colList.forEach(col => {
+ if (col) {
+ if (col.fieldId == attrs[i].attr) {
+ col.value = '';
+ col.oldvalue = '';
+ col.value = attrs[i].value;
+ col.oldvalue = attrs[i].value;
+ styledef.form.model[col
+ .fieldId] = attrs[i].value;
+ }
+ }
+ });
+ }
+ }
+
+ }
+ },
+ setFormItemVisible(attrs) {
+ if (!Array.isArray(attrs)) {
+ return
+ }
+ const head_styledef = this.head_styledef
+ if (!head_styledef.hiddenIds) {
+ head_styledef.hiddenIds = []
+ }
+ attrs.forEach((attr) => {
+ let index = head_styledef.hiddenIds.findIndex((id) => id == attr.attr);
+ if (attr.show) {
+ if (index > -1) head_styledef.hiddenIds.splice(index, 1);
+ } else {
+ if (index == -1) head_styledef.hiddenIds.push(attr.attr);
+ }
+ });
+
+ this.setData({
+ head_styledef: head_styledef
+ })
},
scan_DataObjRunCustomEvent(info, data_attr) {
var $this = this;
@@ -1767,7 +1778,7 @@
runCustomEvent(dataInfo).then(data => {
console.log(data);
- if (data.ret != 0) {
+ if (data.ret != 0 && data.ret != 1) {
var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : data
.err_info.join('<br/>') : '';
if (data.ret == 801) {
@@ -1792,86 +1803,17 @@
} else {
var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join(
'<br/>') : '';
+ tip = tip || data.err_info
if (tip) uni.showModal({
title: this.translateSys("tip"),
content: tip,
showCancel: false,
confirmText: this.translateSys('close')
});
+ if ([0, 2, 3, 4, -1].includes(data.result_type)) {
+ if (data.result_type == 2) {
+ if (data.result) {
- var actionlist = data.action;
- if (actionlist) {
- console.log(actionlist);
- for (var ii = 0; ii < actionlist.length; ii++) {
- var action = actionlist[ii];
- if (action.action_type == 'set_dlg_attr') {
- var result = action.value;
- for (var i = 0; i < result.length; i++) {
- if (result[i].choice_list) {
- for (var s = 0; s < $this.subPanelList.length; s++) {
- for (var c = 0; c < $this.subPanelList[s]
- .subClassAttrList.length; c++) {
- var attr = $this.subPanelList[s].subClassAttrList[c]
- .Attr;
- for (var j = 0; j < attr.length; j++) {
- if (attr[j].Name == result[i].attr) {
- if (utils.classUtils.attrTypeIsDict(attr[j]
- .Type)) {
- var dictItemList = [];
- for (var d in result[i].choice_list) {
- var val = result[i].choice_list[d];
- dictItemList.push({
- "CN_S_NAME": val,
- "CN_S_VALUE": val,
- "Name": val,
- "label": val,
- "value": val
- });
- }
- attr[j].dictitem = dictItemList;
- // attr[j].dictitem = result[i].choice_list;
- }
- }
- }
- }
- }
- }
- for (var s = 0; s < $this.subPanelList.length; s++) {
- for (var c = 0; c < $this.subPanelList[s].subClassAttrList
- .length; c++) {
- var attr = $this.subPanelList[s].subClassAttrList[c]
- .Attr;
- for (var j = 0; j < attr.length; j++) {
- console.log(attr[j].Name + '==' + result[i].attr);
- if (attr[j].Name == result[i].attr) {
- attr[j].Value = result[i].value;
- // attr.value = '';
- // attr.oldvalue = '';
- // attr.value = result[i].value;
- // attr.oldvalue = result[i].value;
- }
- }
- }
- }
- var length = 0;
-
- }
- } else if (action.action_type == 'set_global_attr') {
- $this.$actiontr = action.value || [];
- } else if (action.action_type == 'open_common_dlg') { //鎵撳紑渚ф粦寮规
- var $this = this;
- if (action.value.common_dlg_id == 'check_list') {
- $this.check_list = action.value.config;
- if (action.value.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�- $this.popupType = 'right';
- else
- $this.popupType = 'center'
- // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
- $this.$refs.popup.open($this.popupType);
- }
- } else if (action.action_type == 'add_subcls_panel') { //涓讳粠鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�- var result = action.value;
- var $this = this;
var list_1 = JSON.parse(JSON.stringify(this.detail1_styledef));
var scanCodeVal = $this.scanCodeVal;
var rand = '';
@@ -1890,16 +1832,14 @@
scanCodeVal: scanCodeVal,
subClassAttr: list_1
});
- $this.activelist.push({
- active: false
- });
+ var result = data.result || []
for (var i = 0; i < result.length; i++) {
for (var s = 0; s < $this.subPanelList.length; s++) {
if ($this.subPanelList[s].scanCodeVal == scanCodeVal) {
if (result[i].attr == "S_ID")
$this.subPanelList[s].ObjID = result[i].value;
- var _subClassAttr = $this.subPanelList[s].subClassAttr
- .form.items;
+ var _subClassAttr = $this.subPanelList[s].subClassAttr.form
+ .items;
for (var c = 0; c < _subClassAttr.length; c++) {
if (_subClassAttr[c].name != 'Layout') {
if (_subClassAttr[c].fieldId == result[i].attr)
@@ -1913,11 +1853,9 @@
});
}
}
-
- // $this.subPanelList[s].subClassAttr=list_1;
}
}
- // console.log($this.subPanelList);
+
var length = 0;
if (!$this.refdatastore.filter(function(s) {
return result[i].attr == s.attr
@@ -1933,77 +1871,177 @@
}
}
}
- } else {
+ }
+
+ } else if (typeof data.result == 'string') {
+ if (data.result) {
uni.showModal({
- title: this.translateSys("tip"),
- content: this.translateSys("quotation_mark_left") + action
- .action_type + this.translateSys(
- "quotation_mark_right") + this.translate(
- "tip_action_unprocessed"),
+ title: this.translateSys('tip'),
+ content: data.result,
showCancel: false,
confirmText: this.translateSys('close')
});
}
}
- }
-
- if (data.result) {
- var list_1 = JSON.parse(JSON.stringify(this.detail1_styledef));
- var scanCodeVal = $this.scanCodeVal;
- var rand = '';
- for (var i = 0; i < 5; i++) { //鐢熸垚5浣嶉殢鏈烘暟
- rand += Math.floor(Math.random() * 10);
- }
- if (inputParamter[0].attr) {
- if (inputParamter[0].attr == "mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�- scanCodeVal = "mast_input_3037-" + rand;
- }
- if (info.attr[0].attr) {
- if (info.attr[0].attr == "mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�- scanCodeVal = "mast_input_3037-" + rand;
- }
- $this.subPanelList.push({
- scanCodeVal: scanCodeVal,
- subClassAttr: list_1
- });
- var result = data.result;
- for (var i = 0; i < result.length; i++) {
- for (var s = 0; s < $this.subPanelList.length; s++) {
- if ($this.subPanelList[s].scanCodeVal == scanCodeVal) {
- if (result[i].attr == "S_ID")
- $this.subPanelList[s].ObjID = result[i].value;
- var _subClassAttr = $this.subPanelList[s].subClassAttr.form
- .items;
- for (var c = 0; c < _subClassAttr.length; c++) {
- if (_subClassAttr[c].name != 'Layout') {
- if (_subClassAttr[c].fieldId == result[i].attr)
- _subClassAttr[c].value = result[i].value;
- } else if (_subClassAttr[c].name == 'Layout') {
- _subClassAttr[c].setting.colList.forEach(col => {
- if (col) {
- if (col.fieldId == result[i].attr)
- col.value = result[i].value;
+ try {
+ var actionlist = data.action || []
+ for (var ii = 0; ii < actionlist.length; ii++) {
+ var action = actionlist[ii];
+ if (action.action_type == 'set_dlg_attr') {
+ var result = action.value;
+ for (var i = 0; i < result.length; i++) {
+ if (result[i].choice_list) {
+ for (var s = 0; s < $this.subPanelList.length; s++) {
+ for (var c = 0; c < $this.subPanelList[s]
+ .subClassAttrList.length; c++) {
+ var attr = $this.subPanelList[s].subClassAttrList[c]
+ .Attr;
+ for (var j = 0; j < attr.length; j++) {
+ if (attr[j].Name == result[i].attr) {
+ if (utils.classUtils.attrTypeIsDict(attr[j]
+ .Type)) {
+ var dictItemList = [];
+ for (var d in result[i].choice_list) {
+ var val = result[i].choice_list[d];
+ dictItemList.push({
+ "CN_S_NAME": val,
+ "CN_S_VALUE": val,
+ "Name": val,
+ "label": val,
+ "value": val
+ });
+ }
+ attr[j].dictitem = dictItemList;
+ // attr[j].dictitem = result[i].choice_list;
+ }
+ }
+ }
}
- });
+ }
+ }
+ for (var s = 0; s < $this.subPanelList.length; s++) {
+ for (var c = 0; c < $this.subPanelList[s].subClassAttrList
+ .length; c++) {
+ var attr = $this.subPanelList[s].subClassAttrList[c]
+ .Attr;
+ for (var j = 0; j < attr.length; j++) {
+ console.log(attr[j].Name + '==' + result[i].attr);
+ if (attr[j].Name == result[i].attr) {
+ attr[j].Value = result[i].value;
+ // attr.value = '';
+ // attr.oldvalue = '';
+ // attr.value = result[i].value;
+ // attr.oldvalue = result[i].value;
+ }
+ }
+ }
+ }
+ var length = 0;
+
+ }
+ } else if (action.action_type == 'set_global_attr') {
+ $this.$actiontr = action.value || [];
+ } else if (action.action_type == 'open_common_dlg') { //鎵撳紑渚ф粦寮规
+ var $this = this;
+ if (action.value.common_dlg_id == 'check_list') {
+ $this.check_list = action.value.config;
+ if (action.value.config.appear_style == 'sideslip') //鍒ゆ柇鏄惁鏄晶婊�+ $this.popupType = 'right';
+ else
+ $this.popupType = 'center'
+ // open 鏂规硶浼犲叆鍙傛暟 绛夊悓鍦�uni-popup 缁勪欢涓婄粦瀹�type灞炴�
+ $this.$refs.popup.open($this.popupType);
+ }
+ } else if (action.action_type == 'add_subcls_panel') { //涓讳粠鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�+ var result = action.value;
+ var $this = this;
+ var list_1 = JSON.parse(JSON.stringify(this.detail1_styledef));
+ var scanCodeVal = $this.scanCodeVal;
+ var rand = '';
+ for (var i = 0; i < 5; i++) { //鐢熸垚5浣嶉殢鏈烘暟
+ rand += Math.floor(Math.random() * 10);
+ }
+ if (inputParamter[0].attr) {
+ if (inputParamter[0].attr == "mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�+ scanCodeVal = "mast_input_3037-" + rand;
+ }
+ if (info.attr[0].attr) {
+ if (info.attr[0].attr == "mast_input_3037") //鍒ゆ柇鏄富鏁版嵁绫绘壂鐮佹煡璇㈡暟鎹�+ scanCodeVal = "mast_input_3037-" + rand;
+ }
+ $this.subPanelList.push({
+ scanCodeVal: scanCodeVal,
+ subClassAttr: list_1
+ });
+ $this.activelist.push({
+ active: false
+ });
+ for (var i = 0; i < result.length; i++) {
+ for (var s = 0; s < $this.subPanelList.length; s++) {
+ if ($this.subPanelList[s].scanCodeVal == scanCodeVal) {
+ if (result[i].attr == "S_ID")
+ $this.subPanelList[s].ObjID = result[i].value;
+ var _subClassAttr = $this.subPanelList[s].subClassAttr
+ .form.items;
+ for (var c = 0; c < _subClassAttr.length; c++) {
+ if (_subClassAttr[c].name != 'Layout') {
+ if (_subClassAttr[c].fieldId == result[i].attr)
+ _subClassAttr[c].value = result[i].value;
+ } else if (_subClassAttr[c].name == 'Layout') {
+ _subClassAttr[c].setting.colList.forEach(col => {
+ if (col) {
+ if (col.fieldId == result[i].attr)
+ col.value = result[i].value;
+ }
+ });
+ }
+ }
+
+ // $this.subPanelList[s].subClassAttr=list_1;
+ }
+ }
+ // console.log($this.subPanelList);
+ var length = 0;
+ if (!$this.refdatastore.filter(function(s) {
+ return result[i].attr == s.attr
+ }).length) {
+ length = 1;
+ $this.refdatastore.push(result[i]);
+ }
+ if (length == 0) {
+ for (var j = 0; j < $this.refdatastore.length; j++) {
+ if ($this.refdatastore[j].attr == result[i].attr) {
+ $this.refdatastore[j].value = result[i].value;
+ }
+ }
}
}
+ } else {
+ uni.showModal({
+ title: this.translateSys("tip"),
+ content: this.translateSys("quotation_mark_left") + action
+ .action_type + this.translateSys(
+ "quotation_mark_right") + this.translate(
+ "tip_action_unprocessed"),
+ showCancel: false,
+ confirmText: this.translateSys('close')
+ });
}
}
- var length = 0;
- if (!$this.refdatastore.filter(function(s) {
- return result[i].attr == s.attr
- }).length) {
- length = 1;
- $this.refdatastore.push(result[i]);
- }
- if (length == 0) {
- for (var j = 0; j < $this.refdatastore.length; j++) {
- if ($this.refdatastore[j].attr == result[i].attr) {
- $this.refdatastore[j].value = result[i].value;
- }
- }
- }
+
+ } catch (ex) {
+ let actionList = (data.action || []).map(a => a.action_type).join(';')
+ let tip = typeof ex == 'string' ? ex : ex.message
+ tip = `鎵ц鑴氭湰杩斿洖鐨�{actionList}鏃跺嚭鐜板紓甯革紝璇锋鏌ヨ剼鏈繑鍥炵殑鏁版嵁鏍煎紡鏄惁姝g‘銆�{tip}`
+ uni.showModal({
+ title: this.translateSys('tip'),
+ content: tip,
+ showCancel: false,
+ confirmText: this.translateSys('close')
+ });
+ console.log(ex)
+ return
}
}
}
@@ -2140,6 +2178,7 @@
} else {
var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join(
'<br/>') : '';
+ tip = tip || data.err_info
if (tip) uni.showModal({
title: this.translateSys("tip"),
content: tip,
@@ -2147,7 +2186,7 @@
confirmText: this.translateSys('close')
});
- var result = data.result;
+ // var result = data.result;
if (eventID != $this.param.After_OK_Event.ID)
$this.scan_OKDataObjRunCustomEvent($this.param.After_OK_Event.ID);
else {
--
Gitblit v1.9.1