From bf5651cc5fd25fe282d674b2996e3f3aaf98c62f Mon Sep 17 00:00:00 2001
From: 346149741 <346149741@qq.com>
Date: 星期六, 22 六月 2024 20:38:08 +0800
Subject: [PATCH] Merge branch 'master' of http://218.28.192.34:9999/r/sqys/sqys_xcx

---
 policy/policyApply/policyApply.vue |  191 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 149 insertions(+), 42 deletions(-)

diff --git a/policy/policyApply/policyApply.vue b/policy/policyApply/policyApply.vue
index 45e2bb8..399b8f0 100644
--- a/policy/policyApply/policyApply.vue
+++ b/policy/policyApply/policyApply.vue
@@ -13,26 +13,26 @@
 						鎵ф硶瀵硅薄
 					</view>
 					<view class="input">
-						<input type="text" placeholder="璇疯緭鍏�" v-model="form.companyName"/>
+						<input type="text"  placeholder="璇疯緭鍏�" v-model="form.companyName"/>
 						<!-- <u-icon name="arrow-right"></u-icon> -->
-						<u-text text='鎼滅储' type="primary"></u-text>
+						<u-text text='鎼滅储' type="primary" @click="search"></u-text>
 					</view>
 				</view>
 				<view class="form-item">
 					<view class="form-label require">
 						鎵ф硶鏃堕棿
 					</view>
-					<view class="input">
-						<input type="text" placeholder="璇疯緭鍏�"/>
+					<view class="input" @click="showTimeFun">
+						<input type="text" placeholder="璇疯緭鍏�" disabled v-model="form.planTimeStr"/>
 						<u-icon name="arrow-right"></u-icon>
 					</view>
 				</view>
-				<view class="form-item">
+				<view class="form-item" @click="showType = true">
 					<view class="form-label require">
 						鎵ф硶绫诲瀷
 					</view>
 					<view class="input">
-						<input type="text" placeholder="璇疯緭鍏�"/>
+						<input type="text" placeholder="璇疯緭鍏�" v-model="form.enforceTypeName" disabled/>
 						<u-icon name="arrow-right"></u-icon>
 					</view>
 				</view>
@@ -41,7 +41,7 @@
 						鎵ф硶鍐呭
 					</view>
 					<view class="back">
-						<u--textarea :height="120" v-model="form.regionReason" placeholder="璇疯緭鍏�" count maxlength="500"></u--textarea>
+						<u--textarea :height="120" v-model="form.enforceContent" placeholder="璇疯緭鍏�" count maxlength="500"></u--textarea>
 					</view>
 				</view>
 			</view>
@@ -52,19 +52,27 @@
 					<view class="form-label">
 						鎵ф硶浜哄憳
 					</view>
-					<input type="text" placeholder="璇疯緭鍏�"/>
+					<input type="text" placeholder="璇疯緭鍏�" v-model="form.applyUser" disabled/>
 				</view>
 				<view class="form-item">
 					<view class="form-label">
 						鎵ф硶閮ㄩ棬
 					</view>
-					<input type="text" placeholder="璇疯緭鍏�"/>
+					<input type="text" placeholder="璇疯緭鍏�" v-model="form.applyDeptName" disabled/>
 				</view>
-				<view class="form-item">
-					<view class="form-label require">
-						闅忚浜哄憳鏁伴噺
+				<view class="form-item sui" style="align-items: flex-start;" @click="openPer">
+					<view class="form-label require ">
+						闅忚浜哄憳
 					</view>
-					<input type="text" placeholder="璇疯緭鍏�"/>
+					<view>
+						<view style="color: #a2a2a2;" class="placeholder" v-if="!form.peers.length">璇烽�夋嫨</view>
+						<view v-else>
+							<view style="margin-bottom: 20rpx;" v-for="(item,index) in form.peers"  :key="index">
+								{{item.peerUser}}({{item.peerDeptName}})
+							</view>
+						</view>
+					</view>
+					<!-- <u-textarea  border="none" disabled style="padding: 0;" placeholder="璇烽�夋嫨" ></u-textarea> -->
 				</view>
 				<view class="form-item down-2">
 					<view class="form-label">
@@ -76,7 +84,7 @@
 			</view>
 		</view>
 		<view class="down-options">
-			<view class="button record" >鐢宠璁板綍</view>
+			<view class="button record" @click="applyRecord">鐢宠璁板綍</view>
 			<view class="button submit" @click="submitApply">鎻愪氦鐢宠</view>
 		</view>
 		<!-- <u-form label-position="top" label-width="120px">
@@ -115,62 +123,95 @@
 <!-- 		<u-button @click="submitApply">鎻愪氦鐢宠</u-button>
 		<u-button @click="applyRecord">鐢宠璁板綍</u-button> -->
 		<u-picker :show="show" @close="show = false" @confirm="confirmSearch" @cancel="show = false" :columns="columns" keyName="companyName"></u-picker>
-		<u-datetime-picker
-					:show="showTime"
-					@close="showTime = false"
-					@cancel="showTime = false"
-					v-model="currentTime"
-					@confirm="confirmTime"
-					:minDate="minDate"
-					mode="dateTime"
-					ref="datetimePicker"
-					class="hide-clear-button"
-			></u-datetime-picker>
+		<!-- <u-datetime-picker
+			:show="showTime"
+			@close="showTime = false"
+			@cancel="showTime = false"
+			@confirm="confirmTime"
+			:minDate="minDate"
+			v-model="currentTime"
+			@change="changeValue"
+			mode="datetime"
+			ref="datetimePicker"
+			></u-datetime-picker> -->
+			 <yt-dateTimePicker
+			      ref="myPicker"
+			      @submit="confirmTime"
+			      :start-year="year"
+			      :end-year="endYear"
+			      :time-init="timeInit"
+			      :time-hide="[true, true, true, true, false, false]"
+			    />
 			<u-picker :show="showType" @close="showType = false" @confirm="confirmType" @cancel="showType = false" :columns="columnsType" keyName="dictLabel"></u-picker>
-			
+			<perPage :list="list" ref="perpage" @selectValue="selectValue"></perPage>
 	</view>
 </template>
 
 <script>
-	import { orderAdd, companyList } from '@/api/policy.js'
+	import { orderAdd, companyList, enforceList } from '@/api/policy.js'
 	import { getInfo } from '@/api/auth.js'
 	import { getDicts } from '@/api/data'
+	import perPage from './perPage'
+	import YtDateTimePicker from "uni_modules/yt-dateTimePicker/components/yt-dateTimePicker/yt-dateTimePicker.vue"
 	export default {
+		components: {
+			YtDateTimePicker,
+			perPage
+		},
 		data() {
 			return {
 				currentTime: "",
 				form: {
-					executeTime: "",
-					applyName: '',
+					applyUser: '',
 					applyDeptName: '',
 					enforceType: 1,
 					isNoticeCompany: 0,
-					regionReason: ''
+					// regionReason: 0,
+					planTimeStr: '',
+					peers: [],
+					orderStatus: 1,
+					enforceContent: ""
 				},
 				show: false,
 				columns: [],
 				showTime: false,
 				columnsType: [],
 				showType: false,
-				minDate: ''
+				minDate: '',
+				year: '',
+				endYear: '',
+				timeInit: '',
+				list: []
 			}
 		},
 		onLoad() {
-			this.currentTime = this.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss')
+			this.year = new Date().getFullYear()
+			this.endYear = this.year + 5
+			this.minDate = new Date().valueOf()
+			this.timeInit = this.$u.timeFormat(new Date(), 'yyyy-mm-dd')
 			this.getInfo()
 			this.getDicts()
+			this.enforceList()
+		},
+		onShow() {
+			
 		},
 		methods: {
+			enforceList() {
+				enforceList().then(val => {
+					this.list = val.data.data
+				})
+			},
 			getDicts() {
 				getDicts('enforce_type').then(val =>{
-					console.log(val.data.data)
 					this.columnsType = [val.data.data]
 				})
 			},
 			getInfo() {
 				getInfo().then(val => {
 					const value = val.data.data
-					this.form.applyName = value.nickName
+					// this.form.applyName = value.nickName
+					this.form.applyUser = value.nickName
 					this.form.applyId = value.userId
 					this.form.applyDeptName = value.dept.deptName
 					this.form.applyDeptId = value.dept.deptId
@@ -191,15 +232,55 @@
 				}
 				return options;
 			},
+			authFile() {
+				if(!this.form.enforceReason){
+					return '璇峰~鍐欎富棰�'
+				}
+				if(!this.form.companyName){
+					return '璇峰~鍐欑‘璁ゆ墽娉曞璞�'
+				}
+				if(!this.form.companyId) {
+					return '璇风偣鍑绘悳绱㈢‘璁ゆ墽娉曞璞�'
+				}
+				if(!this.form.planTimeStr) {
+					return '璇峰~鍐欐墽娉曟椂闂�'
+				}
+				if(!this.form.enforceTypeName){
+					return '璇烽�夋嫨鎵ф硶绫诲瀷'
+				}
+				if(!this.form.enforceContent) {
+					return '璇峰~鍐欐墽娉曞唴瀹�'
+				}
+				if(!this.form.peers.length){
+					return '璇锋坊鍔犲悓琛屼汉'
+				}
+				return ''
+			},
 			submitApply(){
+				const res =	this.authFile()
+				if(res){
+					uni.showToast({
+						title: res,
+						icon: 'none'
+					})
+					return
+				}
 				orderAdd(this.form).then(val => {
 					if(val.data.code == 200) {
-						uni.navigateBack()
+						uni.showToast({
+							title: '鎻愪氦鎴愬姛',
+							icon: 'none'
+						})
+						setTimeout(() => {
+							uni.navigateBack()
+						}, 500)
 					}
 				})
 			},
 			applyRecord() {
-			
+				uni.navigateTo({
+					url:`/policy/applyRecord/applyRecord`
+				})
 			},
 			search() {
 				companyList({companyName: this.form.companyName}).then(val => {
@@ -229,13 +310,13 @@
 				this.show = false
 			},
 			confirmTime(e) {
-				// console.log(e.value)
-				this.form.applyTime = e.value
-				this.showTime = false
+				this.form.planTime = e.year + '-' + e.month+ '-' + + e.day + ' ' + e.hour + ":" + "00:00"
+				this.form.planTimeStr = e.year + '-' + e.month+ '-' + + e.day + ' ' + e.hour
 			},
 			showTimeFun() {
-				this.showTime = true
-				
+				// this.showTime = true
+					      this.$refs.myPicker.show();
+
 			},
 			sheet(){
 				
@@ -244,6 +325,26 @@
 				this.form.enforceType = e.value[0].dictCode
 				this.form.enforceTypeName = e.value[0].dictLabel
 				this.showType = false
+			},
+			changeValue(e, e1) {
+				this.currentTime = e.value
+			},
+			openPer() {
+				this.$refs.perpage.open(this.list)
+			},
+			selectValue(value) {
+				this.list.forEach(item => {
+					if(value.includes(item.userId)) {
+						this.form.peers.push({
+							peerDeptId: item.dept.deptId,
+							peerDeptName: item.dept.deptName,
+							peerId: item.userId,
+							peerPhone: item.phonenumber,
+							peerType: 2,
+							peerUser: item.nickName
+						})
+					}
+				})
 			}
 		}
 	}
@@ -251,6 +352,9 @@
 <style>
 	page{
 		background-color: #F4F4F4;
+	}
+	.sui  .u-textarea{
+		padding: 0 !important;
 	}
 </style>
 <style scoped lang="scss">
@@ -323,7 +427,7 @@
 	padding-bottom: 40rpx;
 	width: 100%;
 	padding: 22rpx 30rpx 40rpx;
-	z-index: 1000;
+	z-index: 800;
 	display: flex;
 	justify-content: space-between;
 	align-items: center;
@@ -350,5 +454,8 @@
 		text-align: center;
 	}
 }
+.sui{
 
+}
+	
 </style>

--
Gitblit v1.9.1