You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							360 lines
						
					
					
						
							9.0 KiB
						
					
					
				
			
		
		
	
	
							360 lines
						
					
					
						
							9.0 KiB
						
					
					
				| <template> | |
|   <div class="order"> | |
|     <div class="frame"> | |
|       <el-input | |
|         class="mr20" | |
|         v-model="parameter.params.productName" | |
|         placeholder="产品名称" | |
|         clearable | |
|       ></el-input> | |
|       <!-- <el-select | |
|         v-model="parameter.params.refineryId" | |
|         placeholder="炼厂名称" | |
|         clearable | |
|       > | |
|         <el-option | |
|           v-for="item in refineryList" | |
|           :key="item.id" | |
|           :label="item.refineryName" | |
|           :value="item.id" | |
|         > | |
|         </el-option> | |
|       </el-select> --> | |
|       <el-select | |
|         v-model="parameter.params.productType" | |
|         placeholder="产品类型" | |
|         clearable | |
|       > | |
|         <el-option | |
|           v-for="(item, index) in productTypeList" | |
|           :key="index" | |
|           :label="item.label" | |
|           :value="item.value" | |
|         > | |
|         </el-option> | |
|       </el-select> | |
|  | |
|       <autocomplete :params="parameter.params" :config="configAutocomplete" /> | |
|       <!-- <el-input | |
|         v-model="parameter.params.belongLibrary" | |
|         placeholder="所处炼厂库" | |
|         clearable | |
|       ></el-input> | |
|       <el-select | |
|         v-model="parameter.params.enableMark" | |
|         placeholder="启用禁用" | |
|         clearable | |
|       > | |
|         <el-option label="启用" value="ENABLE"> </el-option> | |
|         <el-option label="禁用" value="DISABLE"> </el-option> | |
|       </el-select> --> | |
|  | |
|       <div class="buttons"> | |
|         <el-button icon="el-icon-search" @click="search">查询</el-button> | |
|         <el-button icon="el-icon-refresh" @click="reset">重置</el-button> | |
|       </div> | |
|     </div> | |
|     <div class="table"> | |
|       <div class="operation"> | |
|         <el-button @click="createOrder">下单</el-button> | |
|       </div> | |
|       <el-table | |
|         v-if="tableHeight" | |
|         ref="multipleTable" | |
|         :height="tableHeight" | |
|         :data="tableData" | |
|         style="width: 100%" | |
|       > | |
|         > | |
|         <el-table-column | |
|           prop="productName" | |
|           label="产品名称" | |
|           show-overflow-tooltip | |
|         > | |
|         </el-table-column> | |
|         <el-table-column prop="productType" label="产品类型"> </el-table-column> | |
|         <el-table-column | |
|           prop="refineryName" | |
|           label="炼厂名称" | |
|           show-overflow-tooltip | |
|         > | |
|         </el-table-column> | |
|         <el-table-column | |
|           prop="belongLibrary" | |
|           label="所属炼厂库" | |
|           show-overflow-tooltip | |
|         > | |
|         </el-table-column> | |
|         <el-table-column prop="refineryLevel" label="企业销售价" width="100"> | |
|           <template slot-scope="{ row }"> | |
|             {{ row.salePrice2company }}/{{ row.measurement }} | |
|           </template> | |
|         </el-table-column> | |
|         <el-table-column label="时间" width="235"> | |
|           <template slot-scope="{ row }"> | |
|             <p class="gray"> | |
|               创建时间 <span>{{ row.createTime }}</span> | |
|             </p> | |
|             <p class="gray"> | |
|               更新时间 <span>{{ row.updateTime || " - -" }}</span> | |
|             </p> | |
|           </template> | |
|         </el-table-column> | |
|         <el-table-column label="操作" width="210"> | |
|           <template slot-scope="{ row }"> | |
|             <span class="el-dropdown-link" @click="detail(row)">详情</span> | |
| 
 | |
