cuiqian2004
2025-03-04 733cfa21c16c019c0337f948ac884ca4961ea2ad
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]"
@@ -200,8 +200,8 @@
         <uni-popup class="view-popup" ref="popup" background-color="#fff" @change="popupChange">
            <view class="popup-header">{{check_list.title}}</view>
            <view class="popup-content" :class="{ 'popup-height': popupType === 'left' || popupType === 'right' }"
               :style="{'width':check_list.width?check_list.width+'px':'200px','height':check_list.height?check_list.height+'px':'88%'}">
               <view class="popup-cont" :style="{'height':check_list.height?check_list.height-45+'px':'415px'}">
               :style="{'width':check_list.width?check_list.width+'px':'375rpx','height':check_list.height?check_list.height+'px':popupType =='center'?'60vh':'88vh'}">
               <view class="popup-cont" :style="{'height':check_list.height?check_list.height-45+'px':popupType =='center'?'50vh':'80vh'}">
                  <view class="view_popup_CheckList" v-for="(item,index) in check_list.items">
                     <checkbox-group class="check_list" @change="checkChange" :data-ischeck="item.check"
                        :data-index="index" :style="{'margin-left': '10rpx'}">
@@ -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,12 +919,13 @@
            // 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);
         },
         getDetailAttrList(pageData) {
            const detailAttrList = [];
              console.log(pageData)
            if (pageData.DefList) {
               pageData.DefList.forEach(style => {
                  var detail_attr = {};
@@ -953,6 +968,7 @@
                  });
               });
            }
              console.log(detailAttrList)
            const jsonlist = [];
            detailAttrList.forEach(attr => {
               jsonlist.push({
@@ -984,6 +1000,7 @@
                  });
                  var obj_attr = this.head_styledef.form.model;
                  // console.log(obj_attr);
                  var input_param = Base64.encode(
                     JSON.stringify(
                        Object.keys(head_attr).map((a) => ({
@@ -998,9 +1015,7 @@
                     jsonList.push({
                        page_name: page.Name,
                        item_list: $this.getDetailAttrList(page
                           .DefList, page
                           .Select_Button),
                        item_list: $this.getDetailAttrList(page),
                        ext_data: page.ExtData || {}
                     })
@@ -1008,6 +1023,7 @@
                  const data_json = Base64.encode(
                     JSON.stringify(jsonList)
                  );
                    console.log(jsonList)
                  var dataInfo = {
                     ed_type: 0,
                     start_transaction: true,
@@ -1029,7 +1045,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 +1733,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
@@ -2421,6 +2401,7 @@
                                 $this.setData({
                                    check_list: val.config
                                 })
                                 console.log($this.check_list)
                                 if (val.config.appear_style == 'sideslip') //判断是否是侧滑
                                    $this.setData({
                                       popupType: "right"
@@ -2728,8 +2709,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,
@@ -3278,7 +3258,17 @@
      },
   };
</script>
<style>
   .popup-content {
      @include flex;
   }
   .popup-height {
      @include height;
      /* width: 200px; */
   }
</style>
<style lang="scss">
   .uni-page-modal-5601 {
@@ -3614,15 +3604,6 @@
         background-color: #f3f3f3 !important;
      }
      .demo-uni-row {
         margin-bottom: 0px;
         display: block;
         .uni-input {
            width: calc(100% - 120px);
         }
      }
      ::v-deep .uni-row {
         margin-bottom: 0px;
      }
@@ -3636,6 +3617,30 @@
         border-radius: 5px;
      }
   .view-popup {
         position: relative;
      }
      .popup-content {
         // @include flex;
         align-items: center;
         justify-content: center;
         padding: 30rpx;
         background-color: #fff;
         /* height: 150px; */
         /* border: 1px solid red; */
      }
      .popup-cont {
         overflow-y: auto;
         /* border: 1px solid red; */
      }
      .popup-height {
         // @include height;
         /* width: 200px; */
      }
      .popup-header {
         font-size: 42rpx;
         font-weight: bold;