inventory-analyze2.vue 17.2 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
<template>
	<div class="container resource close-left-menu contaNEW">

		<div class="pop-banner clearfix">
			<!-- <div class="operate-btns">
				<a href="javascript:;" class="fbtn fb-export">导出</a>
			</div> -->
			<h3 class="current-module">库存数据分析</h3>
		</div>

		<nav class="o_nav_4 clearfix" style='display:inline-block; margin-left:34%;'>
			<li>
				<a class="pandect-sort" href="javascript:;" v-link="{path:'/inventoryAnalyze'}"></a>
			</li>
			<!--     <li><a class="region-sort" href="#"></a></li>
	      <li><a class="hospital-sort active" href="#"></a></li>
	      <li><a class="firm-sort" href="#"></a></li> -->
			<li>
				<a class="category-sort active" href="javascript:;"></a>
			</li>
			<!-- <li><a class="salesman-sort" href="#"></a></li> -->
		</nav>

		<div class="pd-form mt-20 fast-search-form"> 
				<div class="group-row">
				<div class="form-group">
					<div class="control select-style fl">
						<input type="text" v-model="search.search_Producer" placeholder="产品名称、厂家名称">
					</div>
				</div>
				<div class="form-group form-label">
					<label class="label">选择医院</label>
					<div class="control select-style">
						<select v-model="medguid" class="inp4"> 
					                <option v-for="option in getMedLists" v-bind:value="option.medguid">
					                  {{option.medname}}
					                </option>
					            </select>
					</div>
				</div>
			</div>
			<div class="group-row">
				<div class="form-group">
					<label for="cn3" class="label label-xf"></label>
					<div class="control control-date" style="width: 460px;height:34px;overflow: inherit;">
						<div style="width: 46%;float: left">
							<datepicker :target.sync='search.search_Start_date' :readonly="readonlyFlag" title="时间范围" placeholder="时间范围" styleobj="width:100% !important;border-radius:8px 0px 0px 8px !important;"></datepicker>
						</div>
						<span class="text-and"></span>
						<div style="width: 46%;float: left">
							<datepicker :target.sync='search.search_End_date' :readonly="readonlyFlag" title="时间范围" placeholder="时间范围" styleobj="width:100% !important;border-radius:0px 8px 8px 0px !important;"></datepicker>
						</div>
					</div>
				</div>  
			</div>
			<div class="group-row">
				<div class="form-group fl" style='width: 800px;'>
					<label for="cn3" class="label w60">时间范围</label>
					<div class="control control-filtering control-filtering-green fl" style='width:500px;'>
						<a class="all active" href="javascript:;" @click='search.search_EQ_date=0' :class="{'all active':search.search_EQ_date==0}">所有</a>
						<a class="option" href="javascript:;" style='margin: 4px 14px;' @click='search.search_EQ_date=1' :class="{'all active':search.search_EQ_date==1}">已过期</a>
						<a class="option" href="javascript:;" style='margin: 4px 14px;' @click='search.search_EQ_date=2' :class="{'all active':search.search_EQ_date==2}">近一周到期</a>
						<a class="option" href="javascript:;" style='margin: 4px 14px;' @click='search.search_EQ_date=3' :class="{'all active':search.search_EQ_date==3}">近一月到期</a>
						<a class="option" href="javascript:;" style='margin: 4px 14px;' @click='search.search_EQ_date=4' :class="{'all active':search.search_EQ_date==4}">近三月到期</a>
					</div>
				</div>
				</div>
			<div class="group-row t-right">
				<button class="fast-analy-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle" v-on:click="getData">分 析</button>
			</div>
		</div>
		<table class=" itable itable-thead-13px itable-td-long-text" >
			<thead>
				<tr>
					<th class="w50">序号</th>
					<th class="w70">医院</th>
					<th class="w230">商品</th>
					<th class="w70">单位</th>
					<th class="w100">库存数量</th>
					<th class="w130">批号</th>
					<th class="w100">生产日期</th>
					<th class="w100">有效期</th>
					<th class="w100">单价</th>
					<th class="w100">总金额</th>
					<th class="w120">操作</th>
				</tr>
			</thead>
			<tbody class="txt_v">
				<tr v-if="getStockGoodsList==null || getStockGoodsList.length==0">
					<td colspan="11">
						暂无符合条件的记录
					</td>

				</tr>
				<tr  v-for="stock in getStockGoodsList">
					<td>{{$index+1}}</td>
					<td class="t-left">{{stock.name}}</td>
					<td>
						<div class="t-left pr10">
							{{stock.goodscode}}
							<br> {{stock.goodsname}}
							<br> {{stock.goodsspec}}
							<br>  {{stock.producer}}
							<br> {{stock.registkey}}
						</div>
					</td>
					<td>{{stock.unitstyle}}</td>
					<td>{{stock.stockqty}}</td>
					<td class="t-left pr10">{{stock.lot}}</td>
					<td class="t-left pr10">{{stock.productiondate | getYMD}}</td>
					<td class="t-right pr10">{{stock.expiredate | getYMD}}</td>
					<td class="">{{stock.price | numDigit 2 | numFmt}}</td>
					<td class="t-right pr10">{{stock.price * stock.stockqty  | numDigit 2 | numFmt}}</td>
					<td>
						<a class="btn button-green mar-none" href="javascript:;" v-on:click='getSelling(stock.masterguid)'>库存分析</a>
					</td>
				</tr>
			</tbody>
		</table>
		<!-- 	    <div class="fpart ">
	      <div class="fheader">
	        <h4 class="fh-rental">总额分析</h4>
	        <div class="stretch ml-20">
	          <div class="stretch-pull">
	          </div>
	        </div>
	        <div class="from-button fr">
	          <a href="javascript:;" class="green-button icon remove">查看总额分布<i>|</i></a>
	          <a href="javascript:;" class="green-button icon save">查看各省排名</a>
	        </div>
	      </div>
	      <div class="information clearfix">
	        <div class="information-left">
	          <div class="information-left-hos">
	            <div>出库总金额</div>
	            <span>1020.35万元</span>
	          </div>
	          <div class="information-left-hos">
	            <div>最高:广东省</div>
	            <span>420.35万元</span>
	          </div>
	          <div class="information-left-hos">
	            <div>最低:西藏</div>
	            <span>90.35万元</span>
	          </div>
	        </div>
	        <div class="information-right fr" style='width:700px;'>
	        	<div id='echart1' style='width:100%;height:440px;'></div>
	        </div>
	      </div>
	    </div> -->
		<div class="fpart" v-if='falg'>
			<div class="fheader">
				<h4 class="fh-tendency">趋势分析</h4>
				<!-- <div class="stretch ml-20">
					<div class="stretch-pull">
					</div>
				</div> -->
			</div>
			<div class="pd-form mt-20 mb-20">
				<div class="group-row"> 
					<div class="form-group form-radio fl" style='width: 580px;'>
						<label class="label">时间范围:</label>
						<div class="control radio-control fl" style='width:500px;'>
							<input type="radio" name="radio" id="radio1" @click='search.dateconditions=1' :class="{'all active':search.search_EQ_date==1}">
							<label class="radio" for="radio1">近三月</label>
							<input type="radio" name="radio" id="radio2" @click='search.dateconditions=2' :class="{'all active':search.search_EQ_date==2}">
							<label class="radio" for="radio2">近六月</label>
							<input type="radio" name="radio" id="radio3" @click='search.dateconditions=3' :class="{'all active':search.search_EQ_date==3}">
							<label class="radio" for="radio3">近一年</label>
							<input type="radio" name="radio" id="radio4" @click='search.dateconditions=4' :class="{'all active':search.search_EQ_date==4}">
							<label class="radio" for="radio4">近两年</label>
							<input type="radio" name="radio" id="radio5" @click='search.dateconditions=5' :class="{'all active':search.search_EQ_date==5}">
							<label class="radio" for="radio5">近三年</label>
							<input type="radio" name="radio" id="radio6" @click="getSupDoods(6)">
							<label class="radio" for="radio6">其他</label>
						</div>
					</div>
					<div class="form-group" style="width: 414px;">
						<label for="cn3" class="label label-xf"></label>
						<div class="control control-date" style="width: 414px;height:34px;overflow: inherit;">
							<div style="width: 46%;float: left">
								<datepicker :target.sync='search.beginDate' :readonly="readonlyFlag" v-if="sh" title="开始时间" placeholder="开始时间" styleobj="width:100% !important;border-radius:8px 0px 0px 8px !important;" ></datepicker>
								<datepicker :disabled='true' :target.sync="search.beginDate" v-if="!sh" readonly="readonly" title="开始时间" placeholder="开始时间" styleobj="width:100% !important;border-radius:8px 0px 0px 8px !important;"></datepicker>
							</div>
							<span class="text-and"></span>
							<div style="width: 46%;float: left">
								<datepicker :target.sync='search.endDate' :readonly="readonlyFlag" v-if="sh" title="结束时间" placeholder="结束时间" styleobj="width:100% !important;border-radius:0px 8px 8px 0px !important;"></datepicker>
								<datepicker :disabled='true' :target.sync="search.endDate" v-if="!sh" readonly="readonly" title="结束时间" placeholder="结束时间" styleobj="width:100% !important;border-radius:8px 0px 0px 8px !important;"></datepicker>
							</div>
						</div>
					</div>
					<div class="group-row">
						<button class="fast-search-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle fr"  v-on:click="getSellingCost()">查 询</button>
					</div>
				</div>
