<template>
	<div
		:style="{ height: heightNum + 'px!important' }"
		class="order-create-container order-mc-bg main-container"
	>
		<div class="order-create-btn-group">
			<toolBtn
				:btnType="btnType"
				:isDisable="isDisableTop"
				@actionhandel="actionhandel"
			></toolBtn>
		</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="order-com-rr 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
											:required="true"
											class="item-bt-s"
											label="调出库存组织"
										>
											<el-select
												:disabled="
													isEdit || isPushDownOrg
												"
												@change="stockOutChange"
												class="click-cell-ipt-issue"
												placeholder="请选择单据状态"
												v-model="
													baseInfoForm.stockOrgId
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													:style="{
														height: item.disable
															? '0px'
															: 'auto',
													}"
													@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-select
												:disabled="true"
												class="click-cell-ipt-issue"
												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>
									</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"
												filterable
												placeholder="请选择调出类型"
												v-model="
													baseInfoForm.billTypeId
												"
											>
												<el-option
													:key="key + index"
													:label="value"
													:value="key"
													@click="
														purchaseCom(
															baseInfoForm.billTypeId,
															'billTypeId'
														)
													"
													class="click-cell-ipt-issue"
													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"
											label="调入库存组织"
										>
											<el-select
												:disabled="
													isEdit || isPushDownOrg
												"
												@change="stockInChange"
												class="click-cell-ipt-issue"
												filterable
												placeholder="请选择组织"
												v-model="
													baseInfoForm.stockinOrgId
												"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													:style="{
														height: item.disable
															? '0px'
															: 'auto',
													}"
													@click="
														purchaseCom(
															baseInfoForm.stockinOrgId,
															'stockinOrgId'
														)
													"
													style="font-size: 12px"
													v-for="item in statusForm.saleOrg"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											class="item-bt-s Iisshow"
											label="手机"
										>
											<el-input
												:disabled="isEdit"
												:maxlength="255"
												@input="
													purchaseCom(
														baseInfoForm.phone,
														'phone'
													)
												"
												placeholder=" "
												v-model.trim="
													baseInfoForm.phone
												"
											></el-input>
											<div
												:data-clipboard-text="
													baseInfoForm.phone
												"
												@click="saleOrderCopy"
												class="copyBtn"
											>
												<i
													class="el-icon-document-copy"
												/>
											</div>
										</el-form-item>
										<el-form-item
											class="item-bt-s"
											label="部门"
										>
											<el-cascader
												:disabled="isEdit"
												:options="statusForm.saleParts"
												:props="optionProps"
												:show-all-levels="false"
												@change="
													purchaseCom(
														baseInfoForm.deptId,
														'deptId',
														'type'
													)
												"
												class="click-cell-ipt-c"
												clearable
												placeholder="请选择部门"
												ref="cascader"
												style="font-size: 12px"
												v-model="baseInfoForm.deptId"
											></el-cascader>
										</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"
													:required="true"
													class="item-bt-s icon-sty"
													label="调拨类型"
												>
													<el-select
														:disabled="true"
														filterable
														placeholder="请选择调出类型"
														v-model="
															baseInfoForm.allocatingType
														"
													>
														<el-option
															:key="key + index"
															:label="value"
															:value="key"
															@click="
																purchaseCom(
																	baseInfoForm.allocatingType,
																	'allocatingType'
																)
															"
															style="
																font-size: 12px;
															"
															v-for="(
																value,
																key,
																index
															) in statusForm.allocatingType"
														></el-option>
													</el-select>
												</el-form-item>
												<el-form-item
													:required="true"
													class="item-bt-s item-date"
													label="下单日期"
												>
													<el-date-picker
														:disabled="isEdit"
														@change="
															purchaseCom(
																baseInfoForm.date,
																'date'
															)
														"
														class="icon-x"
														format="YYYY-MM-DD"
														placeholder="年/月/日"
														type="date"
														v-model="
															baseInfoForm.date
														"
														value-format="YYYY-MM-DD"
													></el-date-picker>
												</el-form-item>
												<el-form-item
													class="item-bt-s Iisshow"
													label="联系人"
												>
													<el-input
														:disabled="isEdit"
														@input="
															purchaseCom(
																baseInfoForm.linkMan,
																'linkMan'
															)
														"
														placeholder="请输入联系人"
														v-model="
															baseInfoForm.linkMan
														"
													></el-input>
													<div
														:data-clipboard-text="
															baseInfoForm.linkMan
														"
														@click="saleOrderCopy"
														class="copyBtn copyBtnB"
													>
														<i
															class="el-icon-document-copy"
														/>
													</div>
												</el-form-item>
											</el-col>
										</el-row>
									</div>
								</el-col>
								<el-col :span="4">
									<div class="div-col">
										<el-form-item
											class="item-bt-s"
											label="仓管员"
										>
											<el-select
												:clearable="true"
												:disabled="isEdit"
												class="click-cell-ipt-issue"
												placeholder="请选择仓管员"
												v-model="baseInfoForm.stockerId"
											>
												<el-option
													:key="item.id"
													:label="item.name"
													:value="item.id"
													:style="{
														height: item.disable
															? '0px'
															: 'auto',
													}"
													@click="
														purchaseCom(
															baseInfoForm.stockerId,
															'stockerId'
														)
													"
													style="font-size: 12px"
													v-for="item in statusForm.salePerson"
												></el-option>
											</el-select>
										</el-form-item>
										<el-form-item
											class="item-bt-s"
											label="地址"
										>
											<el-input
												:autosize="{
													minRows: 3,
													maxRows: 3,
												}"
												:disabled="isEdit"
												@input="
													purchaseCom(
														baseInfoForm.address,
														'address'
													)
												"
												maxlength="150"
												placeholder=" "
												resize="none"
												type="textarea"
												v-model="baseInfoForm.address"
											></el-input>
										</el-form-item>
									</div>
								</el-col>
								<el-col :span="8"></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.creatorName
												"
											></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.modifyName
												"
											></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.commitDate
												"
											></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.checkName
														"
													></el-input>
												</el-form-item>
												<el-form-item
													class="item-bt-s"
													label="审核时间"
												>
													<el-input
														:disabled="true"
														placeholder
														v-model.trim="
															baseInfoForm.checkDate
														"
													></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"
					@copyCellcolumn="copyCellcolumn"
					@copyRow="bottomCopyRow"
					@deleteRow="selectDeleteRow"
					@insertObj="getInsertInfo"
				></DetailsOperation>
			</div>
			<div class="tell-info-table tell-info-other">
				<el-table
					:cell-style="disabledCellStyle"
					:data="baseInfoForm.details"
					:header-cell-class-name="mustAfter"
					:header-cell-style="headerBg"
					: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="salOrderBillNo"
						width="200"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>销售订单号
						</template>
						<template #default="scope" class="Iisshow">
							<span v-if="!scope.row.isSalOrderBillNo">{{
								scope.row.salOrderBillNo
							}}</span>
							<div
								:class="{
									'is-disabled':
										isEdit ||
										isPushDownOrgList[scope.$index],
								}"
								class="el-input click-cell-ipt"
								v-if="scope.row.isSalOrderBillNo"
							>
								<input
									:disabled="
										isEdit ||
										isPushDownOrgList[scope.$index]
									"
									:id="'salOrderBillNo' + scope.$index"
									autocomplete="off"
									@paste="
										pasteExcel(
											$event,
											scope.$index,
											scope,
											'salOrderBillNo'
										)
									"
									class="el-input__inner click-cell-ipt"
									placeholder="请输入"
									v-model.lazy="scope.row.salOrderBillNo"
								/>
								<div
									:data-clipboard-text="
										scope.row.salOrderBillNo
									"
									@click="saleOrderCopy"
									class="copyBtn"
								>
									<i class="el-icon-document-copy" />
								</div>
							</div>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="组织间需求单"
						prop="parentOrderBillNo"
						width="200"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>组织间需求单
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isParentOrderBillNo">{{
								scope.row.parentOrderBillNo
							}}</span>
							<div
								:class="{
									'is-disabled':
										isEdit ||
										isPushDownOrgList[scope.$index],
								}"
								class="el-input click-cell-ipt Iisshow"
								v-if="scope.row.isParentOrderBillNo"
							>
								<input
									:disabled="
										isEdit ||
										isPushDownOrgList[scope.$index]
									"
									:id="'parentOrderBillNo' + scope.$index"
									autocomplete="off"
									@paste="
										pasteExcel(
											$event,
											scope.$index,
											scope,
											'parentOrderBillNo'
										)
									"
									class="el-input__inner click-cell-ipt"
									placeholder="请输入"
									v-model.lazy="scope.row.parentOrderBillNo"
								/>
								<div
									:data-clipboard-text="
										scope.row.parentOrderBillNo
									"
									@click="saleOrderCopy"
									class="copyBtn"
								>
									<i class="el-icon-document-copy" />
								</div>
							</div>
						</template>
					</el-table-column>
					<!-- @paste="pasteExcel($event,scope.$index,scope,'materialId')" -->
					<el-table-column
						align="left"
						label="物料编码"
						prop="materialId"
						width="200"
					>
						<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 || isPushDownOrgList[scope.$index]
								"
								:id="'materialId' + scope.$index"
								:remote-method="
									(query) => {
										matterCodeChange(
											query,
											scope.$index,
											'materialId'
										);
									}
								"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'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>
					<!-- @paste="pasteExcel($event,scope.$index,scope,'specificationId')" -->
					<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 || isPushDownOrgList[scope.$index]
								"
								:id="'specificationId' + scope.$index"
								:remote-method="
									(query) => {
										skuCodeChange(
											query,
											scope.$index,
											'specification'
										);
									}
								"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'specificationId'
									)
								"
								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="170"
					>
						<template #default="scope">
							<span>{{ scope.row.materialName }}</span>
						</template>
					</el-table-column>
					<el-table-column
						align="center"
						label="单位"
						prop="unitId"
						width="96"
					>
						<template #default="scope">
							<span>{{
								getName(statusForm.saleUnits, scope.row.unitId)
							}}</span>
							<!-- <el-select :disabled="true" :clearable="false" v-model="scope.row.unitId" class="click-cell-ipt" placeholder="请选择">
                <el-option v-for="item in statusForm.saleUnits" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>-->
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="调出数量"
						prop="qty"
						width="120"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>调出数量
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isQty">{{
								scope.row.qty
							}}</span>
							<div
								:class="{ 'is-disabled': isEdit }"
								class="el-input click-cell-ipt"
								v-if="scope.row.isQty"
							>
								<input
									:disabled="isEdit"
									:id="'qty' + scope.$index"
									:maxlength="19"
									@blur="
										detailsCom(
											scope.row.qty,
											'qty',
											scope.row,
											scope.column
										)
									"
									@paste="
										pasteExcel(
											$event,
											scope.$index,
											scope,
											'qty'
										)
									"
									class="el-input__inner click-cell-ipt"
									autocomplete="off"
									placeholder="请输入"
									v-model.lazy="scope.row.qty"
								/>
							</div>
						</template>
					</el-table-column>
					<el-table-column
						align="right"
						label="累计调入数量"
						prop="stockReceiveQty"
						width="120"
					>
						<template #default="scope">
							<span>{{ scope.row.stockReceiveQty }}</span>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="剩余调入数量"
						prop="remainReceiveQty"
						width="120"
					>
						<template #default="scope">
							<span>{{ scope.row.remainReceiveQty }}</span>
						</template>
					</el-table-column>
					<el-table-column
						:required="true"
						align="center"
						label="备品"
						prop="isFree"
						width="120"
					>
						<template #default="scope">
							<el-checkbox
								:disabled="isEdit"
								@change="
									isCheckBox(
										scope.row.isFree,
										scope.row.index,
										'isFree'
									)
								"
								v-model="scope.row.isFree"
							></el-checkbox>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="调出仓库"
						prop="srcStockId"
						width="150"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>调出仓库
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isSrcStockId">{{
								getName(
									statusForm.warehouse,
									scope.row.srcStockId
								)
							}}</span>
							<el-select
								:disabled="isEdit || scope.row.isSrcStock"
								:id="'srcStockId' + scope.$index"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'srcStockId'
									)
								"
								class="click-cell-ipt"
								placeholder="请输入关键词"
								reserve-keyword
								v-if="scope.row.isSrcStockId"
								v-model="scope.row.srcStockId"
							>
								<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,
											'srcStockId',
											scope.row,
											scope.column,
											item.disabled,
											item.customerWarehouseTag
										)
									"
									v-for="item in statusForm.warehouse"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="调出客户"
						prop="srcCustomer"
						width="150"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>调出客户
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isSrcCustomer">{{
								getName(
									statusForm.custmers,
									scope.row.srcCustomer
								)
							}}</span>
							<el-select
								:clearable="true"
								:disabled="isEdit || scope.row.isOutCustomer"
								:id="'srcCustomer' + scope.$index"
								@clear="
									clearCom(
										scope.row.srcCustomer,
										'srcCustomer',
										scope.row,
										scope.column
									)
								"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'srcCustomer'
									)
								"
								class="click-cell-ipt-issue"
								placeholder="请输入关键词"
								v-if="scope.row.isSrcCustomer"
								v-model="scope.row.srcCustomer"
							>
								<el-option
									:key="item.id"
									:label="item.name"
									:value="item.id"
									:style="{
										height: item.disable ? '0px' : 'auto',
									}"
									@click="
										detailsCom(
											item.id,
											'srcCustomer',
											scope.row,
											scope.column
										)
									"
									v-for="item in statusForm.custmers"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="调出客户仓库"
						prop="srcCustomerStock"
						width="150"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>调出客户仓库
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isSrcCustomerStock">{{
								getName(
									customeStockArrylist[scope.$index],
									scope.row.srcCustomerStock
								)
							}}</span>
							<el-select
								:clearable="true"
								:disabled="isEdit || scope.row.isOutCustomer"
								:id="'srcCustomerStock' + scope.$index"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'srcCustomerStock'
									)
								"
								class="click-cell-ipt-issue"
								placeholder="请输入关键词"
								v-if="scope.row.isSrcCustomerStock"
								v-model="scope.row.srcCustomerStock"
							>
								<el-option
									:disabled="item.disabled"
									:key="item.id"
									:label="item.name"
									:value="item.id"
									@click="
										detailsCom(
											item.id,
											'srcCustomerStock',
											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="destStockId"
						width="150"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>调入仓库
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isDestStockId">{{
								getName(
									statusForm.warehouseInset,
									scope.row.destStockId
								)
							}}</span>
							<el-select
								:disabled="
									isEdit || isPushDownOrgList[scope.$index]
								"
								:id="'destStockId' + scope.$index"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'destStockId'
									)
								"
								class="click-cell-ipt"
								placeholder="请输入关键词"
								remote
								reserve-keyword
								v-if="scope.row.isDestStockId"
								v-model="scope.row.destStockId"
							>
								<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,
											'destStockId',
											scope.row,
											scope.column,
											item.disabled,
											item.customerWarehouseTag
										)
									"
									v-for="item in statusForm.warehouseInset"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="调入客户"
						prop="destCustomer"
						width="150"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>调入客户
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isDestCustomer">{{
								getName(
									statusForm.deCustmers,
									scope.row.destCustomer
								)
							}}</span>
							<el-select
								:clearable="true"
								:disabled="isEdit || scope.row.isInnerCustomer"
								:id="'destCustomer' + scope.$index"
								@clear="
									clearCom(
										scope.row.destCustomer,
										'destCustomer',
										scope.row,
										scope.column
									)
								"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'destCustomer'
									)
								"
								class="click-cell-ipt-issue"
								placeholder="请输入关键词"
								v-if="scope.row.isDestCustomer"
								v-model="scope.row.destCustomer"
							>
								<el-option
									:key="item.id"
									:label="item.name"
									:value="item.id"
									:style="{
										height: item.disable ? '0px' : 'auto',
									}"
									@click="
										detailsCom(
											item.id,
											'destCustomer',
											scope.row,
											scope.column
										)
									"
									v-for="item in statusForm.deCustmers"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="调入客户仓库"
						prop="destCustomerStock"
						width="150"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>调入客户仓库
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isDestCustomerStock">{{
								getName(
									customeStockArrylistInner[scope.$index],
									scope.row.destCustomerStock
								)
							}}</span>
							<el-select
								:clearable="true"
								:disabled="isEdit || scope.row.isInnerCustomer"
								:id="'destCustomerStock' + scope.$index"
								@click="
									getRowCol(
										scope.row,
										scope.column,
										'destCustomerStock'
									)
								"
								class="click-cell-ipt-issue"
								placeholder="请输入关键词"
								v-if="scope.row.isDestCustomerStock"
								v-model="scope.row.destCustomerStock"
							>
								<el-option
									:disabled="item.disabled"
									:key="item.id"
									:label="item.name"
									:value="item.id"
									@click="
										detailsCom(
											item.id,
											'destCustomerStock',
											scope.row,
											scope.column,
											item.disabled
										)
									"
									v-for="item in customeStockArrylistInner[
										scope.$index
									]"
								></el-option>
							</el-select>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="期望交期"
						prop="deliveryDate"
						width="121"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>期望交期
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isDeliveryDate">{{
								scope.row.deliveryDate
							}}</span>
							<el-date-picker
								:clearable="false"
								:disabled="isEdit"
								@change="
									detailsCom(
										scope.row.deliveryDate,
										'deliveryDate',
										scope.row,
										scope.column
									)
								"
								class="lead-time-style"
								format="YYYY-MM-DD"
								placeholder="年-月-日"
								type="date"
								v-if="scope.row.isDeliveryDate"
								v-model="scope.row.deliveryDate"
								value-format="YYYY-MM-DD"
							></el-date-picker>
						</template>
					</el-table-column>
					<el-table-column
						align="left"
						label="备注"
						prop="remarks"
						width="280"
					>
						<template #header>
							<span
								class="iconfont icon-bianji1 iconfont-mg"
							></span
							>备注
						</template>
						<template #default="scope">
							<span v-if="!scope.row.isRemarks">{{
								scope.row.remarks
							}}</span>
							<div
								:class="{ 'is-disabled': isEdit }"
								class="el-input click-cell-ipt"
								v-if="scope.row.isRemarks"
							>
								<input
									:disabled="isEdit"
									:id="'remarks' + scope.$index"
									autocomplete="off"
									class="el-input__inner click-cell-ipt"
									placeholder="请输入"
									v-model.lazy="scope.row.remarks"
								/>
							</div>
						</template>
					</el-table-column>
				</el-table>
			</div>
		</div>
		<!-- 选择下推单据 -->
		<el-dialog
			title="选择下推单据"
			top="15%"
			v-model="dialogxt"
			width="20%"
		>
			<el-radio-group v-model="pushdownVal">
				<el-radio
					:key="item.id"
					:label="item.id"
					:value="item.id"
					v-for="item in pushDownList"
					>{{ item.value }}</el-radio
				>
			</el-radio-group>
			<template #footer>
				<span class="dialog-footer">
					<el-button @click="dialogxt = false" size="small"
						>取 消</el-button
					>
					<el-button
						@click="sumitPushdown(pushdownVal)"
						size="small"
						type="primary"
						>确 定</el-button
					>
				</span>
			</template>
		</el-dialog>
		<!-- 选择上下查单据 -->
		<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 examineTop from '@/components/examineTop/index.vue';

