From 1c434ec741986a6126cd5d86dc2b2121b3e2d27f Mon Sep 17 00:00:00 2001
From: shuishen <1109946754@qq.com>
Date: Fri, 30 Jul 2021 19:28:00 +0800
Subject: [PATCH] 工作汇报

---
 pages/report/initiate.vue |   66 +++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 11 deletions(-)

diff --git a/pages/report/initiate.vue b/pages/report/initiate.vue
index 2830e36..4b3308d 100644
--- a/pages/report/initiate.vue
+++ b/pages/report/initiate.vue
@@ -16,14 +16,19 @@
 					<u-select v-model="typeShow" mode="single-column" :list="typeList" @confirm="typeConfirm">
 					</u-select>
 				</u-form-item>
+
 				<u-form-item label-position='top' prop="content" label="汇报内容" :required="true">
 					<u-input type='textarea' v-model="form.content" placeholder="请输入汇报内容" />
 				</u-form-item>
-				<u-form-item label-position='top' prop="typeText" label="接收人" :required="true">
-					<u-input v-model="form.typeText" type="select" placeholder="请选择接收人" :border="false"
+
+				<u-form-item label-position='top' prop="recipientText" label="接收人" :required="true">
+
+					<u-input v-model="form.recipientText" type="select" placeholder="请选择接收人" :border="false"
 						@click="recipientClick" />
-					<u-select v-model="recipientShow" mode="single-column" :list="typeList" @confirm="typeConfirm">
+					<u-select v-model="recipientShow" mode="mutil-column-auto" :list="recipientList"
+						@confirm="recipientConfirm">
 					</u-select>
+
 				</u-form-item>
 
 			</u-form>
@@ -72,12 +77,16 @@
 						label: '月报'
 					}
 				],
+				recipientList: [],
+
 				form: {
 					content: '',
 					category: '',
 					type: '',
+					recipient: '',
 					categoryText: '',
-					typeText: ''
+					typeText: '',
+					recipientText: ''
 				},
 				rules: {
 					categoryText: [{
@@ -96,7 +105,12 @@
 						required: true,
 						message: '汇报内容不能少于5个字',
 						trigger: ['change', 'blur'],
-					}]
+					}],
+					recipientText: [{
+						required: true,
+						message: '请选择接收人',
+						trigger: ['change', 'blur'],
+					}],
 				}
 			};
 		},
@@ -115,9 +129,7 @@
 				this.categoryShow = true;
 			},
 			typeClick() {
-
 				this.typeShow = true;
-
 			},
 			recipientClick() {
 				if (this.form.category == '') {
@@ -128,23 +140,55 @@
 					});
 					return;
 				} else {
-					this.recipientShow = true;
+					uni.request({
+						url: this.$store.state.piAPI + "/blade-system/dept/lazy-tree-user-app?type=" + this.form
+							.category,
+						method: "get",
+						data: {
+
+						},
+						success: (res) => {
+							this.recipientList = []
+							res.data.forEach(item => {
+								if (item.hasChildren) {
+									this.recipientList.push(item)
+								}
+							})
+							this.recipientShow = true;
+						}
+					});
+
 				}
 			},
 			categoryConfirm(e) {
+				if (this.form.categoryText != e[0].label) {
+					this.form.recipient = ''
+					this.form.recipientText = ''
+				}
+
 				this.form.category = e[0].value
 				this.form.categoryText = e[0].label
+
 			},
 			typeConfirm(e) {
 				this.form.type = e[0].value
 				this.form.typeText = e[0].label
 			},
+			recipientConfirm(e) {
+				if (e.length > 1) {
+					this.form.recipient = e[1].value
+					this.form.recipientText = e[1].label
+				} else {
+					this.form.recipient = e[0].value
+					this.form.recipientText = e[0].label
+				}
+
+			},
 			initiateClick() {
 				this.$refs.uForm.validate(valid => {
 					if (valid) {
 						uni.request({
-							url: this.$store.state.piAPI + "/workReport/submit?deptId=" + this.$store.state
-								.UserData.dept_id + '&userId=' + this.$store.state.puserID,
+							url: this.$store.state.piAPI + "/workReport/submit",
 							method: "post",
 							data: {
 								type: this.form.type,
@@ -152,7 +196,7 @@
 								content: this.form.content,
 								userId: this.$store.state.puserID,
 								deptId: this.$store.state.UserData.dept_id,
-								receivedIds: "1416717479708815362"
+								receivedIds:  this.form.recipient
 							},
 							success: (res) => {
 								if (res.data.msg == "操作成功") {

--
Gitblit v1.9.3