cuiqian2004
2024-08-20 946dae0a8885b529e7755788ba7872503d9f9d9d
pages/modal/3037_2.vue
@@ -213,10 +213,10 @@
      <view class="view-floor">
         <button type="default" @tap="cancel" class="btn_cancel"
            v-if="param.Sub_Cls.Can_Add_Delete == true">{{translateSys('cancel')}}</button>
         <button type="default" @tap="sava" class="btn_add"
            v-if="param.Sub_Cls.Can_Add_Delete == true">{{title}}</button>
         <button type="default" @tap="sava" class="btn_sava"
            v-else-if="param.Sub_Cls.Can_Add_Delete == false">{{title}}</button>
         <button type="default" @tap="sava" class="btn_add" v-if="param.Sub_Cls.Can_Add_Delete == true"
            :class="saving?'btn_disabled':''" :disabled="saving">{{title}}</button>
         <button type="default" @tap="sava" class="btn_sava" v-else-if="param.Sub_Cls.Can_Add_Delete == false"
            :class="saving?'btn_disabled':''" :disabled="saving">{{title}}</button>
      </view>
      <!-- 普通弹窗 top bottom center left right -->
      <view>
@@ -279,6 +279,7 @@
            detail1_styledef: {},
            detail1StyleDefList: [],
            activelist: [],
            saving: false,
         };
      },
      onLoad(options) {
@@ -459,48 +460,38 @@
               dict_id: dict.id,
               dict_name: dict.name
            };
            // console.log(dataInfo);
            this.$store.dispatch('DictGetInfo', dataInfo).then(async (success) => {
               // console.log(success);
               if (success.err_code == 0) {
                  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,
                     });
            try {
               const success = await this.getDictInfo(dataInfo)
               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 (type == 'mast') { //有默认值,显示默认值
                     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;
                     // console.log($this.$data.detail1StyleDefList);
                  } else {
                     if (itemName) {
                        $this.detail1_styledef.form.items[index].value = itemName;
                        var attr = $this.detail1_styledef.form.items[index].fieldId;
                        $this.detail1_styledef.form.model[attr] = itemName;
                     }
                     $this.detail1_styledef.form.items[index].dict = list;
                     console.log($this.$data.detail1_styledef);
               if (type == 'mast') { //有默认值,显示默认值
                  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;
                  // console.log($this.$data.detail1StyleDefList);
               } else {
                  uni.showModal({
                     title: this.translateSys("error") + "1.2",
                     content: success.err_msg,
                     showCancel: false,
                     confirmText: this.translateSys("cancel")
                  });
                  if (itemName) {
                     $this.detail1_styledef.form.items[index].value = itemName;
                     var attr = $this.detail1_styledef.form.items[index].fieldId;
                     $this.detail1_styledef.form.model[attr] = itemName;
                  }
                  $this.detail1_styledef.form.items[index].dict = list;
                  console.log($this.$data.detail1_styledef);
               }
            }).catch(ex => {
            } catch (ex) {
               // console.log(ex);
               uni.showModal({
                  title: this.translateSys("error") + "1.3",
@@ -508,8 +499,39 @@
                  showCancel: false,
                  confirmText: this.translateSys("cancel")
               });
            });
            }
         },
         getDictInfo(info) { //Mobox3得到得到字典信息字典项列表
            const loginInfo = this.$store.getters.loginid
            const mobxoSApi = this.$store.getters.getMobxoSApi
            return new Promise((resolve, reject) => {
               uni.request({
                  url: mobxoSApi + 'api/dict/GetInfo2?sessionid=' + loginInfo.result.session_id,
                  data: info,
                  method: 'POST',
                  dataType: "json",
                  success: (_res) => {
                     // console.log(_res);
                     const ret = _res.data
                     if (ret.err_code == 0) {
                        resolve(ret);
                     } else {
                        reject({
                           "errMsg": ret.err_msg
                        });
                     }
                  },
                  fail: (err) => {
                     // console.log(err);
                     reject(err);
                  }
               })
            })
         },
         async loadInitEvent(eventid, type) {
            var $this = this;
            var styledef = type == 'head' ? this.head_styledef : this.detail1_styledef;
@@ -785,7 +807,7 @@
            // console.log(e.target);
            var $this = this;
            console.log(item);
            if (item.oldvalue != item.value) {
            if (item.oldvalue != item.value && item.value.trim() != "") {
               item.oldvalue = item.value;
               var attr = item.fieldId;
               $this.head_styledef.form.model[attr] = item.value;
@@ -824,7 +846,7 @@
            console.log(item);
            var $this = this;
            console.log(item);
            if (item.oldvalue != item.value) {
            if (item.oldvalue != item.value && item.value.trim() != "") {
               item.oldvalue = item.value;
               var attr = item.fieldId;
               $this.head_styledef.form.model[attr] = item.value;
@@ -1827,6 +1849,7 @@
               }); //返回层数,2则上上页
         },
         scan_OKDataObjRunCustomEvent(eventID) {
            this.saving = true
            uni.showLoading({
               title: this.translateSys("loading"),
               mask: true
@@ -1925,6 +1948,7 @@
                        showCancel: false,
                        confirmText: this.translateSys("cancel")
                     });
                     this.saving =false
                     return false
                  } else {
                     var tip = data.info ? typeof data.info == 'string' ? data.info : data.info.join(
@@ -1955,8 +1979,10 @@
                     confirmText: this.translateSys("cancel")
                  });
               }
               this.saving = false
            }).catch(ex => {
               // console.log(ex);
               this.saving = false
               uni.hideLoading();
               uni.showModal({
                  title: this.translateSys("error") + "8.1",
@@ -2257,6 +2283,11 @@
         display: inline-block;
      }
      button.btn_disabled {
         background-color: #ddd;
         color: #888;
      }
      .class_attr_body .form-group {
         margin: 20rpx 30rpx;
         /* margin-left: -12px;