| | |
| | | .result |
| | | .style_def); |
| | | } |
| | | $this.$data.head_styledef = ret.result.style_def ? JSON.parse(styledef) : {}; |
| | | // console.log($this.$data.head_styledef); |
| | | $this.head_styledef.form.items.forEach(async (ele, index) => { |
| | | ele.show = true; |
| | | if (ele.useDict == true) { //判断useDict是否使用字典 |
| | | await this.DictGetInfo(ele.bind.dict, index, 'mast'); |
| | | } |
| | | if ($this.focusFieldId == "") { |
| | | if (ele.name == 'Input' || ele.name == 'InputNumber' || ele.name == |
| | | 'Textarea') { |
| | | $this.setData({ |
| | | focusFieldId: ele.fieldId |
| | | }) |
| | | const styledefHead = styledef ? JSON.parse(styledef) : {}; |
| | | |
| | | styledefHead.form.items.forEach(async (ele) => { |
| | | if (ele.name != "Layout") { |
| | | if (ele?.useDict) { |
| | | //判断useDict是否使用字典 |
| | | await this.DictGetInfo(ele.bind.dict, |
| | | styledefHead.form.model, |
| | | ele); |
| | | } |
| | | if ($this.focusFieldId == "") { |
| | | if (ele.name == 'Input' || ele.name == |
| | | 'InputNumber') { |
| | | $this.setData({ |
| | | focusFieldId: ele.fieldId |
| | | }) |
| | | } |
| | | } |
| | | } else { |
| | | ele.setting.colList.forEach(async (col) => { |
| | | if (col?.useDict) { |
| | | //判断useDict是否使用字典 |
| | | await this.DictGetInfo(col.bind |
| | | .dict, |
| | | styledefHead.form |
| | | .model, col); |
| | | } |
| | | if ($this.focusFieldId == "") { |
| | | if (col.name == 'Input' || col |
| | | .name == |
| | | 'InputNumber') { |
| | | $this.setData({ |
| | | focusFieldId: col |
| | | .fieldId |
| | | }) |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | }); |
| | | this.setData({ |
| | | head_styledef: styledefHead |
| | | }) |
| | | if ($this.head_styledef.event?.length > 0) { |
| | | $this.head_styledef.event.forEach(async (a) => { //判断是否是初始化事件 |
| | | if (a.event_id == "initial") { |
| | |
| | | }); |
| | | |
| | | }, |
| | | async DictGetInfo(dict, index, type) { //Mobox3得到得到字典信息字典项列表 |
| | | async DictGetInfo(dict, formModel, formItem) { //Mobox3得到得到字典信息字典项列表 |
| | | this.data = []; |
| | | var $this = this; |
| | | var dataInfo = { |
| | |
| | | this.$store.dispatch('DictGetInfo', dataInfo).then(async (success) => { |
| | | console.log(success); |
| | | if (success.err_code == 0) { |
| | | if (type == 'mast') { |
| | | var list = []; |
| | | var itemName = ''; |
| | | success.result.dict_item_list.forEach((item) => { |
| | | if (item.is_default == '1') |
| | | itemName = item.name; |
| | | list.push({ |
| | | text: item.value, |
| | | value: item.name, |
| | | }); |
| | | |
| | | var list = []; |
| | | var itemName = ''; |
| | | success.result.dict_item_list.forEach((item) => { |
| | | if (item.is_default == '1') |
| | | itemName = item.name; |
| | | list.push({ |
| | | text: item.value, |
| | | value: item.name, |
| | | }); |
| | | //有默认值,显示默认值 |
| | | if (itemName) { |
| | | $this.head_styledef.form.items[index].value = itemName; |
| | | var attr = $this.head_styledef.form.items[index].fieldId; |
| | | $this.head_styledef.form.model[attr] = itemName; |
| | | } |
| | | $this.head_styledef.form.items[index].dict = list; |
| | | }); |
| | | //有默认值,显示默认值 |
| | | if (itemName) { |
| | | formItem.value = itemName; |
| | | formModel[formItem.fieldId] = itemName; |
| | | } |
| | | formItem.dict = list; |
| | | // $this.head_styledef.form.items[index].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); |
| | | } |
| | | |
| | | |
| | | } else { |
| | | uni.showModal({ |