From e8b665122cf256caae4993534c696d029883f0d5 Mon Sep 17 00:00:00 2001 From: cuiqian2004 <cuiqian2004@163.com> Date: 星期三, 05 三月 2025 10:52:03 +0800 Subject: [PATCH] showmodal cancal 改成 close --- pages/modal/classAttr.vue | 142 +++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 124 insertions(+), 18 deletions(-) diff --git a/pages/modal/classAttr.vue b/pages/modal/classAttr.vue index 04000d1..d2042d1 100644 --- a/pages/modal/classAttr.vue +++ b/pages/modal/classAttr.vue @@ -24,14 +24,17 @@ </div> <input :type="attr.Type=='鏁存暟' || attr.Type=='娴偣鏁� || attr.Type=='int' || attr.Type=='float'?'number':'text'" - :value="attr.Value" @focus="ontap" @blur="onevent" v-if="attr.Height=='1'" + :value="attr.Value" :focus="focusField == `${index}-${iindex}`" @focus="ontap" + @click="onClick(index,iindex)" @blur="onevent" v-if="attr.Height=='1'" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" :disabled="attr.edit?false:true"> <!-- =='flase'?true:false --> - <textarea :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='2'" + <textarea :value="attr.Value" :focus="focusField == `${index}-${iindex}`" @focus="ontap" + @click="onClick(index,iindex)" @blur="onevent" v-else-if="attr.Height=='2'" :data-index="index" :data-iindex="iindex" style="height:60px;" :style="{'width':attr.Width}" :disabled="attr.edit?false:true"></textarea> - <textarea :value="attr.Value" @focus="ontap" @blur="onevent" v-else-if="attr.Height=='3'" + <textarea :value="attr.Value" :focus="focusField == `${index}-${iindex}`" @focus="ontap" + @click="onClick(index,iindex)" @blur="onevent" v-else-if="attr.Height=='3'" :data-index="index" :data-iindex="iindex" style="height:90px;" :style="{'width':attr.Width}" :disabled="attr.edit?false:true"></textarea> <!-- 鎵爜鍚庝簨浠惰繑鍥�--> @@ -47,16 +50,19 @@ <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> <input :type="attr.Type=='鏁存暟' || attr.Type=='娴偣鏁� || attr.Type=='int' || attr.Type=='float' ?'number':'text'" - class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" - v-if="attr.Height=='1'" :data-index="index" :data-iindex="iindex" + class="attr_field" :value="attr.Value" :focus="focusField == `${index}-${iindex}`" + @focus="ontap" @blur="onevent" @click="onClick(index,iindex)" v-if="attr.Height=='1'" + :data-index="index" :data-iindex="iindex" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" :disabled="attr.edit?false:true"> - <textarea class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" + <textarea class="attr_field" :value="attr.Value" :focus="focusField == `${index}-${iindex}`" + @focus="ontap" @blur="onevent" @click="onClick(index,iindex)" v-else-if="attr.Height=='2'" :data-index="index" :data-iindex="iindex" style="height:60px;" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" :disabled="attr.edit?false:true"></textarea> - <textarea class="attr_field" :value="attr.Value" @focus="ontap" @blur="onevent" + <textarea class="attr_field" :value="attr.Value" :focus="focusField ==`${index}-${iindex}`" + @focus="ontap" @blur="onevent" @click="onClick(index,iindex)" v-else-if="attr.Height=='3'" :data-index="index" :data-iindex="iindex" style="height:90px;" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) - (attr.ext_button==true?9:0) +'%'}" @@ -181,7 +187,8 @@ <a class="class_attr_add_per" @tap="classAttr_AddPer(index,iindex)"><i class="ace-icon fa fa-plus-circle"></i></a> </div> - <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true" :maxlength="-1"> + <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true" + :maxlength="-1"> </view> <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> @@ -204,7 +211,8 @@ <a href="#" class="class_attr_add_prj" @tap="classAttr_AddPrj(index,iindex)"><i class="ace-icon fa fa-plus-circle"></i></a> </div> - <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true" :maxlength="-1"> + <input type="text" :value="attr.Value" :style="{'width':attr.Width}" disabled="true" + :maxlength="-1"> </view> <view v-if="classattr.control_style=='宸﹀彸甯冨眬'"> <p class="tx_title2" :style="{'width':classattr.title_p_wdith+'%'}">{{attr.DispName}}:</p> @@ -305,6 +313,8 @@ return { title: '鏂板', param: {}, + focusField: "", + focusOldField: "", classAttrList: [], classGridStyle: [], edit_inital_event: "", //寮圭獥鍒濆鍖栦簨浠禝D @@ -540,15 +550,94 @@ delta: 1 //杩斿洖灞傛暟锛�鍒欎笂涓婇〉 }); }, + onClick(index, iindex) { + this.focusField = `${index}-${iindex}` + }, + ontap(e) { //鎵爜鍔熻兘 var $ele = e; //console.log(e.target) + this.focusOldField = `${e.target.dataset['index']}-${e.target.dataset['iindex']}` getApp().onScan((result) => { //console.log(result.decodedata); this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value = result.decodedata; uni.hideKeyboard(); this.onevent($ele, result.decodedata); + if (result.decodedata) { //绗竴涓緭鍏ユ涓嶄负绌�+ //鍒濆鍖栵紝涓嬩釜杈撳叆妗唂ocus灞炴� + const attrs = this.$data.classAttrList[e.target.dataset['index']].Attr || [] + var findd = false + for (let i = e.target.dataset['iindex'] + 1; i < attrs.length; i++) { + const ele = attrs[i] + + if (ele.hidden != true) { + if (utils.classUtils.attrTypeIsString(ele.Type) || utils.classUtils + .attrTypeIsInt(ele.Type)) { + const field = `${e.target.dataset['index']}-${i}` + if (this + .focusOldField == + field) { + this.setData({ + focusField: "" + }) + } else { + this.setData({ + focusField: this + .focusOldField + }) + } + this.$nextTick(() => { + this.setData({ + focusField: field + }) + }); + findd = true + break + } + } + + + } + if (findd) { + return + } + for (let i = e.target.dataset['index'] + 1; i < this.classAttrList.length; i++) { + const attrs2 = this.classAttrList[i].Attr || [] + for (let ii in attrs2) { + const ele = attrs2[ii] + if (ele.hidden != true) { + if (utils.classUtils.attrTypeIsString(ele.Type) || utils.classUtils + .attrTypeIsInt(ele.Type)) { + const field = `${i}-${ii}` + if (this + .focusOldField == + field) { + this.setData({ + focusField: "" + }) + } else { + this.setData({ + focusField: this + .focusOldField + }) + } + this.$nextTick(() => { + this.setData({ + focusField: field + }) + }); + break + } + } + } + if (findd) { + break + } + } + + } + }) }, onarrow(index, open) { @@ -972,8 +1061,12 @@ icon: "success", duration: 3000 }); - - // this.class_attr_init(); + //鍒锋柊 + uni.redirectTo({ + url: '../modal/classAttr?param=' + JSON.stringify(this.$data.param) + + "&titlename=" + this.$data.title + }); + //this.class_attr_init(); }).catch(ex => { console.log(ex); @@ -1054,6 +1147,16 @@ ca.Value = '璇烽�鎷�; if (utils.classUtils.attrTypeIsBool(ca.Type)) ca.Value = false; + if (ca.hidden != true) { + if (utils.classUtils.attrTypeIsString(ca.Type) || utils.classUtils + .attrTypeIsInt(ca.Type) || utils.classUtils.attrTypeIsFloat(ca.Type)) { + if (this.focusField == "") { + this.setData({ + focusField: `${newattrlist.length}-${attr.length}` + }) + } + } + } attr.push(ca); } @@ -1221,8 +1324,7 @@ } } } - } - if (action_type == 'open_select_userdlg') { + } else if (action_type == 'open_select_userdlg') { uni.showModal({ title: "閿欒2.2", content: "open_select_userdlg杩欎釜action_type杩樻湭澶勭悊锛�, @@ -1930,9 +2032,11 @@ margin-top: 50rpx; padding: 20rpx; line-height: 1.5; - background: #27A6E1; + /* background: #27A6E1; border: none; - color: #fff; + color: #fff; */ + background: #fff; + color: #000; font-size: 38rpx; font-weight: bold; float: left; @@ -2016,7 +2120,7 @@ .popup-footer { float: right; position: absolute; - bottom: 0; + bottom: 10rpx; right: 20rpx; } @@ -2040,9 +2144,11 @@ margin-top: 50rpx; padding: 15rpx; line-height: 1.5; - background: #27A6E1; + /* background: #27A6E1; border: none; - color: #fff; + color: #fff; */ + background: #fff; + color: #000; font-size: 38rpx; font-weight: bold; /* float: right; */ -- Gitblit v1.9.1