<!-- 检查记录确认 退回信息 -->
<template>
	<view class="page-wrap">
		<view class="card">
			<uni-card margin="0" :is-shadow="true">
				<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" :rules="rules"
					ref="wForm" errorType="border-bottom">

					<view class="label-title">退回原因</view>
					<u-form-item prop="REASON" borderBottom>
						<u--textarea v-model="model.REASON" placeholder="请输入退回原因" border="surround"></u--textarea>
					</u-form-item>

					<view class="upload-title">附件</view>
					<full-upload v-model="model.Nav_Files" :isShowBtn='true' :listProp='listPropUpload'
						:listPropVal='listPropValUpload'></full-upload>
					<view class="label-title-red">请与检查登记人复核后再退回</view>
				</u--form>
			</uni-card>
		</view>

		<button type="primary" @click="Back">退回</button>
	</view>
</template>



<script>
	import {
		initFilter,
		extendRule,
		extendInclude,
		guid
	} from '../../../../utils/common'

	import {
		GetRejectModel,
		Reject
	} from '../../../../services/apply/subPages/BS/riskSubmit'

	export default {
		data() {
			return {
				tableKey: '0',
				TaskID: '',
				listPropUpload: ['REJECT_ID'],
				listPropValUpload: [],
				model: {
					ID: '',
					SAFE_CHECK_ID: '',
					SAFE_CHECK_DETAIL_ID: '',
					REASON: '',
					RESULT: 0,
					Nav_Files: []
				},
				rules: {
					'REASON': {
						type: 'string',
						required: true,
						trigger: ['blur', 'change']
					},
					// 'Nav_Files': {
					// 	type: 'string',
					// 	required: true,
					// 	trigger: ['blur', 'change']
					// }
				},
			}
		},
		onLoad(option) {
			this.model.SAFE_CHECK_DETAIL_ID = option.ID
			this.model.SAFE_CHECK_ID = option.SAFE_CHECK_ID
			this.model.ID = guid()
			this.listPropValUpload.push(this.model.ID)

			// this.loadData()
		},

		methods: {
			Back() {
				if (this.model.Nav_Files == null || this.model.Nav_Files.length < 1) {
					uni.$showErrorInfo('请上传附件！')
				}

				this.model.ORG_ID = uni.getStorageSync('orgId')
				// this.model.ID = guid()

				const ele = this.$refs
				ele['wForm'].validate().then(res => {

					// uni.navigateBack()

					Reject(this.model).then(res => {
						uni.$showMsgFunc('操作成功!', () => {
							uni.navigateBack()
						}, 'success', 1000)
					})

				}).catch(err => {
					uni.$showErrorInfo('校验失败！')
				})
			},

			loadData() {
				// const orgId = uni.getStorageSync('orgId')
				// const json = initFilter(orgId, "", "CODE", 1)
				// extendRule(json, 'ID', 1, this.model.ID);
				// json.IgnoreDataRule = true
				// GetRejectModel(json).then(res => {
				// 	this.model = res

				// 	// debugger
				// })
			},

		},
		computed: {

		}
	}
</script>


<style scoped>
	@import url("../../../../style/css/editTemplate.css");
	
	/* .page-wrap {
		padding: 16px;
	}

	.card {
		margin-bottom: 18px;
	}

	.sub-form {
		margin-bottom: 16px;
	}

	.upload-title {
		color: #303133;
		font-size: 15px;
		line-height: 22px;
		padding: 8px 0;
	}

	.page-wrap>>>.u-upload__button {
		margin-bottom: 0;
	}

	.btnEnable {
		background: #E6E6E6;
		color: #303133;
	}

	.label-title {
		color: #303133;
		font-size: 15px;
		line-height: 22px;
		padding-top: 8px;
	}

	.bottom-button {
		position: fixed;
		bottom: 0;
		left: 0;
		width: 100%;
		padding: 10px 16px;
		box-sizing: border-box;
		background: #fff;
		z-index: 999;
	} */
</style>