import { mapState, mapActions } from 'vuex';
import { Decimal } from 'decimal.js';
import { countMethodsUnitNumber } from '@/utils/count.js';
import { getStaffListApiUser } from '@/utils/api.js';
import { orderCopy } from '@/utils/takeMethods';
import { removeChildren, splitJointList } from '@/utils/pubulic';
import {
	pricePrecisionNumberCom,
	issSureUpDownSearch,
	getNowTimeGlobal,
	issCopyMaterialSkuGetData,
	issSaveSubmitGetData,
	issMaterSkuSearchGetData,
	issChangeStockOrgClear,
	issMaterialSkuGetData,
	issUpDownInsertRow,
	getArrayName,
	filterMaterialData,
} from '@/utils/takeMethods.js';
import {
	issueBtnAdd,
	issueBtnEdit,
	issStatusForm,
	issDefaultTableInfo,
	storeObj,
	optionProps,
} from '@/utils/variable.js';
export default {
	name: 'ActiveIssue',
	components: {
		examineTop,
	},
	data() {
		return {
			salePrecisionNumber: [],
			isPrecision: [],
			unitData: [],
			isCount: [],
			isDisableTop: false,
			statusForm: JSON.parse(JSON.stringify(issStatusForm)),
			baseInfoForm: JSON.parse(JSON.stringify(issDefaultTableInfo)),
			addRow: {},
			storeObj: JSON.parse(JSON.stringify(storeObj)),
			optionProps: JSON.parse(JSON.stringify(optionProps)),
			loading: false, // loding
			isEdit: true, // 禁止编辑
			isSetlementDifference: true,
			selectRowIndexArr: [],
			btnType: JSON.parse(JSON.stringify(issueBtnAdd)), // 不需要的按钮
			saleUnits: [],
			currRow: '', // 表格 编辑 当前行
			currColumn: '', // 表格 编辑 当前列
			selectRowIndex: 0, // 选择的行
			heightNum: 0, // 容器高度
			multipleSelection: [], // 选择的行
			pushdownVal: null, // 下推选择
			dialogxt: false, // 选择下推单据弹框显示
			OrdedetailIds: [], // 勾选的明细id集合
			pushDownList: [], // 下推集合
			dialogCX: false, // 上下查弹框控制
			upOrDownList: [], // 上查下查弹窗可选数据
			OrderNoNameslist: [], // 上查下查的订单号
			OrderNoNameStr: '', // 上查下查的订单号str
			CXaction: '', // 判断是上查还是下查
			CXttile: '', // 查询弹框的名称
			CXcheckVal: '', // 选择的查询radio
			saveIds: '',
			isPushDownOrg: false,
			isPushDownOrgList: [false],
			detailBtn: [],
			customeStockArrylistInner: [], // 调入客户仓库
			customeStockArrylist: [], // 调出客户仓库集合
			matterallCodelist: [], // 物料下拉数据
			specificationalllist: [], // 规格型号（sku）下拉数据
			tableHeight: 0,
			isOrder: true,
			isLoading: false,
			timer: null,
			recordIndex: '',
		};
	},
	methods: {
		// 初始化
		Init() {
			let vuexKey = ['customer', 'unitAll'];
			let setVuexData = ['setCustomer', 'setAllUnit'];
			let requestQueryUrl = [
				'SysConfig/GetCustomer',
				'SysConfig/GetUnitAllProperty',
			];
			let resDataQuery = [['deCustmers', 'custmers'], 'saleUnits'];
			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;
									this[setVuexData[ind]](
										this.statusForm[resDataQuery[ind]]
									);
								} else {
									resDataQuery[ind].forEach((ele, index) => {
										this.statusForm[
											resDataQuery[ind][index]
										] = r.data;
										this[setVuexData[ind]](
											this.statusForm[
												resDataQuery[ind][index]
											]
										);
									});
								}
								// 单位
								if (vuexKey[ind] == 'unitAll') {
									this.unitData =
										this.statusForm[resDataQuery[ind]];
								}
							}
						});
				}
			});

			// 公共人员接口 - 'SysConfig/GetUserList','testUserPerson','setGetAllUserList' 'getAllUserList'
			if (this.getAllUserList && this.getAllUserList.length > 0) {
				this.statusForm.salePerson = this.getAllUserList;
			} else {
				getStaffListApiUser().then((r) => {
					r.status == 200 ? this.setGetAllUserList(r.data) : false;
					r.status == 200
						? (this.statusForm.salePerson = r.data)
						: (this.statusForm.salePerson = []);
				});
			}

			// 枚举 - 调拨类型、订单状态、调出类型
			if (
				this.stktranStatus &&
				JSON.stringify(this.stktranStatus) !== '{}'
			) {
				this.statusForm.allocatingType = JSON.parse(
					JSON.stringify(this.stktranStatus.allocatingType)
				);
				this.statusForm.billType = JSON.parse(
					JSON.stringify(this.stktranStatus.billType)
				);
				this.statusForm.documentStatus = JSON.parse(
					JSON.stringify(this.stktranStatus.documentStatus)
				);
			} else {
				this.$http
					.showLoading(false)
					.get('StktransferOut/GetStatus')
					.then((req) => {
						if (req.status == 200) {
							this.setStktranStatus(req.data);
							this.statusForm.allocatingType =
								req.data.allocatingType; // 调拨类型
							this.statusForm.billType = req.data.billType; // 分步式调出单类型
							this.statusForm.documentStatus =
								req.data.documentStatus; // 订单状态
						}
					});
			}
			var windowHeight = document.documentElement.clientHeight;
			this.heightNum = windowHeight - 102;
			this.tableHeight = windowHeight - 444;
			this.baseInfoForm.date = this.getNowTime();
			this.baseInfoForm.billTypeId = 'a';
			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];
				}
				this.addRow.stockReceiveQty = '0';
			}
			if (
				this.$route.query.type === 'add' ||
				this.$route.query.type === 'copy'
			) {
				this.baseInfoForm.documentStatus = 'a';
				this.isEdit = false;
				this.baseInfoForm.stockOrgId =
					this.$store.state && this.$store.state.org
						? this.$store.state.org.orgId
						: null;
				if (this.$route.query.type === 'copy') {
					this.getPurChaseDetails();
				}
				if (this.$route.query.type === 'add') {
					this.baseInfoForm.details.forEach((el, ind) => {
						this.baseInfoForm.details[ind].stockReceiveQty = 0;
					});
					this.$http
						.showLoading(false)
						.get(
							'SysConfig/GetWarehouse/' +
								this.baseInfoForm.stockOrgId
						)
						.then((res) => {
							if (res.status === 200) {
								this.statusForm.warehouse = res.data;
							}
						});
				}
			}
			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();
			}
			//   if (this.$store.state && this.$store.state.org && this.$store.state.org.orgId) {
			//     this.getStaffListCom(this.$store.state.org.orgId)
			//   }
		},
		getName(arr, val) {
			return getArrayName(arr, val);
		},
		// 复制粘贴
		pasteExcel(event, index, scope, key) {
			let pastedText = undefined; // 定义变量
			let isPasteOneCol = false; // 锁
			let oldVal = this.storeObj.storeVal; // 记录当前的值
			if (event.clipboardData && event.clipboardData.getData) {
				pastedText = event.clipboardData.getData('Text');
			} else {
				pastedText = event.originalEvent.clipboardData.getData('Text');
			}
			let rows = pastedText.split('\r\n'); // 分割字符
			rows.forEach((el) => {
				if (el.indexOf('\t') !== -1) {
					isPasteOneCol = true;
				}
			});
			setTimeout(async () => {
				if (isPasteOneCol) {
					this.baseInfoForm.details[index][key] = oldVal;
					this.$message.error({
						message: '请选择一列复制粘贴!',
						showClose: true,
					});
					return;
				}
				let recordAddIndex = index; // 记录行
				for (let i = 0; i < rows.length; i++) {
					if (rows[i] !== '') {
						if (key === 'materialId' || key === 'specificationId') {
							let key = scope.column.property;
							if (key === 'materialId') {
								this.matterCodeChange(
									rows[i],
									recordAddIndex,
									'getDate'
								);
							}
							if (key === 'specificationId') {
								this.skuCodeChange(
									rows[i],
									recordAddIndex,
									'getDate'
								);
							}
							recordAddIndex++;
						} else if (
							key === 'salOrderBillNo' ||
							key === 'parentOrderBillNo'
						) {
							if (
								this.baseInfoForm.details[recordAddIndex] ===
								undefined
							) {
								return;
							} else {
								let key = scope.column.property;
								this.baseInfoForm.details[recordAddIndex][key] =
									rows[i];
							}
							recordAddIndex++;
						} else if (key === 'qty') {
							if (
								this.baseInfoForm.details[recordAddIndex] ===
								undefined
							) {
								return;
							} else {
								let key = scope.column.property;
								let num = rows[i] * 1;
								if (!isNaN(num)) {
									this.baseInfoForm.details[recordAddIndex][
										key
									] = rows[i];
									this.baseInfoForm.details[
										recordAddIndex
									].remainReceiveQty =
										Number(
											this.baseInfoForm.details[
												recordAddIndex
											][key]
										) -
										Number(
											this.baseInfoForm.details[
												recordAddIndex
											].stockReceiveQty
										);
								} else {
									this.$message.error({
										message:
											'粘贴内容有误,请重新选择复制内容!',
										showClose: true,
									});
									return;
								}
							}
							if (key === 'qty') {
								if (
									this.baseInfoForm.details[recordAddIndex]
										.unitId
								) {
									this.getCountUnitCom(
										recordAddIndex,
										this.baseInfoForm.details[
											recordAddIndex
										][key],
										this.baseInfoForm.details[
											recordAddIndex
										][key],
										true,
										'qty'
									);
								} else {
									this.baseInfoForm.details[
										recordAddIndex
									].qty = Decimal(
										this.baseInfoForm.details[
											recordAddIndex
										].qty
									).toFixed(0, Decimal.ROUND_HALF_UP);
								}
							}
							recordAddIndex++;
						}
					}
				}
			}, 0);
		},
		// 调入仓库改变
		stockInChange() {
			this.$http
				.showLoading(false)
				.get('SysConfig/GetWarehouse/' + this.baseInfoForm.stockinOrgId)
				.then((res) => {
					if (res.status === 200) {
						this.statusForm.warehouseInset = res.data;
					}
				});
		},
		// 调出仓库改变
		stockOutChange() {
			this.$http
				.showLoading(false)
				.get('SysConfig/GetWarehouse/' + this.baseInfoForm.stockOrgId)
				.then((res) => {
					if (res.status === 200) {
						this.statusForm.warehouse = res.data;
					}
				});
		},
		clearCom(value, key, row, column) {
			if (value === '') {
				if (key === 'srcCustomer') {
					this.baseInfoForm.details[row.index].srcCustomerStock = '';
				}
				if (key === 'destCustomer') {
					this.baseInfoForm.details[row.index].destCustomerStock = '';
				}
			}
		},
		saleRexgu(val, key) {
			if (key === 'billNo') {
				if (val) {
					this.baseInfoForm.billNo = val
						.toString()
						.replace(/[^A-Za-z0-9\\-]/g, '');
				}
			}
		},
		verificationNum(val, index, key, isPrecision) {
			this.baseInfoForm.details[index].materialId
				? false
				: (isPrecision[index] = true);
			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) {
				this.baseInfoForm.details[index][key] = pricePrecisionNumberCom(
					this.baseInfoForm,
					this.salePrecisionNumber,
					this.isPrecision,
					index,
					key,
					val
				);
			}
		},
		async getPurChaseDetails(res) {
			if (res) {
				this.isLoading = true;
				this.baseInfoForm = res;
				this.baseInfoForm.documentStatus = 'a';
				this.baseInfoForm.id = 0;
				this.baseInfoForm.billTypeId = 'a';
				this.isPushDownOrg = res.isPushDown;
				await this.$http
					.showLoading(false)
					.get(
						'SysConfig/GetWarehouse/' +
							this.baseInfoForm.stockinOrgId
					)
					.then((res) => {
						if (res.status === 200) {
							this.statusForm.warehouseInset = res.data;
							this.statusForm.warehouseInset = splitJointList(
								this.baseInfoForm.details,
								this.statusForm.warehouseInset,
								'inStockList'
							);
							this.statusForm.warehouseInset =
								this.statusForm.warehouseInset.filter(Boolean);
						}
					});
				await this.$http
					.showLoading(false)
					.get(
						'SysConfig/GetWarehouse/' + this.baseInfoForm.stockOrgId
					)
					.then((res) => {
						if (res.status === 200) {
							this.statusForm.warehouse = res.data;
							this.statusForm.warehouse = splitJointList(
								this.baseInfoForm.details,
								this.statusForm.warehouse,
								'outStockList'
							);
							this.statusForm.warehouse =
								this.statusForm.warehouse.filter(Boolean);
						}
					});
				await this.getMaterialCustomerDataAll();
				this.baseInfoForm.details.forEach((el, ind) => {
					this.isPushDownOrgList[ind] = el.parentOrderId
						? true
						: false;
					this.getCountUnitCom(
						ind,
						this.baseInfoForm.details[ind].qty,
						this.baseInfoForm.details[ind].qty,
						true,
						'qty'
					);
					this.getCountUnitCom(
						ind,
						this.baseInfoForm.details[ind].parentOrderNumber,
						this.baseInfoForm.details[ind].parentOrderNumber,
						true,
						'parentOrderNumber'
					);
					this.baseInfoForm.details[ind].isSrcStock = false;
					this.baseInfoForm.details[ind].isDestStock = false;
					// this.matterCodeChange(el.materialNumber, ind, 'getDate')
					this.baseInfoForm.details[ind].materialId = el.materialId;
					this.baseInfoForm.details[ind].specificationId =
						el.materialId;
					this.baseInfoForm.details[ind].isDisabled = false;
					this.baseInfoForm.details[ind].isCusHouse = true;
					this.baseInfoForm.details[ind].id = 0;
					this.baseInfoForm.details[ind].fid = 0;
					if (!this.baseInfoForm.details[ind].stockReceiveQty) {
						this.baseInfoForm.details[ind].stockReceiveQty = 0;
					}
					if (this.baseInfoForm.details[ind].srcStockId) {
						this.baseInfoForm.details[ind].isSrcStock = true;
					} else {
						this.baseInfoForm.details[ind].isSrcStock = false;
					}
					if (this.baseInfoForm.details[ind].destStockId) {
						this.baseInfoForm.details[ind].isDestStock = true;
					}
					// if (this.baseInfoForm.details[ind].srcCustomer && this.baseInfoForm.stockOrgId) {
					//   this.getInnerOutCustomerStoreCom('out', ind, 'inner')
					// }
					// if (this.baseInfoForm.details[ind].destCustomer && this.baseInfoForm.stockinOrgId) {
					//   this.getInnerOutCustomerStoreCom('inner', ind, 'inner')
					// }
					if (!this.baseInfoForm.details[ind].stockReceiveQty) {
						this.baseInfoForm.details[ind].stockReceiveQty = 0;
					}
					if (this.baseInfoForm.details[ind].qty) {
						this.baseInfoForm.details[ind].remainReceiveQty =
							Number(this.baseInfoForm.details[ind].qty) -
							Number(
								this.baseInfoForm.details[ind].stockReceiveQty
							);
					}
					if (el.srcStockId) {
						let rowObject = this.statusForm.warehouse.filter(
							(it) => it.id === el.srcStockId
						);
						el.isOutCustomer =
							rowObject.length > 0
								? !rowObject[0].customerWarehouseTag
								: true;
					} else {
						el.isOutCustomer = true;
					}
					if (el.destStockId) {
						let rowObject1 = this.statusForm.warehouseInset.filter(
							(it) => it.id === el.destStockId
						);
						el.isInnerCustomer =
							rowObject1.length > 0
								? !rowObject1[0].customerWarehouseTag
								: true;
					}
				});
				if (!this.baseInfoForm.date) {
					this.baseInfoForm.date = this.getNowTime();
				}
				this.isLoading = false;
			} else {
				this.statusForm.settlementOrgList = this.orgIdArr;
				this.isLoading = true;
				this.$http
					.showLoading(false)
					.post('StktransferOut/GetInfo/' + this.$route.query.id)
					.then(async (req) => {
						if (req.status == 200) {
							this.saveIds = req.data.id;
							this.baseInfoForm = req.data;
							if (this.$route.query.reversal) {
								this.baseInfoForm.details =
									this.baseInfoForm.details.reverse();
							}
							this.baseInfoForm.billTypeId = 'a';
							this.isPushDownOrg = req.data.isPushDown;

							if (
								this.baseInfoForm.documentStatus === 'a' ||
								this.baseInfoForm.documentStatus === 'd'
							) {
								this.isEdit = false;
							} else {
								this.isEdit = true;
							}
							if (this.baseInfoForm.billNo) {
								this.isOrder = false;
							}
							if (this.$route.query.type === 'copy') {
								let spliceList = [];
								this.baseInfoForm.details.forEach(
									(element, index) => {
										if (
											this.$route.query.detailsIds.indexOf(
												element.id.toString()
											) !== -1
										) {
											spliceList.push(
												this.baseInfoForm.details[index]
											);
										}
									}
								);
								this.baseInfoForm.details = spliceList;
							}
							await this.$http
								.showLoading(false)
								.get(
									'SysConfig/GetWarehouse/' +
										this.baseInfoForm.stockinOrgId
								)
								.then((res) => {
									if (res.status === 200) {
										this.statusForm.warehouseInset =
											res.data;
										this.statusForm.warehouseInset =
											splitJointList(
												this.baseInfoForm.details,
												this.statusForm.warehouseInset,
												'inStockList'
											);
									}
								});
							await this.$http
								.showLoading(false)
								.get(
									'SysConfig/GetWarehouse/' +
										this.baseInfoForm.stockOrgId
								)
								.then((res) => {
									if (res.status === 200) {
										this.statusForm.warehouse = res.data;
										this.statusForm.warehouse =
											splitJointList(
												this.baseInfoForm.details,
												this.statusForm.warehouse,
												'outStockList'
											);
									}
								});
							await this.getMaterialCustomerDataAll();
							this.baseInfoForm.details.forEach((el, ind) => {
								this.isPushDownOrgList[ind] = el.parentOrderId
									? true
									: false;
								// this.matterCodeChange(el.materialNumber, ind, 'getDate')
								this.baseInfoForm.details[ind].materialId =
									el.materialId;
								this.baseInfoForm.details[ind].specificationId =
									el.materialId;
								this.baseInfoForm.details[
									ind
								].isDisabled = false;
								this.baseInfoForm.details[
									ind
								].isCusHouse = true;
								if (
									!this.baseInfoForm.details[ind]
										.stockReceiveQty
								) {
									this.baseInfoForm.details[
										ind
									].stockReceiveQty = 0;
								}
								// if (this.baseInfoForm.details[ind].srcCustomer && this.baseInfoForm.stockOrgId) {
								//   this.getInnerOutCustomerStoreCom('out', ind, 'inner')
								// }
								// if (this.baseInfoForm.details[ind].destCustomer && this.baseInfoForm.stockinOrgId) {
								//   this.getInnerOutCustomerStoreCom('inner', ind, 'inner')
								// }
								if (
									!this.baseInfoForm.details[ind]
										.stockReceiveQty
								) {
									this.baseInfoForm.details[
										ind
									].stockReceiveQty = 0;
								}
								if (this.baseInfoForm.details[ind].qty) {
									this.baseInfoForm.details[
										ind
									].remainReceiveQty =
										Number(
											this.baseInfoForm.details[ind].qty
										) -
										Number(
											this.baseInfoForm.details[ind]
												.stockReceiveQty
										);
								}

								let rowObject =
									this.statusForm.warehouse.filter(
										(it) => it.id === el.srcStockId
									);
								el.isOutCustomer =
									rowObject.length > 0
										? !rowObject[0].customerWarehouseTag
										: true;

								let rowObjectI =
									this.statusForm.warehouseInset.filter(
										(it) => it.id === el.destStockId
									);
								el.isInnerCustomer =
									rowObjectI.length > 0
										? !rowObjectI[0].customerWarehouseTag
										: true;

								el.isSalOrderBillNo = false;
								el.isParentOrderBillNo = false;
								el.isMaterialId = false;
								el.isSpecificationId = false;
								el.isQty = false;
								el.isSrcStockId = false;
								el.isSrcCustomer = false;
								el.isSrcCustomerStock = false;
								el.isDestStockId = false;
								el.isDestCustomer = false;
								el.isDestCustomerStock = false;
								el.isDeliveryDate = false;
								el.isRemarks = false;
							});
							if (this.$route.query.type === 'copy') {
								this.detailBtn = [];
								this.baseInfoForm.billNo = '';
								this.baseInfoForm.id = 0;
								this.isEdit = false;
								this.baseInfoForm.isPushDown = false;
								this.isPushDownOrg = false;
								this.baseInfoForm.details.forEach((el, ind) => {
									this.isPushDownOrgList[ind] = false;
									this.getCountUnitCom(
										ind,
										this.baseInfoForm.details[ind].qty,
										this.baseInfoForm.details[ind].qty,
										true,
										'qty'
									);
									this.getCountUnitCom(
										ind,
										this.baseInfoForm.details[ind]
											.parentOrderNumber,
										this.baseInfoForm.details[ind]
											.parentOrderNumber,
										true,
										'parentOrderNumber'
									);
									el.id = 0;
									el.fid = 0;
									el.parentOrderId = null;
									el.stockReceiveQty = 0;
									if (this.baseInfoForm.details[ind].qty) {
										this.baseInfoForm.details[
											ind
										].remainReceiveQty =
											Number(
												this.baseInfoForm.details[ind]
													.qty
											) -
											Number(
												this.baseInfoForm.details[ind]
													.stockReceiveQty
											);
									} else {
										this.baseInfoForm.details[
											ind
										].remainReceiveQty = '';
									}
									this.baseInfoForm.details[
										ind
									].parentOrderBillNo = '';
									this.baseInfoForm.details[
										ind
									].parentOrderId = '';
									this.baseInfoForm.details[
										ind
									].parentOrderNumber = '';
									this.baseInfoForm.details[
										ind
									].parentOrderType = '';
								});
								this.baseInfoForm.documentStatus = 'a';
								this.isOrder = true;
							}
							this.isLoading = false;
						}
						if (
							this.baseInfoForm.date == '' ||
							this.baseInfoForm.date == null ||
							this.baseInfoForm.date == undefined
						) {
							this.baseInfoForm.date = this.getNowTime();
						}
					});
			}
		},
		// 详情 - 克隆 - 下推进入 一次性获取物料编码 + 客户仓库数据
		async getMaterialCustomerDataAll() {
			let materQuery = this.baseInfoForm.details.map((it) => {
				return it.materialNumber;
			});
			let customerQuery = [];
			let customerListIndex = [];
			let customerQueryInner = [];
			let customerListIndexInner = [];
			this.baseInfoForm.details.forEach((el, ind) => {
				if (el.srcCustomer) {
					customerQuery.push(el.srcCustomer);
					customerListIndex.push(ind);
				}
				if (el.destCustomer) {
					customerQueryInner.push(el.destCustomer);
					customerListIndexInner.push(ind);
				}
			});
			let _result = await this.matterCodeChangeAll(
				materQuery,
				'Number',
				this.baseInfoForm.stockOrgId
			);
			let _resultHouse = await this.getCustmerStoreAll(
				customerQuery,
				this.baseInfoForm.stockOrgId
			);
			let _resultHouseInner = await this.getCustmerStoreAll(
				customerQueryInner,
				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;
						}
					});
				}
				if (customerListIndexInner.length > 0) {
					customerListIndexInner.forEach((el) => {
						if (el == index) {
							this.customeStockArrylistInner[index] =
								_resultHouseInner;
						}
					});
				}
				this.matterallCodelist[index].forEach((ele) => {
					this.baseInfoForm = issMaterSkuSearchGetData(
						this.baseInfoForm,
						ele,
						index
					);
				});
			});
		},
		// 获取所有客户仓库信息
		async getCustmerStoreAll(customerQuery, id) {
			if (customerQuery.length > 0) {
				return this.$http
					.post('SysConfig/GetCustomerStockList', {
						customerIds: customerQuery,
						orgId: id,
					})
					.then((res) => {
						if (res.status === 200) {
							return res.data;
						} else {
							return [];
						}
					});
			} 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 [];
					}
				});
		},
		// 订单号 复制按钮
		saleOrderCopy() {
			orderCopy();
		},
		// 是否211、赠品
		isCheckBox(val, index, key) {
			this.baseInfoForm.details[index][key] = val;
		},
		// 匹配物料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) {
						return res.data;
					} else {
						return [];
					}
				});
		},
		// 获取物料编码信息
		async matterCodeChange(val, ind, type) {
			if (val && this.baseInfoForm.stockOrgId) {
				if (val.indexOf(' ') == -1) {
					let matterDate = await this.backMaterSkuMethods(
						val,
						'Number',
						this.baseInfoForm.stockOrgId
					);
					this.matterallCodelist[ind] = matterDate;
					this.specificationalllist[ind] = matterDate;
					if (type === 'getDate') {
						if (this.baseInfoForm.details[ind] !== undefined) {
							this.matterallCodelist[ind].forEach((el) => {
								this.baseInfoForm = issMaterSkuSearchGetData(
									this.baseInfoForm,
									el,
									ind
								);
							});
						}
					}
				}
			}
		},
		// 获取型号SKU信息
		async skuCodeChange(val, ind) {
			if (val && this.baseInfoForm.stockOrgId) {
				if (val.indexOf(' ') == -1) {
					let matterDate = await this.backMaterSkuMethods(
						val,
						'Specifications',
						this.baseInfoForm.stockOrgId
					);
					this.matterallCodelist[ind] = matterDate;
					this.specificationalllist[ind] = matterDate;
					if (this.baseInfoForm.details[ind] !== undefined) {
						this.matterallCodelist[ind].forEach((el) => {
							this.baseInfoForm = issMaterSkuSearchGetData(
								this.baseInfoForm,
								el,
								ind
							);
						});
					}
				}
			}
		},
		// 单据头公共fun
		purchaseCom(value, key, type) {
			if (value && key) {
				this.baseInfoForm[key] = value;
				if (key === 'address') {
					this.baseInfoForm[key] = value;
				}
			} else {
				if (key === 'address') {
					this.baseInfoForm[key] = '';
				} else {
					delete this.baseInfoForm[key];
				}
			}
			if (key === 'stockOrgId') {
				this.customeStockArrylist[0] = [];
				this.customeStockArrylistInner[0] = [];
				this.baseInfoForm = issChangeStockOrgClear(
					this.baseInfoForm,
					this.addRow
				);
			}
			if (key === 'stockinOrgId') {
				this.baseInfoForm.details.forEach((el, ind) => {
					this.baseInfoForm.details[ind].destStockId = '';
					this.baseInfoForm.details[ind].destCustomer = '';
					this.baseInfoForm.details[ind].destCustomerStock = '';
				});
				this.customeStockArrylistInner.forEach((el, ind) => {
					this.customeStockArrylistInner[ind] = [];
				});
			}
			if (type) {
				this.$refs.cascader.togglePopperVisible(); // 选择之后将下拉框界面收起
			}
		},
		// 详情公共fun
		detailsCom(value, key, row, column, disable, customerWarehouseTag) {
			if (this.baseInfoForm.details[row.index].unitId) {
				let tempList = this.unitData.filter(
					(it) =>
						it.id === this.baseInfoForm.details[row.index].unitId
				);
				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.storeVal = value;
				this.storeObj.storekey = key;
				this.storeObj.storeRow = row.index;
				this.storeObj.storeCol = column.index;
				if (key === 'materialId' || key === 'specificationId') {
					this.matterallCodelist[row.index].forEach((el) => {
						if (value === el.id) {
							let result = issMaterialSkuGetData(
								this.baseInfoForm,
								el,
								this.currRow,
								this.unitData,
								this.isPrecision,
								this.salePrecisionNumber
							);
							this.baseInfoForm = result.baseInfoForm;
							this.isPrecision = result.isPrecision;
							this.salePrecisionNumber =
								result.salePrecisionNumber;
							this.baseInfoForm.details[row.index].qty = '0';
							this.baseInfoForm.details[
								row.index
							].remainReceiveQty = '0';

							this.baseInfoForm.details[
								row.index
							].isMaterialId = false;
							this.baseInfoForm.details[
								row.index
							].isSpecificationId = false;
							document.getElementById(key + row.index).blur();
						}
					});
				} else {
					this.baseInfoForm.details[this.currRow][key] = value;
				}
				if (key === 'srcCustomer') {
					if (value && this.baseInfoForm.stockOrgId) {
						this.baseInfoForm.details[row.index][key] = value;
						this.baseInfoForm.details[row.index].srcCustomerStock =
							'';
						this.getInnerOutCustomerStoreCom(
							'out',
							row.index,
							'out'
						);
					}
				}
				if (key === 'destCustomer') {
					if (value && this.baseInfoForm.stockinOrgId) {
						this.baseInfoForm.details[row.index][key] = value;
						this.baseInfoForm.details[row.index].destCustomerStock =
							'';
						this.getInnerOutCustomerStoreCom(
							'inner',
							row.index,
							'out'
						);
					}
				}
				if (key === 'deliveryDate') {
					let comparD = this.compareDate(
						this.baseInfoForm.date,
						value
					);
					if (comparD == false) {
						this.$message.error({
							message: '期望交期不能大于下单日期,请重新选择',
							showClose: true,
						});
						this.baseInfoForm.details[row.index].deliveryDate = '';
					}
				}
				if (key === 'qty') {
					this.verificationNum(
						this.baseInfoForm.details[row.index][key],
						row.index,
						'qty',
						this.isPrecision
					);
					if (
						this.baseInfoForm.details[row.index][key] != '' &&
						this.baseInfoForm.details[row.index][key] != null &&
						this.baseInfoForm.details[row.index][key] != undefined
					) {
						if (!isNaN(this.baseInfoForm.details[row.index][key])) {
							if (!this.isCount[row.index]) {
								this.isCount[row.index] = 1;
							}
							if (
								this.baseInfoForm.details[row.index][
									key
								].indexOf('.') !== -1
							) {
								this.getCountUnitCom(
									row.index,
									this.baseInfoForm.details[row.index][key],
									this.baseInfoForm.details[row.index].qty,
									false,
									'qty',
									'copy'
								);
							} else {
								this.isCount[row.index] = 2;
							}
							if (
								this.baseInfoForm.details[row.index]
									.parentOrderNumber
							) {
								if (
									this.baseInfoForm.details[row.index].qty >
									this.baseInfoForm.details[row.index]
										.parentOrderNumber
								) {
									this.baseInfoForm.details[row.index].qty =
										this.baseInfoForm.details[
											row.index
										].parentOrderNumber;
								}
							}

							this.baseInfoForm.details[
								row.index
							].remainReceiveQty =
								Number(
									this.baseInfoForm.details[row.index].qty
								) -
								Number(
									this.baseInfoForm.details[row.index]
										.stockReceiveQty
								);
						}
					}
					if (this.baseInfoForm.details[row.index][key] == '') {
						this.baseInfoForm.details[
							row.index
						].remainReceiveQty = 0;
					}

					this.baseInfoForm.details[row.index][key] =
						this.valueRemoveZero(row, key);
					this.storeObj.storeVal =
						this.baseInfoForm.details[row.index][key];
				}
				if (key === 'srcStockId') {
					let rowObject = this.statusForm.warehouse.filter(
						(it) => it.id === value
					);
					this.baseInfoForm.details[row.index].isOutCustomer =
						rowObject.length > 0
							? !rowObject[0].customerWarehouseTag
							: true;
					this.baseInfoForm.details[row.index].srcCustomer = '';
					this.baseInfoForm.details[row.index].srcCustomerStock = '';
				}
				if (key === 'destStockId') {
					let rowObject = this.statusForm.warehouseInset.filter(
						(it) => it.id === value
					);
					this.baseInfoForm.details[row.index].isInnerCustomer =
						rowObject.length > 0
							? !rowObject[0].customerWarehouseTag
							: true;
					this.baseInfoForm.details[row.index].destCustomer = '';
					this.baseInfoForm.details[row.index].destCustomerStock = '';
				}
			}
		},
		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];
			}
		},
		// 日期比较
		compareDate(logintime, logouttime) {
			var arys1 = new Array();
			var arys2 = new Array();
			if (logintime != null && logouttime != null) {
				arys1 = logintime.split('-');
				var logindate = new Date(
					arys1[0],
					parseInt(arys1[1] - 1),
					arys1[2]
				);
				arys2 = logouttime.split('-');
				var logoutdate = new Date(
					arys2[0],
					parseInt(arys2[1] - 1),
					arys2[2]
				);
				if (logindate > logoutdate) {
					return false;
				} else {
					return true;
				}
			}
		},
		// 顶部公共按钮
		actionhandel(type) {
			this.isDisableTop = true;
			setTimeout(() => {
				this.isDisableTop = false;
			}, 2000);
			let ids = [];
			let detailsIds = [];
			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;
			if (type === 'up-check' || type === 'down-check') {
				if (this.multipleSelection.length == 0) {
					this.$message.error({
						message: '请先选择要查询的明细行!',
						showClose: true,
					});
					return;
				}
			}
			if (type === 'push-down' && this.multipleSelection.length == 0) {
				this.$message.error({
					message: '请先选择要下推的明细行!',
					showClose: true,
				});
				return;
			}
			if (type == 'add') {
				this.$router.push({
					path: '/warehouse/allocation/activeIssue',
					query: { type: 'add', id: '', sjtag: Math.random() * 36 },
				});
			}
			if (type === 'save') {
				this.saveSubmitDataCom(type);
			}
			if (type === 'submit') {
				this.saveSubmitDataCom(type);
			}
			if (type === 'revoke') {
				this.revokePageData(ids);
			}
			if (type === 'audit') {
				this.unAuditPageDataCom(ids, type);
			}
			if (type === 'de-approval') {
				this.unAuditPageDataCom(ids, type);
			}
			if (type === 'delet') {
				this.deleteOrder(ids);
			}
			if (type === 'close') {
				this.toolarFn('SalOrder/Close', newArry, detailsIds, type);
			}
			if (type === 'de-close') {
				this.toolarFn('SalOrder/Reclose', newArry, detailsIds, type);
			}
			if (type === 'push-down') {
				if (detailsIds.length > 0) {
					if (detailsIds.length <= 20) {
						if (this.baseInfoForm.documentStatus !== 'c') {
							this.$message.error({
								message:
									'单据状态错误，只能选择单据状态为已审核单据，请重新选择！',
								showClose: true,
							});
						} else {
							this.$http
								.showLoading(false)
								.get('StktransferOut/GetOrderType')
								.then((r) => {
									if (r.status == 200) {
										this.pushDownList = [];
										for (const key in r.data.orderType) {
											this.pushDownList.push({
												id: key,
												value: r.data.orderType[key],
											});
										}
									}
								});
							this.dialogxt = true;
						}
					} else {
						this.$message.error({
							message: '最多一次性下推二十条明细',
							showClose: true,
						});
					}
				} else {
					this.$message.error({
						message:
							'请先勾选明细,并确认勾选的信息是否有保存提交,只有有效明细信息才能下推',
						showClose: true,
					});
				}
			}
			// 上、下查
			if (type === 'up-check' || type === 'down-check') {
				let pathName =
					type === 'up-check'
						? 'StktransferOut/GetUpNumber'
						: 'StktransferOut/GetDownNumber';
				let msg =
					type === 'up-check'
						? '没有可上查的单据!'
						: '没有可下查的单据!';
				let msgT = type === 'up-check' ? '上查结果' : '下查结果';
				this.$http.post(pathName, { ids: detailsIds }).then((res) => {
					if (res.status === 200) {
						if (res.data.length === 0 || res.data === []) {
							this.$message.error({
								message: msg,
								showClose: true,
							});
						} else {
							this.upOrDownList = res.data;
							this.dialogCX =
								res.data && res.data.length > 0 ? true : false;
							this.CXttile = msgT;
							this.CXcheckVal =
								res.data && res.data.length === 1
									? res.data[0].orderType
									: null; //只有一个，就个默认值
						}
					}
				});
			}
		},
		// 审核 - 反审
		unAuditPageDataCom(ids, type) {
			let ifDoc = type === 'audit' ? 'b' : 'c';
			let ifInnerDoc = type === 'audit' ? 'c' : 'd';
			let pathName =
				type === 'audit'
					? 'StktransferOut/Check'
					: 'StktransferOut/NoCheck';
			let isNO = type === 'audit' ? true : false;
			let msg = type === 'audit' ? '审核成功!' : '反审成功!';
			let msgR =
				type === 'audit'
					? '只能审核处于审核中的单据!'
					: '只能反审核处于已审核的单据!';
			if (this.baseInfoForm.documentStatus == ifDoc) {
				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 = ifInnerDoc;
							this.isEdit = isNO;
							//   if (type === 'audit') {
							this.$http
								.showLoading(false)
								.post('StktransferOut/GetInfo/' + this.saveIds)
								.then((req) => {
									if (req.status == 200) {
										this.baseInfoForm =
											issSaveSubmitGetData(
												this.baseInfoForm,
												req
											);
									}
								});
							//   }
						} else {
							this.$message.error({
								message: r.data[0].msg,
								showClose: true,
							});
						}
					}
				});
			} else {
				this.$message.error({ message: msgR, showClose: true });
			}
		},
		// 撤消
		revokePageData(ids) {
			if (this.baseInfoForm.documentStatus == 'b') {
				this.$http
					.post('StktransferOut/Revoke', { ids: ids })
					.then((r) => {
						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: '只能撤销审核中的单据!',
					showClose: true,
				});
			}
		},
		// 保存、提交共公方法
		saveSubmitDataCom(type) {
			if (
				this.baseInfoForm.documentStatus == 'a' ||
				this.baseInfoForm.documentStatus == 'd'
			) {
				let pathName =
					type === 'save'
						? 'StktransferOut/Save'
						: 'StktransferOut/Commit';
				let msg = type === 'save' ? '保存成功!' : '提交成功!';
				let msgO =
					type === 'save'
						? '只能保存创建的单据!'
						: '只能提交创建或重新审核的单据!';
				filterMaterialData(this.baseInfoForm);
				this.$http.post(pathName, this.baseInfoForm).then((r) => {
					if (r.status == 200) {
						this.saveOrSubmitData(r);
						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) {
			if (r.data) {
				this.$http
					.showLoading(false)
					.post('StktransferOut/GetInfo/' + r.data.id)
					.then((req) => {
						if (req.status == 200) {
							this.baseInfoForm = issSaveSubmitGetData(
								this.baseInfoForm,
								req
							);
						}
					});
				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 = [];
			}
		},
		// 删除
		deleteOrder(ids) {
			if (ids.length > 0) {
				this.$http
					.post('StktransferOut/Delete', { ids: ids })
					.then((r) => {
						if (r.status === 200) {
							if (r.status == 200) {
								if (r.data[0].isSuccess == false) {
									this.$message.error({
										message: r.data[0].msg,
										showClose: true,
									});
								} else {
									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.error({
					message: '不能删除此单据!',
					showClose: true,
				});
			}
		},
		// 居右
		headerBg({ rowIndex, columnIndex }) {
			let arry = [];
			if (arry.indexOf(columnIndex) !== -1) {
				return `text-align:right!important;`;
			}
		},
		// 星星
		mustAfter(obj) {
			let arry = [3, 4, 7, 11, 14];
			if (arry.indexOf(obj.columnIndex) !== -1) {
				return 'must';
			}
		},
		// 处理失焦
		selectBlur() {
			let _this = this;
			_this.baseInfoForm.details.forEach((el) => {
				el.isSalOrderBillNo = false;
				el.isParentOrderBillNo = false;
				el.isMaterialId = false;
				el.isSpecificationId = false;
				el.isQty = false;
				el.isSrcStockId = false;
				el.isSrcCustomer = false;
				el.isSrcCustomerStock = false;
				el.isDestStockId = false;
				el.isDestCustomer = false;
				el.isDestCustomerStock = false;
				el.isDeliveryDate = false;
				el.isRemarks = false;
			});
		},
		// 插入的行
		getInsertInfo(data) {
			for (const key in this.addRow) {
				this.addRow[key] = '';
			}
			this.addRow.id = 0;
			this.addRow.stockReceiveQty = 0;
			this.addRow.isFree = false;
			this.addRow.isDisabled = false;
			let result = issUpDownInsertRow(
				data,
				this.baseInfoForm,
				this.customeStockArrylistInner,
				this.customeStockArrylist,
				this.matterallCodelist,
				this.specificationalllist,
				this.addRow
			);
			this.baseInfoForm = result.baseInfoForm;
			this.customeStockArrylistInner = result.customeStockArrylistInner;
			this.customeStockArrylist = result.customeStockArrylist;
			this.matterallCodelist = result.matterallCodelist;
			this.specificationalllist = result.specificationalllist;
			this.$nextTick(() => {
				this.$refs.multipleTable.$refs.bodyWrapper.scrollTop =
					this.$refs.multipleTable.$refs.bodyWrapper.scrollHeight;
			});
			this.selectBlur();
			this.$refs.multipleTable.clearSelection();
			this.multipleSelection = [];
			this.selectRowIndexArr = [];
		},
		// 向下复制行
		bottomCopyRow(data) {
			if (this.selectRowIndexArr.length > 0) {
				if (this.selectRowIndexArr.length == 1) {
					const tableArr = JSON.parse(
						JSON.stringify(
							this.baseInfoForm.details[this.selectRowIndex]
						)
					);
					let insertNum = this.selectRowIndex + 1;
					this.baseInfoForm.details.splice(insertNum, 0, tableArr);
					this.customeStockArrylistInner.splice(
						insertNum,
						0,
						this.customeStockArrylist[this.selectRowIndex]
					);
					this.customeStockArrylist.splice(
						insertNum,
						0,
						this.customeStockArrylist[this.selectRowIndex]
					);
					this.matterallCodelist.splice(
						insertNum,
						0,
						this.matterallCodelist[this.selectRowIndex]
					);
					this.specificationalllist.splice(
						insertNum,
						0,
						this.specificationalllist[this.selectRowIndex]
					);
					this.salePrecisionNumber.splice(
						insertNum,
						0,
						this.salePrecisionNumber[this.selectRowIndex]
					);
					this.isPrecision.splice(
						insertNum,
						0,
						this.isPrecision[this.selectRowIndex]
					);
					this.isCount.splice(
						insertNum,
						0,
						this.isCount[this.selectRowIndex]
					);
					this.baseInfoForm.details[insertNum].id = 0;
					this.$refs.multipleTable.clearSelection();
					this.selectBlur();
					this.multipleSelection = [];
					this.selectRowIndexArr = [];
					this.baseInfoForm.details[insertNum].parentOrderId = null;
					this.baseInfoForm.details[insertNum].parentOrderType = null;
					this.baseInfoForm.details[insertNum].id = 0;
					this.baseInfoForm.details[insertNum].fid = 0;
				} else {
					// 获取最后选择的行
					let lastIndex = -1;
					this.selectRowIndexArr.forEach((el) => {
						el.index > lastIndex ? (lastIndex = el.index) : false;
					});
					// 添加行
					this.selectRowIndexArr.forEach((el) => {
						el.id = 0;
						lastIndex = lastIndex + 1;
						this.baseInfoForm.details.splice(
							lastIndex,
							0,
							JSON.parse(JSON.stringify(el))
						);
						this.customeStockArrylistInner.splice(
							lastIndex,
							0,
							this.customeStockArrylist[el.index]
						);
						this.customeStockArrylist.splice(
							lastIndex,
							0,
							this.customeStockArrylist[el.index]
						);
						this.matterallCodelist.splice(
							lastIndex,
							0,
							this.matterallCodelist[el.index]
						);
						this.specificationalllist.splice(
							lastIndex,
							0,
							this.specificationalllist[el.index]
						);
						this.salePrecisionNumber.splice(
							lastIndex,
							0,
							this.salePrecisionNumber[el.index]
						);
						this.isPrecision.splice(
							lastIndex,
							0,
							this.isPrecision[el.index]
						);
						this.isCount.splice(
							lastIndex,
							0,
							this.isCount[el.index]
						);
						this.baseInfoForm.details[lastIndex].parentOrderId =
							null;
						this.baseInfoForm.details[lastIndex].parentOrderType =
							null;
						this.baseInfoForm.details[lastIndex].id = 0;
						this.baseInfoForm.details[lastIndex].fid = 0;
					});

					this.$refs.multipleTable.clearSelection();
					this.selectBlur();
					this.multipleSelection = [];
					this.selectRowIndexArr = [];
				}
			} else {
				this.$message.error({
					message: '请选择一行或多行复制!',
					showClose: true,
				});
			}
		},
		// 删除行
		selectDeleteRow(data) {
			if (
				this.baseInfoForm.details.length > 1 &&
				this.baseInfoForm.details.length !=
					this.multipleSelection.length
			) {
				if (this.selectRowIndexArr != 0) {
					// console.log('del',this.selectRowIndexArr)
					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.customeStockArrylistInner.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.skuCodeChange(el.specification, ind)
						this.baseInfoForm.details[ind].materialId =
							el.materialId;
						this.baseInfoForm.details[ind].specificationId =
							el.materialId;
					});
					this.$refs.multipleTable.clearSelection();
					this.selectBlur();
					this.multipleSelection = [];
					this.selectRowIndexArr = [];
					this.recordIndex = '';
				} else {
					this.$message.error({
						message: '请先选择要删除的行',
						showClose: true,
					});
				}
			} else {
				this.$message.error({
					message: '表格不能为空!',
					showClose: true,
				});
			}
		},
		// 单元格被点击
		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;
			}
			_that.storeObj.storeVal = row[_that.storeObj.storekey];

			if (_that.recordIndex != '' || _that.recordIndex == '0') {
				_that.baseInfoForm.details[
					_that.recordIndex
				].isSalOrderBillNo = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isParentOrderBillNo = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isMaterialId = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isSpecificationId = false;
				_that.baseInfoForm.details[_that.recordIndex].isQty = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isSrcStockId = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isSrcCustomer = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isSrcCustomerStock = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isDestStockId = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isDestCustomer = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isDestCustomerStock = false;
				_that.baseInfoForm.details[
					_that.recordIndex
				].isDeliveryDate = false;
				_that.baseInfoForm.details[_that.recordIndex].isRemarks = false;
			}

			switch (column.label) {
				case '销售订单号':
					row.isSalOrderBillNo = true;
					_that.recordIndex = row.index;
					break;
				case '组织间需求单':
					row.isParentOrderBillNo = 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.isQty = true;
					_that.recordIndex = row.index;
					break;
				case '调出仓库':
					row.isSrcStockId = true;
					_that.recordIndex = row.index;
					break;
				case '调出客户':
					row.isSrcCustomer = true;
					_that.recordIndex = row.index;
					break;
				case '调出客户仓库':
					row.isSrcCustomerStock = true;
					_that.recordIndex = row.index;
					break;
				case '调入仓库':
					row.isDestStockId = true;
					_that.recordIndex = row.index;
					break;
				case '调入客户':
					row.isDestCustomer = true;
					_that.recordIndex = row.index;
					break;
				case '调入客户仓库':
					row.isDestCustomerStock = true;
					_that.recordIndex = row.index;
					break;
				case '期望交期':
					row.isDeliveryDate = true;
					_that.recordIndex = row.index;
					break;
				case '备注':
					row.isRemarks = true;
					_that.recordIndex = row.index;
					break;
			}

			this.$nextTick(() => {
				let strArr = [
					'销售订单号',
					'组织间需求单',
					'物料编码',
					'规格型号(SKU)',
					'调出数量',
					'调出仓库',
					'调出客户',
					'调出客户仓库',
					'调入仓库',
					'调入客户',
					'调入客户仓库',
					'备注',
				];
				if (strArr.indexOf(column.label) !== -1) {
					document
						.getElementById(column.property + row.index)
						.focus();
				}
			});
		},
		// 批量填充
		copyCellcolumn() {
			let nextRow = this.storeObj.storeRow + 1;
			let storeKey = this.storeObj.storekey;
			if (
				this.storeObj.storekey !== 'destCustomerStock' &&
				this.storeObj.storekey !== 'srcCustomerStock'
			) {
				for (
					let i = nextRow;
					i < this.baseInfoForm.details.length;
					i++
				) {
					for (const key in this.baseInfoForm.details[i]) {
						if (key === storeKey) {
							if (
								key === 'materialId' ||
								key === 'specificationId'
							) {
								this.baseInfoForm.details[i][key] =
									this.storeObj.storeVal;
								this.matterallCodelist[i] =
									this.matterallCodelist[i - 1];
								this.specificationalllist[i] =
									this.specificationalllist[i - 1];
								this.salePrecisionNumber[i] =
									this.salePrecisionNumber[i - 1];
								this.isPrecision[i] = this.isPrecision[i - 1];
								this.isCount[i] = this.isCount[i - 1];
								this.matterallCodelist[i].forEach((el) => {
									if (
										el.id ===
										this.baseInfoForm.details[i - 1]
											.materialId
									) {
										this.baseInfoForm =
											issCopyMaterialSkuGetData(
												this.baseInfoForm,
												el,
												i
											);
									}
								});
							} else if (key === 'qty') {
								if (this.baseInfoForm.details[i].unitId) {
									this.getCountUnitCom(
										i,
										this.storeObj.storeVal,
										this.storeObj.storeVal,
										true,
										'qty',
										'copy'
									);
									this.baseInfoForm.details[
										i
									].remainReceiveQty =
										Number(
											this.baseInfoForm.details[i][key]
										) -
										Number(
											this.baseInfoForm.details[i]
												.stockReceiveQty
										);
								} else {
									this.baseInfoForm.details[i][key] = Decimal(
										this.storeObj.storeVal
									).toFixed(0, Decimal.ROUND_DOWN);
									this.baseInfoForm.details[
										i
									].remainReceiveQty =
										Number(
											this.baseInfoForm.details[i][key]
										) -
										Number(
											this.baseInfoForm.details[i]
												.stockReceiveQty
										);
								}
							} else if (key === 'srcStockId') {
								this.baseInfoForm.details[i][key] =
									this.storeObj.storeVal;
								this.baseInfoForm.details[i].srcCustomer = '';
								this.baseInfoForm.details[i].srcCustomerStock =
									'';
								let rowObject =
									this.statusForm.warehouse.filter(
										(it) =>
											it.id ===
											this.baseInfoForm.details[i]
												.srcStockId
									);
								this.baseInfoForm.details[i].isOutCustomer =
									!rowObject[0].customerWarehouseTag;
							} else if (key === 'destStockId') {
								this.baseInfoForm.details[i][key] =
									this.storeObj.storeVal;
								this.baseInfoForm.details[i].destCustomer = '';
								this.baseInfoForm.details[i].destCustomerStock =
									'';
								let rowObject1 =
									this.statusForm.warehouseInset.filter(
										(it) =>
											it.id ===
											this.baseInfoForm.details[i]
												.destStockId
									);
								this.baseInfoForm.details[i].isInnerCustomer =
									!rowObject1[0].customerWarehouseTag;
							} else {
								if (
									storeKey !== 'srcCustomer' &&
									storeKey === 'destCustomer'
								) {
									this.baseInfoForm.details[i][key] =
										this.storeObj.storeVal;
								}
							}
						}
						if (storeKey === 'srcCustomer') {
							if (this.baseInfoForm.details[i].isOutCustomer) {
								this.baseInfoForm.details[i].srcCustomer = '';
							} else {
								this.baseInfoForm.details[i].srcCustomer =
									this.storeObj.storeVal;
								this.baseInfoForm.details[i].srcCustomerStock =
									'';
							}
							if (
								this.baseInfoForm.details[i].srcCustomer &&
								this.baseInfoForm.stockOrgId
							) {
								this.getInnerOutCustomerStoreCom(
									'out',
									i,
									'out'
								);
							}
						}
						if (storeKey === 'destCustomer') {
							if (this.baseInfoForm.details[i].isInnerCustomer) {
								this.baseInfoForm.details[i].destCustomer = '';
							} else {
								this.baseInfoForm.details[i].destCustomer =
									this.storeObj.storeVal;
								this.baseInfoForm.details[i].destCustomerStock =
									'';
							}
							if (
								this.baseInfoForm.details[i].destCustomer &&
								this.baseInfoForm.stockinOrgId
							) {
								this.getInnerOutCustomerStoreCom(
									'inner',
									i,
									'out'
								);
							}
						}
					}
				}
			} else {
				this.$message.error({
					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();
		},
		// 禁止操作单元格
		disabledCellStyle({ row, rowIndex, column, columnIndex }) {
			row.index = rowIndex;
			column.index = columnIndex;
		},
		// 下推确定
		sumitPushdown(id) {
			if (id) {
				this.pushdownVal = id;
				let pathName = '';
				let routerName = '';
				if (this.pushdownVal === '21') {
					pathName = 'StktransferOut/PushDownPurchaseOrder';
					routerName = 'ActiveEntryOrder';
				}
				this.$http
					.post(pathName, { ids: this.OrdedetailIds })
					.then((res) => {
						if (res.status === 200) {
							this.dialogxt = false;
							this.$router.push({
								name: routerName,
								query: {
									type: 'pushDown',
									pushDownData: JSON.stringify(res.data),
									sjtag: Math.random() * 36,
								},
							});
							this.dialogxt = false;
						}
					});
			} else {
				this.$message.error({
					message: '请先选中在确认',
					showClose: true,
				});
			}
		},
		// 确定上下查
		submitCX() {
			if (this.CXcheckVal) {
				let ary = [];
				let pathName = issSureUpDownSearch(this.CXcheckVal);
				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,
				});
			}
		},
		// 获取调出 + 调入客户仓库
		getInnerOutCustomerStoreCom(type, index, isInner) {
			this.$http
				.showLoading(false)
				.post('SysConfig/GetCustomerStock', {
					customerId:
						type === 'out'
							? this.baseInfoForm.details[index].srcCustomer
							: this.baseInfoForm.details[index].destCustomer,
					orgId:
						type === 'out'
							? this.baseInfoForm.stockOrgId
							: this.baseInfoForm.stockinOrgId,
				})
				.then((r) => {
					if (r.status === 200) {
						if (type === 'inner') {
							this.customeStockArrylistInner[index] = r.data;
							if (isInner === 'inner') {
								this.customeStockArrylistInner = splitJointList(
									this.baseInfoForm.details,
									this.customeStockArrylistInner,
									'inCustomerStockList'
								);
							}
						} else {
							this.customeStockArrylist[index] = r.data;
							if (isInner === 'inner') {
								this.customeStockArrylist = splitJointList(
									this.baseInfoForm.details,
									this.customeStockArrylist,
									'outCustomerStockList'
								);
							}
						}
					}
				});
		},
		// 金额、单价计算
		getCountUnitCom(index, valueO, valueT, isInner, key, copy) {
			let tempList = this.unitData.filter(
				(it) => it.id === this.baseInfoForm.details[index].unitId
			);
			if (tempList.length > 0) {
				tempList[0].precision == 0
					? (this.isPrecision[index] = true)
					: (this.isPrecision[index] = false);
				tempList[0].precision == 0
					? (this.salePrecisionNumber[index] = 0)
					: (this.salePrecisionNumber[index] = tempList[0].precision);
				if (copy === 'copy') {
					if (tempList && tempList.length > 0) {
						tempList[0].roundoffType = 2;
					}
				}
				let result = countMethodsUnitNumber(
					tempList,
					valueO,
					valueT,
					this.isCount[index],
					this.salePrecisionNumber[index],
					isInner
				);
				this.baseInfoForm.details[index][key] = result.value;
				this.isCount[index] = result.isDefault;
			}
		},
		...mapActions({
			setAllUnit: 'storeData/setAllUnit',
			setCustomer: 'storeData/setCustomer',
			setStktranStatus: 'storeData/setStktranStatus',
			setGetAllUserList: 'storeData/setGetAllUserList',
		}),
	},
	computed: {
		...mapState({
			orgIdArr: (state) => state.user.orgIdArr,
			unitAll: (state) => state.storeData.allUnit,
			customer: (state) => state.storeData.customer,
			stktranStatus: (state) => state.storeData.stktranStatus,
			getAllUserList: (state) => state.storeData.getAllUserList,
		}),
		orgIdChange() {
			return this.$store.state && this.$store.state.org
				? this.$store.state.org.orgId
				: null;
		},
	},
	created: function () {
		this.Init();
	},
	watch: {
		orgIdChange: function () {
			//   if (this.$store.state && this.$store.state.org ? this.$store.state.org.orgId : null) {
			//     this.getStaffListCom(this.$store.state.org.orgId, 'y')
			//   }
		},
		'baseInfoForm.stockinOrgId': function () {
			if (
				this.baseInfoForm.stockinOrgId != null ||
				this.baseInfoForm.stockinOrgId != '' ||
				this.baseInfoForm.stockinOrgId != undefined
			) {
				this.$http
					.showLoading(false)
					.post('SysConfig/GetDept/' + this.baseInfoForm.stockinOrgId)
					.then((req) => {
						if (req.status == 200) {
							let deptArr = req.data;
							this.statusForm.saleParts = removeChildren(deptArr);
						}
					});
			}
			if (
				this.baseInfoForm.stockinOrgId === this.baseInfoForm.stockOrgId
			) {
				this.baseInfoForm.allocatingType = 'b';
			} else {
				if (
					this.baseInfoForm.stockinOrgId &&
					this.baseInfoForm.stockOrgId
				) {
					this.baseInfoForm.allocatingType = 'a';
				}
			}
		},
		'baseInfoForm.stockOrgId': function () {
			if (
				this.baseInfoForm.stockinOrgId === this.baseInfoForm.stockOrgId
			) {
				this.baseInfoForm.allocatingType = 'b';
			} else {
				if (
					this.baseInfoForm.stockinOrgId &&
					this.baseInfoForm.stockOrgId
				) {
					this.baseInfoForm.allocatingType = 'a';
				}
			}
		},
		'baseInfoForm.documentStatus'() {
			if (
				this.baseInfoForm.documentStatus === 'a' ||
				this.baseInfoForm.documentStatus === 'd'
			) {
				this.$topNavTagRename('新增分步式调出单');
				this.btnType = issueBtnAdd;
			} else {
				this.$topNavTagRename('编辑分步式调出单');
				this.btnType = issueBtnEdit;
			}
		},
	},
};
</script>
<style lang="scss" scoped>
@import '@/assets/style/saleOrder/saleOrderCommon.scss';
@import '@/assets/style/saleOrder/issueDetails.scss';
@import '@/assets/style/saleOrder/stepByStepCom.scss';
@import '@/assets/style/saleOrder/common.scss';
</style>
