<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
	<div>
		<el-row>
			<el-col :span="24">

				<el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="true"
						 label-width="135px" @submit.native.prevent>

					<el-divider content-position="left"><i class="el-icon-document"></i> 项目信息</el-divider>
					<el-row  :gutter="0">
						<el-col :span="12">
							<el-form-item label="项目名称" prop="projectName"
										  :rules="[
                   ]">
								<el-input :disabled="true" v-model="inputForm.projectName" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="项目编号" prop="projectNumber"
										  :rules="[
                   ]">
								<el-input :disabled="true" v-model="inputForm.projectNumber" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="项目负责人" prop="projectManager"
										  :rules="[
                   ]">
								<el-input :disabled="true" v-model="inputForm.projectManager" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="创建人" prop="projectCreateByName"
										  :rules="[
                   ]">
								<el-input :disabled="true" v-model="inputForm.projectCreateByName" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="创建时间" prop="projectCreateTime"
										  :rules="[
                   ]">
								<el-input :disabled="true" v-model="inputForm.projectCreateTime" clearable></el-input>
							</el-form-item>
						</el-col>
					</el-row>
					<el-divider content-position="left"><i class="el-icon-document"></i> 质量复核信息</el-divider>
					<el-row  :gutter="0">
						<el-col :span="12">
							<el-form-item label="送审价(元)" prop="reviewFee"
										  :rules="[
							{required: true, message: '送审价(元)不能为空', trigger: 'blur'},
                   ]">
								<!--						  <el-input v-model="inputForm.reviewFee" placeholder="请输入送审价" @change="getFee" clearable></el-input>-->
								<el-input
									@change="getFee"
									v-on:input="inputForm.reviewFee=inputForm.reviewFee.replace(/[^\d.]/g,'')
							  .replace(/^\./g,'')
							  .replace(/\.{2,}/g,'.')
							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
									v-model="inputForm.reviewFee"
									controls-position="right"
									:controls="false"
									style="width:100%;"
									placeholder="请输入送审价(元)"
									clearable />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="审定价(元)" prop="approvalFee"
										  :rules="[
									{required: true, message: '审定价(元)不能为空', trigger: 'blur'},
			   ]">
								<!--						  <el-input v-model="inputForm.approvalFee" placeholder="请输入审定价" clearable></el-input>-->
								<el-input
									@change="getApprovalFee"
									v-on:input="inputForm.approvalFee=inputForm.approvalFee.replace(/[^\d.]/g,'')
							  .replace(/^\./g,'')
							  .replace(/\.{2,}/g,'.')
							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
									v-model="inputForm.approvalFee"
									controls-position="right"
									:controls="false"
									style="width:100%;"
									placeholder="请输入审定价(元)"
									clearable />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="合同类别" prop="contractCategory" :rules="[]">
								<el-radio-group v-model="inputForm.contractCategory">
									<el-radio v-for="item in $dictUtils.getDictList('contract_amount_type')" :key="item.value" :label="item.value">{{item.label}}</el-radio>
								</el-radio-group>
							</el-form-item>
						</el-col>
						<el-col :span="12" v-if="inputForm.contractCategory === '1'">
							<el-form-item label="合同价(元)" prop="contractFee"
										  :rules="[

			   ]">
								<el-input v-model="inputForm.contractFee" placeholder="请输入合同价(元)" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12" v-if="inputForm.contractCategory === '2'">
							<el-form-item label="费率(%)" prop="contractRate"
										  :rules="[

			   ]">
								<el-input v-model="inputForm.contractRate" placeholder="请输入费率(%)" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="下一节点审核人" prop="reviewBy"
										  :rules="[
										{required: true, message:'下一节点审核人不能为空', trigger:'change'}
                   ]">
								<UserSelectSignatory style="width: 100%" ref="userSelect1"
													 :readonly="true" :limit='1' :modelValue="inputForm.reviewBy"
													 @update:modelValue='(value) => {inputForm.reviewBy = value}'></UserSelectSignatory>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="核增核减额(元)" prop="verifyFee"
										  :rules="[

			   ]">
								<el-input v-model="inputForm.verifyFee" :disabled="true" placeholder="请输入核增核减额(元)" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="核增核减率(%)" prop="verifyRate"
										  :rules="[

			   ]">
								<el-input v-model="inputForm.verifyRate" :disabled="true" placeholder="请输入核增核减率(%)" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="咨询标的额(元)" prop="consultFee"
										  :rules="[

			   ]">
								<el-input v-model="inputForm.consultFee" :disabled="true" placeholder="请输入咨询标的额(元)" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="土建造价(元)" prop="buildingFee"
										  :rules="[

			   ]">
								<!--						  <el-input v-model="inputForm.buildingFee" placeholder="请输入土建造价(元)" clearable></el-input>-->
								<el-input
									@change="getBuildingFee"
									v-on:input="inputForm.buildingFee=inputForm.buildingFee.replace(/[^\d.]/g,'')
							  .replace(/^\./g,'')
							  .replace(/\.{2,}/g,'.')
							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
									v-model="inputForm.buildingFee"
									controls-position="right"
									:controls="false"
									style="width:100%;"
									placeholder="土建造价(元)"
									clearable />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="安装造价(元)" prop="installFee"
										  :rules="[

			   ]">
								<!--						  <el-input v-model="inputForm.installFee" placeholder="请输入安装造价(元)" clearable></el-input>-->
								<el-input
									@change="getInstallFee"
									v-on:input="inputForm.installFee=inputForm.installFee.replace(/[^\d.]/g,'')
							  .replace(/^\./g,'')
							  .replace(/\.{2,}/g,'.')
							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
									v-model="inputForm.installFee"
									controls-position="right"
									:controls="false"
									style="width:100%;"
									placeholder="安装造价(元)"
									clearable />
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="土建比例(%)" prop="buildingRate"
										  :rules="[

			   ]">
								<el-input v-model="inputForm.buildingRate" :disabled="true" placeholder="请输入土建比例(%)" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="安装比例(%)" prop="installRate"
										  :rules="[

			   ]">
								<el-input v-model="inputForm.installRate" :disabled="true" placeholder="请输入安装比例(%)" clearable></el-input>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="工作开始时间" prop="workStartDate" :rules="[
					  	{required: true, message: '工作开始时间不能为空', trigger: 'blur'},
					  	{ validator: validateDateRange, trigger: 'change' }
               ]">
								<el-date-picker
									style="width: 100%"
									v-model="inputForm.workStartDate"
									value-format="YYYY-MM-DD"
									placeholder="选择日期"
								>
								</el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="工作结束时间" prop="workEndDate" :rules="[
					  	{required: true, message: '工作结束时间不能为空', trigger: 'blur'},
					  	{ validator: validateDateRange, trigger: 'change' }
               ]">
								<el-date-picker
									style="width: 100%"
									v-model="inputForm.workEndDate"
									value-format="YYYY-MM-DD"
									placeholder="选择日期"
								>
								</el-date-picker>
							</el-form-item>
						</el-col>
						<el-col :span="12">
							<el-form-item label="造价咨询营业收入(万元)" prop="ziXunShouRu"
										  :rules="[
										{ validator: ziXunShouRuRange, trigger: 'change' },
										{required: true, message: '造价咨询营业收入(万元)不能为空', trigger: 'blur'},
			   ]">
								<el-input
									v-on:input="inputForm.ziXunShouRu=inputForm.ziXunShouRu.replace(/[^\d.]/g,'')
							  .replace(/^\./g,'')
							  .replace(/\.{2,}/g,'.')
							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
									v-model="inputForm.ziXunShouRu"
									controls-position="right"
									:controls="false"
									style="width:100%;"
									placeholder="请输入造价咨询营业收入(万元)"
									clearable />
							</el-form-item>
						</el-col>
					</el-row>
				</el-form >
				<el-divider content-position="left"><i class="el-icon-document"></i>
					<span>文件信息</span>
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-overflow
							ref="clientTable"
							class="vxe-table-element"
							style="margin-left: 5em"
							:row-config="{keyField: 'id'}"
							:column-config="{resizable: true}"
							:tree-config="{transform: true, expandAll: true}"
							:key="tableKey"
							:data="tableData">
							<vxe-column field="name" title="文件要求" width="240px" tree-node>
								<template #default="scope">
							<span style="font-weight: bold"
								  v-if="scope.row.parentId === '0'"
							>{{ scope.row.name }}
							</span>
									<span
										v-if="scope.row.parentId !== '0' && scope.row.mustFlag === 1"
									><span style="color: red;font-weight: bold">* </span>{{ scope.row.name }}
							</span>
									<span
										v-if="scope.row.parentId !== '0' && scope.row.mustFlag === 0"
									>{{ scope.row.name }}
							</span>
								</template>
							</vxe-column>
							<vxe-column field="attachmentName" title="文件描述/文件名称" show-overflow="false">
								<template #default="scope">
							<span
								v-if="scope.row.levelFlag === 2"
							>
								<span style="font-weight: bold">文件格式及大小：{{ scope.row.size }}</span>
								<br>
								<span>{{ scope.row.type }}</span>
							</span>
									<div v-if="ifName(scope.row) === true">
										<el-image
											style="width: 30px; height: 30px;padding-top: 4px;"
											:src="scope.row.lsUrl"
											:preview-src-list="[scope.row.lsUrl]"
											:preview-teleported="true"
										></el-image>
									</div>
									<div v-else>
										<el-link v-if="scope.row.levelFlag === 3"  type="primary" :underline="false" @click="showFile(scope.row)">{{scope.row.attachmentName}}</el-link>
									</div>
								</template>
							</vxe-column>
							<vxe-column field="workAttachmentType" width="100px" title="文件类型"></vxe-column>
							<vxe-column field="createDate" title="上传时间" width="100px"></vxe-column>
							<vxe-column field="fileSize" width="100px" title="文件大小(M)">
								<template #default="scope">
									{{getSize(scope.row.fileSize)}}
								</template>
							</vxe-column>

							<vxe-column
								title="操作"
								width="100px"
								fixed="right"
								align="center"
							>
								<template #default="scope">
									<el-button
										v-if="scope.row.levelFlag === 2"
										type="primary"
										size="small"
										:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
										@click="openFileForm(scope.row.id,this.inputForm.id)"
									>编辑</el-button>
									<el-button
										v-if="scope.row.levelFlag === 3"
										type="info"
										size="small"
										@click="toHref(scope.row)" >下载</el-button>

								</template>
							</vxe-column>
						</vxe-table>
					</el-col>
				</el-row>
				<FileForm ref="fileForm" @getFiles="getFiles"></FileForm>
			</el-col>
		</el-row>
	</div>
