cuiqian2004
2025-03-20 c094d4a32180130de0c26c75a5abc414128a5ec1
pages/modal/3037_2.vue
@@ -1,81 +1,9 @@
<template>
   <view class="uni-page-modal-3017-2">
      <!-- 表头样式 -->
      <view class="v-headStyle" v-for="(item,index) in head_styledef.form.items">
         <!-- 普通布局 -->
         <view v-if="item.name!='Layout' && item.show==true">
            <text class="txt_title" :style="{'width':item.labelWidth+'px'}">{{item.label}}:</text>
            <!-- 下拉框-单选 item.useDict?item.dict:item.selections-->
            <uni-data-select id="dv_select" v-if="item.name=='Select'" :class="item.disabled?'input-disabled':''"
               v-model="item.value" :localdata="item.dict" @change="onEnterChange(item)" :disabled="item.disabled"
               :clear="false"></uni-data-select>
            <!-- 文本框/数字框 -->
            <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]"
                  @click="classAttr_extButton(item)">&#xe568;</text>
               <input class="uni-input" :class="item.disabled?'input-disabled':''"
                  :type="item.name=='Input'?'text':item.name=='InputNumber'?'number':'text'" v-model="item.value"
                  :disabled="item.disabled" :placeholder="item.placeholder"
                  :style="{'width':item.setting.prefix && item.setting.suffix?'78%':item.setting.prefix || item.setting.suffix?'87%':'96%'}"
                  :focus="focusMateria" @focus="ontap(item)" @keyup.enter="onEnterChange(item)"
                  @blur="onEnterChange(item)" :maxlength="-1" />
               <text v-if="item.setting.suffix" class="uni-icon" :class="[item.setting.suffix]"
                  @click="classAttr_extButton(item)">&#xe568;</text>
            </view>
            <!-- 多行文本 -->
            <view class="input-wrapper" v-if="item.name=='Textarea'">
               <textarea class="uni-input" :class="item.disabled?'input-disabled':''" v-model="item.value"
                  :placeholder="item.placeholder"  @blur="onEnterChange(item)"
                  :data-index="index" style="height:60px;" :style="{'width':'96%'}"
                  :disabled="item.disabled"></textarea>
            </view>
            <!-- 复选框 -->
            <checkbox-group class="check_rememberPwd" v-if="item.name=='Checkbox'"
               :class="item.disabled?'input-disabled':''" :disabled="item.disabled" @change="onCheckBoxValue"
               :data-attr="item.fieldId" :data-index="index">
               <label v-for="(item2) in item.selections" :key="item2.value">
                  <checkbox :value="item2.value" :checked="item.value.includes(item2.value)" />
                  <text>{{item2.label}}</text>
               </label>
            </checkbox-group>
            <!-- 单选框 -->
            <radio-group class="check_rememberPwd" v-if="item.name=='Radio'"
               :class="item.disabled?'input-disabled':''" :disabled="item.disabled" @change="onRadioBoxValue"
               :data-attr="item.fieldId" :data-index="index">
               <label v-for="(item2) in item.selections" :key="item2.value">
                  <radio :value="item2.value" :checked="item2.value === item.value" />
                  <text>{{item2.label}}</text>
               </label>
            </radio-group>
            <!-- Switch开关 -->
            <switch v-if="item.name=='Switch'" :class="item.disabled?'input-disabled':''" :disabled="item.disabled"
               v-model="item.value" @change="onModelValue(item)" :style="{'margin-left':'10rpx'}" />
            <!-- 日期时间 -->
            <!--    <view class="input-wrapper" v-if="item.name=='TimePicker' || item.name=='DatePicker'">
               <picker mode="date" class="date_iput" :class="item.disabled?'input-disabled':''"
                  :disabled="item.disabled" :value="item.value" @change="onModelValue(item)">
                  <view class="picker">{{item.value}}</view>
               </picker>
            </view>
          -->
            <view class="input-wrapper"
               v-if="item.name=='TimePicker' || item.name=='DatePicker'|| item.name=='DatePickerRange'">
               <OIDatePicker v-if="item.name=='DatePicker'" :class="item.disabled?'input-disabled':''"
                  :disabled="item.disabled" v-model="item.value" :placeholder="item.placeholder"
                  :defaultToday="item.setting.defaultToday" :format="item.setting.format"
                  @change="onModelValue(item)" />
               <OIDatePickerRange v-if="item.name=='DatePickerRange'" :rangeSeparator="item.setting.separator"
                  :format="item.setting.format" :class="item.disabled?'input-disabled':''"
                  :disabled="item.disabled" v-model="item.value" :placeholder="item.placeholder"
                  @change="onModelValue(item)" />
               <OITimePicker v-if="item.name=='TimePicker'" :class="item.disabled?'input-disabled':''"
                  :disabled="item.disabled" v-model="item.value" :placeholder="item.placeholder"
                  @change="onModelValue(item)" />
            </view>
         </view>
      </view>
      <OIForm ref="refBaseForm" class="v-headStyle" :form="head_styledef.form" @on-focus="ontap"
         @on-change="onEnterChange" @on-click-prefix="classAttr_extButton" @on-click-suffix="classAttr_extButton">
      </OIForm>
      <!-- 从数据 -->
      <view class="v-panel">
         <div class="panel_title">{{param.Sub_Cls.Title}}</div>
