| | |
| | | <u-icon class="m-l-a" name="arrow-right"></u-icon> |
| | | </view> --> |
| | | <view class="m-l-a m-r-0 flex " :class="[!dto['category']?'desc-gray':'']"> |
| | | <uni-data-picker @change="(e)=>{PickCategory(dto,e)}" placeholder="" @search="updateSearch" |
| | | :localdata="columns_categorys_picker"> |
| | | <!-- <uni-data-picker ref="picker_category" @change="(e)=>{PickCategory(dto,e)}" placeholder="" |
| | | @search="updateSearch" :filter="true" :localdata="columns_categorys_picker"> |
| | | {{dto.categoryStr||dto.category || '请选择'}} |
| | | </uni-data-picker> |
| | | </uni-data-picker> --> |
| | | <tree-filter ref="picker_category" @change="(e)=>{PickCategory(dto,e)}" placeholder="" |
| | | @search="updateSearch" :filter="true" :localdata="columns_categorys_picker" |
| | | selectConfirmTitle=""> |
| | | <view class="flex"> |
| | | <view>{{dto.categoryStr||dto.category || '请选择'}}</view> |
| | | <u-icon class="m-l-a" name="arrow-right"></u-icon> |
| | | </view> |
| | | |
| | | </tree-filter> |
| | | </view> |
| | | </view> |
| | | <view class="form-item before-line"> |
| | |
| | | <view class="button-green" @click="closeParamPop">返回</view> |
| | | </view> |
| | | </uni-popup> |
| | | <dying318picker :picker-list="columns_categorys" ref="picker_category" @confirm="confirmPickerCategory"> |
| | | </dying318picker> |
| | | <!-- <dying318picker :picker-list="columns_categorys" ref="picker_category" @confirm="confirmPickerCategory"> |
| | | </dying318picker> --> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import environments from '@/environments' |
| | | import dying318picker from '@/components/dying318-picker/Picker.vue' |
| | | import treeFilter from '@/components/tree-filter/tree-filter.vue' |
| | | |
| | | |
| | | import { |
| | | mapState |
| | |
| | | this.columns_categorys_picker = [] |
| | | this.mapCategoryTree(this.columns_categorys_picker, this.columns_categorys) |
| | | console.log('change updateSearch', search, this.columns_categorys_picker) |
| | | this.$refs.picker_category.selectedClear() |
| | | }, |
| | | async PickCategory(item, e) { |
| | | console.log('PickCategory', item, e) |
| | | if (e.detail.value) { |
| | | if (this.dto.category) { |
| | | await this.$message.confirm('修改分类将清空商品参数,确定修改吗') |
| | | } { |
| | | var currentnode = this.columns_categorys_dict['@' + e.detail.value[e.detail.value.length - 1] |
| | | .value] |
| | | let tmpe = e |
| | | if (this.dto.category && this.dto.category !== currentnode.id) { |
| | | this.$message.confirm('修改分类将清空商品参数,确定修改吗').then(async res => { |
| | | // console.log('currentnode',currentnode,this.columns_categorys_dict,'@'+e.detail.value[e.detail.value.length - 1].value) |
| | | this.dto.categoryStr = currentnode.name |
| | | this.dto.category = currentnode.id |
| | | this.dto.name = currentnode.name |
| | | this.dto.unit = currentnode.unit |
| | | this.dto.color = currentnode.color |
| | | //递归获取category的其他数据,用来做map? |
| | | this.$message.showLoading() |
| | | await this.refresh_category() |
| | | this.$message.hideLoading() |
| | | }).catch(e1 => { |
| | | console.log('this.$refs.picker_category', this.$refs.picker_category) |
| | | this.$refs.picker_category.onchange(tmpe.detail.value) |
| | | }) |
| | | } else { |
| | | this.dto.categoryStr = currentnode.name |
| | | this.dto.category = currentnode.id |
| | | this.dto.name = currentnode.name |
| | |
| | | } |
| | | if (item.name == this.columns_categorys_search) { |
| | | has = true |
| | | hasTrue = true |
| | | } |
| | | this.columns_categorys_dict['@' + item.id] = item |
| | | if (item.children && item.children.length > 0) { |
| | |
| | | } else { |
| | | tmp.children = undefined |
| | | } |
| | | if (hasTrue || has) { |
| | | console.log('has ',tmp) |
| | | |
| | | if (has) { |
| | | console.log('has ', tmp, hasTrue, has) |
| | | node.push(tmp) |
| | | } else { |
| | | |
| | | } |
| | | if (!has && hasTrue) { |
| | | //说明是这个节点有的,需要判断是否需要删除 |
| | | if (!tmp.children || tmp.children.length == 0) { |
| | | |
| | | } else { |
| | | console.log('not has ',tmp) |
| | | console.log('has ', tmp, hasTrue, has) |
| | | node.push(tmp) |
| | | } |
| | | } |
| | | // if (hasTrue || has) { |
| | | // node.push(tmp) |
| | | |
| | | // } else { |
| | | // console.log('not has ', tmp) |
| | | // } |
| | | |
| | | } |
| | | } |
| | |
| | | } |
| | | }, |
| | | components: { |
| | | dying318picker |
| | | dying318picker, |
| | | treeFilter |
| | | } |
| | | } |
| | | </script> |