</template>

<script>
	import moment from 'moment';
	import FileForm from '@/views/cw/reportManagement/reportReview/FileForm'
	import OSSSerivce, {
		// eslint-disable-next-line no-unused-vars
		beforeAvatarUpload,
		// eslint-disable-next-line no-unused-vars
		openWindowOnUrl,
		// eslint-disable-next-line no-unused-vars
		toHref
	} from '@/api/sys/OSSService'
	import UserSelectSignatory from '@/components/userSelectNew'
	import ReportSignAndIssueService from '@/api/cw/reportManagement/ReportSignAndIssueService'
	import projectReportService from '@/api/cw/reportManagement/ProjectReportService'
	import CommonApi from '@/api/cw/common/CommonApi'
	export default {
		props: {
			businessId: {
				type: String,
				default: ''
			},
			formReadOnly: {
				type: Boolean,
				default: false
			},
			status: {
				type: String,
				default: ''
			}
		},
		data () {
			return {
				tableKey: '',
				tableData: [],
				validRules: {
					memberName: [
						{required: true, message: '成员名称不能为空'}
					],
					enrollCertNo: [
						{required: true, message: '注册/资格证号不能为空'}
					],
					profession: [
						{required: true, message: '专业不能为空'}
					],
					content: [
						{required: true, message: '本人负责内容不能为空'}
					],
					opinion: [
						{required: true, message: '审核意见不能为空'}
					],
				},
				validRules2: {
					memberName: [
						{required: true, message: '成员名称不能为空'}
					],
					enrollCertNo: [
						{required: true, message: '注册/资格证号不能为空'}
					],
					profession: [
						{required: true, message: '专业不能为空'}
					],
					opinion: [
						{required: true, message: '审核意见不能为空'}
					],
				},
				detailKey: '',
				title: '',
				method: '',
				loading: false,
				inputForm: {
					reviewByName: '',
					procInsId3: '',
					signAndIssueId: '',
					projectLevel: '',
					memberName: '',
					enrollCertNo: '',
					profession: '',
					professionType: '',
					projectName: '',
					projectId: '',
					projectNumber: '',
					projectManager: '',
					projectManagerId: '',
					projectCreateByName: '',
					projectCreateTime: '',
					reviewFee: '',
					approvalFee: '',
					contractCategory: '',
					contractFee: '',
					contractRate: '',
					reviewBy: '',
					verifyFee: '',
					verifyRate: '',
					consultFee: '',
					buildingFee: '',
					installFee: '',
					buildingRate: '',
					installRate: '',
					workStartDate: '',
					workEndDate: '',
					ziXunShouRu: '',
					createBy: {
						id: '',
						name: this.$store.state.user.name
					},
				},
				keyWatch: '',
			}
		},
		reportSignAndIssueService: null,
		commonApi: null,
		created () {
			this.reportSignAndIssueService = new ReportSignAndIssueService()
			this.commonApi = new CommonApi()
		},
		computed: {
			bus: {
				get () {
					return this.businessId
				},
				set (val) {
					this.businessId = val
				}
			}
		},
		watch: {
			'keyWatch': {
				handler (newVal) {
					if (this.commonJS.isNotEmpty(this.bus)) {
						this.init('', this.bus)
					} else {
						this.$nextTick(() => {
							// this.$refs.inputForm.resetFields()
						})
					}
				}
			},
			'loading': {
				handler (newVal) {
					this.$emit('changeLoading', newVal)
				}
			}
		},
		components: {
			FileForm,
			UserSelectSignatory,
		},
		methods: {
			getKeyWatch (keyWatch) {
				this.keyWatch = keyWatch
			},
			init (method, id) {
				console.log('method', method)
				this.method = method
				this.inputForm = {
					reviewByName: '',
					procInsId3: '',
					signAndIssueId: '',
					projectLevel: '',
					memberName: '',
					enrollCertNo: '',
					profession: '',
					professionType: '',
					projectName: '',
					projectId: '',
					projectNumber: '',
					projectManager: '',
					projectManagerId: '',
					projectCreateByName: '',
					projectCreateTime: '',
					reviewFee: '',
					approvalFee: '',
					contractCategory: '',
					contractFee: '',
					contractRate: '',
					reviewBy: '',
					verifyFee: '',
					verifyRate: '',
					consultFee: '',
					buildingFee: '',
					installFee: '',
					buildingRate: '',
					installRate: '',
					workStartDate: '',
					workEndDate: '',
					ziXunShouRu: '',
					createBy: {
						id: '',
						name: this.$store.state.user.name
					},
				}
				this.inputForm.id = id
				this.loading = false
				this.$nextTick(() => {
					// this.$refs.inputForm.resetFields()

					this.loading = true
					projectReportService.queryByIdNew(this.inputForm.id).then((data) => {
						if (data) {
							this.inputForm = this.recover(this.inputForm, data)

							if (this.commonJS.isEmpty(this.inputForm.contractCategory)) {
								this.inputForm.contractCategory = '1'
							}

							projectReportService.getAttachmentList(data.projectId,this.inputForm.id,'').then((data) => {
								this.tableData = data
								this.tableKey = Math.random()
							})

							if (this.status === 'taskFormDetail' || this.status === 'audit') {
								this.method = 'view'
							} else {
								this.method = 'false'
							}
							this.loading = false
						} else {
							projectReportService.queryBySignAndIssueId(this.inputForm.id).then((data2) => {
								if (data2) {
									this.inputForm = this.recover(this.inputForm, data2)

									if (this.commonJS.isEmpty(this.inputForm.contractCategory)) {
										this.inputForm.contractCategory = '1'
									}

									projectReportService.getAttachmentList(data2.projectId,this.inputForm.id,'').then((data3) => {
										this.tableData = data3
										this.tableKey = Math.random()
									})

									if (this.status === 'taskFormDetail' || this.status === 'audit') {
										this.method = 'view'
									} else {
										this.method = 'false'
									}
									this.loading = false
								}

							})
						}

					})
				})
			},
			clearClientList () {
				// 项目直接对接联系人列表清除
				this.inputForm.clientList = []
				this.$forceUpdate()
			},
			saveForm (callback) {
				this.doSubmit('save', callback)
			},
			startForm (callback) {
				this.loading = true
				if (this.commonJS.isNotEmpty(this.inputForm.id)) {
					this.reportSignAndIssueService.queryByReportId(this.inputForm.id).then((data) => {
						if (this.commonJS.isNotEmpty(data.status) && data.status !== '0' && data.status !== '1' && data.status !== '3') { // 审核状态不是“未发起”或“暂存”或“撤回”，就弹出提示
							this.loading = false
							this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
							throw new Error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						} else {
							this.doSubmit('start', callback)
						}
					})
				} else {
					this.doSubmit('start', callback)
				}
			},
			async agreeForm (callback) {
				this.loading = true
				await this.reportSignAndIssueService.queryByReportId(this.inputForm.id).then((data) => {
					if (data.status !== '2') { // 审核状态不是“待审核”，就弹出提示
						this.loading = false
						this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						throw new Error()
					} else {
						this.doSubmit('agree', callback)
					}
				})
			},
			reapplyForm (callback) {
				this.loading = true
				this.reportSignAndIssueService.queryByReportId(this.inputForm.id).then((data) => {
					if (data.status !== '4') { // 审核状态不是“驳回”，就弹出提示
						this.loading = false
						this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						throw new Error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
					} else {
						this.doSubmit('reapply', callback)
					}
				})
			},
			// 表单提交
			doSubmit (status, callback) {
				if (status === 'save') {
					// 暂存
					this.inputForm.status = '1'
					this.loading = true
					this.reportSignAndIssueService.saveForm(this.inputForm).then((data) => {
						callback(data.businessTable, data.businessId, this.inputForm)
						this.loading = false
					}).catch(() => {
						this.loading = false
					})
					return
				} else if (status === 'start') {
					// 送审  待审核
					this.inputForm.status = '2'
					this.inputForm.assignee = this.inputForm.reviewBy
				} else if (status === 'agree') {
					// 审核同意
					this.inputForm.agreeDate = this.moment(new Date()).format('YYYY-MM-DD')
					this.inputForm.agreeUserId = this.$store.state.user.id
					// this.inputForm.status = '5'
				} else if (status === 'reapply') {
					this.inputForm.status = '2'
					this.inputForm.assignee = this.inputForm.reviewBy
				}
				if (this.commonJS.isEmpty(this.tableData)) {
					this.loading = false
					this.$message.error('附件信息加载中，请稍等!')
					throw new Error('附件信息加载中，请稍等!')
				}
				this.$refs['inputForm'].validate((valid) => {
					if (valid) {
						this.loading = true
						if (status === 'agree') {

							this.inputForm.status = '5'
							this.reportSignAndIssueService.saveForm(this.inputForm).then((data) => {
								callback(data.businessTable, data.businessId, this.inputForm)
								this.loading = false
							}).catch(() => {
								this.loading = false
							})

						}else{

							this.tableData.forEach(item=>{
								if (item.levelFlag === 2 && item.mustFlag === 1){
									if (item.children.length === 0){
										this.loading = false
										this.$message.error(item.name + '文件未上传')
										throw new Error(item.name + '文件未上传')
									} else {
										item.children.forEach(child => {
											const fileExtension = child.attachmentName.split('.').pop(); // 获取文件后缀名
											const supportedFileTypes = item.type.split(','); // 支持的文件类型数组
											if (!supportedFileTypes.includes(fileExtension)) {
												this.loading = false;
												this.$message.error(child.attachmentName + ' 文件类型不受支持');
												throw new Error(child.attachmentName + ' 文件类型不受支持');
											}
										});
									}
								}
							})

							this.reportSignAndIssueService.saveForm(this.inputForm).then((data) => {
								callback(data.businessTable, data.businessId, this.inputForm)
								this.loading = false
							}).catch(() => {
								this.loading = false
							})

						}

					} else {
						this.loading = false
					}
				})
			},
			async updateStatusById (type, callback) {
				this.loading = true
				if (type === 'reject' || type === 'reback') {
					await this.reportSignAndIssueService.queryByReportId(this.inputForm.id).then((data) => {
						if (data.status !== '2') { // status的值不等于“审核中”就弹出提示
							this.loading = false
							this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
							throw new Error()
						} else {
							if (type === 'reject') {
								this.reportSignAndIssueService.queryByReportId(this.inputForm.id).then((review) => {
									console.log('review', review)
									this.rejectOn(callback)
								})
							}
							if (type === 'reback') {
								// 撤回
								let param = {status: '3', id: this.inputForm.signAndIssueId}
								this.reportSignAndIssueService.updateStatusByReportId(param)
							}
						}
					})
				} else if (type === 'hold') {
					this.reportSignAndIssueService.queryByReportId(this.inputForm.id).then((data) => {
						if (data.status !== '4') { // status的值不等于“驳回”就弹出提示
							this.loading = false
							this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
							throw new Error()
						} else {
							// 终止
							let param = {status: '1', id: this.inputForm.signAndIssueId}
							this.reportSignAndIssueService.updateStatusByReportId(param).then(() => {
								callback()
								this.loading = false
							})
						}
					})
				}
			},
			// 这个方法是这个之前这个页面的驳回方法，现在粘出来复用
			rejectOn (callback) {
				// 驳回
				let param
				this.inputForm.status = '4'
				param = {status: this.inputForm.status,
					id: this.inputForm.signAndIssueId,
					needUpdate2: this.inputForm.needUpdate2,
					needUpdate3: this.inputForm.needUpdate3,
					remark2: this.inputForm.remark2,
					remark3: this.inputForm.remark3,
					details: this.inputForm.details
				}
				this.reportSignAndIssueService.updateStatusByReportId(param).then(() => {
					this.loading = false
					callback()
				})
			},
			close () {
				this.inputForm = {
					reviewByName: '',
					procInsId3: '',
					signAndIssueId: '',
					projectLevel: '',
					memberName: '',
					enrollCertNo: '',
					profession: '',
					professionType: '',
					projectName: '',
					projectId: '',
					projectNumber: '',
					projectManager: '',
					projectManagerId: '',
					projectCreateByName: '',
					projectCreateTime: '',
					reviewFee: '',
					approvalFee: '',
					contractCategory: '',
					contractFee: '',
					contractRate: '',
					reviewBy: '',
					verifyFee: '',
					verifyRate: '',
					consultFee: '',
					buildingFee: '',
					installFee: '',
					buildingRate: '',
					installRate: '',
					workStartDate: '',
					workEndDate: '',
					ziXunShouRu: '',
					createBy: {
						id: '',
						name: this.$store.state.user.name
					},
				}
			},
			getProfessionList(type) {
				switch (type) {
					case '1':
					case '2':
						return this.$dictUtils.getDictList('sys_cert_profession_build');
					case '3':
					case '4':
						return this.$dictUtils.getDictList('sys_cert_profession_cost');
					case '5':
						return this.$dictUtils.getDictList('sys_cert_profession_supervision');
					case '6':
						return this.$dictUtils.getDictList('sys_cert_profession_accounting');
					default:
						return [];
				}
			},
			getFee() {
				//送审价
				var rf = this.inputForm.reviewFee
				//审定价
				var af = this.inputForm.approvalFee
				if (this.commonJS.isNotEmpty(rf) && rf !== '0.00' && this.commonJS.isNotEmpty(af) && af !== '0.00') {
					var hf = (af*100-rf*100)/100;
					var rate = parseFloat(hf) / parseFloat(rf) * 100
					this.inputForm.verifyFee = hf.toFixed(2)
					this.inputForm.verifyRate = rate.toFixed(2)
				}
				if (this.commonJS.isNotEmpty(af)) {
					this.inputForm.consultFee = af
				}

			},
			getApprovalFee() {
				//送审价
				var rf = this.inputForm.reviewFee
				//审定价
				var af = this.inputForm.approvalFee
				if(this.commonJS.isNotEmpty(rf) && rf != '0.00' && this.commonJS.isNotEmpty(af) && af !='0.00'){
					//计算审核增减额
					var hf = (af*100-rf*100)/100;
					var rate = parseFloat(hf) / parseFloat(rf) * 100
					this.inputForm.verifyFee = hf.toFixed(2)
					this.inputForm.verifyRate = rate.toFixed(2)
				}
				if(this.commonJS.isNotEmpty(af)){
					this.inputForm.consultFee = af
				}
				this.inputForm.buildingFee = ''
				this.inputForm.installFee = ''
				this.inputForm.buildingRate = ''
				this.inputForm.installRate = ''
			},
			getBuildingFee() {
				var af = this.inputForm.approvalFee
				//土建
				var bf = this.inputForm.buildingFee
				if(this.commonJS.isNotEmpty(bf) && this.commonJS.isNotEmpty(af)){
					var hf = parseInt(af)-parseInt(bf);
					var rate = Math.round(parseInt(bf) / parseInt(af) * 100) / 100 * 100
					this.inputForm.buildingRate = rate
					this.inputForm.installFee = hf
					var inRate = Math.round(parseInt(hf) / parseInt(af) * 100) / 100 * 100
					this.inputForm.installRate = inRate
				}
				if(this.commonJS.isEmpty(bf) || this.commonJS.isEmpty(af)){
					this.inputForm.buildingRate = ''
				}
			},
			getInstallFee() {
				var af = this.inputForm.approvalFee
				//安装
				var inf = this.inputForm.installFee
				if(this.commonJS.isNotEmpty(inf) && this.commonJS.isNotEmpty(af)){
					var hf = parseInt(af)-parseInt(inf);
					var rate = Math.round(parseInt(inf) / parseInt(af) * 100) / 100 * 100
					this.inputForm.installRate = rate
					this.inputForm.buildingFee = hf
					var bRate = Math.round(parseInt(hf) / parseInt(af) * 100) / 100 * 100
					this.inputForm.buildingRate = bRate
				}
				if(this.commonJS.isEmpty(inf) || this.commonJS.isEmpty(af)){
					this.inputForm.installRate = ''
				}
			},
			validateDateRange(rule, value, callback) {
				const workStartDate = this.inputForm.workStartDate;
				const workEndDate = this.inputForm.workEndDate;

				if (workStartDate && workEndDate && workStartDate > workEndDate) {
					this.inputForm.workEndDate = ''
					callback(new Error('工作开始时间不能大于工作结束时间'));
				} else {
					callback();
				}
			},
			ziXunShouRuRange(rule, value, callback) {
				if (!value || value.trim() === "") {
					callback(new Error('造价咨询营业收入不能为空！'));
				} else if (parseFloat(value) <= 0) {
					callback(new Error('造价咨询营业收入必须大于0！'));
				} else {
					callback();
				}
			},
			ifName (row) {
				if (this.commonJS.isEmpty(row.attachmentName)) {
					row.attachmentName = '---'
					return false
				}
				let suffix = row.attachmentName.substring(row.attachmentName.lastIndexOf('.') + 1)
				if (suffix === 'jpg' || suffix === 'png' || suffix === 'gif' || suffix === 'bmp' || suffix === 'jpeg') {
					return true
				} else {
					return false
				}
			},
			showFile (row) {
				console.log("showFile",row)
				row.name = row.attachmentName
				openWindowOnUrl(row)
			},
			getSize (value) {
				if (this.commonJS.isEmpty(value)) {
					return ''
				} else {
					let val = parseInt(value)
					let k = 1024
					let sizes = ['B', 'KB', 'MB', 'GB', 'PB', 'TB', 'EB', 'ZB', 'YB']
					let i = Math.floor(Math.log(val) / Math.log(k))
					let result = val / Math.pow(k, i);
					let kb = parseFloat(result.toPrecision(3));
					return kb + '' + sizes[i]
				}
			},
			//测试按钮
			openFileForm(id,typeId){
				console.log('this.id', id )
				this.$refs.fileForm.init("add", id,this.inputForm.projectId)
			},
			toHref (row) {
				console.log("toHref",row)
				toHref(row)
			},
			getFiles(){
				projectReportService.getAttachmentList(this.inputForm.projectId,this.inputForm.id,'').then((data) => {
					this.tableData = data
					this.tableKey = Math.random()
				})

			},
		}
	}
</script>
<style scoped>
	/deep/ .el-input-number .el-input__inner {
		text-align: left;
	}

	/deep/ .vxe-select-option {
		padding: 0 .6em;
		max-width: 600px;
		overflow: visible;
		text-overflow: ellipsis;
		white-space: nowrap;
		-webkit-user-select: none;
		-moz-user-select: none;
		-ms-user-select: none;
		user-select: none
	}
</style>
