From e6c7099b1f642c63822f8288471bfd9fbfeb5625 Mon Sep 17 00:00:00 2001 From: tanghaolin <1723298894@qq.com> Date: 星期二, 30 八月 2022 13:20:38 +0800 Subject: [PATCH] 添加品牌选择和品牌筛选 --- src/views/Select/SelParams.vue | 330 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 261 insertions(+), 69 deletions(-) diff --git a/src/views/Select/SelParams.vue b/src/views/Select/SelParams.vue index f1c4b1f..a4652f8 100644 --- a/src/views/Select/SelParams.vue +++ b/src/views/Select/SelParams.vue @@ -5,20 +5,21 @@ <template #left> <div @click="pageBack" style="display: flex; align-items: center"> <van-icon name="arrow-left" size="18" /> - <span>{{$t('selectPage.index.TR')}}</span> + <span>{{ $t("selectPage.index.TR") }}</span> </div> </template> <template #title> - <label>{{$t("selectPage.productSeries.TR")}}</label> + <label>{{ $t("selectPage.productSeries.TR") }}</label> </template> <template #right> <div @click="toSelSeries" style="display: flex; align-items: center"> - <span>{{$t("selectPage.nextStep.TR")}}</span> + <span>{{ $t("selectPage.nextStep.TR") }}</span> <van-icon name="arrow" size="18" /> </div> </template> </van-nav-bar> <div class="selectParm_main"> + <!-- 娴侀噺 --> <van-field center clearable @@ -30,7 +31,7 @@ style="padding: 10px 26px" > <template #label> - <span style="font-size: 14px">{{$t('ebookPage.flow.TR')}}</span> + <span style="font-size: 14px">{{ $t("ebookPage.flow.TR") }}</span> </template> <template #button> <van-button @@ -41,6 +42,7 @@ > </template> </van-field> + <!-- 鎵▼ --> <van-field center clearable @@ -48,11 +50,11 @@ label-align="center" :label="$t('ebookPage.head.TR')" type="number" - :placeholder="$t('selectPage.headRule.TR')" + :placeholder="$t('selectPage.headRule.TR')" style="padding: 10px 26px" > <template #label> - <span style="font-size: 14px">{{$t('ebookPage.head.TR')}}</span> + <span style="font-size: 14px">{{ $t("ebookPage.head.TR") }}</span> </template> <template #button> <van-button @@ -63,6 +65,7 @@ > </template> </van-field> + <!-- 璁剧疆棰戠巼 --> <van-field readonly clickable @@ -78,6 +81,7 @@ <van-button disabled size="small" type="primary">Hz</van-button> </template> </van-field> + <!-- 娑堥槻娉� --> <van-field readonly center @@ -94,6 +98,7 @@ </van-button> </template> </van-field> + <!-- 杞�� --> <van-field readonly center @@ -102,7 +107,7 @@ v-if="m_DeviceTpyeValue != 3" :label="$t('selectPage.speed.TR')" label-align="center" - style="margin-bottom: 10px; padding: 10px 26px" + style="padding: 10px 26px" @click="m_ShowMotorPolePicker = true" > <template #button> @@ -111,11 +116,30 @@ </van-button> </template> </van-field> + <!-- 鍝佺墝 --> + <van-field + readonly + center + clearable + v-model="m_BrandShowValue" + label="鍝佺墝" + label-align="center" + style="margin-bottom: 10px; padding: 10px 26px" + @click="getBrandData" + > + <template #button> + <van-button disabled size="small" type="primary"> + <van-icon name="arrow" /> + </van-button> + </template> + </van-field> <van-collapse v-model="m_activeNames"> <!-- 鏇村鏉′欢 --> <van-collapse-item name="moreTrade" style="margin-bottom: 10px"> <template #title> - <span style="font-size: 14px; font-weight: 600">{{$t('selectPage.drivingConditions.TR')}}</span> + <span style="font-size: 14px; font-weight: 600">{{ + $t("selectPage.drivingConditions.TR") + }}</span> </template> <van-field readonly @@ -149,7 +173,9 @@ <!-- 鍙傛暟鑼冨洿 --> <van-collapse-item name="paramLimit" style="margin-bottom: 10px"> <template #title> - <span style="font-size: 14px; font-weight: 600">{{$t('detailPage.medium.TR')}}</span> + <span style="font-size: 14px; font-weight: 600">{{ + $t("detailPage.medium.TR") + }}</span> </template> <van-field readonly @@ -208,7 +234,9 @@ <!-- 瀹瑰樊鑼冨洿 --> <van-collapse-item name="tolerances"> <template #title> - <span style="font-size: 14px; font-weight: 600">{{$t('selectPage.toleranceRange.TR')}}</span> + <span style="font-size: 14px; font-weight: 600">{{ + $t("selectPage.toleranceRange.TR") + }}</span> </template> <van-field readonly @@ -382,6 +410,17 @@ @confirm="onChangeMotorPoleConfirm" /> </van-popup> + <!-- 鍝佺墝 --> + <van-action-sheet v-model:show="m_ShowBrandPicker" title="鍝佺墝閫夋嫨"> + <div class="brand-content"> + <div class="brand-item" @click="onChangeBrandSelectAll" :class="brandSelectAll?'brand-item-active':''"> + <span>鍏ㄩ儴</span> + </div> + <div class="brand-item" @click="onChangeBrandSelect(brand_item)" :class="brand_item.IsSelect?'brand-item-active':''" v-for="(brand_item,brand_index) in m_BrandColumns" :key="brand_index"> + <span>{{brand_item.ShortName}}</span> + </div> + </div> + </van-action-sheet> <!-- 鐢垫満鍔熺巼鏍囧噯 --> <van-popup v-model:show="m_ShowMotorStdPicker" @@ -497,6 +536,13 @@ { text: "12p", value: 12, disabled: false }, ], //杞�熺瓑绾� + m_ShowBrandPicker: false, //鏄剧ず鍝佺墝寮规 + m_BrandValue: null, //閫夋嫨鐨勫搧鐗岀殑鍊� + m_BrandShowValue: "鍏ㄩ儴", //灞曠ず鍝佺墝閫夋嫨鍚庣殑鍊� + m_BrandColumns: [], //鍝佺墝閫夋嫨鏁� + isInitBrandData:false,//鏄惁鑾峰彇浜嗗搧鐗屾暟鎹� + brandSelectAll:false, + m_DieselSpeed: "", //鏌存补鏈鸿浆閫� m_ShowMotorStdPicker: false, //杞�熺瓑绾ч�夋嫨寮规 @@ -517,13 +563,13 @@ m_CalcViscosityUnit: "cSt", m_ToleranceStandardPicker: false, //鏍¢獙鏍囧噯瀹瑰樊閫夋嫨寮规鏄�/闅� - m_ToleranceStandardIndex:0,//褰撳墠閫夋嫨鐨勫宸爣鍑嗙储寮� + m_ToleranceStandardIndex: 0, //褰撳墠閫夋嫨鐨勫宸爣鍑嗙储寮� m_ToleranceStandardValue: "", //楠屾敹瀹瑰樊鏍囧噯 m_ToleranceStandardShowValue: "", //浠嬭川鍚嶇О m_ToleranceStandardColumns: [], m_ToleranceLevelPicker: false, //鏍¢獙鏍囧噯瀹瑰樊閫夋嫨寮规鏄�/闅� - m_ToleranceLevelIndex:0,//褰撳墠閫夋嫨鐨勫宸瓑绾х储寮� + m_ToleranceLevelIndex: 0, //褰撳墠閫夋嫨鐨勫宸瓑绾х储寮� m_ToleranceLevelValue: "", //楠屾敹瀹瑰樊鏍囧噯 m_ToleranceLevelShowValue: "", //浠嬭川鍚嶇О m_ToleranceLevelColumns: [], @@ -540,11 +586,10 @@ }; }, mounted() { - this.m_Title = this.getSoftName(); + this.m_Title = this.getSoftName(); // console.log(this.$i18n.locale,554) - this.translateParamsToLang() + this.translateParamsToLang(); this.getParaPageInfo(); - this.m_DpQuText = UnitHelper.GetUnitNameQ( this.$globalConfig.UnitDefault.UnitQ.value @@ -559,9 +604,9 @@ methods: { getParaPageInfo() { let _this = this; - let Toast = _this.$toast + let Toast = _this.$toast; Toast.loading({ - message: 'loading...', + message: "loading...", forbidClick: true, }); _this @@ -569,23 +614,23 @@ url: _this.$globalConfig.WebApiUrl.MainUrl + "/v1/Mobile/SelectByParas/GetParaPageInfo", - params:{ - Lang:_this.getCurrentLanguageType() - } + params: { + Lang: _this.getCurrentLanguageType(), + }, }) .then((res) => { - Toast.clear() + Toast.clear(); let result = res.data; - console.log(res,575) + // console.log(res, 575); if (result.Code != 0) { - Toast.fail(result.Message) + Toast.fail(result.Message); return; } if (result.Data.DriveTypeList) { _this.m_DeviceTpyeValue = result.Data.DriveTypeList[0].Value; _this.m_DeviceTpyeShowValue = result.Data.DriveTypeList[0].Text; - console.log(_this.m_DeviceTpyeValue,_this.m_DeviceTpyeShowValue ) + // console.log(_this.m_DeviceTpyeValue, _this.m_DeviceTpyeShowValue); //鑾峰彇椹卞姩绫诲瀷 let deviceTpyeColumns = []; result.Data.DriveTypeList.forEach((element) => { @@ -601,7 +646,8 @@ if (result.Data.FireTypeList) { //鑾峰彇娑堥槻娉电被鍨� _this.m_FireTypeValue = _this.$globalConfig.FireTypeDefault.value; - _this.m_FireTypeShowValue = _this.$globalConfig.FireTypeDefault.text; + _this.m_FireTypeShowValue = + _this.$globalConfig.FireTypeDefault.text; let fireTypeColumns = []; result.Data.FireTypeList.forEach((element) => { let columns = { @@ -609,8 +655,8 @@ value: element.Value, disable: !element.Enable, }; - if(element.Value == _this.m_FireTypeValue){ - _this.m_FireTypeShowValue = element.Text + if (element.Value == _this.m_FireTypeValue) { + _this.m_FireTypeShowValue = element.Text; } fireTypeColumns.push(columns); }); @@ -635,21 +681,71 @@ _this.getToleranceDefaultValue(); _this.buildToleranceRangData(); //console.log(res, 344); - - }) .catch((err) => { console.log(err); }); }, - translateParamsToLang(){ - let currentLang = this.$i18n.locale - if(currentLang == 'en'){ - this.m_JieZhiNameColumns[0].text = `${this.$t('selectPage.cleanWater.TR')}` - this.m_JieZhiNameShowValue = this.m_JieZhiNameColumns[0].text + //鑾峰彇鍝佺墝鏁版嵁 + getBrandData() { + this.m_ShowBrandPicker = true; + console.log(this.isInitBrandData,987) + if(this.isInitBrandData)return + this.getBrandList(); + }, - this.m_MotorPoleColumns[0].text = `${this.$t('selectPage.unlimited.TR')}` - this.m_MotorPoleShowValue = this.m_MotorPoleColumns[0].text + //鑾峰彇鍝佺墝鍒楄〃 + getBrandList() { + let _this = this; + _this + .$axios({ + methods: "get", + url: _this.$globalConfig.WebApiUrl.MainUrl + "v1/Web/Corp/GetList", + params: { + lang: _this.getCurrentLanguageType(), + }, + }) + .then(function (res) { + _this.isInitBrandData = true + // console.log(res,"绫诲瀷鍒楄〃"); + let result = res.data; + if (result.Code != 0) { + return; + } + if (result.Data) { + // console.log(result.Data, 158); + let brandList = []; + result.Data.forEach((element) => { + let brandNode = { + Description: element.Description, + FullName: element.FullName, + ID: element.ID, + LogoPath: + _this.$globalConfig.WebApiUrl.FileUrl + element.LogoPath, + ShortName: element.ShortName, + IsSelect: false, + }; + brandList.push(brandNode); + }); + _this.m_BrandColumns = brandList; + } + }) + .catch(function (err) { + console.log(err); + }); + }, + translateParamsToLang() { + let currentLang = this.$i18n.locale; + if (currentLang == "en") { + this.m_JieZhiNameColumns[0].text = `${this.$t( + "selectPage.cleanWater.TR" + )}`; + this.m_JieZhiNameShowValue = this.m_JieZhiNameColumns[0].text; + + this.m_MotorPoleColumns[0].text = `${this.$t( + "selectPage.unlimited.TR" + )}`; + this.m_MotorPoleShowValue = this.m_MotorPoleColumns[0].text; } }, //鑾峰彇涓婃濉啓琛ㄥ崟鐨勮褰� @@ -675,16 +771,25 @@ prvePathDataObj.DesignInfo.UnitQ ); - this.m_ToleranceStandardValue = prvePathDataObj.DesignInfo.ToleranceStandard //瀹瑰樊鏍囧噯 - this.m_ToleranceLevelValue = prvePathDataObj.DesignInfo.PointTolerance.ToleranceGrade //瀹瑰樊绛夌骇 - if(this.m_ToleranceLevelValue == 0){ - this.isToleranceLevelCustom = true + this.m_ToleranceStandardValue = + prvePathDataObj.DesignInfo.ToleranceStandard; //瀹瑰樊鏍囧噯 + this.m_ToleranceLevelValue = + prvePathDataObj.DesignInfo.PointTolerance.ToleranceGrade; //瀹瑰樊绛夌骇 + if (this.m_ToleranceLevelValue == 0) { + this.isToleranceLevelCustom = true; } - this.m_MinFlowPerecent = parseFloat(prvePathDataObj.DesignInfo.PointTolerance.RatioMinQ * 100).toFixed(1); //鏈�灏忔祦閲忕櫨鍒嗘瘮 - this.m_MaxFlowPerecent = parseFloat(prvePathDataObj.DesignInfo.PointTolerance.RatioMaxQ * 100).toFixed(1); //鏈�澶ф祦閲忕櫨鍒嗘瘮 - this.m_MinHeadPerecent = parseFloat(prvePathDataObj.DesignInfo.PointTolerance.RatioMinH * 100).toFixed(1); //鏈�灏忔壃绋嬬櫨鍒嗘瘮 - this.m_MaxHeadPerecent = parseFloat(prvePathDataObj.DesignInfo.PointTolerance.RatioMaxH * 100).toFixed(1); //鏈�澶ф壃绋嬬櫨鍒嗘瘮 - + this.m_MinFlowPerecent = parseFloat( + prvePathDataObj.DesignInfo.PointTolerance.RatioMinQ * 100 + ).toFixed(1); //鏈�灏忔祦閲忕櫨鍒嗘瘮 + this.m_MaxFlowPerecent = parseFloat( + prvePathDataObj.DesignInfo.PointTolerance.RatioMaxQ * 100 + ).toFixed(1); //鏈�澶ф祦閲忕櫨鍒嗘瘮 + this.m_MinHeadPerecent = parseFloat( + prvePathDataObj.DesignInfo.PointTolerance.RatioMinH * 100 + ).toFixed(1); //鏈�灏忔壃绋嬬櫨鍒嗘瘮 + this.m_MaxHeadPerecent = parseFloat( + prvePathDataObj.DesignInfo.PointTolerance.RatioMaxH * 100 + ).toFixed(1); //鏈�澶ф壃绋嬬櫨鍒嗘瘮 this.m_PinLvValue = prvePathDataObj.FilterInfo.MotorFrequence; //鐢垫満棰戠巼 this.m_PinLvShowValue = prvePathDataObj.FilterInfo.MotorFrequence; //鐢垫満棰戠巼鏄剧ず鏂囧瓧 @@ -703,19 +808,23 @@ let currentLangType = this.getCurrentLanguageUrl(); let defauleValueObj = this.pointToleranceConfig.DefaultValue; let currentDefauleValue = { - Standard:"", - ToleranceGrade:"" + Standard: "", + ToleranceGrade: "", }; // console.log(this.m_ToleranceStandardValue,this.m_ToleranceLevelValue,689) - if(this.m_ToleranceStandardValue == "" || this.m_ToleranceStandardValue == undefined || this.m_ToleranceStandardValue == null){ + if ( + this.m_ToleranceStandardValue == "" || + this.m_ToleranceStandardValue == undefined || + this.m_ToleranceStandardValue == null + ) { Object.keys(defauleValueObj).forEach((item) => { if (item == currentLangType) { currentDefauleValue = defauleValueObj[item]; } }); } else { - currentDefauleValue.Standard = this.m_ToleranceStandardValue - currentDefauleValue.ToleranceGrade = this.m_ToleranceLevelValue + currentDefauleValue.Standard = this.m_ToleranceStandardValue; + currentDefauleValue.ToleranceGrade = this.m_ToleranceLevelValue; } let selectList = this.pointToleranceConfig.Standard4PumpSelectList; @@ -727,8 +836,13 @@ if (grade.Value == currentDefauleValue.ToleranceGrade) { this.m_ToleranceLevelShowValue = grade.Name; } - if (grade.Value != currentDefauleValue.ToleranceGrade && currentDefauleValue.ToleranceGrade == 0) { - this.m_ToleranceLevelShowValue = `${this.$t('selectPage.custom.TR')}`; + if ( + grade.Value != currentDefauleValue.ToleranceGrade && + currentDefauleValue.ToleranceGrade == 0 + ) { + this.m_ToleranceLevelShowValue = `${this.$t( + "selectPage.custom.TR" + )}`; } }); }); @@ -741,9 +855,9 @@ let ToleranceStandardColumns = []; let ToleranceLevelColumns = []; let SelectList = this.pointToleranceConfig.Standard4PumpSelectList; - SelectList.forEach((item,index) => { - if(item.Value == this.m_ToleranceStandardValue){ - this.m_ToleranceStandardIndex = index + SelectList.forEach((item, index) => { + if (item.Value == this.m_ToleranceStandardValue) { + this.m_ToleranceStandardIndex = index; } let standColumn = { text: "", @@ -754,12 +868,12 @@ standColumn.value = item.Value; ToleranceStandardColumns.push(standColumn); - item.ToleranceGrade.forEach((grade,gradeIndex) => { + item.ToleranceGrade.forEach((grade, gradeIndex) => { if ( item.Value == this.m_ToleranceStandardValue && grade.Value == this.m_ToleranceLevelValue ) { - this.m_ToleranceLevelIndex = gradeIndex + this.m_ToleranceLevelIndex = gradeIndex; this.m_MinFlowPerecent = parseFloat( grade.Tol.RatioMinQ * 100 ).toFixed(1); //鏈�灏忔祦閲忕櫨鍒嗘瘮 @@ -786,12 +900,12 @@ }); }); ToleranceLevelColumns.push({ - text: `${this.$t('selectPage.custom.TR')}`, + text: `${this.$t("selectPage.custom.TR")}`, value: 0, disable: false, }); - if(this.m_ToleranceStandardValue == 0){ - this.m_ToleranceLevelIndex = ToleranceLevelColumns.length - 1 + if (this.m_ToleranceStandardValue == 0) { + this.m_ToleranceLevelIndex = ToleranceLevelColumns.length - 1; } this.m_ToleranceStandardColumns = ToleranceStandardColumns; this.m_ToleranceLevelColumns = ToleranceLevelColumns; @@ -852,6 +966,51 @@ this.m_MotorPoleValue = e.value; this.m_MotorPoleShowValue = e.text; }, + onChangeBrandSelectAll(){ + this.brandSelectAll = !this.brandSelectAll + let currentBrandSelectArr= [] + let currentBrandSelectName = [] + this.m_BrandColumns.forEach(item=>{ + if(this.brandSelectAll){ + item.IsSelect = true + }else { + item.IsSelect = false + } + + if(item.IsSelect){ + currentBrandSelectArr.push(item.ID) + currentBrandSelectName.push(item.ShortName) + } + }) + + this.m_BrandShowValue = currentBrandSelectName.join(',') + this.m_BrandValue = currentBrandSelectArr + }, + //鐩戝惉鍝佺墝閫夋嫨 + onChangeBrandSelect(e){ + // console.log(e,965) + let currentBrandSelectArr= [] + let currentBrandSelectName = [] + this.m_BrandColumns.forEach(item=>{ + if(item.ID == e.ID){ + item.IsSelect = !item.IsSelect + } + if(item.IsSelect){ + currentBrandSelectArr.push(item.ID) + currentBrandSelectName.push(item.ShortName) + } + }) + + this.m_BrandShowValue = currentBrandSelectName.join(',') + this.m_BrandValue = currentBrandSelectArr + //鍒ゆ柇褰撳墠鏄惁鏄叏閫� + if(this.m_BrandValue.length != this.m_BrandColumns.length){ + this.brandSelectAll = false + }else { + this.brandSelectAll = true + } + + }, //鐩戝惉鐢垫満鍔熺巼鏍囧噯閫夋嫨 onChangeMotorStdConfirm(e) { this.m_ShowMotorStdPicker = false; @@ -865,9 +1024,9 @@ this.m_JieZhiNameShowValue = e.text; }, //鐩戝惉鏍¢獙瀹瑰樊鏍囧噯鐨勯�夋嫨 - onChangeToleranceStandardConfirm(e,index) { + onChangeToleranceStandardConfirm(e, index) { this.isToleranceLevelCustom = false; - this.m_ToleranceStandardIndex = index + this.m_ToleranceStandardIndex = index; this.m_ToleranceStandardPicker = false; this.m_ToleranceStandardValue = e.value; this.m_ToleranceStandardShowValue = e.text; @@ -883,15 +1042,15 @@ this.buildToleranceRangData(); }, //鐩戝惉瀹瑰樊绛夌骇鐨勯�夋嫨 - onChangeToleranceLevelConfirm(e,index) { + onChangeToleranceLevelConfirm(e, index) { this.isToleranceLevelCustom = false; this.m_ToleranceLevelPicker = false; this.m_ToleranceLevelValue = e.value; - this.m_ToleranceLevelIndex = index + this.m_ToleranceLevelIndex = index; this.m_ToleranceLevelShowValue = e.text; if (e.value == 0) { this.isToleranceLevelCustom = true; - return + return; } this.buildToleranceRangData(); }, @@ -943,7 +1102,7 @@ UnitH: this.m_DpHuValue, //鎵▼鍗曚綅 DpQ: this.m_DpQ, //杈撳叆鐨勬祦閲忕殑鍊� DpH: this.m_DpH, //杈撳叆鐨勬壃绋嬬殑鍊� - ToleranceStandard:this.m_ToleranceStandardValue,//瀹瑰樊鏍囧噯鐨勫�� + ToleranceStandard: this.m_ToleranceStandardValue, //瀹瑰樊鏍囧噯鐨勫�� // PointTolerance: { // ToleranceGrade: this.m_ToleranceLevelValue,//瀹瑰樊绛夌骇鐨勫�� // RatioMinQ: this.m_MinFlowPerecent / 100, @@ -951,7 +1110,7 @@ // RatioMinH: this.m_MinHeadPerecent / 100, // RatioMaxH: this.m_MaxHeadPerecent / 100, // }, - PointTolerance:"", + PointTolerance: "", IsVisCorrect: false, //鏄惁淇绮樺害 榛樿false }, }; @@ -968,11 +1127,11 @@ //select 琛ㄧずvuex鐨勬枃浠跺悕 filterData: groupPageData, }); - this.gotoPage("/Select/PumpCategory","",null) + this.gotoPage("/Select/PumpCategory", "", null); }, //杩斿洖涓婁竴椤� pageBack() { - this.gotoPage("/Index","",null) + this.gotoPage("/Index", "", null); }, }, }; @@ -1008,6 +1167,39 @@ } .van-field__control { text-indent: 5.5em; + text-overflow: ellipsis; + } + .brand-content { + height: 50vh; + padding: 0px 5px; + display: flex; + flex-wrap: wrap; + justify-content: flex-start; + align-content: flex-start; + } + .brand-item { + display: flex; + flex-direction: column; + width: 120px; + height: 32px; + justify-content: center; + align-items: center; + background-color: #f1f2f3; + border-radius: 20px; + margin-bottom: 10px; + margin-right: 5px; + box-sizing: border-box; + span{ + font-size: 12px; + } + } + .brand-item-active{ + border: 1px solid #578ebe; + background-color: #ecf5ff; + span{ + font-size: 12px; + color:#578ebe + } } } } -- Gitblit v1.9.3