| 
					
				 | 
			
			
				@@ -2,14 +2,16 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   <div class="productRange-wrap"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 操作按钮 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <div class="table-operator"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <a-button id="productRange-brand" type="primary" class="button-error" @click="choosePModal('BRAND')">选择产品品牌</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <a-button id="productRange-type" type="primary" class="button-info" @click="choosePModal('CATEGORY')">选择产品分类</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <a-button id="productRange-product" type="primary" class="button-success" @click="choosePModal('PRODUCT')">选择供应商</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <a-button id="productRange-brand" type="primary" class="button-error" @click="choosePModal('PRODUCT_BRAND')">选择产品品牌</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <a-button id="productRange-type" type="primary" class="button-info" @click="choosePModal('PRODUCT_TYPE')">选择产品分类</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <a-button id="productRange-product" type="primary" class="button-success" @click="choosePModal('SUPPLIER')">选择供应商</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 选择产品品牌 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <chooseBrandModal :openModal="openBrandModal" :chooseData="chooseBrand" @close="openBrandModal=false" @ok="handleBrandOk" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 选择产品分类 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <chooseTypeModal :openModal="openTypeModal" :chooseData="chooseType" @close="openTypeModal=false" @ok="handleTypeOk" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <!-- 选择供应商 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <chooseSupplierModal :openModal="openSupplierModal" :chooseData="chooseSupplier" @close="openSupplierModal=false" @ok="handleSupplierOk" /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <!-- 列表 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <s-table 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       class="sTable" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -20,6 +22,15 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       :data="loadData" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       :showPagination="false" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       bordered> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <!-- 操作 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <template slot="action" slot-scope="text, record"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <a-button 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          size="small" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          type="link" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          class="button-error" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          @click="handleDel(record)" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          id="productRange-del-btn">删除</a-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </s-table> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -28,9 +39,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { STable } from '@/components' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import ChooseBrandModal from '@/views/common/chooseBrandModal.vue' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import ChooseTypeModal from '@/views/common/chooseTypeModal.vue' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import { predictRangeList } from '@/api/predict' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import ChooseSupplierModal from '@/views/common/chooseSupplierModal.vue' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import { predictRangeList, predictRangeDel } from '@/api/predict' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  components: { STable, ChooseBrandModal, ChooseTypeModal }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  components: { STable, ChooseBrandModal, ChooseTypeModal, ChooseSupplierModal }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   props: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     itemSn: { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       type: [String, Number], 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -41,14 +53,15 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     return { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       openBrandModal: false, //  选择产品品牌 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       openTypeModal: false, //  选择产品分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      openSupplierModal: false, //  选择供应商 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       chooseBrand: [], //  所选品牌 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       chooseType: [], //  所选分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      chooseSupplier: [], //  所选供应商 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       columns: [ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { title: '序号', dataIndex: 'no', width: 80, align: 'center' }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { title: '创建时间', dataIndex: 'createDate', width: 160, align: 'center', customRender: function (text) { return text || '--' } }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { title: '创建人', dataIndex: 'creatorName', align: 'center', customRender: function (text) { return text || '--' } }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { title: '状态', dataIndex: 'stateDictValue', width: 200, align: 'center', customRender: function (text) { return text || '--' } }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        { title: '操作', scopedSlots: { customRender: 'action' }, width: 200, align: 'center' } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { title: '类型', dataIndex: 'rangeTypeName', align: 'center', customRender: function (text) { return text || '--' } }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { title: '类型名称', dataIndex: 'rangeDataName', align: 'center', customRender: function (text) { return text || '--' } }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { title: '操作', scopedSlots: { customRender: 'action' }, align: 'center' } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       ], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       // 加载数据方法 必须为 Promise 对象 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       loadData: parameter => { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -57,9 +70,11 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           for (var i = 0; i < data.length; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             data[i].no = i + 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.listData = data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           return data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      listData: [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   methods: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -67,67 +82,100 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     choosePModal (type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const brandList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const typeList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      predictRangeList({ 'sn': this.itemSn }).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (res.status == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          const data = res.data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          data.map(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (item.goodsType == 'BRAND') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              brandList.push(item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } else if (item.goodsType == 'CATEGORY') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              typeList.push(item) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          if (type == 'BRAND') { //  选择品牌 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.chooseBrand = brandList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.openBrandModal = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          } else if (type == 'CATEGORY') { //  选择分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.chooseType = typeList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            this.openTypeModal = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const supplierList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.listData.map(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (item.rangeType == 'PRODUCT_BRAND') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          brandList.push(Object.assign(item, { goodsSn: item.rangeDataSn, brandSn: item.rangeDataSn })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (item.rangeType == 'PRODUCT_TYPE') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          typeList.push(Object.assign(item, { goodsSn: item.rangeDataSn, productTypeSn: item.rangeDataSn })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } else if (item.rangeType == 'SUPPLIER') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          supplierList.push(Object.assign(item, { supplierSn: item.rangeDataSn })) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      if (type == 'BRAND') { //  选择品牌 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // this.chooseBrand = brandList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (type == 'PRODUCT_BRAND') { //  选择品牌 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.chooseBrand = brandList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.openBrandModal = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } else if (type == 'CATEGORY') { //  选择分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        // this.chooseType = typeList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (type == 'PRODUCT_TYPE') { //  选择分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.chooseType = typeList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         this.openTypeModal = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (type == 'SUPPLIER') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.chooseSupplier = supplierList 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.openSupplierModal = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 品牌 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     handleBrandOk (obj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.chooseBrand = obj 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.changeData('BRAND') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.changeData('PRODUCT_BRAND') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // 分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     handleTypeOk (obj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.chooseType = obj 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      this.changeData('CATEGORY') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.changeData('PRODUCT_TYPE') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 供应商 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handleSupplierOk (obj) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.chooseSupplier = obj 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.changeData('SUPPLIER') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     changeData (type) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       const _this = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      if (type == 'BRAND') { //  选择品牌 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const dataList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      if (type == 'PRODUCT_BRAND') { //  选择品牌 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (_this.chooseBrand.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          const snList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           _this.chooseBrand.map(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            snList.push(item.brandSn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dataList.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              rangeType: type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              rangeDataSn: item.brandSn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              stockPredictSn: this.itemSn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.setData(snList, type) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      } else if (type == 'CATEGORY') { //  选择分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (type == 'PRODUCT_TYPE') { //  选择分类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (_this.chooseType.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          const snList = [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           _this.chooseType.map(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            snList.push(item.productTypeSn) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dataList.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              rangeType: type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              rangeDataSn: item.productTypeSn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              stockPredictSn: this.itemSn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      } else if (type == 'SUPPLIER') { //  选择供应商 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (_this.chooseSupplier.length > 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          _this.chooseSupplier.map(item => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            dataList.push({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              rangeType: type, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              rangeDataSn: item.supplierSn, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              stockPredictSn: this.itemSn 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          this.setData(snList, type) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      console.log('----------------选择', dataList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$emit('ok', dataList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    handleDel (row) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      const _this = this 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$confirm({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        title: '提示', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        content: '删除后不可恢复,确定要进行删除吗?', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        centered: true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        onOk () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          predictRangeDel({ stockPredictSn: row.stockPredictSn, rangeDataSn: row.rangeDataSn }).then(res => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (res.status == 200) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              _this.$message.success(res.message) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              _this.$refs.table.refresh() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    // 刷新数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    refreshList () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      this.$refs.table.refresh() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-<style lang="less"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  .productRange-wrap{} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-</style> 
			 |