| | |
| | | <view class="uni-page-modal-3017-2" :class="largeMode?'large-mode':''"> |
| | | <!-- 表头样式 --> |
| | | <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"> |
| | | :hiddenIds="head_styledef.hiddenIds ?head_styledef.hiddenIds :[] " @on-focus="ontap" :focusId="focusFieldId" |
| | | @on-change="onEnterChange" @on-click-prefix="classAttr_extButton" @on-click-suffix="classAttr_extButton" |
| | | @on-click="onClick"> |
| | | </OIForm> |
| | | <!-- 从数据 --> |
| | | <view class="v-panel"> |
| | |
| | | import utils from "@/js/utils.js" |
| | | import { |
| | | showInfo, |
| | | showError |
| | | showError, |
| | | showLoading, |
| | | hideLoading |
| | | } from "@/js/Page.js" |
| | | import { |
| | | appGetInfo, |
| | |
| | | subClassGridStyle: [], |
| | | popupType: "center", |
| | | check_list: {}, |
| | | |
| | | focusMateria: false, |
| | | focusFieldId: "", |
| | | focusOldFieldId: "", |
| | | head_styledef: { |
| | | form: { |
| | | items: [] |
| | |
| | | this.param = JSON.parse(options.param); |
| | | const paramValue = options.paramValue ? JSON.parse(options.paramValue) : undefined |
| | | this.loadData(paramValue) |
| | | |
| | | //页面初始化获取焦点 |
| | | // this.focusMateria=true; |
| | | }, |
| | | initialEvent() { |
| | | let event = (this.head_styledef.event || []).find((e) => e.event_id == "initial"); |
| | |
| | | }); |
| | | }, |
| | | async loadData(paramValue) { |
| | | console.log(this.param); |
| | | //获取数据类的自定义表单参数 |
| | | await this.Head_UIStyleGetInfo(this.param.Master_Cls?.ID, this.param.Master_Cls?.UI_Style?.ID); |
| | | //传入参数值 |
| | | if (paramValue) { |
| | | this.setFormValues(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; |
| | | // } |
| | | // }); |
| | | // } |
| | | // }); |
| | | // } |
| | | // }) |
| | | |
| | | try { |
| | | showLoading("loading...") |
| | | console.log(this.param); |
| | | //获取数据类的自定义表单参数 |
| | | await this.Head_UIStyleGetInfo(this.param.Master_Cls?.ID, this.param.Master_Cls?.UI_Style?.ID); |
| | | //传入参数值 |
| | | if (paramValue) { |
| | | this.setFormValues(this.head_styledef, paramValue) |
| | | } |
| | | await this.Detail1_UIstyleGetInfo(this.param.Sub_Cls?.ID, this.param.Sub_Cls?.UI_Style?.ID); |
| | | await this.loadInitialEvent(); |
| | | hideLoading() |
| | | } catch (ex) { |
| | | hideLoading() |
| | | showError(ex, this.translateSys("error")); |
| | | } |
| | | |
| | | await this.Detail1_UIstyleGetInfo(this.param.Sub_Cls?.ID, this.param.Sub_Cls?.UI_Style?.ID); |
| | | await this.loadInitialEvent(); |
| | | }, |
| | | async loadInitialEvent() { |
| | | try { |
| | |
| | | if (!result.style_def.includes('"')) styledef = Base64.decode(result |
| | | .style_def); |
| | | } |
| | | $this.head_styledef = result.style_def ? JSON.parse(styledef) : {}; |
| | | |
| | | const styledefHead = styledef ? JSON.parse(styledef) : {}; |
| | | |
| | | // console.log($this.head_styledef); |
| | | if ($this.head_styledef.form?.items) { |
| | | $this.head_styledef.form.items.forEach(async (ele, index) => { |
| | | ele.show = true; |
| | | if (ele.useDict == true) { //判断useDict是否使用字典 |
| | | await this.DictGetInfo(ele.bind.dict, index, 'mast'); |
| | | } else { |
| | | if (ele?.name === "Select") { |
| | | const selections = ele?.selections || [] |
| | | //有默认值,显示默认值 |
| | | let itemName = ele.value || ""; |
| | | if (itemName) { |
| | | $this.head_styledef.form |
| | | .model[ele.fieldId] = itemName; |
| | | } |
| | | $this.head_styledef.form.items[index].selections = selections.map(( |
| | | a) => { |
| | | return { |
| | | value: a.value, |
| | | text: a.label |
| | | if (styledefHead.form?.items) { |
| | | styledefHead.form.items.forEach(async (ele, index) => { |
| | | if (ele.name != "Layout") { |
| | | ele.show = true; |
| | | if (ele.useDict == true) { //判断useDict是否使用字典 |
| | | await this.DictGetInfo(ele.bind.dict, index, 'mast'); |
| | | } else { |
| | | if (ele?.name === "Select") { |
| | | const selections = ele?.selections || [] |
| | | //有默认值,显示默认值 |
| | | let itemName = ele.value || ""; |
| | | if (itemName) { |
| | | styledefHead.form |
| | | .model[ele.fieldId] = itemName; |
| | | } |
| | | }) |
| | | styledefHead.form.items[index].selections = selections.map(( |
| | | a) => { |
| | | return { |
| | | value: a.value, |
| | | text: a.label |
| | | } |
| | | }) |
| | | } |
| | | |
| | | } |
| | | if ($this.focusFieldId == "") { |
| | | if (ele.name == 'Input' || ele.name == |
| | | 'InputNumber') { |
| | | $this.setData({ |
| | | focusFieldId: ele.fieldId |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | for (let j in ele.setting.colList) { |
| | | const col = ele.setting.colList[j] |
| | | if (col) { |
| | | col.show = true |
| | | if (col?.useDict) { |
| | | //判断useDict是否使用字典 |
| | | await $this.DictGetInfo(col.bind |
| | | .dict, |
| | | styledefHead.form |
| | | .model, col); |
| | | } else { |
| | | if (col?.name === "Select") { |
| | | const selections = col?.selections || [] |
| | | //有默认值,显示默认值 |
| | | let itemName = col.value || ""; |
| | | if (itemName) { |
| | | styledefHead.form |
| | | .model[col.fieldId] = itemName; |
| | | } |
| | | col.selections = selections.map((a) => { |
| | | return { |
| | | value: a.value, |
| | | text: a.label |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | if ($this.focusFieldId == "") { |
| | | if (col.name == 'Input' || col |
| | | .name == |
| | | 'InputNumber') { |
| | | $this.setData({ |
| | | focusFieldId: col |
| | | .fieldId |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | $this.head_styledef.form.model["S_CLASSES"] = app.globalData.classes |
| | | } |
| | | } |
| | | $this.setData({ |
| | | head_styledef: styledefHead |
| | | }) |
| | | if ($this.head_styledef.event?.length > 0) { |
| | | $this.head_styledef.event.forEach(async (a) => { //判断是否是初始化事件 |
| | | if (a.event_id == "initial") { |
| | |
| | | getApp().onScan((result) => { |
| | | //console.log(result); |
| | | uni.hideKeyboard(); |
| | | var $this = this; |
| | | console.log(item); |
| | | item.value = result |
| | | let newVal = item.value.trim() |
| | | if (newVal) { |
| | | item.oldvalue = newVal; |
| | | var attr = item.fieldId; |
| | | $this.head_styledef.form.model[attr] = newVal; |
| | | $this.focusMateria = true; //初始化,第二个输入框focus属性 |
| | | // setTimeout(function(){ |
| | | // $this.focusMateria=true; //第二个输入框获取焦点 |
| | | setTimeout(function() { |
| | | uni.hideKeyboard(); |
| | | }, 1000); |
| | | // },500); |
| | | //子数据类扫码区事件脚本 |
| | | var eventid = this.param.Scan_Code.Input_Change_Event.ID; |
| | | if (eventid) { |
| | | 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 info = { |
| | | eventid: eventid, |
| | | edtype: "7", //"0", |
| | | projectid: '', |
| | | rclsid: '', |
| | | robjid: '', |
| | | userlogin: '', |
| | | clsid: 'MBOX', //this.param.Sub_Cls.ID, |
| | | objid: "", |
| | | attr: req, |
| | | mast_attr: [], |
| | | inputParamter: [{ |
| | | attr: 'mast_input_3037', |
| | | value: newVal |
| | | }] |
| | | this.onScanValue(item, result) |
| | | }) |
| | | }, |
| | | onScanValue(item, value) { |
| | | const $this = this; |
| | | //console.log("onScanValue", item); |
| | | item.value = value |
| | | let newVal = item.value |
| | | if (typeof item.value == "string") { |
| | | newVal = item.value.trim() |
| | | } |
| | | if (newVal) { |
| | | item.oldvalue = newVal; |
| | | var attr = item.fieldId; |
| | | $this.head_styledef.form.model[attr] = newVal; |
| | | setTimeout(function() { |
| | | uni.hideKeyboard(); |
| | | }, 1000); |
| | | var eventid = this.param.Scan_Code.Input_Change_Event.ID; |
| | | if (eventid) { |
| | | 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 info = { |
| | | eventid: eventid, |
| | | edtype: "7", //"0", |
| | | projectid: '', |
| | | rclsid: '', |
| | | robjid: '', |
| | | userlogin: '', |
| | | clsid: 'MBOX', //this.param.Sub_Cls.ID, |
| | | objid: "", |
| | | attr: req, |
| | | mast_attr: [], |
| | | inputParamter: [{ |
| | | attr: 'mast_input_3037', |
| | | value: newVal |
| | | }] |
| | | } |
| | | |
| | | this.scan_DataObjRunCustomEvent(info, ""); |
| | | } |
| | | var findd = false |
| | | for (let i in $this.head_styledef.form.items) { |
| | | const ele = $this.head_styledef.form.items[i] |
| | | |
| | | if (ele.name != "Layout") { |
| | | if (ele.name == 'Input' || ele.name == 'InputNumber') { |
| | | if (attr == ele.fieldId) { |
| | | findd = true |
| | | } else { |
| | | if (findd) { |
| | | $this.setData({ |
| | | focusFieldId: ele.fieldId |
| | | }) |
| | | break |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | if (findd) { |
| | | let curIndex = ele.setting.colList.findIndex((col, index2, arr) => { |
| | | return (col.name == 'Input' || col.name == 'InputNumber'); |
| | | }) |
| | | if (curIndex > -1) { |
| | | $this.setData({ |
| | | focusFieldId: ele.setting.colList[curIndex] |
| | | .fieldId |
| | | }) |
| | | break |
| | | } |
| | | |
| | | } else { |
| | | let curIndex = ele.setting.colList.findIndex((col, index2, arr) => { |
| | | return attr == col.fieldId; |
| | | }) |
| | | if (curIndex > -1) { |
| | | findd = true |
| | | let curIndex2 = ele.setting.colList.findIndex((col, index2, arr) => { |
| | | return (col.name == 'Input' || col.name == |
| | | 'InputNumber') && |
| | | index2 > |
| | | curIndex; |
| | | }) |
| | | if (curIndex2 > -1) { |
| | | $this.setData({ |
| | | focusFieldId: ele.setting.colList[curIndex].fieldId |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.scan_DataObjRunCustomEvent(info, ""); |
| | | } |
| | | } |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | onevent(item) { |
| | | // console.log(e.target); |
| | |
| | | } |
| | | |
| | | }, |
| | | onClick(item) { |
| | | 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); |
| | | } |
| | | }, |
| | | classAttr_extButton(item) { |
| | | var onSuffixClickCallbackEvent = item.bind.onSuffixClickCallbackEvent; //后图标点击回调 |
| | | var onSuffixClickEvent = item.bind.onSuffixClickEvent; //后图标点击事件 |
| | |
| | | // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 |
| | | this.$refs.popup.open(this.popupType); |
| | | |
| | | this.dataObjRunCustomEvent_Return(onSuffixClickEvent.id, '', onSuffixClickCallbackEvent.id, |
| | | this.dataObjRunCustomEvent_Return(onSuffixClickEvent.id, onSuffixClickCallbackEvent.id, |
| | | item); |
| | | }, |
| | | dataObjRunCustomEvent_Return(eventid, data_attr, button_callback, item) { |
| | | dataObjRunCustomEvent_Return(eventid, button_callback, item) { |
| | | const $this = this |
| | | var enviroment = { |
| | | 'function': '3000', // 功能点编号 |
| | | cls_id: $this.head_styledef.form.clsId, // 功能点主数据类标识 |
| | | 'button': 'top', // top/bottom |
| | | button_name: $this.translateSys('add2'), |
| | | master: { |
| | | cls_id: $this.head_styledef.form.clsId, // button=bottom时 master的cls_id |
| | | //obj_id: '' // button=bottom时 master的obj_id |
| | | } |
| | | }; |
| | | showLoading("loading...") |
| | | |
| | | var obj_attr = $this.head_styledef.form.model; |
| | | console.log(obj_attr); |
| | | var req = Object.keys(obj_attr).map((a) => ({ |
| | |
| | | console.log(dataInfo); |
| | | // return; |
| | | runCustomEvent(dataInfo).then(data => { |
| | | hideLoading() |
| | | $this.onFormEventResult(data, button_callback, item) |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | hideLoading() |
| | | showError(ex, this.translateSys("error") + "5.1") |
| | | }); |
| | | }, |
| | | |
| | | onEnterChange(item) { |
| | | console.log("onEnterChange", item); |
| | | let newVal = item.value |
| | | if (typeof item.value == "string") { |
| | | newVal = item.value.trim() |
| | | if (!newVal) |
| | | return |
| | | } |
| | | if (item.oldvalue != newVal) { |
| | | item.oldvalue = newVal; |
| | | var attr = item.fieldId; |
| | | this.head_styledef.form.model[attr] = newVal; |
| | | var onChangeEvent = item.bind.onChangeEvent; //内容变化后事件 |
| | | if (onChangeEvent?.id) { //内容变化后事件 |
| | | this.onChange(onChangeEvent); |
| | | } |
| | | } |
| | | |
| | | }, |
| | | onDetail1EnterChange(item) { |
| | | //码盘中样式回车事件 |
| | | // console.log(item); |
| | | }, |
| | | // 内容变化后事件 |
| | | async onChange(event) { |
| | | var eventid = event?.id; //内容变化后事件 |
| | | if (eventid) { |
| | | // self.event_no_sub = 1; |
| | | 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 info = { |
| | | eventid: eventid, |
| | | edtype: "0", |
| | | projectid: '', |
| | | rclsid: '', |
| | | robjid: '', |
| | | userlogin: '', |
| | | clsid: this.head_styledef.form.clsId, |
| | | objid: "", |
| | | attr: req, |
| | | } |
| | | this.DataObjRunCustomEvent(info); |
| | | } |
| | | |
| | | }, |
| | | async onFormEventResult(data, callbackEventId, item) { |
| | | try { |
| | | const $this = this |
| | | var enviroment = { |
| | | 'function': '3000', // 功能点编号 |
| | | cls_id: $this.head_styledef.form.clsId, // 功能点主数据类标识 |
| | | 'button': 'top', // top/bottom |
| | | button_name: $this.translateSys('add2'), |
| | | master: { |
| | | cls_id: $this.head_styledef.form.clsId, // button=bottom时 master的cls_id |
| | | //obj_id: '' // button=bottom时 master的obj_id |
| | | } |
| | | }; |
| | | if (data.ret != 0 && data.ret != 1) { |
| | | let cls_name = data.event_info?.cls_name |
| | | let event_name = data.event_info?.event_name |
| | |
| | | showInfo(tip) |
| | | if ([0, 2, 3, 4, -1].includes(data.result_type)) { |
| | | if (data.result_type == 2) { |
| | | 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; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | 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') { |
| | | 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') { |
| | | var enviroment = JSON.stringify(enviroment); |
| | | 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_dlg_current_edit_attr" |
| | | ) { |
| | | if ($this |
| | | .focusOldFieldId == |
| | | action.value) { |
| | | $this.setData({ |
| | | focusFieldId: "" |
| | | }) |
| | | } else { |
| | | $this.setData({ |
| | | focusFieldId: $this |
| | | .focusOldFieldId |
| | | }) |
| | | } |
| | | $this.$nextTick(() => { |
| | | $this.setData({ |
| | | focusFieldId: action |
| | | .value |
| | | }) |
| | | }); |
| | | } else if (action.action_type == 'set_global_attr') { |
| | | $this.global_attr = action.value || []; |
| | | } else if (action.action_type == 'open_panel') { |
| | | var d = dialog({ |
| | | title: '<i class="ace-icon fa fa-info-circle"></i> ' + |
| | | $this.translateSys("tip"), |
| | |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | showInfo($this.translateSys( |
| | | "quotation_mark_left") + |
| | | action.action_type + $this.translateSys( |
| | | "quotation_mark_right") + $this |
| | | .translate( |
| | | "tip_action_unprocessed")) |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | } catch (ex) { |
| | |
| | | return |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | showError(ex, this.translateSys("error") + "5.1") |
| | | }); |
| | | }, |
| | | |
| | | onEnterChange(item) { |
| | | console.log("onEnterChange", item); |
| | | let newVal = item.value |
| | | if (typeof item.value == "string") { |
| | | newVal = item.value.trim() |
| | | if (!newVal) |
| | | return |
| | | } catch (ex) { |
| | | showError(ex, this.translateSys("error") + "10.1") |
| | | } |
| | | if (item.oldvalue != newVal) { |
| | | item.oldvalue = newVal; |
| | | var attr = item.fieldId; |
| | | this.head_styledef.form.model[attr] = newVal; |
| | | var onChangeEvent = item.bind.onChangeEvent; //内容变化后事件 |
| | | if (onChangeEvent?.id) { //内容变化后事件 |
| | | this.onChange(onChangeEvent); |
| | | } |
| | | } |
| | | |
| | | }, |
| | | onDetail1EnterChange(item) { |
| | | //码盘中样式回车事件 |
| | | // console.log(item); |
| | | }, |
| | | // 内容变化后事件 |
| | | async onChange(event) { |
| | | var eventid = event?.id; //内容变化后事件 |
| | | if (eventid) { |
| | | // self.event_no_sub = 1; |
| | | 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 info = { |
| | | eventid: eventid, |
| | | edtype: "0", |
| | | projectid: '', |
| | | rclsid: '', |
| | | robjid: '', |
| | | userlogin: '', |
| | | clsid: this.head_styledef.form.clsId, |
| | | objid: "", |
| | | attr: req, |
| | | } |
| | | this.DataObjRunCustomEvent(info); |
| | | } |
| | | |
| | | }, |
| | | |
| | | scan_ontap(e) { //扫码区扫码功能 |
| | | //console.log(e.target) |
| | | getApp().onScan((result) => { |
| | |
| | | |
| | | DataObjRunCustomEvent(info, data_attr) { |
| | | var $this = this; |
| | | if (!info.eventid) |
| | | return |
| | | showLoading("loading...") |
| | | var enviroment = { |
| | | 'function': '3000', // 功能点编号 |
| | | cls_id: this.param.Master_Cls.ID, // 功能点主数据类标识 |
| | |
| | | // return; |
| | | runCustomEvent(dataInfo).then(data => { |
| | | console.log(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) { |
| | | 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; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | 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') { |
| | | showInfo(data.result) |
| | | |
| | | } |
| | | 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 || []; |
| | | } |
| | | |
| | | } |
| | | |
| | | } catch (ex) { |
| | | let actionList = (data.action || []).map(a => a.action_type).join(';') |
| | | let tip = typeof ex == 'string' ? ex : ex.message |
| | | tip = `执行脚本返回的${actionList}时出现异常,请检查脚本返回的数据格式是否正确。${tip}` |
| | | showError(tip, this.translateSys('tip')) |
| | | return |
| | | } |
| | | } |
| | | } |
| | | hideLoading() |
| | | $this.onFormEventResult(data, "") |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | hideLoading() |
| | | showError(ex, this.translateSys("error") + "3.1") |
| | | }); |
| | | }, |
| | |
| | | }, |
| | | scan_DataObjRunCustomEvent(info, data_attr) { |
| | | var $this = this; |
| | | showLoading("loading...") |
| | | var obj_attr = {}; |
| | | info.attr.forEach(item => { |
| | | obj_attr[item.attr] = item.value; |
| | |
| | | // return; |
| | | runCustomEvent(dataInfo).then(data => { |
| | | console.log(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 |
| | |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | hideLoading() |
| | | showError(ex, this.translateSys("error") + "7.1") |
| | | }); |
| | | }, |
| | |
| | | }, |
| | | scan_OKDataObjRunCustomEvent(eventID) { |
| | | this.saving = true |
| | | uni.showLoading({ |
| | | title: this.translateSys("loading"), |
| | | mask: true |
| | | }); |
| | | showLoading("loading...") |
| | | |
| | | var $this = this; |
| | | //获取表头属性 |
| | | var obj_attr = this.head_styledef.form.model; |
| | |
| | | // return; |
| | | runCustomEvent(dataInfo).then(data => { |
| | | console.log(data); |
| | | uni.hideLoading(); |
| | | hideLoading() |
| | | if (data.ret != 0 && data.ret != 1) { |
| | | let cls_name = data.event_info?.cls_name |
| | | let event_name = data.event_info?.event_name |
| | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | this.saving = false |
| | | uni.hideLoading(); |
| | | hideLoading() |
| | | showError(ex, this.translateSys("error") + "8.1") |
| | | }); |
| | | }, |