linweizeng %!s(int64=3) %!d(string=hai) anos
pai
achega
35ac53b9a1
Modificáronse 2 ficheiros con 147 adicións e 81 borrados
  1. 97 79
      pages/jiance/order.vue
  2. 50 2
      pages/jiance/order/lhypbMessage.vue

+ 97 - 79
pages/jiance/order.vue

@@ -33,6 +33,8 @@
 				</u-form-item>
 			</uni-group>
 
+			<u-button type="success" class="btn" @click="getSing()" v-if="type != 'detail'">添加样品</u-button>
+
 			<view class="tagBox">
 				<uni-tag class="tagSin" :text="'样品:'+(index+1)" :type="lhypbIndex == index ? 'primary':'warning'"
 					:circle="true" v-for="(item,index) in form.lhypb" :key="index" @click="lhypbIndex = index" />
@@ -285,15 +287,14 @@
 					<!-- <u-input v-model="item.yangPinZongJia" disabled /> -->
 				</u-form-item>
 
-				<u-button type="error" class="btn" @click="deletSing(index)" v-if="type != 'detail'">删除样品{{index+1}}
+				<u-button type="error" class="btn" @click="deletSing(index)" v-if="type != 'detail'">
+					删除样品编号“{{item.yangPinBianHao}}”的样品
 				</u-button>
 				<u-button type="error" class="btn" @click="updateSing(item,index)" v-if="type != 'detail'">
-					修改样品{{index+1}}
+					修改样品编号“{{item.yangPinBianHao}}”的样品
 				</u-button>
 			</uni-group>
 
-			<u-button type="success" class="btn" @click="getSing()" v-if="type != 'detail'">添加样品</u-button>
-
 			<uni-group mode="card">
 				<u-form-item label="付款方式">
 					<u-input placeholder="请输入付款方式" v-model="form.fuKuanFangShi" disabled />
@@ -374,6 +375,8 @@
 			<u-button type="primary" class="btn" @click="sumbit" v-if="type != 'detail'">提交</u-button>
 		</u-form>
 
+		<u-back-top :scroll-top="scrollTop" :icon-style="iconStyle" bottom="400"></u-back-top>
+
 		<u-calendar v-model="dateShow" :mode="mode" max-date="2050-01-01" @change="dateChange"></u-calendar>
 		<u-action-sheet :list="list" v-model="sheetShow" @click="actionSheetCallback"></u-action-sheet>
 		<u-select v-model="selectShow" :list="list" @confirm="selectConfirm"></u-select>
@@ -539,6 +542,11 @@
 				popupShow: false,
 				selectShow: false,
 
+				scrollTop: 0,
+				iconStyle: {
+					color: '#FFFFFF'
+				},
+
 				lhypbIndex: 0,
 				lhypbShow: false,
 				lhypbIndexData: 'add', //判断样品添加还是修改
@@ -566,6 +574,9 @@
 		onReady() {
 			this.$refs.form.setRules(this.rules);
 		},
+		onPageScroll(e) {
+			this.scrollTop = e.scrollTop;
+		},
 		methods: {
 			//根据委托单id查询 taskId
 			getTaskId(id) {
@@ -852,12 +863,12 @@
 			},
 			//调用日期组件
 			dateClick(type, index) {
-				if (type == 'inspect') {
-					this.type = type
-					this.mode = 'date'
-					this.dateShow = true
-					this.listIndex = index
-				}
+				// if (type == 'inspect') {
+				// 	this.type = type
+				// 	this.mode = 'date'
+				// 	this.dateShow = true
+				// 	this.listIndex = index
+				// }
 				if (type == 'report') {
 					this.type = type
 					this.mode = 'date'
@@ -871,9 +882,9 @@
 			},
 			//日期回调
 			dateChange(e) {
-				if (this.type == 'inspect') {
-					this.form.lhypb[this.listIndex].songJianShiJian = e.result
-				}
+				// if (this.type == 'inspect') {
+				// 	this.form.lhypb[this.listIndex].songJianShiJian = e.result
+				// }
 				if (this.type == 'report') {
 					this.form.chuBaoGaoShiJian = e.result
 				}
@@ -884,24 +895,24 @@
 			sheetClick(type, index) {
 				this.listType = type
 				this.sheetShow = true
-				if (type == 'state') {
-					this.list = this.sampleStateList
-					this.listIndex = index
-				}
-
-				//1
-				if (type.includes('yangpinType')) {
-					this.list = this.sampleTypeList
-					this.listIndex = index
-				}
-				if (type.includes('transportType')) {
-					this.list = this.transportTypeList
-					this.listIndex = index
-				}
-				if (type.includes('specification')) {
-					this.list = this.specificationList
-					this.listIndex = index
-				}
+				// if (type == 'state') {
+				// 	this.list = this.sampleStateList
+				// 	this.listIndex = index
+				// }
+
+				// //1
+				// if (type.includes('yangpinType')) {
+				// 	this.list = this.sampleTypeList
+				// 	this.listIndex = index
+				// }
+				// if (type.includes('transportType')) {
+				// 	this.list = this.transportTypeList
+				// 	this.listIndex = index
+				// }
+				// if (type.includes('specification')) {
+				// 	this.list = this.specificationList
+				// 	this.listIndex = index
+				// }
 				if (type == 'disposition') {
 					this.list = this.dispositionList
 				}
@@ -913,53 +924,53 @@
 				let that = this
 				let lists = that.form.lhypb[this.listIndex]
 
-				if (this.listType == 'state') {
-					lists.yangPinZhuangTai = this.list[e].text
-				}
-
-				//1
-				if (this.listType == 'yangpinType1') {
-					lists.yangPinLeiXing = that.list[e].text
-				}
-				if (this.listType == 'transportType1') {
-					lists.yangBenYunShuTiao = that.list[e].text
-				}
-				if (this.listType == 'specification1') {
-					lists.yangPinGuiGe = that.list[e].text
-				}
-
-				//2
-				if (this.listType == 'yangpinType2') {
-					lists.yangPinLeiXingEr = that.list[e].text
-				}
-				if (this.listType == 'transportType2') {
-					lists.yangPinYunShuTiao = that.list[e].text
-				}
-				if (this.listType == 'specification2') {
-					lists.yangPinGuiGeEr = that.list[e].text
-				}
-
-				//3
-				if (this.listType == 'yangpinType3') {
-					lists.yangPinLeiXingSan = that.list[e].text
-				}
-				if (this.listType == 'transportType3') {
-					lists.yangPinYunShuSan = that.list[e].text
-				}
-				if (this.listType == 'specification3') {
-					lists.yangPinGuiGeSan = that.list[e].text
-				}
-
-				//3
-				if (this.listType == 'yangpinType4') {
-					lists.yangPinLeiXingSi = that.list[e].text
-				}
-				if (this.listType == 'transportType4') {
-					lists.yangPinYunShuSi = that.list[e].text
-				}
-				if (this.listType == 'specification4') {
-					lists.yangPinGuiGeSi = that.list[e].text
-				}
+				// if (this.listType == 'state') {
+				// 	lists.yangPinZhuangTai = this.list[e].text
+				// }
+
+				// //1
+				// if (this.listType == 'yangpinType1') {
+				// 	lists.yangPinLeiXing = that.list[e].text
+				// }
+				// if (this.listType == 'transportType1') {
+				// 	lists.yangBenYunShuTiao = that.list[e].text
+				// }
+				// if (this.listType == 'specification1') {
+				// 	lists.yangPinGuiGe = that.list[e].text
+				// }
+
+				// //2
+				// if (this.listType == 'yangpinType2') {
+				// 	lists.yangPinLeiXingEr = that.list[e].text
+				// }
+				// if (this.listType == 'transportType2') {
+				// 	lists.yangPinYunShuTiao = that.list[e].text
+				// }
+				// if (this.listType == 'specification2') {
+				// 	lists.yangPinGuiGeEr = that.list[e].text
+				// }
+
+				// //3
+				// if (this.listType == 'yangpinType3') {
+				// 	lists.yangPinLeiXingSan = that.list[e].text
+				// }
+				// if (this.listType == 'transportType3') {
+				// 	lists.yangPinYunShuSan = that.list[e].text
+				// }
+				// if (this.listType == 'specification3') {
+				// 	lists.yangPinGuiGeSan = that.list[e].text
+				// }
+
+				// //3
+				// if (this.listType == 'yangpinType4') {
+				// 	lists.yangPinLeiXingSi = that.list[e].text
+				// }
+				// if (this.listType == 'transportType4') {
+				// 	lists.yangPinYunShuSi = that.list[e].text
+				// }
+				// if (this.listType == 'specification4') {
+				// 	lists.yangPinGuiGeSi = that.list[e].text
+				// }
 
 				if (this.listType == 'disposition') {
 					this.form.yangBenChuLi = this.list[e].text
@@ -1238,6 +1249,7 @@
 						duration: 2000
 					})
 				}
+				console.log("9")
 
 				this.getLhypbh(res => {
 					let obj = {
@@ -1294,6 +1306,7 @@
 					}
 					this.lhypbShow = true
 					this.lhypbIndexData = 'add'
+					console.log("555")
 					this.$nextTick(() => {
 						this.$refs.lhypbMessage.getInit(obj)
 					})
@@ -1301,6 +1314,9 @@
 			},
 			deletSing(index) {
 				this.form.lhypb.splice(index, 1)
+				if (this.form.lhypb.length == index) {
+					this.lhypbIndex = this.form.lhypb.length - 1
+				}
 			},
 			updateSing(item, index) {
 				this.lhypbIndex = index
@@ -1370,9 +1386,11 @@
 				});
 				return uuid;
 			},
+			//取消
 			deletClick() {
 				this.lhypbShow = false
 			},
+			//样品保存返回数据保存到样品表上,修改样品对对应的样品表
 			sumbitSingClick(item) {
 				if (this.lhypbIndexData == 'add') {
 					this.lhypbShow = false
@@ -1381,7 +1399,7 @@
 					this.lhypbShow = false
 					this.form.lhypb[this.lhypbIndex] = item
 				}
-
+				this.getTotal()
 			}
 		}
 	}

