From 9bcb6b47a130099d65dc0b55d2c2addd8b9191ca Mon Sep 17 00:00:00 2001 From: jt <jt@activesoft.com> Date: 星期四, 11 五月 2023 14:22:35 +0800 Subject: [PATCH] 下拉多选选择后会把单选和其他下拉框的值改动的问题改进 --- pages/modal/classAttr.vue | 36 +++++++++++++++++------------------- 1 files changed, 17 insertions(+), 19 deletions(-) diff --git a/pages/modal/classAttr.vue b/pages/modal/classAttr.vue index 7448247..d997aa8 100644 --- a/pages/modal/classAttr.vue +++ b/pages/modal/classAttr.vue @@ -270,7 +270,7 @@ <i class="i_tishi" v-if="attr.notempty==true">*</i> </view> </view> - <view class="form-group" v-if="attr.Type=='瀛楀吀' || attr.Type=='瀛楀吀-瀛楃涓�" :style="{'display':attr.hidden == true?'none':''}"> + <view class="form-group" v-if="attr.Type=='瀛楀吀' || attr.Type=='瀛楀吀-瀛楃涓� || attr.Type=='瀛楀吀-鏁存暟'" :style="{'display':attr.hidden == true?'none':''}"> <view v-if="classattr.control_style=='涓婁笅甯冨眬'"> <text class="tx_title">{{attr.DispName}}:<i class="i_tishi" v-if="attr.notempty==true">*</i></text> <picker class="section_iput" @change="onchange" :range="attr.dictitem" range-key="CN_S_NAME" v-if="attr.select==false" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}" :disabled="attr.edit?false:true"> @@ -283,7 +283,7 @@ <picker class="section_iput attr_field" @change="onchange" :range="attr.dictitem" range-key="CN_S_NAME" v-if="attr.select==false" :data-index="index" :data-iindex="iindex" :style="{'width': attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) +'%'}"> <label class="">{{ attr.Value }}</label> </picker> - <select-cy :value="attr.Value" :name="attr.Name" :options="attr.dictitem" showClearIcon="true" @change="onchange2" v-else-if="attr.select==true" :data-index="index" :data-iindex="iindex" :style="{'width':attr.Width}"></select-cy> + <select-cy :value="attr.Value" :name="attr.Name" :options="attr.dictitem" showClearIcon="true" @change="onchange2" v-else-if="attr.select==true" :data-index="index" :data-iindex="iindex" :style="{'display':'inline-block','margin-left':'8px','width':attr.Width.split('%')[0] - classattr.title_p_wdith - (attr.notempty==true?10:5) +'%'}"></select-cy> <i class="i_tishi" v-if="attr.notempty==true">*</i> </view> </view> @@ -399,7 +399,7 @@ edit_compose_cls_id:"", global_attr:[], refdatastore: [], //寮曠敤鏁版嵁瀛樺偍鍖�/ {attr:'G_PRJ_' + bindattr + '_ID', value:info.id} - inputValList:[{Name:"test"},{Name:"test2"},{Name:"test3"},{Name:"test4"},{Name:"test5"},{Name:"test6"},{Name:"test7"}], + inputValList:[{Name:"test"},{Name:"test2"},{Name:"test3"},{Name:"test4"},{Name:"test5"},{Name:"test6"},{Name:"test7"}] } }, onLoad(options) { @@ -503,13 +503,13 @@ this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value=e.target.value; }, onchange(e) { - console.log(e.target); + // console.log(e.target); var value=this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].dictitem[e.target.value]; var data_attr = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']]; console.log(data_attr); if (value.Name != data_attr.Value) { this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value=value.Name; - console.log(this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value); + // console.log(this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].Value); var eventid = this.$data.classAttrList[e.target.dataset['index']].Attr[e.target.dataset['iindex']].action; if (eventid) { // self.event_no_sub = 1; @@ -553,10 +553,8 @@ var index ,iindex,dindex=0; for(var i in this.$data.classAttrList){ for(var j in this.$data.classAttrList[i].Attr){ - for(var d in this.$data.classAttrList[i].Attr[j].dictitem){ - if(delvalue[0].Name == this.$data.classAttrList[i].Attr[j].dictitem[d].Name){ - this.$data.classAttrList[i].Attr[j].Value=""; - } + if(delvalue[0].attr == this.$data.classAttrList[i].Attr[j].Name){ + this.$data.classAttrList[i].Attr[j].Value=""; } } } @@ -566,10 +564,8 @@ var index ,iindex,dindex=0; for(var i in this.$data.classAttrList){ for(var j in this.$data.classAttrList[i].Attr){ - for(var d in this.$data.classAttrList[i].Attr[j].dictitem){ - if(item[v].Name == this.$data.classAttrList[i].Attr[j].dictitem[d].Name){ - index=i;iindex=j;dindex=d; - } + if(item[v].attr == this.$data.classAttrList[i].Attr[j].Name){ + index=i;iindex=j;dindex=d; } } } @@ -579,7 +575,7 @@ console.log(data_attr); if (itemvalue.Name != data_attr.Value) { this.$data.classAttrList[index].Attr[iindex].Value=value; - console.log(this.$data.classAttrList[index].Attr[iindex].Value); + // console.log(this.$data.classAttrList[index].Attr[iindex].Value); var eventid = this.$data.classAttrList[index].Attr[iindex].action; if (eventid) { // self.event_no_sub = 1; @@ -595,7 +591,7 @@ req.push({ attr: ar.Name, val: ar.ValID ?ar.ValID :'' }); else if(ar.Type=='甯冨皵鍊�) req.push({ attr: ar.Name, val: ar.Value?'1':'0'}); - else if(ar.Type=='瀛楀吀' || ar.Type=='瀛楀吀-瀛楃涓�) + else if(ar.Type=='瀛楀吀' || ar.Type=='瀛楀吀-瀛楃涓� || ar.Type=='瀛楀吀-鏁存暟') req.push({ attr: ar.Name, val: itemvalue.Name}); else req.push({ attr: ar.Name, val: ar.Value ?ar.Value :''}); @@ -814,7 +810,8 @@ }, add(){ uni.showLoading({ - title:"鍔犺浇涓�.." + title:"鍔犺浇涓�..", + mask:true }); var req=[]; var attrlist = this.$data.classAttrList; @@ -829,7 +826,7 @@ req.push({ name: ar.Name, value: ar.ValID ?ar.ValID :'' }); else if(ar.Type=='甯冨皵鍊�) req.push({ name: ar.Name, value: ar.Value?'1':'0'}); - else if(ar.Type=='瀛楀吀' || ar.Type=='瀛楀吀-瀛楃涓�){ + else if(ar.Type=='瀛楀吀' || ar.Type=='瀛楀吀-瀛楃涓� || ar.Type=='瀛楀吀-鏁存暟'){ if(ar.select==true){ //鍒ゆ柇涓嬫媺鏄惁澶氶� var valStr =""; for(var v in ar.Value){ @@ -943,6 +940,7 @@ for (var d = 0; d < ca.dictitem.length; d++) { ca.dictitem[d].label=ca.dictitem[d].CN_S_NAME; ca.dictitem[d].value=ca.dictitem[d].CN_S_NAME; + ca.dictitem[d].attr=ca.Name; if(ca.dictitem[d].CN_C_IS_DEFAULT=='1') ca.Value=ca.dictitem[d].CN_S_NAME; } @@ -1089,7 +1087,7 @@ for (var l = 0; l < this.$data.classAttrList[a].Attr.length; l++) { var ca = this.$data.classAttrList[a].Attr[l]; if (val[i].attr == ca.Name) { - if(ca.Type=='瀛楀吀' || ca.Type=='瀛楀吀-瀛楃涓�){ + if(ca.Type=='瀛楀吀' || ca.Type=='瀛楀吀-瀛楃涓� || ca.Type=='瀛楀吀-鏁存暟'){ var dictItemList=[]; for(var d in val[i].choice_list){ var list_val =val[i].choice_list[d]; @@ -1192,7 +1190,7 @@ var attr = $this.$data.classAttrList[c].Attr; for (var j = 0; j < attr.length; j++) { if(attr[j].Name==result[i].attr){ - if(attr[j].Type=='瀛楀吀' || attr[j].Type=='瀛楀吀-瀛楃涓�){ + if(attr[j].Type=='瀛楀吀' || attr[j].Type=='瀛楀吀-瀛楃涓� || attr[j].Type=='瀛楀吀-鏁存暟'){ var dictItemList=[]; for(var d in result[i].choice_list){ var val =result[i].choice_list[d]; -- Gitblit v1.9.1