398 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
			
		
		
	
	
			398 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Vue
		
	
	
	
	
	
<template>
 | 
						||
	<!-- 当班工作人员 -->
 | 
						||
	<view class="content">
 | 
						||
		<view class="container">
 | 
						||
			<view class="form-sub">
 | 
						||
				<u-form :model="model" ref="uForm" label-width="90px" class="demo-ruleForm" size="mini">
 | 
						||
					<view style="position: relative;">
 | 
						||
						<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
 | 
						||
					</view>
 | 
						||
					<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">组织信息</view>
 | 
						||
					<u-form-item label="班组名称" prop="DEPARTMENT_NAME" borderBottom ref="item1"
 | 
						||
						@click="handleShowSheet({title: '班组名称'})">
 | 
						||
						<u--input v-model="model.DEPARTMENT_NAME" border="none" suffixIcon="arrow-right"
 | 
						||
							customStyle="margin:0px;display:flex;padding:3px 9px"
 | 
						||
							suffixIconStyle="font-size:12px"></u--input>
 | 
						||
					</u-form-item>
 | 
						||
					<u-form-item label="当班状态" prop="SchedulingType" borderBottom @click="showSex = true;" ref="item1">
 | 
						||
						<u--input v-model="model.SchedulingType" disabled disabledColor="#ffffff" placeholder="员工数量"
 | 
						||
							border="none" fontSize="14px"
 | 
						||
							customStyle="margin:0px;display:flex;padding:3px 9px"></u--input>
 | 
						||
					</u-form-item>
 | 
						||
					<u-form-item label="当班开始时间" prop="START_TIME" borderBottom @click="showSex = true;" ref="item1">
 | 
						||
						<u--input v-model="model.START_TIME" disabled disabledColor="#ffffff" placeholder="员工数量"
 | 
						||
							border="none" fontSize="14px"
 | 
						||
							customStyle="margin:0px;display:flex;padding:3px 9px"></u--input>
 | 
						||
					</u-form-item>
 | 
						||
					<u-form-item label="当班结束时间" prop="END_TIME" borderBottom @click="showSex = true;" ref="item1">
 | 
						||
						<u--input v-model="model.END_TIME" disabled disabledColor="#ffffff" placeholder="员工数量"
 | 
						||
							border="none" fontSize="14px"
 | 
						||
							customStyle="margin:0px;display:flex;padding:3px 9px"></u--input>
 | 
						||
					</u-form-item>
 | 
						||
					<u-form-item label="当班员工数" prop="COUNT_WORKER" borderBottom @click="showSex = true;" ref="item1">
 | 
						||
						<u--input v-model="model.COUNT_WORKER" disabled disabledColor="#ffffff" placeholder="员工数量"
 | 
						||
							border="none" fontSize="14px"
 | 
						||
							customStyle="margin:0px;display:flex;padding:3px 9px"></u--input>
 | 
						||
					</u-form-item>
 | 
						||
					<u-form-item label="请假员工数" prop="COUNT_LEVEL" borderBottom @click="showSex = true;" ref="item1">
 | 
						||
						<u--input v-model="model.COUNT_LEVEL" disabled disabledColor="#ffffff" placeholder="员工数量"
 | 
						||
							border="none" fontSize="14px"
 | 
						||
							customStyle="margin:0px;display:flex;padding:3px 9px"></u--input>
 | 
						||
					</u-form-item>
 | 
						||
					<u-form-item label="下次排班时间" prop="SchedulingNEXTTIME" borderBottom @click="showSex = true;"
 | 
						||
						ref="item1">
 | 
						||
						<u--input v-model="model.SchedulingNEXTTIME" disabled disabledColor="#ffffff" placeholder="员工数量"
 | 
						||
							border="none" fontSize="14px"
 | 
						||
							customStyle="margin:0px;display:flex;padding:3px 9px"></u--input>
 | 
						||
					</u-form-item>
 | 
						||
 | 
						||
					<!-- <u-form-item label="员工信息" prop="SchedulingNEXTTIME" borderBottom @click="showSex = true;"
 | 
						||
						ref="item1">
 | 
						||
					</u-form-item> -->
 | 
						||
					<!-- <u-form-item>工作人员信息:</u-form-item> -->
 | 
						||
					<u-form-item>
 | 
						||
						<u-list key="qb">
 | 
						||
							<u-list-item v-for=" item  in model.ListUser">
 | 
						||
								<u-cell style="background-color: whitesmoke;" :title="item"> </u-cell>
 | 
						||
							</u-list-item>
 | 
						||
						</u-list>
 | 
						||
					</u-form-item>
 | 
						||
 | 
						||
					<!-- <u-form-item key="db">
 | 
						||
						<u-list>
 | 
						||
							<u-list-item v-for="item in model.LISTPERSON_SCHEDULING">
 | 
						||
								<u-cell :title="`${item.NAME +  '(当班)'}`">
 | 
						||
 | 
						||
								</u-cell>
 | 
						||
							</u-list-item>
 | 
						||
						</u-list>
 | 
						||
					</u-form-item>
 | 
						||
					
 | 
						||
					<u-form-item key="qj">
 | 
						||
						<u-list>
 | 
						||
							<u-list-item v-for="(item, index) in model.LISTUSER_LEAVE">
 | 
						||
								<u-cell :title="item.NAME+' (请假)'"> </u-cell>
 | 
						||
							</u-list-item>
 | 
						||
						</u-list>
 | 
						||
					</u-form-item> -->
 | 
						||
 | 
						||
				</u-form>
 | 
						||
 | 
						||
				<!-- 动态加载用户信息 -->
 | 
						||
				<!-- <u-sticky offset-top="20">
 | 
						||
					<view class="sub-form">
 | 
						||
						<view class="sub-form-wrap">
 | 
						||
							<u--form labelPosition="left" labelWidth="auto" labelAlign="center"
 | 
						||
								errorType="border-bottom" style="margin-bottom: 50px;" ref="sForm">
 | 
						||
								<uni-collapse :border="false" accordion>
 | 
						||
									<uni-card style="margin-bottom: 5px;" margin="0" spacing="0" :is-shadow="false"
 | 
						||
										v-for="(item, index) in model.LISTPERSON_SCHEDULING">
 | 
						||
										<uni-collapse-item :title="(index+1) + '. ' + item.NAME" name="1">
 | 
						||
											<u-form-item label="姓名" prop="NAME" borderBottom>
 | 
						||
												<u--input disabled disabledColor="#fff" v-model="item.NAME"
 | 
						||
													border="none" inputAlign="right"></u--input>
 | 
						||
											</u-form-item>
 | 
						||
											<u-form-item label="性别" prop="SEX" borderBottom>
 | 
						||
												<u--input disabled disabledColor="#fff" v-model="item.SEX" border="none"
 | 
						||
													inputAlign="right"></u--input>
 | 
						||
											</u-form-item>
 | 
						||
										</uni-collapse-item>
 | 
						||
									</uni-card>
 | 
						||
 | 
						||
									<uni-card style="margin-bottom: 5px;" margin="0" spacing="0" :is-shadow="false"
 | 
						||
										v-for="(item, index) in model.LISTUSER_LEAVE">
 | 
						||
										<uni-collapse-item :title="(index+1) + '. ' + item.NAME" name="1">
 | 
						||
											<u-form-item label="姓名" prop="NAME" borderBottom>
 | 
						||
												<u--input disabled disabledColor="#fff" v-model="item.NAME"
 | 
						||
													border="none" inputAlign="right"></u--input>
 | 
						||
											</u-form-item>
 | 
						||
											<u-form-item label="性别" prop="SEX" borderBottom>
 | 
						||
												<u--input disabled disabledColor="#fff" v-model="item.SEX" border="none"
 | 
						||
													inputAlign="right"></u--input>
 | 
						||
											</u-form-item>
 | 
						||
										</uni-collapse-item>
 | 
						||
									</uni-card>
 | 
						||
 | 
						||
								</uni-collapse>
 | 
						||
							</u--form>
 | 
						||
 | 
						||
						</view>
 | 
						||
					</view>
 | 
						||
				</u-sticky> -->
 | 
						||
 | 
						||
				<!-- 
 | 
						||
				<view style="display: flex;flex-direction: row;" class="bottom-button">
 | 
						||
					<u-button type="primary" @click="reset" color="#3d4b70" :plain="true"
 | 
						||
						style="margin-right: 5px;">重置</u-button>
 | 
						||
					<u-button type="primary" @click="submit" color="#3d4b70" style="margin-left: 5px;"
 | 
						||
						v-if="loading == false">提交</u-button>
 | 
						||
					<u-button type="primary" loading loadingText="加载中" color="#3d4b70" style="margin-left: 5px;"
 | 
						||
						v-if="loading == true">提交</u-button>
 | 
						||
				</view> -->
 | 
						||
 | 
						||
				<query-selector :show="selectorInfo.showPopup" :defaultChecked="selectorInfo.defaultChecked"
 | 
						||
					:title="selectorInfo.title" :lists="selectorInfo.dataLists" @search="handleSearch"
 | 
						||
					@select="handleSelected" @close="selectorInfo.showPopup=false" :total="selectorInfo.totalCount" />
 | 
						||
			</view>
 | 
						||
		</view>
 | 
						||
 | 
						||
	</view>
 | 
						||
</template>
 | 
						||
 | 
						||
<script>
 | 
						||
	import {
 | 
						||
		PagedDep,
 | 
						||
		WorkerScheduling		
 | 
						||
	} from '../../services/apply'
 | 
						||
	import {
 | 
						||
		initFilter,
 | 
						||
		extendRule
 | 
						||
	} from '../../utils/common'
 | 
						||
	export default {
 | 
						||
		data() {
 | 
						||
			return {
 | 
						||
				OrgId: '',
 | 
						||
				model: {
 | 
						||
					DEPARTMENT_NAME: '',
 | 
						||
					DEPARTMENT_ID: '',
 | 
						||
					SchedulingType: '',
 | 
						||
					COUNT_WORKER: '',
 | 
						||
					COUNT_LEVEL: '',
 | 
						||
					START_TIME: '',
 | 
						||
					END_TIME: '',
 | 
						||
					SchedulingNEXTTIME: '',
 | 
						||
					LISTPERSON_SCHEDULING: [{
 | 
						||
						NAME: ''
 | 
						||
					}],
 | 
						||
					LISTUSER_LEAVE: [{
 | 
						||
						NAME: ''
 | 
						||
					}],
 | 
						||
					ListUser: []
 | 
						||
				},
 | 
						||
				selectorInfo: {
 | 
						||
					showPopup: false,
 | 
						||
					totalCount: 0,
 | 
						||
					title: '班组名称',
 | 
						||
					// itemData: {},
 | 
						||
					index: 0,
 | 
						||
					dataLists: [],
 | 
						||
					defaultText: '',
 | 
						||
					defaultValue: '',
 | 
						||
					name: '',
 | 
						||
					defaultChecked: []
 | 
						||
				},
 | 
						||
			}
 | 
						||
		},
 | 
						||
		onLoad(option) {
 | 
						||
			this.model.DEPARTMENT_ID = option.DEPARTMENT_ID // 'B18F95F4-572A-E521-1412-FA8CE50DC98A'
 | 
						||
			this.OrgId = option.OrgId // 'B043B28B-BBC3-C452-6052-4FBA1457ABFA'
 | 
						||
			if (this.model.DEPARTMENT_ID && this.model.DEPARTMENT_ID.length > 1){
 | 
						||
				//显示组织信息
 | 
						||
				const json = initFilter(this.OrgId, null, "NAME", 0, 1)
 | 
						||
				json.IgnoreDataRule = true
 | 
						||
				json.Limit = 2
 | 
						||
				extendRule(json, "ID", 1, this.model.DEPARTMENT_ID)
 | 
						||
				PagedDep(json).then(res => {
 | 
						||
					if (res != undefined && res.Data.length > 0) {
 | 
						||
						this.model.DEPARTMENT_NAME = res.Data[0].NAME
 | 
						||
					}
 | 
						||
				})
 | 
						||
				//显示数据
 | 
						||
				this.WorkerScheduling()
 | 
						||
			}
 | 
						||
		},
 | 
						||
		// onReady() {
 | 
						||
		// 	//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
 | 
						||
		// 	this.$refs.uForm.setRules(this.rules)
 | 
						||
		// },
 | 
						||
		methods: {
 | 
						||
			WorkerScheduling() {
 | 
						||
				const modelRequest = {
 | 
						||
					Keyword: this.model.DEPARTMENT_ID,
 | 
						||
					OrgId: this.OrgId
 | 
						||
				}
 | 
						||
				WorkerScheduling(modelRequest).then(res => {
 | 
						||
					if (res.IsSuccessful) {
 | 
						||
						this.model = res.Data
 | 
						||
						var ListUser = []
 | 
						||
						if (this.model.LISTPERSON_SCHEDULING != null && this.model.LISTPERSON_SCHEDULING.length >
 | 
						||
							0) {
 | 
						||
							this.model.LISTPERSON_SCHEDULING.forEach(e => {
 | 
						||
								ListUser.push(e.NAME + '(当班)')
 | 
						||
							})
 | 
						||
						}
 | 
						||
 | 
						||
						if (this.model.LISTUSER_LEAVE != null && this.model.LISTUSER_LEAVE.length > 0) {
 | 
						||
							this.model.LISTUSER_LEAVE.forEach(e => {
 | 
						||
								ListUser.push(e.NAME + '(请假)')
 | 
						||
							})
 | 
						||
						}
 | 
						||
						this.model.ListUser = ListUser
 | 
						||
					} else {
 | 
						||
						uni.$showErrorInfo(res.ErrorMessage)
 | 
						||
						// this.model.DEPARTMENT_NAME = ''
 | 
						||
						this.model.DEPARTMENT_ID = ''
 | 
						||
						this.model.SchedulingType = ''
 | 
						||
						this.model.COUNT_WORKER = ''
 | 
						||
						this.model.COUNT_LEVEL = ''
 | 
						||
						this.model.START_TIME = ''
 | 
						||
						this.model.END_TIME = ''
 | 
						||
						this.model.SchedulingNEXTTIME = ''
 | 
						||
						this.model.LISTPERSON_SCHEDULING = []
 | 
						||
						this.model.LISTUSER_LEAVE = []
 | 
						||
						this.model.ListUser = []
 | 
						||
					}
 | 
						||
				})
 | 
						||
			},
 | 
						||
 | 
						||
 | 
						||
			closePicker() {
 | 
						||
				this.comPickerInfo = {
 | 
						||
					showSheet: false,
 | 
						||
					columns: [],
 | 
						||
					title: '',
 | 
						||
					name: '',
 | 
						||
					formIndex: undefined
 | 
						||
				}
 | 
						||
			},
 | 
						||
 | 
						||
			//显示组件
 | 
						||
			handleChange() {
 | 
						||
				this.selectorInfo.showPopup = true
 | 
						||
				this.selectorInfo.title = '班组名称'
 | 
						||
				this.handleSearch()
 | 
						||
			},
 | 
						||
 | 
						||
			//数据加载
 | 
						||
			handleSearch(val, pageIndex) {
 | 
						||
				var p = {
 | 
						||
					name: this.selectorInfo.name,
 | 
						||
					title: this.selectorInfo.title,
 | 
						||
					val: val,
 | 
						||
					pageIndex: pageIndex
 | 
						||
				}
 | 
						||
				this.handleShowSheet(p)
 | 
						||
			},
 | 
						||
 | 
						||
			async handleShowSheet(p) {
 | 
						||
				var defaultChecked = []
 | 
						||
				const json = initFilter(this.OrgId, null, "NAME", 0, (p.pageIndex ?? 1));
 | 
						||
				json.IgnoreDataRule = true
 | 
						||
				json.Limit = 20
 | 
						||
				if (p.val) {
 | 
						||
					extendRule(json, "NAME", 9, p.val)
 | 
						||
				}
 | 
						||
				let dataSelect = await PagedDep(json).then(res => {
 | 
						||
					this.selectorInfo.totalCount = res.TotalCount
 | 
						||
					if (res != undefined && res.Data.length > 0) {
 | 
						||
						for (let i = 0; i < res.Data.length; i++) {
 | 
						||
							res.Data[i].name = res.Data[i].NAME
 | 
						||
							res.Data[i].code = res.Data[i].CODE
 | 
						||
						}
 | 
						||
					}
 | 
						||
					return res.Data
 | 
						||
				})
 | 
						||
 | 
						||
				if (defaultChecked == null)
 | 
						||
					defaultChecked = []
 | 
						||
				if (dataSelect.length) {
 | 
						||
					this.selectorInfo = {
 | 
						||
						totalCount: this.selectorInfo.totalCount,
 | 
						||
						showPopup: true,
 | 
						||
						title: p.title,
 | 
						||
						name: p.name,
 | 
						||
						dataLists: dataSelect,
 | 
						||
						defaultChecked: defaultChecked
 | 
						||
					}
 | 
						||
				} else {
 | 
						||
					// 暂无数据
 | 
						||
				}
 | 
						||
			},
 | 
						||
			handleSelected(e) {
 | 
						||
				this.selectorInfo.showPopup = false
 | 
						||
				this.model.DEPARTMENT_NAME = e.NAME
 | 
						||
				this.model.DEPARTMENT_ID = e.ID
 | 
						||
				this.WorkerScheduling()
 | 
						||
			}
 | 
						||
		}
 | 
						||
	}
 | 
						||