|             <span class="el-dropdown-link" @click="updateCreate(row)" | |
|               >下单</span | |
|             > | |
|           </template> | |
|         </el-table-column> | |
|       </el-table> | |
|       <!-- 分页 --> | |
|       <pagination :parameter="parameter" @searchAgain="getByPage" /> | |
|     </div> | |
|     <!-- 下单 --> | |
|     <create :controlWindows="controlWindows" @closeWindow="search" /> | |
|     <!-- 详情 --> | |
|     <el-drawer | |
|       title="详情" | |
|       direction="ltr" | |
|       size="60%" | |
|       :withHeader="false" | |
|       :visible="controlWindows.detail" | |
|     > | |
|       <general-details | |
|         title="详情" | |
|         :isHeader="true" | |
|         v-if="controlWindows.detail" | |
|         :sourceData="oilCompanyMatch" | |
|         :mappingData="mappingData" | |
|         @close="controlWindows.detail = false" | |
|       > | |
|         <template #enableMark> | |
|           <p> | |
|             {{ oilCompanyMatch[0].enableMark === "ENABLE" ? "启用" : "禁用" }} | |
|           </p> | |
|         </template> | |
|       </general-details> | |
|     </el-drawer> | |
|   </div> | |
| </template> | |
| 
 | |
| <script> | |
| import serve from "api/product.js"; | |
| 
 | |
| import create from "./components/create.vue"; | |
| 
 | |
| import pagination from "components/pagination/index.vue"; | |
| import autocomplete from "components/autocomplete/index.vue"; | |
| import generalDetails from "components/generalDetails/index.vue"; | |
| 
 | |
| export default { | |
|   components: { | |
|     create, | |
|     pagination, | |
|     autocomplete, | |
|     generalDetails, | |
|   }, | |
|   data() { | |
|     return { | |
|       controlWindows: { | |
|         addInfo: {}, | |
|         detail: false, | |
|         create: false, | |
|       }, | |
|       productTypeList: [ | |
|         { | |
|           label: "0#柴", | |
|           value: "0#", | |
|         }, | |
|         { | |
|           label: "-10#柴", | |
|           value: "-10#", | |
|         }, | |
|         { | |
|           label: "92#汽", | |
|           value: "92#", | |
|         }, | |
|         { | |
|           label: "95#汽", | |
|           value: "95#", | |
|         }, | |
|       ], | |
|       configAutocomplete: { | |
|         serveTarget: serve.findByEntity, | |
|         autocompleteKey: "refineryName", | |
|         valueKey: "refineryName", | |
|         placeholder: "炼厂名称", | |
|         querykey: "refineryId", | |
|       }, | |
|       refineryList: [], | |
|       tableHeight: 0, | |
|       tableData: [], | |
|       parameter: { | |
|         currentPage: 1, | |
|         pageSize: 10, | |
|         total: 0, | |
|         params: {}, | |
|       }, | |
|       oilCompanyMatch: [], | |
|       mappingData: [ | |
|         { | |
|           carTitle: "", | |
|           carItems: [ | |
|             { label: "炼厂id", value: "refineryId" }, | |
|             { label: "炼厂名称", value: "refineryName" }, | |
|             { label: "产品名称", value: "productName" }, | |
|             { label: "产品类型", value: "productType" }, | |
|             { label: "企业销售价", value: "salePrice2company" }, | |
|             { label: "计量单位", value: "measurement" }, | |
|             { label: "启用/禁用", value: "enableMark" }, | |
|             { label: "所属炼厂库名", value: "belongLibrary" }, | |
|             { label: "创建时间", value: "createTime" }, | |
|             { label: "修改时间", value: "updateTime" }, | |
|           ], | |
|         }, | |
|       ], | |
|     }; | |
|   }, | |
| 
 | |
|   mounted() { | |
|     this.$nextTick(() => { | |
|       this.heightHandle(); | |
|     }); | |
|     window.addEventListener( | |
|       "resize", | |
|       this.$utils.debounce(this.heightHandle, 500) | |
|     ); | |
|   }, | |
|   created() { | |
|     this.getByPage(); | |
|   }, | |
|   methods: { | |
|     search() { | |
|       this.parameter.currentPage = 1; | |
|       this.getByPage(); | |
|     }, | |
|     //table list | |
|     getByPage() { | |
|       this.parameter.params["enableMark"] = "ENABLE"; | |
|       serve.getByPage(this.parameter).then((res) => { | |
|         this.tableData = res.data.list; | |
|         this.parameter.total = res.data.totalCount; | |
|       }); | |
|     }, | |
|     //下单 | |
|     createOrder(row) { | |
|       this.controlWindows.addInfo = {}; | |
|       this.controlWindows.addInfo.title = "创建订单"; | |
|       this.controlWindows.create = true; | |
|       console.log(this.controlWindows, "新增"); | |
|     }, | |
|     //修改订单 | |
|     updateCreate(row) { | |
|       this.controlWindows.addInfo = { | |
|         title: "创建订单", | |
|         ...row, | |
|       }; | |
|       this.controlWindows.create = true; | |
|       console.log("修改"); | |
|     }, | |
|     //详情 | |
|     detail(row) { | |
|       this.oilCompanyMatch = [row]; | |
|       this.controlWindows.detail = true; | |
|     }, | |
|     //重置 | |
|     reset() { | |
|       Object.assign(this.parameter, { | |
|         currentPage: 1, | |
|         pageSize: 10, | |
|         params: {}, | |
|       }); | |
|     }, | |
|     // table height | |
|     heightHandle() { | |
|       let bodyHeight = document.body.clientHeight; | |
|       let frameHeight = this.obtainElement(".frame").clientHeight; | |
|       let operationHeight = this.obtainElement(".operation").clientHeight; | |
|       let paginationHeight = this.obtainElement(".el-pagination").clientHeight; | |
|       this.tableHeight = | |
|         bodyHeight - frameHeight - operationHeight - paginationHeight - 145; | |
|     }, | |
|     obtainElement(className) { | |
|       return document.documentElement.querySelector(className); | |
|     }, | |
|   }, | |
| }; | |
| </script> | |
| 
 | |
