supply-list-revise.vue 10.1 KB
<template>
	<div class="container resource close-left-menu contaNEW">
		<div class="pop-banner clearfix">
			<div class="operate-btns">
				<a @click="exportsuppliergoodsPO" class="fbtn fb-export-goods ml-10 mr-10">导出商品</a>
				<a @click="downModel" class="fbtn fb-export-modifyTem ml-20">导出修改模板</a>
				<upload-excel :class="['fbtn fb-setting']" :tag="tagType" :type="fileType" :label="fileLabel" :exceltype="updGoodsImp" v-on:file-change="getBackTips"></upload-excel>
			</div>
			<h3 class="current-module">商品清单</h3>
		</div>
		<!--supply-productlist start-->
		<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="search.search_LIKE_searchtxt" placeholder="商品编码、名称、厂商、注册证号" title="商品编码、名称、厂商、注册证号">
						</div>
					</div>
					<div class="form-group">
						<label for="cn1" class="label" style="width:60px;">业务状态</label>
						<div class="control control-filtering control-filtering-green" style="width:390px;">
							<a class="{{ stateAll }}" href="javascript:void(0);" @click="bizState('3')">全部</a>
							<a class="{{ stateYes }}" href="javascript:void(0);" @click="bizState('1')">有效</a>
							<a class="{{ stateNo }}" href="javascript:void(0);" @click="bizState('0')">失效</a>
							<a class="{{ stateNY }}" href="javascript:void(0);" @click="bizState('2')">停用</a>
						</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 class="b">{{total}}</em>个商品</div>
			</div>
			<table class="itable itable-thead-13px itable-td-long-text">
				<thead id='t_header'>
					<tr>
						<th class="w50">
							<div class="checkbox-control fl">
								<input type="checkbox" :id="1" @click="selectAllsum(selectAllList)" v-model="selectAllList" :value="1">
								<label class="checkbox mr-0 ml-5" style="line-height: 19px;" :for="1"></label>
							</div>
							序号
						</th>
						<th class="w70">商品编号</th>
						<th class="w140">商品名称</th>
						<th class="w100">招标平台编码</th>
						<th class="w140">生产厂商</th>
						<th class="w130">注册证号</th>
						<!--<th class="w50">生产来源</th>-->
						<!--<th class="w70">产地</th>-->
						<th class="w50">业务状态</th>
						<th class="w70">操作</th>
					</tr>
				</thead>
				<tbody>
					<tr v-for="hospitalProduct in hospitalProductList">
						<td>
							<div class="checkbox-control">
								<input type="checkbox" :id="hospitalProduct.guid+$index" v-model="checkArr" :value="hospitalProduct.guid">
								<label class="checkbox" :for="hospitalProduct.guid+$index">{{$index + 1 | getIndex}}</label>
							</div>
						</td>
						<td class="t-left pr10">{{hospitalProduct.goodscode}}</td>
						<td class="t-left pr10">{{hospitalProduct.goodsname}}<br>{{hospitalProduct.unitstyle}}
							<br>{{hospitalProduct.minunitqty}}{{hospitalProduct.minunitstyle}}</td>
						<td class="t-left pr10">{{hospitalProduct.tenderplatformcode}}</td>
						<td class="t-left pr10">{{hospitalProduct.producer}}</td>
						<td>{{hospitalProduct.registkey}}</td>
						<!--<td>{{hospitalProduct.importedflag | IMPORTEDFLAG}}</td>-->
						<!--<td>{{hospitalProduct.productionaddress}}</td>-->
						<td v-bind:class="{'' : hospitalProduct.bizstate == ctns.bizstatey}" v-if="hospitalProduct.bizstate == ctns.bizstatey">{{hospitalProduct.bizstate | BIZSTATE}}</td>
						<td v-bind:class="{'text-color-red' : hospitalProduct.bizstate != ctns.bizstatey}" v-if="hospitalProduct.bizstate != ctns.bizstatey">{{hospitalProduct.bizstate | BIZSTATE}}</td>
						<td class="pt5">
							<a class="btn button-green mar-none" v-link="{path: '/supplyProductview/' + hospitalProduct.guid}">明细</a>
						</td>
					</tr>
				</tbody>
			</table>
			<pagination @page-change="getData(false)" :class="['m-20-0']" :page-no.sync="search.page" :total-pages.sync="search.totalPages"></pagination>
		</div>

		<div class="modal" :class="backMessage.modal=='Y'?'':'hide'">
			<div class="resource" style='margin: 0 auto;width: 1003px;'>
				<div class="audit-detail mt-50" style="width:540px;margin:0 auto;">
					<span class="close-win" v-on:click="close()"></span>

					<div class="sdiv-9-9b">
						<a class="btn-d btn-d-activate btn-d-lg" href="javascript:;">信息提示</a>
					</div>

					<div class="status-process wbe-0 clearfix pd20 mr-10" style="padding-top:0px;height: 200px;overflow: auto;">

						<div class="sp-head sp-headb" v-for="m in backMessage.list" track-by='$index'>
							<span class="sp-col" style='width:400px;margin-left:50px;'>
                <span class="control radio-control ">
                  <span>{{m}}</span>
							</span>
							</span>
						</div>

					</div>
					<div class="sdiv9-9" style='margin:0 20px;'>
						<button v-on:click="close()" class="btn-d btn-d-activate btn-d-lg">关闭</button>
					</div>
				</div>
			</div>
		</div>
		<!--star 9-9 弹出导入提示信息-->
		<div class="modal " :class="backMessage.showDialog=='Y'?'':'hide'">
			<div class="container resource">
				<div class="audit-detail" style="width:540px;">
					<span class="close-win" v-on:click="closeDialog()"></span>

					<div class="sdiv-9-9b">
						<a class="btn-d btn-d-activate btn-d-lg" href="javascript:;">导入信息提示</a>
					</div>

					<div class="status-process wbe-0 clearfix pd20" style="padding-top:0px;">
						<div class="sp-head sp-headb" v-for="m in backMessage.mList" track-by="$index">
							<span class="sp-col w300">
                    <span class="control radio-control ">
                      <span>{{m}}</span>
							</span>
							</span>
						</div>

					</div>
					<div class="sdiv9-9">
						<button v-on:click="closeDialog()" class="btn button-red mar-none">关闭</button>
					</div>
				</div>
			</div>
		</div>

	</div>