+ 50 - 2
pages/jiance/order/lhypbMessage.vue

@@ -242,9 +242,34 @@
 				selectShow: false,
 				dateShow: false,
 				mode: 'date',
-				type: ""
+				type: "",
+				rules: {
+					yangPinMingCheng: [{
+						required: true,
+						message: '请输入样品名称',
+						trigger: 'blur',
+					}],
+					songJianPiHao: [{
+						required: true,
+						message: '请输入送检批号/编号',
+						trigger: 'blur',
+					}],
+					yangPinZhuangTai: [{
+						required: true,
+						message: '请输入样本状态',
+						trigger: 'blur',
+					}],
+					songJianShiJian: [{
+						required: true,
+						message: '请输入送检时间',
+						trigger: 'blur',
+					}],
+				}
 			}
 		},
+		onReady() {
+			this.$refs.form.setRules(this.rules);
+		},
 		methods: {
 			getInit(data) {
 				this.form = data
@@ -376,7 +401,30 @@
 				this.$emit("deletClick")
 			},
 			sumbitSing() {
-				this.$emit("sumbitSingClick", this.form)
+				if (this.form.yangPinZongJia == '') {
+					this.form.yangPinZongJia = 0
+				}
+				// let showIndex = this.form.lhypb.findIndex(item => item.jianCeXiangMu == '')
+				// if (showIndex >= 0) {
+				// 	uni.showToast({
+				// 		title: `请在样品信息${showIndex+1}选择委托单需要检测项目`,
+				// 		icon: 'none',
+				// 		duration: 2000
+				// 	})
+				// 	return
+				// }
+				this.$refs.form.validate(valid => {
+					if (valid) {
+						this.$emit("sumbitSingClick", this.form)
+					} else {
+						uni.showToast({
+							title: '必填项未填写',
+							icon: 'none',
+							duration: 2000
+						})
+					}
+				});
+
 			}
 		}
 	}