<template>
	<view class="office_page">
		<fileCard :isoffice="isoffice" :isleader="isleader" :isinfo="true"></fileCard>
		<view class="office_main">
			<view class="office_title">
				<uni-section v-if="isoffice" titleColor="#36a7f3" class="mb-10" title="办公室拟办" type="line"></uni-section>
				<uni-section v-if="isleader" titleColor="#36a7f3" class="mb-10" title="领导批示" type="line"></uni-section>
			</view>
			<view class="office_info">
				<u--form v-if="isoffice" :model="auditForm" labelWidth="130px" class="u-form default_title"
					labelPosition="left" ref="auditForm">
					<u-form-item label="办公室拟办" borderBottom prop="title">
						<u--textarea placeholder=""></u--textarea>
					</u-form-item>
					<u-form-item label="转发领导" borderBottom prop="teDate">
						<jp-picker placeholder="请选择转发领导" :range="leaderList" rangeKey="name" rangeValue="id"></jp-picker>
					</u-form-item>
					<u-form-item label="科室承办" borderBottom prop="teDate">
						<office-user-select  placeholder="请选择科室承办" title="科室承办"></office-user-select>
					</u-form-item>
					<u-form-item label="备注" borderBottom prop="message">
						<u--input placeholder="请输入备注" border="none"></u--input>
					</u-form-item>
					<view class="submit_btn flex ">
						<!-- <u-button @click="formSubmit" color="#36a7f3" plain hairline type="primary" text="暂存待办"></u-button> -->
						<u-button disabled="" type="primary" text="确认签字"></u-button>
					</view>
				</u--form>
				<u--form v-if="isleader" :model="auditForm" labelWidth="130px" class="u-form default_title"
					labelPosition="left" ref="auditForm">
					<u-form-item label="领导批示" borderBottom prop="title">
						<u--textarea placeholder=""></u--textarea>
					</u-form-item>
					<view class="submit_btn flex ">
						<u-button disabled="" type="primary" text="确认签字"></u-button>
					</view>
				</u--form>
				<!-- <signInput ref="sign" canvasId="twoDrowCanvas" canvasIds="twoRotateCanvas" :header="header"
					:action="action" @signToUrl="signToUrl">
				</signInput> -->
			</view>
		</view>
	</view>

</template>

<script>
	import fileCard from "./fileCard.vue"
	import signInput from "@/components/am-sign-input/am-sign-input.vue"
	import officeUserSelect from "@/components/office-user-select/office-user-select.vue"
	import userService from "@/api/sys/userService"
	export default {
		components: {
			fileCard,
			signInput,
			officeUserSelect
		},
		mounted() {
			this.searchForm.officeDTO.id="1770354910488272897"
			userService.list({
				current: this.tablePage.currentPage,
				size: this.tablePage.pageSize,
				orders: this.tablePage.orders,
				...this.searchForm
			}).then(data => {
				console.log("user=============", data);
				this.leaderList = data.records
			})
		},
		data() {
			return {
				action: "", //上传服务器的地址
				header: {}, //图片上传携带头部信息
				auditForm: {},
				isoffice: true,
				isleader: false,
				leaderList: [],
				tablePage: {
					total: 0,
					currentPage: 1,
					pageSize: 1000,
					orders: [{
						column: "a.create_time",
						asc: false
					}],
				},
				searchForm: {
					loginName: "",
					name: "",
					companyDTO: {
						id: "",
					},
					officeDTO: {
						id: "",
					},
				},
			}
		},
		methods: {
			/**
			 * @param {Object} e
			 * 签名完成回调
			 */
			signToUrl(e) {
				if (e.error_code && e.error_code === '201') {
					uni.showToast({
						title: e.msg,
						icon: 'none'
					})
					return
				}
			},
		}
	}
</script>

<style>
	.office_main {
		width: 100%;
		margin: 5px 0;
		padding: 0 20px;
		background-color: #fefefe;
	}

	.office_main .office_title {
		width: 100%;
		border-bottom: 1px solid #eee;
	}

	.submit_btn {
		background-color: #fefefe;
		bottom: 10px;
		box-shadow: none;
		padding: 20px 0;
	}

	.submit_btn button {
		height: 40px;
		width: 40%;
		border-radius: 30px;
	}
</style>