| | |
| | | import Base64 from '../../components/js-base64/base64.js' |
| | | import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' |
| | | import utils from "@/js/utils.js" |
| | | import { |
| | | dictGetInfo, |
| | | dictItemGetInfo |
| | | } from "@/api/mobox.js" |
| | | import { |
| | | getUIStyleInfo, |
| | | classAttrGetList, |
| | | runCustomEvent, |
| | | dataObjCreate, |
| | | dataObjDel |
| | | } from "@/api/data.js" |
| | | export default { |
| | | name: "PageModalSmallWnd", |
| | | modules: { |
| | |
| | | this.loadData() |
| | | }, |
| | | 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() { |
| | | |
| | | |
| | |
| | | await this.loadAttrList(); |
| | | }, |
| | | async loadAttrList() { |
| | | |
| | | try { |
| | | var dataInfo = { |
| | | class_id: this.param.clsId, |
| | | class_name: this.param.clsName, |
| | | group_name: '' |
| | | }; |
| | | var $this = this; |
| | | this.$data.attrList == await classAttrGetList(dataInfo) || [] |
| | | |
| | | // console.log($this.$store.getters.getclassAttrList); |
| | | $this.$store.state.thisareaFuncID = this.param.clsId; |
| | | //获取 |
| | | if ($this.$store.getters.getclassAttrList) { |
| | | $this.$data.attrList = $this.$store.getters.getclassAttrList; |
| | | } else { |
| | | $this.$store.dispatch('classAttrGetList', dataInfo).then(success => { |
| | | // console.log(success); |
| | | if (success.err_code == 0) { |
| | | $this.$data.attrList = success.result; |
| | | } |
| | | }).catch(ex => { |
| | | } catch (ex) { |
| | | // console.log(ex); |
| | | let tip = typeof ex.errMsg == "string" ? ex.errMsg : ex |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.1", |
| | | content: ex.errMsg, |
| | | title: this.translateSys("error") + "1.1", |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }) |
| | | }) |
| | | confirmText: this.translateSys("cancel") |
| | | }); |
| | | } |
| | | }, |
| | | async DictItemGetList(attr, name) { //Mobox3得到字典项列表 |
| | | |
| | | try { |
| | | this.data = []; |
| | | var $this = this; |
| | | var dataInfo = { |
| | | dict_id: undefined, |
| | | dict_name: name |
| | | }; |
| | | this.$store.dispatch('DictItemGetList', dataInfo).then(async (success) => { |
| | | // console.log(success); |
| | | if (success.err_code == 0) { |
| | | |
| | | let dicList = success.result?.dict_item_list || []; |
| | | $this.dictList[attr.attr] = dicList; |
| | | const result = await dictItemGetInfo(dataInfo) |
| | | let dicList = result?.dict_item_list || []; |
| | | this.dictList[attr.attr] = dicList; |
| | | |
| | | let dictName = ""; |
| | | if (dicList?.length > 0) { |
| | |
| | | |
| | | } |
| | | this.form[attr.attr] = dictName; |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.2", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | |
| | | } catch (ex) { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.3", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | return [] |
| | | } |
| | | |
| | | |
| | | }, |
| | | async loadStyleDef() { |
| | | try { |
| | | var $this = this; |
| | | |
| | | var gridstyleInfo = {}; |
| | | if (param.editDlg.id) { |
| | | gridstyleInfo = { |
| | | class_id: $this.param.clsId, |
| | | class_id: this.param.clsId, |
| | | ui_style_id: this.param.editDlg.id, |
| | | }; |
| | | } else { |
| | | gridstyleInfo = { |
| | | class_id: $this.param.clsId, |
| | | ui_style_type: 2, |
| | | ui_style_name: $this.param.editDlg.name |
| | | ui_style_name: this.param.editDlg.name |
| | | }; |
| | | } |
| | | $this.$store.state.thisareaFuncID = this.param.clsId; |
| | | $this.$store.state.thisEditName = $this.$data.param.editDlg.name |
| | | // console.log($this.$store.getters.getclassGridStyleInfo); |
| | | //获取 |
| | | if ($this.$store.getters.getclassGridStyleInfo) { |
| | | $this.$data.style_def = $this.$store.getters.getclassGridStyleInfo; |
| | | } else { |
| | | // console.log(gridstyleInfo); |
| | | $this.$store.dispatch('UIStyleGetInfo', gridstyleInfo).then(async (success) => { |
| | | // console.log(success); |
| | | if (success.err_code == 0) { |
| | | var styledef = Base64.decode(success.result.style_def); |
| | | $this.$data.style_def = JSON.parse(styledef); |
| | | } else { |
| | | const result = await getUIStyleInfo(gridstyleInfo) |
| | | var styledef = Base64.decode(result?.style_def); |
| | | this.$data.style_def = JSON.parse(styledef); |
| | | } catch (ex) { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.4", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.5", |
| | | title: this.translateSys('error') + " 1.5, |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | return [] |
| | | } |
| | | }, |
| | | |
| | |
| | | }; |
| | | console.log(dataInfo); |
| | | // return |
| | | this.$store.dispatch('createDataObj', dataInfo).then(success => { |
| | | console.log(success); |
| | | dataObjCreate(dataInfo).then(result => { |
| | | console.log(result); |
| | | uni.hideLoading(); |
| | | if (success.err_code == 0) { |
| | | var result = success.result; |
| | | // if(result.result_type == 0){} |
| | | if (success.result.action) { |
| | | var action = JSON.parse(success.result.action); |
| | | if (result.action) { |
| | | var action = JSON.parse(result.action); |
| | | console.log(action); |
| | | if (action.ret == '0') { |
| | | if (action.ret != 0) { |
| | |
| | | "&titlename=" + this.$data.title |
| | | }); |
| | | // this.cancel(); |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " ", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.hideLoading(); |
| | |
| | | }; |
| | | console.log(dataInfo); |
| | | // return; |
| | | this.$store.dispatch('runCustomEvent', dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.err_code == 0) { |
| | | var data = success.result; |
| | | runCustomEvent(dataInfo).then(data => { |
| | | console.log(data); |
| | | if (data.ret != 0) { |
| | | var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : |
| | | data |
| | |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 2", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | |
| | | }; |
| | | console.log(dataInfo); |
| | | // return; |
| | | this.$store.dispatch('runCustomEvent', dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.err_code == 0) { |
| | | var data = success.result; |
| | | runCustomEvent(dataInfo).then(data => { |
| | | console.log(data); |
| | | if (data.ret != 0) { |
| | | var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : |
| | | data |
| | |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 3", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | |
| | | }; |
| | | console.log(dataInfo); |
| | | // return; |
| | | this.$store.dispatch('runCustomEvent', dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.err_code == 0) { |
| | | var data = success.result; |
| | | runCustomEvent(dataInfo).then(data => { |
| | | console.log(data); |
| | | if (data.ret != 0) { |
| | | var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : |
| | | data |
| | |
| | | |
| | | this.add(); |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 4", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | |
| | | }; |
| | | console.log(dataInfo); |
| | | // return; |
| | | this.$store.dispatch('runCustomEvent', dataInfo).then(success => { |
| | | console.log(success); |
| | | if (success.err_code == 0) { |
| | | var data = success.result; |
| | | runCustomEvent(dataInfo).then(data => { |
| | | console.log(data); |
| | | |
| | | if (data.ret != 0) { |
| | | var tip = data.err_info ? typeof data.err_info == 'string' ? data.err_info : |
| | | data |
| | |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 5", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |