From f0afdc84ddfb0798cdcb1ba5ff5b1ee92ed833d4 Mon Sep 17 00:00:00 2001
From: 展杰 <1240968267@qq.com>
Date: 星期一, 20 十一月 2023 17:46:16 +0800
Subject: [PATCH] Merge branch 'master' of http://git.gs-mes.com:8080/sjz/pad

---
 api/spotCheck.js                  |   62 ++++++++++
 pages/eqSpotCheck/eqSpotCheck.vue |  254 ++++++++++++++++++++++++++++++++++++++++++
 pages.json                        |   10 +
 pages/index/index.vue             |    5 
 4 files changed, 330 insertions(+), 1 deletions(-)

diff --git a/api/spotCheck.js b/api/spotCheck.js
new file mode 100644
index 0000000..9f91ce9
--- /dev/null
+++ b/api/spotCheck.js
@@ -0,0 +1,62 @@
+import request from '@/utils/request.js'
+
+export function getEqSpotCheckItem(eqNo) {
+	return request({
+		'url': '/spotCheck/getSpotItem?userNo=' + uni.getStorageSync('userInfo').code +'&eqNo='+eqNo,
+		'method': 'post',
+		'header': {
+			'Content-Type': 'application/json',
+			'dataType': 'json',
+			'Accept': 'application/json'
+		}
+	})
+}
+
+export function getEq(eqNo) {
+	return request({
+		'url': '/spotCheck/getEq?eqNo='+eqNo,
+		'method': 'post',
+		'header': {
+			'Content-Type': 'application/json',
+			'dataType': 'json',
+			'Accept': 'application/json'
+		}
+	})
+}
+
+export function getEqSpotList(eqNo) {
+	return request({
+		'url': '/spotCheck/getEqSpotList?userNo=' + uni.getStorageSync('userInfo').code +'&eqNo='+eqNo,
+		'method': 'post',
+		'header': {
+			'Content-Type': 'application/json',
+			'dataType': 'json',
+			'Accept': 'application/json'
+		}
+	})
+}
+
+export function getSpotItemResult(planNo) {
+	return request({
+		'url': '/spotCheck/getSpotItemResult?planNo='+planNo,
+		'method': 'post',
+		'header': {
+			'Content-Type': 'application/json',
+			'dataType': 'json',
+			'Accept': 'application/json'
+		}
+	})
+}
+
+export function save(item) {
+	return request({
+		'url': '/spotCheck/save',
+		'method': 'post',
+		'header': {
+			'Content-Type': 'application/json',
+			'dataType': 'json',
+			'Accept': 'application/json'
+		},
+		data: item
+	})
+}
\ No newline at end of file
diff --git a/pages.json b/pages.json
index 7b3fb44..59842da 100644
--- a/pages.json
+++ b/pages.json
@@ -30,7 +30,15 @@
 				"navigationBarTitleText": "棣栨妫�楠屽垪琛�",
 				"enablePullDownRefresh": false
 			}