</script>
 | 
						||
 | 
						||
<style>
 | 
						||
	.content {
 | 
						||
		background-color: #f4f7ff;
 | 
						||
		width: 100%;
 | 
						||
		/* #ifndef APP-PLUS */
 | 
						||
		height: calc(100vh - 44px - 50px); // 非APP平台下生效
 | 
						||
		/* #endif */
 | 
						||
		/* #ifdef APP-PLUS */
 | 
						||
		height: calc(100vh); // APP平台下生效
 | 
						||
		/* #endif */
 | 
						||
	}
 | 
						||
 | 
						||
	.container {
 | 
						||
		padding: 20px 16px 10px 16px;
 | 
						||
	}
 | 
						||
 | 
						||
	.form-sub {
 | 
						||
		/* margin: 20px 16px 10px 16px; */
 | 
						||
		/* border: 1px solid #EBEEF5; */
 | 
						||
		padding: 20px 10px 10px 10px;
 | 
						||
		/* box-shadow: rgba(0, 0, 0, 0.08) 0px 0px 3px 1px; */
 | 
						||
		background-color: #ffffff;
 | 
						||
		border-radius: 10px;
 | 
						||
	}
 | 
						||
 | 
						||
	.demo-ruleForm>>>.u-form-item__body__left__content__label {
 | 
						||
		font-size: 14px;
 | 
						||
		color: #8e8b9c;
 | 
						||
		/* justify-content: flex-start; */
 | 
						||
	}
 | 
						||
 | 
						||
	.demo-ruleForm>>>.u-form-item__body__left__content__ {
 | 
						||
		left: -11px;
 | 
						||
		top: 0px
 | 
						||
	}
 | 
						||
 | 
						||
	.demo-ruleForm>>>.u-textarea__field {
 | 
						||
		font-size: 14px;
 | 
						||
	}
 | 
						||
 | 
						||
	.demo-ruleForm>>>.u-cell__title-text {
 | 
						||
		font-size: 14px;
 | 
						||
	}
 | 
						||
 | 
						||
	.demo-ruleForm-thr>>>.u-textarea {
 | 
						||
		padding: 9px 9px 25px 9px;
 | 
						||
	}
 | 
						||
 | 
						||
	.demo-ruleForm-thr>>>.u-form-item__body__left__content__label {
 | 
						||
		font-size: 14px;
 | 
						||
		color: #8e8b9c;
 | 
						||
		/* justify-content: flex-start; */
 | 
						||
	}
 | 
						||
 | 
						||
	.demo-ruleForm-thr>>>.u-form-item__body__left__content__ {
 | 
						||
		left: -11px;
 | 
						||
		top: 0px
 | 
						||
	}
 | 
						||
 | 
						||
	.demo-ruleForm-thr>>>.u-textarea__field {
 | 
						||
		font-size: 14px;
 | 
						||
	}
 | 
						||
 | 
						||
	.demo-ruleForm-thr>>>.u-cell__title-text {
 | 
						||
		font-size: 14px;
 | 
						||
	}
 | 
						||
 | 
						||
	.bottom-button {
 | 
						||
		position: fixed;
 | 
						||
		bottom: 0;
 | 
						||
		left: 0;
 | 
						||
		width: 100%;
 | 
						||
		padding: 10px 16px;
 | 
						||
		box-sizing: border-box;
 | 
						||
		background: #f4f7ff;
 | 
						||
		z-index: 999;
 | 
						||
	}
 | 
						||
</style> |