@@ -105,40 +33,38 @@
         <!-- 从数据显示详情区 -->
         <view class="v-panellist" v-for="(subpanel,iiindex) in subPanelList" @tap="onPanelClick(iiindex)"
            :class="activelist[iiindex].active==true?'bk-active':''">
            <view class="v-area dv-panel" v-for="(item,index) in subpanel.subClassAttr.form.items">
               <div class="dv-panel-input">
                  <!-- 普通布局 -->
                  <view v-if="item.name!='Layout' && item.show==true">
                     <text class="txt_title" :style="{'width':item.labelWidth+'px'}">{{item.label}}:</text>
                     <span class="form-item-span" v-if="item.disabled">{{item.value}}</span>
                     <!-- 文本框/数字框 -->
                     <view v-else class="input-wrapper">
                        <input :type="item.name=='InputNumber'?'number':'text'" v-model="item.value"
                           :placeholder="item.placeholder" :maxlength="-1"
                           @on-enter="onDetail1EnterChange(item)" />
                     </view>
                  </view>
            <uni-forms class="v-area dv-panel" label-align="right">
               <view v-for="(item,index) in subpanel.subClassAttr.form.items" :key="index">
                  <!-- 栅格布局 -->
                  <uni-row class="demo-uni-row" v-if="item.name=='Layout' && item.show==true">
                     <uni-col v-for="(cols,key) in item.setting.colList"
                        :span="item.setting.spanList?item.setting.spanList[key]:24 / item.setting.col">
                        <view v-if="cols!=null">
                           <text class="txt_title"
                              :style="{'width':cols.labelWidth+'px'}">{{cols.label}}:</text>
                           <span class="form-item-span" v-if="cols.disabled">{{cols.value}}</span>
                           <!-- 文本框/数字框 -->
                           <view v-else class="input-wrapper">
                              <input :type="cols.name=='InputNumber'?'number':'text'" v-model="cols.value"
                                 :placeholder="cols.placeholder" :maxlength="-1"
                                 @on-enter="onDetail1EnterChange(cols)" />
                           </view>
                  <uni-row v-if="item.name == 'Layout'" :gutter="item.setting.gutter">
                     <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" :key="key">
                        <uni-forms-item v-if="col != null"
                           :label="col.labelWidth === 0 ? '' : col.label? col.label+':':''"
                           :label-width="col.labelWidth || col.labelWidth === 0 ? col.labelWidth : 100+'px'">
                           <view v-if="col.disabled">{{col.value}}</view>
                           <input class="uni-input" v-else-if="col.name=='Input' || col.name=='InputNumber'"
                              :type="col.name=='InputNumber'?'number':'text'" v-model="col.value"
                              :placeholder="col.placeholder" :maxlength="-1" />
                           <view v-else>{{col.value}}</view>
                        </view>
                        </uni-forms-item>
                        <uni-forms-item v-else label=""></uni-forms-item>
                     </uni-col>
                  </uni-row>
               </div>
            </view>
                  <uni-forms-item v-else :label="item.labelWidth === 0 ? '' : item.label? item.label+':':''"
                     :label-width="item.labelWidth || item.labelWidth === 0 ? item.labelWidth : 100+'px'"
                     :style="{ textAlign: item.setting.align }">
                     <view v-if="item.disabled">{{item.value}}</view>
                     <input v-else-if="item.name=='Input' || item.name=='InputNumber' " class="uni-input"
                        :type="item.name=='InputNumber'?'number':'text'" v-model="item.value"
                        :disabled="item.disabled" :placeholder="item.placeholder" :maxlength="-1" />
                     <view v-else>{{item.value}}</view>
                  </uni-forms-item>
               </view>
            </uni-forms>
            <view class="v-paneldel" v-if="param.Sub_Cls.Can_Add_Delete == true">
               <a href="javascript:;" class="panel_del" @tap="panel_del(iiindex)"><i
                     class="ace-icon fu-delete"></i></a>
