| | |
| | | <script> |
| | | import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' |
| | | import utils from "@/js/utils.js" |
| | | import { |
| | | classAttrList, |
| | | classGridStyleInfo, |
| | | dataObjAdd, |
| | | dataObjDelele, |
| | | dataObjRunCustomEvent |
| | | } from "@/api/index.js" |
| | | |
| | | export default { |
| | | components: { |
| | | pickerAddress |
| | |
| | | // Model: param.EditDlgMode, |
| | | // Name: param.Master_Cls.View_Style.Name |
| | | // } |
| | | //主数据类获取 |
| | | var dataInfo = { |
| | | class_id: param.Master_Cls.ID |
| | | }; |
| | | var $this = this; |
| | | $this.$store.state.thisareaFuncID = param.Master_Cls.ID; |
| | | // console.log($this.$store.getters.getclassAttrList); |
| | | if ($this.$store.getters.getclassAttrList) { |
| | | $this.$data.classAttrList = $this.$store.getters.getclassAttrList.data; |
| | | $this.classGridStyleInfo(param.Master_Cls.ID, $this.$data.param.Master_Cls.View_Style.Name, 'Mast'); |
| | | } else { |
| | | $this.$store.dispatch('classAttrList', dataInfo).then(success => { |
| | | // console.log(success); |
| | | if (success.code == '00000') { |
| | | $this.$data.classAttrList = success.data; |
| | | this.loadData() |
| | | |
| | | $this.classGridStyleInfo(param.Master_Cls.ID, $this.$data.param.Master_Cls.View_Style.Name, |
| | | 'Mast'); |
| | | }, |
| | | methods: { |
| | | setData(obj) { |
| | | let that = this; |
| | | let keys = []; |
| | | let val, data; |
| | | |
| | | Object.keys(obj).forEach(function(key) { |
| | | keys = key.split("."); |
| | | val = obj[key]; |
| | | data = that.$data; |
| | | keys.forEach(function(key2, index) { |
| | | if (index + 1 == keys.length) { |
| | | that.$set(data, key2, val); |
| | | } else { |
| | | if (!data[key2]) { |
| | | that.$set(data, key2, {}); |
| | | } |
| | | } |
| | | data = data[key2]; |
| | | }); |
| | | }); |
| | | }, |
| | | async loadData() { |
| | | try { |
| | | const param = this.param |
| | | |
| | | this.$data.classAttrList = await this.classAttrGetList(param.Master_Cls?.ID) |
| | | this.$data.classGridStyle = await this.classGridStyleInfo(param.Master_Cls?.ID, param.Master_Cls |
| | | ?.View_Style?.Name) |
| | | this.class_attr_init(); |
| | | |
| | | |
| | | this.$data.subClassAttrList = await this.classAttrGetList(param.Sub_Cls?.ID) |
| | | this.$data.subClassGridStyle = await this.classGridStyleInfo(param.Sub_Cls?.ID, param.Sub_Cls |
| | | ?.View_Style |
| | | ?.Name) |
| | | this.subClass_attr_init(); |
| | | |
| | | } catch (ex) { |
| | | uni.showModal({ |
| | | title: "错误1", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | | title: "错误1.1", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | }); |
| | | } |
| | | |
| | | //从数据类获取 |
| | | var subdataInfo = { |
| | | class_id: param.Sub_Cls.ID |
| | | }; |
| | | $this.$store.state.thisareaFuncSubID = param.Sub_Cls.ID; |
| | | if ($this.$store.getters.getSubClassAttrList) { |
| | | $this.$data.subClassAttrList = $this.$store.getters.getSubClassAttrList.data; |
| | | $this.classGridStyleInfo(param.Sub_Cls.ID, $this.$data.param.Sub_Cls.View_Style.Name, 'Sub'); |
| | | } else { |
| | | $this.$store.dispatch('subClassAttrList', subdataInfo).then(success => { |
| | | // console.log(success); |
| | | if (success.code == '00000') { |
| | | $this.$data.subClassAttrList = success.data; |
| | | |
| | | $this.classGridStyleInfo(param.Sub_Cls.ID, $this.$data.param.Sub_Cls.View_Style.Name, |
| | | 'Sub'); |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误1_1", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | | title: "错误1_1.1", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | methods: { |
| | | scan_classAttr_extButton(e) { //选择按钮前 |
| | | var $this = this; |
| | | var Before_Select_Event = $this.$data.param.Scan_Code.Before_Select_Event; |
| | |
| | | uni.showLoading({ |
| | | title: "加载中..." |
| | | }); |
| | | this.$store.dispatch('DelObj', dataInfo).then(success => { |
| | | console.log(success); |
| | | dataObjDelele(dataInfo).then(success => { |
| | | uni.hideLoading(); |
| | | if (success.code == '00000') { |
| | | $this.$data.subPanelList.splice(index, 1); |
| | | uni.showModal({ |
| | | title: "提示", |
| | |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误9", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.hideLoading(); |
| | |
| | | }); |
| | | } |
| | | }, |
| | | async classGridStyleInfo(clsid, styleName, clsType) { |
| | | async classAttrGetList(clsid) { |
| | | try { |
| | | |
| | | var $this = this; |
| | | var dataInfo = { |
| | | class_id: clsid, |
| | | }; |
| | | const result = await classAttrList(dataInfo) || [] |
| | | return result |
| | | } 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.1", |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys("cancel") |
| | | }); |
| | | return [] |
| | | }; |
| | | }, |
| | | |
| | | async classGridStyleInfo(clsid, styleName) { |
| | | try { |
| | | |
| | | var $this = this; |
| | | var gridstyleInfo = { |
| | | class_id: clsid, |
| | | name: styleName, |
| | | type: '2' |
| | | }; |
| | | // console.log($this.$store.getters.getclassGridStyleInfo); |
| | | //获取主数据类界面样式 |
| | | if (clsType == 'Mast') { |
| | | $this.$store.state.thisEditName = styleName; |
| | | if ($this.$store.getters.getclassGridStyleInfo) { |
| | | $this.$data.classGridStyle = $this.$store.getters.getclassGridStyleInfo.data; |
| | | $this.class_attr_init(); |
| | | } else { |
| | | //console.log(gridstyleInfo); |
| | | $this.$store.dispatch('classGridStyleInfo', gridstyleInfo).then(success => { |
| | | // console.log(success); |
| | | const result = await classGridStyleInfo(gridstyleInfo) |
| | | result.style_def = JSON.parse(styledef); |
| | | return result |
| | | |
| | | if (success.code == '00000') { |
| | | |
| | | success.data.StyleDef = JSON.parse(success.data.StyleDef); |
| | | $this.$data.classGridStyle = success.data; |
| | | |
| | | $this.class_attr_init(); |
| | | |
| | | |
| | | } else { |
| | | } 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: "错误1.2", |
| | | content: success.msg, |
| | | title: this.translateSys("error") + " 1.2", |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | confirmText: this.translateSys("cancel") |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.showModal({ |
| | | title: "错误1.3", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | }); |
| | | } |
| | | } else if (clsType == 'Sub') { //获取从数据类界面样式 |
| | | $this.$store.state.thisEditSubName = styleName; |
| | | if ($this.$store.getters.getSubClassGridStyleInfo) { |
| | | $this.$data.subClassGridStyle = $this.$store.getters.getSubClassGridStyleInfo.data; |
| | | $this.subClass_attr_init(); |
| | | } else { |
| | | //console.log(gridstyleInfo); |
| | | |
| | | $this.$store.dispatch('subClassGridStyleInfo', gridstyleInfo).then(success => { |
| | | // console.log(success); |
| | | if (success.code == '00000') { |
| | | |
| | | success.data.StyleDef = JSON.parse(success.data.StyleDef); |
| | | $this.$data.subClassGridStyle = success.data; |
| | | |
| | | $this.subClass_attr_init(); |
| | | |
| | | |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误1.2", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.showModal({ |
| | | title: "错误1.3", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | return {} |
| | | }; |
| | | }, |
| | | |
| | | |
| | | ontap(e) { //扫码功能 |
| | | //console.log(e.target) |
| | | getApp().onScan((result) => { |
| | |
| | | |
| | | // return |
| | | console.log(dataInfo); |
| | | this.$store.dispatch('addclassattr', dataInfo).then(success => { |
| | | console.log(success); |
| | | dataObjAdd(dataInfo).then(data => { |
| | | console.log(data); |
| | | uni.hideLoading(); |
| | | if (success.code == '00000') { |
| | | var action = JSON.parse(success.data.Action); |
| | | var action = JSON.parse(data.Action); |
| | | if (action.ret == '0') { |
| | | if (action.result_type == '0') { |
| | | uni.showToast({ |
| | |
| | | // "&titlename=" + this.$data.title |
| | | // }); |
| | | // // this.class_attr_init(); |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.hideLoading(); |
| | |
| | | global_attr: global_attr |
| | | } |
| | | console.log(dataInfo); |
| | | this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | dataObjRunCustomEvent(dataInfo).then(success => { |
| | | var data = JSON.parse(success); |
| | | var actionlist = data.action; |
| | | if (actionlist) { |
| | | for (var j = 0; j < actionlist.length; j++) { |
| | |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误2", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | |
| | | global_attr: JSON.stringify(this.$data.global_attr) |
| | | } |
| | | console.log(dataInfo); |
| | | this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { |
| | | dataObjRunCustomEvent(dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | var data = JSON.parse(success); |
| | | var actionlist = data.action; |
| | | |
| | | if (actionlist) { |
| | |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误3", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | |
| | | global_attr: JSON.stringify(this.$data.global_attr) |
| | | } |
| | | console.log(dataInfo); |
| | | this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { |
| | | dataObjRunCustomEvent(dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | var data = JSON.parse(success); |
| | | var result = data.result; |
| | | for (var i = 0; i < result.length; i++) { |
| | | // self.class_attr_ele.find('.attr_field[data-field="' + result[i].attr + '"]').val(result[i].value).data('val', result[i].value); |
| | |
| | | } |
| | | |
| | | this.add(); |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误4", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | |
| | | global_attr: JSON.stringify(this.$data.global_attr) |
| | | } |
| | | console.log(dataInfo); |
| | | this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { |
| | | dataObjRunCustomEvent(dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | var data = JSON.parse(success); |
| | | if (data != "") { |
| | | |
| | | var actions = data.action; |
| | |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误5", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | |
| | | global_attr: global_attr |
| | | } |
| | | console.log(dataInfo); |
| | | this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { |
| | | dataObjRunCustomEvent(dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | var data = JSON.parse(success); |
| | | var actionlist = data.action; |
| | | if (actionlist) { |
| | | for (var j = 0; j < actionlist.length; j++) { |
| | |
| | | } |
| | | } |
| | | |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误6", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | |
| | | global_attr: JSON.stringify(global_attr) |
| | | } |
| | | console.log(dataInfo); |
| | | this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { |
| | | dataObjRunCustomEvent(dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | var data = JSON.parse(success); |
| | | var actionlist = data.action; |
| | | |
| | | if (actionlist) { |
| | |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误7", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | |
| | | } |
| | | // console.log(JSON.stringify(dataInfo)); |
| | | console.log(dataInfo); |
| | | this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { |
| | | dataObjRunCustomEvent(dataInfo).then(success => { |
| | | console.log(success); |
| | | uni.hideLoading(); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | var data = JSON.parse(success); |
| | | var result = data.result; |
| | | if (eventID != $this.$data.param.After_OK_Event.ID) |
| | | $this.scan_OKDataObjRunCustomEvent($this.$data.param.After_OK_Event.ID); |
| | |
| | | // "&titlename=" + $this.$data.title |
| | | // }); |
| | | // } |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误8", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.hideLoading(); |
| | |
| | | } |
| | | // console.log(JSON.stringify(dataInfo)); |
| | | console.log(dataInfo); |
| | | this.$store.dispatch('DataObjRunCustomEventInfo', dataInfo).then(success => { |
| | | dataObjRunCustomEvent(dataInfo).then(success => { |
| | | console.log(success); |
| | | uni.hideLoading(); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | var data = JSON.parse(success); |
| | | var result = data.result; |
| | | if (eventID != $this.$data.param.After_Trigger_Event.ID) |
| | | $this.scan_TriggerDataObjRunCustomEvent($this.$data.param.After_Trigger_Event.ID); |
| | |
| | | // "&titlename=" + $this.$data.title |
| | | // }); |
| | | // } |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误8", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.hideLoading(); |