<!-- 				<div class="group-row">
					<div class="form-group fl" style='width: 500px;'>
						<label for="cn3" class="label w60">有效期</label>
						<div class="control control-filtering control-filtering-green fl" style='width:440px;'>
							<a class="all active" href="javascript:;">所有</a>
							<a class="option" href="javascript:;" style='margin: 4px 14px;'>近一周到期</a>
							<a class="option" href="javascript:;" style='margin: 4px 14px;'>近一月到期</a>
							<a class="option" href="javascript:;" style='margin: 4px 14px;'>近三月到期</a>
							<a class="option" href="javascript:;" style='margin: 4px 14px;'>其他</a>
						</div>
					</div>
				</div> -->
			</div>
			<div class="information clearfix">
				<div class="information-left">
					<div class="information-left-hos hide">
						<div>整体评估</div>
						<span>高于90%的用户水平</span>
					</div>
					<div class="information-left-hos">
						<div>库存周转天数</div>
						<span>{{getSellingCostList.diffdays}}</span>
					</div>
					<div class="information-left-hos">
						<div>周转</div>
						<span>{{getSellingCostList.sellingtimes | getYMD}}</span>
					</div>
					<div class="information-left-hos">
						<div>销售额</div>
						<span>{{getSellingCostList.amount | numDigit 2 | numFmt}}</span>
					</div>
					<div class="information-left-hos">
						<div>库存平均</div>
						<span>{{getSellingCostList.avgcount | numDigit 2 | numFmt}}</span>
					</div>
				</div>
				<div class="information-right fr" style='width:700px;'>
					<div id='echart1' style='width:100%;height:440px;'></div>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
	var echarts_api = require('../../options/echarts_api.js')
	module.exports = {
		data: function() {
			return {
				search: {
					pageSize:5,
				            page:1,
				            totalPages:0,
				            total: 0,
					search_Start_date: '',
					search_End_date:'',
					search_EQ_date:'', 
					search_Producer:'',
					beginDate:'',
					endDate:'',
					dateconditions:'',
				},
				sh:false,
				falg:false,
				getMedLists:[],
				medguid:'',
				getStockGoodsList:[],
				getSellingCostList:[],
				datecondition:'', 
				masterguid:'',
				getMonthLinesList:[],
				getMoneyLinesList:[],
			}
		},
		    watch:{  
		     },
		methods: {
			getData: function() {
		                 var self = this;  
			      Ajax.post('/supplierSupplierReport/getStockGoods',{'datecondition':self.search.search_EQ_date,'beginDate':self.search.search_Start_date,'endDate':self.search.search_End_date,'goodsinfo':self.search.search_Producer,'medguid':self.medguid})
			      .then(function(response){
			            var data=response.data.data;  
			            self.$set("getStockGoodsList",data);     
			        })    
				// this.echarts();
			},
			getMedNameList:function(){  
			      var self = this;  
			      Ajax.post('/supplierSupplierReport/getMedList',{})
			      .then(function(response){
			            var data=response.data.data; 
			            if (response.data.errorCode==0) { 
			               self.$set("getMedLists",data);   
			             }else{
			                  layer.msg(response.data.message);
			            }   
			        })    
		    	},
		    	getSupDoods:function(val){  
			      var self = this;  
			      if(val == 6){
	      			self.sh=true;
	      			self.search.dateconditions = val;
			      }
		    	},
		    	getSelling:function(masterguid){   
		    		var self = this;  
		    		self.falg = true;
		    		self.masterguid = masterguid; 
		    		self.getSellingCost(); 
		    	},
		    	getSellingCost:function(){  
			      var self = this;   
			      Ajax.post('/supplierSupplierReport/getSellingCost',{'masterguid':self.masterguid,'datecondition':self.search.dateconditions,'beginDate':self.search.beginDate,'endDate':self.search.endDate})
			      .then(function(response){
			            var data=response.data.data; 
			            self.$set("getSellingCostList",data);     
			            if (response.data.errorCode==0) { 
			           	    self.getMonthLines();
			             }else{
			                  layer.msg(response.data.message);
			            } 
			        })    
		    	},
		    	getMonthLines:function(){  
			      var self = this;   
			      self.getMonthLinesList =[];
			      self.getMoneyLinesList =[];
			      Ajax.post('/supplierSupplierReport/getMonthLines',{'masterguid':self.masterguid,'datecondition':self.search.dateconditions,'beginDate':self.search.beginDate,'endDate':self.search.endDate})
			      .then(function(response){
			            var data=response.data.data;   

			            if (response.data.errorCode==0) {  
			            	for (var i = 0 ; i < data.length; i++) {
		            		  self.getMonthLinesList.push(data[i].month);
		            		  self.getMoneyLinesList.push(data[i].money);
			             } 
			               setTimeout(function(){
				          self.echarts();
				        }.bind(this),1000)   
			            }else{
			              layer.msg(response.data.message);
			            } 
			        })    
		    	},
			echarts: function() {
				var self = this;   
				this.chart1 = echarts_api.init('echart1', {
					title: {
						text: ''
					},
					tooltip: {
						trigger: 'axis',
						axisPointer: {
							type: 'cross',
							label: {
								backgroundColor: '#6a7985'
							}
						}
					},
					legend: {
						data: ['出库单']
					},
					toolbox: {
						feature: {
							saveAsImage: {}
						}
					},
					grid: {
						left: '3%',
						right: '4%',
						bottom: '3%',
						containLabel: true
					},
					xAxis: [{
						type: 'category',
						boundaryGap: true,
						data: self.getMonthLinesList
					}],
					yAxis: [{
						type: 'value',
						boundaryGap: false,
						data:self.getMonthLinesList
					}],
					series: [{
							name: '万元',
							type: 'line',
							stack: '总量',
							areaStyle: {
								opacity: 0
							},
							itemStyle: {
								normal: {
									borderWidth: 5,
									borderType: 'solid',
									shadowColor: '#FA9DA0',
									shadowBlur: 10
								}
							},
							color: ["#FA9DA0"],
							// data: self.getMonthLinesList,
							symbolSize: 5,
						},
						{
							name: '万元',
							type: 'line',
							stack: '总量',
							areaStyle: {
								opacity: 0
							},
							itemStyle: {
								normal: {
									borderWidth: 5,
									borderType: 'solid',
									shadowColor: '#FDD45C',
									shadowBlur: 10
								}
							},
							color: ["#FDD45C"],
							data: self.getMoneyLinesList,
							symbolSize: 5,
						},
						// {
						// 	name: '万元',
						// 	type: 'line',
						// 	stack: '总量',
						// 	areaStyle: {
						// 		opacity: 0
						// 	},
						// 	itemStyle: {
						// 		normal: {
						// 			borderWidth: 5,
						// 			borderType: 'solid',
						// 			shadowColor: '#B4D55A',
						// 			shadowBlur: 10
						// 		}
						// 	},
						// 	color: ["#B4D55A"],
						// 	data: [
						// 		200, 0, 51, 20, 60, 20, 30, 30, 20, 30,
						// 		300, 30, 30, 20, 30, 500, 20, 30, 30, 80,
						// 		800, 600, 512, 40, 60, 80, 70, 100, 800, 20,
						// 	],
						// 	symbolSize: 5,

						// },
						// {
						// 	name: '万元',
						// 	type: 'line',
						// 	stack: '总量',
						// 	areaStyle: {
						// 		opacity: 0
						// 	},
						// 	itemStyle: {
						// 		normal: {
						// 			borderWidth: 5,
						// 			borderType: 'solid',
						// 			shadowColor: '#49A7E5',
						// 			shadowBlur: 10
						// 		}

						// 	},
						// 	color: ["#49A7E5"],
						// 	data: [
						// 		200, 41, 51, 20, 60, 20, 30, 30, 20, 30,
						// 		300, 30, 30, 20, 30, 500, 20, 30, 30, 80,
						// 		800, 600, 512, 40, 60, 80, 70, 100, 800, 20,
						// 	],
						// 	symbolSize: 5,

						// },
					]

				}, 'echart1')
			}
		},
		route: {
			activate: function() {
				this.getMedNameList();
				this.getData();
				// setTimeout(function() {
				// 	this.echarts();
				// }.bind(this), 1000)
			}
		},
		watch:{
			'falg':function(){
				this.echarts();
			},
			'search.search_EQ_date':function(){
				this.getData();
			}
		}
	}
</script>