| <style lang="scss" scoped> | |
| .order { | |
|   .frame { | |
|     margin: 20px; | |
|     padding: 20px; | |
|     // width: 100%; | |
|     border-radius: 6px; | |
|     border: 1px solid #e3e3e5; | |
|     background: #fff; | |
|     .el-input, | |
|     .el-select { | |
|       width: 183px; | |
|       height: 40px; | |
|     } | |
|     .el-input + .el-input, | |
|     .el-input + .el-select, | |
|     .el-select + .el-select, | |
|     .el-select + .el-input { | |
|       margin-right: 20px; | |
|       margin-bottom: 15px; | |
|     } | |
|     .mr20 { | |
|       margin-right: 20px; | |
|     } | |
|     .buttons { | |
|       text-align: right; | |
|     } | |
|   } | |
| 
 | |
|   .table { | |
|     overflow: hidden; | |
|     margin: 0 20px; | |
|     padding-bottom: 20px; | |
|     background: #fff; | |
|     border-radius: 6px; | |
|     border: 1px solid #e3e3e5; | |
|     > .operation { | |
|       box-sizing: content-box; | |
|       padding: 15px; | |
|     } | |
|     .gray { | |
|       color: #999; | |
|       span { | |
|         color: #333; | |
|       } | |
|     } | |
|     .el-table { | |
|       margin-bottom: 20px; | |
|       border-radius: 10px 10px 0px 0px; | |
|     } | |
|     // .el-link, | |
|     // .el-dropdown { | |
|     //   margin-right: 10px; | |
|     // } | |
|  | |
|     .el-dropdown-link { | |
|       margin-right: 10px; | |
|       cursor: pointer; | |
|       color: #409eff; | |
|       &.special { | |
|         margin-right: 0; | |
|       } | |
|     } | |
|     .el-icon-arrow-down { | |
|       font-size: 12px; | |
|     } | |
|   } | |
| } | |
| </style>
 | |
| 
 |