@@ -199,18 +125,14 @@
      dataObjDel
   } from "@/api/data.js"
   import dayjs from "dayjs";
   import OIDatePicker from '@/components/oi-date-time-picker/oi-date-picker.vue'
   import OIDatePickerRange from '@/components/oi-date-time-picker/oi-date-picker-range.vue'
   import OITimePicker from '@/components/oi-date-time-picker/oi-time-picker.vue'
   import OIForm from '@/components/oi-form/index.vue'
   export default {
      modules: {
         Base64,
      },
      components: {
         OIDatePicker,
         OIDatePickerRange,
         OITimePicker
         OIForm
      },
      data() {
         return {
@@ -608,20 +530,6 @@
                                    });
                                 }
                              }
                              var length = 0;
                              if (!$this.$data.refdatastore.filter(function(s) {
                                    return result[i].attr == s.attr
                                 }).length) {
                                 length = 1;
                                 $this.$data.refdatastore.push(result[i]);
                              }
                              if (length == 0) {
                                 for (var j = 0; j < $this.$data.refdatastore.length; j++) {
                                    if ($this.$data.refdatastore[j].attr == result[i].attr) {
                                       $this.$data.refdatastore[j].value = result[i].value;
                                    }
                                 }
                              }
                           }
                        } else if (data.action[i].action_type == 'set_dlg_attr_show') {
                           var result = action.value;
@@ -694,20 +602,19 @@
               uni.hideKeyboard();
               var $this = this;
               console.log(item);
               if (item.oldvalue != result.decodedata) {
                  item.oldvalue = result.decodedata;
                  item.value = result.decodedata;
               item.value = result.decodedata
               let newVal = item.value.trim()
               if (item.oldvalue != newVal) {
                  item.oldvalue = newVal;
                  var attr = item.fieldId;
                  $this.head_styledef.form.model[attr] = result.decodedata;
                  if (result.decodedata) { //第一个输入框不为空
                     $this.focusMateria = true; //初始化,第二个输入框focus属性
                     // setTimeout(function(){
                     //    $this.focusMateria=true; //第二个输入框获取焦点
                     setTimeout(function() {
                        uni.hideKeyboard();
                     }, 1000);
                     // },500);
                  }
                  $this.head_styledef.form.model[attr] = newVal;
                  $this.focusMateria = true; //初始化,第二个输入框focus属性
                  // setTimeout(function(){
                  //    $this.focusMateria=true; //第二个输入框获取焦点
                  setTimeout(function() {
                     uni.hideKeyboard();
                  }, 1000);
                  // },500);
                  //子数据类扫码区事件脚本
                  var eventid = this.$data.param.Scan_Code.Input_Change_Event.ID;
                  if (eventid) {
@@ -730,7 +637,7 @@
                        mast_attr: [],
                        inputParamter: [{
                           attr: 'mast_input_3037',
                           value: result.decodedata
                           value: newVal
                        }]
                     }
@@ -743,10 +650,16 @@
            // console.log(e.target);
            var $this = this;
            console.log(item);
            if (item.oldvalue != item.value && item.value.trim() != "") {
               item.oldvalue = item.value;
            let newVal = item.value
            if (typeof item.value == "string") {
               newVal = item.value.trim()
               if (!newVal)
                  return
            }
            if (item.oldvalue != newVal) {
               item.oldvalue = newVal;
               var attr = item.fieldId;
               $this.head_styledef.form.model[attr] = item.value;
               $this.head_styledef.form.model[attr] = newVal;
               //子数据类扫码区事件脚本
               var eventid = this.$data.param.Scan_Code.Input_Change_Event.ID;
               if (eventid) {
@@ -769,7 +682,7 @@
                     mast_attr: [],
                     inputParamter: [{
                        attr: 'mast_input_3037',
                        value: item.value
                        value: newVal
                     }]
                  }
@@ -1125,10 +1038,16 @@
         onEnterChange(item) {
            console.log("onEnterChange", item);
            if (item.oldvalue != item.value && item.value.trim() != "") {
               item.oldvalue = item.value;
            let newVal = item.value
            if (typeof item.value == "string") {
               newVal = item.value.trim()
               if (!newVal)
                  return
            }
            if (item.oldvalue != newVal) {
               item.oldvalue = newVal;
               var attr = item.fieldId;
               this.head_styledef.form.model[attr] = item.value;
               this.head_styledef.form.model[attr] = newVal;
               var onChangeEvent = item.bind.onChangeEvent; //内容变化后事件
               if (onChangeEvent?.id) { //内容变化后事件
                  this.onChange(onChangeEvent);
@@ -1171,15 +1090,20 @@
            //console.log(e.target)
            getApp().onScan((result) => {
               console.log(result.decodedata);
               item.value = result.decodedata
               let newVal = item.value
               if (typeof item.value == "string") {
                  newVal = item.value.trim()
               }
               var isflag = true;
               for (var i in this.$data.subPanelList) {
                  if (this.$data.subPanelList[i].scanCodeVal == result.decodedata)
                  if (this.$data.subPanelList[i].scanCodeVal == newVal)
                     isflag = false;
               }
               //子数据类扫码查询数据
               if (isflag) {
                  uni.hideKeyboard();
                  this.$data.scanCodeVal = result.decodedata;
                  this.$data.scanCodeVal = newVal;
                  var eventid = this.$data.param.Scan_Code.Input_Change_Event.ID;
                  if (eventid) {
                     //主数据类属性
@@ -1272,68 +1196,6 @@
                  }
               }
            }
         },
         onCheckBoxValue(e) { //绑定Model值
            let values = e.detail.value || []
            const item = this.head_styledef.form.items[e.currentTarget?.dataset?.index || 0]
            if (item?.setting?.colList) {
               const col = item.setting.colList[e.currentTarget?.dataset?.iindex || 0]
               if (col) {
                  col.value = values
                  let attr = col.fieldId;
                  this.head_styledef.form.model[attr] = col.value;
                  var onChangeEvent = col.bind.onChangeEvent; //内容变化后事件
                  if (onChangeEvent?.id) { //内容变化后事件
                     this.onChange(onChangeEvent);
                  }
                  return
               }
            } else {
               if (item) {
                  item.value = values
                  let attr = item.fieldId;
                  this.head_styledef.form.model[attr] = item.value;
                  var onChangeEvent = item.bind.onChangeEvent; //内容变化后事件
                  if (onChangeEvent?.id) { //内容变化后事件
                     this.onChange(onChangeEvent);
                  }
               }
            }
         },
         onRadioBoxValue(e) { //绑定Model值
            let values = e.detail.value || ""
            const item = this.head_styledef.form.items[e.currentTarget?.dataset?.index || 0]
            if (item?.setting?.colList) {
               const col = item.setting.colList[e.currentTarget?.dataset?.iindex || 0]
               if (col) {
                  col.value = values
                  let attr = col.fieldId;
                  this.head_styledef.form.model[attr] = col.value;
                  var onChangeEvent = col.bind.onChangeEvent; //内容变化后事件
                  if (onChangeEvent?.id) { //内容变化后事件
                     this.onChange(onChangeEvent);
                  }
                  return
               }
            } else {
               if (item) {
                  item.value = values
                  let attr = item.fieldId;
                  this.head_styledef.form.model[attr] = item.value;
                  var onChangeEvent = item.bind.onChangeEvent; //内容变化后事件
                  if (onChangeEvent?.id) { //内容变化后事件
                     this.onChange(onChangeEvent);
                  }
               }
            }
         },
         onModelValue(item) { //绑定Model值
            //console.log(e.target)
            var attr = item.fieldId;
            this.head_styledef.form.model[attr] = item.value;
         },
         panel_del(index) { //面板删除
@@ -1719,20 +1581,7 @@
                                 }
                              }
                              var length = 0;
                              if (!$this.$data.refdatastore.filter(function(s) {
                                    return result[i].attr == s.attr
                                 }).length) {
                                 length = 1;
                                 $this.$data.refdatastore.push(result[i]);
                              }
                              if (length == 0) {
                                 for (var j = 0; j < $this.$data.refdatastore.length; j++) {
                                    if ($this.$data.refdatastore[j].attr == result[i].attr) {
                                       $this.$data.refdatastore[j].value = result[i].value;
                                    }
                                 }
                              }
                           }
                        } else if (action.action_type == 'set_dlg_attr_show') {
                           var result = action.value;
@@ -1976,20 +1825,7 @@
                                    }
                                 }
                              }
                              var length = 0;
                              if (!$this.$data.refdatastore.filter(function(s) {
                                    return result[i].attr == s.attr
                                 }).length) {
                                 length = 1;
                                 $this.$data.refdatastore.push(result[i]);
                              }
                              if (length == 0) {
                                 for (var j = 0; j < $this.$data.refdatastore.length; j++) {
                                    if ($this.$data.refdatastore[j].attr == result[i].attr) {
                                       $this.$data.refdatastore[j].value = result[i].value;
                                    }
                                 }
                              }
                           }
                        } else if (action.action_type == 'set_global_attr') {
                           $this.$actiontr = action.value || [];
@@ -2413,61 +2249,46 @@
         /* padding: 10rpx 20rpx 4rpx 0px; */
         border-radius: 12rpx;
         /* margin-bottom: 20rpx; */
         text-align: right;
         .uni-forms-item {
            padding-bottom: 5rpx;
            margin-bottom: 0;
            .uni-forms-item__label {
               height: 20px !important;
               padding: 0 10rpx 0 0 !important;
            }
            .uni-input {
               width: calc(100% - 12rpx);
               padding: 5rpx;
               border: 1px solid #d5d5d5;
               color: #2d8cf0;
               height: 20px;
               background: #FFF;
               line-height: 20px;
               border-radius: 6px !important;
               font-size: 14px;
               font-family: inherit;
               box-shadow: none !important;
               transition-duration: 0.1s;
               vertical-align: middle;
            }
            .uni-input:hover {
               border: 1px solid rgb(41, 121, 255);
            }
         }
      }
      .dv-panel:first-child {
         padding-top: 10rpx;
      }
      .dv-panel-input {
         width: 100%;
         display: inline-block;
         text-align: left;
      }
      .dv-panel .txt_title {
         font-size: 34rpx;
         text-align: right;
         display: inline-block;
         vertical-align: 12px;
      }
      .dv-panel input {
         /* vertical-align: middle; */
         display: inline-block;
         border: 1px solid #d5d5d5;
         width: 68%;
         height: 52rpx;
         line-height: 34rpx;
         background: #FFF;
         border-radius: 7px !important;
         color: #2d8cf0;
         padding: 6rpx 8rpx 8rpx;
         font-size: 32rpx;
         font-family: inherit;
         box-shadow: none !important;
         transition-duration: 0.1s;
         margin-top: 0rpx;
      }
      .dv-panel input::-webkit-input-placeholder {
         font-size: 10rpx;
      }
      .input-disabled {
         background-color: #f3f3f3 !important;
      }
      .dv-panel .form-item-span {
         vertical-align: top;
         color: #2d8cf0;
         white-space: normal;
         word-break: break-all;
         display: inline-block;
         width: calc(100% - 100px);
         /* border: 1rpx solid red; */
      }
      #dv_select {
         display: inline-block;