Browse Source

全局加禁止多次提交方法,多个新增和提交按钮

Ming 3 years ago
parent
commit
681239321a

+ 4 - 2
pages/authAdd/authAdd.vue

@@ -57,7 +57,7 @@
 			</view>
 
 			<view class="btn-area submitBottomBtn padding-lr-sm">
-				<button class="bg-blue round  margin-top" @click="addSubmit">提 交 </button>
+				<button class="bg-blue round  margin-top" @click="$noMultipleClicks(addSubmit)">提 交 </button>
 			</view>
 		</form>
 		<!-- 权限新增 end -->
@@ -118,7 +118,7 @@
 			</view>
 		
 			<view class="btn-area submitBottomBtn padding-lr-sm">
-				<button class="bg-blue round  margin-top" @click="editSbuimt">提 交 </button>
+				<button class="bg-blue round  margin-top" @click="$noMultipleClicks(editSbuimt)">提 交 </button>
 			</view>
 		</form>
 		<!-- 权限修改 end -->
@@ -130,6 +130,8 @@
 
 		data() {
 			return {
+				noClick:true,
+				
 				index: -1,
 				type: '0',
 				

+ 3 - 1
pages/eleControl/controlReport/controlReportAdd/controlReportAdd.vue

@@ -59,7 +59,7 @@
 			</view>
 
 			<view class="btn-area submitBottomBtn padding-lr-sm">
-				<button class="bg-blue round  margin-top" @click="addSubmit()">提 交 </button>
+				<button class="bg-blue round  margin-top" @click="$noMultipleClicks(addSubmit)">提 交 </button>
 			</view>
 		</form>
 
@@ -70,6 +70,8 @@
 	export default {
 		data() {
 			return {
+				noClick:true,
+				
 				imgList: [],
 
 				supervision_title: '',

+ 5 - 2
pages/eleControl/powerCut/powerCutAdd/powerCutAdd.vue

@@ -41,7 +41,7 @@
 				</select>
 			</view>
 			<view class="btn-area submitBottomBtn padding-lr-sm">
-				<button class="bg-blue round  margin-top" @click="addSubmit()">提 交 </button>
+				<button class="bg-blue round  margin-top" @click="$noMultipleClicks(addSubmit)">提 交 </button>
 			</view>
 		</form>
 		
@@ -105,7 +105,7 @@
 				<input name="deviceCode" v-model="planDetailData.phone" disabled="disabled"></input>
 			</view>
 			<view class="btn-area submitBottomBtn padding-lr-sm">
-				<button class="bg-blue round  margin-top" @click="editSubmit()">提 交 </button>
+				<button class="bg-blue round  margin-top" @click="$noMultipleClicks(editSubmit)">提 交 </button>
 			</view>
 		</form>
 		<!-- 修改end -->
@@ -123,6 +123,9 @@
 
 		data() {
 			return {
+				
+				noClick:true,
+				
 				id:'',
 				isShow: false,
 				formMess: {

+ 27 - 12
pages/siteAdd/siteAdd.vue

@@ -64,7 +64,7 @@
 			
 
 			<view class="btn-area submitBottomBtn padding-lr-sm">
-				<button class="bg-blue round  margin-top" @click="addSubmit">提 交 </button>
+				<button class="bg-blue round  margin-top" @click="$noMultipleClicks(addSubmit)">提 交 </button>
 			</view>
 		</form>
 		<!-- 站点新增end -->
@@ -130,7 +130,7 @@
 				<input name="input" v-model="siteMessage.rheological_change"></input>
 			</view>
 			<view class="btn-area submitBottomBtn padding-lr-sm">
-				<button class="bg-blue round  margin-top" @click="editSubmit">提 交 </button>
+				<button class="bg-blue round  margin-top" @click="$noMultipleClicks(editSubmit)">提 交 </button>
 			</view>
 		</form>
 		<!-- 站点修改end -->
@@ -144,6 +144,7 @@
 	export default {
 		data() {
 			return {
+				noClick:true,
 				
 				id: 0,
 				latitude: "",
@@ -226,14 +227,14 @@
 
 			//新增验证并提交
 			addSubmit() {
-				if (!this.siteName) {
+				if (!this.siteName.replace(/^\s*/g,'')) {
 					uni.showToast({
 						title: "请输入站点名称...",
 						icon: "none"
 					});
 					return
 				}
-				if (!this.address) {
+				if (!this.address.replace(/^\s*/g,'')) {
 					uni.showToast({
 						title: "请输入地址...",
 						icon: "none"
@@ -254,14 +255,14 @@
 					});
 					return
 				}
-				if (!this.userName) {
+				if (!this.userName.replace(/^\s*/g,'')) {
 					uni.showToast({
 						title: "请输入联系人...",
 						icon: "none"
 					});
 					return
 				}
-				if (!this.phone) {
+				if (!this.phone.replace(/^\s*/g,'')) {
 					uni.showToast({
 						title: "请输入手机号码...",
 						icon: "none"
@@ -284,14 +285,21 @@
 				 	});
 				 	return
 				 }
-				 if (!this.installed_capacity) {
+				 if (!this.region) {
+				 	uni.showToast({
+				 		title: "请选择所属区域...",
+				 		icon: "none"
+				 	});
+				 	return
+				 }
+				 if (!this.installed_capacity.replace(/^\s*/g,'')) {
 				 	uni.showToast({
 				 		title: "请输入装机容量...",
 				 		icon: "none"
 				 	});
 				 	return
 				 }
-				 if (!this.rheological_change) {
+				 if (!this.rheological_change.replace(/^\s*/g,'')) {
 				 	uni.showToast({
 				 		title: "请输入流变变化...",
 				 		icon: "none"
@@ -314,14 +322,14 @@
 			
 			//编辑验证并提交
 			editSubmit() {
-				if (!this.siteMessage.siteName) {
+				if (!this.siteMessage.siteName.replace(/^\s*/g,'')) {
 					uni.showToast({
 						title: "请填写站点名称...",
 						icon: "none"
 					});
 					return
 				}
-				if (!this.siteMessage.address) {
+				if (!this.siteMessage.address.replace(/^\s*/g,'')) {
 					uni.showToast({
 						title: "请输入地址...",
 						icon: "none"
@@ -342,14 +350,14 @@
 					});
 					return
 				}
-				if (!this.siteMessage.userName) {
+				if (!this.siteMessage.userName.replace(/^\s*/g,'')) {
 					uni.showToast({
 						title: "请输入联系人...",
 						icon: "none"
 					});
 					return
 				}
-				if (!this.siteMessage.phone) {
+				if (!this.siteMessage.phone.replace(/^\s*/g,'')) {
 					uni.showToast({
 						title: "请输入手机号码...",
 						icon: "none"
@@ -370,6 +378,13 @@
 				 	});
 				 	return
 				 }
+				 if (!this.siteMessage.region) {
+				 	uni.showToast({
+				 		title: "请选择所属区域...",
+				 		icon: "none"
+				 	});
+				 	return
+				 }
 				 if (!this.siteMessage.installed_capacity) {
 				 	uni.showToast({
 				 		title: "请输入装机容量...",

+ 4 - 2
pages/siteArchive/siteArchiveAdd/siteArchiveAdd.vue

@@ -166,7 +166,7 @@
 				<textarea name="" id=""v-model="formMess.remarks"></textarea>
 			</view>
 			<view class="btn-area submitBottomBtn padding-lr-sm  " style="position:static">
-				<button class="bg-blue round  margin-top" @click="addSubmit">提 交 </button>
+				<button class="bg-blue round  margin-top" @click="$noMultipleClicks(addSubmit)">提 交 </button>
 			</view>
 			<br>
 		</form>
@@ -341,7 +341,7 @@
 				<textarea name="" id=""v-model="detailInfo.remarks"></textarea>
 			</view>
 			<view class="btn-area submitBottomBtn padding-lr-sm  " style="position:static">
-				<button class="bg-blue round  margin-top" @click="editSubmit">提 交 </button>
+				<button class="bg-blue round  margin-top" @click="$noMultipleClicks(editSubmit)">提 交 </button>
 			</view>
 			<br>
 		</form>
@@ -357,6 +357,8 @@
 		data() {
 			return {
 				
+				noClick:true,
+				
 				baseValue: '1',
 				
 				supervisionListData: [],