| | |
| | | <script> |
| | | import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' |
| | | import utils from "@/js/utils.js" |
| | | import { |
| | | classAttrList, |
| | | classGridStyleInfo, |
| | | dataObjAdd, |
| | | dataObjRunCustomEvent |
| | | } from "@/api/index.js" |
| | | |
| | | export default { |
| | | components: { |
| | | pickerAddress |
| | |
| | | this.loadData() |
| | | }, |
| | | methods: { |
| | | loadData() { |
| | | var $this = this; |
| | | 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 { |
| | | var edit_dlg = { |
| | | Model: $this.param.EditDlgMode, |
| | | Name: $this.param.Edit_dlg.Name |
| | | Model: this.param.EditDlgMode, |
| | | Name: this.param.Edit_dlg.Name |
| | | } |
| | | var dataInfo = { |
| | | class_id: $this.param.clsid |
| | | class_id: this.param.clsid |
| | | }; |
| | | $this.$store.state.thisareaFuncID = $this.param.clsid; |
| | | // console.log($this.$store.getters.getclassAttrList); |
| | | //获取 |
| | | if ($this.$store.getters.getclassAttrList) { |
| | | $this.$data.classAttrList = $this.$store.getters.getclassAttrList.data; |
| | | $this.classGridStyleInfo(); |
| | | } else { |
| | | $this.$store.dispatch('classAttrList', dataInfo).then(success => { |
| | | // console.log(success); |
| | | if (success.code == '00000') { |
| | | $this.$data.classAttrList = success.data; |
| | | this.$data.classAttrList = await classAttrList(dataInfo) || [] |
| | | |
| | | $this.classGridStyleInfo(); |
| | | } else { |
| | | var gridstyleInfo = { |
| | | class_id: this.param.clsid, |
| | | name: this.param.Edit_dlg.Name, |
| | | type: '2' |
| | | }; |
| | | |
| | | const res = await classGridStyleInfo(gridstyleInfo) |
| | | res.StyleDef = JSON.parse(res.StyleDef); |
| | | this.$data.classGridStyle = res; |
| | | // console.log($this.$data.classGridStyle); |
| | | this.class_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: "取消" |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | |
| | | uni.navigateBack({ |
| | | delta: 1 //返回层数,2则上上页 |
| | | }); |
| | | }, |
| | | async classGridStyleInfo() { |
| | | var $this = this; |
| | | var gridstyleInfo = { |
| | | class_id: $this.$data.param.clsid, |
| | | name: $this.$data.param.Edit_dlg.Name, |
| | | type: '2' |
| | | }; |
| | | $this.$store.state.thisEditName = $this.$data.param.Edit_dlg.Name |
| | | // console.log($this.$store.getters.getclassGridStyleInfo); |
| | | //获取 |
| | | 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); |
| | | |
| | | if (success.code == '00000') { |
| | | |
| | | success.data.StyleDef = JSON.parse(success.data.StyleDef); |
| | | $this.$data.classGridStyle = success.data; |
| | | // console.log($this.$data.classGridStyle); |
| | | |
| | | $this.class_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: "取消" |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | ontap(e) { //扫码功能 |
| | | var $ele = e; |
| | |
| | | |
| | | console.log(dataInfo); |
| | | // return |
| | | this.$store.dispatch('addclassattr', dataInfo).then(success => { |
| | | console.log(success); |
| | | dataObjAdd(dataInfo).then(data => { |
| | | console.log(data); |
| | | uni.hideLoading(); |
| | | if (success.code == '00000') { |
| | | if (success.data.Action) { |
| | | var action = JSON.parse(success.data.Action); |
| | | if (data.Action) { |
| | | var action = JSON.parse(data.Action); |
| | | console.log(action); |
| | | if (action.ret == '0') { |
| | | if (action.ret != 0) { |
| | |
| | | }); |
| | | |
| | | // 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(data => { |
| | | data = JSON.parse(data); |
| | | 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({ |
| | |
| | | } |
| | | 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(data => { |
| | | data = JSON.parse(data); |
| | | 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 => { |
| | | console.log(success); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | dataObjRunCustomEvent(dataInfo).then(data => { |
| | | data = JSON.parse(data); |
| | | 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 => { |
| | | console.log(success); |
| | | if (success.code == '00000') { |
| | | var data = JSON.parse(success.data); |
| | | dataObjRunCustomEvent(dataInfo).then(data => { |
| | | data = JSON.parse(data) |
| | | console.log(data); |
| | | if (data != "") { |
| | | |
| | | var actions = data.action; |
| | | console.log(actions); |
| | | if (actions) { |
| | |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: "错误5", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: "取消" |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |