cuiqian2004
2025-03-03 15dcf7158d4c5d66d4b196e4e0b2030e1070d448
pages/modal/5601.vue
@@ -7,7 +7,7 @@
            <uni-forms-item v-if="item.name != 'Layout'" :label="item.label ?item.label +':':'' "
               :label-width="item.labelWidth+'px'">
               <uni-data-picker v-if="item.name=='Select'" :class="item.disabled?'input-disabled':''"
                  v-model="item.value" :localdata="item.dict" @change="onEnterChange(item)"
                  v-model="item.value" :localdata="item.useDict ? item.dict : item.selections" @change="onEnterChange(item)"
                  :readonly="item.disabled" :clear-icon="false" :popup-title="item.label"></uni-data-picker>
               <view class="input-wrapper" v-if="item.name=='Input' || item.name=='InputNumber'">
                  <text v-if="item.setting.prefix" class="uni-icon" :class="[item.setting.prefix]"
@@ -48,9 +48,9 @@
               <uni-col
                  :span=" item.setting.spanList && item.setting.spanList[key]? item.setting.spanList[key] : 24 / item.setting.col"
                  v-for="(col,key) in item.setting.colList">
                  <uni-forms-item :label="col.label ? col.label +':':''" :label-width="col.labelWidth+'px'">
                  <uni-forms-item v-if="col!=null" :label="col.label ? col.label +':':''" :label-width="col.labelWidth+'px'">
                     <uni-data-picker v-if="col.name=='Select'" :class="col.disabled?'input-disabled':''"
                        v-model="col.value" :localdata="col.dict" @change="onEnterChange(col)"
                        v-model="col.value" :localdata="col.useDict ? col.dict : col.selections" @change="onEnterChange(col)"
                        :readonly="col.disabled" :clear-icon="false" :popup-title="col.label"></uni-data-picker>
                     <view class="input-wrapper" v-if="col.name=='Input' || col.name=='InputNumber'">
                        <text v-if="col.setting.prefix" class="uni-icon" :class="[col.setting.prefix]"
