| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489 | <!DOCTYPE html><html>	<head>		<title>入境登记-添加/修改</title>		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">		<meta name="viewport"			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />		<!-- 所有的 css js 资源 -->		<link rel="stylesheet" href="../../static/kj/element-ui/theme-chalk/index.css">		<link rel="stylesheet" href="../../static/sa.css">		<script src="../../static/kj/vue.min.js"></script>		<script src="../../static/kj/element-ui/index.js"></script>		<script src="../../static/kj/httpVueLoader.js"></script>		<script src="../../static/kj/jquery.min.js"></script>		<script src="../../static/kj/layer/layer.js"></script>		<script src="../../static/sa.js"></script>		<script src="../../static/kj/upload-util.js"></script>		<style type="text/css">			.c-panel .el-form .c-label {				width: 7em !important;			}			.c-panel .el-form .c-panel .el-form {				width: 180px;			}			.item-num .el-input__inner {				width: 100px;			}			.xj {				display: inline;				color: red;				margin-left: 9px;				font-weight: bold;			}			.hj {				color: red;				margin-left: 9px;				font-weight: bold;			}		</style>	</head>	<body>		<div class="vue-box" :class="{sbot: id}" style="display: none;" :style="'display: block;'">			<!-- ------- 内容部分 ------- -->			<div class="s-body">				<div class="c-panel">					<div class="c-title" v-if="id == 0">数据添加</div>					<div class="c-title" v-else>数据修改</div>					<el-form v-if="m" label-position="left">						<el-row>							<el-col span=10>								<el-card class="box-card">									<div slot="header" class="clearfix">										<span>基本资料</span>									</div>									<div>										<div class="c-item" v-show="currentCustomerId==1">											<label class="c-label">选择客户:</label>											<el-select v-model="m.customerId" placeholder="请选择" filterable>												<el-option v-for="item in customerList" :key="item.id"													:label="item.name" :value="item.id">												</el-option>											</el-select>										</div>										<div class="c-item">											<label class="c-label">运输货品:</label>											<el-select v-model="m.goodsName" placeholder="请选择" @change="goodsChange">												<el-option v-for="item in goodsList" :key="item.id" :label="item.name"													:value="item.name">												</el-option>											</el-select>										</div>										<sa-item type="text" name="境外车牌号" placeholder="请输入境外车牌号" v-model="m.cardNo" br>										</sa-item>										</sa-item>										<div class="c-item">											<label class="c-label">境外车规格:</label>											<el-autocomplete v-model="m.cardSize" placeholder="请输入车规格"												@select="handleSelectCarSize" value-key='unit'												:fetch-suggestions="queryCaSizerAsync">											</el-autocomplete>										</div>										<sa-item type="num" name="载重(吨)" placeholder="请输入车辆载重" v-model="m.netWeight" br>										</sa-item>										<sa-item type="text" name="中国车牌" placeholder="请输入中国车牌" v-model="m.chinaCarNo"											br></sa-item>										<sa-item type="text" name="中国司机" placeholder="请输入中国车司机" v-model="m.driverName"											br></sa-item>										<sa-item type="text" name="联系号码" placeholder="请输入联系号码" v-model="m.driverPhone"											br></sa-item>										<sa-item type="datetime" name="预计入场" placeholder="请选择" v-model="m.expectInDay"											br></sa-item>									</div>								</el-card>							</el-col>							<el-col span=14>								<el-card class="box-card">									<div slot="header" class="clearfix">										<span>业务项</span>									</div>									<div>										<el-form-item v-for="(type,index) in filterTypeList" style="display: flex;"											v-if="filterTypeList.length>0">											<label slot="label"><label v-if="needTypeId.indexOf(type.id)!==-1"													style="color: red;">*</label>{{type.name}}</label>											<el-select v-model="type.itemId" style="width: 120px;" placeholder="请选择">												<el-option v-for="item in type.items" :key="item.id"													:label="item.itemName" :value="item.id">												</el-option>											</el-select>											<el-input-number style="margin-left: 60px;" class="item-num"												v-model="type.num" :min="1" :max="10" size="mini"												:disabled="type.inc==0"></el-input-number>											<div class="xj" v-if="type.itemId">												{{type.items.filter(obj=>obj.id==type.itemId)[0].price*type.num}}元												<label @click="type.itemId=''"													style="margin-left: 5px;cursor: pointer">(<i														class="el-icon-delete"></i>)</label>											</div>											<el-button v-if="type.code=='p09'&&type.itemId"												@click="addPeopleFn(type.itemId,type.num)">操作</el-button>										</el-form-item>										<div v-if="filterTypeList.length==0" style="height: 400px;padding: 30px;">											请先选择运输货品										</div>										<div class="hj" v-if="totalPrice>0">											合计费用:{{totalPrice}}<label>元</label>										</div>									</div>								</el-card>							</el-col>						</el-row>					</el-form>				</div>			</div>			<!-- ------- 底部按钮 ------- -->			<div class="s-foot">				<el-button type="primary" @click="ok()">确定</el-button>				<el-button @click="sa.closeCurrIframe()">取消</el-button>			</div>			<el-dialog title="人员核酸检测" :visible.sync="modal.visible" width="80%">				<el-card class="box-card">					<div slot="header">						<span>列表</span>						<el-button style="float: right;" icon="el-icon-plus" type="primary" @click="showAddModal" v-if="modal.list.length<modal.num">添加						</el-button>					</div>					<el-table :data="modal.list">						<el-table-column prop="name" label="姓名">						</el-table-column>						<el-table-column prop="phone" label="联系号码">						</el-table-column>						<!-- <sa-td type="img-list" name="核酸报告" prop="ticket"></sa-td> -->						<el-table-column label="操作">							<template slot-scope="s">								<!-- <el-button class="c-btn" type="primary" @click="uploadFn(s.row)">上传</el-button> -->								<el-button class="c-btn" type="info" @click="editFn(s.row)">修改</el-button>								<el-button class="c-btn" type="danger" @click="deleteFn(s.row)">删除</el-button>							</template>						</el-table-column>					</el-table>				</el-card>				<span slot="footer" class="dialog-footer">					<el-button @click="cancelAdd">取 消</el-button>					<el-button type="primary" @click="modal.visible=false">确 定</el-button>				</span>			</el-dialog>			<el-dialog title="人员核酸检测" :visible.sync="addModal.visible" width="400">				<span>					<el-form label-position="left">						<sa-item type="text" name="姓名" placeholder="姓名" v-model="addModal.form.name" br></sa-item>						<sa-item type="text" name="联系号码" placeholder="联系号码" v-model="addModal.form.phone" br></sa-item>					</el-form>				</span>				<span slot="footer" class="dialog-footer">					<el-button @click="addModal.visible = false">取 消</el-button>					<el-button type="primary" @click="confirmAdd">确 定</el-button>				</span>			</el-dialog>		</div>		<script>			var app = new Vue({				components: {					"sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),					"sa-td": httpVueLoader('../../sa-frame/com/sa-td.vue')				},				el: '.vue-box',				data: {					id: sa.p('id', 0), // 获取超链接中的id参数(0=添加,非0=修改) 					m: {						id: '', // 主键 						customerId: '', // 客户id 						customerName: '', // 客户名称 						no: '', // 编号 						cardNo: '', // 车牌号 						countryName: '越南车',						cardSize: '', // 车规格 						netWeight: '', // 载重(kg) 						goodsName: '', // 商品 						chinaCarNo: '',						expectInDay: '',						driverName: '', // 司机名称 						driverPhone: '', // 司机联系号码 						driverIdCard: '', // 司机身份证 						payTicket: '', // 支付凭证 					}, // 实体对象 					customerList: [],					cardList: [],					driverList: [],					currentCustomerId: 1,					itemTypeList: [],					filterTypeList: [],					goodsList: [],					countryList: [{						name: '越南车'					}, {						name: '中国车'					}],					tableData: [],					modal: {						visible: false,						itemId: 4,						num: 1,						list: []					},					addModal: {						visible: false,						form: {							name: '',							phone: '',							itemId: 4,							ticket: ''						}					},					unitList: [],					needTypeId: []				},				computed: {					totalPrice() {						let itemList = this.itemTypeList.filter(obj => obj.itemId);						let price = 0;						for (let i in itemList) {							let type = itemList[i];							let num = type.num;							let items = type.items;							for (let j in items) {								let item = items[j];								if (item.id == type.itemId) {									price += num * item.price;									break;								}							}						}						return price;					}				},				methods: {					goodsChange(value) {						let goods = this.goodsList.filter(obj => obj.name === value).pop();						let noNeedIds = goods.noNeedIds.split(',');						this.needTypeId = goods.needIds.split(',');						this.filterTypeList = this.itemTypeList.filter(type => noNeedIds.indexOf(type.id) === -1);					},					getUnitList() {						sa.ajax('/TbUnit/getList', {							pageNo: 1,							pageSize: 50						}, function(resp) {							this.unitList = resp.data;						}.bind(this))					},					addPeopleFn(itemId, num) {						this.modal.itemId = itemId;						this.modal.num = num;						this.modal.visible = true;					},					showAddModal() {						Object.assign(this.addModal, {							visible: true,							form: {								index: -1,								name: '',								phone: '',								itemId: this.modal.itemId,								ticket: ''							}						})					},					cancelAdd() {						this.modal.list = [];						this.modal.visible = false;					},					confirmAdd() {						if (!this.addModal.form.name) {							sa.error('请输入检测人姓名')							return false;						}						let phone = this.addModal.form.phone;						if (phone && !sa.isPhone(phone)) {							sa.error('检测人联系号码不正确')							return false;						}						let dbIndex = this.addModal.form.index;						if (dbIndex >= 0) {							this.modal.list[dbIndex].name = this.addModal.form.name;							this.modal.list[dbIndex].phone = this.addModal.form.phone;						} else {							this.addModal.form.index = this.modal.list.length;							this.modal.list.push(this.addModal.form);						}						this.addModal.visible = false;					},					editFn(data) {						Object.assign(this.addModal, {							visible: true,							form: data						})					},					deleteFn(data) {						this.modal.list.splice(data.index, 1);						if (data.id) {							sa.ajax('/TbBusinessPeople/deleteById', {								id: data.id							}, function(resp) {							}.bind(this))						}					},					getGoods() {						sa.ajax('/TbGoods/getList', {							pageNo: 1,							pageSize: 10						}, function(resp) {							this.goodsList = resp.data;						}.bind(this))					},					getItemTypeList() {						sa.ajax('/TbItemType/getList', function(resp) {							let typeList = resp.data;							// 初始化数据							if (this.id > 0) {								sa.ajax('/TbBusiness/getById?id=' + this.id, function(res) {									let m = res.data;									let items = m.items;									for (let i in items) {										let item = items[i];										for (let j in typeList) {											let type = typeList[j];											if (item.itemTypeId == type.id) {												type.itemId = item.itemId;												type.num = item.num;											}										}									}									this.m = m;								}.bind(this))							}							this.itemTypeList = typeList;						}.bind(this))					},					queryCaSizerAsync(queryStr, cb) {						let list = this.unitList;						let filterList = list.filter(obj => obj.unit.indexOf(queryStr) !== -1);						cb(filterList)					},					handleSelectCarSize(item) {						this.m.cardSize = item.unit;					},					getCustomerList() {						sa.ajax('/TbCostomer/getList', {							pageNo: 1,							pageSize: 100,							judgeStatus: 2						}, function(resp) {							this.customerList = resp.data;							if (resp.data.length > 0) {								this.m.customerId = resp.data[0].id;							}						}.bind(this));					},					getCustomer() {						sa.ajax('/TbCostomer/getCurrentCustomerId', function(resp) {							let id = resp.data;							if (id == 1) {								this.getCustomerList();							} else {								this.m.customerId = id;							}							this.currentCustomerId = id;						}.bind(this));					},					// 提交数据 					ok: function() {						// 表单校验						let m = this.m;						if (this.currentCustomerId == 1) {							sa.checkNull(m.customerId, '请选择 [客户名称]');						}						sa.checkNull(m.goodsName, '请选择运输货物');						sa.checkNull(m.cardNo, '请输入 [车牌号]');						if (!sa.isNum(m.cardSize)) {							sa.error('车辆规格只能输入数字')							return;						}						if (!sa.isNum(m.netWeight)) {							sa.error('载重只能输入数字')							return;						}						sa.checkNull(m.driverName, '请输入 [中国司机名称]');						if (!sa.isPhone(m.driverPhone)) {							sa.error('司机联系号码不正确')							return false;						}						sa.checkNull(m.chinaCarNo, '请输入 [中国车牌号]');						let checkList = this.itemTypeList;						for (let j in this.needTypeId) {							let id = this.needTypeId[j];							for (let i in checkList) {								let type = checkList[i];								if (id == type.id && !type.itemId) {									sa.error('选择[' + this.m.goodsName + ']时,[' + type.name + ']必选')									return;								}							}						}						let typeList = this.itemTypeList.filter(obj => obj.itemId);						let list = [];						if (typeList.length == 0) {							sa.error('至少选择一项业务');							return false;						}						for (let i in typeList) {							let type = typeList[i];							list.push({								itemId: type.itemId,								num: type.num							})						}						if (typeList.filter(obj => obj.itemId == 4 || obj.itemId == 9).length > 0 && this.modal.list							.length == 0) {							sa.error('请添加核酸检测人员');							return false;						}						m.itemJson = JSON.stringify(list);						m.peopleJson = JSON.stringify(this.modal.list);						m.items = [];						if (this.id <= 0) { // 添加							sa.ajax('/TbBusiness/add', m, function(res) {								sa.alert('增加成功', this.clean);							}.bind(this));						} else { // 修改							sa.ajax('/TbBusiness/update', m, function(res) {								sa.alert('修改成功', this.clean);							}.bind(this));						}					},					// 添加/修改 完成后的动作					clean: function() {						this.modal.list = [];						if (this.id == 0) {							this.m = this.createModel();						} else {							parent.app.f5(); // 刷新父页面列表							sa.closeCurrIframe(); // 关闭本页 						}					}				},				mounted: function() {					this.getCustomer();					this.getItemTypeList();					this.getGoods();					this.getUnitList();				}			})		</script>	</body></html>
 |