<template>
	<div>
		<transition name="bounce">
			<examineTop
				v-if="isExmaineTop === 2"
				:radios="radios"
				@handleBtns="handleBtns"
				@handleOpen="handleOpen"
				:isexamineBtns="isexamineBtns"
			/>
			<!-- 	:isexamineBtns="isexamineBtns" -->
		</transition>
	</div>
	<div
		:style="{ height: heightNum + 'px!important' }"
		class="order-create-container order-mc-bg main-container"
	>
		<div class="order-create-btn-group">
			<!-- 顶部按钮组 -->
			<template v-if="isExmaineTop !== 2">
				<toolBtn
					:btnType="btnType"
					:isDisable="isDisable"
					@actionhandel="actionhandel"
					:isExmaineTop="isShow"
				></toolBtn>
			</template>
		</div>
		<div class="order-create-base-info">
			<img
				class="reviewIconImg"
				src="../../../assets/reviewed_ico.png"
				v-if="baseInfoForm.documentStatus === 'c'"
			/>
			<el-tabs
				style="margin-bottom: 8px"
				type="border-card"
				v-loading="isLoading"
			>
				<el-tab-pane label="基本信息">
					<div class="base-info-form-box">
						<el-form :model="baseInfoForm" label-width="80px">
							<el-row :gutter="10">
								<el-col :span="4">
									<div class="div-col">
										<div class="order-number-bx item-bt-s">
											<el-form-item
												class="Iisshow"
												label="单据编号"
											>
												<el-input
													:disabled="isEdit"
													:maxlength="255"
													@input="
														saleRexgu(
															baseInfoForm.billNo,
															'billNo'
														);
														purchaseCom(
															baseInfoForm.billNo,
															'billNo'
														);
													"
													placeholder="(保存时自动生成)"
													v-model.trim="
														baseInfoForm.billNo
													"
												></el-input>
												<div
													:data-clipboard-text="
														baseInfoForm.billNo
													"
													@click="saleOrderCopy"
													class="copyBtn"
												>
													<i
														class="el-icon-document-copy"
													/>
												</div>
											</el-form-item>
										</div>
										<el-form-item
											class="item-bt-s"
											label="单据状态"
										>
											<el-select
												:disabled="true"
												placeholder="请选择单据状态"
												v-model="
													baseInfoForm.documentStatus
												"
											>
												<el-option
													:key="key + index"
													:label="value"
													:value="key"
													@click="
														purchaseCom(
															baseInfoForm.documentStatus,
															'documentStatus'
														)
													"
													style="font-size: 12px"
													v-for="(
														value, key, index
													) in statusForm.documentStatus"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											:required="true"
											class="item-bt-s"
											label="单据类型"
										>
											<el-select
												:disabled="true"
												filterable
												placeholder="请选择调出类型"
												v-model="
													baseInfoForm.billTypeId
												"
											>
												<el-option
													:key="key + index"
													:label="value"
													:value="key"
													@click="
														purchaseCom(
															baseInfoForm.billTypeId,
															'billTypeId'
														)
													"
													style="font-size: 12px"
													v-for="(
														value, key, index
													) in statusForm.billType"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											:required="true"
											class="item-bt-s item-date"
											label="入库日期"
										>
											<el-date-picker
												:disabled="isEdit"
												:disabledDate="pickerOptions"
												@change="
													purchaseCom(
														baseInfoForm.date,
														'date'
													)
												"
												format="YYYY-MM-DD"
												placeholder="年/月/日"
												type="date"
												v-model="baseInfoForm.date"
												value-format="YYYY-MM-DD"
											></el-date-picker>
										</el-form-item>
									</div>
								</el-col>
								<el-col :span="4">
									<div class="div-col col-2">
										<el-form-item
											:required="true"
											class="item-bt-s"
											label="收料组织"
										>
											<el-select
												:disabled="true"
												class="click-cell-ipt-issue"
												filterable
												placeholder="请选择组织"
												v-model="
													baseInfoForm.stockOrgId
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													@click="
														purchaseCom(
															baseInfoForm.stockOrgId,
															'stockOrgId'
														)
													"
													style="font-size: 12px"
													v-for="item in statusForm.saleOrg"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											class="item-bt-s"
											label="收料部门"
										>
											<el-cascader
												:disabled="isEdit"
												:options="statusForm.stockDepts"
												:props="optionProps"
												:show-all-levels="false"
												@change="
													purchaseCom(
														baseInfoForm.stockDeptId,
														'stockDeptId',
														'type'
													)
												"
												clearable
												placeholder="请选择部门"
												ref="cascaderType"
												style="font-size: 12px"
												v-model="
													baseInfoForm.stockDeptId
												"
											></el-cascader>
										</el-form-item>
										<el-form-item
											class="item-bt-s"
											label="仓管员"
										>
											<el-select
												:disabled="isEdit"
												placeholder="请选择仓管员"
												v-model="
													baseInfoForm.stockManager
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													:style="{
														height: item.disable
															? '0px'
															: 'auto',
													}"
													@click="
														purchaseCom(
															baseInfoForm.stockManager,
															'stockManager'
														)
													"
													style="font-size: 12px"
													v-for="item in statusForm.stockPersons"
												></el-option>
											</el-select>
										</el-form-item>
									</div>
								</el-col>
								<el-col :span="4">
									<div class="div-col">
										<el-row :gutter="0">
											<el-col :span="24">
												<el-form-item
													:required="true"
													class="item-bt-s"
													label="供应商"
												>
													<el-select
														:clearable="true"
														:disabled="
															isEdit ||
															isPushDownOrg
														"
														filterable
														placeholder="请输入关键词"
														remote
														reserve-keyword
														v-model="
															baseInfoForm.supplierId
														"
													>
														<el-option
															:key="
																item.id +
																item.name
															"
															:label="item.name"
															:value="item.id"
															:style="{
																height: item.disable
																	? '0px'
																	: 'auto',
															}"
															@click="
																purchaseCom(
																	item.id,
																	'supplierId'
																)
															"
															v-for="item in statusForm.getCustomerNumList"
														></el-option>
													</el-select>
												</el-form-item>
												<el-form-item
													:required="true"
													class="item-bt-s"
													label="采购组织"
												>
													<el-select
														:disabled="
															isEdit ||
															isPushDownOrg
														"
														filterable
														placeholder="请选择组织"
														v-model="
															baseInfoForm.purchaseOrgId
														"
													>
														<el-option
															:key="item.id"
															:label="item.name"
															:value="item.id"
															:style="{
																height: item.disable
																	? '0px'
																	: 'auto',
															}"
															@click="
																purchaseCom(
																	baseInfoForm.purchaseOrgId,
																	'purchaseOrgId'
																)
															"
															style="
																font-size: 12px;
															"
															v-for="item in statusForm.saleOrg"
														></el-option>
													</el-select>
												</el-form-item>
												<el-form-item
													class="item-bt-s cascader-dis"
													label="采购部门"
												>
													<el-cascader
														:disabled="isEdit"
														:options="
															statusForm.purchaseDepts
														"
														:props="optionPropsPur"
														:show-all-levels="false"
														@change="
															purchaseCom(
																baseInfoForm.purchaseDeptId,
																'purchaseDeptId',
																'purType'
															)
														"
														clearable
														placeholder="请选择部门"
														ref="cascader"
														style="font-size: 12px"
														v-model="
															baseInfoForm.purchaseDeptId
														"
													></el-cascader>
												</el-form-item>
												<el-form-item
													class="item-bt-s"
													label="采购员"
												>
													<el-select
														:disabled="isEdit"
														class="click-cell-ipt-issue"
														placeholder="请选择采购员"
														v-model="
															baseInfoForm.purchaserId
														"
													>
														<el-option
															:key="item.id"
															:label="item.name"
															:value="item.id"
															:style="{
																height: item.disable
																	? '0px'
																	: 'auto',
															}"
															@click="
																purchaseCom(
																	baseInfoForm.purchaserId,
																	'purchaserId'
																)
															"
															style="
																font-size: 12px;
															"
															v-for="item in statusForm.purchasePersons"
														></el-option>
													</el-select>
												</el-form-item>
											</el-col>
										</el-row>
									</div>
								</el-col>
								<el-col :span="12"></el-col>
							</el-row>
						</el-form>
					</div>
				</el-tab-pane>
				<el-tab-pane label="财务信息">
					<div class="base-info-form-box">
						<el-form :model="baseInfoForm" label-width="80px">
							<el-row :gutter="10">
								<el-col :span="4">
									<div class="div-col">
										<el-form-item
											:required="true"
											class="item-bt-s"
											label="结算组织"
										>
											<el-select
												:disabled="
													isEdit || isPushDownOrg
												"
												filterable
												placeholder="请选择组织"
												v-model="
													baseInfoForm.settleOrgId
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													@click="
														purchaseCom(
															baseInfoForm.settleOrgId,
															'settleOrgId'
														)
													"
													style="font-size: 12px"
													v-for="item in statusForm.saleOrg"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											:required="true"
											class="item-bt-s"
											label="结算币别"
										>
											<el-select
												:disabled="
													isEdit || isPushDownOrg
												"
												@change="settleCurrMethods"
												placeholder="请选择结算币别"
												v-model="
													baseInfoForm.settleCurrId
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													@click="
														purchaseCom(
															baseInfoForm.settleCurrId,
															'settleCurrId'
														)
													"
													style="font-size: 12px"
													v-for="item in statusForm.setlementDifferences"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											class="item-bt-s"
											label="结算方式"
										>
											<el-select
												:disabled="isEdit"
												placeholder="请选择结算方式"
												v-model="
													baseInfoForm.settleTypeId
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													:style="{
														height: item.disable
															? '0px'
															: 'auto',
													}"
													@click="
														purchaseCom(
															baseInfoForm.settleTypeId,
															'settleTypeId'
														)
													"
													style="font-size: 12px"
													v-for="item in statusForm.exchangeRateTypes"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											class="item-bt-s"
											label="付款条件"
										>
											<el-select
												:disabled="isEdit"
												placeholder="请选择收款条件"
												v-model="
													baseInfoForm.payconditionId
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													:style="{
														height: item.disable
															? '0px'
															: 'auto',
													}"
													@click="
														purchaseCom(
															baseInfoForm.payconditionId,
															'payconditionId'
														)
													"
													style="font-size: 12px"
													v-for="item in statusForm.collectionTermss"
												></el-option>
											</el-select>
										</el-form-item>
									</div>
								</el-col>
								<el-col :span="4">
									<div class="div-col col-2">
										<el-form-item
											class="item-bt-s"
											label="本位币"
										>
											<el-select
												:disabled="true"
												placeholder="请选择结算币别"
												v-model="
													baseInfoForm.localCurrId
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													style="font-size: 12px"
													v-for="item in statusForm.setlementDifferences"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											class="item-bt-s"
											label="汇率类型"
										>
											<el-select
												:disabled="true"
												placeholder="请选择汇率"
												v-model="
													baseInfoForm.exchangeTypeId
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													@click="
														purchaseCom(
															baseInfoForm.exchangeTypeId,
															'exchangeTypeId'
														)
													"
													style="font-size: 12px"
													v-for="item in statusForm.rateTypeList"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											class="item-bt-s Iisshow"
											label="汇率"
										>
											<el-input
												:disabled="true"
												placeholder=" "
												v-model="
													baseInfoForm.exchangeRate
												"
											></el-input>
											<div
												:data-clipboard-text="
													baseInfoForm.exchangeRate
												"
												@click="saleOrderCopy"
												class="copyBtn"
											>
												<i
													class="el-icon-document-copy"
												/>
											</div>
										</el-form-item>
									</div>
								</el-col>
								<el-col :span="4">
									<div class="div-col">
										<el-row :gutter="0">
											<el-col :span="24">
												<el-form-item
													class="item-bt-s Iisshow"
													label="税额"
												>
													<el-input
														:disabled="true"
														placeholder=" "
														v-model="
															baseInfoForm.billTaxAmount
														"
													></el-input>
													<div
														:data-clipboard-text="
															baseInfoForm.billTaxAmount
														"
														@click="saleOrderCopy"
														class="copyBtn"
													>
														<i
															class="el-icon-document-copy"
														/>
													</div>
												</el-form-item>
												<el-form-item
													class="item-bt-s Iisshow"
													label="金额"
												>
													<el-input
														:disabled="true"
														placeholder=" "
														v-model="
															baseInfoForm.billAmount
														"
													></el-input>
													<div
														:data-clipboard-text="
															baseInfoForm.billAmount
														"
														@click="saleOrderCopy"
														class="copyBtn"
													>
														<i
															class="el-icon-document-copy"
														/>
													</div>
												</el-form-item>
												<el-form-item
													class="item-bt-s Iisshow"
													label="价税合计"
												>
													<el-input
														:disabled="true"
														placeholder=" "
														v-model="
															baseInfoForm.billAllAmount
														"
													></el-input>
													<div
														:data-clipboard-text="
															baseInfoForm.billAllAmount
														"
														@click="saleOrderCopy"
														class="copyBtn"
													>
														<i
															class="el-icon-document-copy"
														/>
													</div>
												</el-form-item>
											</el-col>
										</el-row>
									</div>
								</el-col>
								<el-col :span="12"></el-col>
							</el-row>
						</el-form>
					</div>
				</el-tab-pane>
				<el-tab-pane label="操作记录">
					<div class="base-info-form-box">
						<el-form
							:model="baseInfoForm"
							label-width="80px"
							ref="form"
						>
							<el-row :gutter="10">
								<el-col :span="4">
									<div class="div-col">
										<el-form-item
											class="item-bt-s"
											label="创建人"
										>
											<el-input
												:disabled="true"
												placeholder
												v-model.trim="
													baseInfoForm.creatorIdName
												"
											></el-input>
										</el-form-item>
										<el-form-item
											class="item-bt-s"
											label="创建时间"
										>
											<el-input
												:disabled="true"
												placeholder
												v-model.trim="
													baseInfoForm.createDate
												"
											></el-input>
										</el-form-item>
									</div>
								</el-col>
								<el-col :span="4">
									<div class="div-col col-2">
										<el-form-item
											:required="true"
											class="item-bt-s"
											label="最后修改人"
										>
											<el-input
												:disabled="true"
												placeholder
												v-model.trim="
													baseInfoForm.modifierName
												"
											></el-input>
										</el-form-item>
										<el-form-item
											:required="true"
											class="item-bt-s"
											label="最后修改时间"
										>
											<el-input
												:disabled="true"
												placeholder
												v-model.trim="
													baseInfoForm.modifyDate
												"
											></el-input>
										</el-form-item>
										<el-form-item
											:required="true"
											class="item-bt-s"
											label="提交时间"
										>
											<el-input
												:disabled="true"
												placeholder
												v-model.trim="
													baseInfoForm.submitDate
												"
											></el-input>
										</el-form-item>
									</div>
								</el-col>
								<el-col :span="4">
									<div class="div-col">
										<el-row :gutter="0">
											<el-col :span="24">
												<el-form-item
													:maxlength="50"
													class="item-bt-s"
													label="审核人"
												>
													<el-input
														:disabled="true"
														placeholder
														v-model.trim="
															baseInfoForm.approverName
														"
													></el-input>
												</el-form-item>
												<el-form-item
													class="item-bt-s"
													label="审核时间"
												>
													<el-input
														:disabled="true"
														placeholder
														v-model.trim="
															baseInfoForm.approveDate
														"
													></el-input>
												</el-form-item>
											</el-col>
										</el-row>
									</div>
								</el-col>
								<el-col :span="4"></el-col>
								<el-col :span="4"></el-col>
							</el-row>
						</el-form>
					</div>
				</el-tab-pane>
			</el-tabs>
		</div>
		<div class="order-create-tell-info">
			<div class="tell-info-row-title">
				<h3>明细信息</h3>
				<div class="long-line-bx">
					<div class="long-line"></div>
				</div>
			</div>
			<div class="tell-info-button-group">
				<DetailsOperation
					:detailBtn="detailBtn"
					:deviationSelectArr="selectRowIndexArr"
					:isEdit="isEdit"
					@addGift="addGift"
					@deleteRow="selectDeleteRow"
				></DetailsOperation>
			</div>
			<div class="tell-info-table">
				<el-table
					:cell-style="disabledCellStyle"
					:data="baseInfoForm.details"
					:header-cell-class-name="mustAfter"
					:max-height="tableHeight"
					@cell-click="getRowCol"
					@select="selectRow"
					@select-all="selectAll"
					border
					ref="multipleTable"
					style="width: 100%; font-size: 12px"
					v-loading="isLoading"
				>
					<el-table-column
						align="center"
						fixed
						type="selection"
						width="40"
					/>
					<el-table-column
						align="left"
						label="采购订单号"
						prop="parentOrderBillNo"
						width="180"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>采购订单号
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isParentOrderBillNo">{{
								scope.row.parentOrderBillNo
							}}</span>
							<el-input
								:disabled="isEdit || scope.row.isPushDownOrg"
								:id="'parentOrderBillNo' + scope.$index"
								@input="
									detailsCom(
										scope.row.parentOrderBillNo,
										'parentOrderBillNo',
										scope.row,
										scope.column
									)
								"
								class="click-cell-ipt"
								placeholder="请输入"
								v-if="scope.row.isParentOrderBillNo"
								v-model.trim="scope.row.parentOrderBillNo"
							></el-input>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="销售订单号"
						prop="saleOrderNo"
						width="180"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>销售订单号
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isSaleOrderNo">{{
								scope.row.saleOrderNo
							}}</span>
							<el-input
								:disabled="isEdit || scope.row.isPushDownOrg"
								:id="'saleOrderNo' + scope.$index"
								@input="
									detailsCom(
										scope.row.saleOrderNo,
										'saleOrderNo',
										scope.row,
										scope.column
									)
								"
								class="click-cell-ipt"
								placeholder="请输入"
								v-if="scope.row.isSaleOrderNo"
								v-model.trim="scope.row.saleOrderNo"
							></el-input>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="物料编码"
						prop="materialId"
						width="180"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>物料编码
						</template>
						<template #default="scope" class="matter-code-box">
							<span v-if="!scope.row.isMaterialId">{{
								scope.row.materialNumber
							}}</span>
							<el-select
								:disabled="isEdit || scope.row.isPushDownOrg"
								:id="'materialId' + scope.$index"
								:remote-method="
									(query) => {
										matterCodeChange(
											query,
											scope.$index,
											'materialId'
										);
									}
								"
								class="click-cell-ipt"
								filterable
								placeholder="请输入关键词"
								remote
								reserve-keyword
								v-if="scope.row.isMaterialId"
								v-model="scope.row.materialId"
							>
								<el-option
									:key="item.id + item.number"
									:label="item.number"
									:value="item.id"
									:style="{
										height: item.disable ? '0px' : 'auto',
									}"
									@click="
										detailsCom(
											item.id,
											'materialId',
											scope.row,
											scope.column
										)
									"
									v-for="item in matterallCodelist[
										scope.$index
									]"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						id="sku"
						label="规格型号(SKU)"
						prop="specificationId"
						width="280"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>规格型号(SKU)
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isSpecificationId">{{
								scope.row.specification
							}}</span>
							<el-select
								:disabled="isEdit || scope.row.isPushDownOrg"
								:id="'specificationId' + scope.$index"
								:remote-method="
									(query) => {
										skuCodeChange(
											query,
											scope.$index,
											'specification'
										);
									}
								"
								class="click-cell-ipt"
								filterable
								placeholder="请输入关键词"
								remote
								reserve-keyword
								v-if="scope.row.isSpecificationId"
								v-model="scope.row.specificationId"
							>
								<el-option
									:key="item.id + item.specifications"
									:label="item.specifications"
									:value="item.id"
									:style="{
										height: item.disable ? '0px' : 'auto',
									}"
									@click="
										detailsCom(
											item.id,
											'specificationId',
											scope.row,
											scope.column
										)
									"
									v-for="item in specificationalllist[
										scope.$index
									]"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="物料名称"
						prop="materialName"
						width="150"
					>
						<template #default="scope">
							<span>{{ scope.row.materialName }}</span>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="单位"
						prop="remaininStockUnitId"
						width="96"
					>
						<template #default="scope">
							<span>{{ scope.row.remaininStockUnitName }}</span>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="应收数量"
						prop="mustQty"
						width="120"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>应收数量
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isMustQty">{{
								scope.row.mustQty
							}}</span>
							<div
								:class="{
									'is-disabled':
										isEdit || scope.row.isPushDownOrg,
								}"
								class="el-input click-cell-ipt"
								v-if="scope.row.isMustQty"
							>
								<input
									:disabled="
										isEdit || scope.row.isPushDownOrg
									"
									:id="'mustQty' + scope.$index"
									:maxlength="19"
									@blur="
										detailsCom(
											scope.row.mustQty,
											'mustQty',
											scope.row,
											scope.column,
											'',
											scope.$index
										)
									"
									autocomplete="off"
									class="el-input__inner click-cell-ipt"
									placeholder="请输入"
									v-model.lazy="scope.row.mustQty"
								/>
							</div>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="实收数量"
						prop="realQty"
						width="120"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>实收数量
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isRealQty">{{
								scope.row.realQty
							}}</span>
							<div
								:class="{ 'is-disabled': isEdit }"
								class="el-input click-cell-ipt"
								v-if="scope.row.isRealQty"
							>
								<input
									:disabled="isEdit"
									:id="'realQty' + scope.$index"
									:maxlength="19"
									@blur="
										detailsCom(
											scope.row.realQty,
											'realQty',
											scope.row,
											scope.column,
											'',
											scope.$index
										)
									"
									autocomplete="off"
									class="el-input__inner click-cell-ipt"
									placeholder="请输入"
									v-model.lazy="scope.row.realQty"
								/>
							</div>
						</template>
					</el-table-column>
					<el-table-column
						align="right"
						label="含税单价"
						prop="taxPrice"
						width="120"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>含税单价
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isTaxPrice">{{
								scope.row.taxPrice
							}}</span>
							<div
								:class="{
									'is-disabled':
										isEdit ||
										scope.row.addGift ||
										scope.row.isDisabled,
								}"
								class="el-input click-cell-ipt"
								v-if="scope.row.isTaxPrice"
							>
								<input
									:disabled="
										isEdit ||
										scope.row.isDisabled ||
										scope.row.addGift
									"
									:id="'taxPrice' + scope.$index"
									:maxlength="12"
									@blur="
										detailsCom(
											scope.row.taxPrice,
											'taxPrice',
											scope.row,
											scope.column,
											'',
											scope.$index
										)
									"
									autocomplete="off"
									class="el-input__inner click-cell-ipt"
									placeholder
									v-model.lazy="scope.row.taxPrice"
								/>
							</div>
						</template>
					</el-table-column>
					<el-table-column
						align="right"
						label="税率%"
						prop="taxRate"
						width="120"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>税率%
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isTaxRate">{{
								scope.row.taxRate
							}}</span>
							<el-select
								:clearable="false"
								:disabled="
									isEdit ||
									scope.row.isDisabled ||
									scope.row.addGift
								"
								:id="'taxRate' + scope.$index"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'taxRate'
									)
								"
								class="click-cell-ipt t-r"
								placeholder="请选择"
								v-if="scope.row.isTaxRate"
								v-model="scope.row.taxRate"
							>
								<el-option
									:key="item.id"
									:label="item.name"
									:value="item.name"
									:style="{
										height: item.disable ? '0px' : 'auto',
									}"
									@click="
										detailsCom(
											item.name,
											'taxRate',
											scope.row,
											scope.column
										)
									"
									v-for="item in statusForm.getTaxRateList"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="仓库"
						prop="stockId"
						width="170"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>仓库
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isStockId">{{
								scope.row.stockName
							}}</span>
							<el-select
								:disabled="isEdit || scope.row.isPushDownOrg"
								:id="'stockId' + scope.$index"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'stockId'
									)
								"
								class="click-cell-ipt"
								placeholder="请输入关键词"
								remote
								reserve-keyword
								v-if="scope.row.isStockId"
								v-model="scope.row.stockId"
							>
								<el-option
									:disabled="item.disabled"
									:key="item.id + item.name"
									:label="item.name"
									:value="item.id"
									:style="{
										height: item.disable ? '0px' : 'auto',
									}"
									@click="
										detailsCom(
											item.id,
											'stockId',
											scope.row,
											scope.column,
											item.disabled
										)
									"
									v-for="item in statusForm.warehouse"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="客户"
						prop="customerId"
						width="280"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>客户
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isCustomerId">{{
								scope.row.customerName
							}}</span>
							<el-select
								:disabled="isEdit || scope.row.isCustomer"
								:id="'customerId' + scope.$index"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'customerId'
									)
								"
								class="f_12"
								placeholder="请选择"
								remote
								reserve-keyword
								v-if="scope.row.isCustomerId"
								v-model="scope.row.customerId"
							>
								<el-option
									:key="item.id"
									:label="item.name"
									:value="item.id"
									:style="{
										height: item.disable ? '0px' : 'auto',
									}"
									@click="
										detailsCom(
											item.id,
											'customerId',
											scope.row,
											scope.column
										)
									"
									v-for="item in statusForm.custList"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="客户仓库"
						prop="customerStockId"
						width="180"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>客户仓库
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isCustomerStockId">{{
								scope.row.customerStockName
							}}</span>
							<el-select
								:disabled="isEdit || scope.row.isCustomer"
								:id="'customerStockId' + scope.$index"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'customerStockId'
									)
								"
								class="click-cell-ipt"
								placeholder="请选择"
								remote
								reserve-keyword
								v-if="scope.row.isCustomerStockId"
								v-model="scope.row.customerStockId"
							>
								<el-option
									:disabled="item.disabled"
									:key="item.id"
									:label="item.name"
									:value="item.id"
									@click="
										detailsCom(
											item.id,
											'customerStockId',
											scope.row,
											scope.column,
											item.disabled
										)
									"
									v-for="item in customeStockArrylist[
										scope.$index
									]"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="采购日期"
						prop="purchaseDate"
						width="118"
					>
						<template #default="scope">
							<span>{{ scope.row.purchaseDate }}</span>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="期望交期"
						prop="deliveryDate"
						width="118"
					>
						<template #default="scope">
							<span>{{ scope.row.deliveryDate }}</span>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="备注"
						prop="note"
						width="280"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>备注
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isNote">{{
								scope.row.note
							}}</span>
							<div
								:class="{ 'is-disabled': isEdit }"
								class="el-input click-cell-ipt"
								v-if="scope.row.isNote"
							>
								<input
									:disabled="isEdit"
									:id="'note' + scope.$index"
									@click="
										getRowCol(
											scope.row,
											scope.column,
											'note'
										)
									"
									autocomplete="off"
									class="el-input__inner click-cell-ipt"
									placeholder="请输入"
									v-model.lazy="scope.row.note"
								/>
							</div>
						</template>
					</el-table-column>
					<el-table-column
						align="right"
						label="单价"
						prop="price"
						width="120"
					>
						<template #default="scope">
							<span>{{ scope.row.price }}</span>
						</template>
					</el-table-column>
					<el-table-column
						align="right"
						label="价税合计"
						prop="allAmount"
						width="120"
					>
						<template #default="scope">
							<span>{{ scope.row.allAmount }}</span>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="折扣率%"
						prop="discountRate"
						width="120"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>折扣率%
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isDiscountRate">{{
								scope.row.discountRate
							}}</span>
							<div
								:class="{
									'is-disabled':
										isEdit ||
										scope.row.addGift ||
										scope.row.isDisabled,
								}"
								class="el-input click-cell-ipt"
								v-if="scope.row.isDiscountRate"
							>
								<input
									:disabled="
										isEdit ||
										scope.row.isDisabled ||
										scope.row.addGift
									"
									:id="'discountRate' + scope.$index"
									:maxlength="12"
									@blur="
										detailsCom(
											scope.row.discountRate,
											'discountRate',
											scope.row,
											scope.column,
											'',
											scope.$index
										)
									"
									@click="
										getRowCol(
											scope.row,
											scope.column,
											'discountRate'
										)
									"
									autocomplete="off"
									class="el-input__inner click-cell-ipt"
									placeholder
									v-model.lazy="scope.row.discountRate"
								/>
							</div>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="折扣额"
						prop="discountAmount"
						width="120"
					/>
					<el-table-column
						:disabled="true"
						align="right"
						label="税额"
						prop="billTaxAmount"
						width="120"
					>
						<template #default="scope">
							<span>{{ scope.row.billTaxAmount }}</span>
						</template>
					</el-table-column>
					<el-table-column
						:disabled="true"
						align="right"
						label="金额"
						prop="amount"
						width="120"
					>
						<template #default="scope">
							<span>{{ scope.row.amount }}</span>
						</template>
					</el-table-column>
					<el-table-column
						:disabled="true"
						align="right"
						label="是否211"
						prop="is211"
						width="80"
					>
						<template #default="scope">
							<span>{{ scope.row.is211 ? '是' : '否' }}</span>
							<!-- <el-select v-model="scope.row.is211" :disabled="true" filterable class="click-cell-ipt" placeholder="请选择">
                <el-option
                  v-for="item in is211s"
                  @click="detailsCom(item.id,'is211',scope.row,scope.column)"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                ></el-option>
              </el-select>-->
						</template>
					</el-table-column>
					<el-table-column
						:disabled="true"
						align="right"
						label="供应链"
						prop="supplyChainName"
						width="100"
					>
						<template #default="scope">
							<span>{{ scope.row.supplyChainName }}</span>
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						label="是否赠品"
						prop="giveAway"
						width="80"
					>
						<template #default="scope">
							<span>{{ scope.row.giveAway ? '是' : '否' }}</span>
							<!-- <el-checkbox
                v-model="scope.row.giveAway"
                :disabled="isEdit || scope.row.isPushDownOrg || scope.row.addGift || true"
                @change="isCheckBox(scope.row.giveAway,scope.row.index,'giveAway',scope.row,scope.column,'taxPrice')"
              ></el-checkbox>-->
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="物料条码"
						prop="barcode"
						width="120"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>物料条码
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isBarcode">{{
								scope.row.barcode
							}}</span>
							<el-input
								:disabled="isEdit || scope.row.isPushDownOrg"
								:id="'barcode' + scope.$index"
								class="click-cell-ipt"
								placeholder="请输入条码"
								v-if="scope.row.isBarcode"
								v-model="scope.row.barcode"
							></el-input>
						</template>
					</el-table-column>
				</el-table>
			</div>
		</div>
		<!-- 选择上下查单据 -->
		<el-dialog :title="CXttile" top="15%" v-model="dialogCX" width="20%">
			<div class="sale-page-table-body">
				<el-radio-group
					v-if="CXttile === '上查结果'"
					v-model="CXcheckVal"
				>
					<el-radio
						:key="index"
						:label="it.orderType"
						v-for="(it, index) in upOrDownList"
						>{{ it.orderName }}({{ it.orderCount }})</el-radio
					>
				</el-radio-group>
				<el-radio-group
					v-if="CXttile === '下查结果'"
					v-model="CXcheckVal"
				>
					<el-radio
						:key="index"
						:label="it.orderType"
						v-for="(it, index) in upOrDownList"
						>{{ it.orderName }}({{ it.orderCount }})</el-radio
					>
				</el-radio-group>
			</div>
			<template #footer>
				<span class="dialog-footer">
					<el-button @click="dialogCX = false" size="small"
						>取 消</el-button
					>
					<el-button @click="submitCX" size="small" type="primary"
						>确 定</el-button
					>
				</span>
			</template>
		</el-dialog>
	</div>
