| | |
| | | <div class="panel_title">{{param.Sub_Cls.Title}}</div> |
| | | <!-- 从数据扫码区 --> |
| | | <view class="v-area class_attr_body" v-if="param.Sub_Cls.Can_Add_Delete == true"> |
| | | <h4 style="margin: 15rpx 0 0 30rpx;font-weight: bold;">{{`${translateSys('add2')}'${param.Sub_Cls.Name}'` }}</h4> |
| | | <h4 style="margin: 15rpx 0 0 30rpx;font-weight: bold;"> |
| | | {{`${translateSys('add2')}'${param.Sub_Cls.Name}'` }} |
| | | </h4> |
| | | <view class="form-group"> |
| | | <!-- 左右布局 --> |
| | | <p class="tx_title2">{{param.Scan_Code.Name}}:</p> |
| | |
| | | import Base64 from '../../components/js-base64/base64.js' |
| | | import pickerAddress from '../../js/pickerAddress/pickerAddress.vue' |
| | | import utils from "@/js/utils.js" |
| | | import { |
| | | appGetInfo, |
| | | dictGetInfo, |
| | | dictItemGetInfo |
| | | } from "@/api/mobox.js" |
| | | import { |
| | | getUIStyleInfo, |
| | | runCustomEvent, |
| | | dataObjCreate, |
| | | dataObjDel |
| | | } from "@/api/data.js" |
| | | import { |
| | | classAttrList, |
| | | } from "@/api/index.js" |
| | | |
| | | |
| | | export default { |
| | | modules: { |
| | | Base64, |
| | |
| | | // 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; |
| | | $this.classGridStyleInfo(param.Master_Cls.ID, $this.$data.param.Master_Cls.View_Style.Name, 'Mast'); |
| | | } else { |
| | | $this.$store.dispatch('classAttrGetList', dataInfo).then(success => { |
| | | // console.log(success); |
| | | if (success.err_code == 0) { |
| | | $this.$data.classAttrList = success.result; |
| | | success.result.forEach(async (group, index) => { |
| | | group.attr_list.forEach(async (attr, key) => { |
| | | if (utils.classUtils.attrTypeIsDict(attr.type)) |
| | | // if (attr.type == "字典-字符串" || attr.type == "字典-整数" ||attr.type == "dict-char" || attr.type == "dict-int") |
| | | { |
| | | await $this.DictItemGetList(attr, key, index, 'mast'); |
| | | } |
| | | }); |
| | | }); |
| | | setTimeout(function() { |
| | | $this.classGridStyleInfo(param.Master_Cls.ID, $this.$data.param.Master_Cls |
| | | .View_Style.Name, 'Mast'); |
| | | }, 500); |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.1", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | } |
| | | this.loadData() |
| | | |
| | | //从数据类获取 |
| | | 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; |
| | | $this.classGridStyleInfo(param.Sub_Cls.ID, $this.$data.param.Sub_Cls.View_Style.Name, 'Sub'); |
| | | } else { |
| | | $this.$store.dispatch('subClassAttrGetList', subdataInfo).then(success => { |
| | | // console.log(success); |
| | | if (success.err_code == 0) { |
| | | $this.$data.subClassAttrList = success.result; |
| | | success.result.forEach(async (group, index) => { |
| | | group.attr_list.forEach(async (attr, key) => { |
| | | if (utils.classUtils.attrTypeIsDict(attr.type)) { |
| | | //if (attr.type == "字典-字符串" || attr.type == "字典-整数" ||attr.type == "dict-char" || attr.type == "dict-int"){ |
| | | await $this.DictItemGetList(attr, key, index, 'sub'); |
| | | } |
| | | }); |
| | | }); |
| | | setTimeout(function() { |
| | | $this.classGridStyleInfo(param.Sub_Cls.ID, $this.$data.param.Sub_Cls.View_Style |
| | | .Name, 'Sub'); |
| | | }, 500); |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1_1", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1_1.1", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | } |
| | | }, |
| | | methods: { |
| | | async DictItemGetList(attr, key, index, type) { //Mobox3得到字典项列表 |
| | | 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() { |
| | | //主数据类获取 |
| | | 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.viewParam('Mast'); |
| | | this.$data.classAttrList = await this.classAttrGetList(param.Sub_Cls?.ID) |
| | | this.$data.classGridStyle = await this.classGridStyleInfo(param.Sub_Cls?.ID, param.Sub_Cls?.View_Style |
| | | ?.Name) |
| | | this.viewParam('Sub'); |
| | | }, |
| | | async DictItemGetList(attr) { //Mobox3得到字典项列表 |
| | | try { |
| | | this.data = []; |
| | | var $this = this; |
| | | var dataInfo = { |
| | | dict_id: attr.dict_id, |
| | | dict_name: attr.dict_name |
| | | }; |
| | | // console.log(dataInfo); |
| | | this.$store.dispatch('DictItemGetList', dataInfo).then(async (success) => { |
| | | // console.log(success); |
| | | if (success.err_code == 0) { |
| | | if (type == 'mast') { |
| | | $this.$data.classAttrList[index].attr_list[key].dictitem = success.result; |
| | | this.$store.commit("classAttrList", $this.$data.classAttrList); |
| | | } else { |
| | | $this.$data.subClassAttrList[index].attr_list[key].dictitem = success.result; |
| | | this.$store.commit("subClassAttrList", $this.$data.subClassAttrList); |
| | | } |
| | | const result = await dictItemGetInfo(dataInfo) |
| | | return result?.dict_item_list || [] |
| | | |
| | | } else { |
| | | } catch (ex) { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.2", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.3", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | return [] |
| | | } |
| | | |
| | | }, |
| | | async classGridStyleInfo(clsid, styleName, clsType) { |
| | | async classAttrGetList(clsid) { |
| | | try { |
| | | |
| | | var $this = this; |
| | | var dataInfo = { |
| | | class_id: clsid, |
| | | }; |
| | | const result = await classAttrList(dataInfo) || [] |
| | | for (let index in result) { |
| | | const group = result[index] |
| | | for (let key in group.attr_list) { |
| | | const attr = group.attr_list[key] |
| | | if (utils.classUtils.attrTypeIsDict(attr.type)) { |
| | | attr.dictitem = await $this.DictItemGetList(attr); |
| | | } |
| | | } |
| | | } |
| | | 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, |
| | | ui_style_type: 2, |
| | | ui_style_name: styleName |
| | | }; |
| | | // 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; |
| | | $this.viewParam('Mast'); |
| | | } else { |
| | | //console.log(gridstyleInfo); |
| | | $this.$store.dispatch('UIStyleGetInfo', gridstyleInfo).then(success => { |
| | | // console.log(success); |
| | | if (success.err_code == 0) { |
| | | var styledef = Base64.decode(success.result.style_def); |
| | | success.result.style_def = JSON.parse(styledef); |
| | | $this.$data.classGridStyle = success.result; |
| | | // console.log($this.$data.classGridStyle); |
| | | const result = await getUIStyleInfo(gridstyleInfo) |
| | | var styledef = Base64.decode(result.style_def || ""); |
| | | result.style_def = JSON.parse(styledef); |
| | | return result |
| | | |
| | | $this.viewParam('Mast'); |
| | | } 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: this.translateSys('error') + " 1.2", |
| | | content: success.err_msg, |
| | | title: this.translateSys("error") + " 1.2", |
| | | content: tip, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | confirmText: this.translateSys("cancel") |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.3", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | } |
| | | } else if (clsType == 'Sub') { //获取从数据类界面样式 |
| | | $this.$store.state.thisEditSubName = styleName; |
| | | if ($this.$store.getters.getSubClassGridStyleInfo) { |
| | | $this.$data.subClassGridStyle = $this.$store.getters.getSubClassGridStyleInfo; |
| | | $this.viewParam('Sub'); |
| | | } else { |
| | | //console.log(gridstyleInfo); |
| | | $this.$store.dispatch('UIStyleGetInfo', gridstyleInfo).then(success => { |
| | | // console.log(success); |
| | | if (success.err_code == 0) { |
| | | var styledef = Base64.decode(success.result.style_def); |
| | | success.result.style_def = JSON.parse(styledef); |
| | | $this.$data.subClassGridStyle = success.result; |
| | | // console.log($this.$data.subClassGridStyle); |
| | | |
| | | $this.viewParam('Sub'); |
| | | |
| | | // $this.subClass_attr_init(); |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.2", |
| | | content: success.err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 1.3", |
| | | content: ex.errMsg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | return {} |
| | | }; |
| | | }, |
| | | viewParam(type) { //将mobox3小写参数转换为mobox2大写参数 |
| | | var classGridStyle = ''; |
| | |
| | | } |
| | | } |
| | | } |
| | | if (utils.classUtils.attrTypeIsDateTime(ca.Type)) //if(ca.Type=='日期' || ca.Type=='时间') |
| | | if (utils.classUtils.attrTypeIsDateTime(ca |
| | | .Type)) //if(ca.Type=='日期' || ca.Type=='时间') |
| | | { |
| | | var nowDate = new Date(); |
| | | var date = { |
| | |
| | | uni.showLoading({ |
| | | title: "加载中..." |
| | | }); |
| | | this.$store.dispatch('dataObjDel', dataInfo).then(success => { |
| | | dataObjDel(dataInfo).then(success => { |
| | | // console.log(success); |
| | | uni.hideLoading(); |
| | | if (ret.err_code == 0) { |
| | | $this.$data.subPanelList.splice(index, 1); |
| | | uni.showModal({ |
| | | title: this.translateSys('tip') + "", |
| | |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 9", |
| | | content: success.msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | console.log(ex); |
| | | uni.hideLoading(); |
| | |
| | | }; |
| | | 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 (success.result |
| | | .action) { |
| | | var action = JSON |
| | |
| | | .title |
| | | }); |
| | | // this.class_attr_init(); |
| | | } 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 ? |
| | |
| | | } |
| | | } |
| | | } |
| | | } 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 ? |
| | |
| | | } |
| | | } |
| | | } |
| | | } 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 ? |
| | |
| | | |
| | | 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 ? |
| | |
| | | }); |
| | | } |
| | | } |
| | | } 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({ |
| | |
| | | }; |
| | | 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 ? |
| | |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 6", |
| | | 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 ? |
| | |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 7", |
| | | 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); |
| | | runCustomEvent(dataInfo).then(data => { |
| | | console.log(data); |
| | | uni.hideLoading(); |
| | | if (success.err_code == 0) { |
| | | var data = success.result; |
| | | if (data.ret != 0) { |
| | | var tip = data |
| | | .err_info ? |
| | |
| | | }); |
| | | } |
| | | } |
| | | } else { |
| | | uni.showModal({ |
| | | title: this.translateSys('error') + " 8", |
| | | content: success |
| | | .err_msg, |
| | | showCancel: false, |
| | | confirmText: this.translateSys('cancel') |
| | | }); |
| | | } |
| | | |
| | | }).catch(ex => { |
| | | // console.log(ex); |
| | | uni.hideLoading(); |