| | |
| | | |
| | | </view> |
| | | |
| | | <view class="v-bottom"><button type="default" @tap="cancel" |
| | | class="btn_cancel">{{translateSys('cancel')}}</button> |
| | | <button type="default" @tap="sava" class="btn_add">{{title}}</button> |
| | | <view class="v-bottom"><button type="primary" @tap="ok" class="btn_add">{{title}}</button> |
| | | <button type="default" @tap="cancel" class="btn_cancel">{{translateSys('cancel')}}</button> |
| | | |
| | | </view> |
| | | <!-- 普通弹窗 top bottom center left right --> |
| | | <view> |
| | |
| | | data() { |
| | | return { |
| | | title: this.translateSys('add2'), |
| | | editMode: false, |
| | | objAttr: {}, |
| | | param: {}, |
| | | type: '', |
| | | classAttrList: [], |
| | |
| | | if (options.type) { |
| | | this.$data.type = options.type; |
| | | } |
| | | this.editMode = options.editMode ? true : false; |
| | | if (options.objAttr) |
| | | this.objAttr = JSON.parse(options.objAttr); |
| | | console.log(param); |
| | | if (!param.EditDlgMode) { |
| | | uni.showModal({ |
| | |
| | | return res?.dict_item_list || [] |
| | | |
| | | } catch (ex) { |
| | | // console.log(ex); |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.3", |
| | | content: ex.errMsg, |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | |
| | | try { |
| | | var $this = this; |
| | | var gridstyleInfo = { |
| | | class_id: $this.$data.param.clsid, |
| | | class_id: $this.param.clsid, |
| | | ui_style_type: 2, |
| | | ui_style_name: $this.$data.param.Edit_dlg.Name |
| | | ui_style_name: $this.param.Edit_dlg.Name |
| | | }; |
| | | |
| | | const result = await getUIStyleInfo(dataInfo) |
| | | const result = await getUIStyleInfo(gridstyleInfo) |
| | | var styledef = Base64.decode(result.style_def); |
| | | result.style_def = JSON.parse(styledef); |
| | | $this.$data.classGridStyle = result |
| | | $this.viewParam(); |
| | | |
| | | } catch (ex) { |
| | | // console.log(ex); |
| | | console.log(ex) |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.4", |
| | | content: ex.errMsg, |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | }, |
| | | viewParam() { //将mobox3小写参数转换为mobox2大写参数 |
| | | async loadFormData(objAttr) { |
| | | let formData |
| | | if (this.param.objid) { |
| | | let info = await dataObjInfo({ |
| | | class_id: this.param.clsid, |
| | | obj_id: this.param.objid, |
| | | }); |
| | | formData = {}; |
| | | formData["id"] = info.id; |
| | | formData["state"] = info.state; |
| | | info.attr_list.forEach(({ |
| | | name, |
| | | value |
| | | }) => { |
| | | formData[name] = value; |
| | | }); |
| | | } else if (objAttr) { |
| | | formData = {}; |
| | | Object.keys(objAttr).forEach((attr) => { |
| | | let value = objAttr[attr]; |
| | | formData[attr] = value; |
| | | }); |
| | | } |
| | | //传入参数值 |
| | | if (formData) { |
| | | var attrlist = this.$data.classAttrList; |
| | | for (var i = 0; i < attrlist.length; i++) { |
| | | var attr = attrlist[i].Attr; |
| | | for (var j = 0; j < attr.length; j++) { |
| | | var ar = attr[j]; |
| | | ar.Value = formData[ar.Name] || "" |
| | | } |
| | | } |
| | | this.$data.classAttrList = attrlist; |
| | | } |
| | | }, |
| | | async viewParam() { //将mobox3小写参数转换为mobox2大写参数 |
| | | try { |
| | | var class_gridStyle = { |
| | | ID: this.$data.classGridStyle.id, |
| | | Name: this.$data.classGridStyle.name, |
| | |
| | | this.$data.classAttrList = class_attrList; |
| | | // console.log(this.$data.classGridStyle); |
| | | // console.log(this.$data.classAttrList); |
| | | this.class_attr_init(); |
| | | |
| | | await this.class_attr_init(); |
| | | } catch (ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys("error"), |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys("cancel") |
| | | }); |
| | | } |
| | | }, |
| | | class_attr_init() { |
| | | async class_attr_init() { |
| | | try { |
| | | var attrlist = this.$data.classGridStyle.StyleDef.show_style |
| | | var newattrlist = []; |
| | | if (this.$data.classAttrList.length > 0) { |
| | |
| | | } |
| | | } |
| | | } |
| | | await this.loadFormData(this.objAttr) |
| | | // console.log(req); |
| | | if (this.$data.edit_inital_event) { |
| | | var eventid = this.$data.edit_inital_event.scrip_id; |
| | |
| | | content: this.translate('no_find_attr_diaplay'), |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | } catch (ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys("error"), |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys("cancel") |
| | | }); |
| | | } |
| | | }, |
| | |
| | | } |
| | | this.DataObjRunCustomEvent_Return(before_click_button, data_attr, button_callback, index, |
| | | iindex); |
| | | }, |
| | | setFormValues(data) { |
| | | if (JSON.stringify(data) == '{}') { |
| | | return; |
| | | } |
| | | for (var a = 0; a < this.$data.classAttrList |
| | | .length; a++) { |
| | | for (var l = 0; l < this.$data |
| | | .classAttrList[a] |
| | | .Attr |
| | | .length; l++) { |
| | | var ca = this.$data.classAttrList[a] |
| | | .Attr[l]; |
| | | let curIndex = data.findIndex((attr) => { |
| | | return attr.attr == ca.Name; |
| | | }) |
| | | if (curIndex > -1) { |
| | | const attr = data[curIndex] |
| | | if (utils.classUtils |
| | | .attrTypeIsDict(ca |
| | | .Type)) { |
| | | var dictItemList = []; |
| | | for (var d in attr |
| | | .choice_list) { |
| | | var list_val = attr |
| | | .choice_list[d]; |
| | | dictItemList.push({ |
| | | "CN_S_NAME": list_val, |
| | | "Name": list_val, |
| | | "label": list_val, |
| | | "value": list_val |
| | | }); |
| | | |
| | | } |
| | | ca.dictitem = dictItemList; |
| | | // attr[j].dictitem = val[i].choice_list; |
| | | } else { |
| | | ca.Value = attr.value; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | for (var i = 0; i < value.length; i++) { |
| | | |
| | | var length = 0; |
| | | if (!this.$data.refdatastore.filter(function( |
| | | s) { |
| | | return data[i].attr == s.attr |
| | | }).length) { |
| | | length = 1; |
| | | this.$data.refdatastore.push(data[i]); |
| | | } |
| | | if (length == 0) { |
| | | for (var j = 0; j < this.$data.refdatastore |
| | | .length; j++) { |
| | | if (this.$data.refdatastore[j].attr == |
| | | data[i] |
| | | .attr) { |
| | | this.$data.refdatastore[j].value = |
| | | data[i] |
| | | .value; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | popupChange(e) { |
| | | console.log('当前模式:' + e.type + ',状态:' + e.show); |
| | |
| | | } |
| | | }); |
| | | }, |
| | | //确定 |
| | | sava() { |
| | | if (this.$data.edit_ok_event) |
| | | this.OKDataObjRunCustomEvent(); |
| | | else |
| | | this.add(); |
| | | getPostDataObjAttr() { |
| | | var req = []; |
| | | var attrlist = this.$data.classAttrList; |
| | | for (var i = 0; i < attrlist.length; i++) { |
| | | var attr = attrlist[i].Attr; |
| | | for (var j = 0; j < attr.length; j++) { |
| | | var ar = attr[j]; |
| | | if (ar.Value == this.translateSys("select") || ar.Value == '——' + this |
| | | .translateSys( |
| | | "select") + '——') ar.Value = ''; |
| | | req.push(this.formatAttr(ar)); |
| | | } |
| | | } |
| | | if (this.$data.refdatastore.length > 0) { |
| | | for (var i = 0; i < this.$data.refdatastore.length; i++) { |
| | | if (!req.filter(function(s) { |
| | | return this.$data.refdatastore[i].attr == s.name |
| | | }).length) { |
| | | length = 1; |
| | | req.push({ |
| | | 'attr': this.$data.refdatastore[i].attr, |
| | | 'val': this.$data.refdatastore[i].value |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | var obj_attr = {}; |
| | | req.forEach(item => { |
| | | obj_attr[item.attr] = item.value; |
| | | }); |
| | | return obj_attr |
| | | }, |
| | | add() { |
| | | //确定 |
| | | async ok() { |
| | | try { |
| | | uni.showLoading({ |
| | | title: this.translateSys("loading"), |
| | | mask: true |
| | | }); |
| | | this.okLoading = true |
| | | var obj_attr = this.getPostDataObjAttr(); |
| | | let ret = await this.sava(); |
| | | this.okLoading = false |
| | | uni.hideLoading(); |
| | | if (!ret) return; |
| | | obj_attr.id = this.objId; |
| | | const eventChannel = this.$scope.eventChannel; |
| | | // const eventChannel = this.getOpenerEventChannel(); |
| | | eventChannel.emit(this.type, obj_attr); |
| | | |
| | | uni.navigateBack() |
| | | } catch (ex) { |
| | | return false; |
| | | } |
| | | }, |
| | | //确定 |
| | | async sava() { |
| | | try { |
| | | if (this.param.objid) { |
| | | |
| | | // let ret = await this.OKDataObjRunCustomEvent(); |
| | | // if (!ret) return false; |
| | | if (this.$data.edit_ok_event) { // 点击确定按钮后 |
| | | ret = await this.OKDataObjRunCustomEvent(); |
| | | if (!ret) return false; |
| | | |
| | | } else { |
| | | ret = await this.update(); |
| | | if (!ret) return false; |
| | | } |
| | | |
| | | } else { |
| | | if (this.editMode) { |
| | | return true |
| | | } else { |
| | | // let ret = await this.OKDataObjRunCustomEvent(); |
| | | // if (!ret) return false; |
| | | if (this.$data.edit_ok_event) { // 点击确定按钮后 |
| | | ret = await this.OKDataObjRunCustomEvent(); |
| | | if (!ret) return false; |
| | | } else { |
| | | ret = await this.add(); |
| | | if (!ret) return false; |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } catch (ex) { |
| | | return false; |
| | | } |
| | | |
| | | }, |
| | | |
| | | // async sava() { |
| | | // try { |
| | | // if (this.$data.edit_ok_event) |
| | | // this.OKDataObjRunCustomEvent(); |
| | | // else |
| | | // this.add(); |
| | | // } catch (ex) { |
| | | // return false; |
| | | // } |
| | | // }, |
| | | async add() { |
| | | try { |
| | | var req = []; |
| | | var attrlist = this.$data.classAttrList; |
| | | for (var i = 0; i < attrlist.length; i++) { |
| | |
| | | req.forEach(item => { |
| | | obj_attr[item.name] = item.value; |
| | | }); |
| | | // console.log(obj_attr); |
| | | // var dataInfo={ |
| | | // class_id: this.$data.param.clsid, data_obj_id: '', masterclsid: '', |
| | | // req: JSON.stringify(req), upfile: JSON.stringify([]), post_data: JSON.stringify({}), |
| | | // compose: JSON.stringify([]), refdatastore: JSON.stringify([]), extinfo: JSON.stringify(enviroment), |
| | | // not_trigger_sys_event: '' |
| | | // }; |
| | | var dataInfo = { |
| | | class_id: this.$data.param.clsid, |
| | | class_name: '', |
| | |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.hideLoading(); |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys('tip'), |
| | | content: ex.errMsg, |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | } catch (ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 4.1", |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | }, |
| | | ini_DataObjRunCustomEvent(info) { |
| | | var param = { |
| | |
| | | var value = action.value; |
| | | if (action_type == 'set_dlg_attr') { |
| | | if (value) { |
| | | console.log(value); |
| | | for (var i = 0; i < value.length; i++) { |
| | | for (var a = 0; a < this.$data.classAttrList |
| | | .length; a++) { |
| | | for (var l = 0; l < this.$data |
| | | .classAttrList[a] |
| | | .Attr |
| | | .length; l++) { |
| | | var ca = this.$data.classAttrList[a] |
| | | .Attr[l]; |
| | | if (value[i].attr == ca.Name) { |
| | | if (utils.classUtils |
| | | .attrTypeIsDict(ca |
| | | .Type)) { |
| | | var dictItemList = []; |
| | | for (var d in value[i] |
| | | .choice_list) { |
| | | var list_val = value[i] |
| | | .choice_list[d]; |
| | | dictItemList.push({ |
| | | "CN_S_NAME": list_val, |
| | | "Name": list_val, |
| | | "label": list_val, |
| | | "value": list_val |
| | | }); |
| | | |
| | | } |
| | | ca.dictitem = dictItemList; |
| | | // attr[j].dictitem = val[i].choice_list; |
| | | } else { |
| | | ca.Value = value[i].value; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | var length = 0; |
| | | if (!this.$data.refdatastore.filter(function( |
| | | s) { |
| | | return value[i].attr == s.attr |
| | | }).length) { |
| | | length = 1; |
| | | this.$data.refdatastore.push(value[i]); |
| | | } |
| | | if (length == 0) { |
| | | for (var j = 0; j < this.$data.refdatastore |
| | | .length; j++) { |
| | | if (this.$data.refdatastore[j].attr == |
| | | value[i] |
| | | .attr) { |
| | | this.$data.refdatastore[j].value = |
| | | value[i] |
| | | .value; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.setFormValues(value) |
| | | } |
| | | } |
| | | if (action_type == 'open_select_userdlg') { |
| | |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 2.1", |
| | | content: ex.errMsg, |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | |
| | | 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.$data.classAttrList |
| | | .length; c++) { |
| | | var attr = $this.$data.classAttrList[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, |
| | | "Name": val, |
| | | "label": val, |
| | | "value": val |
| | | }); |
| | | } |
| | | attr[j].dictitem = dictItemList; |
| | | // attr[j].dictitem = result[i].choice_list; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | for (var c = 0; c < $this.$data.classAttrList |
| | | .length; c++) { |
| | | var attr = $this.$data.classAttrList[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; |
| | | } |
| | | } |
| | | } |
| | | var length = 0; |
| | | if (!$this.$data.refdatastore.filter(function(s) { |
| | | return result[i].attr == s.attr |
| | | }).length) { |
| | | length = 1; |
| | | $this.$data.refdatastore.push(result[i]); |
| | | } |
| | | if (length == 0) { |
| | | for (var j = 0; j < $this.$data.refdatastore |
| | | .length; j++) { |
| | | if ($this.$data.refdatastore[j].attr == result[ |
| | | i] |
| | | .attr) { |
| | | $this.$data.refdatastore[j].value = result[ |
| | | i] |
| | | .value; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | this.setFormValues(action.value) |
| | | } else if (data.action[i].action_type == 'set_global_attr') { |
| | | $this.$data.global_attr = data.action[i].value || []; |
| | | } |
| | |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 3.1", |
| | | content: ex.errMsg, |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | }, |
| | | OKDataObjRunCustomEvent() { |
| | | async OKDataObjRunCustomEvent() { |
| | | try { |
| | | var enviroment = { |
| | | 'function': '3000', // 功能点编号 |
| | | cls_id: this.$data.param.clsid, // 功能点主数据类标识 |
| | |
| | | robjid: '', |
| | | userlogin: '', |
| | | clsid: this.$data.param.clsid, |
| | | objid: "", |
| | | objid: this.$data.param.objid, |
| | | attr: req, |
| | | } |
| | | // var dataInfo = { |
| | | // edtype: info.edtype, eventid: info.eventid, projectid: info.projectid,rclsid: info.rclsid, |
| | | // robjid: info.robjid, userlogin: info.userlogin, clsid: info.clsid, objid: info.objid, |
| | | // attr: JSON.stringify(info.attr), extinfo: JSON.stringify(enviroment), global_attr: JSON.stringify(this.$data.global_attr) |
| | | // } |
| | | |
| | | enviroment = Base64.encode(JSON.stringify(enviroment)); //将字符串转换为base64编码 |
| | | var global_attr = Base64.encode(JSON.stringify(this.$data.global_attr)); //将字符串转换为base64编码 |
| | | var obj_attr = {}; |
| | |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 4.1", |
| | | content: ex.errMsg, |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | } catch (ex) { |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 4.1", |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | }, |
| | | DataObjRunCustomEvent_Return(eventid, data_attr, button_callback, index, iindex) { |
| | | var enviroment = { |
| | |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | let exStr = JSON.stringify(ex) |
| | | if (exStr == "{}") |
| | | exStr = ex |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : exStr |
| | | uni.showModal({ |
| | | title: this.translateSys('tip') + "5.1", |
| | | content: ex.errMsg, |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | |
| | | color: #fff; |
| | | font-size: 38rpx; |
| | | font-weight: bold; |
| | | float: right; |
| | | float: left; |
| | | display: inline-block; |
| | | } |
| | | |
| | |
| | | margin-top: 50rpx; |
| | | padding: 20rpx; |
| | | line-height: 1.5; |
| | | background: #27A6E1; |
| | | background: #fff; |
| | | border: none; |
| | | color: #fff; |
| | | color: #000; |
| | | font-size: 38rpx; |
| | | font-weight: bold; |
| | | float: left; |
| | | float: right; |
| | | display: inline-block; |
| | | } |
| | | |