</template>
<script>
import { mapState, mapActions } from 'vuex';
import { countMethodsPurHo, countMethodsUnitNumber } from '@/utils/count.js';
import { Decimal } from 'decimal.js';
import { orderCopy } from '@/utils/takeMethods';
import examineTop from '@/components/examineTop/index.vue';
import toolBtn from '@/components/public/toolBtn/toolBtn.vue';
import {
	getBaseCurrency,
	getTaxPrice,
	removeChildren,
	splitJointList,
} from '@/utils/pubulic.js';
import {
	getStaffListApiUser,
	approvalFlowTrackingCreate,
	approvalFlowTrackingGetby,
	approvalFlowTrackingUpdate,
	// getStaffListApiUser,
} from '@/utils/api.js';

import {
	activeWareBtnAdd,
	activeWareBtnEdit,
	wareStatusForm,
	wareDefaultTableInfo,
	wareAddGift,
	storeObj,
	is211s,
	optionProps,
} from '@/utils/variable.js';
import {
	orderRexgu,
	disRateRexgu,
	numberPrecisionCom,
	getNowTimeGlobal,
	warePurcaseGetResData,
	warePurcaseGetMaterialSkuData,
	warePurcaseGetMaterialSearch,
	filterMaterialData,
} from '@/utils/takeMethods.js';
export default {
	name: 'ActiveWareHouse',
	components: {
		examineTop,
		toolBtn,
	},
	data() {
		return {
			isexamineBtns: false,
			isExmaineTop: 3,
			radios: [],
			examineObj: {},
			isLoading: false,
			timer: null,
			salePrecisionNumber: [],
			isPrecision: [],
			unitData: [],
			pushDownPrice: [],
			isCount: [],
			isLockPrice: true,
			isDisableTop: false,
			isOrder: true,
			statusForm: JSON.parse(JSON.stringify(wareStatusForm)),
			baseInfoForm: JSON.parse(JSON.stringify(wareDefaultTableInfo)),
			addRow: {},
			createdGift: {},
			storeObj: JSON.parse(JSON.stringify(storeObj)),
			is211s: JSON.parse(JSON.stringify(is211s)),
			optionProps: JSON.parse(JSON.stringify(optionProps)),
			optionPropsPur: JSON.parse(JSON.stringify(optionProps)),
			loading: false, // loding
			isEdit: true, // 禁止编辑
			isSetlementDifference: true,
			rowArr: [], // 明细 当前行
			selectRowIndexArr: [],
			btnType: JSON.parse(JSON.stringify(activeWareBtnAdd)), // 不需要的按钮
			saleUnits: [],
			currRow: '', // 表格 编辑 当前行
			currColumn: '', // 表格 编辑 当前列
			selectRowIndex: 0, // 选择的行
			heightNum: 0, // 容器高度
			txtVal: 0, // 字数显示
			multipleSelection: [], // 选择的行
			OrdedetailIds: [], // 勾选的明细id集合
			dialogCX: false, // 上下查弹框控制
			upOrDownList: [], // 上查下查弹窗可选数据
			OrderNoNameslist: [], // 上查下查的订单号
			OrderNoNameStr: '', // 上查下查的订单号str
			CXaction: '', // 判断是上查还是下查
			CXttile: '', // 查询弹框的名称
			CXcheckVal: '', // 选择的查询radio
			saveIds: '',
			unitpriceAccuracy: 6,
			amountAccuracy: 2,
			isPushDownOrg: false,
			detailBtn: ['add', 'copy', 'allIn', 'gift'],
			customeStockArrylist: [], // 客户仓库集合
			matterallCodelist: [], // 物料下拉数据
			specificationalllist: [], // 规格型号（sku）下拉数据
			tableHeight: 0,
			recordIndex: '',
		};
	},
	methods: {
		setExamine(res) {
			if (
				res.status === 200 &&
				res.data &&
				JSON.stringify(res.data) !== '{}'
			) {
				this.examineObj = res.data;
				//有审批流,但是自己不能审批则返回1,否则返回2,如果没有审批流或者报错为了不阻断流程返回3
				let isApprover = res.data.isApprover;
				this.isExmaineTop = isApprover ? 2 : 1;
				if (
					!res.data ||
					JSON.stringify(res.data) === '{}' ||
					this.baseInfoForm.documentStatus !== 'b'
				) {
					this.isExmaineTop = 3;
				}
				if (res.data.isDone) {
					this.baseInfoForm.documentStatus = 'c';
					this.isExmaineTop = 3;
				}
				this.isexamineBtns = false;
			} else {
				this.isexamineBtns = false;
				this.isExmaineTop = 3;
			}
		},
		handleDetails(r) {
			this.$http
				.showLoading(false)
				.get('PurchaseInstock/get/' + r.data.sendOrderId)
				.then((req) => {
					if (req.status == 200) {
						this.baseInfoForm = req.data;
						this.baseInfoForm.documentStatus =
							req.data.documentStatus;
						if (
							this.baseInfoForm.documentStatus === 'a' ||
							this.baseInfoForm.documentStatus === 'd'
						) {
							this.isEdit = false;
						}
						this.setExamine(r);
					}
				});
			// this.saveIds = r.data.id;
			// this.baseInfoForm = purGetOrderId(this.baseInfoForm, r);
			this.$refs.multipleTable.clearSelection();
			this.multipleSelection = [];
			this.selectRowIndexArr = [];
		},
		handleSubmit(data) {
			this.isexamineBtns = true;
			this.$http
				.post(approvalFlowTrackingUpdate, data)
				.then((res) => {
					if (res.status === 200) {
						this.$message.success({
							message: '操作成功!',
							showClose: true,
						});
					}
					this.handleDetails(res);
				})
				.catch((err) => {
					if (err) {
						this.isExmaineTop = 3;
					}
				})
				.finally(() => {
					// this.isexamineBtns = false;
				});
		},
		//顶部按钮点击
		handleBtns(vals) {
			if (vals.type === 'out') {
				this.$router.go(-1);
			} else {
				let data = {
					approvalDetailsId: this.examineObj.approvalDetailsId,
					approvalOrderType: this.examineObj.sendOrderType,
					orderId: this.examineObj.sendOrderId,
					deptId: this.baseInfoForm.purchaseDeptId,
					orgId: this.baseInfoForm.stockOrgId,
					details: {
						trackId: this.examineObj.id,
						approverId: this.userId,
						approvalMethod: this.examineObj.currentApprovalMethod,
						approvalResult: vals.approvalResult,
						wayId: this.examineObj.currentWayId,
						remark: vals.remark,
						// upperId
					},
				};
				this.handleSubmit(data);
			}
		},
		//跳转到追踪页面
		handleOpen() {
			this.$router.push({
				path: '/examine/mange/examineFollow',
				query: { id: this.examineObj.id },
			});
		},
		//获取处理意见状态
		setApprovalFlowStatus() {
			this.radios = this.getApprovalResult;
		},

		//审批流-详情
		setApprovalFlowTrackingGetby(data) {
			if (
				this.$route.query.type === 'copy' &&
				this.baseInfoForm.outSourcOrderNo === ''
			) {
				this.examineObj = {};
				return;
			}
			if (data.tracking && data.tracking.remark) {
				this.$message.error({
					message: `单据由-${data.tracking.remark}`,
					showClose: true,
					duration: 5000,
				});
			}
			if (
				data.documentStatus === 'a' ||
				data.documentStatus == 'd' ||
				this.$route.query.type === 'copy'
			) {
				this.examineObj = data.tracking;
				return;
			}
			let obj = {
				orderId: data.id,
				deptId: data.purchaseDeptId || 0,
				approvalOrderType: 7,
				orgId: data.stockOrgId,
			};
			this.$http
				.post(approvalFlowTrackingGetby, obj)
				.then((res) => {
					this.setExamine(res);
					if (res.status === 200) {
						this.setExamine(res);
						let details = res.data.details || [];
						let length = details.length;

						// if (!length) {
						// 	return false;
						// }
						// if (details[0].approvalResult !== 2) {
						// 	return false;
						// }
						// this.$message.error({
						// 	message: `"单据由${res.data.details[0].approverName}"审核不通过，拒绝理由”${res.data.details[0].remark}”`,
						// 	showClose: true,
						// 	duration: 5000,
						// });
					}
				})
				.catch((err) => {
					if (err) {
						this.isExmaineTop = 3;
					}
				});
		},
		//审批流-创建
		// setApprovalFlowTrackingCreate(data) {
		// 	let _this = this;
		// 	let obj = {
		// 		sendOrderId: data.id,
		// 		deptId: data.sellDept || 0,
		// 		sendId: this.userId,
		// 		sendOrderType: 5,
		// 		sendOrderBillNo: data.billNO,
		// 		orgId: data.sellOrg,
		// 	};
		// 	this.$http
		// 		.post(approvalFlowTrackingCreate, obj)
		// 		.then((res) => {
		// 			this.setExamine(res);
		// 		})
		// 		.catch((err) => {
		// 			if (err) {
		// 				this.isExmaineTop = 3;
		// 			}
		// 		});
		// },

		// 初始化
		Init() {
			let vuexKey = [
				'taxRate',
				'rateType',
				'dcurrency',
				'customer',
				'settletype',
				'unitAll',
				'paymentTerm',
				'supplierSelect',
			];
			let setVuexData = [
				'setTaxRate',
				'setRateType',
				'setDcurrency',
				'setCustomer',
				'setSettletype',
				'setAllUnit',
				'setPaymentTerm',
				'setSupplierSelect',
			];
			let requestQueryUrl = [
				'SysConfig/GetTaxRate',
				'SysConfig/GetRateType',
				'SysConfig/GetDcurrency',
				'SysConfig/GetCustomer',
				'SysConfig/GetSettletype',
				'SysConfig/GetUnitAllProperty',
				'SysConfig/GetPaymentTerm',
				'SysConfig/supplier/select',
			];
			let resDataQuery = [
				'getTaxRateList',
				'rateTypeList',
				'setlementDifferences',
				'custList',
				'exchangeRateTypes',
				'saleUnits',
				'collectionTermss',
				'getCustomerNumList',
			];
			vuexKey.forEach((ele, ind) => {
				if (this[vuexKey[ind]] && this[vuexKey[ind]].length > 0) {
					if (typeof resDataQuery[ind] == 'string') {
						this.statusForm[resDataQuery[ind]] = JSON.parse(
							JSON.stringify(this[vuexKey[ind]])
						);
					} else {
						resDataQuery[ind].forEach((ele, index) => {
							this.statusForm[resDataQuery[ind][index]] =
								JSON.parse(JSON.stringify(this[vuexKey[ind]]));
						});
					}
					if (vuexKey[ind] == 'unitAll') {
						this.unitData = this.statusForm[resDataQuery[ind]];
					}
				} else {
					this.$http
						.showLoading(false)
						.get(requestQueryUrl[ind])
						.then((r) => {
							if (r.status === 200) {
								if (typeof resDataQuery[ind] == 'string') {
									this.statusForm[resDataQuery[ind]] = r.data;
								} else {
									resDataQuery[ind].forEach((ele, index) => {
										this.statusForm[
											resDataQuery[ind][index]
										] = r.data;
									});
								}
								this[setVuexData[ind]](
									this.statusForm[resDataQuery[ind]]
								);
								// 单位
								if (vuexKey[ind] == 'unitAll') {
									this.unitData =
										this.statusForm[resDataQuery[ind]];
								}
								// 税率
								if (vuexKey[ind] == 'taxRate') {
									this.statusForm.getTaxRateList.forEach(
										(element) => {
											element.name = Number(element.name);
										}
									);
									this.setTaxRate(
										this.statusForm.getTaxRateList
									);
								}
							}
						});
				}
			});
			// 枚举 - 单据状态、单据类型
			if (this.inStockType && JSON.stringify(this.inStockType) !== '{}') {
				this.statusForm.billType = JSON.parse(
					JSON.stringify(this.inStockType.purchaseInstockBillType)
				);
				this.statusForm.documentStatus = JSON.parse(
					JSON.stringify(this.inStockType.documentStatus)
				);
			} else {
				this.$http
					.showLoading(false)
					.get('PurchaseInstock/status/get')
					.then((req) => {
						if (req.status == 200) {
							this.setInStockType(req.data);
							this.statusForm.billType =
								req.data.purchaseInstockBillType; // 单据类型
							this.statusForm.documentStatus =
								req.data.documentStatus; // 单据状态
						}
					});
			}

			// 获取人员接口
			if (this.getAllUserList && this.getAllUserList.length > 0) {
				this.statusForm.stockPersons = this.getAllUserList;
				this.statusForm.purchasePersons = this.getAllUserList;
			} else {
				getStaffListApiUser().then((r) => {
					r.status == 200 ? this.setGetAllUserList(r.data) : false;
					r.status == 200
						? (this.statusForm.stockPersons = r.data)
						: (this.statusForm.stockPersons = []);
					r.status == 200
						? (this.statusForm.purchasePersons = r.data)
						: (this.statusForm.purchasePersons = []);
				});
			}

			var windowHeight = document.documentElement.clientHeight;
			this.heightNum = windowHeight - 102;
			this.tableHeight = windowHeight - 444;
			this.baseInfoForm.date = this.getNowTime();
			this.statusForm.saleOrg = this.orgIdArr;
			this.statusForm.settlementOrgList = this.orgIdArr;
			let keys = Object.keys(this.baseInfoForm.details[0]); // 获取添加对象
			for (const key in this.baseInfoForm.details[0]) {
				if (keys.indexOf(key) > -1) {
					this.addRow[key] = this.baseInfoForm.details[0][key];
				}
			}

			if (this.baseInfoForm.purchaseOrgId) {
				this.$http
					.get(
						'SysConfig/GetWarehouseByOrg/' +
							this.baseInfoForm.purchaseOrgId
					)
					.then((req) => {
						if (req.status == 200) {
							this.statusForm.warehouse = req.data;
						}
					});
			}
			if (
				this.$route.query.type === 'add' ||
				this.$route.query.type === 'copy'
			) {
				this.baseInfoForm.documentStatus = 'a';
				this.isEdit = false;
				if (this.$route.query.type === 'copy') {
					this.getPurChaseDetails();
				}
			}
			if (
				this.$route.query.type == 'pushDown' &&
				this.$route.query.pushDownData
			) {
				this.isEdit = false;
				this.getPurChaseDetails(
					JSON.parse(
						decodeURIComponent(this.$route.query.pushDownData)
					)
				);
			}
			if (this.$route.query.type == 'details' && this.$route.query.id) {
				this.getPurChaseDetails();
			}
		},
		// 单元格被点击
		getRowCol(row, column, cell) {
			let _that = this;
			_that.currRow = row.index;
			_that.storeObj.storeRow = row.index;
			_that.storeObj.storeCol = column.index;
			if (typeof cell === 'string') {
				_that.storeObj.storekey = cell;
			} else {
				_that.storeObj.storekey = column.property;
			}
			if (_that.storeObj.storekey === 'note') {
				_that.storeObj.storeVal = row.note;
			} else {
				_that.storeObj.storeVal = row[_that.storeObj.storekey];
			}

			if (_that.recordIndex != '' || _that.recordIndex == '0') {
				_that.baseInfoForm.details[
					_that.recordIndex
				].isParentOrderBillNo = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isSaleOrderNo = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isMaterialId = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isSpecificationId = false;
				_that.baseInfoForm.details[_that.recordIndex].isMustQty = false;
				_that.baseInfoForm.details[_that.recordIndex].isRealQty = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isTaxPrice = false;
				_that.baseInfoForm.details[_that.recordIndex].isTaxRate = false;
				_that.baseInfoForm.details[_that.recordIndex].isStockId = false;
				_that.baseInfoForm.details[_that.recordIndex].isNote = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isDiscountRate = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isCustomerId = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isCustomerStockId = false;
				_that.baseInfoForm.details[_that.recordIndex].isBarcode = false;
			}

			switch (column.label) {
				case '采购订单号':
					row.isParentOrderBillNo = true;
					_that.recordIndex = row.index;
					break;
				case '销售订单号':
					row.isSaleOrderNo = true;
					_that.recordIndex = row.index;
					break;
				case '物料编码':
					row.isMaterialId = true;
					_that.recordIndex = row.index;
					break;
				case '规格型号(SKU)':
					row.isSpecificationId = true;
					_that.recordIndex = row.index;
					break;
				case '应收数量':
					row.isMustQty = true;
					_that.recordIndex = row.index;
					break;
				case '实收数量':
					row.isRealQty = true;
					_that.recordIndex = row.index;
					break;
				case '含税单价':
					row.isTaxPrice = true;
					_that.recordIndex = row.index;
					break;
				case '税率%':
					row.isTaxRate = true;
					_that.recordIndex = row.index;
					break;
				case '仓库':
					row.isStockId = true;
					_that.recordIndex = row.index;
					break;
				case '备注':
					row.isNote = true;
					_that.recordIndex = row.index;
					break;
				case '折扣率%':
					row.isDiscountRate = true;
					_that.recordIndex = row.index;
					break;
				case '客户':
					row.isCustomerId = true;
					_that.recordIndex = row.index;
					break;
				case '客户仓库':
					row.isCustomerStockId = true;
					_that.recordIndex = row.index;
					break;
				case '物料条码':
					row.isBarcode = true;
					_that.recordIndex = row.index;
					break;
			}
			this.$nextTick(() => {
				let strArr = [
					'采购订单号',
					'销售订单号',
					'物料编码',
					'规格型号(SKU)',
					'应收数量',
					'实收数量',
					'含税单价',
					'税率%',
					'仓库',
					'备注',
					'折扣率%',
					'客户',
					'客户仓库',
					'物料条码',
				];
				if (strArr.indexOf(column.label) !== -1) {
					document
						.getElementById(column.property + row.index)
						.focus();
				}
			});
		},
		// 订单号
		saleRexgu(val) {
			this.baseInfoForm.billNo = orderRexgu(val);
		},
		// 折扣率
		disRateRex(val, row, key) {
			this.baseInfoForm.details[row.index][key] = disRateRexgu(val);
		},
		// 订单号 复制按钮
		saleOrderCopy() {
			orderCopy();
		},
		// 获取客户
		getCustomerMeth() {
			this.$http
				.showLoading(false)
				.get('SysConfig/GetCustomer')
				.then((res) => {
					if (res.status === 200) {
						this.statusForm.custList = res.data;
					}
				});
		},
		supplierChange(value, detailsCopy) {
			if (value) {
				let query = {
					orgId: this.baseInfoForm.stockOrgId,
					supplerId: value,
				};
				this.$http
					.showLoading(false)
					.post('Public/get/supplieraboutfor', query)
					.then(async (r) => {
						if (r.status == 200) {
							this.supplierList = r.data;
							this.baseInfoForm.settleCurrId =
								r.data.settlementCurrency;
							this.baseInfoForm.payconditionId =
								r.data.paymentTerms;
							this.baseInfoForm.settleTypeId =
								r.data.settlementMethod;
							//   if (detailsCopy) {
							//     let content = this.statusForm.setlementDifferences.filter(it => it.id === this.baseInfoForm.settleCurrId)
							//     if (content.length !== 0) {
							//       this.unitpriceAccuracy = content[0].unitpriceAccuracy
							//       this.amountAccuracy = content[0].amountAccuracy
							//     }
							//     this.baseInfoForm.details.forEach((ele, index) => {
							//       if(this.matterallCodelist[index]){
							//         this.matterallCodelist[index].forEach(el => {
							//           if (ele.materialId === el.id) {
							//             let result = purReTableInfoMaterialSkuGetData(
							//               this.baseInfoForm,
							//               el,
							//               index,
							//               this.unitData,
							//               this.isPrecision,
							//               this.salePrecisionNumber,
							//               this.supplierList,
							//               this.statusForm.getTaxRateList
							//             )
							//             this.baseInfoForm = result.baseInfoForm
							//             this.isPrecision = result.isPrecision
							//             this.salePrecisionNumber = result.salePrecisionNumber
							//           }
							//         })
							//         this.getPriceNumberCountCom(this.baseInfoForm.details[index].taxPrice, index, 'taxPrice')
							//       }
							//     })
							//   }
							//   this.settleCurrMethods(true)
						}
					});
			}
		},
		async getPurChaseDetails(res) {
			if (res) {
				this.isLoading = true;
				this.baseInfoForm = res;
				// 结算组织 = 收料组织
				this.baseInfoForm.settleOrgId = this.baseInfoForm.stockOrgId;
				// 通过供应商获取 - 结算币别、结算方式、付款条件
				this.supplierChange(this.baseInfoForm.supplierId);
				// 通过结算币别、本位币 获取汇率类型、汇率
				this.baseInfoForm.details.forEach((el, ind) => {
					if (!el.note) {
						this.baseInfoForm.details[ind].note = '';
					}
					this.pushDownPrice[ind] = el.taxPrice;
				});
				this.baseInfoForm.documentStatus = 'a';
				this.isEdit = false;
				if (this.baseInfoForm.purchaseOrgId) {
					this.$http
						.get(
							'SysConfig/GetWarehouseByOrg/' +
								this.baseInfoForm.purchaseOrgId
						)
						.then((req) => {
							if (req.status == 200) {
								this.statusForm.warehouse = req.data;
								this.statusForm.warehouse = splitJointList(
									this.baseInfoForm.details,
									this.statusForm.warehouse,
									'stockList'
								);
								this.statusForm.warehouse =
									this.statusForm.warehouse.filter(Boolean);
							}
						});
				}
				this.isPushDownOrg = res.isPushDown;
				this.baseInfoForm.billTypeId = this.baseInfoForm.billTypeId
					? (this.baseInfoForm.billTypeId =
							this.baseInfoForm.billTypeId + '')
					: (this.baseInfoForm.billTypeId = '');
				if (this.baseInfoForm.settleCurrId) {
					await this.$http
						.showLoading(false)
						.get('SysConfig/GetDcurrency')
						.then(async (r) => {
							if (r.status === 200) {
								this.statusForm.setlementDifferences =
									await r.data;
								let content =
									await this.statusForm.setlementDifferences.filter(
										(it) =>
											it.id ===
											this.baseInfoForm.settleCurrId
									);
								if (content.length !== 0) {
									this.unitpriceAccuracy = await content[0]
										.unitpriceAccuracy;
									this.amountAccuracy = await content[0]
										.amountAccuracy;
								}
							}
						});
				}
				await this.getMaterialCustomerDataAll();
				await this.baseInfoForm.details.forEach((el, ind) => {
					if (this.baseInfoForm.details[ind].remaininStockUnitId) {
						let tempList = this.unitData.filter(
							(it) =>
								it.id ===
								this.baseInfoForm.details[ind]
									.remaininStockUnitId
						);
						tempList[0].precision == 0
							? (this.isPrecision[ind] = true)
							: (this.isPrecision[ind] = false);
						tempList[0].precision == 0
							? (this.salePrecisionNumber[ind] = 0)
							: (this.salePrecisionNumber[ind] =
									tempList[0].precision);
						this.isCount[ind] = 1;
					}
					this.baseInfoForm.details[ind].taxPrice =
						Decimal(this.pushDownPrice[ind]).toFixed(
							this.unitpriceAccuracy
						) * 1;
					el.isPushDownOrg = res.isPushDown;
					// this.matterCodeChange(el.materialNumber, ind, 'getDate')
					this.baseInfoForm.details[ind].id = 0;
					this.baseInfoForm.details[ind].materialId = el.materialId;
					this.baseInfoForm.details[ind].specificationId =
						el.materialId;
					if (!this.baseInfoForm.details[ind].giveAway) {
						this.baseInfoForm.details[ind].giveAway = false;
					}
					this.getPriceCountCom(el.discountRate, ind, 'discountRate');

					let tempUnitName = this.statusForm.saleUnits.filter(
						(it) =>
							it.id ===
							this.baseInfoForm.details[ind].remaininStockUnitId
					);
					if (tempUnitName.length > 0) {
						this.baseInfoForm.details[ind].remaininStockUnitName =
							tempUnitName[0].name;
					}

					let tempCustomerName = this.statusForm.custList.filter(
						(it) => it.id === el.customerId
					);
					if (tempCustomerName.length > 0) {
						this.baseInfoForm.details[ind].customerName =
							tempCustomerName[0].name;
					}

					this.baseInfoForm.details[ind].customerStockId = el
						.customerStockList[0]
						? el.customerStockList[0].id
						: '';
					this.baseInfoForm.details[ind].customerStockName = el
						.customerStockList[0]
						? el.customerStockList[0].name
						: '';

					// this.getCustomerStockCom(ind, 'y')
					let rowObject = this.statusForm.warehouse.filter(
						(it) => it.id === el.stockId
					);
					el.isCustomer =
						rowObject.length > 0
							? !rowObject[0].customerWarehouseTag
							: true;
					if (this.baseInfoForm.details[ind].remaininStockUnitId) {
						this.isCount[ind] = 1;
						this.getNumberCountCom(
							ind,
							'maxNumber',
							this.baseInfoForm.details[ind].maxNumber,
							this.baseInfoForm.details[ind].maxNumber,
							false,
							'y'
						);
						this.getNumberCountCom(
							ind,
							'realQty',
							this.baseInfoForm.details[ind].realQty,
							this.baseInfoForm.details[ind].realQty,
							false
						);
						this.getNumberCountCom(
							ind,
							'mustQty',
							this.baseInfoForm.details[ind].mustQty,
							this.baseInfoForm.details[ind].mustQty,
							false
						);
						this.isCount[ind] = 2;
					}
				});
				this.isLoading = false;
				this.baseInfoForm.date = this.getNowTime();
			} else {
				this.statusForm.settlementOrgList = this.orgIdArr;
				this.isLoading = true;
				await this.$http
					.showLoading(false)
					.get('PurchaseInstock/get/' + this.$route.query.id)
					.then(async (req) => {
						if (req.status == 200) {
							// if (req.data.tracking && req.data.tracking.remark) {
							// 	this.$message.error({
							// 		message: `单据由-${req.data.tracking.remark}`,
							// 		showClose: true,
							// 		duration: 5000,
							// 	});
							// }
							this.baseInfoForm = await req.data;

							this.setApprovalFlowTrackingGetby(req.data);
							this.baseInfoForm.details.forEach((el, ind) => {
								if (!el.note) {
									this.baseInfoForm.details[ind].note = '';
								}
							});
							this.isPushDownOrg = req.data.isPushDown;
							if (this.baseInfoForm.billNo) {
								this.isOrder = false;
							}
							if (
								this.baseInfoForm.documentStatus === 'a' ||
								this.baseInfoForm.documentStatus === 'd'
							) {
								this.isEdit = false;
							} else {
								this.isEdit = true;
							}
							if (this.baseInfoForm.purchaseOrgId) {
								// 获取仓库
								this.$http
									.get(
										'SysConfig/GetWarehouseByOrg/' +
											this.baseInfoForm.purchaseOrgId
									)
									.then((req) => {
										if (req.status == 200) {
											this.statusForm.warehouse =
												req.data;
											this.statusForm.warehouse =
												splitJointList(
													this.baseInfoForm.details,
													this.statusForm.warehouse,
													'stockList'
												);
											this.statusForm.warehouse =
												this.statusForm.warehouse.filter(
													Boolean
												);
										}
									});
							}
							this.baseInfoForm.billTypeId =
								this.baseInfoForm.billTypeId + '';
							!this.baseInfoForm.billTaxAmount
								? (this.baseInfoForm.billTaxAmount = '0')
								: false;
							!this.baseInfoForm.billAmount
								? (this.baseInfoForm.billAmount = '0')
								: false;
							!this.baseInfoForm.billAllAmount
								? (this.baseInfoForm.billAllAmount = '0')
								: false;
							await this.getMaterialCustomerDataAll();
							this.baseInfoForm.details.forEach((el, ind) => {
								if (el.parentOrderId !== 0) {
									el.isPushDownOrg = req.data.isPushDown;
								} else {
									el.addGift = true;
								}
								// this.matterCodeChange(el.materialNumber, ind, 'getDate')
								this.baseInfoForm.details[ind].materialId =
									el.materialId;
								this.baseInfoForm.details[ind].specificationId =
									el.materialId;
								let tempUnitName =
									this.statusForm.saleUnits.filter(
										(it) =>
											it.id ===
											this.baseInfoForm.details[ind]
												.remaininStockUnitId
									);
								if (tempUnitName.length > 0) {
									this.baseInfoForm.details[
										ind
									].remaininStockUnitName =
										tempUnitName[0].name;
								}
								let tempCustomerName =
									this.statusForm.custList.filter(
										(it) => it.id === el.customerId
									);
								if (tempCustomerName.length > 0) {
									this.baseInfoForm.details[
										ind
									].customerName = tempCustomerName[0].name;
								}
								this.baseInfoForm.details[ind].customerStockId =
									el.customerStockList[0].id;
								this.baseInfoForm.details[
									ind
								].customerStockName =
									el.customerStockList[0].name;

								// this.getCustomerStockCom(ind, 'y')
								let rowObject =
									this.statusForm.warehouse.filter(
										(it) => it.id === el.stockId
									);
								el.isCustomer =
									rowObject.length > 0
										? !rowObject[0].customerWarehouseTag
										: true;
								el.isParentOrderBillNo = false;
								el.isSaleOrderNo = false;
								el.isMaterialId = false;
								el.isSpecificationId = false;
								el.isMustQty = false;
								el.isRealQty = false;
								el.isTaxPrice = false;
								el.isTaxRate = false;
								el.isStockId = false;
								el.isNote = false;
								el.isDiscountRate = false;
								el.isCustomerId = false;
								el.isCustomerStockId = false;
								el.isBarcode = false;
							});
							this.isLoading = false;
						}
					});
			}
		},
		// 详情 - 克隆 - 下推进入 一次性获取物料编码 + 客户仓库数据
		async getMaterialCustomerDataAll() {
			let materQuery = this.baseInfoForm.details.map((it) => {
				return it.materialNumber;
			});
			let customerQuery = [];
			let customerListIndex = [];
			this.baseInfoForm.details.forEach((el, ind) => {
				if (el.customerId) {
					customerQuery.push(el.customerId);
					customerListIndex.push(ind);
				}
			});
			let _result = await this.matterCodeChangeAll(
				materQuery,
				'Number',
				this.baseInfoForm.stockOrgId
			);
			let _resultHouse = await this.getCustmerStoreAll(
				customerQuery,
				this.baseInfoForm.stockOrgId
			);
			this.baseInfoForm.details.forEach((el, index) => {
				this.matterallCodelist[index] = _result.filter((item) => {
					return item.number === el.materialNumber;
				});
				this.specificationalllist[index] = _result.filter((item) => {
					return item.number === el.materialNumber;
				});
				if (customerListIndex.length > 0) {
					customerListIndex.forEach((el) => {
						if (el == index) {
							this.customeStockArrylist[index] = _resultHouse;
						}
					});
				}
				this.matterallCodelist[index].forEach((ele) => {
					this.baseInfoForm = warePurcaseGetMaterialSearch(
						this.baseInfoForm,
						ele,
						index
					);
				});
			});
		},
		// 获取所有客户仓库信息
		async getCustmerStoreAll(query, id) {
			return this.$http
				.post('SysConfig/GetCustomerStockList', {
					customerIds: query,
					orgId: id,
				})
				.then((res) => {
					if (res.status === 200) {
						return res.data;
					} else {
						return [];
					}
				});
		},
		// 获取所有物料携带信息
		async matterCodeChangeAll(query, type, id) {
			return this.$http
				.post('SysConfig/GetMaterialLikeList', {
					names: query,
					file: type,
					orgId: id,
				})
				.then((res) => {
					if (res.status === 200) {
						return res.data.reverse();
					} else {
						return [];
					}
				});
		},
		taxPriceNumberRex(val, row, key) {
			this.baseInfoForm.details[row.index][key] = numberPrecisionCom(
				this.unitpriceAccuracy,
				val
			);
		},
		// 禁止时间
		pickerOptions(date) {
			return date.getTime() > new Date().getTime();
		},
		// 是否211、赠品
		isCheckBox(val, index, key, row, column, taxPrice) {
			this.baseInfoForm.details[index][key] = val;
			if (val === true) {
				this.baseInfoForm.details[index].isDisabled = true;
				this.baseInfoForm.details[index].taxRate = '0';
				this.baseInfoForm.details[index].taxPrice = '0';
				this.baseInfoForm.details[index].discountRate = '0';
				this.getPriceCountCom('0', row.index, taxPrice);
				this.getPriceCountCom(row.taxRate, row.index, 'taxRate');
			} else {
				this.baseInfoForm.details[index].isDisabled = false;
			}
		},
		// 匹配物料sku的方法
		async backMaterSkuMethods(val, key, id) {
			return this.$http
				.showLoading(false)
				.post('SysConfig/GetMaterial', {
					name: val,
					file: key,
					orgId: id,
				})
				.then((res) => {
					if (res.status === 200) {
						this.rowArr = res.data;
						return res.data;
					} else {
						return [];
					}
				});
		},
		// 获取物料编码信息
		async matterCodeChange(val, ind, type) {
			if (val && this.baseInfoForm.purchaseOrgId) {
				let matterDate = await this.backMaterSkuMethods(
					val,
					'Number',
					this.baseInfoForm.purchaseOrgId
				);
				this.matterallCodelist[ind] = matterDate;
				this.specificationalllist[ind] = matterDate;
				if (type === 'getDate') {
					if (ind || ind == 0) {
						this.matterallCodelist[ind].forEach((el) => {
							this.baseInfoForm = warePurcaseGetMaterialSearch(
								this.baseInfoForm,
								el,
								ind
							);
						});
					}
				}
			} else {
				this.matterallCodelist[ind] = [];
				this.specificationalllist[ind] = [];
			}
		},
		// 获取型号SKU信息
		async skuCodeChange(val, ind) {
			if (val && this.baseInfoForm.purchaseOrgId) {
				let skuDate = await this.backMaterSkuMethods(
					val,
					'Specifications',
					this.baseInfoForm.purchaseOrgId
				);
				this.specificationalllist[ind] = skuDate;
				this.matterallCodelist[ind] = skuDate;
			} else {
				this.specificationalllist[ind] = [];
				this.matterallCodelist[ind] = [];
			}
		},
		// 单据头公共fun
		purchaseCom(value, key, type) {
			if (!!value && !!key) {
				this.baseInfoForm[key] = value;
				if (key === 'address') {
					this.baseInfoForm[key] = value;
					this.txtVal = this.baseInfoForm[key].length;
				}
			} else {
				delete this.baseInfoForm[key];
			}
			if (key === 'stockOrgId') {
				this.baseInfoForm.stockDeptId = '';
				this.baseInfoForm.stockDepts = [];
			}
			if (key === 'purchaseOrgId') {
				this.getCustomerMeth();
				this.baseInfoForm.purchaseDeptId = '';
				this.baseInfoForm.purchaseDepts = [];
				if (this.baseInfoForm.purchaseOrgId) {
					this.$http
						.get(
							'SysConfig/GetWarehouseByOrg/' +
								this.baseInfoForm.purchaseOrgId
						)
						.then((req) => {
							if (req.status == 200) {
								this.statusForm.warehouse = req.data;
							}
						});
				}
			}
			if (type) {
				if (type === 'purType') {
					this.$refs.cascader.togglePopperVisible(); // 选择之后将下拉框界面收起
				}
				if (type === 'type') {
					this.$refs.cascaderType.togglePopperVisible(); // 选择之后将下拉框界面收起
				}
			}
		},
		async detailsCom(value, key, row, column, disable, index) {
			if (this.isLockPrice) {
				await this.$http
					.showLoading(false)
					.get('SysConfig/GetDcurrency')
					.then(async (r) => {
						if (r.status === 200) {
							this.statusForm.setlementDifferences = await r.data;
							let content =
								this.statusForm.setlementDifferences.filter(
									(it) =>
										it.id === this.baseInfoForm.settleCurrId
								);
							if (content.length !== 0) {
								this.unitpriceAccuracy =
									content[0].unitpriceAccuracy;
								this.amountAccuracy = content[0].amountAccuracy;
								this.isLockPrice = false;
							}
						}
					});
			}
			if (this.baseInfoForm.details[row.index].remaininStockUnitId) {
				let tempList = this.unitData.filter(
					(it) =>
						it.id ===
						this.baseInfoForm.details[row.index].remaininStockUnitId
				);
				tempList[0].precision == 0
					? (this.isPrecision[row.index] = true)
					: (this.isPrecision[row.index] = false);
				tempList[0].precision == 0
					? (this.salePrecisionNumber[row.index] = 0)
					: (this.salePrecisionNumber[row.index] =
							tempList[0].precision);
			}
			if (!disable) {
				this.currRow = row.index;
				this.storeObj.storekey = key;
				this.storeObj.storeRow = row.index;
				this.storeObj.storeCol = column.index;
				this.storeObj.storeVal = value;
				if (key === 'materialId' || key === 'specificationId') {
					this.rowArr.forEach((el) => {
						if (value === el.id) {
							this.baseInfoForm.details[this.currRow] =
								warePurcaseGetMaterialSkuData(
									this.baseInfoForm.details[this.currRow],
									el
								);
							this.getPriceCountCom('0', row.index, 'taxPrice');
							this.baseInfoForm.details[
								row.index
							].isMaterialId = false;
							this.baseInfoForm.details[
								row.index
							].isSpecificationId = false;
							document.getElementById(key + row.index).blur();
						}
					});
				} else {
					this.baseInfoForm.details[row.index][key] = value;
				}
				if (key === 'taxPrice') {
					this.taxPriceNumberRex(
						this.baseInfoForm.details[row.index][key],
						row,
						key
					);
					this.getPriceCountCom(
						this.baseInfoForm.details[row.index][key],
						row.index,
						key
					);
					this.baseInfoForm.details[row.index][key] =
						this.valueRemoveZero(row, key);
				}
				if (key === 'realQty') {
					this.saleNum(
						row.index,
						this.baseInfoForm.details[row.index][key],
						key,
						this.isPrecision
					);
					if (
						Number(this.baseInfoForm.details[row.index][key]) >
						Number(this.baseInfoForm.details[row.index].mustQty)
					) {
						this.baseInfoForm.details[row.index][key] =
							this.baseInfoForm.details[row.index].mustQty;
					}
					if (!this.isCount[row.index]) {
						this.isCount[row.index] = 1;
					}
					if (this.baseInfoForm.details[row.index].mustQty != '') {
						let compareO = Number(
							this.baseInfoForm.details[row.index].mustQty
						);
						let compareT = Number(
							this.baseInfoForm.details[row.index].realQty
						);
						if (compareT > compareO) {
							this.baseInfoForm.details[row.index].realQty =
								this.baseInfoForm.details[row.index].mustQty;
							return;
						}
					} else {
						if (
							Decimal(
								this.baseInfoForm.details[row.index].realQty
							).toNumber() >
							Decimal(
								this.baseInfoForm.details[row.index].mustQty
							).toNumber()
						) {
							this.baseInfoForm.details[row.index].realQty =
								this.baseInfoForm.details[row.index].mustQty;
						}

						if (
							this.baseInfoForm.details[row.index][key]
								.toString()
								.indexOf('.') !== -1
						) {
							if (this.isCount[row.index] == 1) {
								this.baseInfoForm.details[row.index].taxPrice =
									Decimal(
										this.baseInfoForm.details[row.index]
											.taxPrice
									).toFixed(this.unitpriceAccuracy);
							}
							this.getNumberCountCom(
								row.index,
								key,
								this.baseInfoForm.details[row.index][key],
								this.baseInfoForm.details[row.index][key],
								false
							);
						} else {
							this.isCount[row.index] = 2;
						}
					}
					this.getPriceCountCom(
						this.baseInfoForm.details[row.index][key],
						row.index,
						key
					);
					this.baseInfoForm.details[row.index][key] =
						this.valueRemoveZero(row, key);
				}
				if (key === 'customerId' || key === 'stockId') {
					this.baseInfoForm.details[row.index].customerStockId = '';
					this.baseInfoForm.details[row.index].customerStockName = '';
					this.getCustomerStockCom(row.index);
				}
				if (key === 'customerId') {
					let tempCustomerName = this.statusForm.custList.filter(
						(it) =>
							it.id ==
							this.baseInfoForm.details[row.index].customerId
					);
					this.baseInfoForm.details[row.index].customerName =
						tempCustomerName[0].name;
				}
				if (key === 'customerStockId') {
					let tempCustomerName = this.customeStockArrylist[
						row.index
					].filter(
						(it) =>
							it.id ==
							this.baseInfoForm.details[row.index].customerStockId
					);
					this.baseInfoForm.details[row.index].customerStockName =
						tempCustomerName[0].name;
				}
				if (key === 'stockId') {
					this.baseInfoForm.details[row.index].customerId = '';
					this.baseInfoForm.details[row.index].customerName = '';
					let rowObject = this.statusForm.warehouse.filter(
						(it) => it.id === value
					);
					this.baseInfoForm.details[row.index].stockName =
						rowObject[0].name;
					this.baseInfoForm.details[row.index].isCustomer =
						rowObject.length > 0
							? !rowObject[0].customerWarehouseTag
							: true;
				}
				if (key === 'mustQty') {
					this.saleNum(
						row.index,
						this.baseInfoForm.details[row.index][key],
						key,
						this.isPrecision
					);
					if (!this.isCount[row.index]) {
						this.isCount[row.index] = 1;
					}
					if (
						this.baseInfoForm.details[row.index][key]
							.toString()
							.indexOf('.') !== -1
					) {
						this.getNumberCountCom(
							row.index,
							key,
							this.baseInfoForm.details[row.index][key],
							this.baseInfoForm.details[row.index][key],
							false
						);
					} else {
						this.isCount[row.index] = 2;
					}
					this.baseInfoForm.details[row.index][key] =
						this.valueRemoveZero(row, key);
				}
				if (key === 'discountRate') {
					if (
						this.baseInfoForm.details[row.index][key]
							.toString()
							.indexOf('.') !== -1
					) {
						if (this.isCount[row.index] == 1) {
							this.baseInfoForm.details[row.index].taxPrice =
								Decimal(
									this.baseInfoForm.details[row.index]
										.taxPrice
								).toFixed(this.unitpriceAccuracy);
						}
						this.getNumberCountCom(
							row.index,
							key,
							this.baseInfoForm.details[row.index][key],
							this.baseInfoForm.details[row.index][key],
							false
						);
						this.baseInfoForm.details[row.index][key] =
							this.valueRemoveZero(row, key);
					} else {
						this.isCount[row.index] = 2;
					}
					this.getPriceCountCom(
						this.baseInfoForm.details[row.index][key],
						row.index,
						key
					);
				}
				if (key === 'taxRate') {
					this.getNumberCountCom(
						row.index,
						key,
						this.baseInfoForm.details[row.index][key],
						this.baseInfoForm.details[row.index][key],
						false
					);
					this.getPriceCountCom(
						this.baseInfoForm.details[row.index][key],
						row.index,
						key
					);
				}
			}
		},
		valueRemoveZero(row, key) {
			if (
				this.baseInfoForm.details[row.index][key]
					.toString()
					.charAt(
						this.baseInfoForm.details[row.index][key].toString()
							.length - 1
					) != '.'
			) {
				return this.baseInfoForm.details[row.index][key] * 1;
			} else {
				return this.baseInfoForm.details[row.index][key];
			}
		},
		actionhandel(type) {
			this.isDisableTop = true;
			setTimeout(() => {
				this.isDisableTop = false;
			}, 2000);
			let ids = []; // 顶部公共按钮
			let detailsIds = []; // 提取明细id
			if (this.$route.query.id) {
				ids = [this.$route.query.id];
			}
			if (this.saveIds != '') {
				ids = [this.saveIds];
			}
			if (
				this.baseInfoForm.details &&
				this.baseInfoForm.details.length > 0
			) {
				detailsIds = [
					...new Set(
						this.multipleSelection
							.filter((item) => {
								if (item.id) {
									return item.id;
								}
							})
							.map((it) => {
								return it.id;
							})
					),
				];
			}
			this.OrdedetailIds = detailsIds; // 勾选的明细id集合
			if (type === 'push-down') {
				if (this.multipleSelection.length == 0) {
					this.$message.error({
						message: '请先选择要下推的明细行!',
						showClose: true,
					});
					return;
				}
			}
			if (type === 'up-check' || type === 'down-check') {
				if (this.multipleSelection.length == 0) {
					this.$message.error({
						message: '请先选择要查询的明细行!',
						showClose: true,
					});
					return;
				}
			}
			if (type == 'exDetails') {
				if (
					!this.examineObj ||
					JSON.stringify(this.examineObj) === '{}'
				) {
					this.$message.error('该单据不存在审批流!');
					return false;
				}
				this.$router.push({
					path: '/examine/mange/examineFollow',
					query: { id: this.examineObj.id },
				});
			}
			if (type === 'save') {
				this.saveSubmitPageCom(type);
			}
			if (type === 'submit') {
				this.saveSubmitPageCom(type);
			}
			if (type === 'revoke') {
				this.revokePageData(ids);
			}
			if (type === 'delet') {
				this.deleteOrder(ids);
			}
			if (type === 'audit') {
				this.auditUnPageDataCom(ids, type);
			}
			if (type === 'de-approval') {
				this.auditUnPageDataCom(ids, type);
			}
			if (type === 'up-check') {
				// 点击查询--上查
				this.$http
					.post('PurchaseInstock/upper', { ids: detailsIds })
					.then((res) => {
						if (res.status === 200) {
							if (res.data.length === 0 || res.data === []) {
								this.$message.warning({
									message: '没有可上查的单据！',
									showClose: true,
								});
							} else {
								this.upOrDownList = res.data;
								this.dialogCX =
									res.data && res.data.length > 0
										? true
										: false;
								this.CXttile = '上查结果';
								this.CXcheckVal =
									res.data && res.data.length === 1
										? res.data[0].orderType
										: null; //只有一个，就个默认值
							}
						}
					});
			}
		},
		// 删除
		deleteOrder(ids) {
			if (!isNaN(ids[0])) {
				this.$http
					.post('PurchaseInstock/delete/details', { ids: ids })
					.then((res) => {
						if (res.status === 200) {
							if (
								this.$store.state &&
								this.$store.state.topNavTag
							) {
								this.$store.state.topNavTag.tags.splice(
									this.$store.state.topNavTag.tags.findIndex(
										(item) => item.path === this.$route.path
									),
									1
								);
								this.$router.push(
									this.$store.state.topNavTag.tags[
										this.$store.state.topNavTag.tags
											.length - 1
									].path
								);
							}
						}
					});
			} else {
				this.$message.warning({
					message: '不能删除此单据!',
					showClose: true,
				});
			}
		},
		// 审核 - 反审
		auditUnPageDataCom(ids, type) {
			let pathName =
				type === 'de-approval'
					? 'PurchaseInstock/recheck'
					: 'PurchaseInstock/check';
			let msg = type === 'de-approval' ? '反审成功!' : '审核成功!';
			let msgO =
				type === 'de-approval'
					? '只能反审核处于已审核的单据!'
					: '只能审核处于审核中的单据!';
			let typeDoc = type === 'de-approval' ? 'c' : 'b';
			let typeFz = type === 'de-approval' ? 'd' : 'c';
			if (this.baseInfoForm.documentStatus == typeDoc) {
				this.$http.post(pathName, { ids: ids }).then((r) => {
					if (r.status == 200) {
						if (r.data[0].isSuccess) {
							this.$message.success({
								message: msg,
								showClose: true,
							});
							this.baseInfoForm.documentStatus = typeFz;
							type === 'de-approval'
								? (this.isEdit = false)
								: (this.isEdit = true);
							//   if (type === 'audit') {
							this.$http
								.showLoading(false)
								.get(
									'PurchaseInstock/get/' +
										this.baseInfoForm.id
								)
								.then((req) => {
									if (req.status == 200) {
										this.baseInfoForm =
											warePurcaseGetResData(
												this.baseInfoForm,
												req
											);
									}
								});
							//   }
						} else {
							this.$message.error({
								message: r.data[0].msg,
								showClose: true,
							});
						}
					}
				});
			} else {
				this.$message.error({ message: msgO, showClose: true });
			}
		},
		// 撤消
		revokePageData(ids) {
			if (this.baseInfoForm.documentStatus == 'b') {
				this.$http
					.post('PurchaseInstock/revoke', { ids: ids })
					.then((r) => {
						if (r.data[0].isSuccess) {
							this.$message.success({
								message: '撤消成功!',
								showClose: true,
							});
							this.baseInfoForm.documentStatus = 'a';
							this.isEdit = false;
							this.$refs.multipleTable.clearSelection();
							this.multipleSelection = [];
							this.selectRowIndexArr = [];
						} else {
							this.$message.error({
								message: r.data[0].msg,
								showClose: true,
							});
						}
					});
			} else {
				this.$message.error({
					message: '只能撤销审核中的单据!',
					showClose: true,
				});
			}
		},
		// 保存提交
		saveSubmitPageCom(type) {
			if (
				this.baseInfoForm.documentStatus == 'a' ||
				this.baseInfoForm.documentStatus == 'd'
			) {
				let pathName =
					type === 'save'
						? 'PurchaseInstock/save'
						: 'PurchaseInstock/submit';
				let msg = type === 'save' ? '保存成功!' : '提交成功!';
				filterMaterialData(this.baseInfoForm);
				this.$http
					.showLoading(true)
					.post(pathName, this.baseInfoForm)
					.then((r) => {
						if (r.status == 200) {
							this.saveOrSubmitData(r, type);
							this.$message.success({
								message: msg,
								showClose: true,
							});
							type === 'submit'
								? (this.baseInfoForm.documentStatus = 'b')
								: false;
							type === 'submit' ? (this.isEdit = true) : false;
						}
					});
			} else {
				this.$message.error({
					message: '只能保存或提交创建或重新审核的单据!',
					showClose: true,
				});
			}
		},
		// 处理保存、提交返回数据
		saveOrSubmitData(r, type) {
			if (r.data) {
				this.$http
					.showLoading(false)
					.get('PurchaseInstock/get/' + r.data.id)
					.then((req) => {
						if (req.status == 200) {
							this.baseInfoForm = warePurcaseGetResData(
								this.baseInfoForm,
								req
							);
							if (type == 'submit') {
								this.setExamine({
									status: r.status,
									data: r.data.tracking,
								});
							}
						}
					});
				this.baseInfoForm.billNo = r.data.billNo;
				this.baseInfoForm.id = r.data.id;
				this.saveIds = r.data.id;
				r.data.details.forEach((el, ind) => {
					this.baseInfoForm.details[ind].id = el.id;
					this.baseInfoForm.details[ind].fid = el.fid;
				});
				this.$refs.multipleTable.clearSelection();
				this.multipleSelection = [];
				this.selectRowIndexArr = [];
			}
		},
		// 星星
		mustAfter(obj) {
			let arry = [8, 9, 10, 11];
			if (arry.indexOf(obj.columnIndex) !== -1) {
				return 'must';
			}
		},
		// 删除行
		selectDeleteRow() {
			if (
				this.baseInfoForm.details.length > 1 &&
				this.baseInfoForm.details.length !=
					this.multipleSelection.length
			) {
				if (this.selectRowIndexArr != 0) {
					this.selectRowIndexArr.sort(function (a, b) {
						return a.index - b.index;
					});
					for (let i = 0; i < this.selectRowIndexArr.length; i++) {
						this.baseInfoForm.details.splice(
							this.selectRowIndexArr[i].index - i,
							1
						);
						this.customeStockArrylist.splice(
							this.selectRowIndexArr[i].index - i,
							1
						);
						this.matterallCodelist.splice(
							this.selectRowIndexArr[i].index - i,
							1
						);
						this.specificationalllist.splice(
							this.selectRowIndexArr[i].index - i,
							1
						);
						this.salePrecisionNumber.splice(
							this.selectRowIndexArr[i].index - i,
							1
						);
						this.isPrecision.splice(
							this.selectRowIndexArr[i].index - i,
							1
						);
						this.isCount.splice(
							this.selectRowIndexArr[i].index - i,
							1
						);
					}
					this.baseInfoForm.details.forEach((el, ind) => {
						this.matterCodeChange(el.materialNumber, ind);
						this.baseInfoForm.details[ind].materialId =
							el.materialId;
						this.baseInfoForm.details[ind].specificationId =
							el.materialId;
					});
					this.$refs.multipleTable.clearSelection();
					this.multipleSelection = [];
					this.selectRowIndexArr = [];
					this.recordIndex = '';
				} else {
					this.$message.warning({
						message: '请先选择要删除的行',
						showClose: true,
					});
				}
			} else {
				this.$message.warning({
					message: '表格不能为空!',
					showClose: true,
				});
			}
		},
		// 单行选择
		selectRow(selection) {
			this.multipleSelection = [];
			this.multipleSelection = selection;
			if (selection.length != 0) {
				this.selectRowIndex = selection[0].index;
				this.selectRowIndexArr = selection;
			} else {
				this.selectRowIndexArr = [];
			}
		},
		// 全选
		selectAll(selection) {
			this.multipleSelection = [];
			this.multipleSelection = selection;
			if (selection.length != 0) {
				this.selectRowIndexArr = selection;
				if (selection.length == 1) {
					this.selectRowIndex = 0;
				}
			} else {
				this.selectRowIndexArr = [];
			}
		},
		// 获取时间
		getNowTime() {
			return getNowTimeGlobal();
		},
		//  输入数量小数位控制
		saleNum(index, val, key, isPrecision) {
			isPrecision[index] = isPrecision[index]
				? isPrecision[index]
				: false;
			this.salePrecisionNumber[index] =
				this.salePrecisionNumber[index] ||
				this.salePrecisionNumber[index] == 0
					? this.salePrecisionNumber[index]
					: 10;
			if (
				!this.baseInfoForm.details[index].materialId &&
				!this.$route.query.id
			) {
				isPrecision[index] = true;
			}
			if (val) {
				if (isPrecision[index]) {
					if (val.toString().indexOf('.') !== -1) {
						this.baseInfoForm.details[index][key] = Decimal(
							val
						).toFixed(0, Decimal.ROUND_DOWN);
					}
					this.baseInfoForm.details[index][key] =
						this.baseInfoForm.details[index][key]
							.toString()
							.replace(/\D/g, '');
				} else {
					this.baseInfoForm.details[index][key] = numberPrecisionCom(
						this.salePrecisionNumber[index],
						val
					);
				}
			}
		},
		// 禁止操作单元格
		disabledCellStyle({ row, rowIndex, column, columnIndex }) {
			row.index = rowIndex;
			column.index = columnIndex;
		},
		// 确定上下查
		submitCX() {
			if (this.CXcheckVal) {
				let pathName = '';
				if (this.CXcheckVal === 2) {
					pathName = 'DemandOrder';
				}
				let ary = [];
				ary = this.upOrDownList.filter((it) => {
					return it.orderType === this.CXcheckVal;
				});
				if (pathName) {
					this.dialogCX = false;
					this.$router.push({
						name: pathName,
						query: {
							detailsIds: JSON.stringify(
								ary.length > 0 ? ary[0].detailsIds : []
							),
							actionType:
								this.CXttile === '上查结果' ? 'up' : 'down',
							actionName: '采购入库单',
							OrderNoNames: JSON.stringify(ary[0].billNos),
						},
					});
					this.dialogCX = false;
				}
			} else {
				this.$message.error({
					message: '请先选择在确认',
					showClose: true,
				});
			}
		},
		// 部门请求公共方法
		getDeptCom(reqKey, resKey) {
			if (reqKey) {
				this.$http
					.showLoading(false)
					.post('SysConfig/GetDept/' + reqKey)
					.then((req) => {
						if (req.status == 200) {
							let deptArr = req.data;
							this.statusForm[resKey] = removeChildren(deptArr);
						}
					});
			}
		},
		// 金额、单价计算精度
		getPriceCountCom(value, index, key) {
			let templateObject = countMethodsPurHo(
				this.baseInfoForm.details,
				value,
				index,
				key,
				this.statusForm.getTaxRateList,
				this.baseInfoForm.exchangerate,
				this.unitpriceAccuracy,
				this.amountAccuracy
			);
			this.baseInfoForm.details = templateObject.details;
			this.baseInfoForm.billTaxAmount =
				templateObject.baseTaxaMount == ''
					? this.baseInfoForm.billTaxAmount
					: templateObject.baseTaxaMount;
			this.baseInfoForm.billAmount =
				templateObject.baseAmount == ''
					? this.baseInfoForm.billAmount
					: templateObject.baseAmount;
			this.baseInfoForm.billAllAmount =
				templateObject.baseAllAmount == ''
					? this.baseInfoForm.billAllAmount
					: templateObject.baseAllAmount;
		},
		// 数量计算精度
		getNumberCountCom(i, key, valueO, valueT, isInner, type) {
			let tempList = this.unitData.filter(
				(it) =>
					it.id === this.baseInfoForm.details[i].remaininStockUnitId
			);
			if (type) {
				tempList[0].precision == 0
					? (this.isPrecision[i] = true)
					: (this.isPrecision[i] = false);
				tempList[0].precision == 0
					? (this.salePrecisionNumber[i] = 0)
					: (this.salePrecisionNumber[i] = tempList[0].precision);
			}
			let result = countMethodsUnitNumber(
				tempList,
				valueO,
				valueT,
				this.isCount[i],
				this.salePrecisionNumber[i],
				isInner
			);
			this.baseInfoForm.details[i][key] = result.value;
			this.isCount[i] = result.isDefault;
		},
		// 获取客户仓库
		getCustomerStockCom(ind, isInner) {
			let query = {};
			query.customerId = this.baseInfoForm.details[ind].customerId
				? parseInt(this.baseInfoForm.details[ind].customerId)
				: null;
			query.orgId = this.baseInfoForm.purchaseOrgId
				? parseInt(this.baseInfoForm.purchaseOrgId)
				: null;
			query.stockId = this.baseInfoForm.details[ind].stockId
				? parseInt(this.baseInfoForm.details[ind].stockId)
				: null;
			if (
				this.baseInfoForm.details[ind].customerId &&
				this.baseInfoForm.purchaseOrgId &&
				this.baseInfoForm.details[ind].stockId
			) {
				this.$http
					.post('SysConfig/GetCustomerStock', query)
					.then((r) => {
						if (r.status == 200) {
							this.customeStockArrylist[ind] = r.data;
							if (isInner) {
								this.customeStockArrylist = splitJointList(
									this.baseInfoForm.details,
									this.customeStockArrylist,
									'customerStockList'
								);
								this.customeStockArrylist =
									this.customeStockArrylist.filter(Boolean);
							}
						}
					});
			}
		},
		settleCurrMethods() {
			let content = this.statusForm.setlementDifferences.filter(
				(it) => it.id === this.baseInfoForm.settleCurrId
			);
			if (content.length !== 0) {
				this.unitpriceAccuracy = content[0].unitpriceAccuracy;
				this.amountAccuracy = content[0].amountAccuracy;
			}
		},
		// 添加赠品
		addGift() {
			let addRow = JSON.parse(JSON.stringify(wareAddGift));
			this.matterallCodelist[this.baseInfoForm.details.length] = [];
			this.specificationalllist[this.baseInfoForm.details.length] = [];
			this.customeStockArrylist[this.baseInfoForm.details.length] = [];
			this.baseInfoForm.details.push(addRow);
			this.$nextTick(() => {
				this.$refs.multipleTable.$refs.bodyWrapper.scrollTop =
					this.$refs.multipleTable.$refs.bodyWrapper.scrollHeight;
			});
		},
		...mapActions({
			setAllUnit: 'storeData/setAllUnit',
			setSettletype: 'storeData/setSettletype',
			setDcurrency: 'storeData/setDcurrency',
			setRateType: 'storeData/setRateType',
			setTaxRate: 'storeData/setTaxRate',
			setCustomer: 'storeData/setCustomer',
			setPaymentTerm: 'storeData/setPaymentTerm',
			setSupplierSelect: 'storeData/setSupplierSelect',
			setInStockType: 'storeData/setInStockType',
			setGetAllUserList: 'storeData/setGetAllUserList',
		}),
	},
	computed: {
		...mapState({
			orgIdArr: (state) => state.user.orgIdArr,
			userId: (state) => state.user.userInfo.staffId || null,
			unitAll: (state) => state.storeData.allUnit,
			settletype: (state) => state.storeData.settletype,
			dcurrency: (state) => state.storeData.dcurrency,
			rateType: (state) => state.storeData.rateType,
			taxRate: (state) => state.storeData.taxRate,
			customer: (state) => state.storeData.customer,
			paymentTerm: (state) => state.storeData.paymentTerm,
			supplierSelect: (state) => state.storeData.supplierSelect,
			inStockType: (state) => state.storeData.inStockType,
			getAllUserList: (state) => state.storeData.getAllUserList,
			getApprovalResult: (state) =>
				state.examine.examineStatus.approvalResult,
		}),
		isShow: function () {
			return this.isExmaineTop;
		},
	},
	created: function () {
		this.Init();
		this.setApprovalFlowStatus();
	},
	watch: {
		'baseInfoForm.stockOrgId': function () {
			this.getDeptCom(this.baseInfoForm.stockOrgId, 'stockDepts');
		},
		'baseInfoForm.purchaseOrgId': function () {
			this.getDeptCom(this.baseInfoForm.purchaseOrgId, 'purchaseDepts');
		},
		'baseInfoForm.documentStatus': function () {
			if (
				this.baseInfoForm.documentStatus === 'a' ||
				this.baseInfoForm.documentStatus === 'd'
			) {
				this.$topNavTagRename('新增采购入库单');
				this.btnType = activeWareBtnAdd;
			} else {
				this.$topNavTagRename('编辑采购入库单');
				this.btnType = activeWareBtnEdit;
			}
		},
		'baseInfoForm.settleOrgId': async function () {
			this.baseInfoForm.localCurrId = getBaseCurrency(
				this.orgIdArr,
				this.baseInfoForm.settleOrgId
			);
			if (
				this.baseInfoForm.localCurrId &&
				this.baseInfoForm.settleCurrId
			) {
				if (this.baseInfoForm.settleCurrId) {
					let templateObj = await getTaxPrice(
						this.baseInfoForm.localCurrId,
						'SysConfig/GetRateInfo',
						this.baseInfoForm.settleCurrId
					);
					if (templateObj) {
						this.baseInfoForm.exchangeRate = templateObj.directRate;
						this.baseInfoForm.exchangeTypeId =
							templateObj.issueInvoiceId;
					} else {
						this.baseInfoForm.exchangeRate = '';
						this.baseInfoForm.exchangeTypeId = '';
					}
				}
			}
		},
	},
};
</script>
<style lang="scss" scoped>
@import '@/assets/style/saleOrder/saleOrderCommon.scss';
@import '@/assets/style/saleOrder/orderCreate.scss';
@import '@/assets/style/purchase/common.scss';
@import '@/assets/style/saleOrder/common.scss';
</style>