-		},{
+		},
+		{
+			"path": "pages/eqSpotCheck/eqSpotCheck",
+			"style": {
+				"navigationBarTitleText": "璁惧鐐规璁″垝",
+				"enablePullDownRefresh": false
+			}
+		},
+		{
 			"path": "pages/inspection/inspectionInfo",
 			"style": {
 				"navigationBarTitleText": "妫�楠屼俊鎭綍鍏�",
diff --git a/pages/eqSpotCheck/eqSpotCheck.vue b/pages/eqSpotCheck/eqSpotCheck.vue
new file mode 100644
index 0000000..c4e47e7
--- /dev/null
+++ b/pages/eqSpotCheck/eqSpotCheck.vue
@@ -0,0 +1,254 @@
+<template>
+	<view>
+		<u-form :model="form" ref="uForm">
+			<u-form-item label="鍞竴缂栫爜" prop="eqNo">
+				<u-input v-model="form.eqNo" @blur="getSpotItem" />
+			</u-form-item>
+			<u-form-item label="璁惧鍚嶇О" prop="eqName">
+				<u-input v-model="form.eqName" />
+			</u-form-item>
+			<u-form-item label="璁惧鍨嬪彿" prop="eqMode">
+				<u-input v-model="form.eqMode" :disabled=true />
+			</u-form-item>
+			<u-form-item label="浣跨敤閮ㄩ棬" prop="department">
+				<u-input v-model="form.department" :disabled=true />
+			</u-form-item>
+			<u-form-item label="鏀剧疆鍦扮偣" prop="place">
+				<u-input v-model="form.place" :disabled=true />
+			</u-form-item>
+			<u-form-item label="淇濆吇宸ュ崟" prop="planNo" borderBottom @click="groupShow = true" required>
+				<u--input v-model="form.planNo" disabled disabledColor="#fff" suffixIcon="arrow-down"
+					placeholder="璇蜂繚鍏诲伐鍗�" border="none"></u--input>
+				<u-picker :show="groupShow" :columns="jtList" keyName="label" @confirm="groupConfim"
+					@cancel="groupShow=false"></u-picker>
+			</u-form-item>
+			<u-form-item label="淇濆吇浜�" prop="planBy">
+				<u-input v-model="form.planBy" :disabled=true />
+			</u-form-item>
+
+			<u-form-item label="璁″垝淇濆吇鏃堕棿" prop="planDate">
+				<view class="sss" @click="show = true">
+					<input type="text" v-model="form.planDate" />
+					<u-datetime-picker ref="datetimePicker" :formatter="formatter" :show="show" mode="date"
+						@confirm="confirm" @cancel="close"></u-datetime-picker>
+				</view>
+			</u-form-item>
+			<u-form-item label="澶囨敞" prop="remark">
+				<u-input v-model="form.remark" />
+			</u-form-item>
+			<u-form-item label="鏄惁鍚堟牸">
+				<u-radio-group v-model="form.finalResult">
+					<u-radio v-for="(item, index) in radioList" :key="index" :name="item.name"
+						:disabled="item.disabled">
+						{{ item.name }}
+					</u-radio>
+				</u-radio-group>
+			</u-form-item>
+		</u-form>
+		<u-button style="background-color: #9294FF;" @click="submit">鎻愪氦</u-button>
+
+		<u-list @scrolltolower="scrolltolower">
+			<u-list-item v-for="(item, index) in indexList" :key="index">
+				<u-form style="border: 2px solid #000;margin: 5px 0px;">
+					<u-form-item label="鍞竴缂栫爜">
+						<u-input v-model="item.eqNo" :disabled=true />
+					</u-form-item>
+					<u-form-item label="妫�鏌ュ唴瀹�">
+						<u-input v-model="item.eqMain" :disabled=true />
+					</u-form-item>
+					<u-form-item label="鏄惁鍚堟牸">
+						<u-radio-group v-model="item.eqEnd">
+							<u-radio v-for="(item, index) in radioList" :key="index" :name="item.name"
+								:disabled="item.disabled">
+								{{ item.name }}
+							</u-radio>
+						</u-radio-group>
+					</u-form-item>
+				</u-form>
+			</u-list-item>
+		</u-list>
+	</view>
+</template>
+
+<script>
+	import {
+		getEqSpotCheckItem,
+		getEq,
+		getEqSpotList,
+		getSpotItemResult,
+		save
+	} from '../../api/spotCheck'
+
+	export default {
+		data() {
+			return {
+				form: {
+					eqNo: '',
+					eqName: '',
+					eqMode: '',
+					department: '',
+					place: '',
+					planNo: '',
+					planBy: '',
+					planDate: '',
+					remark: '',
+					finalResult: 'OK'
+				},
+				jtList: [],
+				indexList: [],
+				rules: {
+					eqNo: [{
+						required: true,
+						message: '璇疯緭鍏ュ敮涓�缂栫爜',
+						// 鍙互鍗曚釜鎴栬�呭悓鏃跺啓涓や釜瑙﹀彂楠岃瘉鏂瑰紡 
+						trigger: ['change', 'blur'],
+					}],
+					planNo: [{
+						required: true,
+						message: '璇烽�夋嫨淇濆吇宸ュ崟',
+						// 鍙互鍗曚釜鎴栬�呭悓鏃跺啓涓や釜瑙﹀彂楠岃瘉鏂瑰紡 
+						trigger: ['change', 'blur'],
+					}]
+				},
+				radioList: [{
+						name: 'OK',
+						disabled: false
+					},
+					{
+						name: 'NG',
+						disabled: false
+					}
+				],
+				switchVal: false,
+				show: false,
+				groupShow: false,
+			};
+		},
+		onLoad() {
+			//鍒濆鍖栦笅鎷�
+		},
+		methods: {
+			submit() {
+				//闈炵┖鏍¢獙锛屼负绌烘椂鍥瀝eturn;
+				if (!this.form.planNo) {
+					uni.showToast({
+						title: '璇烽�夋嫨淇濆吇宸ュ崟',
+						icon: 'none',
+						duration: 2000
+					});
+					return;
+				}
+				if (!this.form.eqNo) {
+					uni.showToast({
+						title: '璇疯緭鍏ヨ澶囧敮涓�缂栫爜',
+						icon: 'none',
+						duration: 2000
+					});
+					return;
+				}
+				this.form.indexList = this.indexList;
+				this.form.submitBy = uni.getStorageSync('userInfo').code;
+				this.form.submitDate = this.now();
+				console.log(JSON.stringify(this.form));
+				save(this.form).then(res => {
+					if(res.result){
+						uni.showToast({
+							title: '淇濆瓨鎴愬姛',
+							icon: 'none',
+							duration: 2000
+						});
+						//娓呯┖鐐规鍗曞拰鐐规璇︾粏淇℃伅
+						this.form = {};
+						this.indexList = [];
+					}
+				})
+			},
+			groupConfim(e) {
+				//鑾峰彇閫変腑鐨勫��
+				// 鏍规嵁瀹為檯闇�姹傝缃�変腑鐨勫��
+				this.form.planNo = e.value[0].label;
+				const timeFormat = uni.$u.timeFormat;
+				this.form.planDate = timeFormat(e.value[0].date, 'yyyy-mm-dd');
+				this.form.planBy = uni.getStorageSync('userInfo').username;
+				this.form.remark = e.value[0].remark;
+				this.loadmore(this.form.planNo);
+				this.groupShow = false
+			},
+			scrolltolower() {
+				//this.loadmore()
+			},
+			loadmore(planNo) { //鑾峰彇鐐规椤圭洰骞堕粯璁ゅ悎鏍�
+				getSpotItemResult(planNo).then(res => {
+					this.indexList = res.data;
+					for(let i=0;i<this.indexList.length;i++){
+						this.indexList[i].eqEnd = 'OK';
+					}
+				})
+			},
+			getSpotItem(event) {  //鏍规嵁鍞竴缂栫爜鏌ヨ璁惧淇℃伅
+				getEq(event).then(res => {
+					this.form = res.data;
+					this.form.finalResult = 'OK';
+					//鍐嶆牴鎹敮涓�缂栫爜鏌ヨ鐐规鍗曠殑淇℃伅
+					getEqSpotList(event).then(res => {
+						//涓嬫媺鍒楄〃濉厖鍊�
+						let arr = res.data.map(item => {
+							return {
+								label: item.planNo,
+								id: item.planNo,
+								date: item.planDate,
+								remark: item.remark
+							}
+						});
+						this.jtList = [arr]
+					})
+				});
+			},
+			confirm(e) {  //淇濆吇鏃堕棿閫夋嫨
+				const timeFormat = uni.$u.timeFormat;
+				this.form.planDate = timeFormat(e.value, 'yyyy-mm-dd');
+				this.show = false;
+			},
+			close() { //鍏抽棴鏃堕棿閫夋嫨妗�
+				this.show = false;
+			},
+			formatter(type, value) {
+				if (type === 'year') {
+					return `${value}骞碻;
+				}
+				if (type === 'month') {
+					return `${value}鏈坄;
+				}
+				if (type === 'day') {
+					return `${value}鏃;
+				}
+				return value;
+			},
+			now() { //鑾峰彇褰撳墠鏃堕棿鏍煎紡涓簓yyy-mm-dd鐨勫瓧绗︿覆
+				var currentDate = new Date();
+				var year = currentDate.getFullYear();
+				var month = currentDate.getMonth() + 1; // 娉ㄦ剰JavaScript涓湀浠芥槸浠�0寮�濮嬬殑锛屾墍浠ヨ鍔�1
+				var day = currentDate.getDate();
+				return year + "-" + month + "-" + day
+			}
+		},
+		// 蹇呴』瑕佸湪onReady鐢熷懡鍛ㄦ湡锛屽洜涓簅nLoad鐢熷懡鍛ㄦ湡缁勪欢鍙兘灏氭湭鍒涘缓瀹屾瘯
+		onReady() {
+			this.$refs.uForm.setRules(this.rules);
+		}
+	};
+</script>
+
+<style scoped>
+	.sss {
+		width: 100%;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+
+	}
+
+	.sss>view {
+		margin-right: 50rpx;
+	}
+</style>
\ No newline at end of file
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 5371802..4deb669 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -36,6 +36,11 @@
 						src:'/pages/work_reporting/work_reporting',
 						icon:''
 					},
+					{
+						name :'璁惧鐐规璁″垝',
+						src:'/pages/eqSpotCheck/eqSpotCheck',
+						icon:''
+					},
 				]
 			}
 		},

--
Gitblit v1.9.3