| 
					
				 | 
			
			
				@@ -1,7 +1,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <!-- BOM清单 --> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   <div class="product-management"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    <template v-if="!addOrUpdateVisible && !changeFormVisible && !attachVisible && !detailVisible && !craftsVisible && !drawVisible && !changeVisible && !noticeChangeVisible"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <template v-if="!addOrUpdateVisible && !changeFormVisible && !attachVisible && !detailVisible && !craftsVisible && !drawVisible && !changeVisible && !noticeChangeVisible && !importVisible"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-form-item label="名称"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-input v-model="dataForm.productName" placeholder="物料名称" clearable/> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -26,6 +26,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-button @click="search()">查询</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-button v-if="isAuth('pro:product:save')" type="primary" @click="addOrUpdateHandle(0, false)">新建</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           <el-button v-if="isAuth('pro:product:noteChangeConfig')" type="primary" @click="setNoticeChangeHandel()">变更通知人设置</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-button type="primary" @click="importFromExcel">导入清单</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-button type="primary" @click="templateDownload">清单模板下载</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </el-form> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <el-table 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -263,10 +265,28 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <notice-change-setting v-if="noticeChangeVisible" ref="noticeChangeSetting" @onChose="onChose"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <change-form v-if="changeFormVisible" ref="changeForm" @refreshDataList="getDataList" @onChose="onChose"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-dialog title="导入清单" :visible.sync="importVisible"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-upload 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          class="upload-demo" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          ref="upload" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :on-remove="handleRemove" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          action="#" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :limit="1" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :file-list="fileList" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :auto-upload="false" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          :http-request="handleUpload" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-button slot="trigger" size="small" type="primary">选取文件</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          <el-button size="small" type="success" @click="submitUpload">开始上传</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </el-upload> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      </el-dialog> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 <script> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  import Vue from 'vue' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import AddOrUpdate from './product-add-or-update' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import Detail from './product-detail' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import { getDictList } from '@/api/dict' 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -277,6 +297,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import NoticeChangeSetting from './product-notice-change-setting' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import ChangeForm from './product-change' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   import {bomStateOption, writeStateOption} from '@/utils/enums' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  import UploadComponent from '@/views/modules/common/upload-component-v2' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     name: 'product-management', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     components: { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -286,7 +308,8 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       AddOrUpdate, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       Detail, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       NoticeChangeSetting, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      ChangeForm 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      ChangeForm, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      UploadComponent 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     data () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       return { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -298,6 +321,7 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         changeVisible: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         noticeChangeVisible: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         changeFormVisible: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        importVisible: false, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dataForm: {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dataList: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         pageIndex: 1, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -307,7 +331,9 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         dataListSelections: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         optionsType: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         bomStateOption: bomStateOption, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        writeStateOption: writeStateOption 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        writeStateOption: writeStateOption, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        importForm: {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        fileList: [] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     created () { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -607,6 +633,48 @@ export default { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				           }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }).catch(() => {}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      importFromExcel () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.importVisible = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      handleUpload (file) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (file == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          this.$message.error('请上传清单文件') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        console.log(this.fileList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        const formData = new FormData() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        formData.append('importFile', file.file) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.$http({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          url: this.$http.adornUrl(`/biz-service/product/importExcel`), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          method: 'POST', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          data: formData 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }).then(({data}) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          if (data && data.code === '200') { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.$message({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              message: '导入成功', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              type: 'success', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              duration: 1500, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              onClose: () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                this.importVisible = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+              } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.$message.error(data.msg) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // 上传 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      submitUpload () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.$refs.upload.submit() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          // 移除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      handleRemove (file, fileList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        this.$emit('input', fileList) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      }, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      templateDownload () { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        location.href = this.$http.adornUrl(`/biz-service/product/template/download?_token=${Vue.cookie.get('token')}`) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 |