motion-plan.vue 6.35 KB
<template>
	<div style="min-height: 806px;" class="container resource close-left-menu contaNEW">
		<div class="pop-banner clearfix w1003">
			<!-- <div class="operate-btns">
          	    <a class="fbtn fb-add" v-link="{path:'/basicMessageForm/0'}" href="javascript:;">批量添加</a>
            </div> -->
			<h3 class="current-module">自动生成计划</h3>
		</div>
		<!--purchase-return-goods start-->
		<div class="purchase-return-goods">
			<div class="step-tips step-3 clearfix">
				<div class="step-item active"><span>1</span>选择库存紧缺商品</div>
				<div class="step-item"><span>2</span>分配供应商</div>
				<div class="step-item"><span>3</span>完成</div>
			</div>
		</div>
		<div class="supply-productlist clearfix">
	      <div class="pd-form fast-search-form" style="padding:10px;">
	        <div class="group-row">
	          <div class="form-group">
	            <div class="control">
	              <input type="text" id="cn1" maxlength="50" v-rule v-model="goodsflag"  placeholder="商品编码、商品名称、注册证号" title="商品编码、商品名称、注册证号">
	           </div>
	          </div>
	          <div class="form-group">
	          	 <div class="control select-style form-label">
		        	<label class="label">库存量</label>
		            <select class="inp3" v-model='qtyflag'>
		            	<option value="1"><下限的</option>
		               <option value="2">下限的25%</option>
		               <option value="3">下限的50%</option>
		               <option value="4">下限的75%</option>
		            </select>
		          </div>
	          </div>
	     	</div>
	     	<div class="group-row t-right">
	          	<button class="fast-search-form-btn btn-d btn-d-lg btn-d-activate btn-d-circle" @click="getData">查 询</button>
	      	</div>
	      </div>
	      <div class="search-result">
	      	 <div class="statistics">您当前共添加<em @click='list=newList'>{{newList.length}}</em>个商品</div>
	      </div>
		     <table class="itable itable-thead-13px itable-td-long-text">
		        <thead>
		          <tr>
		           <th class="w70">
		           	  <div class="checkbox-control">
						<input type="checkbox" name="cb2" id="cn8" v-model="itemChecked">
						<label class="checkbox mr-0" for="cn8" style='line-height: inherit;'>序号</label>
					  </div>
		           </th>
		           <th class="w280">商品</th>
		           <!--<th class="w140">商品</th>-->
		           <!--<th class="w140">生产<br>厂商</th>-->
		           <!--<th class="w130">注册证号/<br/>批准文号</th>-->
		           <th class="w100">存库量</th>
		           <th class="w30"></th>
		           <th class="w100">库存上下限</th>
		           <th class="w100">推荐量</th>
		           <th class="w100">采购量</th>
		           <th class="w120">单价</th>
		           <th class="w100">金额</th>
		          </tr>
		       </thead>
		       <tbody>
		       	<tr v-if="list.length==0">
		          <td colspan="15" >
		          暂无符合条件的记录
		          </td>
		        </tr>
				<!---->
		         <tr v-for='item in list'>
		           <td>
		           	<div class="checkbox-control">
		           		<input type="checkbox" :id="item.guid" v-model='item.checked'>
						<label class="checkbox mr-0" :for="item.guid" style="line-height: inherit;">{{$index+1}}</label>
		           	</div>
		           </td>
		           <td class="t-left">
					   <div class="goods_con">  {{item.goodscode}}
						   <br>
						   <span class="p-tit-green">{{item.goodsname}}</span>
						   <br> {{item.goodsspec}}
						   <br> {{item.unitstyle}}
						   <br> {{item.producer}}
						   <br> {{item.registkey}}
					   </div>
				   </td>
		           <!--<td class="t-left">-->
		           	<!--{{item.goodsname}}-->
		           	<!--<br>-->
		           	<!--{{item.goodsspec}}-->
		           	<!--<br>-->
		           	<!--{{item.unitstyle}}-->
		           <!--</td>-->
		           <!--<td class='t-left'>{{item.producer}}</td>-->
		           <!--<td>{{item.registkey}}</td>-->
		           <td>{{item.stockQty}}</td>
		           <td>
		           	<span class="table-detail-icon"></span>
		           	<span class="table-detail-icon mt-10"></span>
		           </td>
		           <td class="t-right pr10">
			           <div>{{item.stockUpperLimit}}</div>
			           <div class="mt-10">{{item.stockLowerLimit}}</div>
		           </td>
		           <td class="t-right pr10">{{item.safetyStock}}</td>
		           <td><input type="text" v-model='item.poqty'></td>
		           <td>{{item.arriveprice}}</td>
		           <td>{{item.arriveprice*item.poqty}}</td>
		         </tr>
		       </tbody>
		      </table>
		    </div>
		    <div class="step-btn">
				<a href="javascript:;" @click='next'>下一步,分配供应商&gt;&gt;</a>
			</div>
	</div>
</template>
<script>
	module.exports = {

		data: function() {
			return {
				goodsflag:'',
				qtyflag:1,
				list:[],
				itemChecked:false,
				newList:[]
			};
		},
		methods: {
			getData:function(){
				var self=this;
				Ajax.post('/hospitalTrmedplan/listmedstockgoods',{'goodsflag':self.goodsflag,'qtyflag':self.qtyflag})
					.then(function(response) {
						var res = response.data.data;
						if(response.data.errorCode==0){
							for(var a=0;a<res.length;a++){
					      		res[a].checked=false;
					      	}
							self.list=res;
						}
					});
			},
			next:function(){
				var self=this;
				console.log(self.newList);
				if(self.newList.length==0){
					layer.msg('请选择商品');
				}else{
					Ajax.post('/hospitalTrmedplan/saveAutoTrmedplan',{'mfmedstockgoodsList':self.newList})
					.then(function(response) {
						if(response.data.errorCode==0){
							self.$router.go({'path':'/motionPlan2'})
						}
					});
				}

			},
		},
		// 画面初始化
		route: {
			activate: function() {
				this.getData();
			}
		},
		watch:{
			'itemChecked':function(){
				var self=this;
		      	for(var a=0;a<self.list.length;a++){
		      		self.$set('list['+a+']',Object.assign({}, self.list[a], { 'checked': self.itemChecked}));
		      	}

			},
			'list':{
				handler(checkbox){
           var self=this;
					self.newList=[];
					for(var a=0;a<checkbox.length;a++){
		      			if(checkbox[a].checked){
		      				self.newList.push(checkbox[a]);
		      			}
		      		}
	       },
	       deep:true
			}
		}
	};
</script>