From f26f29d84e0a68831a6af14dab3eec5500496d2e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期三, 28 五月 2025 16:48:52 +0800
Subject: [PATCH] 初始化项目

---
 pages/daily/handyman/handyman.vue |  268 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 268 insertions(+), 0 deletions(-)

diff --git a/pages/daily/handyman/handyman.vue b/pages/daily/handyman/handyman.vue
new file mode 100644
index 0000000..1e3bc49
--- /dev/null
+++ b/pages/daily/handyman/handyman.vue
@@ -0,0 +1,268 @@
+<template>
+	<view class="body">
+		<view class="main_view">
+			<u-form :model="query" ref="query">
+				<u-form-item label="鏉傚伐浜嬮」" required :label-width="180" prop="handymanItemName">
+					<u-input v-model="query.handymanItemName" placeholder="璇疯緭鍏�"/>
+					<!-- <u-icon name="arrow-right" @click="goPage(0)"></u-icon> -->
+				</u-form-item>
+				<u-form-item label="鏃堕暱" required :label-width="180" prop="duration">
+					<u-input v-model="query.duration" placeholder="璇疯緭鍏�"/>
+				</u-form-item>
+				<u-form-item label="鐢熶骇浜哄憳" required :label-width="180" prop="prodUser">
+					<u-input v-model="query.prodUser" type="select" placeholder="璇烽�夋嫨"/>
+					<u-icon name="arrow-right" @click="goPage(1)"></u-icon>
+				</u-form-item>
+				<u-form-item label="璐d换浜�" required :label-width="180" prop="principalName">
+					<u-input v-model="query.principalName" type="select" placeholder="璇烽�夋嫨"/>
+					<u-icon name="arrow-right" @click="goPage(2)"></u-icon>
+				</u-form-item>
+			</u-form>
+		</view>
+		<view class="bottom">
+			<u-button class="u-button" type="primary" @click="submit" :loading="loading">鎻愪氦</u-button>
+		</view>
+		<u-select v-model="handymanItemListShow" :list="handymanItemList" @confirm="confirmOperation"></u-select>
+		<u-select v-model="handymanRecordListShow" :list="handymanRecordList" @confirm="confirmHandymanRecord"></u-select>
+	</view>
+</template>
+
+<script>
+import UIcon from "../../../uview-ui/components/u-icon/u-icon.vue";
+
+export default {
+	name: "handyman",
+	// import 寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
+	components: {UIcon},
+	data() {
+		// 杩欓噷瀛樻斁鏁版嵁
+		return {
+			query: {
+				duration: '', // 鏃堕暱
+				dutyNo: '', // 鏃ユ姤缂栧彿
+				dutyTime: '', // 鏃ユ姤鏃堕棿
+				handymanItem: '', // 鏉傚伐浜嬮」
+				principalId: '', // 璐熻矗浜篿d
+				prodStaffNoList: '', // 鍏宠仈鐨勭敓浜т汉鍛榠d[list]
+				prodUser: '', // 鐢熶骇浜哄憳
+				principalName: '', // 璐熻矗浜哄悕绉�
+				handymanRecordApprover:'',
+				handymanRecordApproverName:'',
+				handymanRecordId:0,
+				handymanItemName: '', // 鏉傚伐浜嬮」鍚嶇О
+			},
+			rules: {
+				handymanItemName: [
+					{
+						required: true,
+						message: '璇烽�夋嫨鏉傚伐浜嬮」',
+						// 鍙互鍗曚釜鎴栬�呭悓鏃跺啓涓や釜瑙﹀彂楠岃瘉鏂瑰紡
+						trigger: ['change'],
+					}
+				],
+				duration: [
+					{
+						required: true,
+						message: '璇疯緭鍏�',
+						trigger: ['change','blur'],
+					},
+					// 姝e垯鍒ゆ柇鏁板瓧
+					{
+						validator: (rule, value, callback) => {
+							return this.$u.test.amount(value);
+						},
+						message: '璇疯緭鍏ユ纭�',
+						// 瑙﹀彂鍣ㄥ彲浠ュ悓鏃剁敤blur鍜宑hange
+						trigger: ['change','blur'],
+					}
+				],
+				prodUser: [
+					{
+						required: true,
+						message: '璇烽�夋嫨鐢熶骇浜哄憳',
+						// 鍙互鍗曚釜鎴栬�呭悓鏃跺啓涓や釜瑙﹀彂楠岃瘉鏂瑰紡
+						trigger: ['change'],
+					}
+				],
+				principalName: [
+					{
+						required: true,
+						message: '璇烽�夋嫨璐d换浜�',
+						// 鍙互鍗曚釜鎴栬�呭悓鏃跺啓涓や釜瑙﹀彂楠岃瘉鏂瑰紡
+						trigger: ['change'],
+					}
+				],
+			},
+			handymanItemList: [],
+			handymanItemListShow: false,
+			handymanRecordList: [],
+			handymanRecordListShow: false,
+			loading: false
+		}
+	},
+	onReady() {
+		this.$refs.query.setRules(this.rules); // 澶嶅埗鏍¢獙
+		// 杩涘叆椤甸潰鏌ヨ鏉傚伐浜嬮」鍒楄〃
+		this.handymanItemList = []
+		this.getHandymanItem()
+		// 杩涘叆椤甸潰鏌ヨ璐d换浜哄垪琛�
+		this.getHandymanRecord()
+	},
+	onLoad(e) {
+		let s = []
+		e.staffList.split(',').forEach(i => {
+			s.push(i)
+		})
+		console.log(s)
+		this.query.prodStaffNoList =s
+		this.query.prodUser =e.userList
+		this.query.dutyNo = e.dutyNo
+		this.query.dutyTime = e.updateTime
+		uni.$on('checkedList', (data) => {
+			let staffNameList = []
+			let staffNoList = []
+			data.forEach(i => {
+				staffNameList.push(i.staffName)
+				staffNoList.push(i.staffNo)
+			})
+			this.query.prodUser = staffNameList.join(',')
+			this.query.prodStaffNoList = staffNoList
+		});
+	},
+	// 鏂规硶闆嗗悎
+	methods: {
+		goPage (index) {
+			switch (index) {
+				case 0:
+					this.handymanItemListShow = true
+							break
+				case 1:
+					const list = []
+					if(this.query.prodStaffNoList.length > 0) {
+						let staffList = this.query.prodUser.split(',')
+						let staffNoList = this.query.prodStaffNoList
+						for (const i in staffList) {
+							const obj = {
+								staffName: staffList[i],
+								staffNo: staffNoList[i]
+							}
+						list.push(obj)
+						}
+					}
+					uni.navigateTo({
+						url: '/pages/daily/production-person/production-person?list=' + encodeURIComponent(JSON.stringify(list))
+					})
+					break
+				case 2:
+					this.handymanRecordListShow = true
+							break
+			}
+		},
+		submit () {
+			this.$refs.query.validate(valid => {
+				if (valid) {
+					let params = JSON.parse(JSON.stringify(this.query))
+					params.dutyTime = params.dutyTime + ' 00:00:00'
+					console.log(params)
+					this.$u.api.dailyPaper.handymanRecord(params).then((res) => {
+						if (res.code === 0) {
+							this.loading = true;
+							uni.navigateBack({
+								//鍏抽棴褰撳墠椤甸潰锛岃繑鍥炰笂涓�椤甸潰鎴栧绾ч〉闈€��
+								delta:1
+							});
+							this.loading = false;
+						}
+					})
+				} else {
+					this.$u.toast('璇峰~鍐欏畬鏁存暟鎹�')
+				}
+			});
+		},
+		getHandymanItem () {
+			this.$u.api.dictData({dictType: 'handyman_item'}).then((res) => {
+				if (res.code === 0 && res.data.length > 0) {
+					res.data.forEach(item => {
+						const obj = Object.assign({
+							label: item.label,
+							value: item.value,
+						})
+						this.handymanItemList.push(obj)
+					})
+				}
+			})
+		},
+		getHandymanRecord () {
+			this.$u.api.dailyPaper.principal().then((res) => {
+				if (res.code === 0 && res.data.length > 0) {
+					res.data.forEach(item => {
+						const obj = Object.assign({
+							label: item.fullName,
+							value: item.id,
+						})
+						this.handymanRecordList.push(obj)
+					})
+					console.log(res)
+					this.query.principalId = 	this.handymanRecordList[0].value
+					this.query.principalName = 	this.handymanRecordList[0].label
+					this.handymanRecordApprover = this.handymanRecordList[0].value
+				}
+			})
+		},
+		confirmOperation (e) {
+			this.query.handymanItem = e[0].value
+			this.query.handymanItemName = e[0].label
+		},
+		confirmHandymanRecord (e) {
+			this.query.principalId = e[0].value
+			this.query.principalName = e[0].label
+		}
+	},
+}
+</script>
+
+<style scoped lang="scss">
+.body {
+	background: linear-gradient(to bottom, #E5F0FF, #F6F9FF);
+	box-sizing: border-box;
+	padding-top: 26rpx;
+	height: 100vh;
+	.main_view {
+		margin-top: 5rpx;
+		background: linear-gradient(180deg, #D8E8FF 0%, #FFFFFF 100%);
+		border-radius: 15rpx;
+		margin: 0 30rpx;
+		box-sizing: border-box;
+		padding: 37rpx 25rpx;
+	}
+	.bottom {
+		width: 100vw;
+		position:fixed;
+		bottom:60rpx;
+		.u-button {
+			width: 690rpx;
+			height: 80rpx;
+			background: #214DED;
+			border-radius: 8rpx;
+			font-weight: 500;
+			font-size: 34rpx;
+			color: #FFFFFF;
+			z-index: 99;
+		}
+	}
+}
+::v-deep.uicon-arrow-down-fill:before {
+	display: none;
+}
+::v-deep.u-form-item--left__content__label {
+	padding-left: 26rpx;
+	font-weight: 500;
+	font-size: 30rpx;
+	color: #4F4F4F;
+	line-height: 80rpx;
+}
+::v-deep.u-form-item--left__content--required {
+	left: 8rpx;
+	top: 0;
+}
+</style>

--
Gitblit v1.9.3