@@ -536,7 +536,8 @@
                                 styledefHead.form
                                    .model[ele.fieldId] = itemName;
                              }
                              ele.dict = selections.map((a) => {
                              ele.selections = selections.map((a) => {
                                 return {
                                    value: a.value,
                                    text: a.label
@@ -573,7 +574,7 @@
                                    styledefHead.form
                                       .model[col.fieldId] = itemName;
                                 }
                                 col.dict = selections.map((a) => {
                                 col.selections = selections.map((a) => {
                                    return {
                                       value: a.value,
                                       text: a.label
@@ -645,6 +646,13 @@
                              detailstyledef.form
                              .model, ele);
                        }
                        else
                        {
                           if (ele?.name === "Select") {
                              ele.selections =[]
                           }
                        }
                     } else {
                        for (let j in ele.setting.colList) {
                           const col = ele.setting.colList[j]
@@ -653,6 +661,12 @@
                                 .bind.dict,
                                 detailstyledef.form
                                 .model, col);
                           }
                           else
                           {
                              if (col?.name === "Select") {
                                 col.selections =[]
                              }
                           }
                        }
                     }
@@ -905,7 +919,7 @@
            // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
            this.$refs.popup.open(this.popupType);
            this.dataObjRunCustomEvent_Return(onSuffixClickCallbackEvent.id, '', onSuffixClickEvent.id,
            this.dataObjRunCustomEvent_Return(onSuffixClickEvent.id, '', onSuffixClickCallbackEvent.id,
               item);
         },
@@ -1029,7 +1043,6 @@
                  };
                  runCustomEvent(dataInfo).then(result => {
                     console.log(result);
                     if (result.ret != 0) {
                        var tip = result.err_info ? typeof result
                           .err_info == 'string' ? result
@@ -1718,109 +1731,74 @@
            }
         },
         setFormValues(data) {
         setFormValues(attrs) {
            const head_styledef = this.head_styledef
            if (JSON.stringify(data) == '{}') {
            if (JSON.stringify(attrs) == '{}') {
               return;
            }
            head_styledef.form.items.forEach(async (ele, index) => {
               if (ele.name != "Layout") {
                  let curIndex = data.findIndex((attr, index2, arr) => {
                     return attr.attr == ele.fieldId;
                  })
                  if (curIndex > -1) {
                     const attr = data[curIndex]
                     if (ele.name ==
                        'Select' &&
                        attr
                        .choice_list
                     ) {
                        const
                           dictItemList = [];
                        const
                           choiceList =
                           attr
                           .choice_list || [];
                        for (let d in
                              choiceList) {
                           const
                              val =
                              choiceList[
                                 d
                              ];
                           dictItemList
                              .push({
                                 text: val,
                                 value: val
                              });
            console.log(attrs)
            attrs.forEach(async (attr, key) => {
               if (attr.choice_list) {
                  var dictItemList = [];
                  attr.choice_list.forEach(async (val, index) => {
                     dictItemList.push({
                        text: val,
                        value: val
                     });
                  });
                  head_styledef.form.items.forEach(async (attr_item, index) => {
                     if (attr_item.name != "Layout") {
                        if (attr_item.fieldId == attr.attr) {
                           if (attr_item.useDict) {
                              attr_item.dict = dictItemList;
                           } else {
                              attr_item.selections = dictItemList;
                           }
                        }
                        ele.dict =
                           dictItemList;
                     }
                     ele.value =
                        attr
                        .value;
                  }
               } else {
                  ele.setting
                     .colList
                     .forEach(
                        async (
                           col
                        ) => {
                           if (
                              col) {
                              let curIndex = data.findIndex((
                                 attr, index2, arr) => {
                                 return attr.attr == col.fieldId;
                              })
                              if (curIndex > -1) {
                                 const attr = data[curIndex]
                                 if (col.name ==
                                    'Select' &&
                                    attr
                                    .choice_list
                                 ) {
                                    const
                                       dictItemList = [];
                                    const
                                       choiceList =
                                       attr
                                       .choice_list || [];
                                    for (let d in
                                          choiceList) {
                                       const
                                          val =
                                          choiceList[
                                             d
                                          ];
                                       dictItemList
                                          .push({
                                             text: val,
                                             value: val
                                          });
                                    }
                                    col.dict =
                                       dictItemList;
                     } else if (attr_item.name == "Layout") {
                        attr_item.setting.colList.forEach((col) => {
                           if (col) {
                              if (col.fieldId == attr.attr) {
                                 if (col.useDict) {
                                    col.dict = dictItemList;
                                 } else {
                                    col.selections = dictItemList;
                                 }
                                 col.value =
                                    attr
                                    .value;
                              }
                           }
                        })
                        });
                     }
                  });
               }
            })
               if (!head_styledef.form.model[attr.attr]) {
                  head_styledef.form.model[attr.attr] = attr.value;
               }
               head_styledef.form.items.forEach(async (ele) => {
                  if (ele.name != "Layout") {
                     if (ele.fieldId == attr.attr) {
                        ele.value = attr.value;
                        ele.oldvalue = attr.value;
                     }
                  } else if (ele.name == "Layout") {
                     ele.setting.colList.forEach((col) => {
                        if (col) {
                           if (col.fieldId == attr.attr) {
                              col.value = attr.value;
                              col.oldvalue = attr.value;
                           }
                        }
                     });
                  }
               })
               //判断表单里是否有返回字段,没有就装载到model里,点击确定提交的时候带上这些数据
            })
            console.log(head_styledef)
            this.setData({
               head_styledef: head_styledef
            })
         },
         onClickItem(e) { //选择页签
            // console.log(e);
            this.current = e.currentIndex
@@ -2728,8 +2706,7 @@
                  objAttr[item.fieldId] = item.value;
            });
            const url = `../modal/form/index?param=${JSON.stringify(btn)}&titlename=${btn.Edit_dlg
               .Name}&editMode=1&objAttr=${JSON.stringify(objAttr)}&type=updateDataObj`
            const url = `../modal/form/index?param=${JSON.stringify(btn)}&titlename=${btn.ShowName}&editMode=1&objAttr=${JSON.stringify(objAttr)}&type=updateDataObj`
            var $this = this;
            uni.navigateTo({
               url: url,