|
|
@@ -0,0 +1,212 @@
|
|
|
+<template>
|
|
|
+ <view class="mainBox">
|
|
|
+ <uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="选择产品" @clickLeft="backAdd">
|
|
|
+ <!--右菜单-->
|
|
|
+ <template slot="right">
|
|
|
+ <u-button type="success" size="small" class="u-reset-button" @click="classification"
|
|
|
+ text="选择分类"></u-button>
|
|
|
+ </template>
|
|
|
+ </uni-nav-bar>
|
|
|
+ <view class="wrapper">
|
|
|
+ <u-list @scrolltolower="scrolltolower" class="listContent">
|
|
|
+ <checkbox-group v-for="(item, index) in tableList" :key="index"
|
|
|
+ @change="e => selectVal(e, item, index)">
|
|
|
+ <label>
|
|
|
+ <view class="listBox">
|
|
|
+ <view class="listBox-sel">
|
|
|
+ <checkbox :value="item.id" color="#fff" :disabled="item.disabled"
|
|
|
+ :checked="item.checked" />
|
|
|
+ </view>
|
|
|
+ <view class="listBox-con">
|
|
|
+ <view class="listBox-bottom">
|
|
|
+ <view> <text>编码:</text> <text class="value">{{ item.code }}</text> </view>
|
|
|
+ <view> <text>名称:</text> <text class="value">{{ item.name }}</text> </view>
|
|
|
+ <view> <text>型号:</text> <text class="value">{{ item.modelType }}</text> </view>
|
|
|
+ <view> <text>规格:</text> <text class="value">{{ item.specification }}</text> </view>
|
|
|
+ <view> <text>计量单位:</text> <text class="value">{{ item.measuringUnit }}</text>
|
|
|
+ </view>
|
|
|
+ <view> <text>重量单位:</text> <text class="value">{{ item.weightUnit }}</text> </view>
|
|
|
+ <view> <text>分类:</text> <text class="value">{{ item.categoryLevelPath }}</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </label>
|
|
|
+ </checkbox-group>
|
|
|
+ <u-empty class="noDate" style="margin-top: 20vh" v-if="!tableList.length"></u-empty>
|
|
|
+ </u-list>
|
|
|
+ </view>
|
|
|
+ <ba-tree-picker ref="treePicker" key="verify" :multiple="false" @select-change="confirm" title="选择分类"
|
|
|
+ :selectedData="selectedData" :localdata="classificationList" valueKey="id" textKey="name"
|
|
|
+ childrenKey="children" />
|
|
|
+ <view class="footer">
|
|
|
+ <u-button type="success" size="small" class="u-reset-button" @click="jumpAdd">
|
|
|
+ <view class="selBtn">选择( {{ checkListLen }} )</view>
|
|
|
+ </u-button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import {
|
|
|
+ treeByPid
|
|
|
+ } from '@/api/pda/workOrder.js'
|
|
|
+ import {
|
|
|
+ getProductList,
|
|
|
+ getBatchDetails,
|
|
|
+ getInventoryDetails,
|
|
|
+ getMaterielDetails,
|
|
|
+ } from '@/api/repair'
|
|
|
+ export default {
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ tableList: [],
|
|
|
+ obtain: '主数据',
|
|
|
+ dimension: '1', // 列表维度
|
|
|
+ categoryLevelId: 6, // 分类id(默认6 查询备品备件)
|
|
|
+ selectedData: ['6'],
|
|
|
+ classificationList: [],
|
|
|
+ pageNum: 1,
|
|
|
+ isEnd: false,
|
|
|
+ detailsData:{}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed:{
|
|
|
+ checkListLen() {
|
|
|
+ return this.detailsData.id ? 1 : 0
|
|
|
+ },
|
|
|
+ },
|
|
|
+ onLoad(params) {
|
|
|
+ console.log(params, '参数')
|
|
|
+ this.obtain = params.obtain;
|
|
|
+ if (params.obtain == '仓库') {
|
|
|
+ this.changeDimension(this.dimension);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onShow(){
|
|
|
+ this.getTreeList()
|
|
|
+ },
|
|
|
+ components: {},
|
|
|
+ methods: {
|
|
|
+ //返回添加页
|
|
|
+ backAdd() {
|
|
|
+ uni.navigateBack()
|
|
|
+ },
|
|
|
+ // 仓库数据
|
|
|
+ changeDimension(dimension) {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ })
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
+ try {
|
|
|
+ let params = {
|
|
|
+ // assetName: this.assetName,
|
|
|
+ // dimension: this.dimension,
|
|
|
+ pageNum: this.pageNum,
|
|
|
+ size: 15,
|
|
|
+ categoryLevelId: this.categoryLevelId
|
|
|
+ }
|
|
|
+ const api = dimension == 1 ? getProductList : dimension == 2 ?
|
|
|
+ getBatchDetails : dimension == 3 ? getInventoryDetails : getMaterielDetails;
|
|
|
+ let res = await api(params);
|
|
|
+ this.tableList = res.list.map((el) => {
|
|
|
+ el.modelType = el.categoryModel;
|
|
|
+ el.name = el.categoryName;
|
|
|
+ el.code = el.categoryCode;
|
|
|
+ return el;
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ uni.hideLoading();
|
|
|
+ resolve();
|
|
|
+ console.log(res, 'res')
|
|
|
+ } catch (error) {
|
|
|
+ uni.hideLoading()
|
|
|
+ reject()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ classification() {
|
|
|
+ this.$refs.treePicker._show();
|
|
|
+ console.log('选择分类')
|
|
|
+ },
|
|
|
+ scrolltolower() {
|
|
|
+ // if (this.isEnd) {
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // this.getList();
|
|
|
+ },
|
|
|
+ // 选择
|
|
|
+ selectVal(e, val, index) {
|
|
|
+ this.$set(this.tableList[index], 'checked', !this.tableList[index].checked);
|
|
|
+ this.tableList.forEach((item, i) => {
|
|
|
+ if (item.id != val.id) {
|
|
|
+ this.$set(this.tableList[i], 'checked', false)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(this.tableList, 'list - - ')
|
|
|
+ },
|
|
|
+ getTreeList() {
|
|
|
+ treeByPid({
|
|
|
+ ids: [6]
|
|
|
+ }).then(res => {
|
|
|
+ this.classificationList = res;
|
|
|
+ this.confirm(res[0].id, res[0].name, res[0].rootCategoryLevelId)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ confirm(id, name, rootCategoryLevelId) {
|
|
|
+ // this.rootCategoryLevelId = rootCategoryLevelId
|
|
|
+ this.categoryLevelId = id;
|
|
|
+ this.tableList = [];
|
|
|
+ this.changeDimension(this.dimension);
|
|
|
+ },
|
|
|
+ jumpAdd(){
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+ @import url('@/pages/salesServiceManagement/demandList/components/invoice.scss');
|
|
|
+
|
|
|
+ .mainBox {
|
|
|
+ height: 100vh;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+
|
|
|
+ .wrapper {
|
|
|
+ // flex: 1;
|
|
|
+ height: calc(100vh - 250rpx);
|
|
|
+ overflow: hidden;
|
|
|
+ }
|
|
|
+
|
|
|
+ //底部按钮
|
|
|
+ .footer {
|
|
|
+ height: 45px;
|
|
|
+ position: relative;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+ bottom: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 50px;
|
|
|
+ border-top: 1px solid #eeecec;
|
|
|
+ background-color: #ffffff;
|
|
|
+ z-index: 999;
|
|
|
+
|
|
|
+ .bottom {
|
|
|
+ margin-left: 10rpx;
|
|
|
+ }
|
|
|
+
|
|
|
+ .u-reset-button {
|
|
|
+ position: absolute;
|
|
|
+ right: 10rpx;
|
|
|
+ top: 20rpx;
|
|
|
+ width: 150rpx;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|