</template>

<script>
	module.exports = {
		data: function() {
			return {
				fileType: 'file',
				tagType: 'a',
				updGoodsImp: 'updGoodsImp',
				fileLabel: '批量修改商品 ( 请使用模板 )  ',
				hospitalProductList: [],
				stateAll: 'all active',
				stateNo: 'option',
				stateYes: 'option',
				stateNY: 'option',
				search: {
					pageSize: 50,
					page: 1,
					totalPages: 0,
					search_LIKE_searchtxt: '',
					search_EQ_bizState: '',
					search_EQ_medguid: '',
				},
				medGuid: '',
				total: 0,
				backMessage: {
					modal: 'N',
					list: []
				},
				checkArr: [], //导出
				checkArrList: '',
				selectAllList: false,
				backMessage: {
					showDialog: 'N'
				},
			};
		},
		methods: {
			bizState: function(flag) {
				var self = this;
				if(flag == 3) {
					self.$set('stateAll', "all active option");
					self.$set('stateNo', "option");
					self.$set('stateYes', "option");
					self.$set('stateNY', "option");
					self.$set('search.search_EQ_bizState', '');
				} else if(flag == 1) {
					self.$set('stateAll', "option");
					self.$set('stateNo', "option");
					self.$set('stateYes', "all active option");
					self.$set('stateNY', "option");
					self.$set('search.search_EQ_bizState', "Y");
				} else if(flag == 0) {
					self.$set('stateAll', "option");
					self.$set('stateNo', "all active option");
					self.$set('stateYes', "option");
					self.$set('stateNY', "option");
					self.$set('search.search_EQ_bizState', "E");
				} else if(flag == 2) {
					self.$set('stateAll', "option");
					self.$set('stateNY', "all active option");
					self.$set('stateYes', "option");
					self.$set('stateNo', "option");
					self.$set('search.search_EQ_bizState', "S");
				}
				self.getData();
			},
			getData: function(isRefresh) {
				var self = this;
				if(isRefresh) {
					this.search.page = 1;
				}
				Ajax.post('/supplyProduct/supplyProductList', this.search)
					.then(function(response) {
						var data = response.data.data;
						if(response.data.errorCode == 0) {
							self.$set('hospitalProductList', data.list);
							self.search.totalPages = data.totalPages;
							self.total = data.total;
							self.medGuid = self.$store.state.user.curUser.medguid;
						} else {
							layer.msg(response.data.message);
						}
					})
			},
			close: function() {
				this.$set('backMessage.modal', 'N');
			},
			// 导出商品清单  zxx
			exportsuppliergoodsPO: function() {
				var self = this;

				if(!self.checkArrList){
						layer.msg('请选择要导出的商品');
						return;
				}
				Ajax.post('/hospital/exportMfMedgoodsList', {
						list: self.checkArrList
					})
					.then(function(response) {
						var data = response.data;
						window.open(data);
					})
			},

			selectAllsum: function(flag) {
				var self = this;
				if(!flag) {
					self.$set('checkArr', []);
					self.hospitalProductList.forEach(function(item, i) {
						var data = item.guid;
						self.checkArr.push(data);
					});
				} else {
					self.$set('checkArr', []);

				}

			},

			//			批量导入医疗机构商品
			getBackTips: function(data) {
				var self = this;
				console.log(data)
				if(data.iGoodsList.length >= 0) {
					self.goodList = data.iGoodsList;
				}
				if(data.resList.length != 0) {
					// 返回信息
					self.$set('backMessage.showDialog', 'Y');
					self.$set('backMessage.mList', data.resList);
					return;
				}

			},
			closeDialog: function() {
				this.$set('backMessage.showDialog', 'N');
				this.$set('backMessage.mList', []);
				this.getData(true);
			},
			downModel: function() {
				var self = this;
				// 如果是医院端,后边传参数med
				window.open('https://obs.myhwclouds.com/csylcloud-file/templet/HosGoodImp.xls');
			},
		},
		watch: {
			'checkArr': function(val) {
				var self = this;
				var arr, oList;
				self.checkArrList = [];
				for(let i = 0; i < val.length; i++) {
					arr = val[i].split('/');
					oList = {
						'guid': arr[0],
					}
					self.checkArrList.push(oList)
				}

			},

		},
		route: {
			activate: function() {
				this.getData(true);
			}
		}
	};
</script>